Sunday, January 01, 2006

Every so often something comes across one's desk that results in a “hey! what's that!?” moment.  Now I'd like to believe that I have acquired a deep level of comfort and familiarity with the syntax of my favorite development language (C#).  Today, however, I had one of those moments.  I saw a line of code that resembled:

Console.WriteLine(userName ?? "User name not specified");

Note the ?? operator.  It took me a bit to find information about it, I really had to do some digging - it wasn't coming up on the msdn sites...I wonder if the search engines just didn't like the question marks.  Whispering from the recesses of my mind I seemed to recall having seen it, but all memory of its usefulness had vanished...I had to relearn it.

Anyway, this operator (termed a null coalescing operator) is new in C# 2.0...and it's pretty slick.  The null coalescing operator provides inherent null-checking capabilities.  The result of the expression is based on whether the first operand is null.  If the first operand is not null, it is the result of the expression, otherwise, the result falls to the second operand.  In other words, return the first value if not null, otherwise the second.

In effect, the previous line could be written thus:

Console.WriteLine( null != userName ? userName : "User name not specified");

That's pretty awesome - especially since in general I'm a fan of the ternary, conditional operator (?:), I think I can really fall in love with this new capability.  I suppose the null coalescing operator (??) is just syntactic sugar, but I like it nonetheless.

Let's suppose you had a function named 'getCustomer' that accepts an id that is used to retrieve a customer object from some underlying store (such as a database, collection, file, etc).  If the customer exists, it is returned.  However, if it doesn't exist, a value of null is returned.  In this particular instance you might have an operation that indicates that if the customer doesn't exist to create a new one:

Customer cust = getCustomer(id);
if ( null == cust ) cust = new Customer();

You could effectively rewrite the previous lines as

Customer cust = getCustomer(id) ?? new Customer();

Note, you would NOT want to do the following for reasons which are self evident.

Customer cust = ( null == getCustomer(id) ) ? getCustomer(id) : new Customer();

A couple of links that I did eventually find which are good reads: Fritz Onion's blog and Oliver Sturm's blog.

Ya (re)learn something new everyday.

Sunday, January 01, 2006 8:40:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [45]  |  Trackback

In keeping with the tradition we established last year, we had some friends over to commemorate the coming year.  This time, however, rather than watch a movie marathon we decided to do a boardgame marathon, though much more abbreviated than last year's movie marathon.  We had Eric and Kimberly Tolman over to eat dinner and play games, and play we did.  We tried some new games which were loads of fun.

We played:

  • Speed Scrabble - A variation on Scrabble that the Tolmans taught us consisting on building out your own private set of tiles before everyone else.  I love Scrabble so this is a welcomed addition to our gaming repertoire.
  • Mystery of the Abbey - a whodunnit mystery game similar to, but quite distinct to Clue.  That was a good time.  Oh, it was Brother Harold whodunnit you know, the thin, hooded, clean-shaven Brother Templar.  Just as I suspected.
  • Shadows Over Camelot - a fantastic game that works hard against you.  It whooped our butts.  We need to develop a strategy for beating this game.  I look forward to the next time we can play this.
  • Carcassonne - A now-staple game around our house which we discovered nigh a year ago now, we played with the Inns and Cathedrals and the Princess and the Dragon expansions.  Lots of fun.  Carcassonne is a wonderful tile-based game.

All in all we had a great time!

Perhaps I should post something about setting goals, my personal goals, etc in a post such as this, but I just wanted to report on our evening.  I'll be touching on other more lofty topics in the days to come.

Happy New Year!

Sunday, January 01, 2006 4:37:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Friday, December 30, 2005

I met Ron Crumbaker today (he's an SMS MVP) out there in Kentucky.  He's been wanting to enhance his blog (and about 50+ others on his site) with various sundry items such as a rating control, CAPTCHA, etc.  He was having a few issues with it so we got together on the phone and worked through the issues and now he's up and running and it looks great!  Plus he's now up and running on the custom build of the Clearscreen CAPTCHA control by Miguel Jimenez that I made that actually preserves your contents across a post if the code the user enters is invalid, etc.

It's always exciting to have people use your software and be pleased with it.  I hope it works well for him!  You gotta check out his blog.

NOTE: You can find the latest rating control (version 1.0.1.1) here.

Friday, December 30, 2005 4:53:00 PM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [1]  |  Trackback
 Wednesday, December 28, 2005

I was just reading a post by Scott Hanselman on switching off of Acrobat Reader to Foxit's Reader.  I must say I wish I had known about this tool a long time ago.  While I've never had Acrobat crash as Scott did, I've never really enjoyed using it.  Among other things its load time was WAY too long simply to read a document (sure, there are ways to speed it up, but it's a headache).

  1. Gone are the load times; Foxit Reader 1.3 loads almost instantaneously.
  2. Gone is the bloat; Foxit Reader is about 2.5 MB and runs without an installer and with a smaller memory footprint (about 50% smaller).

It's added to my \Tools directory and my thumb drives...awesome!

Wednesday, December 28, 2005 5:34:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [4]  |  Trackback
 Monday, December 26, 2005

Several months back I went down to my local Circuit City and picked up a NetGear RangeMax Wireless Router WPN824.  It wasn't, however, until December 24th that I actually had a chance to do something about it.  Over the years I've been impressed with NetGear's routers, having long employed a NetGear RO318.

In setting it up, I was able to effectively eliminate the RO318 (which is a wired router) and my other wireless router and consolidate them to a single unit with many more capabilities.  I am very excited and impressed with the new RangeMax as it offers many things that my other routers could not do, or at least didn't do well.

DHCP Reservations - One reason that I so thoroughly enjoyed Windows-based DHCP is that of reservations.  The effectively allow you to assign a hard IP address to a particular MAC address on the LAN.  My other routers did not offer such a capability, but this one does.  It both acts as my DHCP server as well as assigns hard IP addresses to devices (such as my Brother HL-5170DN printer, servers, etc) so I don't have to go in and configure them manually.  :-)

Firewall - My other routers of course offered firewall protection...which was very welcome and expected.  This router, however, has a double firewall for additional security.  And while I've seen it in other routers (and yes, my RO318 was rather antiquated), this router provides me to specifically designate the protocol (TCP/UDP) to accept over a given (set of) port(s), it also allows for an arbitrary list of ports.  My RO318 would only provide a set of about 10 ranges of ports for incoming traffic.  For the most part this might be sufficient, but I was constantly banging my head against a wall when needing to open other ports because my list was constantly full.  This RangeMax, on the other hand, doesn't yet seem to have an upper limit on the number of ports and ranges of ports that I can open.  Additionally, it allows me to 'name' the port range.  I fall back to simple protocol names, but it sure makes it easier to remember why I opened port 372 (arbitrary port # of course) and what it was for.

Wireless Security - I have rarely encountered a wireless router that didn't have problems with wireless security.  I've had, oh, three or four different wireless routers from different manufacturers and anytime I set up wireless security (be it WEP, WPA-PSK, etc) the router would freeze, I couldn't reconnect, or I could connect for a bit and then it would drop me...basically I had issues.  The best I could do on security was simply to disable SSID broadcast and lock it down with MAC filtering.  This one, however was a snap!  I setup the wireless security, MAC filtering, and disabled the SSID broadcast and it all just worked...and continues to do so.

Even though I don't have the recommended NetGear Wireless PC Card (which I might pick up today just for kicks to get the 108 Mb performance), I have never dropped, consistently had an 'Excellent' 54 Mb connection, and the router is traversing more walls and floors than before.  I am impressed.

If you're in the market for a router, want additional security, want awesome performance, and a greater network range, definitely take a look at the RangeMax router...I'm hooked already.

Monday, December 26, 2005 3:57:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Friday, December 23, 2005

This is awesome - it's always great to find/discover tools out on the web.  Even ones that have been out there for years and you just never knew about 'em.  This is one of those cases for me.

ColorBlender is a free online tool that will automatically create palettes of matching/coordinated colors (a blend).  You can save your blends, download them in an .ACT file for Photoshop (awesome...I'll be using this all the time), an .EPS file (same for Illustrator), do PANTONE matching, etc.

It has a great UI for managing the RGB values of your color via sliders and provides some slight variations on your color.

For all those out there that are color-scheme challenged, this site should be on your 'do-not-misplace-this-site' list.  Very cool.

Friday, December 23, 2005 4:06:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Thursday, December 22, 2005

Today we had the front door on the house replaced - a much desired improvement on the home.  I've added these before and after pictures to the House Projects gallery (before, after)  The next step is to get shutters on the house to match.  Then redo the flooring in the house.  We're going to tear up the carpet and put hardwood throughout the first floor entry, kitchen, and living room; but some of these projects will have to wait until the summer...or next...or the one after that.

Thursday, December 22, 2005 8:20:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [0]  |  Trackback
 Tuesday, December 20, 2005

I was working with a customer today on an issue.  The customer had a custom VS project that he had inherited from another developer who had since left the company on other pursuits.  While the original developer could work in the solution just fine, the new developer was receiving the following error message:

Visual Studio .NET cannot create or open the application.  The likeliest problem is that required components are not installed on the local web server.  Run Visual Studio .NET setup and add the web development component.

Naturally the first thing I tried was to repair IIS with the following commandlines:

cd %windir%\Microsoft.NET\Framework\v1.1.4322
aspnet_regiis -i

That didn't fix the error, though I didn't really expect it to - the .NET extensions were all already properly mapped in IIS.  The solution was (unlike all of the recommendations that I found online to run the aspnet_regiis utility) to fallback to the same solution that had solved another issue a long time ago:  to delete the VSWebCache folder.

The VSWebCache folder is created automatically by Visual Studio when you open/create a web project and can be found in <root>\Documents and Settings\<user>\VSWebCache\<machinename>.  Simply delete this folder and VS will recreate it when you attempt (now successfully) to open the web project.

Tuesday, December 20, 2005 4:06:00 AM (Mountain Standard Time, UTC-07:00)  #    Disclaimer  |  Comments [90]  |  Trackback