Saturday, August 09, 2008

There's a really cuil set of photos showing the Large Hadron Collider being setup in Europe. Very high tech stuff.

Just a little bit down from the top of the photo stack is an image of someone way down the aisle in the server room. You get the idea that there are just racks and racks and racks of servers with a mind for effective use of power consumption, space utilization, heat and all the other green elements.

The person at the end of the aisle is working on a server. They're sitting at a workstation, typing on a keyboard... looking at a monitor. Not a slick flat screen, but a huge honking cathode ray tube monitor from 1994! Hah! That thing probably takes up the space of three or four servers and gives off as much heat!

Saturday, August 09, 2008 9:32:43 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [1]  | 
 Thursday, July 31, 2008

I just had a Pwop moment (the sound of a forehead slap) with LINQ:

I needed to retrieve a distinct list of years contained in a collection of objects. The data was in the form of an generic List<T>, already loaded into memory. So without thinking too much about it, I sat down and wrote a quick LINQ expression that included the Distinct() operator and since the years were actually properties on the objects, I wrote my own implementation of IEqualityComparer.

It had some problems because the resulting data was not really all that distinct, and then it happened: PWOP!

I don't need to implement an interface. I can simply use the default equality comparer for a List<int> like so.

LINQ Distinct() Operator

Gah!

Thursday, July 31, 2008 9:52:54 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 

Behind the scenes, I see a lot of companies run on Excel and duct tape. So it's common for clients to hand me a slab of data organized into neat little rows and columns. Excel is just a handy way to throw some data over the wall and get things done. This might be a list of dealers, a collection of user profiles, product information, or anything that just needs to get somewhere else.

Depending on the scenario, I'll might massage this data and slide it into a SQL Server database or an XML file. I'm a web developer so I use the ADO.Net stack on a regular basis. If I were a Windows client developer, I might prefer to solve this problem with the Excel object model, but that really looks like more code to me, so here's how I like to roll:

The following code block accepts an Excel file path and returns an ordinary DataTable object, which can be manipulated easily by the code that calls this method. The first row of the Excel document becomes the columns in the DataTable object and each row thereafter are DataRow objects.

ImportDataFromExcel
(Click to enlarge)

If you like, take a look at both techniques for working with Excel data and see what one speaks to you. With this block of code, I can happily accept large chunks of data from a client without spending precious time fiddling with administrivia.

Thursday, July 31, 2008 8:00:16 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Tuesday, June 17, 2008

What's the deal with these online social networking sites? After you sign up, they casually ask for your credentials to other locations so they can provide some handy service. Jeff Atwood noted it recently, and I've just experienced it on Plaxo. Huh... That's nice, but no thank you, and please don't ask any of my friends either.

plaxo

Tuesday, June 17, 2008 9:44:21 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, May 28, 2008

I noticed this when I left the house this morning. Le Wife dislikes the roses due to the maintenance they require and this isn't helping matters at all.

mean-roses

Wednesday, May 28, 2008 3:41:39 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Thursday, May 22, 2008

Joel Spolsky (of http://www.joelonsoftware.com/) and Jeff Atwood (of http://www.codinghorror.com/blog/) selected my audio question on their new podcast, episode #6.

Stackoverflow is a new property created by a joint venture between these two blogging juggernauts.

http://blog.stackoverflow.com/

So far, their podcast is interesting like Paris Hilton. She’s famous for just being herself. Nevertheless, I am now famous.

I really do look forward to each new episode. Its a nice change of pace from the others that decorate my new iPhone. It's a little like a Seinfeld episode too, its a show about nothing, but in that span of 30 minutes, something interesting always happens. I love the history that Joel sprinkles in and the minutia that intrigues Jeff so much.

My question picked a little bit on Jeff, but hopefully the core of it came through. It was essentially a version of the eternal buy vs. build issue, or in this case "use what's in the box" vs. "build your own" scenario. Jeff had a respectable answer that centered on what he felt was important and what he was happy to inherit from the .Net Framework.

These are the types of debates I have every day building software. Its fun to ping someone outside your normal group every now and again and see what they have to say about it.

Thursday, May 22, 2008 10:35:52 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, May 21, 2008

Ok, so I'm not sure I've posted about the dog and the Thai food on this blog before, but I have been preoccupied lately with the newborn.

I was the proud poppa of an 8lb 15oz baby boy on April 29th, 2008. I'm still at a loss for words. This is arguably the cutest, smartest baby in the world.

baby

Wednesday, May 21, 2008 8:00:44 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Thursday, April 03, 2008

steve-wof My buddy Steve was on Wheel of Fortune last night. The actual taping of the show was a few weeks ago and he was pretty tight lipped about it.

He said he won enough money to pay for the flight out there, so he was happy, err... I mean Happy! He did outstanding on the show and his wife came up afterwards to give him a hug. He won over $80K and a trip to Thailand! Congrats!

fun
Thursday, April 03, 2008 7:22:27 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Sunday, March 23, 2008

I spent a little too long on this rainy Sunday afternoon tripping over myself. I'm using the SqlDataSource and the FormView controls in a quick prototype. I clicked the "Use optimistic concurrency" field in the SqlDataSource configuration page so it would compare the original values before updating the database.

I was going along fine when I realized the updates didn't work, but the insert was OK. After several repeated attempts with zero rows updates, I fired up the SQL Profiler and saw my update query right there, plain as day. Why wasn't the update working?

sql-profiler

I even grabbed the SQL out of SQL Profiler and ran it through Query Analyzer - and then bam! I could see it on my screen. The milliseconds for the date time fields were all set to zero, and the actual values in the database were non-zero values. Who was loosing the milliseconds?

Finally, it hit me. I was losing the data.

I was trying to be real smart about setting the hidden "Created" and "Modified" DateTime fields during the updating event of the SqlDataSource control. I would do a similar assignment during the update event for just the "Modified" DateTime field.

protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e)
{
   DateTime now = DateTime.Now;

   e.Command.Parameters["@Created"].Value = now;
   e.Command.Parameters["@Modified"].Value = now;
}

As I was peering at this method, it struck me that I was inadvertently setting the fields to a value that was too granular for my SqlDataSource object. It wasn't passing back the millisecond value, so I compensated by making sure the value is always zero milliseconds, like so:

protected void SqlDataSource1_Inserting(object sender, SqlDataSourceCommandEventArgs e)
{
   DateTime now = DateTime.Now;
   now = now.AddMilliseconds(1000 - now.Millisecond);

   e.Command.Parameters["@Created"].Value = now;
   e.Command.Parameters["@Modified"].Value = now;
}

With this adjustment, my inserts and updates are playing nicely. Yay!

So, now that i works, I'm still not real happy with it. I'd much rather have the code check a single timestamp column named "Version" than see all that bloat in there.

Sunday, March 23, 2008 5:30:47 PM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  | 
 Wednesday, March 19, 2008

I've been trying to disable script using the IE Developer Toolbar for a while now. Well, at least I've wanted to for a while, but its was greyed out so I couldn't select it in the menu. Its a fine little menu, with "Disable" well placed between "Find" and "View", then when you click the Disable item from the menu, three options pop up: Script, Popup Blocker, and All CSS.

The All Css menu item worked fine, it would drop any styles applied to the page and show me the raw, unstyled HTML content. Yet for some reason the top two items were disabled.

I poured myself a fresh cup of coffee from the French Press sitting on my desk and thunk about it real hard. Then, I opened Internet Explorer, clicked Tools, Options and then navigated to the Advanced tab. Sure enough, the Disable Script Debugging options were selected.

internet-options

I cleared the checkbox and restarted IE. Low and behold, I could now disable the JavaScript because it was no longer greyed out in the IE developer toolbar.

ie-disable-script

Drat!

ie7
Wednesday, March 19, 2008 7:53:34 AM (Pacific Standard Time, UTC-08:00)  #    Disclaimer  |  Comments [0]  |