Thijs van der Vossen,
28 Jun 2006, 20:32 in ruby on rails and events (edit).
You can now subscribe to our podcast with talks from the Rails ‘show and tell’ meeting:
Subscribe with your default feed reader
Subscribe with iTunes
Right now we only have ‘Unicode in Rails’ available, but you can expect more talks in the coming days. It’s also possible to download individual talks.
Thijs van der Vossen,
23 Jun 2006, 09:34 in ruby on rails and events (edit).
A big ‘thank you’ to Andy Lo A Foe, Rien Swagerman from Resource Studio, Simon de Haan from Eight Media, Flurin Egger from DigitPaint and Julian ‘Julik’ Tarkhanov for their talks.
We also like to thanks Greenpeace International for letting us use the basement and especially the Application Development Team for helping out with the gear.
More photos can be found in our Rails ‘show and tell’ meeting flickr set.
Thijs van der Vossen,
21 Jun 2006, 13:15 in ruby on rails, web, and unicode (edit).
The Unicode roadmap thread on the Ruby Lang mailing list is now almost 100 messages long.
Yukihiro Matsumoto (matz):
I am too optimized for Ruby string operations using Regexp.
Tim Bray:
Julian ‘Julik’ Tarkhanov:
I think this thread is going to end the same as the one in 2002 did.
Read the whole damn thing if you want to know more about the gritty details. In case it makes your head hurt, go read On the Goodness of Unicode, Characters vs. Bytes and The Absolute Minimum Every Software Developer Absolutely, Positively Must Know About Unicode and Character Sets (No Excuses!) first.
Thijs van der Vossen,
19 Jun 2006, 09:06 in ruby on rails and events (edit).
Here’s the list of talks for the Rails ‘show and tell’ meeting.
Introduction from Greenpeace
Martin Lloyd from the Greenpeace International Application Development Team will give a short overview of the work they’ve done with Rails and Django.
Audio (AAC) | Audio (MP3)
Web Services
Andy Lo A Foe will show us how to connect your Rails project to legacy Java and PHP applications using XML-RPC, SOAP and REST-style web services.
Audio with slides (AAC) | Audio (MP3) | Slides (PDF)
Content Management with Rails
Rien Swagerman from Resource Studio will talk about his experiences with building a CMS on Rails that’s tailored to the needs of his design studio.
Audio with slides (AAC) | Audio (MP3) | Slides (PDF)
Why Django?
Simon de Haan from Eight Media will talk about why they choose Django and not Rails as their default web development framework. An excellent opportunity to learn what the other hot new web framework is all about.
Audio with slides (AAC) | Audio (MP3) | Slides (PDF)
Mailing newsletters
Flurin Egger from DigitPaint will talk about the development of EntopicMail, a Rails application for mailing out newsletters that’s currently in use at organisations like Philips, NEN and the dutch Ministry of Health, Welfare and Sport.
Audio with slides (AAC) | Audio (MP3) | Slides (PDF)
Unicode in Rails
Julian ‘Julik’ Tarkhanov will show us why the lack of Unicode support in Ruby is a problem when developing Rails applications. He’ll also talk about how he developed a very nice way to properly handle Unicode data in Rails.
Audio with slides (AAC) | Audio (MP3) | Slides (PDF)
Update: Added audio and slides.
Thijs van der Vossen,
16 Jun 2006, 10:45 in ruby on rails, web, and unicode (edit).
The current Ruby version has no Unicode String class like in Python or Java. This makes it hard for Rails to support multibyte encodings.
The following code snippet from the truncate helper is a good example:
if $KCODE == "NONE"
text.length > length ? text[0...l] + truncate_string : text
else
chars = text.split(//)
chars.length > length ? chars[0...l].join + truncate_string : text
end
This was added to make the helper work with multibyte characters, but it is far from beautiful.
A few days ago, Julian proposed to add a proxy to the string class for accessing characters instead of bytes. I think this is an excellent and very nice solution.
You access the proxy with the char method on a string object. You can for example get the number of characters with:
text.chars.length
The char method is aliased as u, so you can also write:
text.u.length
Which to me looks even nicer.
Using the proxy, you could replace the six lines of code from the truncate helper with:
text.chars.length > length ? text.chars[0...l] + truncate_string : text
That’s a whole lot more obvious. And don’t be fooled, this is just as fast as the longer version because the proxy only uses the multibyte safe methods when $KODE is set.
Apart from making the Rails code easier to understand and maintain, the proxy can also save application developers a lot of work.
The proxy and the patches to the Rails code are currently in development as a plugin you can get from Subversion. Even though the plugin is called ‘Unicode hacks’ for historical reasons, it’s actually a very clean solution by now. There’s also a proposed patch to the Rails source.
Please try this one out and give your feedback.
Manfred Stienstra,
06 Jun 2006, 10:53 in javascript and web (edit).
RightCart is a cool service that allows you to embed a shopping cart into your webpage. It looks great, but I think it should be a little bit easier to set up.
When you create an account, you get a small piece of HTML to add to your web page (I’ve added formatting for clarity):
<div class='rightcart_div'>
<script type='text/javascript'>rightcart_pid='1'</script>
<script type='text/javascript' src='http://rightcart.com/static/rightcart_display.js'></script>
</div>
Above the code is the following text:
“Simply add the three lines of code below to your web page and your RightCart will appear on your site. It’s that easy.”
But why three lines? Let’s look at the information this application needs. I see a div with a the class ‘rightcart_div’, followed by a variable ‘rightcart_pid’ and after that an URL for a piece of JavaScript. In Rhubarb we do the same with a single line of code:
<script type="text/javascript" src="http://rhubarb/inline/58"></script>
So why is this shorter? We don’t need a named div because our javascript adds it to the page. We don’t need to set a user id of some sort because it’s in the URL. That leaves a single script tag.
Even better, the full code contains a link to a full-page version of the same content for when JavaScript is not available:
<script type="text/javascript" src="http://rhubarb.fngtps.com/inline/58"></script>
<noscript>
<p><a href="http://rhubarb.fngtps.com/58">Aksie!</a></p>
</noscript>
It can be dangerous to add HTML to other pages like this. The injected HTML could end up in biggest case of tagsoup you’ve ever seen, completely breaking your layout.
That’s why we offer four different ways to publish an appeal with Rhubarb: a regular page, embedded on another page inside an iframe, embedded inline and embedded with a nice lightbox effect.
This way you can choose the delivery type that best fits your site while keeping everything accessible.