Monday, February 06, 2006
VMWare Server for Free :)
VMWave is making a new VMWare Server product available for free. See http://www.theregister.com/2006/02/03/vmware_goes_free/ for a better write up.
Friday, January 20, 2006
.Net Generics vs Java Generics
I'm a big fan of Java. It is nice to see the fan base for Java is still far above .Net (and outpacing .Net in growth); see http://www.tiobe.com/tpci.htm
One area I've found .Net outshines Java is the implementation of Generics. Java's Generics exist in source-code only. The Java compiler "Erases" the generic information after the compiler determines that everything is correct. This approach outshines C++ templates, but it creates a lot of other issues. See the Java Generics FAQ which lists pages of special rules and edge cases caused by Erasers. Java Generics is more complex than Java the language!
.Net Generics on the other hand are implemented at runtime. So the Generic type information is not lost and is available through reflection. When the .Net CLR encounters the usage of a Generic type for the first time, it instantiates a non-Generic type based on the type parameters. The Generic type is never executed, it is just used by the CLR to create concrete instances. So Array<string> and Array<float> are two seperate classes at runtime. Java would have just used Array. So .Net memory grows a little more (but not like the bloat of templates in C++), which is a great trade off since it avoids the problems and complexities of Erasures.
One area I've found .Net outshines Java is the implementation of Generics. Java's Generics exist in source-code only. The Java compiler "Erases" the generic information after the compiler determines that everything is correct. This approach outshines C++ templates, but it creates a lot of other issues. See the Java Generics FAQ which lists pages of special rules and edge cases caused by Erasers. Java Generics is more complex than Java the language!
.Net Generics on the other hand are implemented at runtime. So the Generic type information is not lost and is available through reflection. When the .Net CLR encounters the usage of a Generic type for the first time, it instantiates a non-Generic type based on the type parameters. The Generic type is never executed, it is just used by the CLR to create concrete instances. So Array<string> and Array<float> are two seperate classes at runtime. Java would have just used Array. So .Net memory grows a little more (but not like the bloat of templates in C++), which is a great trade off since it avoids the problems and complexities of Erasures.
Thursday, January 12, 2006
Stop running that startup junk.

A friend asked me how to stop some of those annoying programs that always startup when he starts windows. The best solution I've found is a freeware tool Autoruns from Sysinternals (http://www.sysinternals.com/Utilities/Autoruns.html). Autoruns is a powertool that gives you easy access to everything that is executed at startup. Autoruns allows you to simply uncheck the programs that you don't want to run.
Sysinternals has a number of great tools for performing other tasks. For example, Regmon and Filemon are handy to see what is really going on when installing a program. They are also handy for debugging programs.
Sunday, January 08, 2006
From Ant to Ruby - 122 lines of fun
Last month a friend of mine had a disk failure. Fortunately most of his files are still in good shape. Right now, he is going through the difficult process of trying to recover what files he can. This task is extra difficult since Windows XP encrypts everything under the 'My Documents' folder so that other accounts and OS cant read them. If you are not doing regular backups, you are just asking for trouble.
For almost a year now, I've used a simple Ant script to backup my files. I use a very simple method of copying everything to a separate drive using Ant. The backup also has a few extras that require special steps. For example, backing up my subversion repository requires calling the subversion svnadmin hotcopy command. I've been happy with this process until I wanted to automate backing up data I have stored on the internet. For example, my bookmarks and address book are in yahoo. So I had to manually export them from yahoo to a file, then run my backup script. I looked at using Ant's 'Post' task to automate the web stuff, but I was really unhappy that it wasn't very nice code. Also it was hard to verify that everything worked correctly. If yahoo ever changed a page, the backup might stop getting my data and Ant wouldn't tell me.
So I decided to convert the backup to one of my favorite languages Ruby!
My first task was just a straight conversion of my Ant script to Ruby. The original Ant script was 122 lines of code. When I finished the Ruby version, it came to exactly 122 lines of code! Very funny! This completely surprised me. I had thought Ruby would take more lines of code than Ant. In Ruby I had to write a lengthy backup function (40 lines), and add a few convenience functions. However, when I finished the initial conversion they came out to exactly the same number of lines.
Right now I'm adding more advanced features to my script. Which I will blog about later.
For almost a year now, I've used a simple Ant script to backup my files. I use a very simple method of copying everything to a separate drive using Ant. The backup also has a few extras that require special steps. For example, backing up my subversion repository requires calling the subversion svnadmin hotcopy command. I've been happy with this process until I wanted to automate backing up data I have stored on the internet. For example, my bookmarks and address book are in yahoo. So I had to manually export them from yahoo to a file, then run my backup script. I looked at using Ant's 'Post' task to automate the web stuff, but I was really unhappy that it wasn't very nice code. Also it was hard to verify that everything worked correctly. If yahoo ever changed a page, the backup might stop getting my data and Ant wouldn't tell me.
So I decided to convert the backup to one of my favorite languages Ruby!
My first task was just a straight conversion of my Ant script to Ruby. The original Ant script was 122 lines of code. When I finished the Ruby version, it came to exactly 122 lines of code! Very funny! This completely surprised me. I had thought Ruby would take more lines of code than Ant. In Ruby I had to write a lengthy backup function (40 lines), and add a few convenience functions. However, when I finished the initial conversion they came out to exactly the same number of lines.
Right now I'm adding more advanced features to my script. Which I will blog about later.
Wednesday, December 07, 2005
Java vs C# vs C++
Take a quick look at Comparing Two High-Performance I/O Design Patterns, page 3 which graphs the results of writting the same I/O code in Java, C# and C++. It is really cool to see how well Java and C# stack up against C++.
I've written a couple of servers in Java using NIO, and in C++ using raw sockets. I was very impressed with the performance of Java. Factor in how easy it was to write the Java code and Java is a clear winner to me.
One thing that isn't shown in the article is the difference between Java and C#'s class library. In Java, most everything is a CharacterSequence. All the conversion and string manipulation features in Java work with CharacterSequence. For example you can perform Regex functions directly on the NIO buffers!
Unfortunately in C#, the various strings and buffers do not have a common parent. The String and StringBuilder classes only have Object as the common parent. Also classes like RegEx do not support a wide range of targets. RegEx only works on String and serialization streams. You can't perform a RegEx directly on StringBuilder in .Net!
In conclusion, go Java :)
I've written a couple of servers in Java using NIO, and in C++ using raw sockets. I was very impressed with the performance of Java. Factor in how easy it was to write the Java code and Java is a clear winner to me.
One thing that isn't shown in the article is the difference between Java and C#'s class library. In Java, most everything is a CharacterSequence. All the conversion and string manipulation features in Java work with CharacterSequence. For example you can perform Regex functions directly on the NIO buffers!
Unfortunately in C#, the various strings and buffers do not have a common parent. The String and StringBuilder classes only have Object as the common parent. Also classes like RegEx do not support a wide range of targets. RegEx only works on String and serialization streams. You can't perform a RegEx directly on StringBuilder in .Net!
In conclusion, go Java :)
Friday, November 04, 2005
Development at Valve
Game Developer Magazine (http://gdmag.com/) had a real great article about Valve's process and practices that they used to produce Half-Life 2 (Nov 2005 issue). Go get your hands on the article it is really an interesting read.
Their process incuded many elements that are also found in Agile processes. They used a lot of prototyping and interations in the development. The iteration strategy really paid off for them. When faced with trade-offs they favored reducing scope to get more iterations. More iterations forced them to reduce the overhead costs of iterations. Having more iterations helped them increase quailty, experimentation, and enabled them to delay decisions until later in the process. They said "Decisions made later in the project were always better than decisions made earlier."
Their team culture is also very interesting. They worked in small 4-5 person teams (Cabal). Each Cabal shared an office space to increase communication and avoid getting side-tracked. They discouraged "sole ownership". They promoted positive competition between team members and across teams. Also they created demanding comsumers for everyone on the team.
I've only touched on some aspects of their system. You'll have to read the article to get the full story.
Their process incuded many elements that are also found in Agile processes. They used a lot of prototyping and interations in the development. The iteration strategy really paid off for them. When faced with trade-offs they favored reducing scope to get more iterations. More iterations forced them to reduce the overhead costs of iterations. Having more iterations helped them increase quailty, experimentation, and enabled them to delay decisions until later in the process. They said "Decisions made later in the project were always better than decisions made earlier."
Their team culture is also very interesting. They worked in small 4-5 person teams (Cabal). Each Cabal shared an office space to increase communication and avoid getting side-tracked. They discouraged "sole ownership". They promoted positive competition between team members and across teams. Also they created demanding comsumers for everyone on the team.
I've only touched on some aspects of their system. You'll have to read the article to get the full story.
Monday, October 31, 2005
OpenCsv
Today I needed to parse some CSV data. A quick search found a project called OpenCsv that was added to sourceforge last month. I pulled it down and found it did a great job on the data I was parsing. The data I am parsing contained newlines, commas and quoted strings inside the csv elements. Some other libraries would not handle this correctly but OpenCsv did!
Subscribe to:
Posts (Atom)