Archive for June 2007

.NET on Linux faster than on Windows ? Hmm

2007/06/27

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 theserverside.com, one should be careful when reading how much Java outperforms .NET. The bias works the other way too – just look at the Theserverside.net 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

2007/06/25

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 !

2007/06/24

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

2007/06/21

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

2007/06/21

As seen in the video at http://sciencehack.com/videos/view/IDT2RMJNvSA#searchkeywords

The source code:

screen-16.png

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)

screen-14.png

and here is how it looks in IE7:

screen-15.png

BOTD: Railscast

2007/06/19

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

2007/06/15

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

http://msdn2.microsoft.com/
en-us/library/system.data.dataset(vs.80).aspx.

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.

http://msdn2.microsoft.com/
en-us/library/2_0/system.data.dataset.aspx

) 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:

picture-3.png

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 ๐Ÿ˜‰

picture-4.png