September 28, 2004

Hurricane Relief

Having been spared nature's wrath, I am very thankful. A large number of my fellow Floridians, however, have not been as fortunate. Please, if you can spare even a few dollars, do your part to help the victims of Charlie, Frances, Ivan, and Jeanne. Be a hero today.

Posted by Christian at 10:38 AM | |

September 17, 2004

More FogBugz + Atom

You've got to love when it's this easy to extend an application. Kudos again to the folks at for their kick-ass . Yesterday, I created per-bug feeds of bug events so I could monitor the progress of a particular hot item. Today I was able to whip up feeds for all bugs assigned to a specific individual. The screenshot below shows the payoff, easy notification via Bloglines of new bugs assigned to me.

Again, I'll be polishing up the code to the point where it's good enough to maybe do a write up over on CodeProject over the coming days, but in the mean time if you'd like the code just leave a comment to this post.

Posted by Christian at 03:31 PM | |

September 16, 2004

FogBugz + Atom

I spent some time today tinkering with . I love the subscription feature, but I really hate email so I decided to add an Atom feed for each individual bug.


So, now I'm able to subscribe to particular bugs individually. The next step, of course, is to produce a feed for *all* the bugs assigned to me. It turns out that integrating this functionality was really easy. Inside the Fogbugz website directory there is an asp file (dlgBugEditing.asp) that is responsible for handling the display of edit view. I just added the following snippet before the existing


For convenience, I created the feed-producer as an ASP.NET web service (so I can re-use the implementation easily later on) and allowed the HttpGet protocol. If you'd like the code, leave a comment here with some way to get a hold of you and I'll be happy to share it.

Posted by Christian at 07:05 PM | |

SOAP Scope 4.0

Via Christian Weyer, Mindreef has released SOAP Scope 4.0! 3.0 is an awesome tool, so I'm anxious to get the upgrade. For anyone working with web services intensely, I recommend this product wholeheartedly. It is absolutely essential. I'm also hoping to see if they've managed to trim the working set down siginificantly which would creep up to about 100 MB in 3.0. Stay tuned for an update.


After installing SOAP Scope 4.0, I read the known issues. It warns that Windows XP SP2 has an concerning the loopback address for which you need a hotfix. Mindreef recommends calling (Microsoft Professional Support) to obtain the hotfix.


Microsoft was very good (read: fast) in making the hotfix available.

Posted by Christian at 09:40 AM | |

Microsoft Fingerprint Reader

I wonder how good is in light of the "tricks" you see in movies liuke spraying a lift film of hairspray or exposing it to superglue fumes and then pressing down with a piece of paper...

Posted by Christian at 09:21 AM | |

September 15, 2004

MSDN2 Library URLs

Tim Ewald and company are doing a wonderful job of overhauling the MSDN website. One benefit we can see right away is in accessing the documentation for the BCL. The news broke over at Junfeng Zhang's blog. See the comments for all the details, but suffice it to say that appending a namespace or class to http://msdn2.microsoft.com/library/ takes you to the documentation for that item. I'd love to see the source for the HttpModule they implemented this in.

Corrected spelling of Junfeng's surname. Wouldn't it be nice if the ActionScript reference followed the lead here?

Posted by Christian at 09:06 AM | |

September 14, 2004

VSS Journal File

VSS is a pain in the ass, but if you're stuck with it here's a tip for working with the journal. When setting up the journal file on the server, don't browse the local drives as in e:\SCM\Content\journal.txt. When you access VSS from a workstation, it will try to find a local e:\SCM\Content\journal.txt. Instead, always use a UNC path such as \\SCMSRV\Content\Journal.txt. Incidentally, I've gotten best results with 8.3 filenames.

Posted by Christian at 11:57 AM | |

September 10, 2004

Using ASP.NET to Implement the Template Method Design Pattern in JavaScript

Usually, developers use ASP.NET to create Web Forms or dynamic pages for display in a browser. But ASP.NET is really a powerful general-purpose server-side host for the .NET Framework. ASMX Web Services are an example of using the IIS infrastructure to expose the power of .NET over SOAP. In this article I’m going to discuss another way to leverage the power of ASP.NET – as a means of dynamically generating JavaScript code. Specifically, I’ll show you how I used ASP.NET in a real-world scenario to provide a Template Method implementation in JavaScript.

Consider the following constraints:


  1. There is a website in a different domain that needs to populate the contents of an HTML select box with some data that our company must provide dynamically at runtime.
  2. The proprietors of the website do not have developers available that can write code that consumes a web service. In fact, a copywriter with only basic knowledge of HTML will be adding any needed code to the website.
  3. We cannot actively populate a select box that lives in another domain (this would be a security violation) via JavaScript.

One solution to these constraints is to include some generic JavaScript in the page that needs to update its select box. This JavaScript code will contain the algorithm for reading the values of an array and using them to create a new Option object that can then be added to the select box. The only caveat is that this JavaScript will defer the creation of the value array to some other script. This closely resembles the GOF design pattern Template Method, at least in its intent. The Template Method design pattern establishes a virtual or abstract method that subclasses should implement. In the case of JavaScript, we can’t make use of inheritance, so we will simply rely on an included script to provide the method implementation for us.

Let’s look at some code. The html page will look something like this:




Test Page






Notice the call to getDataArray(). We have not defined this JavaScript function anywhere. This is our Template Method. We will rely on an included script to provide the implementation of this method for us. Let’s add a script tag BEFORE our algorithm that includes an external script – but let’s make the src of the script an ASP.NET page that will generate the JavaScript dynamically for us.

We’ll add the following line of code before our original script tag:

Our head now looks like this:



Test Page




The only thing that remains is to provide the ASP.NET implementation. To begin with, we will create an ASP.NET web form and strip out everything the IDE generates for us with the exception of the directive. Our default.aspx page looks like this:

<%@ Page Language="C#" CompileWith="Default.aspx.cs" ClassName="Default_aspx" %>

I’m using the .NET Framework 2.0 beta, but you can implement this technique with any version of the framework. The code-beside (or code-behind) page will contain the following code:


protected override void OnLoad (EventArgs e)
{
string javascript = @"
function getCityCodeArray()
{
var cities = [{0}];
return cities;
}
";
Response.Write(javascript.Replace("{0}", GetCities()));
}
private string GetCities ()
{
return "'Miami', 'Orlando'";
}

Of course, a meaningful implementation of GetCities() would probably access a database, file, or web service and return the string with that data. This technique allows the partner with ASP.NET to generate the data dynamically for the site that lacks the capability or resources to implement a dynamic solution. Lastly, I would like to point out a small optimization we made in the client side script.

document.getElementById('ListBox').length = cityList.length;

The code above sizes the Options array of the select box large enough to hold all the data returned from the external ASP.NET/JavaScript. Leaving this line out will cause the JavaScript engine to dynamically size the array on every iteration of the for loop. In this article I’ve showed you a real-world hack that leverages the power of ASP.NET to write dynamic client-side code to be included in another domain. Ideally, we wouldn’t jump through hoops like this but sometimes you have to rely on a clever hack rather than an elegant solution.

Posted by Christian at 03:53 PM | |

September 09, 2004

Preparing for Hurricane Ivan

Now that Frances has passed, it seems that a Category-5 monster is headed this way. Not since 1964 have three hurricanes hit Florida in the same year. Luckily our place suffered no damage from Charlie or Frances. I was planning to clean the leaves from the ficus out of the pool this weekend (it's turning green from all the chloropyll) before it gets really nasty in there. I guess it'll be good practice for Ivan.

Posted by Christian at 11:22 AM | |

Florida Lottery

The Florida Lottery is rigged i tell ya! Here's last night's winning numbers:
08-20-30-34-43-50

20 + 30 = 50
34 is plaindrome of 43
08 seems like the only oddball. My theory is blown. Or is it?
Let's add the digits of the other numbers.

2+0+3+0+3+4+4+3+5+0 = 26
Now let's add the digits of the result.
2+6 = 08!!!

There it is: inconclusive proof that a mathematical relationship exists among all the lotto numbers.

Posted by Christian at 11:15 AM | |

September 08, 2004

More Rotor Fun

From the Rotor source:
//
// Note: the order of these must match the order defined in
// cordbpriv.h for DebuggerAssemblyControlFlags. The three
// values below should match the values defined in
// DebuggerAssemblyControlFlags when shifted right
// DEBUGGER_INFO_SHIT bits.
//

Did you know?: Array.Sort uses the QuickSort algorithm.

Posted by Christian at 12:43 PM | |

.NET Framework Internals

For any serious .NET Developer, I highly recommend downloading the Shared Source CLI (ROTOR) . There are fascinating finds in the Microsoft source code and plenty of things that make you go hmmm. Along with funny comments like " HACK, HACK, HACK" (see DateTime.cs), there are a number of interesting tidbits (who knew void is a struct?!) of code. Some things seem weird like XmlNode (base class) knowing about XmlDocument (derived class) internally. Even if you never compile the code, reading it will make you a better developer.

UPDATE: I've emailed Brad Abrams concerning the XmlNode/XmlDocument design to see if the SLAR author can shed some light on this. I'll post his findings here if he's cool with it.

Posted by Christian at 12:30 PM | |

September 05, 2004

First Look at Yukon IDE

Hurricane Frances didn't knock out power around here, so I've gotten a chance to install Beta 2 of Yukon. Here's a look at the new SQL SErver Management Studio (FKA SQL Workbench). Unfortunately, still no IntelliSense...

Posted by Christian at 03:28 PM | |

September 02, 2004

Preparing for Hurricane Frances

With Frances bearing down on us, we decided to initiate the Disaster Recovery plan. our agents are busy trying to find flights to the Sungard Disaster Recovery facility in Carlstadt, NJ. Three years of practice, and now we're working on the real thing. The e-commerce team replicates database changes in real-time to our hot node in Jersey, so our sites (http://www.deltavacations.com, http://www.covacations.com, http://www.futurevacations.com, http://www.songtravelpackages.com) should experience no more than 5 minutes of downtime once the traffic is routed to our northeast link. I'll try to keep posting updates throughtout the Hurricane provided my family is safe, work isn't keeping me busy, and power hasn't been disrupted.

Posted by Christian at 09:43 AM | |