Tuesday, February 28, 2006

Driving the Speed Limit

You can thank Aaron for introducing me to this viral video. See what happens when a group of people decide to drive the posted speed limit on I-75 through Atlanta. Four lanes of the highway blocked by four cars all going 55 miles per hour. Pretty funny!

http://video.google.com/videoplay?docid=-5366552067462745475&q=speed

Nick Landry on DNR

On this week's .NET Rocks!, Nickolas Landry talks about Windows Mobile 5.0.

Say, isn't he the one who was trying to pick up the girl on Caesars 24/7 (reality show on A&E):

"... In Vegas, it's said that for every man there's a woman and for every woman there's a man. But does that include geeks? Four big time nerds in town for a computer programmer's convention decide to take a break from boring seminars and try to pick-up a woman they meet at the bar. Are they up to the challenge?"

Reference: http://weblogs.asp.net/cfranklin/archive/2005/01/19/355841.aspx

Monday, February 27, 2006

Upcoming Speaking Engagements

Greg Huber and I have a few more Media Center Presentation's lined up:

Feb 28, Northwest Ohio .NET User Group - http://www.nwnug.com

March 23, Central Ohio .NET Developers Group- http://www.condg.org/default.aspx

Abstract:
Will this be the year of the Home Theater PC (HTPC)? Come learn about Windows Media Center 2005 and decide for yourself. Topics covered include: Overview of Media Center, Alternatives to Media Center, The 10-foot Experience, Developing for Media Center, and using the Xbox 360 as an Extender.

Come check 'em out if you get a chance!

Disclaimer: Blatently plagerized from Greg's post!

I'm really digging this tag-team presentation style. It lets one person have a little bit of downtime to mentally prepare for their next part while the other person does their thing.

Greg and I still do post-mortems and refine the presentation every time that we do it: we watch the audience and make note of where people were falling asleep, and then decide to either improve that section of the agenda, or drop it altogether. And, of course, we've made it part of the show to make an actual sacrifice to the Presentation Gods (hoping that this gesture somehow makes the gremlins go into hiding).

Four Things Meme

This meme has gotten pretty popular lately among the blogs that I follow, so I knew it was only time until I myself got tagged. Thanks, Jim!

Four Jobs I've Had...

  1. Bailing Hay and Straw
  2. McDonald's
  3. Sorting Freight
  4. Programmer

Four movies I can watch over and over...
  1. Back To The Future (trilogy)
  2. Office Space
  3. There's Something About Mary
  4. The Matrix

Four TV shows I love to watch...
  1. LOST
  2. Ghost Hunters
  3. Two and a Half Men
  4. My Name is Earl

Four places I've been on vacation...
  1. Cancun
  2. Turks and Caicos Islands
  3. Virginia Beach
  4. Smoky Mountains

Four favorite dishes...
  1. Lasagna
  2. Mashed Potatoes and Gravy (served with just about anything else)
  3. Steak (medium-rare)
  4. Any burrito at Qdoba

Four websites I visit daily...
  1. www.bloglines.com (aggregates almost all of my reading)
  2. www.spaceweather.com
  3. news.google.com
  4. statcounter.com (Narcissism: I regularly check who reads my blog)

Four places I'd rather be...
  1. On vacation somewhere that it is warm
  2. Hiking
  3. Riding a motorcycle with no particular destination
  4. Sitting at the swim-up bar in a pool at the Moon Palace in Cancun

Four bloggers I'm tagging...
  1. Aaron
  2. Greg
  3. Carl
  4. Rory

resizeable != resizable

Here's a tip that might save you 30 minutes of debugging a silly problem: Resizable is spelled R-E-S-I-Z-A-B-L-E, not "resizeable".

When using in conjunction with window.open(), it seems that this feature name must be spelled correctly in order to work. ;-)

Hating Mark Miller About Now

Just wanted to add to the cliche: CodeRush rocks! And Refactor! Pro is not too shabby, either.

Now, I'm hating Mark Miller (the Architect of CodeRush) because I have to think of a way to come up with the funds to buy these products outright (or get my employer to do it for me, which I would greatly prefer!).

BTW: Inspired by the dnrTV episode, I wrote a CodeRush plugin myself. The first iteration was quite simple, but when I wanted to get into some language-independent code generation, I quickly got lost in the DXCore API. However, Mr. Miller was extremely helpful in pointing me in the right direction. Great product, great personal support--these guys are awesome players in a neat little niche. Plus, they're sponsors of .NET Rocks, which carries a lot of weight when it comes to me selecting/recommending products.

Saturday, February 25, 2006

Xbox 360 Extender: My "Session Terminated" Cause Identified

Before Greg Huber and I presented on Media Center for GANG, I had built a MCE box that was clean and contained everything that we needed for the presentation. Before (at the Dayton-Cincinnati Code Camp), we had his MCE PC, his laptop, and my laptop, and experienced all kinds of technical issues trying to network everything together for the presentation.

The box worked great, and was all set to go. Well, that was until I tried to connect my XBox 360 to it (which was needed for part of the presentation).

I ran through the PCSETUP program, and everything seemed fine. But, when the XBox attempted to connect to the Media Center session, I would always get a "Session Terminated" error. I tried for hours that day to get the connection to work, but everything failed. Then, when I tried to systematically remove one installed program at a time (hoping that it was my DVD software, or something else that was 3rd party), I ended up hosing the box big-time.

So, we ended up reverting back to Greg's MCE machine and both of our laptops... :(

I recently paved that machine and reinstalled everything. But, wouldn't you know it, the "Session Terminated" problem was still there! However, this time, I had the opportunity to dig deeper into the problem, since I wasn't pushing up against the start time of a presentation.

I was actually able to determine that a GeForce FX5200 was at fault. In order to promote discussion, I detailed the situation on The Green Button:

http://www.thegreenbutton.com/community/shwmessage.aspx?ForumID=58&MessageID=157807

Friday, February 24, 2006

The Code Room Episode 3 Is Out

The third installment of The Code Room is now online:

http://msdn.microsoft.com/msdntv/episode.aspx?xml=episodes/en/20060223CodeRoom3/manifest.xml

This episode is obviously scripted, whereas the previous two episodes were "reality television". Nonetheless, there is still a very important message presented: developers must consider security during the entire development process, and once a system is compromised, you cannot just patch the original holes because the hackers probably have a collection of backdoors.

(The first Code room "starred" Chris Menegay, Scott Bellware, and Tracy Sawyer).

Thursday, February 23, 2006

Good Week For Observing ISS in North America

Ever get a chance to see the International Space Station (ISS) with your own eyes? Its orbit will provide for a series of highly favorable passes over North America over the course of the next week or so.

To be favorable for naked-eye observation, you must be in the dark while the ISS, flying overhead, is illuminated by the sun (so, this happens either hours after sunset or hours before sunrise).

Use the Heavens-Above web site to help figure out when the ISS is visible from your location, and where to look in the sky. Be sure to synchronize your clock with the official time (important, since the window is only a few minutes).

When it's flying over, you pretty much can't miss it. It will be comparable to viewing Venus or an airplane with its landing lights on, but will slowly move across the sky until it crosses into the day/night terminator, at which time, it will just disappear.

Heavens-Above will also calculate for you other satellites that you can observe in pretty much the same way. The best viewing that I can remember was one year when the ISS and Space Shuttle flew overhead shortly after the Shuttle had detached from the space station. So, instead of one point of light, I saw two in close proximity to one another.

Windows Vista SKU Featureset Revealed

I hope that KenLin had the authority to reveal this info at this time:

http://msmvps.com/blogs/kenlin/archive/2006/02/23/84582.aspx

Since I've been presenting on Media Center lately, I immediately scanned the features matrix to see if it was going to be available across all of Vista's SKUs. Bottom line: Nope! Only the Windows Vista Home Premium and Windows Vista Ultimate SKUs will include the Media Center functionality.

Wednesday, February 22, 2006

MSDN on DVD

I received my first MSDN shipment yesterday from the subscription that I was awarded for being a Finalist in the Connected Systems Developer Competition.

I've been in charge of receiving the MSDN subscription media for my branch, which we receive as being part of the Microsoft Certified Partner program. These always came on CD, because all of our servers have CD-ROM drives (not a one has a DVD drive).

But, my personal subscription is on DVD. I'm amazed at how many products are crammed onto each disk, and by how much smaller the shipments are when compared to the number of CD's that we would normally receive at a time.

This comes as a relief to me, because I don't know what I would do with hundreds of CDs in my house (it's going to be bad enough keeping track of scores of DVDs!)

Mug Shot

The observant ones among you regular readers might notice a new addition to the sidebar...

Tuesday, February 21, 2006

Miniature Windmill Generator

This should come as no surprise to anyone, but somebody came up with a miniature windmill generator that looks like a small electric fan. At peak output, it appears that it can do 1 amp with a potential difference of 12 volts, which could be used to recharge a cell phone.

Big deal? Yeah. But, it interested me because of my thoughts a while ago of using arrays of micro-generators, like these, in order to produce significant levels of power (maybe enough for your house):

http://jasonf-blog.blogspot.com/2005/10/pressure-generator-array.html

One caveat, though: The huge electric generating windmills with the 30-foot blades continue to spin after the wind has stopped. This is because they store energy as angular momentum, like a flywheel. So, that benefit would not exist with the array of micro-generators (essentially, when the wind stops, so does your electric generation).

Monday, February 20, 2006

Burned by Floating Point Numbers

For those following along at home, you know that I've been working over the past few weeks with a big SQL Server database on a relatively small partition (until the new hardware arrives). Because of this, I've been trying to keep space consumption/database growth under strict control. When you're talking about millions of rows of data in a table, even 1 byte difference in the size of one numeric field translates to millions of bytes of extra disk space.

Well, one choice that I made was to represent decimal numbers using the "real" data type. This is a floating point decimal that uses 4 bytes per number. Other possible alternatives were all 8 bytes per number, so I essentially cut my storage in half (albeit, with some "acceptable" loss in precision).

While reconciling the results of my calculations to the set of control data, we came across a very good example of where this absolutely is the wrong choice of data type.

One field of the table contained Quantity information, and this was not always integer data (i.e., maybe it was weight). Well, my "real" numbers had no problems representing this data, for the most part. But, there was one point of sale where all of the sales were reversed (so that every record with a positive Quantity value would have a corresponding record with a negative Quantity value). The net quantity for this location was zero.

But, upon examination, my net quantity was coming out to be something like 0.000007472 due to errors introduced by the floating point math. Yeah, it's close to zero, but, it led to a serious flaw in my calculations.

You see, I was already trapping for Divide by Zero situations using a CASE clause:

SELECT CASE 
WHEN SumQty <> 0
THEN (Qty/SumQty)* ValToSpread
ELSE 0
END

If it weren't for the floating point math, then this particular SumQty value would have been zero, and the result of the calculation would have been zero. But, in this case, the floating point's "zero" was a small fraction--not zero.

A tangent: Do you know why Divide by Zero is illegal? It's because the Y-axis (x=0) is an asymptote for the hyperbola y = a / x. This means that as the number that you're dividing by gets closer and closer to zero (i.e., a fraction approaching zero) that the quotient gets larger and larger (approaches infinity). So, dividing by zero is undefined because it's actually +/- infinity at the same time.

What's the point of this mathematical mumble-jumble? Well, the sum of my quantity was not zero, but rather a small fraction: 0.000007472. The result of dividing by this number turned out to be a very big number, when the true result that was needed in order to reconcile with the control data should have been zero. So, my results were way off of where they should have been (to the tune of millions of dollars). Whoops! Good thing this was just in QA!

To resolve this one case, I changed the quantity field's data type to a "decimal", which is a fixed-precision number (I can specify how many total digits and decimal digits are maintained). I still went from a 4-byte number to a 8-byte number, but the result of the calculation was dead on.

So, the lesson learned: sometimes it's quite necessary to make the trade-off of space and speed provided by floating point numbers for the accuracy of fixed precision.

Day of .NET

Here's an exciting announcement:

What: Day of .NET (1-day Conference)
When: May 13, 2006 9:00 AM - 5:15 PM
Where: Washtenaw Community College, Ann Arbor, MI

Website: http://dayofdotnet.org/

A cooperative effort between:

Sunday, February 19, 2006

Breaking Change in No-Touch Deployment (2.0 Framework)

A peer of mine (Murph) brought this breaking change to my attention:

In prior version of the .NET Framework (v1.0 and v1.1), you had an option to distribute executables by hosting all of the files (EXE, config, and other necessary assemblies) on a web server, and then opening the EXE file by means of a URL. This is actually a precursor to ClickOnce, and was referred to as No-Touch Deployment (or HREF EXEs).

Well, it seems that by simply installing the 2.0 Framework onto a machine, you break the ability to continue using HREF EXEs.... when the server is in the Internet zone. The web server will log the GET request for the EXE, but you will not see any requests logged for the config file, and the user will get an OPEN or SAVE AS dialog, which in turn does absolutely nothing.

Credit to another member of my organization (Jones) for pointing out the following MSDN Product Feedback record, which discusses that this is by design:

http://lab.msdn.microsoft.com/ProductFeedback/viewfeedback.aspx?feedbackid=ef4ae9a2-1d40-4241-aca4-61d579929793

The workaround is to get the site out of the Internet zone. If it's a trusted server, then you can trust the site, and that will change the zone. Otherwise, you're left creating a new CAS policy. Either way, this does not sound like fun if the application was deployed to hundreds of client machines using HREF EXEs.

Saturday, February 18, 2006

Spot the Bug

Here is a completely made up query, but is close to one that I wrote recently to spread an overhead cost value (@MarketingExpenses) over a list of invoices. This is just one step in a complex series of calculations that helps to determine profitability of products or services sold.

SELECT 
CASE
WHEN COALESCE(b.sum_of_sales,0) > 0
THEN (a.sales / b.sum_of_sales) * @MarketingExpenses
ELSE 0
END AS ShareOfMarketingExpenses
FROM
invoice a LEFT JOIN regional_sum b
ON a.region_code = b.region_code


This query assumes that there's a table called [regional_sum] that has the sum of sales for each region. The [invoice] table is joined to [regional_sum] by linking the "region_code" fields of both tables, and since a LEFT JOIN is used, it will include all rows from [invoice] and only those rows in [regional_sum] that matches (if there is not a match, then NULL values will be used for the [regional_sum] data).

Now, the point of the COALESCE function is to return the first non-NULL value in the supplied list of values (b.sum_of_sales and zero). In this case, I'm simply trying to handle NULL values by changing them into zeros.

You'll also notice that I'm using a SQL CASE statement. I do this because I need to prevent the dreaded "divide by zero" error, so I ensure that the "sum_of_sales" field is not zero before trying to calculate a percentage (otherwise, I return zero as the result of the calculation).

The percentage is then multiplied by the predetermined "@MarketingExpenses" value in order to give you a number of marketing dollars that could be attributed to that one invoice record ("ShareOfMarketingExpenses").

Let me just assure you that the query above compiles and works as written, so the bug is not a syntax error. However, there was an issue that came up as we were trying to reconcile data from the new system with old/validated numbers (the sum of all of the "ShareOfMarketingExpenses" values did not equal the specified "@MarketingExpenses" value).

I'll leave it as an exercise to the reader, but I'll also provide some sample data:

============
REGIONAL_SUM
============

region_code sum_of_sales
----------- ------------
a0001 12345.67
a0002 432312.33
b0001 -123.23
b0004 34322.23
b0005 -12.12
c0006 234328.23

(Negative sales are probably due to internal accounting of moving inventory around from one region to another, but I'm not that close to this [fictitious] business, so I can't explain the numbers any better).

=======
INVOICE
=======

customer_id region_code sales
----------- ----------- ----------
1 a0001 12.32
1 a0001 33.23
2 b0001 5.34
3 c0006 1232.21
3 b0004 322.22
4 a0003 232.23
[the list goes on, but pretend that the
sales for each region correctly sums up
to the values listed in the above table]

It was a pretty cool "Ah ha!" moment for me when I spotted the flaw. Your mileage may vary.

Thursday, February 16, 2006

Is Google Preventing Analysis of Their Search Results?

Robert Scoble has been doing an experiment over the past few days where he asks his readers to include a simple non-existent word in their blogs in order to create a new meme: brrreeeport.

Some initial findings can be found here:

http://scobleizer.wordpress.com/2006/02/15/brrreeeport-crazy-and-more-search-engine-lies/

Now I don't know the full story, but Google is apparently no longer serving up any results for the term "brrreeeport". Is the DNE (Do No Evil) Gang worried about Robert's findings surrounding the accuracy of their reported search results? (In other words, it appears that Scoble's experiment is calling them out on the fact that they inflate the reported number of search matches)

Where did all of the brrreeeport matches go?

UPDATE Feb 17, 2006 8:00AM EST: I checked this morning, and the 22,700 results are back online from the main Google web search. But, since you can only have a maximum of 1000 results returned for any given query, how can anyone verify that there are indeed 27,000 real matches for "brrreeeport" in the Google database?

They're Back!

Tuesday, February 14, 2006

Special Appearance, 1 Night Only!

Greg and I will be presenting at the Great Lakes Area .NET User Group (GANG) meeting on Wednesday, February 15th at 6PM (Microsoft Southfield office (in the Fifth-Third tower near Evergreen and 10-mile/Lodge)).

http://www.migang.org/Default.aspx?tabid=22

The topic will be Windows XP Media Center Edition 2005. The first part will include a general introduction to MCE (what, why, and how). The second part will include some examples of how to develop for this platform. And, we're sure to whip out my XBox 360 at one point or another.

There is a bit of irony in me doing this presentation on Wednesday: I'll be bringing my HTPC machine with me for the demo, so there will be no PVR at my home to record LOST. :)

BlogCode looks cool

Scoble blogged about this: If you have a blog that you like, BlogCode will let you find other blogs that are similar in nature. It goes well beyond just keyword matching.

brrreeeport!