Entries from September 2009 ↓

Run a single test on a Ruby on Rails application

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

XXIII Colombian Programming Contest – Second place!

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.

Continue reading →

Convert string to integer in Javascript

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

My university has been hacked!

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:

DIS EAFIT owned

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):

ieeemedellin

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.

Time Javascript operations

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

   console.time("longOperation");
   for (var i=0; i<1000; ++i){ var j = i*i; } //do something complicated
   console.timeEnd("longOperation");

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