Lovely house.

You might like A House By The Park. It’s a extremely detailed journal of a guy who built a lovely $1M house from scratch. Quite interesting to read.

If I ever build a house this will be very valuable information.


I’ve been living in Belo Horizonte, Brazil for the last 3 months.

I got to get this out there: this is the most frustrating city I’ve ever lived in. I feel like even the simplest of things here can become a real pain in the ass. Just to give you an idea, here’s a list of stuff that’s plainly simple yet absurdly frustrating here:

  • Taking a bus is the most random thing ever. Even in Colombia, a fairly disorganized country, you can expect a constant flow of buses on every line. In Belo Horizonte, if you want to take bus, you might as well get comfortable on the bus stop as you might wait over 40 minutes for a bus that’s supposed to pass by every 10. Then you’ll see 4 of the same kind in a row. Seriously, it’s so unpredictable that if we plotted the waiting time we’d end up with a probability distribution that would make the most clever statistician in the world feel like being run over by one of the buses (of course, he wouldn’t know how long that’d take).
  • You can’t get a local SIM card for a cellphone if you don’t have a CPF number. A CPF number is a tax-related number that’s used to track your credit history and stuff like that. Nobody who lives outside Brazil is supposed to have this number. Did someone in one of the cellphone carriers ever thought that there are foreigners out there, that they might come to Brazil one day, that they may want to buy a local cellphone number and they won’t be fucking able to do it because they don’t have this number?
  • Of course, when you do manage to get a CPF number you can only buy a prepaid SIM card. I wanted to sign up for a monthly plan to save money in the long run, but they told me I’d need a proof of residency: a document showing my address and my name. “Bank statements are best”, they said.
  • Off I went to open a bank account, but surprise, surprise: you need a proof of residency to open a bank account, too. Apparently putting your money in their vaults is not enough: they seem to think you’ll deposit your hard-earned money and then suddenly disappear without leaving a trace and leaving your money back. But here’s the best advice they gave me: when I explained I had just moved to Brazil and didn’t have any kind of proof of residence yet, they said the following wise, unforgettable words: “Bring your cellphone bill. We accept that as a proof of residency.”
  • I found a place to live, with 2 roommates. I didn’t get to sign any rent contract or anything since they had already sorted that out, so no proof of residency yet. I called to install an internet connection under my name which was the only service that hadn’t already been installed in the apartment. One month later the first bill arrived. “Finally, a proof of residency.”, I thought. I opened the envelope only to discover they had written my name as Andrés Meijía Cosada. Yeah, that’s 2 typos in 3 words. Now the cellphone company won’t accept it because they say it doesn’t match my passport name exactly.

Anyway, the point of this post is not just complaining. I used to get infuriated by all this adversity but this had made me think of something: we are never in control of what happens around us, but we can certainly control how we react and adapt to it. Great things can come out of terrible circumstances. I need to let all this slip off and focus my energy on stuff that’s worth it.

This very words are my first step to adapt: the 5 megabit internet connection I installed is down for the 4th time today and I’m forced to write this post offline to upload it tomorrow, or next week, or whenever the internet connection feels like working again.

Today I was added by to Gmail’s chat. I immediately suspected of a chatbot so I accepted her. Here’s how the conversation started:

blinky.stars8: Hi cutey
me: do i know you?
blinky.stars8: hi .. have we chatted before? 23/female here…you?
me: 174 male with testicle cancer
blinky.stars8: i’m sorry ..i get to be forgetful at times!! how’re you??
me: giraffe
blinky.stars8: Just got out of the shower…long day been kind of busy! but i’m feeling naughty! so what’s up ….. want to have some fun? ;)
me: monkey
blinky.stars8: I need a man that can make me squirt……have u ever made a girl squirt? lolz
me: elephant
blinky.stars8: gonna change my clothes … want to see ? ;)
me: panter
blinky.stars8: wanna play on cam?
me: Yes, but be quick about it. I’m running out of animals.

From this point on, I just started asking questions to see what this was bot capable of. Here’s the golden answer:

me: Have you ever licked a dolphin’s vagina?
blinky.stars8: lick n slurp!

There you have it. The proof that spammers are pervert.

Yesterday I got my first pull request accepted into Rails master. This is a great sensation! It feels nice to contribute back to the community that has given me so much.

This particular pull request adds a new first_or_create method to Active Record that let’s you write code like this:

This is much clearer than the old find_or_create_by_first_name method that used to look like this:

I think I’m going to keep writing push requests for Rails from time to time.

Hope you like it!

Today is my last day working for Storific.

I want to thank all the people in the company for this wonderful experience. This was a great opportunity to grow as a programmer, have fun, sleep little on stressful nights and learn French.

Last Thursday it was announced that we were the winners of the Rally on Rails ’11! We won with TimeHub, an utility that lets you generate invoices from your GitHub repositories.

You can check the scoreboard out at (this is a little Sinatra app we coded after the competition, which is open-source, by the way).

I want to thank the organizers, sponsors and judges for this awesome contest! There were a few problems, sure, but overall it was an awesome contest. There were way more good things than bad things.


These are the predictions about the winners I had made last week:

1. by Funky Town (Definitely the most useful app in the competition. Of course, I’m biased.)
2. by Yotoco. (Very fun to use, specially when you sign in with Pemberthy’s account and start saying your male friends are sexy without Pemberthy actually knowing.)
3. GemTalk by 25cm+ (Very pretty design.)

I was only right in the most important one: us! ended up being 6th. I think they just needed to spam for more votes, because their idea and execution was way better than that of the apps that ended 2nd and 3rd. GemTalk ended up being 17th. It looks like they didn’t even tell their parents to vote for them.

I had also predicted Dumuzzi would be last. I nearly nailed this one; they ended second-to-last.

Things that need to be improved for next year

Although the contest ran relatively smoothly, there are a few suggestions I have for next year.

Decide a ranking scheme before the contest starts, and stick with it

The way teams were ranked was decided the same day the voting phase ended. Furthermore, it was changed several times in the lapse of just a few hours.

This shouldn’t have been so. Next year, decide how you’ll rank teams before the contest starts and don’t modify that during the contest.

There was a lot of discussion about whether teams should be ranked by their average score or not. Some people said this was unfair, supposedly because you can vote 1 star on the teams you don’t like and make their average go down. In my opinion, this is completely fair and acceptable. What’s the difference between voting 5 stars for a team you like to make its average go up and voting 1 star for a team you don’t like to make its average go down? There’s absolutely no difference; both approaches are equally biased.

To avoid this kind of pointless discussions, I suggest to ditch the average thing altogether. Make it so that only judges can vote with a number of stars and make the general public vote either 1 point or no points at all. Like presidential elections.

Also, I like they way you gave more weight to judges’ votes when calculating the final score. This is definitely important to avoid lame apps being on top just because they have an army of spam bots asking for votes.

No cheating

Gotta admit it, this episode was embarrassing. Make sure the app is cheat-proof. Ask for help if you need it, I’m sure that a lot of people (including myself) would have volunteered to help find this kind of vulnerabilities.

Add your own scoreboard

We had to scrape the Rally on Rails site because it didn’t have a scoreboard. Not nice! Implement an official scoreboard. An scoreboard is indispensable; it’s very fun to follow how everyone’s going.

Implement a public API

A public API would make a lot of tasks easier. For example:

  • Create custom scoreboard without having to scrape the website
  • Create graphs of votes and analyze them so we can answer questions like “at what time of the day are our spamming sessions on Twitter really working?”
  • Detect cheating easier.

Fix the user experience when voting

Voting for a team was absurdly difficult. Really difficult! Here’s what you had to do:

1. Go to the team page.
2. Click one of the authentication buttons on the top right corner.
3. After authorizing the app, you came back to the home page (this was later fixed and you ended back at the team page).
4. Scroll down until you see the stars.
5. Click the stars.
6. Wonder if your vote was counted or not.

Here are some of the questions I had to answer when I was asking my friends to vote for me:

“I already clicked on the stars, but nothing happened. Was my vote counted?”
“Why can’t I click on the first 4 rows of stars?”
“I clicked the Facebook button and it looks like I’m the home page. What’s your team’s name again?”
“After I clicked the stars I didn’t get a message or anything. Did I do something wrong?”

Here’s how the user experience should have been:

1. Your friend gives you a link to vote for his app. You click it.
2. You see a huge button that says “Vote for this team”. It’s obvious what you have to do.
3. You click the button. A little dialog asking you to identify yourself neatly slides down. Once again, it’s obvious what needs to be done next.

4. You click one of the authentication buttons that just appeared. You are redirected to the third-party, where you authorize to continue:

5. You come back to the app, and you see a green message saying that your vote has been counted. That’s it!

What do you think about that?

Thanks again

Thanks again for running this awesome contest! I know at the end it was harder than what it initially appeared to be. I’m looking forward to participate next year. I’ll be glad to help with anything you need about organizing it. Just ask!

Last weekend I participated on the Rally on Rails contest with Hock and Pemberthy. It was an interesting experience, so here’s how it went.

The idea

The day before, we had no idea what we were going to code. We had had two brainstorming sessions; one one month before the contest and the other one one week before. We had thought of several things: a voice chat app to allow calls inside the browser, an app to share payments between roommates, an app to suggest cocktails and shots to your friends, an app to help you classify GitHub issues and several other ideas that we discarded for one reason or the other.

We were talking on Skype when I remembered I had to send an invoice to a client. “Shit, now I have to go through all those GitHub commits to see how much time I spent on that”, I thought. Then I had the idea! Why not create an app that could generate invoices based on my GitHub commits?

We discussed a bit about it on Skype and then we all agreed on it (except The Wise who flaked alleging he had a lot to do during the weekend. Later he admitted he was going to spend it playing StarCraft and eating pizza). Pemberthy bought the domain and we parted, getting ready to meet at 7AM the next day.

The contest

Friday night

Pembe called me Friday around 7 or 8PM to tell me the contest had started and he had pushed the skeleton of the Rails app to the GitHub repo we had been assigned. I didn’t get it; the contest was supposed to start the next day! But because of the time difference, the contest started earlier than I thought. I finished the beer I was drinking with some friends and went home. I coded the authentication part of the app using OmniAuth. Since the idea of our app is based entirely on integrating it with GitHub, I took a look at the GitHub API to see how we would tackle that part the next day. I went to bed at around 11PM to be fresh for the next morning.


We met at my place. Hock and Pemberthy brought buñuelos and empanadas for breakfast. We were all eagerly excited and ate as fast as we could to get down to business. We assigned tasks for everyone and started coding. Pemberthy started creating models and basic views for them, Hock started setting up the server and configuring the domain name and I started tackling the part of our app that would connect to the GitHub API. I found a few gems for that, but I didn’t really like anyone of them so I coded it myself using the awesome HTTParty gem. Then I don’t truly remember who did what; we just shouted what needed to be done next and someone took care of it.

The methodology we used was probably the most exciting to work with: we barely planned anything of what we were going to do and we decided to write no tests. Not a single one! Those who write tests know how it feels to have untested code, it’s almost like being pointed at with a gun. But we thought we didn’t have enough time to write them, so fuck it.

We took a break and went outside for lunch. It was a sunny and refreshing day. While we ate some burgers we had our only “meeting”, where we decided a lot of the stuff we were going to do next. Our goal was to have all functionality working for that night and then use Sunday to fix bugs and improve the user experience. Then we worked straight until 11PM when we were totally exhausted. I felt like I had no brain anymore. I could barely sync my movements; drinking water was amazingly hard. Pemberthy and Hock left and we agreed to meet the next morning at 9AM. I went to sleep straight and dreamed about winning the Rally.


I woke up a little bit earlier than agreed, had breakfast and started to work. A good night’s sleep is the best tool a programmer can have. The senseless hard-to-find bugs of the night before were now ridiculously easy to fix. We had practically finished all functionality, with a few exceptions, so when Pembe and Hock arrived we were all confident we would finish on time. Hock did a great work polishing the CSS of the app while Pembe and I tackled most of the bugs.

I wrote the one and only test for the app when I was writing the part that parsed commit messages, and only because it involved seriously hard-core regular expressions. Just so you get an idea:

Writing tests was the only reasonable way of making this part of the code work, so I felt obliged to do so.

For lunch, we ordered a pizza and drunk a few beers. Is there anything that feels better than drinking an ice-cold beer with one hand while writing Ruby code with the other?

About one hour before the contest ended, we found a couple new bugs. This was the only part of the contest where I was stressed. We were deploying fixes and then seeing we had broken something else (if only we had written tests!). After a stressful round of deploys, the app finally looked stable enough and we decided it was time to stop. We looked at the clock: 10 minutes until the contest ended.

The result

Overall, I’m very proud of TimeHub. I’m sure it’ll be an insanely useful tool for me. Here’s a quick tour of how it works:

Add time notes to your GitHub commits

Import your commits to TimeHub and select the ones you want to generate an invoice from

The time for each commit will be automatically parsed from the tags you wrote on its message, or from the time elapsed since the last commit (unless the last commit was made more than 2 hours ago).

Create your invoice

There you go! Download the PDF. That took 3 seconds!

Of course, be sure to check TimeHub out and let me know what you think about it in the comments section below!


You can check out all other submissions for the Rally on Rails on the Teams page.

My predictions for the first 3 places are:

1. by Funky Town (Definitely the most useful app in the competition. Of course, I’m biased.)
2. by Yotoco. (Very fun to use, specially when you sign in with Pemberthy’s account and start saying your male friends are sexy without Pemberthy actually knowing.)
3. GemTalk by 25cm+ (Very pretty design.)

My prediction for the last place is undoubtedly Dumuzzi by Cidadelas Jedis. The monster they have as a logo is enough to make any child shit on his pants.

As seen on The Ministry of Type.

I just added Disqus to this blog for comments. I decided to do so because I like to have threaded comments. And if it’s already implemented, why implement it again from scratch?

Integrating it was pretty much painless thanks to their clean documentation. Basically, you just need to add some JavaScript to every page where you want to show a comment thread. Additionally, I did some CSS styling to better match it with this site’s style. Check out this commit to see the exact changes I did.

Storific, the French startup I’m doing my internship at, just raised a round of venture capital.

This is going to be, oh, so fun.

Read the details on TechCrunch. Also, I’m mentioned in the article.

Taken from an email I sent in reply to an offer for a job in PHP:

I’m afraid creating the screening room module would involve some custom coding in PHP. In that case, I’ll politely reject the offer. In few words, I don’t like PHP. In more words, every time I see PHP code I want to maniacally run into the kitchen to grab a fork and repeatedly stab myself in the eyes. Then, after my eyeballs are out, I want to add some hydrochloric acid into the mix so I’m sure my eyes will never hurt as much again. Nothing personal.

I will happily find the time to help you on Ruby-related stuff though, for when I read Ruby code I can feel the tender caress of flowers that start falling from the clear blue skies, and hear the imaginary wind of happiness that gently tickles my neck and makes me laugh in ecstasy.

wack-a-mole@mischa ~ 
$ lsof -i :3000
ruby    2778 wack-a-mole    6u  IPv4 0x06181aec      0t0  TCP *   (LISTEN)

I updated my version of TextMate a few days ago (to version 1.5.10) and on this new version they changed the Ctrl+F binding; it didn’t move forward one character as I wanted, à la Emacs.

This was driving me fucking crazy.

To fix it, I changed the key binding from a command on the Rails bundle that was taking precedence of the default ^F behavior.

Do this:

  • Bundles > Bundle Editor > Show Bundle Editor
  • Find a command called “Jump to Method Definition” and change its key binding. On my case, I changed it to Ctrl+Shift+F:

Voilà, that did the trick for me.


Imagine you go to a party with me. Let’s say there are 50 people in there.

I say: “I bet everything you have there’s two people in this party whose birthdays are the same.”
You think: “50 people… out of 365 days in a year? It’s definitely hard to have two guys with the same birthday. Let’s bet!”

You, my friend, should start looking for a bridge to live under, because your house, your car and your wife are now mine.

Photo by The Random Snapper.

The math

OK, I know this sounds counterintuitive, but it’s all backed up by real math. So let’s jump in to that.

Note: We will assume all years have 365 days, just to simplify things a bit.

First, let’s define the problem. We are interested in finding out my chances of winning the bet. In other words, calculating the probability of two of the people in the party having the same birthday. To do that, we will first calculate exactly the opposite: the probability of everybody in the party having a different birthday.

So we can reformulate the problem as follows: “Let n be the number of people in a party. Calculate the probability of each of the n people having a different birthday.”

And how do we calculate this? Piece of pi:
Take the first person in the party, and write down his birthday. Then take the second. Since we can’t allow two people with the same birthday, this person’s birthday must be one of the 364 days that are not the first person’s birthday. The probability of this happening is 364/365 (there are 364 ‘good’ days out of 365 possible options).

So the probability of everybody having a different birthday on a party with two people is:

\[ \frac{364}{365} = 0.997260273972603 \]

That means that your chances of winning in a party of two people are above 99%. Not good for me.

Now take the third person. His birthday must not be one of the two previous people’s birthdays. So he’s only got 363 out of the 365 days.

So the probability of everybody having a different birthday on a party with three people is:

\[ \frac{364}{365} \times \frac{363}{365} = 0.991795834115219 \]

Now take the fourth person. His birthday must not be one of the three previous people’s birthdays. So he’s only got 362 out of the 365 days.

So the probability of everybody having a different birthday on a party with four people is:

\[ \frac{364}{365} \times \frac{363}{365} \times \frac{362}{365} = 0.98364408753345 \]

And so on. In general, the probability of everybody having a different birthday on a party with n people is:

\[ \frac{364}{365} \times \frac{363}{365} \times \frac{362}{365} \times \dots \times \frac{(365 - n + 2)}{365} \times \frac{(365 - n + 1)}{365} \]

or more succinctly:

\[ \prod_{i=1}^{n-1} \frac{365 - i}{365} \]

Now, let’s find out how’s the deal when there are 50 people. Let’s use this little Ruby program to evaluate the formula for us:

def formula(n)
  p = 1.0
  1.upto(n - 1){ |i| p *= (365.0 - i) / 365 }
  "Party of #{n} people:
     The probability of you winning the bet is #{p}.
     The probability of me winning the bet is #{1.0 - p}."

Let’s try it out:

>> formula(1)
"Party of 1 people:
     The probability of you winning the bet is 1.0.
     The probability of me winning the bet is 0.0."

This makes sense. How can two people have the same birthday if there’s only one person in the party?

>> formula(2)
"Party of 2 people:
     The probability of you winning the bet is 0.9972602739726028.
     The probability of me winning the bet is 0.002739726027397249."

Right, what we had said above. Not too convenient for me.

With three people:

>> formula(3)
"Party of 3 people:
     The probability of you winning the bet is 0.9917958341152187.
     The probability of me winning the bet is 0.008204165884781345."

Not too good, either.

Now let’s jump and see what happens in a 50 people party:

>> formula(50)
"Party of 50 people:
     The probability of you winning the bet is 0.029626420422011596.
     The probability of me winning the bet is 0.9703735795779884."

Whoa! Did you see that? Now my chances increased to above 97%.

Now, go find some unwary rich people and bet! You’ll win in about 97 out of 100 parties.

When getting this message after running git pull:

$ git pull
You asked me to pull without telling me which branch you
want to merge with, and 'branch.master.merge' in
your configuration file does not tell me, either. Please
specify which branch you want to use on the command line and
try again (e.g. 'git pull <repository> <refspec>').
See git-pull(1) for details.

If you often merge with the same branch, you may want to
use something like the following in your configuration file:

    [branch "master"]
    remote = <nickname>
    merge = <remote-ref>

    [remote "<nickname>"]
    url = <url>
    fetch = <refspec>

See git-config(1) for details.

run these two commands to always merge from remote’s master branch:

$ git config --add branch.master.remote origin
$ git config --add branch.master.merge refs/heads/master

Seriously, why do people watch TV? It’s something that’s utterly unexplainable to me. I mean, think of it as something that makes you stay seated in the same position during hours making you incapable of producing your own thoughts while vaguely exposed to someone else’s story and being constantly interrupted by unreal commercials showing fake happy people that just try to trick you into buying stuff you don’t need to supposedly sleep better or have a cleaner house or whiter teeth so you can be happier and work more hours in order to earn more money to buy some more stuff you don’t need. See the point?

So why people do it? Because it’s fucking easy. It’s even easier than just laying there looking at the ceiling. That way, at least you have to face your own thoughts. The problem is that when you watch TV you build nothing. Absolutely nothing. Not an opinion, nor an idea, nor a personality. Not even a memory. Can you remember what was interesting in that TV show you watched last week? Of course not.

I particularly hate people who turn on the TV because “the room is so silent”. Why don’t they just fucking sing?

Today I wanted to start adding some stats to ¿Cómo vamos?. Turns out it was very easy to do with the googlecharts gem.

Here’s the relevant code to generate a pie chart showing the percentage of solutions uploaded by each user on the site:

module StatsHelper
  def pie_chart_for_solutions
    count = {}
    Solution.all.each do |solution|
      count[solution.user] ||= 0
      count[solution.user] += 1

    total = Solution.count
    data = count.collect { |user, number| number }
    labels = count.collect do |user, number|
     "#{} (#{total == 0 ? 0 : (100.0 * number / total).round}%)"

    Gchart.pie(:data => data, :labels => labels, :size => '695x380',
               :theme => :thirty7signals)

We cycle through all solutions and keep a counter for how many belong to each user. Then we generate a label for each portion of the pie, appending its user’s percentage to the end. Then we pass this data to the gem, and that’s it.

Here’s an example of how the generated chart looks like:

Take a look at this commit to see all the changes in context. And here’s the live stats page.


It’s now official! I’m moving to France.

I just got my French visa yesterday and I’m now in the process of getting plane tickets, packing my stuff and buying some new clothes for the trip.

I’m going to Bordeaux, a small and warming city near the border of Spain, located in a French region that is famous for its wine.

I’ll be working on a small start up that’s building an interesting social web app on Ruby on Rails. I can’t give more details now, but keep tuned because we’ll be doing the Beta launch soon.

I remember a few years ago you had to install some messy plugins to use Gmail’s SMTP server (because it uses STARTTLS which is a way of securing plain text protocols like SMTP). Today, it comes by default with Rails so all you need is add this to an initializer (i.e. config/initializers/smtp_settings.rb):

ActionMailer::Base.smtp_settings = {
    :enable_starttls_auto => true,
    :address        => '',
    :port           => 587,
    :domain         => '',
    :authentication => :plain,
    :user_name      => '',
    :password       => 'assword'

Voilà, c’est tout!

Great use of typography.

I’m in the process of learning French (You will discover why, soon).

I noticed that while studying, there were many words I couldn’t easily find on a dictionary because they were conjugated verbs. To solve this problem, I built this little tool on Ruby on Rails during the weekend:

Check it out, and let me know what you think. If you’d like to take a look at the source code, here’s its Github repository.

So I wanted to send real emails from my Rails application, on the development environment. Awesomely, Mac OS X comes with a preinstalled Postfix which we can use as an outgoing SMTP server. It’s stupidly simple:

Start the SMTP server
It’s as easy as this:

sudo postfix start

To see if it’s running a’right, run the following command and you should see a similar output to mine:

$ nc localhost 25
220 ESMTP Postfix

If that happens, you are almost done. Run the following command to send a test message:

date | mail -s test

In my case, it went to my Gmail Spam folder so I just this-is-not-spam-ed it.

Configure your Rails application
Add this code to your config/environments/development.rb file:

config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
  :address => "localhost",
  :port => 25,
  :domain => "",

And that’s it. Now every email you send from a Notifier will truly get to your inbox.


I’m glad to announce my site’s new design!

I redesigned it all from scratch and wrote my own minimalist blog on Rails. It’s open source, if you’d like to take a look.

Here are the PSD files I created before writing the actual HTML and CSS. Props to my recently bought Wacom tablet :)

The new site is simpler, more childish and Deep Purple. Here’s a side-by-side comparison:

Hope you like it!

As seen on ffffound

The cleanest way to add something to the $PATH variable for all users on Snow Leopard is adding it to the /etc/paths file:

$ cat /etc/paths

The order in this file will be preserved as is in the $PATH.


As I mentioned in last post, I’m taking part in a programming contest in Brazil. It started a little more than a week ago and it has been excellent. Last week we were trained by Fabio Dias Moreira, an awesome guy who taught us a lot.

The problems and scoreboards from the different contests are being published here.

Here’s a photo of the door to the university:
The door of the university

The university is incredibly big. There are two bus routes inside of it and you could take some good 40 minutes in any of them. It’s also very green:
A sidewalk in the USP

São Paulo in general is a very sinful city, but just for the record:
Sinful chocolate

Yeah, I’ll spend one full month in São Paulo! I’ll be assisting to the Treino para Final Mundial do ICPC 2010.

That means I’m going to be trained by Petr! (If you don’t know who Petr is, please leave now; I don’t want to talk you).

I will be posting pics and details about the trip in the coming days.


Creating a new tar:

tar zcvf new.tar.gz the_folder_i_want_to_tar

Exploding the tar:

tar zxvf new.tar.gz

I arrived home and they told me an envelope with my name had arrived. I looked at it and this is what I found:


I live in Colombia, so I was rather skeptic with this card. But now it is a reality. It took barely 3 weeks to arrive, which was much faster than I expected.

Payoneer MasterCard

Want a card like this?

Sign up to oDesk and start working. Choose Payoneer credit card as your payment method and that’s it.

I earned $42.03 on my first week of work on oDesk (I worked 4.67 hours this week). I’m working on a Ruby on Rails application. oDesk is awesome! Working from home or wherever you are, at the time you want, for as long as you want, and in what you want, well, that’s very enjoyable.

Screenshot-My Account - Withdraw - oDesk - Mozilla Firefox

Give it a try.

The On Demand Global Workforce - oDesk


mysqldump -u user -p database_name > dump.sql
(Enter password)


mysql -u user -p new_database_name < dump.sql
(Enter password)

On the remote server:

mkdir repository.git
cd repository.git
git --bare init

On the developer’s machine:

mkdir cool_app
cd cool_app
git init
touch README
git add README
git commit -m 'first commit'
git remote add origin ssh://user@server:port/full/path/to/repository.git
git push origin master


Today was my last day working at Ceiba Software House. I decided to quit because I want to focus on studying. I feel like I’m wasting too much time on work and not doing the things that I really enjoy. Besides, I got quite bored working with big Java enterprise applications. That’s not enjoyable.

I will continue working part-time on Mentez, a small company that develops applications for social media. It’s very fun to work there and my workmates are awesome. Besides, we’ll code in Ruby!

The number of tests in the app I’m developing it’s getting really big. Sometimes, I just need to run a single test and not all of them. I only need to remember this line:

ruby -Itest test/unit/availability_time_test.rb

As I had said, last saturday was the XXIII Colombian Programming Contest. It took place simultaneously in 6 cities of Colombia with a total of 93 competing teams. This competition was the qualification round to participate in this year’s International Collegiate Programming Contest (ICPC). The Top 40 teams have advanced to the next contest that will take place next October 24th in Bogotá, to compete against Venezuela and Ecuador and decide who will advance to the World Finals in China.

We ended second, solving 4 of the 10 problems. Here’s how it went.


Here is the problemset. Here is all the code we wrote that day (exact zipfile of our folder from the competition. Also contains incorrect solutions to the problems we couldn’t solve). Here is the final scoreboard. Here is the input/output used by the judges.

The contest

Supposedly we had to be at 8 o’clock in the morning at the university but having competed in previous contests, I knew that I could arrive later, which I did. Thankfully, my teammates had arrived early and they already had my T-shirt and badge ready. We had a quick breakfast in the cafeteria and then proceeded to enter the contest room for the warm-up.


We won the warm-up! Something amazing happened. Before the competition started, we looked at the titles of the problems and one of them was “Birthday paradox”. Then Daniel said: “Did you know that if there are 23 randomly chosen people, the probability that at least two of them have the same birthday is greater than 0.5?”. Axy and I where like “Really? Why? Let’s see” and we found the formula and checked that it was true.
10 minutes later, when the warm-up started, I was amazed since the problem Birthday paradox asked exactly for the formula we had calculated before the competition started. That’s real luck!

Unfortunately, somebody deleted the warm-up scoreboard from our computer during the break after the warm-up, so I don’t have any evidence that we indeed won.

Main contestproblemset

We had lunch and then got ready to start the fight. We painted our faces like some sort of aggresive indians because we wanted to intimidate the competitors. Sadly, we finished looking like some cute kitties and being laughed at:

From left to right: Axy, me and Daniel

Anyway, back to bussiness. The counter started. 5 hours left and I was already feeling bad. I was very nervous but tried to stay calmed. I read the problems and decided to go for problem F.

Problem F – Burger time? Solved on minute 50. 2 wrong tries.

This was certainly the easiest problem. I read it and thought doing binary search would be fast enough, with an O(n log n) algorithm. Unfortunately, this solution timed out. I tried to optimize it a little and submitted it again. Time limit exceeded again! Fuck. I looked at the board and like 3 teams had already solved it. I thought there must be a linear solution and after thinking a little I finally came out with an elegant and short linear solution. I felt the relief of solving the first problem, as I knew we where now classified for the Regionals.

Problem C – Best coalitions Solved on minute 100. 2 wrong tries.

I read this problem and immeadiately the bells of dynamic programming rang in my head. I thought this was going to be straightforward but I coded it and received a Runtime Error verdict. Then a Wrong Answer. I honestly didn’t know what was wrong, so I changed some things here and there and submitted again and finally got a Yes. I think the problem was with reading the input.

After this, the Silence Hour begun. And we were placed ~9th place.

Problem I – Langton’s ant Solved on minute 269. Correct on the first try.

Now, it’s exactly because of problems like this why I sometimes hate Colombian National contests. It was an obvious easy simulation task. Except for one detail. The input was given as a huge integer that should be converted to binary. As Amy Winehouse would say, “What kind of fuckery is this?”. There’s no fun in this, it just makes the competition Java biased and boring for us, real language coders. Here’s something I want to shout: Using Java doesn not make you tough, funky or cool. It’s like having a sign that reads: “Look at me, I use Java! When I grow up I will be a garbage collector!”. And yes, anybody can use BigInteger.

I didn’t code this problem, Axy did. I just went straight to the bathroom to cry for sadness. Here in Colombia we have a cruel enough conflict. There’s drugs, violence and crime. Why the fuck do we want to make things worse by forcing innocent colombian students to code in Java?

Problem D – Informants Solved on minute 280. 2 wrong tries.

I had been struggling with this problem for most part of the competition. I was thinking of an over complicated solution using 2-SAT with didn’t quietly went well and gave me two erroneous and frustrating submissions. Near the end, I was tired of thinking and was about to give up with this problem when I noticed the number of informants was small (20) and coded a O(2^n) brute force solution that gave us a Yes. Yes! The lesson: Don’t get fancy with complicated algorithms, simple solutions are better (As I also confirmed later, when somebody told me about an even easier solution which I sadly forgot).

Well, I’m not personally satisfied with the results but we did all we could. I think the lack of training was evident. Too much work is harmful.

At the end of the competition, our PC^2 looked like this:

Our submissions

var s = "1337";
alert(parseInt(s) * 2);

More precisely, the Computer Science Department of EAFIT University has been owned. My mate just showed me its webpage. And all you can see right now is this:


H-U-H? err, I mean, K-U-H? What happened here? Then my friend showed me this, the website of the IEEE Medellín subsection (click to enlarge):


Googling a little, I found out about who seem to be the responsibles, some dudes who call themselves the Kosova Unknown Hackers. Kosova? WTF? I don’t even know where that is. I think I’m going to found the CCCC and take revenge. The CCCC, you know? Colombian Cocaine Consumers Crackers. We are going to be bad and deface some third world country’s universities’ webpages!

I guess what I wanted to say is that I feel so insecure. Seriously, how come this happens? If this is the security of the Computer Science Department, I can’t image how secure is the site of the Bussiness Management Department.

Sometimes I need to time how long a Javascript operation takes. It’s very easy if you are using jQuery.

for (var i=0; i<1000; ++i){ var j = i*i; } //do something complicated

Then, you’ll see the result in the Firebug console:

This saturday is the 23rd. Colombian National Programming Contest. I’m very excited! I can’t wait to feel the adrenaline of the 5 hours timer. Last year we finished sixth, which was not very satisfying. That time I couldn’t attack the keyboard since my left hand was killing me of pain in a plaster cast. It had been in surgery after a rather scary accident.

Let’s hope I can manage to live this week without breaking any more windows and have a fair fight this weekend!

Open the image using GIMP. Then go to Select > By color. Set the threshold to 0 and click a pixel of the color you want to replace.

This will select all pixels of the clicked color. Then simply use the Bucket Fill Tool to fill the selection with a new color.