Firefox 1.5
Looks like the Mozilla group has released Firefox 1.5.
Some of the new features:
- Automatic updates
- Improved popup blocking
- Clear private data tool
Congrats to the Mozilla team on reaching this milestone.
John Vlissides
From Grady Booch’s blog, I just got the sad news that John Vlissides, one of the Gang of Four, passed away early Thursday morning after being diagnosed with brain cancer in early 2004.
John’s contributions to the software and patterns community are immeasurable and he will be missed.
Happy Thanksgiving
I just want to take a minute and wish everyone a very safe and happy Thanksgiving!
Enjoy the time with your families.
Ordering your javascript while using RegisterClientScriptBlock
Earlier today I stumbled across an interesting issue while using Page.RegisterClientScriptBlock to register some javascript to be output to the browser. The order of output was very important, because one of the scripts depended on a previous script being registered.
Everything worked great, except for one page. It seems like it’s always that way, doesnt it? No matter what I did, this javascript would be output in a different order than I registered them.
After digging into this for quite some time, I finally decided to break open Reflector. By the way, have I ever told you that this is the coolest tool ever? After investigating the Page class (specifically RegisterClientScriptBlock), I quickly saw what the problem was.
RegisterClientScriptBlock calls a private method called RegisterScriptBlock, which takes an IDictionary as a parameter. If the IDictionary is null, RegisterScriptBlock initializes it to a new HybridDictionary. HybridDictionary starts as a ListDictionary, which is an IDictionary implemented using a singly linked list. However, once HybridDictionary gets to be over 9 elements, it switches over to a Hashtable.
Where this is going is that once you switch to a Hashtable, you lose all the ordering benefits of ListDictionary. Clearly this is whats causing my problem. :)
It would be rude to not present a resolution to my problem so here goes:
My application has a common base class, so it seemed logical to override some methods to achieve the desired functionality. The easiest solution would have been to override RegisterScriptBlock in a Page derived class to use a ListDictionary, but alas, RegisterScriptBlock is private. No luck there…
This is what I came up with…
public class MyBasePage : System.Web.UI.Page { private IDictionary scriptBlocks = new ListDictionary(); public override void RegisterClientScriptBlock(string key, string script) { if (!scriptBlocks.Contains(key)) { scriptBlocks.Add(key, script); } } public override void Render(System.Web.UI.HtmlTextWriter writer) { StringBuilder sb = new StringBuilder(); foreach (string scriptBlock in scriptBlocks.Values) { sb.Append(scriptBlock); sb.Append("\r\n"); } base.RegisterClientScriptBlock("completeScript", sb.ToString()); base.Render(writer); } }
It should be fairly apparent what this code does. I really like this approach, because none of the calling code has to change to fix this issue. All 3rd party components will work with this implementation, since all calls are still to RegisterClientScriptBlock.
One thing about this that still needs to be addressed though is the IsClientScriptBlockRegistered method. Microsoft, for some inexplicable reason, has decided to make RegisterClientScriptBlock virtual allowing you to override its implementation (like we have done by providing a new storage mechanism). However, it did not make IsClientScriptBlockRegistered virtual. So, while we have a new data store for our script blocks, a call to IsClientScriptBlockRegistered will return false.
To fix this, you can do this…
public new bool IsClientScriptBlockRegistered(string key) { return scriptBlocks.Contains(key); }
Im not sure I like this, because this means that the new method is available only when the object is cast to the type the method is specified in.
VistaDB 2.1
VistaDB is giving away free licenses to bloggers that spread the word about their embedded database. Free licenses, goooood! Here we go:
VistaDB 2.1 database for .NET has been released
This 2.1 update includes over 60 improvements, including new support for .NET 2.0 and Visual Studio 2005. VistaDB is a small-footprint, embedded SQL database alternative to Jet/Access, MSDE and SQL Server Express 2005 that enables developers to build .NET 1.1 and .NET 2.0 applications. Features SQL-92 support, small 500KB embedded footprint, free 2-User VistaDB Server for remote TCP/IP data access, royalty free distribution for both embedded and server, Copy ‘n Go! deployment, managed ADO.NET Provider, data management and data migration tools. Free trial is available for download.
- Learn more about VistaDB
- Repost this to your blog and receive a FREE copy of VistaDB 2.1!
CruiseControl.NET
Looks like the Thoughtworks group has released the final 1.0 version of CruiseControl.NET (release notes). If you havent yet discovered the joys of continuous integration, you really need to read about the benefits of developing this way.
Having worked under continuous integration for the past 2 years, there is no way I would go back to anything else.
Passing Items around in ASP.NET
Wow, something as simple as keeping an item around between requests has proven to be an incredibly tedious task in ASP.NET.
The initial implementation had this identifier stored in Session state. This however, proved to not work as well as we needed it to, because we needed the item to be available even after the session expired.
Next thought was that we could have a base class that registers a hidden field with this identifier and when the page loads, it reads the identifier and reconstitutes the object needed from this id. This worked great until…
Plain anchor (a href) tags. Plain anchor tags obviously dont submit a form to the server, and therefore, my identifier was no longer available.
Seems to be that the only way to keep this identifier persistent across requests *and* sessions is to add the item to *every* querystring and then also register the hidden field (for pages that postback).
What a colossal pain in the ass! The thought of thinking that I could break my entire app if I forget to generate a URL without this identifer in it makes me cringe.
Has anyone done something similar to this before and how have you solved it?
An interesting thought
“The books you read today will fuel your earning power tomorrow.”
– Tim Sanders, Love is the Killer App
![]()
I’ve made a conscious decision to keep the television off (thanks to some good tips from 43Folders) and taking that time to improve myself.
What books am I reading now?
No one individual is greater than the team
No one individual is greater than the team. This idea was brought home by some things that happened in the NFL this weekend.
Terrell Owens is probably one of the best receivers in the league as far as raw talent goes. While with the San Francisco 49ers, he was never really content to let his skills do the talking. He was no stranger to controversy, on the field and off. Some of his more famous moments include gems like running out from the end zone to pose on the Dallas Cowboy’s star on the 50 yard line. Also, signing a ball that he caught for a touchdown, with a Sharpie that he had stored in his sock, and then giving that ball to his agent.
Last year, after causing a considerable stink, NFL wide receiver Terrell Owens signed with the Philadelphia Eagles, and along with QB Donovan McNabb took the Eagles all the way to the Super Bowl, where they ended up losing.
And here is where the wheels came of for Terrell… A rough recap of the things that happened since that loss:
- Owens makes comments to a reporter about how he “wasn’t the guy who got tired in the Super Bowl”. By throwing his QB under a bus, he ignites a feud with McNabb in which the two don’t speak for several months
- Owens fires his agent and hires mega-agent Drew Rosenhaus and wants to redo his deal, claiming that he outperformed his 7 year, $49M contract. This saga included such gems as, “You know, I’m just trying to feed my family.” Right, because I’m sure your family is eating Ramen noodles on your $49M salary.
- He’s upset with the organization that there was no in-stadium acknowledgement of his 100th TD reception. “That right there just shows you the type of class and integrity that they claim not to be. They claim to be first class and the best organization. It’s an embarrassment. It just shows a lack of class they have.”
- Engaged in a fist fight in the locker room with another teammate
- Insists that the Eagles would be undefeated with Brett Favre at quarterback. Once again he throws his quarterback under the bus to feed his own inflated ego.
Head coach Andy Reid and the rest of the organization seem to have had enough. On Saturday, the Eagles suspended Owens indefinitely for conduct detrimental to the team. They have drawn a line in the sand and sent a very clear message by benching arguably the best receiver in the league because he can not get along with the rest of the team.
It does not matter how good you are, if you cannot exist in harmony with the other members on your team, that team will move on without you.


