Skip to content

Reviewing in paper

As part of writing Beginning Rails 3, I am reviewing Beginning Rails to identify areas that we need to improve, as well as the pieces that will need major rewriting due to changes in Rails, or just need changes due to a slightly different direction we want to take with the book. The main tool I’m using for the review is a red pen.

Reviewing Beginning Rails

Being a software guy and trying to do every possible task in front of the computer, I did start some of the reviewing/rewriting work going over the chapters in Word format - yes, Apress uses a Word template :( - but I felt that I was being very unproductive, not as connected to the reader as I should be. I moved to reading the actual book and highlighting the changes I want to go over, which makes the experience so much closer to the end user, it’s so much easier to move between pages within each chapter I am working on. There is something about having the physical book in hands that makes reading more enjoyable and helps me work and see the end result so much clearer; so, I’ll very likely have a heavily marked copy of the Beginning Rails in a few weeks. I was never a big fan of reading on a computer screen for a long period of time, and never really wanted to have most of the books I own in digital format, books feel a lot better in a non-digital format.

Tagged

Beginning Rails 3

I just signed the contract for writing “Beginning Rails 3″ for Apress, which will be an update to Beginning Rails. I’m extremely excited to have the chance to work on a sequence for the book. The experience of writing Beginning Rails was rewarding and very challenging. I know there are some areas of the book that have to be improved, and that’s one of the reasons doing “Beginning Rails 3″ is so interesting, it gives me the chance to improve on my own work after having learnt a few lessons about print media. I and Jeffrey Hardy will get some help from Rida Al Barazi to help us make constant progress with the writing despite our busy schedules. We’ll be able to do a better job in lots of aspects, fix all remaining issues, use a different type of sample project, talk more about options beyond the default Rails stack.

Beginning Rails

I’ll try to blog about the experience of writing the book in some details. We’re going to put some extra work on the social aspect, in order to communicate better with our readers. We’ve created a Twitter account, will begin updating beginningrails.com soon, and are going to put all the code on github. Stay tuned.

Tagged , ,

acts_as_featurable

In restate.ae, we have the need to feature a model - property, neighborhood, or video - for a period of time. So, I wrote a plugin called acts_as_featurable to allow developers to attach that type of functionality to any model.

The plugin still needs some work in the testing front, and I have some enhancements in mind that I will likely be working on in the next few days.

Tagged , ,

Translate attributes using Rails I18N

I’ve been following the Rails development team since they started working on a built-in 118N solution. We’ve just delivered an application that has to support both english and arabic; so, the project was a perfect fit for the new I18N functionality because I needed support for view and model translations.

I’ve decided to write a simple plugin to simplify the code contained in my views, it’s called translated_attributes, and you can grab it now.

In the example above, I created a model call Post, that contains the same content in two languages; for example the title attribute is title_en for english, and title_ar for arabic. In the application, the locale is defined by the path and is always set on a before_filter; this allows me to use call the title attribute, that will return the appropriate attribute making my view code simpler.

Of course, this solution fits well my scenario that specifies that some content is always to be translated in two languages; so, your requirements if this plugin suits you or not. If you need to translate text in more than 2 languages, I wouldn’t recommend the one-field-per-language approach.

Tagged ,

Moving from SVN to git

I’ve started to do some desktop file clean up, and have just noticed a couple of text files I keep around that I wrote when starting to move from Subversion to git. I decided to put those instructions in the blog for myself and the world, and delete those files.

The process of moving an existing Subversion application to git is very simple. Go to your server, install git, move to a folder where you want to keep your source code, and create a bare repository. In your local machine, you can then create a new git repository from your existing Subversion repository, add the path to your newly create repository in your server as a remote branch, push your code and you’re done.

Tagged ,

Installing the rjb gem

I’ve decided to give JRuby a try under Mac OS X 10.5.5, and the ride has had its share of challenges so far. First thing, after I downloaded and extracted JRuby to a folder in my machine, I had to setup the JRUBY environment variable, and make a change to the PATH variable, that looked like this:

export JRUBY_HOME=/Users/junior/code/jruby/jruby-1.1.5
export PATH=$JRUBY_HOME/bin:$PATH

Pretty simple so far, but I was getting errors trying to install the Ruby Java Bridge gem. To my surprise the reason was that I was running the gem executable from JRuby, not my regular gem executable, as I expected. The fix was simple, I just had to change the path variable to look like:

export PATH=$PATH:$JRUBY_HOME/bin

Then, I spent almost one hour trying to find out why the rjb gem wouldn’t install in my machine. I found lots of blog post from people who had issues installing this gem, and presented a few solutions, but none helped me. I kept getting an error saying that the JAVA_HOME variable was not set, which made no sense because this was working fine:

junior@snake:~$ export JAVA_HOME=/Library/Java/Home
junior@snake:~$ $JAVA_HOME/bin/java -version
java version "1.5.0_16"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_16-b06-284)
Java HotSpot(TM) Client VM (build 1.5.0_16-133, mixed mode, sharing)

I got the answers to my problem online from a blog post by Alex Chaffee. Like Alex mentioned, just run “sudo visudo” and add

Defaults        env_keep += "JAVA_HOME"

Pretty frustrating, but now I can jump back into my original task, which is to generate PDF reports from a Rails application using the iText Java library.

Tagged , ,

Eye of Judgment on the iPhone

Eye of Judgment is a strategy card game for the Playstation 3. If you’ve never heard of it, just click here to see it in action and learn about the game. I’ve been playing the game since it came out, and really enjoy all the aspects and different possibilities; however, I always wanted to have quick access to information about all 300+ cards available when facing a new card, in order to be able to defend myself. With that “need”, I and Rida came up with the idea of creating a mobile micro application that would give us all the information we need in a few seconds.

The main point of the “Play EoJ” application is to get a 100% accurate description of all the cards, we are still missing some data from the newly released Set 3 cards, but the accuracy/completeness is close to 90%, which should go up after feedback from users, and some extra research from our end. After the data we have is totally reliable, we’ll release an API to give other developers access to the information in a simple and structured way.

It doesn’t matter if you don’t have an iPhone, you’ll get to see how the application is supposed to behave in the quick demo screen cast I recorded. Just go to http://playeoj.mobi and give the application a spin. The application is coded with Rails and has a SQLite database, the code is released under the MIT open source license. You can check out the source at GitHub and make any desired changes.

To keep up with the learning spirit, the next steps will be to either port the application as a native iPhone app, write an Android or Symbian equivalent. It’s really interesting to feel the power of quick access to important data from mobile devices, so I’ll be playing a lot more with them in the near future.

Tagged ,

Twittering

I’ve been using Twitter for almost 1 year now, and I really enjoy the social side of the service more and more. As you can guess, my account name is ccjr, and you can follow me at http://twitter.com/ccjr.

One of my initial goals was to have a log of things I do, I think it’s fun to look back and read some of my updates; however, the social side is way bigger than a public log. I think I need to follow some more people in the Internet industry and/or located in Dubai, so that I can get some extra information into some - sometimes not so - interesting thoughts other people may have; but, I also don’t want to follow too many people in the fear that I won’t be able to even read their updates. Despite no longer having SMS updates going out to International numbers, I’ll keep using Twitter, specially that now all the guys in the office are on board, we use it for informal communication/fun. So, if you are still not on Twitter, here are my last 4 updates, thanks to one of their widgets.


Tagged

Raptors

Back in Toronto, I had the chance to see many Raptors games, I was never a huge basketball fan, but the show the NBA puts in every game is really a lot of fun; so, I ended becoming a Raptors fan, I even attended a playoff game against the Pistons five years ago.

raptors

Lately, I started to look for something “fun” to put in the office. We came up with a trip to Toys “R” Us, which lead us to a trip to a sports shop in Mall Of Emirates. For my surprise, I found a mini hoops kit with the Raptors logo on it. Of course, I got it on the spot, and we have been practicing for the last week. It’s a fun way to take a quick break from the computer.

Zero to Beta

We are in the last day of the Zero to Beta experiment in the SpinBits office, with the help of the CloudAppers team. “Zero2Beta is an experiment on intense design and development of a useful web application from concept to launch in a couple of days, and release it to the public.”.

This means we decided to take a few days to try new things, play with different technology, and apply some constraints to our own work. The Zero2Beta web site already has some great content, so just head there, and enjoy the ride with us.