We’re hiring
Posted on September 26, 2008
Filed Under Offers | 2 Comments
Here at Mirai we’re looking for passionate software engineers.
And if it’s not clear, by passionate I mean people who actually enjoy their job, aren’t afraid of trying new things, likes to research/study, is up to date to what’s happening around them and is a true team player.
Interested? Hold on, click here to find out more about the offer, as well as instructions on how to apply.
Doubts? Send them to jobs@hotelsearch.com
ps. If you’ve been following my blog, you probably have already got a feeling of the sort of stuff that we do here…
RailsConf Europe 2008: impressions and highlights
Posted on September 9, 2008
Filed Under Conferences, Rails, Ruby | 2 Comments
I’m back in Madrid again after the RailsConf and I think it’s time to say something about it.
First off, the infrastructure provided by the conference was really great. The rooms, WiFi connection, food… Really well organized.
Now to the sessions, highlights:
Tutorials (Tuesday)
- Meta-programming Ruby for fun and profit (Neal Ford, Patrick Farley)
The old and good techniques that made Ruby so powerful. Here Neal and Patrick walked us through the main tricks to meta programming like open classes - and conditionally open them - , dynamically define methods, sending messages to objects and how Ruby can help test your Java code in a much easier way.
I’ve put the link to the slides but honestly I don’t think they’re too much useful without the talking.
Sessions (Wednessday)
- EC2, MapReduce and Distributed processing (Jonathan Dahl)
Jonathan explained the theory behind MapReduce using very simple ruby examples, providing the basics on how to distribute and paralelize tasks accross multiple machines.
He also introduced Hadoop, a platform built in Java that “lets one easily write and run applications that process vast amounts of data”. What I liked the most was the simplicity he explained this subject. As of today, his presentation is not available online. Stay tuned as I’m gonna update this post with the links, as soon as they’re available.
Sessions (Thursday)
- Debugging & Testing the Web Tier (Neal Ford)
If you’ve been concerned about testing your app’s web tier lately, this presentation would probably not show you anything new. Neal talks about the need to debug and test javascript behaviour accross multiple browsers, using tools like Firebug, JSUnit and Selenium. If you have no idea about what these tools are, please stop now and go evaluate them!
We are pretty concerned about testing on my actual job, but selenium tests can be a pain sometimes - a.k.a extremely slow. And what ends up happening is that they are forgotten. Developers only run the test suite if it’s not painful and it’s lightning fast. Here’s is where the highlight for this session comes: CrossCheck.
The idea is to be able to test your javascript code accross multiple browsers without the need to launch them. In fact, you don’t even need a browser installed. The negative point is that it’s kinda fallen behind because now you can only test older versions of browsers. But since the project is getting a lot of traction, I’m pretty sure this will be solved soon.
Conclusion
My overall impression of the other sessions I attended is that some speakers just didn’t have time to properly prepare themselves, what made me think this years’s RailsConf wasn’t all that I expected.
But I also met interesting people and after all one of the key points in a conference is networking.
Definitely worth it though. And that’s why I took the time to provide this highlights.
c u soon
RailsConf Europe 2008: heading to berlin!
Posted on August 30, 2008
Filed Under Conferences, Rails, Ruby | Leave a Comment
The title says it already.
On monday I’ll be going to Berlin to attend this year´s RailsConf.
This will be my first one and of course my expectations are pretty high!
As usual, after the conference I’ll try and give a summary of what happened there, providing as much content as I can.
Anyone else’s going???
C u there!
Mac OS X: Getting MySQL and Rails to work
Posted on August 28, 2008
Filed Under Mac, Rails, Ruby | 2 Comments
So I couldn’t resist and bought myself a MacBook Pro! It’s my first week with my new toy and I’m really enjoying it.
But I need to do something useful with it so I started to prepare it to be my new development platform, starting with Ruby/Rails + MySQL: Here is where the fun begins!
After I installed both Rails and MySQL, I fired up a terminal an typed:
sudo gem install mysql
…and here is what u get
ERROR: Failed to build gem native extension.
If you google this error you will find a couple solutions and this is the one that worked for me:
ARCHFLAGS="-Os -arch x86_64 -fno-common" sudo gem install mysql -- --with-mysql-dir=/usr/local/mysql --with-mysql-config=/usr/local/mysql/bin/mysql_config
Now, confident enough, I created a sample rails app and tried to create the development database:
leo$ rake db:create (in /Users/leo/projects/test) dyld: lazy symbol binding failed: Symbol not found: _mysql_init
Doesn’t look happy yet huh? This took me a while to figure out but it turned out to be fairly simple.
I have no idea why but after I installed the gem I had the file mysql.bundle in two different places:
/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle /Library/Ruby/Gems/1.8/gems/mysql-2.7/mysql.bundle
The solution was to remove the first copy of the file. Now everything is working fine at this end!
I really hope this is useful to someone!
Rails: Vulnerability on REXML
Posted on August 24, 2008
Filed Under Rails, Ruby, Security | Leave a Comment
REXML, the XML library uses by many ruby apps, including rails, has a vulnerability that requires an immediate patch on whatever rails version you’re using.
Details and instructions on the official rails weblog, here.
But basically, this is what you need to do:
gem install rexml-expansion-fixThen, require rexml-expansion-fix in your rails’s app environment.rb file.
Yes we do eat.
Posted on August 15, 2008
Filed Under World | Leave a Comment
Besides the fact that I am a software developer, I do eat. I even enjoy doing so. Specially when I’m traveling.
That’s why i decided to put up a new weblog only for this kind of stuff - it’s called Travel tips - food & stuff. Basically for friends and whoever else might be interested.
There I plan to share some nice restaurants I’ve been to. At least to start with.
Hope u like it!
Why I like Ruby #1: alias_method
Posted on August 7, 2008
Filed Under Ruby, Why I Like Ruby | 1 Comment
So you found yourself in the need to override a method but still count on it’s old behaviour?
No problem! Override it with your new code, call super and…. Uh oh!! Suddenly this turned into a problem… Let me give some more context.
I was testing Ferret (and the acts_as_ferret plugin) in a project to provide full text search capabilities to our models. One of the things the plugin does is to add a new method to ActiveRecord, called find_with_ferret. That way, every model can use it. Great!
So I thought that would make sense for me to remove all diatrictics from the input text before letting ferret do its job. You know, like removing umlauts and all that.
I could do that by overriding this method with code to remove the undesired chars and then call its older version to finally do the search - something like calling super, but not quite. And I didn’t want my models to inherit from anything else than ActiveRecord::Base. That wouldn’t make any sense.
alias_method to the rescue!
You know that to redefine a method in an existing class you can open it up and rewrite it. But since you don’t wanna loose the behaviour provided by the original method, this is how you can achieve this:
1 2 3 4 5 6 7 8 9 10 | module ActiveRecord class Base alias_method :find_with_ferret_original, :find_with_ferret def find_with_ferret(q, options = {}, find_options = {}) remove_diatrictics!(q) find_with_ferret_original(q, options, find_options) end end end |
And you’re good to go. On line 3 you’re just giving the original method an alias, making a copy of it.
Then you redefine it the way you like and on line 6 you call the old version to make sure u still got the same behaviour.
Now all my models can benefit of this change without requiring them to call another method nor inherit from another class.
Cool, huh? ![]()
The biggest Rails event in latin america
Posted on August 4, 2008
Filed Under Conferences, Rails, Ruby | 2 Comments
Behold latin american railers!
This year we will have the Rails Summit Latin America on October, 15th and 16th, in São Paulo, Brazil.
It’s by far the biggest Rails event we’ve ever had, including many of the speakers that were present at RailsConf.
Fábio Akita is also one of the speakers and provides more details on his blog.
If you’re a assumed rails geek don’t miss the opportunity to hear from the big names and to know a beautiful country like Brazil.
Oh, btw, if you’re brazilian, like me, you have no excuse to miss this party!
Enjoy!!!
New provider
Posted on July 26, 2008
Filed Under Notices | Leave a Comment
I decided to change my blog’s hosting provider and this is the first post using the new service.
Please if you see any abnormal behaviour around here don’t hesitate to contact me either at leonardoborges@leonardoborges.com or leonardoborges.rj@gmail.com
Thanks!
Mock Objects
Posted on July 7, 2008
Filed Under Java, Testing | Leave a Comment
When testing it’s pretty common to see the need for mocking a certain object, say, a Data Access Ojbect. This way you don’t need to depend on a database and you can focus on the actual logic implemented by the method being tested.
For that you have several alternatives like creating the Mock class by hand or - and this is the more common - use one of the various mocking libraries out there.
They all look the same but the past couple of days I’ve come accross to a new - at least for me - mocking library for Java. It’s called Mockito. As the creators state, technically, Mockito is a fork of EasyMock.
I have used EasyMock already but I do think Mockito has its advantages. I find it clear and a bit less verbose to write.
From one of the stubbing examples on their website:
//You can mock concrete classes, not only interfaces LinkedList mockedList = mock(LinkedList.class); //stubbing - before execution stub(mockedList.get(0)).toReturn("first"); //following prints "first" System.out.println(mockedList.get(0)); //following prints "null" because get(999) was not stubbed System.out.println(mockedList.get(999));
Looking forward to using it in production! ![]()


