Yeah it’s that time of the year again. Well end of the year I should say. The time where everyone gets all energetic about their future. “It’s a new year and this time I am going to really do it…no really I am…c’mon! Seriously I am!”. OK I’m finally getting around to moving my old posts over here so stay tuned. See my next post in 2011 (Just kidding…hopefully).
Finally…
December 29, 2009 by eeickeMoving my blog…
October 26, 2009 by eeickeI’m moving my blog so please stand by……
MS Small Basic
October 29, 2008 by eeickeLast week Soma Somaseger announced on his blog the start of a new portal for MS developer tool innovations called DevLabs. Initially Microsoft has posted four new innovations on the portal. The one that caught my interest is called Small Basic. Small Basic is a simple development environment for people wishing to learn how to program (especially kids!). After downloading it I was surprised to find it includes an implementation of Turtle Graphics! Some of you out there probably have no idea what I am talking about. As a young child I loved turtle graphics and was glad to see it hasn’t been forgotten as a learning tool. The idea behind turtle graphics is to command a turtle on the screen to draw a picture for you. It’s a great start to software development. It teaches you the basic structure of writing a program and how to instruct the computer to do something for you.
Take a look at this sample program I wrote:
After typing the above code in click the Run button at the top of the screen:
The turtle on the screen will follow your every command. I won’t tell you what the above program draws. I’ll leave it up to you to put the code in yourself and run it. I should note that Small Basic isn’t limited to turtle graphics. It’s capable of other things too like downloading a random picture from Flickr and making it your desktop background. Download Small Basic here and start playing with it. I can’t wait to teach my kids how to write software with this tool.
Update: Microsoft has yet another programming language coming out for kids (and me) called Boku. This language is entirely visual and will mainly be used to create games. It’s not available yet and should be released soon. I can’t wait to try Boku out!
Using InnerText elements in your app.config files.
October 22, 2008 by eeickeSample code for this post can be found here.
A custom configuration section in your app.config may commonly look like this:
<authors> <author name="Eric Eicke" /> <author name="Tobin Titus" /> <author name="Kevin Borowsky" /> </authors>
But what if you wanted your configuration elements to contain the authors name in the contents of the element instead of having an attribute called name like so:
<authors> <author>Eric Eicke</author> <author>Tobin Titus</author> <author>Kevin Borowsky</author> </authors>
When creating your configuration classes to consume this configuration you might be tempted to create your Author element class like this:
public class AuthorElement: ConfigurationElement { public AuthorElement() { } [ConfigurationProperty("name", IsRequired=true)] public string Name { get { return (string)base["name"]; } set { base["name"] = value; } } }
You will soon discover that when the ConfigurationManager tries to parse your configuration it will throw and exception with a message stating:
The configuration section cannot contain a CDATA or text element.
How do we get around this problem? It turns out the ConfigurationElement class allows you to control the deserialization of your configuration elements (as well as serialization but that’s for another post). By overriding the DeserializeElement method of the ConfigurationElement class we can now override how the AuthorElement is deserialized and retrieve the contents of the author elements ourselves so that the ConfigurationManager doesn’t deal with them. The override method looks like this:
protected override void DeserializeElement(System.Xml.XmlReader reader, bool serializeCollectionKey) { this.Name = reader.ReadElementContentAsString(); }
Now after adding the above override I can retrieve my list of authors from the configuration section without exception.
The sample code that demonstrates this in more detail can be downloaded here.
Using ActiveScript in Managed Code
October 20, 2008 by eeickeI recently was involved in porting a legacy COM application to a .NET version of the application. The application made heavy use of VBScript through the ActiveScript interfaces for customization. The customers current user base was large enough that one of the requirements was to continue to support existing scripts in the field. So interfacing with ActiveScript via .NET was a must. I set out to find a library that already did this, but all I really found were pieces here and there on how to kind of implement it. I played around for a while and finally came up with a good implementation. It even supports adding your own .NET objects to the script. I was able to get rid of all the COM objects and port the entire object model to .NET. The only COM in the new application is the ActiveScript stuff. There are some advantages to using ActiveScript still. For one it doesn’t compile an in memory assembly that you can’t get rid of. If you want to get rid of your compiled in memory assemblies in .NET you have to put them in a separate application domain and unload it, which can be tricky depending on the complexity of your application.
I’m posting the entire ActiveScript libaray including source code on CodePlex for anyone to use free of charge. There is a basic sample included with it that demonstrates how to use the library. It’s actually pretty simple. In future blog entries I will write more on how to use it. For now I wanted to get it out there for others to use. Hopefully it will save some of you some time and hassle. If you find the code useful and decide to use it drop me a line.
The source code (written in C#) can be found here on CodePlex.

