Archive for July, 2008

.NET Reflector auto update

Thursday, July 24th, 2008

I love .NET Reflector. It’s an indispensable programming tool.

Unfortunately it has one big flaw: it’s auto update feature is not optional.

I regularly work disconnected, either because I’m not near a hotspot or because I’m running a VM without internet access.

If Reflector determines that it is out-of-date it will refuse to run until you update it. This is a huge pain because I usually don’t hit the problem unless I need to use Reflector.

Yes, I know complaining about free software is lame, but please Lutz, make the update functionality optional. I promise I’ll update the next time I’m connected.

Update: Red Gate has acquired .NET Reflector. Please visit my forum post and share your opinion!

iPhone software 2.0

Thursday, July 10th, 2008

This morning I upgraded my first-gen iPhone to the 2.0 software, using the process described here.

iPhone 2.0 Home Screen

The update took maybe 30 minutes. I was not prompted to backup my settings or media, so make sure you perform a sync before updating.

Some initial observations:

  • Adding my Exchange account was painless (especially compared to adding the same account using IMAP).
  • Exchange ActiveSync works great. I’m getting emails on my phone before I receive them on my laptop.
  • Syncing your Exchange calendar erases all other calendars from the phone and disables calendar syncing within iTunes.
  • If you aren’t syncing an Exchange calendar, the phone now provides access to all of your iCal calendars, including Entourage (if you have enabled iCal syncing within Entourage).
  • The AppStore is working (from the phone at least). So far I’ve installed Twitterrific, Remote, Google Mobile App, and AP Mobile News.

JavaScriptSerializer non-generic Deserialize method

Thursday, July 10th, 2008

I was messing around with the ASP.NET MVC Preview 3 the other evening and ran into a “problem” with the JavaScriptSerializer. The class provides two methods for deserializing an object from JSON data:

public T Deserialize<T>(string data); public object DeserializeObject(string data);

A notable omission from the API is a non-generic method for deserializing to a specific type, i.e.:

public object Deserialize(Type type, string data);

This method would be useful when dynamically deserializing objects, using reflection for instance.

Digging around with Reflector I found that the generic method just delegates to an internal helper, passing the generic parameter T as typeof(T). It would be a simple matter then to provide the necessary overload that accepts the Type directly.

Hopefully the ASP.NET team will add the missing overload, but in the meantime I decided to "cheat" with the following extension method:

public static class JavaScriptSerializerExtensions { public static object Deserialize(this JavaScriptSerializer serializer, Type type, string data) { Type serializerType = typeof(JavaScriptSerializer); object[] args = new object[] { serializer, data, type, serializer.RecursionLimit, }; return serializerType.InvokeMember( "Deserialize", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.InvokeMethod, Type.DefaultBinder, null, args); } }