Posts Tagged ‘rails’

XML sit-ups with .NET

Tuesday, November 14th, 2006

I’m currently writing some C# code that outputs RDF/XML from a set of classes, and came across some annoyances regarding .NET’s support for XML namespaces (or the lack thereof).

First of all, .NET has only explicit support for one namespace per element. Additional namespaces must be specified by adding an extra xmlns attribute yourself. Well, that’s not so bad, but it adds to the code bloat.

When you want to use namespaces to create new elements (e.g. rdf:Description), you have to explicitly pass the namespace URI again. Otherwise the prefix (in this case rdf) will be ignored. It would be helpful if .NET could check to see if the prefix corresponds to any namespace previously specified in the document root.

Okay, I could have used an RDF library, but this was supposed to be a quick hack, so I didn’t have time to learn another library.

I can’t help but think that if I would have just used strings instead of the System.Xml classes, the program would have been finished sooner. Come to think of it, I should have known better and just used N3 or Turtle.

When using .NET’s XML classes, it seems like half of my code is redundant. Man, do I miss Ruby’s XML Builder.

I’ll end with a great graphic by Why the Lucky Stiff, in which he compares using XML to doing annoying sit-ups:

XML situps

The term XML sit-ups also appeared on the Ruby on Rails homepage:

Rails is a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups.

The common idiom with dynamic languages is to write configuration scripts or domain-specific languages in the language itself, instead of using XML. Compared to e.g. Java, XML is more agile and flexible, but that is not the case with dynamic languages such as Ruby or Python. XML.com has an interesting article about this issue.

IE chokes with Ajax.updater on a table

Tuesday, August 29th, 2006

For some time now, I have had a weird bug concerning an Ajax updater script in a Rails application. The updater worked with Firefox but not with Internet Explorer (IE).

Yesterday I finally figured out IE can only update div or span elements, when I came across this message on the Rails list. I was trying to update a table instead.

After wrapping the table in a div, and updating that div, everything worked.

Would be nice if this would have been documented in Prototype or the script.aculo.us scripts though.

Blog problems

Tuesday, May 30th, 2006

This blog has been down for a while. Maybe using Typo from trunk wasn’t such a good idea after all.

It might also have been caused by an incompatibility between the Rails version Typo used, and the main installation at this server.

Anyway, the blog is back online. Since there are a lot of things I couldn’t blog about, I will probably post frequent updates in the next couple of weeks.

Current controller and action in Rails

Tuesday, December 20th, 2005

I found out on #rubyonrails that it’s possible to get the current controller and action through the params[:controller] and params[:action] variables respectively.

These are definitely time savers when you’re building a menu structure based on the current controller and action.

New blog, website, web host and domain

Sunday, December 11th, 2005

This all started when I wanted to create a new blog.

Typo seemed impressive. However, it required Ruby on Rails, which wasn’t supported on Lumumba. I figured it would be cool to redesign my homepage with Rails as well, so that I could dynamically add content, and more tightly integrate my blog with the main website. The old homepage used a custom-made PHP templating system, which was only sufficient for small changes to the content.

Maybe getting a dedicated host would be the best thing to do. So I went through the list of web hosts supporting Rails. I came across sneaker.nl, a Dutch blog using Typo. We exchanged a few mails, and apparantly he was using DreamHost. After a couple of hours of comparing hosting plans, the choice was narrowed down to TextDrive, Planet Argon and DreamHost. DreamHost is really cheap for the web space and bandwidth it offers, but TextDrive and Planet Argon seemed more customizable, which I found very important. Unfortunately they are a bit expensive for my liking.

And then I stumbled upon Site5, which seemed to combine both enormous bandwidth and disk space with great support and reliability. I found a guide comparing Site5, DreamHost and TextDrive and a whole bunch of of Site5 reviews, of which the majority was positive.

Registering .be domains is free until January 31st, so I registered jozilla.be, and ordered a shared hosting plan at Site5.

And this blog post is the result :-) My homepage still requires some migration work though.

I didn’t regret signing up at Site5. Their community forums are very helpful. Yesterday, I sent an email to support and received an answer within 7 minutes!