Scott Hanselman

Packing Light for Travel with Power and Geek Style

April 9, '08 Comments [39] Posted in Musings
Sponsored By

I've been traveling lately, and last week I posted 10 Guerilla Airline Travel Tips for the Geek-Minded Person. Next week I'm going to Seattle for the week and I really prefer to pack as light as possible. There's lots of tips on the net on how to squish your clothes (I use SpaceBags) and what luggage to use (I like half-sized wheeled totes) but what's really interesting to me is what gadgets and electronic equipment to pack that gives me the most functionality in the least space.

Here's what I'm packing for next week's trip:

Monster 4 Outlet Mini Power StripMonster 4 Outlet Mini Power Strip - Ordinarily I dislike Monster's stuff because its's so expensive, but this little gem is only $12. Paul Mooney gave me one of these and I love it. It's got four-outlets and a small extension core. The cord wraps around and it plugs into itself for storage. As Paul says, "When you're at the airport and you're looking for a plug, you're pushy. If you show up with one of these, you'll make three new friends!" They're amazingly useful when plugged into those lamps with outlets at the hotel.

Kensington Travel Plug Adapter Kensington 33117 International All-in-One Travel Plug Adapter - I love this plug. We took it all over Africa and Europe and it hasn't failed me yet. It even has a spare fuse inside. This plug is all-in-one with no pieces to lose. The plug tips are all stored inside and slide in and out. Use it along with the mini-power strip above and suddenly you've got four US power plugs. It doesn't convert voltage, but most electronic device adapters will convert voltage for you.

Maxtor 250 GB OneTouch Hard Drive Maxtor 250 GB OneTouch 4 Mini Portable Hard Drive - I've recently started doing all my presentations using Virtual Machines on this little drive. It's a great drive because it doesn't require external power, rather it uses a double USB cable to draw power. I have six VMs on this drive.

Kensington Power AdapterKensington K33197 120W Auto/Air Ultra Portable Notebook PC Power Adapter - This has replaced all my power bricks. It powers my PSP, iPod, anything USB, nearly any notebook, phone, digital camera. It'll even charge one high-power (laptop) and one low-power (phone) device at once with the Y-adapter. The brick is also about half the size of whatever came with your laptop. It's creepy small.

USB Mini CableUSB 2.0 A/Mini-B Cable (Black)- You literally can't have enough tiny USB cables. They are good for charging things, tethering with your SmartPhone for Internet access, or connecting to a portable hard drive. I keep at least four in my bag.

Garmin nuvi 350

Garmin nüvi 350 3.5-Inch Portable GPS Navigator - There just isn't a better GPS for your dollar than the Garmin Nuvi 250. I paid twice this and it was still worth it. The feature I like the most is that it speaks the street names using text-to-speech. The interface is clean and easy to use, and it has a mode for walking/hiking which is great around unknown cities. As an aside, it's got an SD Card slot, supports Audible audio-books, it's a passable MP3 player. It also charges via Tiny USB!

 

webcam Microsoft LifeCam VX-7000 Win USB - Don't listen to the low Amazon Reviews on this one. The early drivers sucked and the LifeCam software is a little "meh." However, the secret to this webcam is a Driver Only install. I use it in 64-bit Vista and do 640x480 high-res video calls with the family whenever I'm on the road, using the Skype Hi-Res Hack.

presentermouse

Microsoft Wireless Notebook Presenter Mouse 8000 - I've tried every little notebook mouse/usb dongle combo there is. Some have hidden USB receivers, some recess in the bottom, etc. This mouse has both a dongle, but also bluetooth. I've left the dongle at home and I just have to turn this mouse on and since I paired it once with my laptop, it just works. One less thing to sweat. Plus, it's a presenter mouse, so you just flip it over and it has a laser pointer, on screen magnifier, and Presentation Forward/Back buttons. It lets me move more freely when presenting, and my recent Mix presentation was better for it.

HTC Excalibur Dash

HTC S620 PDA Black Smartphone (Unlocked, Intl. Version) - I've got an HTC Excalibur unlocked phone that's hooked up to Cingular/AT&T. The best think I ever did was turn on unlimited data. Now I can use "Internet Sharing" with Windows Mobile. I can "tether" the laptop and the SmartPhone with two clicks, using either Bluetooth or USB (I use USB as it charges the phone also) and I've got pretty decent speed Internet (25k/sec) pretty much anywhere largish in the US. When I find a Wi-Fi hotspot that wants to charge me money, bam, I bust out the phone. I've found myself using public Wi-Fi less and less, as it's really dodgy in both reliability and speed, and just going with the slower, but always available AT&T Edge network. Both Gmail and Outlook notice when they are on slow connections and will adjust. Also, I don't need to carry around (or pay for) a Network Aircard for the laptop.

kindle Amazon Kindle - It's official, I loves my Amazon Kindle (my review). Sure, it's ugly. But it works. I don't have to sync it. I hate having one more thing to sync to some other thing. If it works wirelessly and I don't have to push any buttons, I like it. The Kindle delivers me the New York Times, Newsweek, and the Huffington Post, every day (or week, for Newsweek) and it just works. I've added a 2gig SD Card and put all my Audible books on it. I've got a dozen books, many free. The one caveat so far, I have had the battery run down over a few day period and the battery go dead when the wireless has been left on and constantly updates blogs, so I've started turning it all the way off at night and charging it like a cell phone. However, with wireless off, it'll go for 1000+ page turns before running down, plus it'll trickle charge from tiny USB.

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Memories of Zimbabwe - You can't afford to go home

April 5, '08 Comments [32] Posted in Africa
Sponsored By

800px-Dol_zimbabwe My wife and I have been married going on eight years. We try to go to Africa every two years as she's from Zimbabwe originally. We wanted to go to Zim last year, but ended up going to Tanzania instead as we were taking our (at the time) one year old, and my sister-in-law works for the Rwandan War Crimes Tribunal there. Zim didn't seem like a good first trip for the baby.

I remember when we went to Zim for the first time in 2001. I was meeting my then fiancée's family for the first time and was deep in lobola negotiations with her father. The exchange rate was US$1 to Z$55, and it was about Z$50 to ride in a combi (minibus/taxi).

My wife remembered at the time how she could go downtown and buy gum for a single Zim penny. Once, my sister-in-law got into huge trouble as a child when she asked a visiting relative for a penny.

When we returned two years later, the exchange rate was US$1 to $Z50,000. Mo's father passed away while we were there and it was surreal to spend a solid hour counting out $Z2,000,000 for his casket in Z$100 bills in the midst of our grief.

zim100kTake a good look at the Zim $50 note in the picture above. It had an expiration date.

Today, whatever Zim currency you have in your pocket loses value of Z$70 a minute just sitting there.

In January of 2008 the exchange rate was US$1 to Z$1,900,000 (1.9M). On March 1st, it was US$1 to $Z 24 million. Today, just two weeks later it's US$1 to Z$70 million. Arguably, Iraq has a significantly better economy than Zimbabwe as Zim's current inflation rate is in excess of 100,000%.  (Some figures point to it being around 164,000%, others closer to 200,000%.)

This Z$100,000 Bearer Cheque is not only two years expired, but were it not, it'd be worth 14/10,000ths of a US dollar, but that worth would last only a few hours.

f9e06f45-c479-4084-be83-68eb5c6da48d_mnThe gift that I gave my father-in-law to buy cows with would today be worth over $Z140,000,000,000, or 140 billion Zim dollars.

If these numbers seem overwhelming, they are. Recently the new Z$50 million dollar note came out, and it will by three loaves of bread (assuming you can find bread) a Z$16M each.

I can't tell you how painful it is to watch a country you love collapse from the outside when we have family there, but it's nothing considering what it's like on the inside. We talk to family there each week and each week the stories get worse.

I could tell you what it used to be like. I could tell you about the time we went to Chipangali Zoo with my mother-in-law and a mini-bus full of 6th graders. I could tell you about the two classrooms and bathroom (real flush toilets!) that we worked to get built.

P0004995 CIMG1645

I could tell you about the time we went to Victoria Falls and slept a hundred yards from an elephant watering hole. I could tell you about the time we went ekhaya to my wife's ancestral home to bury her father.

P0005136 P0005132

I could tell you about the time I found a goat in the my morning bathtub, then it disappeared, only to reappear on my breakfast plate the next morning. I could tell you about freaking out abantu abamnyama nxa ikhiwa likhuluma isiNdebele.

CIMG1653 Cropped CIMG1362

But, those days are gone and we have only pictures and memories. The Zim that we knew is gone and it's unclear what is coming. God help the people of Zimbabwe and our family overseas.

For updated news about the Zimbabwean elections, see the BBC Zimbabwe section or check Google News on Zimbabwe.

Related Links

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 107 - Digital Photography Explained (for Geeks) with Aaron Hockley

April 4, '08 Comments [22] Posted in Podcast
Sponsored By

My one-hundred-and-seventh podcast is up. In this episode I sit down with my Twitter-Friend Aaron Hockley and he helps me understand my new Nikon D40. Aaron is turning pro as a photographer, but he's also a programmer, so I figured it'd take a true geek to explain aperture and F-Stop to me. I was right!

Links from the Show

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

If you have trouble downloading, or your download is slow, do try the torrent with µtorrent or another BitTorrent Downloader.

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Check out their UI Suite of controls for ASP.NET. It's very hardcore stuff. One of the things I appreciate about Telerik is their commitment to completeness. For example, they have a page about their Right-to-Left support while some vendors have zero support, or don't bother testing. They also are committed to XHTML compliance and publish their roadmap. It's nice when your controls vendor is very transparent.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

How do Extension Methods work and why was a new CLR not required?

April 4, '08 Comments [23] Posted in Learning .NET | Programming
Sponsored By

Someone said recently that they thought extensions methods required a new CLR.

Extension methods are a new feature in .NET 3.5 (C#3/VB9) that let you appear to "spot weld" new methods on to existing classes. If you think that the "string" object needs a new method, you can just add it and call it on instance variables.

Here's an example. Note that the IntHelper35 class below defines a new method for integers called DoubleThenAdd. Now, I can do things like 2.DoubleThenAdd(2). See how the method directly "hangs off" of the integer 2? It's the "this" keyword appearing before the first parameter that makes this magic work. But is it really magic? Did it require a change to the CLR, or just a really smart compiler?

Let's do some experimenting and see if we can figure it out for ourselves.

using System;
namespace Foo
{
class Program
{
static void Main(string[] args)
{
Console.WriteLine(2.DoubleThenAdd(3));
Console.WriteLine(IntHelper20.DoubleThenAdd(2, 3));
Console.ReadLine();
}
}

public static class IntHelper20
{
public static int DoubleThenAdd(int myInt, int x)
{
return myInt + (2 * x);
}
}

public static class IntHelper35
{
public static int DoubleThenAdd(this int myInt, int x)
{
return myInt + (2 * x);
}
}
}

I've also added an IntHelper20 class with an identical method but WITHOUT the "this" keyboard. It's a standard static method, and I call it in the standard way. Now, let's compile it, then disassemble it with Reflector and take a look at the IL (Intermediate Language).

.method private hidebysig static void Main(string[] args) cil managed
{
.entrypoint
.maxstack 8
L_0000: nop
L_0001: ldc.i4.2
L_0002: ldc.i4.3
L_0003: call int32 ConsoleApplication8.IntHelper35::DoubleThenAdd(int32, int32)
L_0008: call void [mscorlib]System.Console::WriteLine(int32)
L_000d: nop
L_000e: ldc.i4.2
L_000f: ldc.i4.3
L_0010: call int32 ConsoleApplication8.IntHelper20::DoubleThenAdd(int32, int32)
L_0015: call void [mscorlib]System.Console::WriteLine(int32)
L_001a: nop
L_001b: call string [mscorlib]System.Console::ReadLine()
L_0020: pop
L_0021: ret
}

Interestingly, both method calls look the same. They look like static method calls with two integer parameters. From looking at this part of the IL, you can't actually tell which one is an extension method. We know the first one, IntHelper35, is, but from this snippet of IL, we can't tell.

Can Reflector tell the difference if we ask it to decompile to C# or VB (rather than IL)?

private static void Main(string[] args)
{
Console.WriteLine(2.DoubleThenAdd(3));
Console.WriteLine(IntHelper20.DoubleThenAdd(2, 3));
Console.ReadLine();
}

Interestingly, it knows the difference. How? Here's the decompilation of the IntHelper35 class itself:

.method public hidebysig static int32 DoubleThenAdd(int32 myInt, int32 x) cil managed
{
.custom instance void [System.Core]System.Runtime.CompilerServices.ExtensionAttribute::.ctor()
.maxstack 3
.locals init (
[0] int32 CS$1$0000)
L_0000: nop
L_0001: ldarg.0
L_0002: ldc.i4.2
L_0003: ldarg.1
L_0004: mul
L_0005: add
L_0006: stloc.0
L_0007: br.s L_0009
L_0009: ldloc.0
L_000a: ret
}

The only difference between the two methods is the CompilerServices.ExtensionAttribute. This attribute is added because of the "this" keyword, and it looks like it's what Reflector is using to correctly identify the extension method.

Extension methods are a really nice syntactic sugar. They're not really added to the class, as we can see, but the compiler makes it feel like they are.

Slightly Related Aside about Object Oriented "C"

This reminded me of what we called "object oriented C" in college. I found a great example on Phil Bolthole's site.

Basically you make a struct to represent your member variables, and then you create a number of methods where the first parameter is the struct. For example:

#include "FooOBJ.h" 
void diddle(){
FooOBJ fobj;

fobj=newFooOBJ(); /* create a new object of type "FooOBJ" */

/* Perform member functions on FooOBJ.
* If you try these functions on a different type of object,
* you will get a compile-time error
*/
setFooNumber(fobj, 1);
setFooString(fobj, "somestring");
dumpFooState(fobj);

deleteFooOBJ(fobj);
}

int main(){
diddle();
return 0;
}

In this C example, if you mentally move the first parameter to the left side and add a ".", like fobj.dumpFooState() it's almost like C++. Then, you ask yourself, "gosh, wouldn't it be nice if a compiler did this for me?"

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

How to set an IIS Application or AppPool to use ASP.NET 3.5 rather than 2.0

April 1, '08 Comments [42] Posted in ASP.NET | IIS | LINQ
Sponsored By

A question that comes up a lot is this: How do I tell my IIS Application or Virtual Directory to use ASP.NET 3.5 rather than ASP.NET 2.0?

Folks often go into the IIS6 or IIS7 manager and setup an AppPool and see a properties dialog like this, and when the pull down the option, they often expect to see .NET 3.0 and .NET 3.5 in the list and it's not there, and they freak out, rightfully so.

image

Here's an explanation of why this is confusing, and hopefully by the end, it won't be confusing anymore.

Marketing

This is where marketing and reality part ways. I didn't initially like the naming, because I assumed that each major version of the Framework meant a new CLR, but it's growing on me as I understand it more. I get now why they named them this way. Additional fundamentally new functionality has to be named something.

image

.NET 2.0

The meat of .NET is in %windir%\Microsoft.NET\Framework\v2.0.50727. That's where, along with the GAC (Global Assembly Cache) all the libraries and compilers you know and love live. When folks ask "where is .NET" I usually start here.

image

.NET 3.0

The addition of .NET 3.0 didn't mean new compilers or a new CLR. Instead, it's three major new libraries: WCF (Windows Communication Foundation née Indigo), WPF (Windows Presentation Foundation née Avalon) and Windows Workflow or WF.

image

Bottom line: Installing .NET 3.0 doesn't fundamentally change your system in any way you should fear. Your 2.0 apps still run on a system with 3.0 installed. They are 2.0 apps using the 2.0 compilers and 2.0 CLR.

imageTry this. If you go into Visual Studio and File | New | Project (or Web Site), take note of the drop down in the upper right corner.

Select ".NET Framework 3.0" and make a new "WCF Service" take a look at the web.config. Note that it's pretty conventional, and should look like a typical .NET 2.0 ASP.NET application with a few additional.

Basically, remember Framework version != CLR Version. If you configured an IIS Application to use .NET 2.0, you're talking about the 2.0 CLR. WCF Applications use the .NET 2.0 CLR with the new 3.0 WCF libraries.

  • .NET Framework 1.x = CLR 1.x
  • .NET Framework 2.0 = CLR 2.0
  • .NET Framework 3.0 = CLR 2.0
  • .NET Framework 3.5 = CLR 2.0 + (C# 3.0 | VB9)

You can also use the new 3.5 compilers and the 3.0 libraries, of course as well. Each subsumes the previous as seen in Tim Sneath's fine stacked diagram above.

image

In your new app's web.config, there's a <system.serviceModel> section that is WCF specific, but otherwise the web.config looks pretty 2.0 typical.

.NET 3.5

The marketing term ".NET Framework 3.5" refers to a few things. First, LINQ, which is huge, and includes new language compilers for C# and VB. Second, the REST support added to Windows Communication Foundation, as well as, third, the fact that ASP.NET AJAX is included, rather than a separate download as it was before in ASP.NET 2.0.

There's a few other things in .NET 3.5, like SP1 of .NET 2.0 to fix bugs, but one way to get an idea of what's been added in .NET 3.5 is to look in c:\windows\assembly. Here's just the 3.5 versioned assemblies in the GAC (Global Assembly Cache).

image

Also, looking in %windir%\Microsoft.NET\Framework\v3.5 we can see the new compilers, MSBuild Target files, etc.

image 

So, getting to answering the original question, try this experiment.

Go into Visual Studio and make a .NET 2.0 Web Site. Once it's loaded up, note your web.config. Next, right-click on the project and select Properties. Under Build, select 3.5 Framework.

image

Now, load up your web.config and notice the changes that just occurred. There's some new handlers that are added to support Ajax and some new ASP.NET Features, but the really important stuff is the <system.codedom> and the newly added assemblies in the assemblies section.

    <compilation debug="false">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs"
type="Microsoft.CSharp.CSharpCodeProvider,System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
<compiler language="vb;vbs;visualbasic;vbscript" extension=".vb"
type="Microsoft.VisualBasic.VBCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
warningLevel="4">
<providerOption name="CompilerVersion" value="v3.5"/>
<providerOption name="OptionInfer" value="true"/>
<providerOption name="WarnAsError" value="false"/>
</compiler>
</compilers>
</system.codedom>

There's the magic. Well, not really magic, and there's nothing hidden. This where your web site is told what version of the compiler to use, and the new supporting libraries.

This is where you tell ASP.NET to use .NET 3.5, not in IIS. IIS AppPools know about CLR versions, not Framework and compiler versions, those are set by the application.

Now, this is just my opinion, but I like to name my AppPools in IIS like this...

image

...which looks the way my brain thinks it is even though it's not reality. I keep my 1.1, 2.0 and 3.5 applications all running under the same instance of IIS, but each in their own AppPool. Note again, the there's nothing keeping me from having 3.5 apps under my 2.0 AppPool, I just keep them tidy on my own.

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

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