Mac OS X 10.5 (Leopard) + VMWare Fusion + Mono = Bliss

by Jon 5/17/2008 8:13:00 AM

I have been using my new Mac Mini for less than 24 hours and it already looks like this:

In the screenshot I have VMWare Fusion with Unity enabled so that I have the Windows Vista Start menu (I can toggle off the Start menu's visibility from VMWare itself) and Internet Explorer 7. (I also have Visual Studio 2008 installed in that virtual machine). Next to Internet Explorer on the left is Finder which is showing a bunch of the apps I have installed, including most of the stuff at http://www.opensourcemac.org/. On the right I have MonoDevelop where I can write C# or VB.NET applications for the Mac, for Linux, or for Windows. And of course, down below I have the Dock popped up because that's where my arrow actually is.

I also, obviously, have an Ubuntu VM I can fire up any time I want if I want to test something in Linux. 

Mac OS X 10.5 (Leopard) comes with native X11, not out of the box but with the installer CD, and it's the first OS X build to do so (previous versions used or required XFree86).

This point in time is a particularly intriguing milestone date for the alignment of the moons and stars for blissful cross-platform development using the Mac as a central hub of all things wonderful:

 

  • X11 on Mac OS X 10.5
  • MonoDevelop 1.0 is generally gold (released, it's very nice)
  • System.Windows.Forms in Mono is API-complete
  • VMWare Fusion's Unity feature delivers jaw-dropping, seamless windowing integration between Windows XP / Vista and Mac OS X. And to make things even more wonderful, VMWare Fusion 2, which comes with experimental DirectX 9 support, will be a free upgrade.
  • For game developers, the Unity game engine is a really nice cross-platform game engine and development toolset. I have a couple buddies I'll be joining up with to help them make cross-platform games, something I always wanted to do. This as opposed to XNA, which doesn't seem to know entirely what it's doing and comes with a community framework that's chock full of vaporware. (But then, I still greatly admire XNA and hope to tackle XNA projects soon.)
  • The hackable iPhone (which I also got this week, hacked, and SSH'd into with rediculous ease), which when supplemented with the BSD core, is an amazing piece of geek gadgetry that can enable anyone to write mobile applications using open-source tools (I'd like to see Mono running on it). The amount of quality software written for the hacked iPhone is staggering, about as impressive as the amount of open source software written for the Mac itself. Judging by the quantity of cool installable software, I had no idea how commonplace hacked iPhones were.
  • Meanwhile, for legit game development, the Unity 3D game engine now supports the iPhone and iPod Touch (so that's where XNA got the Zune support idea!) and the iPhone SDK is no longer just a bunch of CSS hacks for Safari but actually binary compile tools.

 

WebKit Is Usable By End Users?

by Jon 5/3/2008 11:20:00 AM

I've been hearing a lot about WebKit being on the bleeding edge of staying up-to-date with performance and passing various tests like ACID 3. I was confused and concerned, though, because I had thought WebKit was only available to developers as a set of components (DLLs) and was not actually usable by end users.

I was sort of right, but mostly wrong. WebKit's nightly build, which is downloadable, runs on top of Safari (from a user perspective, that is .. technicaly, Safari sits on top of WebKit), replacing Safari's rendering engine with the latest "new and improved". After Safari 3.1 is fully installed, just download the latest nightly build of WebKit, run the batch file and go. (There were two batch files, I ran run-drosera.cmd and then I added a shortcut to run-nightly-webkit.cmd to my Quick Launch toolbar and changed the icon.)  WebKit does not kill off the official Safari renderer when Safari is launched in its normal fashion, it only overrides its renderer when launched from WebKit's .bat file.

Now I'm starting to think that Safari on the latest WebKit is the best browser. *gasp* Who'da thunk?

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Open Source | General Technology | Computers and Internet | Web Development

MVC On The Client In Javascript

by Jon 3/31/2008 9:30:00 PM

I stumbled across this over the weekend.

http://javascriptmvc.com/

I was actually very surprised by how closely it resembles what we've been working on at the office. Ours uses a controller to manage and control events and event propogation, track "view objects" (we call 'em "client controls" for drag-and-drop support in Visual Web Developer) and manage AJAX calls. And we've spec'd out to use RESTful URIs to manage data model retrieval and callbacks, and these are cacheable using Google Gears, Flash storage, or *shrug* cookies.

Theirs has a few additional features, though, some of which I think we can glean from, like:

  • script librarian ("Include"), which we don't need but I think we could accomplish using something like JSLoader
  • a complete ActiveRecord-like modeling pattern
  • a complete ASP-like templating system that executes on the client
  • "everything is a plug-in" philosophy

I like what I see, although our own framework goes further as it is built with ASP.NET, ASP.NET MVC, Visual Studio, and Expression Web all in mind. With ours, we enable our web designer, who is not an engineer, to create a complete, non-Flash RIA web pages without coding. Using Expression Web or Visual Web Developer, he can click on one of our controls in the Toolbox, drag it out to the page, absolutely position it, stylize it, give it a data source URI, and have it subscribe to other controls' events (think Flash video player, responding to the events of media playback controls). The entire multi-page web site will support executing in the rich execution environment of a single-page RIA application with a seamless user experience. And since the framework is not done in Flash (although Flash "client controls" are supported), it will support continuous extensions using the wonderfully universal languages of HTML and Javascript, both at design-time (creating new controls, customizing existing controls) and at runtime (RESTful fetches of web content, dynamic execution of JSON models, etc).

In some ways, ours is looking like http://www.wavemaker.com/, except that WaveMaker is based on Java and dojo, and the designer experience is in-page (which is way too much support overhead--why reinvent the designer when Visual Studio / Expression Web can do the job on its own?).

But I'd certainly recommend Javascript MVC (JavascriptMVC.com) as a skeleton foundation framework for someone to roll their own framework. We were thinking about open-sourcing our client bits once we are done with our prototype, but I think Javascript MVC comes close enough that it would do just as well to recommend that one instead. Mind you, I have never used it, I'm only suggesting it based on what I'm seeing at their web site.

kick it on DotNetKicks.com

XHTMLJS Moved To CodePlex

by Jon 3/27/2008 5:24:00 PM

XHTMLJS has a new home on CodePlex!

http://www.codeplex.com/xhtmljs

Would be nice to get some community support (i.e. feedback, bug reports, code editors) going.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Open Source | Web Development

ASP.NET MVC Framework Source Code Released

by Jon 3/25/2008 3:22:00 AM

Microsoft released their beta source code for ASP.NET MVC.

http://www.codeplex.com/aspnet

What took me by surprise as I noticed the .zip file was just called "aspnet-###.zip" (where ### was a version), which made me wonder, what, is Microsoft going in the direction of moving ASP.NET itself to the open source community? I suppose to some extent that is already the case, although I wonder if WebForms' code will ever see the light of day.

Not that we want it or anything. (j/k.)

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Open Source | Web Development

XHTMLJS: Updated to v0.3

by Jon 3/22/2008 4:17:00 PM

I've updated XHTMLJS to version 0.3.

http://cachefile.net/scripts/xhtmljs/0.3/

Try the XHTML editor.

This implements the full strict tagset listed at:

http://www.htmldog.com/reference/htmltags/

It still has some flaws, but this mainly resolves what I observed previously, "a few more failures beyond indentation, namely some XHTML-accepted tags (like <input>) are still going missing in strict mode. The Editor should allow for the de-toggling of strict mode, and IMO I think enabling strict mode for the jQuery extension was a mistake. Also, plain-text '>' (&gt; in markup) is not outputting as '&gt;' but as '>'. "

There are still indentation bugs and missing event handlers, among a few other glitches, but this is an important milestone.

UPDATE: The editor itself had a bug I just fixed (kept the 0.3 version designation) where it would only XHTMLize the first node entered. This required no change to xhtml.js.

kick it on DotNetKicks.com

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Pet Projects | Open Source | Web Development

Introducing jqalert - The jQuery-empowered alert() replacement

by Jon 3/22/2008 9:59:00 AM

I'm releasing a beta build of something I've been working on called jqalert. It's basically a nice, skinnable modal dialog box that defaults to have a certain "fade-in" feel I wanted to have.

Here's the current project URL:

http://www.jondavis.net/codeprojects/jqalert/  

.. or on cachefile:

http://cachefile.net/scripts/jquery/plugins/jqalert/0.9/

I built this having been inspired by a few other similar libraries out there, including:

What sets jqalert apart is that it is a) specifically an alert() replacement, b) prefab'd to be functionally comparable to Visual Basic's MsgBox, which allows the user to set the title and the icon (and the buttons, too, but jqalert currently only supports OK), while c) also adding a lot of customizeability.

What does "specifically an alert() replacement" really mean, when other tools do the same basic thing? It's about the execution...

  • As quick and simple to use as possible: jqalert(message); or jqalert(message, title);
  • Predictable "windowing" appearance; universally recognizeable.
  • You get a titlebar.
  • You can drag the alert window around with the titlebar, for those "emergencies" where you might need to peek back behind the alert window, without closing out the message. 
  • You get an OK button.
  • The OK button claims focus, so that you can close it by just hitting spacebar or enter.
  • The OK button reclaims focus if it loses focus by clicking elsewhere in the alert window.
  • Modality blocks UI.

kick it on DotNetKicks.com

Currently rated 3.3 by 4 people

  • Currently 3.25/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Pet Projects | Open Source | Computers and Internet | Web Development

Open Source Operating Systems Written In C#

by Jon 3/6/2008 3:44:00 AM

Over at http://www.codeplex.com/singularity I came across mention of these...

Cool! I'll have to poke at these.

Singularity Now Open To The Public

by Jon 3/4/2008 5:49:00 PM

Nifty.

Full source code and Virtual PC setup instructions available now at http://codeplex.com/singularity!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Open Source | Software Development | Microsoft Windows

Virtual Tarball - Draft 3

by Jon 3/2/2008 8:16:00 PM

I finally got around to kicking the tires of my "virtual tarball" idea, which is basically an XML document that consists of HTML-renderable <ul> / <li> tags that describe the contents of an Internet-based directory structure. This allows a single URL to be used to fetch an entire set of files by using a single list of hyperlinks.

I prototyped this on the server side at cachefile.net using a REST-like approach. Basically, one would simply need to append the path of a known cached directory at cachefile.net to the following URL:

http://cachefile.net/svc/mrr/ [+ known path from root]

For example:

http://cachefile.net/svc/mrr/scripts/OpenAjax/

This would output the contents of the directory at http://cachefile.net/scripts/OpenAjax/ in XML / <li> format, with hyperlinks.

 

<div class="mrr">
    <label>
        Index of <span class="mrrbase">http://cachefile.net/scripts/OpenAjax/</span>
    </label>
    <ul class="mrrparent">
        <li>
            <a href="../">Parent</a>
        </li>
    </ul>
    <!--
        This is a mrr ("mirror") file, also a.k.a. a "virtual tarball".
        For more information, see
http://www.jondavis.net/blog/?tag=/virtual%20tarball
        -->
    <ul class="mrrdirlist">
        <li class="mrrdir">
            <a href="hub">hub</a>
            <ul class="mrrdirlist">
                <li class="mrrdir">
                    <a href="hub/0.6">0.6</a>
                    <ul class="mrrdirlist">
                        <li class="mrrdir">
                            <a href="hub/0.6/release">release</a>
                            <ul class="mrrdirlist">
                                <li class="mrrfile">
                                    <a href="hub/0.6/release/OpenAjax.js">OpenAjax.js</a>
                                </li>
                            </ul>
                        </li>
                        <li class="mrrdir">
                            <a href="hub/0.6/src">src</a>
                            <ul class="mrrdirlist">
                                <li class="mrrfile">
                                    <a href="hub/0.6/src/OpenAjax.js">OpenAjax.js</a>
                                </li>
                            </ul>
                        </li>
                        <li class="mrrdir">
                            <a href="hub/0.6/testsrc">testsrc</a>
                            <ul class="mrrdirlist">
                                <li class="mrrfile">
                                    <a href="hub/0.6/testsrc/TestSuite.html">TestSuite.html</a>
                                </li>
 
                              <!-- .... -->

                            </ul>
                        </li>
                        <li class="mrrfile">
                            <a href="hub/0.6/build.xml">build.xml</a>
                        </li>
                        <li class="mrrfile">
                            <a href="hub/0.6/index.html">index.html</a>
                        </li>
                    </ul>
                </li>
                <li class="mrrdir">
                    <a href="hub/1.0_build117">1.0_build117</a>
                    <ul class="mrrdirlist">
                        <li class="mrrdir">
                            <a href="hub/1.0_build117/release">release</a>
                            <ul class="mrrdirlist">
                                <li class="mrrfile">
                                    <a href="hub/1.0_build117/release/OpenAjax.js">OpenAjax.js</a>
                                </li>
                            </ul>
                        </li>
                        <li class="mrrdir">
                            <a href="hub/1.0_build117/src">src</a>
                            <ul class="mrrdirlist">
                                <li class="mrrfile">
                                    <a href="hub/1.0_build117/src/OpenAjax.js">OpenAjax.js</a>
                                </li>
                            </ul>
                        </li>
                        <li class="mrrdir">
                            <a href="hub/1.0_build117/testsrc">testsrc</a>
                            <ul class="mrrdirlist">
                                <li class="mrrfile">
                                    <a href="hub/1.0_build117/testsrc/TestSuite.html">TestSuite.html</a>
                                </li>
                                  <!-- ... -->
                            </ul>
                        </li>
                        <li class="mrrfile">
                            <a href="hub/1.0_build117/build.xml">build.xml</a>
                        </li>
                        <li class="mrrfile">
                            <a href="hub/1.0_build117/index.html">index.html</a>
                        </li>
                    </ul>
                </li>
                <li class="mrrfile">
                    <a href="hub/home.href">home.href</a>
                </li>
            </ul>
        </li>
        <li class="mrrfile">
            <a href="home.href">home.href</a>
        </li>
    </ul>
</div>

As an added bonus, you can also get HTML wrapping of the XML file by appending the querystring, "?format=html".

http://cachefile.net/svc/mrr/scripts/OpenAjax/?format=html (click to view) 

You can let your imagination take you wherever you want to go as to what you would do with such a tool from here. I'm opening the uncommented server-side source code for this. The PHP file for my proprietary implementation is here: http://www.jondavis.net/misc/cachefile_mrr_gen.txt

Unfortunately, I have a sinking feeling that this opens up security vulnerabilities. If anyone can spot any, please let me know. I already filter out "..". 

kick it on DotNetKicks.com

LINQ-to-JSON

by Jon 2/13/2008 3:16:00 AM

A few days ago I posted a link / observation of LINQ-to-Javascript a.k.a. JSLINQ.

Ajaxian just pointed out a new project called LINQ-to-JSON that is more LINQ-like. One would use JSLINQ for working with any type of arrays in real Javascript. The LINQ-to-JSON solution looks like a truer LINQ coding experience; however, I can't tell if it's actually for Javascript or JScript.NET, the latter of which is not web browser Javascript and only runs in .NET. I'll check it out further but wanted to raise my eyebrows first. :P

http://james.newtonking.com/archive/2008/02/11/linq-to-json-beta.aspx

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Open Source | Software Development | Web Development

LINQ-to-Javascript

by Jon 1/24/2008 8:28:00 AM

I jumped onto codeplex.com for a random summary of the latest projects and stumbled across LINQ-TO-Javascript (JSLINQ). Pretty nifty idea.

Personally I'd like to see JSLINQ to be a jQuery overload -- that is, take the JSLINQ object definition and merge it with jQuery's object (at runtime) -- so that jQuery extensions can automagically work with JSLINQ objects. I suggested the idea here.

Currently rated 5.0 by 1 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Open Source | Cool Tools | Web Development

Bypassing Cross-Site Scripting Using A Proxy

by Jon 12/13/2007 2:46:00 AM

When I implemented Sprinkle, which is a client-side includes (CSI) system I came up with that doesn't use IFRAMEs, I kept running into the scenario where you may want to fetch HTML from an external web site besides your own. This is sort of what Web 2.0 is all about, being able to mashup the world with not just your crap but everyone else's crap as well.

I threw together a trivial solution. This is ASP.NET-only, I might come up with a PHP-based equivalent. The idea is to implement a really trivial proxy server and cache the data for a period of time. In this particular implementation, I cache it directly into the web Application's in-memory collection.

Here's what using it might look like ..

        <%-- Client-side includes with server-side cross-site proxying --%>
        <script type="text/javascript" src="
http://sprinklejs.com/sprinkle.js"></script>
        <div src="proxy.aspx?url=http://www.sprinklejs.com/info.html" />
       
        <%-- Server-side includes with cross-site proxying--%>
        <ssi:ProxyControl runat="server" ID="GoogleInsertion"
            SourceUrl="
http://www.google.com/"
            DetectImposeBase="true"
            BaseUrl="proxy.aspx?url=http://www.google.com/" />

In the server-side include implementation, the DetectImposeBase and BaseUrl properties are really just hacks where I force-inject the proxy URL to any src and href element attributes.

If you try to use the above-referenced proxy.aspx file from an external web site, it should fail. The referer header can only be on the same host.

If you try to reference a very large binary file or something, it will fail. Maximum file size is enforced, so as to not overload the Application in-memory collection that hosts the proxy cache.

This implementation doesn't work flawlessly and it's sort of a prototype thing, it only took about an hour to hack together (plus some time I spent struggling with Visual Studio puking on me), but anyway, here it is.

Download: http://sprinklejs.com/SSI_Proxy_ASPNET.7z

kick it on DotNetKicks.com

Flashback to 2002: My Javascript Console

by Jon 12/11/2007 8:33:00 PM

Here's something I did five years ago in IE-DHTML (Internet Explorer DHTML): 

http://www.jondavis.net/javascriptConsole.htm

Doesn't seem to work in Firefox.

I had AJAXy plans back then to callback to a server and execute a few console commands. I never followed through with that. I should revise that plan and come up with something kewler, maybe something RESTful.

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , ,

Open Source | Computers and Internet | Web Development

Cool Tool: Folder Size for Windows Explorer

by Jon 12/9/2007 7:00:00 PM

Windows Explorer (the file explorer, not Internet Explorer) is missing a key feature: The ability to asynchronously count up and display folder sizes without pulling up the Properties view. This proves quite important when trying to track down what directory contains big, bloated files. Someone created something for this, though, here:

http://foldersize.sourceforge.net/ 

I tried it on Windows Server 2003 R2 and it just works; it causes Windows Explorer to just add the column as a column option (choose columns).

Unfortunately, however, it doesn't work with Vista. Why? Because Microsoft killed the Win32 API call for it. Apparently, they replaced it for file metadata support as is found in MP3 files. (Garbage. OK, this is stupid. I'm becoming a Microsoft basher now?) http://foldersize.sourceforge.net/vistasucks.html

I sent a $15 CAD donation to ask the developer to continue to look into a workaround for Vista.

Update: He sent me an e-mail and said he wants to focus on Ubuntu. That makes it a different product altogether; essentially, I take it as "no, I won't support FolderSize for Windows Explorer anymore". Quick, Windows Vista users, send him more $$!!

Be the first to rate this post

  • Currently 0/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: ,

Open Source | Cool Tools | Microsoft Windows

ASP.NET: Rotated / Pivoted GridView

by Jon 12/6/2007 4:17:00 AM

I needed to rotate the content of my GridView control. I was databinding using business objects. Why is there no boolean pivot switch?

So I made my own control that inherits GridView. This is just a C# file; to use it, put it in the App_Code folder, and add <%@ Register Namespace="CustomControls" TagPrefix="Custom" %> to the ASPX file.

Not sure if it's buggy or not but it currently passes initial tests.

using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Xml;

namespace CustomControls {
    public partial class PivotDataGrid : System.Web.UI.WebControls.DataGrid
    {
        public PivotDataGrid() : base() { }

        public enum Pivot
        {
            /// <summary>
            /// Rotates the grid by rotating the data source in a replacement matrix. (not implemented)
            /// </summary>
            PreRender,
            /// <summary>
            /// Rotates the grid by converting the output to XML and rotating the cells.
            /// </summary>
            PostRender
        }

        private Pivot _PivotMode = Pivot.PostRender;
        public Pivot PivotMode
        {
            get { return _PivotMode; }
            set { _PivotMode = value; }
        }
        protected override void Render(HtmlTextWriter writer)
        {
            switch (PivotMode)
            {
                case Pivot.PostRender:
                    System.Text.StringBuilder sb = new System.Text.StringBuilder();
                    System.IO.StringWriter sw = new System.IO.StringWriter(sb);
                    HtmlTextWriter htw = new HtmlTextWriter(sw);
                    base.Render(htw);
                    System.Xml.XmlDocument xDoc = new System.Xml.XmlDocument();
                    xDoc.LoadXml(sb.ToString().Replace("&nbsp;", "&#160;"));
                    System.Xml.XmlDocument xDoc2 = new System.Xml.XmlDocument();
                    xDoc2.LoadXml(xDoc.OuterXml);
                    XmlNodeList rowNodes = xDoc.SelectNodes("//tr");
                    XmlNode trParent = null;
                    if (rowNodes.Count > 0) trParent = rowNodes[0].ParentNode;
                    rowNodes = xDoc2.SelectNodes("//tr");
                    XmlNode trParent2 = null;
                    if (rowNodes.Count > 0) trParent2 = rowNodes[0].ParentNode;
                    for (int i = rowNodes.Count - 1; i >= 0; i--)
                    {
                        rowNodes[i].ParentNode.RemoveChild(rowNodes[i]);
                    }

                    RotateRows(trParent, trParent2, xDoc2);
                    writer.Write(xDoc2.OuterXml);

                    break;
                default:
                    base.Render(writer);
                    return;
            }
        }

        protected override void DataBind(bool raiseOnDataBinding)
        {
            switch (PivotMode)
            {
                case Pivot.PreRender:
                    RotateDataSource();
                    base.DataBind(raiseOnDataBinding);
                    break;
                case Pivot.PostRender:
                    base.DataBind(raiseOnDataBinding);
                    break;
            }
        }

        void RotateDataSource()
        {
            //object src = base.DataSource;
            //System.Reflection.PropertyInfo[] srcProps = src.GetType().GetProperties(System.Reflection.BindingFlags.GetProperty);
            //Dictionary<string, Dictionary<string, object>> newSource = new Dictionary<string, object>();
            //DataKeyArray keys = this.DataKeys;
            throw new NotImplementedException("PivotMode of Pivot.PreRender has not yet been implemented.");
        }

        //Cell[,] RowsToCells
        void RotateRows(XmlNode sourceParentNode, XmlNode targetParentNode, // bool rotate
            XmlDocument targetContext)
        {
            bool rotate = true;
            XmlNodeList trNodes = sourceParentNode.SelectNodes("tr");
            int rowLen = trNodes.Count;
            int colLen = 0;
            if (rowLen > 0) colLen = trNodes[0].SelectNodes("td").Count;
            Cell[,] cells;
            List<XmlAttribute>[] rowAttribs = new List<XmlAttribute>[rowLen];
            if (!rotate) cells = new Cell[rowLen, colLen];
            else cells = new Cell[colLen, rowLen];
            for (int r = 0; r < rowLen; r++)
            {
                rowAttribs[r] = new List<XmlAttribute>();
                for (int a = 0; a < trNodes[r].Attributes.Count; a++)
                {
                    XmlAttribute attrib = targetContext.CreateAttribute(trNodes[r].Attributes[a].Name);
                    attrib.Value = trNodes[r].Attributes[a].Value;
                    rowAttribs[r].Add(attrib);
                }

                for (int c = 0; c < colLen; c++)
                {
                    XmlNode tdNode = trNodes[r].SelectNodes("td")[c];
                    Cell cell = new Cell();
                    //cell.Attributes = tdNode[c].Attributes;
                    cell.Attributes = new List<XmlAttribute>();
                    for (int a = 0; a < tdNode.Attributes.Count; a++)
                    {
                        XmlAttribute attrib = targetContext.CreateAttribute(tdNode.Attributes[a].Name);
                        attrib.Value = tdNode.Attributes[a].Value;
                        cell.Attributes.Add(attrib);
                    }
                    cell.InnerXml = trNodes[r].SelectNodes("td")[c].InnerXml;
                    if (rotate) cells[c, r] = cell;
                    else cells[r, c] = cell;
                }
            }
            //return cells;
            for (int cR = cells.GetLowerBound(0); cR <= cells.GetUpperBound(0); cR++)
            {
                XmlNode rowNode = targetContext.CreateElement("tr");
                for (int cC = cells.GetLowerBound(1); cC <= cells.GetUpperBound(1); cC++)
                {
                    Cell cell = cells[cR, cC];
                    XmlNode colNode = targetContext.CreateElement("td");
                    for (int a = 0; a < cell.Attributes.Count; a++)
                    {
                        colNode.Attributes.Append(cell.Attributes[a]);
                    }
                    colNode.InnerXml = cell.InnerXml;
                    if (rotate)
                        for (int rA = 0; rA < rowAttribs[cC].Count; rA++)
                        {
                            if (colNode.Attributes[rowAttribs[cC][rA].Name] != null)
                            {
                                colNode.Attributes[rowAttribs[cC][rA].Name].Value = rowAttribs[cC][rA].Value;
                            }
                            else
                            {
                                XmlAttribute newAttrib = targetContext.CreateAttribute(rowAttribs[cC][rA].Name);
                                newAttrib.Value = rowAttribs[cC][rA].Value;
                                colNode.Attributes.Append(newAttrib);
                            }
                        }
                    rowNode.AppendChild(colNode);
                }
                if (!rotate)
                    for (int rA = 0; rA < rowAttribs[cR].Count; rA++)
                    {
                        rowNode.Attributes.Append(rowAttribs[cR][rA]);
                    }
                targetParentNode.AppendChild(rowNode);
            }
        }

        class Cell
        {
            private List<XmlAttribute> _Attributes;

            public List<XmlAttribute> Attributes
            {
                get { return _Attributes; }
                set { _Attributes = value; }
            }

            private string _InnerXml;

            public string InnerXml
            {
                get { return _InnerXml; }
                set { _InnerXml = value; }
            }

        }
    }
}

kick it on DotNetKicks.com

Currently rated 4.0 by 1 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5

Tags: , , ,

Open Source | Software Development | Web Development

Iconize with CacheFile

by Jon 12/3/2007 7:11:00 PM

I still owe myself that virtual tarball / .mrr app.

Meanwhile, I've been busy with CacheFile.net in other ways.

  • I set up a new dedicated machine to host the site without worrying about others' sites taking the server down. It runs on Fedora / Apache.
  • On the new dedicated machine, I finally enabled gzip and caching.
  • I've been regularly adding popular script libraries as I find and qualify them.
  • The Graphics section now has two new additions:
    • famfamfam, and
    • Iconify

The latter addition, Iconify, is worth noting. http://cachefile.net/graphics/iconize/cachefile/index.html If you just drop this tag on your page:

<link rel="stylesheet" type="text/css" href="http://cachefile.net/graphics/iconize/cachefile/iconize.css" />

.. or ..

<link rel="stylesheet" type="text/css" href="http://cachefile.net/graphics/iconize/cachefile/iconize_left.css" />

.. you'll instantly get icons to show up on your hyperlinks. No image downloads necessary!

Update: Of course, this doesn't work across different domains when using Internet Explorer. *sigh* 

kick it on DotNetKicks.com

The Virtual Tarball - Second Draft

by Jon 11/22/2007 10:50:00 AM

In prototyping yesterday's blogged idea with .vtb / .mrr files, I've run into some design flaws with the proposed "schema". Main problem among them is that directory structures are typically not described in flat lists but as <ul> trees. A local file name should not be described as

<li>dir</li>
<li>dir/subdir</li>
<li>dir/subdir/file.ext</li>

.. but rather as..

<ul class="mrrdir">
  <li>dir
     <ul>
       <li class="mrrdir">subdir
       <ul>
          <li class="mrrfile">file</li>
       </ul></li>
     </ul>
   </li>
 </ul>

This makes more sense because it when it is rendered in HTML it is more legible and maintainable in the DOM.

  • dir
    • subdir
      • file.ext

Imagine if this was "fuzzy" and not strict. If the filename could be "subsubdir/file.ext", or worse "C:/windows/system32/file.ext", you run into all sorts of problems trying to target the download destination path. Directory seperators are completely disallowed, then, in the text value of the file's <li> entity.

This changes the programming a bit on the Windows app side, in both easier and more difficult ways. It becomes easier to manage the directories, but now the files' download names have to be managed within the directories virtually. Note that by "difficult" I mean a few extra minutes, not a few extra hours; on the other hand, thinking this through, I've already lost a few hours and decided to start over in my code while it's still a brand new and barely written prototype codebase.

Meanwhile, the href value must assume that the base URI is always the base URI for the entire document, not for the listed directory.

Here's a proposed valid sample .mrr doc, where the base URI is: http://cachefile.net/  

<ul class="mrr">
 <li class="mrrdir">
  <a href="scripts">scripts</a>
  <ul class="mrrdir">
   <li class="mrrdir">
    <a href="scripts/jquery">jquery</a>
    <ul class="mrrdir">
     <li class="mrrdir">