Scott Hanselman

Six Essential Language Agnostic Programming Books

June 12, 2007 Comment on this post [51] Posted in Musings | Programming | Reviews
Sponsored By

A gentleman emailed  thanking me for http://www.hanselman.com/tools, and suggested I make a list of great Programming Books. I don't think it'll be as long as the Tools List, but here's my list. I specifically made the list Language Agnostic. Also, many of these books are by authors who write gold. That means, nearly everything they write is worth taking a look at. I haven't listed every book they've written, in those cases, just their "Greatest Hits."

When it comes to programming languages, I'm not a religious zealot or C# apologist. My religion in these matter is strict Apatheism. I just don't care enough to fight (except for VB people. They're just nuts. (kidding!)) . Pick the language that makes you smile and ships the project. It is for this reason that I prefer to read Language Agnostic Computer Books.

Code Complete - Steve McConnell - Darn near a bible of software development goodness, Code Complete reminds us of our priorities. It's essential and everyone who writes code should read this book. The Pragmatic Programmer - Andrew Hunt and Dave Thomas - I like to read this book at least every six months or so. It's clean, clever, clear and full of concrete tips you can use to be a better, simpler, pragmatic programmer. A new classic. Programming Pearls - Jon Bentley - This may feel initially like a C book, but it's really an algorithms book at its heart. It's old school with techniques and thought problems that can be applied today, even in language like Ruby and C#.
Refactoring - Fowler, Beck, Brant, Opdyke, Roberts - Although the language used is Java, the concepts are universal. This is a very linear, easy to read, learn by example book. If you think you know how to refactor, but you haven't read this book, pick it up and refresh yourself. You'll find names for Refactorings you've used for years and you'll definitely not only pick up new ones, but be better able to spot opportunities to use them. Design of the UNIX Operating System - So few programmers today can answer questions like "explain how virtual memory is managed" or "how are Unix processes different from Windows." How did we get here. Know your history. Design Patterns - Gamma, Helm, Johnson, Vlissides- One of the comments on Amazon says it best, "It is expected that any professional developer has read this book front-to-back. Buy it, read it, then put it in your bathroom and read it when convenient. Also, when you're done, spend some time at the Portland Pattern Repository.

UPDATE: There's some GREAT comments below, and I'm looking into each of them and putting together a list on Amazon.com. I made some pretty obvious gaffes (it was late. ;) ) by not including SICP (Structure and Interpretation of Computer Programs) or TAOCP as well as Types and Programming Languages. A number of folks said the list wasn't very language agnostic because it's very "C" and imperative language focused. Good points all!

What books did I miss, Dear Reader?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Video: Windows Browser Speed Shootout - IE7, Firefox2, Opera9, Safari for Windows Beta 3

June 12, 2007 Comment on this post [27] Posted in Musings | Reviews | Tools
Sponsored By
There is a lot of good discussion about the Safari for Windows release and my, as well as others (including Apple's), assertion that it's fast. Or at least it feels fast. A few folks said that it might feel fast because Steve Jobs said it's fast

So, I decided over lunch to do a non-scientific (but using common sense) test. I started by loading up each browser and resizing them to exactly 800x600. I used Camtasia to record them, independently, loading hanselman.com, apple.com, cnn.com, msdn.com, sun.com and craigslist.org.

I then downloaded a free version of Sony Vegas and made a 1600x1200 (four quadrants of 800x600) and put each site's loading in their appropriate quadrant. I started the timer (and start frame) when I press Enter in the Address Bar and stopped it when I saw a "done" indication from the browser. For some that was the word "done" in the Status Bar, for others it was a progress bar finishing and disappearing.

Browser Speed

I did the whole thing, capture and edit in Raw 30fps and didn't make it smaller until the final Render. I deleted browser caches and pre-cached DNS for each. Each browser's file was about 1.2 gigs each.

Here's a table of the results:

  Desc FF2 IE7 Opera9 Safari3
hanselman.com heavy, css, javascript 3.604 5.939 4.872 4.872
apple.com light, lots of images 3.670 4.337 4.27 1.134
cnn.com heavy, javascript, many ads 5.339 2.936 3.337 2.002
msdn.com very heavy 6.74 11.946 12.88 2.67
sun.com light, big image 4.938 1.868 3.336 1.801
craigslist.org very light, nearly all text 1.602 0.868 0.668 0.668

You can check the video for yourself, but the nutshell conclusion for the non-Safari browsers is "it depends on the site," but on my computer, Safari on Windows is not slow. The question is, are you willing to put up with a Mac-like interface, wonky text anti-aliasing and some weird rendering, without your FireFox plugins? I'm going to give it a try and see how it goes. It's a lot to ask.

Also, Craigslist just generally rocks. Enjoy.

Technorati Tags: , , , ,

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Microsoft Silverlight in Safari for Windows

June 11, 2007 Comment on this post [14] Posted in Musings | Silverlight
Sponsored By

After I installed Safari for Windows, the second thing I did was see if it would run Silverlight. I loaded up the Airline sample that I had running locally on my machine and got this.

Silverlight Airlines Demo

From this I glean that the JavaScript detection code isn't digging Safari on Windows. So...checking my HTTP UserAgent gives me:

Mozilla/5.0 (Windows; U; Windows NT 5.1; en) AppleWebKit/522.11.3 (KHTML, like Gecko) Version/3.0 Safari/522.11.3

...but on Mac it's usually:

Mozilla/5.0 (Macintosh; U; Intel Mac OS X; en) AppleWebKit/XX (KHTML, like Gecko) Safari/YY

...and since it's not Silverlight but rather the JavaScript that makes the decision on whether to try to load Silverlight (and considering that Flash and what-not worked in Safari without be needing to reinstall any plugins).

I opened up this app's Silverlight.js file and added an alert() around line 85:

var versionStr = detectAgControlVersion();
alert(versionStr);

...and it reported 0.8.5. That means that Safari can see the plugin on the system, but the version should be 0.95.

I figure that the Silverlight Team is already all over this, so rather than solving the problem for them, I added:

agVersion = "0.95.0";

...around line 65 to force the issue. This got Silverlight loaded into memory, as seen in the Process Explorer screenshot below...

Process Explorer - Sysinternals www.sysinternals.com [PDXSHanselm]

...but nothing showed up. Blank screen. No amount of windows jiggling or resizing (to force a paint) would get it going on my system.

UPDATE: Tim Heuer tried the same thing and says the Silverlight Team is on it and that Safari smells like Opera to Silverlight. He also says he was able to get a control to show while I was not.

If this browser is going to get some share (and it likely will with 1 million iTunes downloads a month - they'll likely bundle it virally) then Silverlight support is a must.

Technorati Tags: , , ,

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Safari for Windows - First Impressions

June 11, 2007 Comment on this post [68] Posted in Musings | Reviews
Sponsored By

imageHell has frozen over and I'm running Safari on Windows (v3 Public Beta) You can download it at: www.apple.com/safari.

Good Things:

Weird Things:

  • Dialog Boxes show up as additional Application Windows in the Explorer bar. Meaning, if you have the Preferences Dialog open, the Taskbar says you're running two Safari Windows.
  • The installer asks to install the Bonjour Service, Apple's service discovery protocol ala UPnP. I declined.
  • It uses its own Font Smoothing system with three options, light, medium and strong. It's not using ClearType, and they appear to have their own embedded fonts for rendering text within the browser.
  • It looks like a Mac Application on Windows. Not bad, but slightly creepy.
  • This blog's comment box renders strangely, possibly because they allow you to resize text boxes yourself. It obscures the new Live Comment Preview.
  • What's the point? Was this browser needed?
  • As with OS X apps, you can only resize the window with the handle in the lower right corner.

Speculation:

  • They've clearly built some amazing owner-draw cross-platform UI framework here. Perhaps Safari was the proving ground? Well, they've proven it. I wonder if the Apple concept of a "Universal Binary" has more draconian world dominationesque connotations? Perhaps Objective C is the new Java? Write once, debug everywhere.

Either way, I encourage you to download Safari and try it out. I'm not switching away from Firefox2 just yet, but speed is the #1 thing that'll make me switch. We will see.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

How To: Use Google Earth or Virtual Earth to Visualize a New House Lot - Part 1

June 09, 2007 Comment on this post [7] Posted in Musings | Tools
Sponsored By

Required Tools
(assumes Windows, but there's comparable tools on any platform)

We were screwing around last weekend looking a houses and found a big empty lot that some folks are building houses on. I was surprised that the Real Estate folks (at least these) weren't very computer savvy. Everything's pushed around on paper. There's no kiosk, no 3D renderings, nada. I wanted to understand how the neighborhood would lay out and where houses would sit, but other than pencil sketches, they couldn't help me. Seems that this kind of thing could be very useful to a prospective buyer.

So, given my lunch hour...

(This isn't a house or neighborhood I'm looking at, I've just selected it for demonstration)

Most folks have used Google Maps or Virtual Earth before, but mostly just for driving directions. Few "civilians" (read: non-geek) that I've met have used Google Earth, which is a shame.

If you want to visualize your house lot, here's some steps to help make that possible.

1. Download Google Earth and find the lot.

The imagery is usually a few years old, but if it's an empty lot anyway it shouldn't matter. Put a pushpin on the area so you can get back there quickly.

 Google Earth (2)

2. Go to your Builder or Realtor's site and get the neighborhood map.

Often these maps are in PDF format. Open the PDF and get it as large as you can on the screen.

 

3. Edit the Neighborhood map and remove the non-map stuff, leaving the rest transparent.

Use the screenshot tool or press Printscreen to get a screenshot in the clipboard. Open your Paint application and paste in the picture of the neighborhood.

Untitled (72%) - Paint.NET v3.07

Once you've got your neighborhood picture in Paint.NET (or whatever editor) use the Eraser or Magic Wand tool set to low tolerance to select and delete all the whitespace that isn't part of the map. In this example I'm removing logos, the legend, everything. The checkerboard area underneath means "transparent" or "see-thru." This will make our map look much better once we put it into Google Earth. Now, be sure to save this file as a PNG, which is a file format that includes transparency.

4. Import the new transparent Neighborhood Map and resize

Now, go back over to Google Earth and click Add | Image Overlay and select your just-saved PNG file.

Goof: I realize now after this is all done that I kind of screwed up this example because I left some white border in the far right and very bottom, and a tiny white line on the far left of the neighborhood map. It looks a smidge sloppy. :( Make sure you double check your transparency and get all the non-map stuff removed cleanly.

Google Earth (3)

This step can be VERY confusing because Google Earth has no way of knowing what the "scale" of your image is, so it'll just fill the screen. You can't immediately resize the image and it can be very frustrating.

TIP: You have to Right Click the new Image Overlay in the Places pane, usually on the left site of the Google Earth screen. In my screenshot above it's called "Untitled Image Overlay." Right-click it and select Properties. Only when the Properties Dialog is up can you resize the image. You'll know you're able to resize when Kermit-green colored lines appear all around your image. Hover your mouse over these lines to resize your image. I encourage you to make the image partially transparent to make resizing easier.

Try to use existing or soon-to-be-connecting streets to get an idea how your neighborhood and lot will fit into the scheme of things. Remember that you can use the mouse wheel and move the view around WHILE you are resizing your image. Note that the Properties Dialog is "modeless" - that means you can do stuff while it's showing, unlike many other Dialog Boxes.

Google Earth (5)

Be sure to press "OK" on the Properties Dialog or you'll undo all your hard work. Now that your image overlay is positioned it is a part of the Google Earth system (at least on your computer) and you can few the lot from multiple angles and elevations. You can also move your Pushpin - again, only via the Properties Dialog - and point it at your lot.

Google Earth (6)

4a. Get better imagery in Microsoft Virtual Earth and a Static Bird's Eye Image

Microsoft Virtual Earth has flyover imagery from airplanes taken at an angle that are MUCH higher resolution than typical satellite photos. The pictures are also sometimes newer than those found at Google. Find your lot/plot in Virtual Earth, and click the Bird's Eye View icon under 2D imagery. Press F11 to put your browser into "Kiosk" Mode in order to get a larger image.

TIP: In Virtual Earth, click Share | View Permalink and notice the latitude and longitude numbers in the URL. You can "hack" that URL (you can edit it) and plug in the exact lat/long numbers from Google Earth to quickly get to the same spot in Virtual Earth.

Take a screenshot and put it in the clipboard. Launch your Paint Program and paste it in as a fresh image.

Live Search - Windows Internet Explorer (2)

Add a new layer in your Paint program. In Paint.NET, click Layers | Import from File and select your PNG file of the neighborhood layout that you created earlier. Make the layer slightly transparent to help with positioning. In Paint.NET you do this by double-clicking on your new layer in the Layers Floating Toolbox and changing it's opacity.

In an application like Photoshop you can use the Free Transform option to skew and warp your neighborhood map to match the angle and aspect of the Bird Eye View imagery. In Paint.NET I didn't think this would be possible, until I figured out the Rotate/Zoom tool. The tick is that you can actually click and drag that little ball to change any selection. You can also use the Pan and Zoom to affect your image. These are the tools you need to get your neighborhood map to fit. A second after you make a change - without closing the Dialog - the picture will update. By making small incremental changes you can line up the map to the photo. If you have trouble with things moving too fast, select the control you want to change and use the Arrow Keys to move things 1 number at a time.

rotatezoom 

You might even use the Lasso tool to grab a house in the neighborhood that looks just like your future home and place it on the lot as I've done in the sample below.

homesite

In a Part 2 post I'll show you how to start drawing your house (to the best of primitive ability) in 3D using the home plans and placing it into the Google Earth environment.

Technorati Tags: , , ,

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.