blog.vorpal.cc

Hi! My name is David Hogue. I write code in Bend, Oregon.

January 25, 2008

Internet Explorer 7 usage stats

Filed under: — David @ 12:41 pm

So Internet Explorer 7 has been out for over a year (it was released on October 18th), yet there are still enough IE6 users that we still have to code for it. IE6 has some horrible rendering inconsistencies and bugs that have to be worked around and unfortunately it was out for so long and had so much market share that it’s just not going away. IE7 was a little better, but not great.

I’m hopeful for IE8, but who knows. IE 8, if you haven’t heard has a third rendering mode, in addition to standard and quirks modes, that is triggered by a meta tag (see this A List Apart page for some details.) I’m not terribly fond of the new meta tag, but I can live with it I guess.

My IE stats

A few months ago my blog’s stats were showing a 50/50 split between IE6 and IE7. Now it’s closer to 75% IE7 and 25% IE6. The browser stats page at W3Schools has IE6 ahead of IE7 with 33.2% 21.0% of the total market.

Anyway, a few days ago I saw a story on Slashdot saying Microsoft is going to IE7 updates. I assume this just means they will make it a high priority update. Hopefully this will make the IE6 market share small enough that we can finally ignore it.

January 19, 2008

So Who Reads This Thing Anyways?

Filed under: — David @ 1:52 pm

I recently got to wondering who, if anyone, out there is reading my blog. I’ve just been thinking about it and was getting curious.

I know at least one colleague at work that does. I think there’s a few developers in the .net community that are subscribed by now. Anyone else from Bend? Any of my friends in Eugene?

Anyway, if you feel like it and have the time, could you leave a short comment?

January 9, 2008

The Fun Part of Having People You Know Read Your Blog

Filed under: — David @ 12:33 am

Me: I started digging into some Reflection.Emit stuff the recently.

Him: I think I just saw a post about that the other day.

Me: Was it the one I wrote last night?

Him: Was that you? I didn’t even realize it. (Goes to Google Reader to look up said post) Hey, it was yours.

January 8, 2008

Check This Out (Simple Reflection.Emit Stuff)

Filed under: — David @ 12:00 am
C#:
  1. public class HelloModifier
  2. {
  3.     public static Target CreateTarget()
  4.     {
  5.         AssemblyName assemblyName = new AssemblyName("MyDynamic");
  6.         TypeBuilder typeBuilder = AppDomain.CurrentDomain.
  7.             DefineDynamicAssembly(assemblyName,
  8.                 AssemblyBuilderAccess.Run).
  9.             DefineDynamicModule(assemblyName.Name).
  10.             DefineType("TargetOverride", TypeAttributes.Class,
  11.                 typeof(Target));
  12.         MethodBuilder hello = typeBuilder.DefineMethod("Hello",
  13.             MethodAttributes.Public | MethodAttributes.HideBySig |
  14.             MethodAttributes.NewSlot | MethodAttributes.Virtual,
  15.             CallingConventions.Standard, typeof (string),
  16.             Type.EmptyTypes);
  17.         ILGenerator il = hello.GetILGenerator();
  18.         il.Emit(OpCodes.Ldstr, "Hello, World!");
  19.         il.Emit(OpCodes.Ret);
  20.         typeBuilder.DefineMethodOverride(hello,
  21.             typeof(Target).GetMethod("Hello"));
  22.         return (Target)Activator.CreateInstance(
  23.             typeBuilder.CreateType());
  24.     }
  25. }
  26.  
  27. public class Target
  28. {
  29.     public virtual string Hello()
  30.     {
  31.         return "sorry";
  32.     }
  33. }
  34.  
  35. [TestFixture]
  36. public class NeatTests
  37. {
  38.     [Test]
  39.     public void SayHello()
  40.     {
  41.         Target target = HelloModifier.CreateTarget();
  42.         Assert.AreEqual("Hello, World!", target.Hello());
  43.     }
  44. }

OK, so it's not that revolutionary, but I've never had to dig into the Reflection.Emit namespaces before. I tried once before, but never got that far. It does seem hard to find good, useful documentation and examples on it.

This isn't really all that useful here, but I could come up with some imaginative uses for it if it was more dynamic.

Oh, and with DynamicProxy HelloModifier looks like this:

C#:
  1. public class HelloModifier
  2. {
  3.     private static readonly ProxyGenerator _generator =
  4.         new ProxyGenerator();
  5.  
  6.     public static Target CreateTarget()
  7.     {
  8.         return (Target)_generator.CreateClassProxy(
  9.             typeof(Target), new HelloInterceptor());
  10.     }
  11.  
  12.     private class HelloInterceptor : IInterceptor
  13.     {
  14.         public void Intercept(IInvocation invocation)
  15.         {
  16.             if (invocation.Method.Name == "Hello")
  17.                 invocation.ReturnValue = "Hello, World!";
  18.         }
  19.     }
  20. }

January 6, 2008

On Microsoft and Developer Learning

Filed under: — David @ 11:07 pm

For a while now I had been expecting better developer documentation from Microsoft. You'd think if you were looking for tips and ideas on how to develop software that Microsoft would know a thing or two. I mean they write a lot of software (some better than others) and they have several development tools and platforms.

And there is a ton of documentation on specific tools or examples how to use some specific classes in excruciating detail. However, as far as general software design, architecture, and processes they haven't had much. And that's the kind of stuff I was looking for.

Then it dawned on me that a tool vendor is going to document how to use all the extended features and document as much as they can about their tool. But many of the principals of good design are platform independent. In fact good practice is often to go for the general case and only use the specialized features when necessary, and even then you build abstraction layers around them.

Then there is the quote "the sky is a different color at Microsoft." i.e. Microsoft is so big that most everything they use comes from Microsoft. If an idea wasn't invented there or they have not made their own version of a tool, they often appear ignorant that such an idea or tool exists.

I guess all I'm saying is that I no longer expect this kind of info from Microsoft. Instead I've been doing much better learning from blogs, open source projects, and books (lots of books.) The do have a patterns & practices group and they have been improving and the talk about the ASP.NET MVC framework seems promising (lots of examples of interacting with existing open source software.)

January 4, 2008

Got my copy of Applying DDD (w/C#) today

Filed under: — David @ 1:21 am

DHL said it arrived yesterday, but I never saw it. Turns out DHL used USPS and it was in the mailbox.

Anyway, the book is Applying Domain-Driven Design and Patterns: With Examples in C# and .NET. I just finished the first chapter and although a lot of it was familiar to me, I liked the author's writing style and found it more engaging than some of the more abstract books on the patterns, architecture, and design1. He mentioned several tools that I use daily like NUnit and CruiseControl.net.

I'm hoping this book will be both a good introductory book that I can give to people and that it will give me with some practical examples of how to actually work with DDD in .net. I really want to read through it as quick as I can so that can try to get some other people at work interested.

We have been using some things like unit tests and continuous integration and I think it has greatly improved our process and the quality of our code. Hopefully concepts like domain models and the object-relational impedance mismatch can spur further improvements.

  1. I have Domain-Driven Design, Patterns of Enterprise Application Architecture, and Design Patterns. I really like the books and I have learned a ton from them, it's just that they are a little dense and abstract. I don't know that I feel comfortable giving them to someone new to the concepts.

Next Page »