Archive for June 2007

.NET on Linux faster than on Windows ? Hmm


An interesting article on JavaLobby caught my eye today: Do .NET Applications Run Better on Java?

Normally, knowing the not exactly impartial focus of the Java centric site such as JavaLobby or, one should be careful when reading how much Java outperforms .NET. The bias works the other way too – just look at the or other .NET centric side how much is C# superior :-). With that in mind, I looked at the technical report.

The report was produced by Mainsoft, the company behind the cross compiler product MainSoft for Java EE. The crosscompilation means that the C# or VB.NET code is first compiled into CLR bytecode using standard Microsoft tools and then transformed into Java bytecode using the CLR byte as input. The study was based on fairly large project – 260’000 lines of code. The published result show that translated code running on Java VM and Websphere platform outperformed the .NET stack on both Windows as well as Linux platform.

So far so good. I have no plan to question the results of the test. One could argue that because the evaluation was not done by independent third party, but by the authors of the crosscompiler, the result must be like it was – simply because if the measurement would show that .NET performs better, no report would be published ๐Ÿ™‚

First of all “faster” does not really means much faster. The speed increase measured is 8% in throughput and very much the same for requests per second. 8% increase is much too small to suggest doing anything major with the application, certainly not re-platforming …

Second, comparison based on single port of an application proves absolutely nothing about results of repeating same process for other application or even every application. It can be indication of reality as easy as an exception. I am pretty sure that given the chance to respond, Microsoft or some other party interested in the opposite outcome, could find a C# application that would perform worse after conversion.

More interesting questions is why would you want to do this – replace Win2003 + .NET CLR with some other operating system (Windows/Linux/something else) plus Java plus Websphere. Clearly, performance cannot be the reason – at least not based on this results.

Price is not a good reason either. From cost saving perspective, crosscompiling .NET application to run in Java under Windows makes no sense, because .NET runtime is part of Win2003 license and cost of the license is there in both cases. This leaves using Linux as platform (or some other free alternative). True, Linux is free – but support is not, neither is labor. In real life, initial costs of licenses are small compared to accumulated costs of supporting application in production – and professional support for Windows or Linux is comparably priced. Besides, I bet that savings gained from not paying for Windows license will not cover cost of Websphere license plus the Mainsoft Java EE Entreprise edition license. True, you could use free j2EE server just as Tomcat or Glassfish or JBoss with the free Grasshoper version of the crosscompiler – but you may not get the same performance numbers. I like Tomcat and use it all the time: it is nice, flexible, easy to configure – but, not the fastest servlet container out there (there must be a reason why did Mainsoft pick Websphere with their own enterprise version after all) …

What is the conclusion ? The article above and approach it describes can be a life saviour if you have lot’s of .NET code and *must* for some real reason switch the platform. The reason may be technical – or not – just consider the magic Google did with Linux. The report does hint one possible good reason – moving your application from PC’s to really big machine – multiprocessors (multi means more than 16 these days when desktop machines start getting quadcores ;-)) running Unix or mainframe. The report shows that AIX on Power5+ based system with 4 CPU did ~ 3400 requests per second whereas the PC based did 2335. This would be interesting if the comparison was fair – but it was not. The AIX had 32 GB RAM whereas PC (with Linux or Windows) had 2 GB and you can imagine the price difference in the hardware.

But if there is no really compelling business reason of switching platforms, sticking with Windows when you want to run .NET application may save you lot of work – and most likely some money as well.

Search for perfect online photo storage


One thing that is on my Someday/Maybe list for quite some time is to get some off-site storage for my digital images. They are reasonably safe on RAID-5 NAS with a copy on USB disk, but what is missing is off-site copy. At minimum, a remote backup, ideally with an UI resembling something like Aperture or Photoshop Elements or Shoebox: photo organizer with Web intefarce and remote storage. So that in addition to have offline backup I would have an option to work with images from any location.

I looked on several sites – Flickr, Fotki, Picassa Web. I liked Picassa, but 1 GB storage space may be plenty to publish few sized-down galeries, but close to useless for archival. Who has less than 1 GB digital photos ? I need to upload about 50x more … It looked pretty bleak – but then friend of mine made me aware of SmugMug. I was impressed with what I have read in service description and even more when I saw it working.

It is still not the 100% perfect solution for me – but it certainly is the best thing I have found so far. The presentation is beautiful, it is fast and pleasant for the visitor. Oh, did I mention UNLIMITED storage for very reasonable price – $39.95/year. Plus unlimited traffic … And it is really fast.

The way how SmugMug organizes your images are galeries. Similar to filmrolls from iPhoto, every images belongs to exactly one gallery. You can organize your galleries to categories and subcategories. Based on EXIF information, SmugMug can provide you with timeline and access your images based on the capture or upload time. Within the gallery, you can use drag and drop to re-organize the order, or create the slideshows.

SmugMug has attracted nice and healthy ecosystems of users and tools. In addition to default tools (such as mass uploaders), several user made tools are available.

It is not only nice and smooth UI that is worth admiring. One area where SmugMug really shines was support. I had some questions so I fired off an email on Sunday afternoon, not really expecting anything other than automated response until Tuesday. What happened was nicest customer support surprise I have experienced in last few months. In less than hour I had an answer from real human being – what a rare experience these days. This with combination with really nice application makes SmugMug stand above the crowd ;-).

If I could make any additions to improve this very nice application, here are my suggestions:

1) Allow alias for images. In order for an image to appear in multiple galleries, it must be copied. There is a tool that makes the process manageable, but copying is confusing – why should two images exist with same file name ? It is essential to allow same image be “member” of multiple galleries without copying it

2) Allow “stacks” – similar pictures on top of each other – with best on top and an option to “explode” and “implode” the stack

3) Really useful would be “smart galleries” – picture appears in the gallery based on metadata, e.g. Nikon, Olympus

Netbeans Ruby IDE – great tool getting even better !


I have spent last two days (and few evenings before) playing with Rails and using Netbeans Ruby IDE. What a great experience ! Unlike before, it is so much easier to have really good debugger that allows put breakpoints not only into the Ruby code in controllers and model – but even into the RHTML view files !

Netbeans team works hard on improving the tool. With latest build – 2434, I have noticed great addition – Rails console. The IDE had IRB window even before, but the environment did not load the Rails context and would not recognize e.g. ActiveRecord. Now with latest build, everything works like charm.

Using Rails and coding in Ruby is real pleasure and the only pain-point was (compared to using Eclipse with Java or Visual Studio 2005 with C#)ย  unavailability of a really good IDE. Yes – I tried RadRails and RDT plugin, but they still need lots of improvement and are not (yet) in the same league. Netbeans Ruby IDE is right now very likely best available free environment for Ruby and Rails environment. It allows work with both Ruby and JRuby with or without Rails – what more can you want ๐Ÿ˜‰ ?

Thanks, Sun and the Netbeans team !

Quote of the day


The realization came over me with full force that a good part of the remainder of my life was going to be spent in finding errors in my own programs.

— Maurice Wilkes

What is so worthy mentioning on this obvious stament, describing fate likely shared by many thousand or milions of software developers worldwide ? Not much, only the date. According this book (which is a pretty good read btw),
Sir Maurice came to the sad realization mentioned above in the year 1949.

Just wondering – what have we learned since ?

Adding image to link with CSS only


As seen in the video at

The source code:


Very good explanation is in the video mentioned above. So far so good – unfortunately the technique, however cool it is, does seem to work in Firefox only. Or at least it does not work in the still most prevalent browser on the Net.

Here is how it renders (properly) in Firefox (tested with 1.5)


and here is how it looks in IE7:


BOTD: Railscast


Today’s blog of the day is not really a blog, but a screencast. Dedicated to Ruby on Rails, the Railscast offers (as of today) 46 episodes of short, targeted practical advice on various aspects of Rails development.

Unlike some other screencasts who try to record the screen action as MPEG movie, this one is perfectly legible. In addition to the Rails enlightenment, you can also enjoy the speed and aesthetics of using TextMateย  – with many great Ruby editing shortcuts and beautiful OS-X typography.

Available as subscription in iTunes – search for Railscast.

MSDN Documentation – the follow up


Judging by the number of hits, Joel (and myself) are not the only people who would like to see nicer, better and faster MSDN documentation. As a very nice surprise, some of the feedback came directly from the people than actually can do something about it – like Darren Parker from Microsoft and Anand Raman from the Sandcastle project. Rob Relyea suggested and interesting looking tool based on XAML.

Thanks everybody – it is always nice to find out that even really big companies listen to the developers and want to address the problems. It almost feels like OpenSource experience where (it was few years back) we have encountered an issue in one of many Java templating libraries, posted to discussion group a question and few hours + several emails later had patch for the bug from the library creator :-). But back to the topic.

In addition to the issues mentioned yesterday, I’d like to add few more suggestions:

1) Multiple languages on the same page.

In theory, it sounds great to be able to select in which .NET language syntax I want to see the class, but …. In real life, we seldom switch languages. The project that starts as C# projects will stay C# project – and for several months the developers will not care about documentation in anything but C#, certainly not J# or Javascript … For that reason, ability to dynamically switch languages is not really important. And who needs J#, anyway ๐Ÿ˜‰ ? If there is one thing that should go to sub-pages, the “other languages” should be it.

2) Visual organization

Sounds like minor problem, but it impacts usability a lot. Few examples: The icons in the first column can be safely dropped and free space better used to add the return type and parameters. Position in the inheritance tree and list of parent classes / implemented interfaces (hyperlinked) should follow. After that, the list of members – constructors, methods, properties etc, preferably in single page with links to detail page / code examples. Just compare the definition of DataSet in Mono documentation and in MSDN to see the difference.

3) Postback behaviour

Frames are old and out of fashion, but IMHO still best solution for some sort of tasks – such as documentation. One of killer features of frames is separate and independent reload of one frame while others keep the selection, scroll position etc. Why does the MSDN page – which uses frames – have to reload all of them ?

4) URL’s

In the spirit of REST, the URL should be descriptive and understandable. The MSDN URL’s are not bad – take for example

I am not sure, however, what value adds embedding the VS version into URL. It may be sometimes interesting to see the changes between the 1.1 and 2.0 versions of the same class, but it would be cleaner to make the “split” at the top level ( e.g.

) and provide link from the 2.0 version of DataSet documentation to 1.1 / 1.0 version of the DataSet documentation. This is immensely usefull if you are porting the 1.1 application and need quickly review the changes.

4) Breadcrumbs or Dynamic Menu or what the heck it is

I mean this:


This is something that really should be reviewed, both from implementation and well as content perspective. As I see it – it tries to be several things at the same time and does not really do properly any of them. It duplicates part of the path in tree in left frame, interwoven with some other information.

Some members of this construct are just plain confusing – for example Previous Version. Assume that I am on DataSet documentation and Click on Previous versions, it lands me either on starting page for .NET Framework 2.0 or 1.1 implementation. The problem is that NONE of these pages has anything to do with page I was on – the DataSet – and only way how to get back is Back button …

From usability perspective, selection in the “menu” often causes postback and redraw of all frames …

One more thing: it is not really important (and it may not be a problem on Microsoft side), but the left-side tree does not load in Safari on Mac – not that there would be too many people reading MSDN documentation from OS-X platform ๐Ÿ˜‰


MSDN Documentation – the worst in class ?


Did it ever happened to you that you were using some tool day after day – and never realized it’s pretty big deficiencies ? Until somebody, coming from different background pointed out what everything is wrong with the tool ? Before that moment of revelation, the issues were just inconvenience, but right after that they became real annoyance ?

Exactly this happened to me last week and the credit for pointing out what is wrong with MSDN documentation (and the “standard” .NET documentation format in general) goes to Joel ๐Ÿ™‚

For developer using object oriented language such as C#, Java or Ruby, what you need on daily basis is to find information about a class, see its public interface,members, constructors, method signatures. Ideally, on single page, with possibility of drilling down to the details of a method and to a code example. You also very often need to see all implemented interfaces, have easy access to parent class and (in case of e.g. an interface inside a framework) to access the implementing classes or derived classes within this context.

Unfortunately, the Microsoft .NET documentation makes this simple task not exactly easy, pleasant or fast. As an example, lets take something really simple e.g. DateTime struct. In the documentation, information about this simple class are separated to 6 pages: datetime structure itself, Members, Fields, Constructor, Methods and Properties. If you would expect that with this devotion of low level categorization the particular page for e.g. Methods will give you all details about all DateTime methods, you are wrong. What Methods page gives you is just list of names, not even a method signatures – parameter types and return values are missing. To get this information, you must click through into the page dedicated to that method. If the method is overloaded (take e.g. omnipresent ToString), the Methods page contains only one name and only the next page gives you the signatures, linked to another page with details. See for yourself


In addition to bad information structuring, almost every link causes full page reload.

Compare with how much more usable is the Java documentation: it is very easy to see all interfaces, methods, constants, parent classes, implemented interfaces in single page. The dated frames-based UI actually makes lots of sense and is (except AJAX based dynamic site) much better way how navigate the documentation.

With all that said, I am not surprised that the tools such as Reflector are so extremely popular in .NET world. It not only provides very useful debugging/inspection tool, but thanks to excellent and compact presentation of information about the class retrieved from reflection, they are the fastest way how to get meaningful information on core classes API. Other than Reflector, the other fast way how to get information on .NET core library details is Google search.

Try for example how fast you can access a documentation for particular class starting with Google search – let’s take e.g. WebConfigurationManager. Google search returns blazingly fast (as always) – with the MSDN page as first hit. Now compare how fast you will get the same information starting from MSDN home page, (which is btw, advertising ‘new and improved search and navigation‘). Your mileage may vary, but I usually see 3-8 seconds delay in search response (compare to <0.5 sec for Google). Few seconds seems like no problem, but when you do it all the time, it easily becomes pretty annoying. Even more so when you realize that Google is searching WHOLE WEB, with content they do not own or control, only index and rank, whereas MSDN search is searching MSDN data repository, which is – however you measure it – by many orders of magnitudes smaller and Microsoft fully controls most of it’s content.

Why cannot the largest and most powerful software company create documentation that is useful and usable ? Even the documentation for the OpenSource Mono project (port of .NET to Linux and other platforms) is *much* better than the original. See the class DateTime there for comparison: the menu is dynamic and does not reload page every time you click on a link, the methods have full signatures and everything is on single page with local links and only details are on second level page.

BOTD: Strange Maps


Today’s Blog Of The Day is named Strange Maps, which strangely accurate name. If you have are into maps, or information visualization – or combination of both, do NOT visit this link, because you risk sticking there for few hours :-).

Some ideas presented are quite original and wonderful: for example the map of the USA, having instead of names of the states name of the countries with same GDP as the state. You will find out that Canada == Texas, France == California and Hungary == New Mexico. Or a transposition of the map of Europe and map of Middle Earth – this places Rohan to southern Germany (not a bad match), Isengard is Hamburg. The Mordor ended up in Transylvania with Mount Doom in Romania, Minas Morgul in Hungary and Minas Tirith approximately in Austria.

Highly recommended.

Swing-ing back – to Netbeans


It has been quite some time since I used a Swing based Java application. Compared to beauty and close-to-native feeling of Eclipse based application, Swing just did not feel right – it looked differently and behaved a bit differently. For long time, my desktop was Swing-free (not counting the JDK demo). Not any more, though.

What made me to reconsider, is new release of the Netbeans v 6. In the latest milestone builds (M6 to M9), Netbeans team built amazing Ruby development environment. Compared to Ruby plugin in Eclipse, it has way more functionality, better debugging, really impressive editing support and very cool Rails extensions. The full description of new features is here.

Best way how to start is to download pre-built IDE (inluding Mac friendly packaging) from NBExtras and give it a try. I was quite impressed. On modern hardware, the IDE is very responsive and Ruby development in Netbeans is even more fun as usual. The only small annoyance is frequent redraws and “flicker” of GUI when running on Windows – but it is likely one of the issues that may go away in final release.