Thursday, September 07, 2006

Over the past several months (years) I've given a series of presentations on the topic of Threading in .NET.  These presentations have been to various .NET User Groups, at company 'brown-bag events', or even over Live Meeting.  They have been a real treat for me as I love the topic and it's near and dear to my heart.  I came across this free e-Book (also available as a PDF) that I would highly recommend to anyone wanting to dig in and learn more about Threading in .NET.  The e-Book is written using the C# language, but that shouldn't be a hindrance to anyone wanting to understand the inner workings of the topic.

Enjoy!

Thursday, September 07, 2006 9:56:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Wednesday, September 06, 2006

All in all, I must say that I am indeed a fan of the Web Application Projects (WAP) in VS 2005.  If you're familiar with web development in the VS 2003/.NET 1.1 world, then this provides a much more comfortable and familiar experience than the Web Site Projects (WSP) in VS 2005 out of the box.  I won't belabor the benefits of using them here as they have been covered extensively online.

I had created a WAP several months ago and came back to recently to update it and work on enhancing the functionality.  By way of tendencies, I like to design such that each class is an internal class (that is, not publically exposed) with internal constructors, methods, properties, etc.  As such, when I make a class public my intentions are clearer and the scope of the class is well defined.  Well, such a model doesn't work too well with WSP due to the myriad of assemblies created.  Today, however, in testing my application I was presented with an error message indicating that a class was “inaccessible due to its protection level”.  This warning indicates to me that I'm trying to use a class out of its defined scope (in this case - internal).

As it turns out my .aspx code-behind IS in the same project as the internal class, but the WAP was exhibiting behaviors reminiscent of the WSP.  In fact, the project would compile and I'd get .dlls generated in my \bin folder, but at runtime the .aspx pages were getting compiled into their own dlls.

The easy way to fix this (and I didn't know this wasn't here before) is to do the following:

  1. Right-click on the WAP in the solution explorer
  2. Select “Convert to Web Application”

That fixed up whatever was wrong with the project and now it works like a charm.

Wednesday, September 06, 2006 2:33:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Tuesday, September 05, 2006
Borlard just released their Turbo Explorer for Windows.  I've been anxious to try out this free tool for a while now (ever since it was announced).  It enables you to compile Delphi, C++, Delphi.NET, and C#.  It seems pretty cool.  We'll see how it compares to Visual Studio 2005.  While I LOVE VS.NET, the 2005 version is something of a stack of cards.  I'd like to see this give it a run for its money.  Maybe that'll be the kick the pants that Microsoft needs to release some updates.
Tuesday, September 05, 2006 9:53:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Wednesday, August 30, 2006

Jeffrey Palermo has assembled a great list of productivity features inherent in JetBrain's ReSharper (R#) that make it one of my all-time favorite tools.  I have a hard time remembering the myriad of keyboard shortcuts, but he mentions several that I use on a daily basis that make programming a joy.

It's a great reference for users of the tool and a great list of enticements for those not using it that want a boost to their programming environment.

Wednesday, August 30, 2006 9:20:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, August 29, 2006

I'm looking for laptop bag suggestions, ideas, and recommendations.  I currently have a great bag - it's an Ogio (I forget the model), but it's the best and most spacious bag I've ever had.  That said, however, I am in the market for something else.  I travel quite frequently and my bag weighs in excess of 50 lbs and my back is taking the toll - not to mention that it's a pain at airports.

Here's what I need in a bag:

  • Must be able to have as a carry-on on a plane.
  • Must be able to carry a Dell Precision M90 (17“ monitor) + accessories
  • Must be able to carry a Dell Inspiron 8600 (15.4“ monitor) + accessories
  • Must be wheeled - I don't want to carry it all the time.
  • Have more room to carry 1+ external hard drives, headphones (Bose QuietComfort 2), power strip, etc
  • Preferrably have more room for a few magazines, a book or two, papers, notebooks, etc.

Any suggestions?

I'm considering the following:

I've seen others but they're less than inspiring.  I'm hoping that people have some good suggestions 'cause I'm at a loss but I need to get one soon.

Tuesday, August 29, 2006 1:27:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  |  Trackback
 Wednesday, August 23, 2006

Last night we held the August 2006 incarnation of the Geek Dinner at Los Hermanos in Lindon, Utah; right back where we started in November of last year.  After enjoying our meals we lent an ear to Senatorial candidate Pete Ashdown.  Some of you may not know of Pete directly, but you've probably heard of the company he started years ago called XMission (especially if you're from Utah and haven't lived in a cave for too long).

I encourage you to find out more about Pete's stances on issues as he presented them, they make a lot of sense - especially when it comes to technology.  Pete has the unique position of understanding technology and the internet (unlike Ted Stevens misunderstanding of the 'Inter-Tube') and a great desire to serve the interests of Americans.  We could definitely use (a lot) more people in the Senate et al that understand technology.

Anyway, hope to see more at the next Geek Dinner.  I'll announce it here when we figure out what's happening next.

Wednesday, August 23, 2006 2:43:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, August 22, 2006

I made a few updates to the Regex Assembly Builder tool that I posted a few days ago.  Most notably are the following updates:

  • NEW: Added a 48x48 256 color icon.
  • FIX: Opening Strong Name Key file returns access denied if the file is readonly.
  • FIX: Unable to specify assembly name identifier with period delimiters.
  • NEW: Application now strong named.  This is a breaking change.  All assemblies generated heretofore with the utility will not work with this application because of an embedded attribute.  This will not be an issue moving forward, but my apologies for the mistake.
  • NEW: Added ability to specify output path and to change the target directory the generated assembly.
  • UPD: Set font on the Zoom/Text Editor to be 'Consolas, 9pt'.  If you don't have Consolas, get it - you won't regret it - hands down one of the greatest monospaced fonts out there.
  • UPD: Set anchor on RegexEditor control to support resizing of TextBox controls.
  • UPD: Added application configuration file to support binding redirects when application is updated.

All in all, these updates were added smoothly.  Let me know if you have any issues with the update.

Feel free to download it here.

Coming features include:

  • Namespace view in TreeView to allow for a more natural navigation.
  • Alphabetical listing of regular expressions in TreeView.
  • (possible) Regular expression editor to allow for the creation of the regular expressions directly in the tool.  I may integrate with another tool if anyone has suggestions.

What features would you like to see in it?

Tuesday, August 22, 2006 8:54:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [2]  |  Trackback
 Friday, August 18, 2006

Regular expressions provide a powerful means to harness the capabilities of text.  Deeply ingrained in the heart of .NET is a vast and powerful regular expression toolkit found in the System.Text.RegularExpressions namespace.  This is a well-known fact.  Many developers, myself included have been using them for years and years because they provide unparallelled control over interpreting, parsing, extracting, replacing, and manipulating strings.

I'm not going to bore anyone by further explaining the benefits of regular expressions nor will I go into explaining how they are constructed and how they work.  Every single developer, IMHO, should have on his desk the fantastic book “Mastering Regular Expressions” by Jeffrey Friedl.  It is a MUST read.  It's a MUST read many times.  I absolutely love it.  Alright, enough evangelism.

When creating regular expressions in .NET you have the opportunity to establish how the regular expression will be used to process your text by a RegexOptions enumeration.  By default, the regular expressions that you create are interpreted and evaluated at runtime.  There is nothing particularly wrong with that.  If your regex is used infrequently then that can be perfectly adequate.  However, suppose your regular expression needs to be utilized much more frequently.  It is quite possible that your application's performance may begin to degrade because of such frequent interpretation of the regex.

One of the RegexOptions enumeration values is Compiled.  When you apply the Compiled option to the regular expression you are telling the .NET runtime that you don't want the regex interpreted, but rather that you want it to be compiled.  Ultimately, this will usually have the benefit of being more efficient.  However, there is a cost.  The compilation happens at runtime.  When the execution path hit the regex flagged for compilation the .NET runtime will dynamically generate an assembly, load it, and execute it.  So there's an initial hit.

This might be fine and dandy...but it's going to happen once for every compiled regular expression.  In other words, if you have 25 compiled regular expressions in your code, you'll end up with 25 dynamically generated DLLs in memory.  That doesn't sound good to me.

The wonderful thing is you can take this hit up front entirely and generate a single assembly that contains as many pre-compiled regular expressions as you desire.  This is accomplished through code - there's no built-in IDE support.  The added benefit of a pre-compiled regex assembly is that you can fine tune your regular expressions out-of-band with your application.  You don't have to recompile your application(s) to get the updated regular expressions.  Instead, you reference your regex library and you have access to them.

This magic is accomplished via the Regex.CompileToAssembly() method.

Over the past couple of days I created a little application that I call the “Regular Expression Assembly Builder”.  This tool provides you with the ability to gather your regular expressions, organize them, and ultimately compile them into a DLL.  Essentially, with this tool you can:

  • Open and edit existing assemblies containing regular expressions (via Reflection).
  • Create brand new assemblies.
  • Organize your regular expressions into hierarchical namespaces.
  • Strongly name (even Delay Sign) your resulting assembly with a key file.
  • Apply several attributes to your target assembly.
  • ...and much more

Here are a few screen shots of the application in action:

  

The application plus source can be downloaded directly here or from the link on the main blog page.

Enjoy!

NOTE: I didn't know a tool like this existed already, but when I was just about done with the project I stumbled upon a similar, yet distinct, project that you might also be interested in.  It looks like Brian Delahunty took the initiative to create this well before I did.  Good job!

Friday, August 18, 2006 4:56:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [3]  |  Trackback