Thursday, April 28, 2005

Eric Wise on H1-B visas

Amen: Eric Wise : Should we uncap H1-B visas?

The U.S. hands out 65,000 (temporary)H1-B visas per year, to people who have received degrees from U.S. colleges and universities. At the same time, through the annual green card lottery (formally known as the Diversity Lottery), the U.S. hands out 55,000 permanent work and residency visas to anyone who is not from an over-represented country, who has a high-school diploma or 2 years of work experience that requires prior training, and who manages to send in the application during the one month window. Which program makes more sense?

Social Explorer

Useful tool for demographics research: Social Explorer has the 2000 census data displayed as interactive maps.


More Google Maps goodness: Home : myGmaps and the GoogleMapsHacking Wiki.

View Google Maps on TiVo

I'll have to try this: View Google Maps on TiVo

SQL: ISDATE(@foo) and CAST(@foo AS smalldatetime)

SQL is a squirrely language when it comes to string manipulation, but it has some nice functions. ISNUMERIC and ISDATE are two of them.

ISDATE does not work exactly as advertised in SQL Books Online, however. One feature not mentioned there is that any 4 digit string from '1753' to '9999' will be evaluated as a date (ISDATE interprets the number as a year, and valid years for datetime are 1753-9999). Unfortunately, CAST('1753' AS smalldatetime) will NOT work, as smalldatetime allows years only from 1900 through 2079.

In order to verify that a string input is indeed a 'small' date, I'd recommend the following function:

--Checks if a string is a valid smalldatetime
 @SmallDateString varchar(20) --The input string to check
 DECLARE @Result bit
 IF ISNUMERIC(@SmallDateString) = 1
  IF CAST(@SmallDateString AS int) BETWEEN 1900 AND 2079 
   SET @Result = 1
   SET @Result = 0
  SET @Result = ISDATE(@SmallDateString)

 RETURN @Result


Tuesday, April 26, 2005

Transatlantic Swim Comes to End, Marketing at Fault

Those damn marketing guys can never do things right... Nice publicity stunt from Opera, the Norwegian web browser company: THE 1 MILLION DOWNLOAD CHALLENGE - Opera Web Browser

Friday, April 22, 2005

Rick Santorum (R-PA) bears an uncanny resemblance to a jack ass

Rick Santorum, the esteemed representative from Pennsylvania, is at it again: Weather info could go dark

Annoying .NET SP1 GroupBox and FlatStyle.System bug

I encountered this nasty .NET 1.1 SP1 bug in the Windows.Forms groupbox control yesterday, and unfortunately the workaround is not that straightforward to implement in reality.

My own less-than-perfect workaround is instead to disable FlatStyle on nested groupboxes. Here's the method I use to apply the styles:

  #region SetObjectPropertyValue
  /// <summary>
  /// Attempts to set the value of a property of an object.
  /// Returns true if successful, false if not.
  /// </summary>
  /// <param name="objectInstance">The instance of the object</param>
  /// <param name="propertyName">The name of the property</param>
  /// <param name="propertyValue">The desired value of the property</param>
  /// <returns>True if successful, false if not.</returns>
  public static bool SetObjectPropertyValue(object objectInstance, string propertyName, object propertyValue)
   bool isSet = false;
    //use reflection to attempt to set the FlatStyle of controls
    Type controlType = objectInstance.GetType();
    //attempt to get the Control's specified property
    PropertyInfo prop = controlType.GetProperty(propertyName);
    //if it exists and is settable, set it
    if (prop != null && prop.CanWrite)
     prop.SetValue(objectInstance, propertyValue, null);
     isSet = true;
   catch {}
   return isSet;
  #endregion (SetObjectPropertyValue)

  #region SetFlatStyleSystem
  /// <summary>
  /// Method used recursively to set the FlatStyle property to system 
  /// for all descendants of a control.  Called from the form's constructor.
  /// </summary>
  /// <remarks>
  /// Originally copied from Chris Sells' Windows Forms Programming in C#, 
  /// then embellished by Oskar Austegard (added Reflection).
  /// Requires that the main form's Main() method includes the line
  /// <code>Application.EnableVisualStyles();</code>
  /// prior to showing any UI.
  /// </remarks>
  /// <param name="parent">Control to start with</param>
  public static void SetFlatStyleSystem(Control parent)
   //loop through any & all child controls
   foreach(Control control in parent.Controls)
    //don't do this for labels (changes their vertical alignment)
    //and for groupboxes contained within other groupboxes (which due to a bug render with a large font)
    if (!(control is Label || (control is GroupBox && control.Parent is GroupBox)))
     SetObjectPropertyValue(control, "FlatStyle", FlatStyle.System);
    //Set contained controls' FlatStyle as well

Thursday, April 21, 2005 - Microsoft to support Linux - Microsoft to support Linux: In Virtual Server. Should prove interesting.

Wednesday, April 20, 2005

Sneak Preview of ReSharper IDE -

Looking forward to it: Sneak Preview of ReSharper IDE -

Labels: ,

Google Maps + Craig's List = Impressive!

This guy combined Google Maps with Craig's List's Housing listings and the results are very impressive. I'll actually use this...
He appears to have a pretty good job as the Technical Lead of Animation Tools at Dreamworks - otherwise I could see Google luring him away.

Tuesday, April 19, 2005

The Bioweaponeers

A seven year old horror story: The Bioweaponeers

Monday, April 18, 2005

My Linguistic Profile

So - my native tongue is Norwegian, but here's my American English profile:

Your Linguistic Profile:

65% General American English
30% Dixie
5% Yankee
0% Midwestern
0% Upper Midwestern


Bring on the flying cars and stratellites

Thursday, April 14, 2005

Click Image, Showing More Bigger

I like my Lian Li computer case - but maybe I should have gone for their computer desk.... I love how the marketing people still plopped a laptop on top, with no other monitor in sight.

VB.Net vs. C#.Net

From Philippe Lacoude's Homepage (via Sahil Malik's blog). One of the most comprehensive comparisons I've seen.

Wednesday, April 13, 2005

DC, Sunday

Tuesday, April 12, 2005

The beginnings of an AJAX Wrapper for .NET

At my last company we used javascript-invoked webservices to do behind-the-scenes updates of data in our enterprise-level application. It was one of the many hoops we had to jump through, and one that made me swear I'd not do on my next project. a formal AJAX implementation in .NET would have made things a lot easier: New version of AJAX Wrapper for .NET

Monday, April 11, 2005

Updated CodeSmith templates

CodeSmith 3.0b3 is out, and my old templates were not compatible as the file-header comments I used did not use the apropriate comment tags. This provided a nice excuse to update them, and test the beta at the same time. Below are the results:

  • Stored Proc Wrapper - a C# wrapper around stored procedures
  • CRUD Procs - a template for creating CRUD procedures (and more)
  • Stored Procedure Descriptions - updated version of my sample template included with CodeSmith, creates Description extended properties for procedures and their parameters
  • Add/Drop Columns - simplifies the process of adding/dropping a column to/from multiple tables

Oh, and CodeSmith 3 is definitely worth the upgrade.

Labels: ,

Yet another reason to use Firefox instead of IE

What may look like gibberish in Firefox may look quite normal in IE, thereby exposing users to both spam and phishing attacks: Ned Batchelder: Phishing fun with Unicode

ADO.NET Performance Test: Getting a Single Value

John Papa conducted a performance test on getting a single value from a database: "it turns out that ExecuteScalar test ran slightly faster than the output parameter test, and much faster than the DataSet test".

This is surprising - I always had thought - based on reading - that NonQuery was faster than Scalar. Guess I was wrong.

Thursday, April 07, 2005

More daylight-saving time

Via Slashdot: - Congress may extend daylight-saving time - Apr 7, 2005

"'The more daylight we have, the less electricity we use,' said Markey, who cited Transportation Department estimates that showed the two-month extension would save the equivalent of 10,000 barrels of oil a day."

More Portable DTS Packages

More Portable DTS Packages

Tuesday, April 05, 2005

More on Plug-In Hybrids

EV World: The World of Electric, Plug-in Hybrid, Fuel Cell and Alternative Fuel Vehicles

Labels: ,

Monday, April 04, 2005

..and power it all by burning grass.

Burn Grass, Get Green Biofuel

Apparently grass burns at 96% the efficiency of wood pellets and has an energy output:input ratio exceeding 10:1.

Air/Electric Hybrid

For a completely different type of hybrid: Pneumatic Hybrid Electric Vehicle.
Wonder what the energy losses are in "filling the tank" (pumping ambient air to 300 bar)?

Labels: ,

Plug-In Hybrids

Why should a hybrid vehicle not be able to be plugged-in at night to recharge the batteries?

Labels: ,

Sunday, April 03, 2005

You Can't Save Daylight

About the insanity that is "Daylight Saving Time": CBS News | You Can't Save Daylight | April 2, 2005 23:30:01

I want my hour back.

Labels: ,

Friday, April 01, 2005

P2P Revolution: Opera Announces Platform-Independent Real-Time Speech Technology

Always happy to announce new technology coming from Norway: P2P Revolution: Opera Announces Platform-Independent Real-Time Speech Technology

To SP or not to SP in SQL Server

A balanced, nuanced analysis of the arguments for and against stored procedures: To SP or not to SP in SQL Server


Google Ride Finder

The Google Ride Finder is yet another amazing tool from Google. Essentially it's Google Maps plus real-tme access to the GPS databases of cab/shuttle companies.

Here are cabs/shuttles in the BW area.

More at the Google Blog