Category Archives: Uncategorized

You Have an Architecture

The first step is admitting there is a problem…

Blueprints for Bytes

The Symptoms

There we are standing in front of the whiteboard at 5:00 on Friday afternoon.  Myself, the development manager, and a couple gifted software engineers are staring at the multicolor boxes and lines scribbled on the board.  A feeling of defeat flows through the groups psyche.  Yet again, while trying to come up with a solution to the latest critical bug, we have all made the realization that the architecture of the system is severely broken.  Fixing this bug is going to take an inordinate amount of time.  A new concept will likely need to be introduced which means touching just about every piece of the system.  As we all shake our heads and shrug our shoulders in silence somebody says “Well at least now we know what the architecture is.  I’m going for a beer; anybody in?”

How can this be?  How is it that multiple years into a…

View original post 897 more words


Event Namespacing: It’s A Good Idea

If you’re a web developer and use jQuery chances are you have had, or will have, the need to attach event handlers to your page elements.

With jQuery you can do this in a number of ways .on, .bind, directly with .click (blur, mouseout, etc…), and more.  For more information regarding adding handlers and removing them see the jQuery API documentation.

A quick example using .bind:

$( "selector" ).bind( "click", function() {
//do something;
});

And if you ever needed to remove your handler you could do something like:
$( "selector" ).unbind( "click");

This is all very simple and works great.  However, what if you need to remove a specified handler?  For example, if you’re writing a plugin and need to remove only the plugin’s custom handlers.

Both jQuery functions .off and .unbind allow you to pass in the method signature to remove the specified handler. However, this requires you to maintain a reference to the handler which may not be ideal.

This is where event namespacing can come in handy.  Adding a namesspace to your handler when you attach it allows you to safely remove it later without removing all event handlers of the same type.

Here are the same bind and unbind methods using a namespace:


$( "selector" ).bind( "click.mynamespace", function() {
//do something;
});

$( "selector" ).unbind( "click.mynamespace");

Namespaces gives you the flexibility to unbind specific event handlers while maintaining the ability to unbind by event type or all handlers at once.  It can also be used in the same way to trigger a specific event handler.  And it’s a good practice to easily identify custom event handlers, especially when developing plugins.


Visual Studio Switches

Visual Studio offers a number of command line switches that allow you to run the IDE and perform a specified task.  You can get a complete list and more information here Visual Studio Command Line Switches .

Here are a couple I’ve used.

First /ResetSkipPkgs:

This comes in handy when updating a web reference and get this error: “The components required to enumerate web references are not installed on this computer…”  The error goes on to suggest re-installing visual studio.  But, what this really means is at some point during start up a visual studio extension did threw and error and you said yes to not load it in the future.  All you need to do is run the above command and you should be able to update your web reference.

Second /Log:

Running this will create …\Application Data\Microsoft\VisualStudio\9.0\ActivityLog.xml.  I haven’t used this personally, but the vendor of a third party tool I’m using asked for it to help troubleshoot an issue.  I thought I’d pass it along.


%d bloggers like this: