comments edit

Last FM plugin

Way back in the day I worked on a website called MyLaunch which later changed its name to Launch before being bought by Yahoo where it now lives.

One of the features it boasted was collaborative filtering using what was then called Firefly technology. The problem was that users had to go in and rate a bunch of songs and artists before you would get any meaningful results.

It would have been nice if there were some way for the site to simply listen in on what you were listening to and make recommendations based on your actual habits. That’s what Last.FM does.

There are two components to Last.FM, a plug-in that sends information to the Last.FM web services about the music you are listening to. This requires a plug-in to your favorite audio program. I installed the iTunes plugin.

The second component is a player that delivers a customized radio station with selections based on your tastes. I haven’t used this but Jon Galloway writes about a C# player that is a worthwhile replacement for the lame player offered by Last.FM. Jon recently open sourced the codebase started by another developer, Eric Willis, with his permission.

Give it a twirl. You can see what amazing taste in music I have by checking out my Last.FM profile page.

comments edit

If you are like me, you “learned” source control in a very informal manner. Perhaps you learned via what we used to call the “Commodore Shuffle” back in the day (what is the modern term for this?) in which you clicked around and figured it out by trying to use it.

Heck, with Visual Studio integration, Visual Source Safe is pretty easy to learn. When you double click a file to edit it, VSS kicks in and asks you to check it out. That effectively puts that file under lock and key and nobody else can edit that sucker until you check it back in.

For several years, I thought this process defined source control (also called version control). Up until working professionally, I had never even heard of source control. My college computer science courses never covered it. Why should they? Everything we wrote for class was pretty much throwaway code.

Fortunately Eric Sink comes along and enlightens the masses with his series on Source Control called Source Control HOWTO. If there are better or equivalent series on this topic, let me know in the comments.

This is the guide I wished I had when first starting out. If you think you know source control, but have never created a branch in your life, have never worked with an optimistic locking version control system, then you owe it to yourself to read this series and gain an understanding of these topics, whether you end up using them or not.

comments edit

Power mast Just had a short power outtage at home, which sucks because I work here. I was taking a short break downstairs reading when the lights suddenly turned off. I had that feeling that must go through the head of the lone security guy just before Sidney Bristow busts his head with her fist.

Fortunately no commandos busted down the door to my place. The unfortunate part is that my computer was upstairs doing its computing thing. *Poof!* Data lost. It seems like we have these outtages every other month or so, which is too much for my liking.

Anyways, on to my point. Does anyone have any good recommendations for UPS systems for personal use? I would like to stay around the $50 range, but if you know of one that can signal the computer to go into hibernation, I might be open to spending more.

comments edit

Mix 06 Well I am ready to mix it up at the Mix 06 conference. This will be my first conference of the year and my coworker Jon Galloway will also be in attendance.

I do have one big concern. The conference is in Las Vegas. This is like a kid sitting in a class lecture held in a candy store. I have already registered, so at least there’s no risk of me trying to double my registration fees at the craps table.

While there I will see if I can pencil in BillG for a conversation about supporting web standards with the next generation of Microsoft tools for the web.

Anybody have any inexpensive hotel recommendations?

comments edit

The local newspaper sports a comic strip that enjoys every opportunity to mock the modern university’s emphasis on diversity. The strip holds diversity accountable for lowered standards and educational quality. However it ignores the danger of a lack of diversity, namely that a student might not be exposed to new ideas that challenge pre-existing assumptions that would improve the student’s overall education.

Tunnel Vision Likewise, any institution that does not cultivate diverse viewpoints risks being caught in institutional tunnel vision. At times, spending too much time and energy duplicating the efforts of others due to simple ignorance. I sometimes see hints of this within the .NET developer community.

Copping a Borgitude

Over the past several years, there have been a proliferation of developers who have what I call the “Microsoft” mindset, also known as “Microsoftitis” or “Borgitude”. This conditioned is characterized by a general tendency to hold up the Microsoft way of doing things as the holy bible of software development.

Please note that this is not a blanket criticism of the Microsoft way of doing things. For the most part, Microsoft does a bang up job of developing software and their development platform is fantastic. However, not everything they preach is gospel. What works for Microsoft isn’t always going to work as a one-size fits all solution for everyone else. And at times, Microsoft has shown itself capable of completely ignoring prior art.

Test Driven Development

What really got me thinking about this is a while ago was Microsoft’s blunder with their approach to TDDin Team System, here summarized by Sam Gentile.

This is not to say that TDD is gospel either. But in adopting TDD as part of Team System, Microsoft sets the stage to shape how many developers with Microsoftitis will first encounter and view TDD. Rather than abiding by their traditional “Embrace and Extend” philosophy, they decided to “Ignore and Do It Our Way” which will leave many with a skewed view of TDD and its benefits.

This is unfortunate because TDD has a rich history and a lot of prior art spearheaded by the Java and Smalltalk communities. The fact that the source of these practices are not Microsoft should not dissuade a developer with Borgitude from giving them a fair shake. There is a lot to learn from these other communities, and a lot to lose by not expanding one’s experience.

Source Control

Another classic example is source control. To many developers with Microsoftitis (and I was this way for a long time) source control is Visual Source Safe (derisively called Visual Source Crap by its detractors). Other means of version control are unknown to such developers.

Visual Source Safe has its place. For fairly small teams within the same network, it does a decent enough job. But for developers who have a very low tolerance of repository corruption, larger teams, or distributed teams, VSS is not an ideal solution.

The most common reason given for sticking with VSS is that it is free. This is ironic because it isn’t technically free. It merely comes bundled with whichever MSDN subscription your company happened to buy. However the real cost isn’t that subscription fee, it is the lost productivity by being forced to adhere to the pessimistic locking checkout/checkin model of VSS. For large teams this is extremely restrictive. And when VSS corrupts your data (if it hasn’t yet, just wait. You’re sitting on a ticking time bomb) add the cost of downtime and developer time to bring it back. That is the real cost of VSS.

For distributed teams, VSS performs terribly and is basically unusable unless you purchase SourceOffsite made by a VSS competitor.

What really burns my hide is that one of the reasons given for changing the web project model in ASP.NET 2.0 is that large teams complained of lock contention on the project file. This isn’t a problem with the existing web project model, this is a problem with pessimistic locking on a large project! This has led to many complaining about the new project model.

If the real argument for sticking with VSS is that it is free, one should consider Subversion which is orders of magnitude better.

I suspect that the real reason many stick with it is because they are used to it. Many have never actually taken a class or read a tutorial on version control, so the ramp up time for a new system seems daunting.

On one hand, there is nothing wrong with that. If it is really working for you, why change? On othe other hand, VB6 worked for a lot of developers, but there is only so long you can ignore the advantages to moving to VB.NET or C#.

Development Idioms

If Microsoft provides a component, many developers will never evaluate alternatives. This makes sense for many reasons such as dependency avoidance. Who has the time to evaluate other options when one is already built in? Even so, one should have at least some small exposure to other solutions. Especially when they too are free.

For example, in ASP.NET 1.1 it makes good sense to use the built in Tracing mechanism for logging. It is very configurable and extensible and generally meets the needs of most developers. However many developers find it to be extremely slooow and discovered that Log4Net is an even better solution for their needs. By breaking out of Microsoftitis they discover a mature logging framework that meets their functional needs and performance needs.

The fact that it is in essence a port of the java community’s Log4j does not detract from its usefulness. Log4j has been around a long time and that maturity is apparent as they have solved a lot of problems that other roll-your-own logging frameworks are just now discovering.

The Remedy

If you are a .NET developer I am by no means advocating that you switch to Java (though you may want to spend some time programming in Java, Ruby, Python, etc…). I firmly believe that in a language to language comparison, C# is a much better language to write software in than Java.

However, the language syntax itself is not the whole of the development experience. Many of the features we are just oohing and ahhing about in VS.NET 2005 have been in Java IDEs such as IDEA and Eclipse for a long time now. It seems that we are rediscovering the many things that Java and SmallTalk developers take for granted.

So what I am advocating is to diversify your development reading, toolbox and experience. For example, instead of complaining about how expensive Team System is, consider that by using Trac, MbUnit (or NUnit) and Subversion, you have many of the tools that TS provides, but for free. You don’t have to be beholden to the Microsoft way.

Instead of only reading Microsoft Press, read a book on Java or Ruby. Read up on MVC and other architectural styles and decide for yourself whether or not it makes sense to use it on your next ASP.NET project. Read up on REST as an alternate to SOAP and understand the differences and the advantages and disadvantages of each.

Most of all, consider working on an open source project. In the comments to my post on Open Source, Joe Brinkman says it well when he describes the benefits of being involved in an open source project.

In my office, the closest I ever came to some of the best and brightest in the development community was seeing someone speaking onstage or reading their book/blog. Since working on an OS project, I have had the opportunity to trade ideas with some of the best .Net developers in the world.

comments edit

I was reviewing some code when I ran into code that fit this pattern all over the place (simplified to make a point).

string format = “/comments/{0}/{1}.aspx#”;

string url = String.Format(CultureInfo.InvariantCulture, format + entity.Id, entity.ParentID, entity.Date.ToString(“yyyy/MM/dd”, CultureInfo.InvariantCulture));

There are a couple things I want you to notice here. The first is concatenation of the entity id to the end of the format string.

format + entity.Id

Second, notice format string passed into the ToString method of the the entity.Date.

entity.Date.ToString(“yyyy/MM/dd”, CultureInfo.InvariantCulture)

Ok I lied. There is a third thing I want you to notice - the fact that CultureInfo.InvariantCulture has to be specified twice.

My guess is the author of this code was in a hurry and didn’t realize the full power of format strings that can be passed to the String.Format method. It is possible to get all the formatting information in a single string. Here is how I rewrote this.

string format = “/comments/{0:yyyy/MM/dd}/{1}.aspx#{2}”;

string url = String.Format(CultureInfo.InvariantCulture, format, entity.Date, entity.ParentId, entity.Id);

In this rewritten code, I took advantage of the fact that the String.Format method allows you to specify formatting information within the place holders like so.

{0:yyyy/MM/dd}

In this way, the code does not need to call the ToString method of the DateTime instance. The formatting is all in a single format string and that is one less CultureInfo.InvariantCulture you need to type.

This helps make the code more readable and more flexible. The string format for this url is all in a single string.

A useful reference for string formats that I keep at my fingertips is the following blog post by Steve Tibbett. If you use format strings, you will find this reference invaluable.

comments edit

Candy Hearts Read this interesting post by security expert Bruce Schneier on how Valentine’s day is the day when cheating spouses are most likely to trip up.

The gist of the story is that it is the one holiday that pressures people to do something romantic for a spouse or lover. For a cheating spouse, this is a problem as he or she has both.

I can just see the pathetic excuses now.

Ummm yeah, I bought the lacy panties for myself, but tossed them out because they didn’t fit.

comments edit

Multi-Touch UI By now just about everybody is ooh-ing and aww-ing over this demonstration video showing multiple users on a single touch and pressure sensitive graphical user interface.

And rightfully so. This thing is amazing! Who wouldn’t want to be able to organize their photos in the manner they do in the demo? They’ve created a particularly intuitive means for navigating photos, maps, floating lava lamp blobs that is a huge step forward in usability.

Is it Ergonomic?

But there was one small issue that popped in the back of my mind. One other detail that would need to be addressed by such an interface. Is it ergonomic?

For software developers, who typically sit at a computer 8 or more hours a day, the ergonomics of a system are extremely important. Ideally monitors are placed so that the top is a couple of inches above eye level. Your head actually has a significant amount of mass (even more if you have a forehead like mine) so it should remain for the most part balanced on your neck to prevent strain.

What would eight hours a day looking down at a tilted screen do to a person’s body? Either we would develop very strong neck and shoulder muscles like our governator, or we would suffer from shoulder and neck pains along with headaches.

I am not sure what the solution is, but I hope they address it because I definitely would want such a device. Perhaps one option is a dual screen approach where a user could alternate by looking at a non-tactile screen at eye level that mirrors what the user is doing on the touch screen, allowing the user to alternate between screens. Having the touch screen at eye level would only introduce upper arm and shoulder pain. Ever try holding your arms straight in front of you for hours at a time? It is painful. Whatever the solution, I bet they will come up with something better than anything I have proposed.

The Lesson

The lesson here is that great design is hard and there is no perfect design. When trying to design anything, such as a new UI, a compensation plan, etc… You have to consider and try to anticipate unintended consequences.

comments edit

Soccer Ball I’ve joined a group of soccer players attempting to form a team to get into a 30 and over league that hosts games on much nicer fields. These are the fields with that really nice high quality artificial turf, a huge difference over the pock-marked dirt/grass fields of my current league. The play in this league is also at a much higher level than my current league and they are very particular about which teams they let in. They judge teams on ability, sportsmanship, and organization.

Last night we played one of their top teams, if not the top. This team included an ex-Sweden national team player and an ex-MLS/National Team player. Had I known I would have asked for autographs. ;)

For one of their warm-ups, these guys we’re in tight circles of five conducting a one-touch five man weave. The interesting part was that it was one-touch in the air. The ball didn’t touch the ground. Meanwhile we looked like the Bad News Bears with our mismatched jerseys. This was one of several friendlies so that the league could evaluate us, so we don’t have uniforms yet.

In any case, we struck first with a goal and ended up with a one to one tie. A very respectable showing, but between me and you, and I would never admit this normally, but they were a much better team. It was obvious they’ve played together for a long time. It is amazing what a well organized, well coordinated team can do. Just like software teams!

Not only that, every last one of them was fit like Lance Armstrong. This was one of the few games I subbed myself out from time to time to get a breather. Usually you have to drag me kicking and screaming off the field.

In any case, we just got the word that we have been accepted into the league. Woohoo! Hopefully we won’t run into any brawls in this league.

comments edit

Toy Soldier With Bazooka No, this isn’t a revisionist history account attempting to insert the role of software in the Crusades. Today we take a look at Religious Wars in software. Sometimes also referred to as “Flame Wars” and “Holy Wars”.

A religious war is a very passionate conflict or argument in which each side is absolutely convinced of the objective truth of his or her own position on a matter of personal preference. These are typically very heated arguments over very trivial matters in which the only truth is that there is no objectively correct answer. These arguments would make an outsider wonder if we should all be locked up in straight jackets.

Spaces or Tabs

One good example, and I hesitate to even mention it, is the topic of using spaces or tabs for indenting code. True software developers know there is only one right answer and they’ll defend the truth of that answer till they are blue in the fingers, making sure to spread the “One True Indenting Style“ to every forum in every nook and cranny of cyberspace. Obviously I know what the real answer is and that answer is…

Kinda puts the “anal” in anal retentive obsessive compulsive doesn’t it?

Private Member Prefix

Sometimes we lob grenades over a single character or two. Make sure to prefix private member variables with an underscore or be burned at the stake in one camp. Use an m_ prefix or be flayed alive by another camp. Don’t use an underscore at all in yet another camp or be drawn and quartered. I’ve seriously thought of joining the camp that wants to prefix member variables like so:

string HEYThisIsAPrivateMemberVariable___someVariable;

How is that for being explicit? Of course the true code warrior will notice I didn’t explicitely mark the member as private and already has a sniper laser scope aimed at my head.

Holy War Phoenix

The real beauty of religious wars is that they never go away. Sure they’ll sometimes flame out a bit and lie smoldering just under the radar. But wait long enough and they’ll spring back to life in full force. Just look at the Edit and Continue debate in Atwood’s blog.

Another example of a holy war that never seems to die is the VB.NET vs C# debate. This is an interesting one because VB.NET and C# are really good buddies who like to have a pint at the pub together every now and then. They don’t have a beef with each other. It’s certain camps that use these languages who like to beat each other with flames and misinterpreted arguments that thrust these languages into an all out religious war.

Crusaders

At the forefront of these religious wars are the crusaders. I won’t link or call out any in particular lest my blog become the next battleground for the faithful holy warriors. But you recognize them when you see them. They can be found in the trenches of the newsgroups, blog comment sections, and in their own blogs, fighting for the cause with a single minded determination.

They rarely give an inch to the oppositions viewpoint, lest they come across as weak. You are either with them, or against them.

Well Known Religious Wars

No discourse on religious wars would be complete without a list. This list is by no means complete, but simply a list of well known holy wars in software that I can recall. Please contribute others in the comments and I will keep this updated.

  1. Spaces vs Tabs for indenting code
  2. Curly braces on their own line or not
  3. Private Member Prefixes…or not
  4. private keyword or just omitting it
  5. Managed Languages vs Unmanaged
  6. Edit and Continue or Not Edit and Continue
  7. BDUF vs Iterative Design
  8. Interpreted and dynamic languages vs Compiled
  9. VB.NET vs C#
  10. Java vs .NET
  11. vi vs emacs
  12. Windows vs Linux
  13. Tastes Great vs Less Filling

Got any others?

comments edit

So after reading this post by Scott Hanselman, I just had to try it out. He writes about a site called MyHeritage that attempts to match your face to celebrities and relatives.

I thought I might have interesting results since I am bi-racial, but wasn’t expecting much. Here is the photo I uploaded and the two closest look alikes.

Portrait of Me

Look Alikes

Now that is just plain rude! Dare I play the race card here? Just because I am half-Korean with glasses doesn’t mean I look like Kim Jong Il! We don’t all look alike!

In a way they were accurate about my heritage, by having the top two results be a caucasian and a Korean.

Now if you’ll excuse me, the Great Leader wishes to get back to work on some interesting code.

comments edit

Recently I added some seemingly innocent code to Subtext within the Application_BeginRequest method of Global.asax.cs that I adapted from this blog post by Darren Neimke. The purpose of the code is to provide culture aware formatting of dates, times, and numbers specific to the user reading the blog.

// Set the user culture.  Got the idea from

// http://markitup.com/Posts/Post.aspx?postId=52252561-f83d-4463-82f0-769fce82fd82

// but modified it to catch specific exceptions.

//TODO: Make sure we store dates in UTC etc and do the conversion when we pull them.

//        I assume we do this but haven’t checked.

try

{

    if (Request.UserLanguages != null

            && Request.UserLanguages.Length > 0

            && Request.UserLanguages[0] != null)

    {

        Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);

    }

}

catch(NotSupportedException nse)

{

    log.Error(“Error while attempting to set CurrentCulture to ‘” + Request.UserLanguages[0] + “’”, nse);

}

Such a simple snippet of code, yet it introduced a couple of bugs, both which can be seen in this screen capture that Jayson Knight kindly sent me.

Archive Links

The first error, the fact that you see the same month over and over, has been fixed in our codebase, but I have yet to deploy it to my blog. That has to do with how different cultures format dates differently when ordering the month and the day.

The second error is the fact that Jayson is seeing the months in what appears to be Portugese in the first place. At one time, he saw the months in Spanish. I started wondering if somehow a thread from the thread pool with a CurrentCulture already set was servicing his request, but that didn’t make any sense since it should be reset for him.

Then it occurred to me today. Subtext makes extensive use of caching on multiple levels from data caching to output caching. When I added this code, I didn’t go through and update all code that caches data to vary the cache by user language. Doh!

Once again, the law of unintended consequences smacks me upside the forehead.

UPDATE: Jon Galloway points out that Scott Hanselman wrote about this very thing recently. I read that post and totally forgot about it when I made my change. Blogs are good, umm’kay.

comments edit

If you’ve started on module development with DotNetNuke 4.0 and above in Visual Studio.NET 2005, you might run into a problem with trying to add a Web User Control (*.ascx file) to a class library.

The fix is similar to what you had to do with Visual Studio.NET 2003.

For C#, follow these steps.

  1. Close VS.NET 2005.
  2. Open the directory C:\Program Files\Microsoft Visual Studio 8\Web\WebNewFileItems\CSharp (assuming a default installation of VS.NET).
  3. Open the CSharpItems.vsdir file in Notepad. Select the text and copy it to the clipboard.
  4. Now open up the file C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjectItems\CSharpItems.vsdir and paste the contents of the clipboard underneath the existing text.
  5. Now copy the contents of C:\Program Files\Microsoft Visual Studio 8\Web\WebNewFileItems\CSharp (excluding CSharpItems.vsdir) into the folder C:\Program Files\Microsoft Visual Studio 8\VC#\CSharpProjectItems.

Now “Web User Control” should be an option when you select Add | New Item.

comments edit

Lately I have been spending a little bit of time performing maintenance tasks on my blog’s SQL Server. I noticed that OdeToCode’s Scott Allen was in the same mood.

In looking to free up some database space, he took the somewhat drastic step of deleting all referrals and urls before a certain date. Since he doesn’t care about this data, it isn’t really all that drastic. But it makes a data packrat like me shudder. I wanted to free up some space as well so I created an approach that frees up a lot of space, but keeps the data I care about.

Around 90% to 99% of my referrals are from web searches and online blog readers. As a matter of fact, nearly all of these are from Google. Since those referrals are not that important to me as WebHost4Life also tracks that data, I wrote a script to delete them for Subtext. Note that the following SQL script is pretty aggressive, so use at your own risk. You might even think of some search strings that I missed.

DELETE FROM subtext_Referrals

WHERE UrlID IN

(

  SELECT UrlID

  FROM subtext_URLs

  WHERE Url LIKE ‘http://google.%’

    OR Url LIKE ‘http://%.yahoo.%’

    OR Url LIKE ‘http://yahoo.%’

    OR Url LIKE ‘%/Search/%’

    OR Url LIKE ‘%/Search?%’

    OR Url LIKE ‘http://search.%’

    OR Url LIKE ‘http://bloglines.%’

)

 

DELETE FROM subtext_URLs

WHERE Url LIKE ‘http://google.%’

  OR Url LIKE ‘http://%.yahoo.%’

  OR Url LIKE ‘http://yahoo.%’

  OR Url LIKE ‘%/Search/%’

  OR Url LIKE ‘%/Search?%’

  OR Url LIKE ‘http://search.%’

  OR Url LIKE ‘http://bloglines.%’

I then ran the same commands that Scott did after reading his post.

DBCC DBREINDEX(subtext_URLs)

DBCC DBREINDEX(subtext_Referrals)

DBCC SHRINKDATABASE(SubtextData)

In order to run those commands on .TEXT, just replace the “subtext_” prefix with “blog_” and you are set.

Now I haven’t tested this, but I imagine the corresponding script for Community Server would be the following based on its published schema.

DELETE FROM cs_Referrals

WHERE UrlID IN

(

    SELECT UrlID FROM cs_Urls

    WHERE Url LIKE ‘http://google.%’

      OR Url LIKE ‘http://%.yahoo.%’

      OR Url LIKE ‘http://yahoo.%’

      OR UrlLIKE ‘%/Search/%’

      OR Url LIKE ‘%/Search?%’

      OR Url LIKE ‘http://search.%’

      OR Url LIKE ‘http://bloglines.%’

)

 

DELETE FROM cs_Urls

WHERE Url LIKE ‘http://google.%’

  OR Url LIKE ‘http://%.yahoo.%’

  OR Url LIKE ‘http://yahoo.%’

  OR UrlLIKE ‘%/Search/%’

  OR UrlLIKE ‘%/Search?%’

  OR UrlLIKE ‘http://search.%’

  OR UrlLIKE ‘http://bloglines.%’

comments edit

I got a 1099 for my blog yesterday. Now that is a weird feeling. Google giveth, the federal government taketh away.

Google has some tax information regarding ad-sense income. Basically operating this blog has in effect become a small proprietorship small business. I will deduct hosting costs etc… I wonder if I can deduct time spent on Subtext. That would be pretty sweet.

UPDATE: For my readers not familiar with tax regulations in the U.S., I should mention that the 1099 is used to report income other than wages, salaries, and tips. I linked to the Wikipedia explanation for more details.

comments edit

Troll Cap I love this idea from 37 Signals in handling abusive comments. Rather than simply deleting them, they will take the approach of shaming the abusers with a Troll Cap. Though it is doubtful that those who troll will really feel much shame, at least it serves an educational purpose of teaching others what is considered trolling behavior.

This is definitely an idea to put in Subtext at some point.

comments edit

Looks like Jeff Atwood is not content to let dead dogs lie when he revisits Edit and Continue.

Jeff argues that those decrying E&C are promoting a culture of machismo which implicitely states that “Everyone Should Code The Way We Do”.

As I stated in his comments, I think the real argument is not whether or not E&C is dangerous, but whether it should have a higher priority than other features introduced into VS.NET when the discussion first started.

I am not against E&C as I see it as a tool that can be used or abused like any other. When I was a VB programmer back in the day, I found it helpful at times while debugging a unit test. Rather than endure a compile and re-run unit test cycle that could take a couple minutes, I could simply fix a dumb typo in stride and continue on. I didn’t need it, but used responsibly, it saved me time in certain situations.

However, I wonder if there may have been other features that Microsoft could have focused on that would have been more worthwhile than E&C. When using test driven development practices, I find the need to use E&C greatly reduced. Unit tests provide a bigger bang for my development buck in writing better code. If I had a say in it, I would have suggested that Microsoft really focus on getting the test driven development story right, which they’ve completely failed at so far.

So again, for me it is not a question of whether E&C is useful, I believe it is, but whether it has pushed aside more useful features. What do you think?

comments edit

One common approach to having a script method run when a page loads is to attach a method to the window.onload event like so…

window.onload = function() { someCode; }

This is a common approach with methods for enhancing structural markup with Javascript like my table row rollover library, but it suffers from one major problem.

What happens when you include more than one script that does this? Only one of them will be attached to the onload event.

It would be nice if there was a syntax like the C# delegate syntax for attaching an event handler. For example…

window.onload += function() {} //This doesn’t work

However, there is a better way. In looking at the Lightbox script, I noticed the script references a method written about by Simon Willison. He has a method named addLoadEvent(func); that will append the method to the load event, without interfering with any existing methods set to execute on load.

Read about this technique here.