rb's blog

YUI-ext grid and context menus

I recently had the opportunity to use YUI-Ext for a little application. I'll focus on the creation of the context menus for the grid. If you're discovering YUI-Ext's layout approach, more information is available from Jack Slockum's blog in Exploring Cross-browser Web 2.0 Layouts with Yahoo!

Accessing temlpate variables in tests

In your tests, you can easily access variables defined in your templates as:
and here's a concrete example:

Upgrade to Rails 1.2 notes

As I was looking to upgrade applications to rails 1.2, I wrote down all changes I had to do, and post those here in the hope it can be useful to anyone. I have skipped rails 1.1 for some apps and upgraded from rails 1.0, so some (all?) of the points could be from differences between rails 1.0 and 1.1. The first thing is that apparently the name of model classes have to be named very precisely, and there's now a check to see the class was loaded correctly. This caused a problem for the class I had defined in the file app/model/user2address.rb.

Understanding javascript's prototype member

After looking Douglas Crockford's talks about javascript, I started experimenting to really understand javascript's prototype. If you have downloaded the presentation's slides, this is an illustration of slide 27. I've worked with the javascript interpreter included in the JDK6, based on Rhino. If you do this, just run $JAVA_HOME/bin/jrunscript and you get a prompt of the javascript interpreter. Each javascript function is given a prototype member when it is created.

Enhance your javascript knowledge online!

Until now I've been using javascript as a simple language to get Ajax features, but as I used it I discovered interesting features and got really interested to know more. As the JDK 6 has rhino included, you can also use javascript and get access too all Java libraries, which makes javascript knowledge even more interesting. A really great resource to know more about the power of javascript and how to use it effectively is the series of presentations by Douglas Crockford made available online by Yahoo.

Javascript closures illustration

Jack Slocum mentioned in a comment the problem comes from the creation of a global variable. When you create a local variable, you don't get the problematic behaviour. Thanks Jack for taking the time to correct me.


Here is the illustration of a bug that was present in version 0.1 of the yui slideshow.

YUI based slideshow

As I wanted to add a slideshow on the MyOwnDB homepage, I started looking for a ready made solution, but as I didn't find exactly what I wanted, but also because I was curious of how it could be done, I started coding one based on YUI.

Remember to reset the YUI listeners on updated content

I had event listeners set on elements added dynamically to the page not working:
my original content Click here to replace content
When you click on the test_link, the content of the div is

Web 2.0 traffic watch list

MyOwnDB is progressing in Seth Godin's Web 2.0 Traffic Watch List to 595th position. Although this is not a remarkable result, and the list has to be regarded with usual caution, it's good to see MyOwnDB progress.

Mass mailing with active mailer

So, you have plenty of users, and you want to notify them of a significant update. You have all recipient emails in you database, and the corresponding ActiveRecord models. Rails also provides the nice ActiveMailer tool. Writing a script using all your existing infrastructure seems the best solution, and it's also how I wanted to send an anoucement to MyOwnDB subscribers. There are, however, two points that you need to take into account:
  • you can't simply loop over all emails, and for each address open a connection to the SMTP server.
Syndicate content