“Why I hate Django”
- 3 Comments
- Published October 8th, 2008 in Software Eng.
&hlI don’t hate Django. Actually, I find it a very interesting framework that has reached a great level of maturity since version 1.0 hit the shelves. It’s a fast, sleek and well put framework in the likes of Rails. I do prefer Rails over Django but that’s a matter of personal preference (actually, it boils down to preferring Ruby’s neat syntax over Python’s — semantically speaking, they’re both very similar).
Actually, we’ve been using Django a lot on our company to develop certain web products (mainly those that require an extensive admin interface, that Django provides right there on the spot). Overall, we’re platform agnostic but we try to focus on some key technologies to create expertise and advanced know-how.
Cal Henderson, Flickr’s author, went to Googleplex in Mountainview during the Djangocon to show his side of the story — why he “hates” Django and frameworks alike.
Most of the presentation is mostly making fun of it, not exactly complaining. For instance, he says that in real languages (like in Perl) you can format your code text as an ‘S’ while on Python you can’t as it needs the tabs to define scopes. Another funny one is him pointing out that Python developers usually use soft spaces rather than tabs which wastes a lot of disk space.
Overall, the presentation is just a chill out ending for the day but there’s a couple of things that are actually true and need to be pointed out.
The tipping point of a framework — when it begins to deter productivity — is when you need to cross its well defined bounds that speed up the execution of common tasks. This is where frameworks (Rails, Django and many others) can learn a lot. They’re quite modular already but they should be way more. The idea is to easily replace bottlenecks by code that addresses the specific needs and nothing more.
This problem mostly concerns medium-sized applications. Small size applications are fine — put a couple of application servers and it runs fine. Large size applications have tons of layers (Squid, memcached, MySQL clusters, etc..) before actually touching the application server. Medium sized applications, on the other hand, don’t benefit from the hardware resources available to large applications and are way more demanding than their counterpart small-sized ones. Handling 100/150 requests per second without growing horizontally might become a tough task, even worse if you can’t rely on caching mechanisms due to application specific requirements.
Making (white-box) frameworks more modular, ie, layering the architecture in such a way that it’s easy to define the entry points and simply replace them, might be one step in the right direction.
P.S. - Shredding inefficient pieces like REXML is definitely another step in the right direction.
P.P.S - Nothing against REXML’s author, he has contributed way more to Ruby than I did. But it’s darn slow, despite not being its fault — parsing XML using an interpreted language such as Ruby is by nature not that efficient.
Is Stallman serious?
- 7 Comments
- Published October 2nd, 2008 in Free Software, Politics
“Web-based programs like Google’s Gmail will force people to buy into locked, proprietary systems that will cost more and more over time, according to the free software campaigner” (outrageous stuff continues here)
Richard Stallman is the creator of the Free Software philosophy. Whether you like him or not, he has contributed to significant advances in the IT industry in general and to the development of important Free Software in particular (most notably, GNU tools and Emacs).
He’s a strange mix of a geek and a nerd. I’ve seen him live and I can assure that. Whether you like the person or not, the persona has done significant things.
But sometimes radicalism throws reason away. In his quest to destroy all the living proprietary software (in the same way that religious people fight the evil) he’s become the enemy of himself and of his very own ideologies. Every time he speaks, a kitty dies and someone around the globe stops using Free Software. No, really.
The last one comes in regard to the so-called cloud computing. Generally speaking, we’re talking about web apps like GMail, YouTube, Flickr and others. According to him, “It’s stupidity. It’s worse than stupidity: it’s a marketing hype campaign […]”.
I use GMail. I guess that makes me stupid. Moreover, I’m a pawn at the hands of a huge marketing campaign. Perhaps I didn’t make such decision while at my full capacity.
Let me tell you something Mr Stallman. First off, nowadays you do more harm to the Free Software community than you do any good at all. Relax, get your retirement ready and get a ticket straight to Miami Beach. You’re gonna love it and it’s damn time. Secondly, please respect the freedom of choice. The freedom to use whatever we want to use. Also, the freedom to turn software into a usable tool and not an object of worship. Appreciated.
Bottom line: Free software doesn’t need proprietary software to fail so it can thrive. Both can coexist.
rexml-dropin
- Comments Off
- Published September 29th, 2008 in Ruby
If you’re a Ruby developer you know by now that REXML has to be one of the least efficient XML parsers around. It’s easy to use, it comes bundled with Ruby and it doesn’t get in your way, but it’s painfully slow.
If you’re developing something from scratch you’d rather use libxml, Gnome’s XML C parser. But if you’re using a third-party software that uses REXML you’re stuck to it. Well, kind of.
rexml-dropin is a newborn project that wraps around REXML but uses libxml instead. It’s still under development but it’s quite promising. It’s been successfully used with xmpp4r, a Ruby XMPP client.
rails-footnotes
- Comments Off
- Published September 15th, 2008 in Ruby
Rails developer? Tired of sneaking in on the console and scrolling through tons of useless information until you get what you’re really looking for? Great, then take a look at Rails Footnotes.
Rails Footnotes is a plugin that adds some useful information to the footer of a page while in development mode. It lets you take a look at the SQL queries that were performed and also explain or trace them; it gives you access to the session and cookie variables; the request context and some other stuff.
If you happen to also use Mac OS X/TextMate you’re also entitled to an extra goodie: direct links for opening the view, the controller and the layout in TextMate.
Resume with scp
- 2 Comments
- Published July 18th, 2008 in Tips & Tricks
Secure Copy (scp) is a very interesting tool for securely transferring files over a network. If you do a lot of scp's you'll soon step against an unfinished transfer that you'll want to resume. Well, look no further. Here's an instant tip on how to resume an scp copy.
[bash]
alias scpr="rsync --partial --progress --rsh=ssh"
[/bash]
Now, restart or initiate another shell session. Instead of using scp just use the alias scpr that makes use of rsync to resume your transfer. The cream on top of the cake is the global progress bar!
Rails/Globalize tip
- 1 Comment
- Published July 17th, 2008 in Tips & Tricks, Ruby
I'm absolutely burdened in work so there's no time for blogging or whatever might refrain me from producing (few exceptions apply — am I becoming a workaholic? nevermind the rhetoric question, I've always been one). But this tip is quick and very interesting.
If you're using the i18n/l13n Globalize plugin for your Ruby on Rails projects and you need to escape something from being translated in the middle of a sentence, you do not need to split it and then concatenate it as follows:
-
"to be translated ".t + user.name + " more to be translated".t
You can simply use Ruby's sugar candy to the string format function.
-
"to be translated %s more to be translated".t % user.name
Just make sure your translators don't mess up the %s placeholder.
There’s a new phishing approach in town!
- 20 Comments
- Published July 5th, 2008 in Web
Impressive how phisers have been constantly evolving the tools and approaches to scam people over.
Usually, they resort to replicating a page of a bank, PayPal, whatever, and put it on a different URL. People are lead to believe that they're actually logging in to the target website and they capture your authentication information.
This can be easily overcome with a little bit of precaution — make sure you're buying the milk from the milkman, i.e., reassure you're logging on the right website.
The newest approach, that I've just witnessed through the means of an email inbox assault, goes a little bit further in order to outcome this smartness one might use to unveil the scam. They exploit the original website to their benefit.
On this case, I received an email proclaiming to be from Paypal that said my account had limited access and I had to login. I wondered about it being a scam attempt but, nonetheless, checked the URL. Guess what? It started with https://www.paypal.com. It was even on an SSL encrypted HTTP channel. What could it be?
Now, if you've used Paypal before, you'd notice that many redirects occur between sign in and landing pages and also from external websites. They could have taken two approaches to pass the landing page around: by the means of a cookie or passing in directly on the URI. They took the second option. What happened was that the attacker simply replaced the redirect parameter with his own target website, misleading people into believing that everything should be fine.
The URL looks like this (if you haven't read the whole post, please realize this URL is a phishing attempt! Be careful).
https://www.paypal.com/cgi-bin/webscr/cgi-bin/webscr?cmd=_ssr&return=http%3A%2F%2Fpaypal-us.6s.pl/?cgi-bin.webscrcmd=_login-run.webscrcmd=_account-run.CaseIDNumberPP-046-631-789
As one can see, Paypal will freely redirect to the attacker's website.
Be careful.
Update - Phishing, of course. Typo fixed.
iPhone 3G
- 2 Comments
- Published June 9th, 2008 in Apple
Apple simply blew up the competition. Destroyed. Annihilated.
iPhone 3G with GPS starting at $199. Unbeatable.
Mine will be ordered whenever it's available at the Apple stores.
Firefox 3 RC1
- Comments Off
- Published May 20th, 2008 in Firefox

It's fast. Damn fast. It's slick. Responsive. It has a nice theme. And tons of useful plugins that I can't live without like Firebug and WebDeveloper.
Firefox has always been my browser of choice on Windows and Linux and holds a very important place in what regards to web development on Mac OS X. But now I'm considering making it my default browser and displacing Safari. We'll see how things turn out.
Bottom line: a competitive market is wonderful.
OpenOffice.org 3 is awesome!
- 1 Comment
- Published May 15th, 2008 in Free Software

After having used it for over a week, I must conclude that OpenOffice.org 3 beta is quite an achievement. It's faster, it now sports an Aqua interface (lovely for us, Mac OS X users), it's simple yet beautiful. It's more solid than ever before and comes with a full range of functionalities that the common user will certainly put to good use.
It still doesn't grasp to the extent of Microsoft Office's plethora of functionality, but it's definitely more than enough for the average Joe. Don't expect complex financial plugins to be available, but you're welcome to start programming your own. It's still a remarkable achievement in the Free Software world.
Congratulations to Sun and to the OpenOffice.org team.
MySQL to remain 100% Open Source
- Comments Off
- Published May 11th, 2008 in Free Software, MySQL
After MySQL was bought by Sun, a rumour started circulating stating that certain features of MySQL would be targeted at the enterprise version only and would never make part of the community version.
Right after this rumour started spreading around, criticisms arose and now it seems that Sun and MySQL paid attention to the community. Therefore, they're retracting back and dropping any plans of making pieces of MySQL closed source.
Hereto MySQL is to remain Open Source. After all, the community shaped MySQL the way it is today.
22″ displays are useless
- 5 Comments
- Published May 3rd, 2008 in Tech Comment
Here's the point: most if not all the 22" displays have a resolution of 1680x1050, precisely the same resolution of most of the 20" displays. That means that buying a 22" won't add any real estate but only take some extra money out of your pocket.
22" might be useful for people that need to see everything in huge size. In that case you'll appreciate fonts set to 12px looking like they're 16px.
P.S. - On the other hand, a 22" display with a 1900x1200 resolution (equal to 24" displays) would be amazing.
Twitter and Ruby on Rails
- 2 Comments
- Published May 2nd, 2008 in Tech Comment
First off, one clear remark: according to Evan Williams, Twitter is not abandoning Ruby on Rails. Got it?
Secondly, on an application such as Twitter that relies heavily on services and messaging Rails accounts for.. hmm.. 3% of the whole application?
Twitter is suffering from being a very write-intensive application, having an architecture not initially thought for scalability (handling tons of write requests per second and propagating them is not an easy task) and because, well, everyone uses it.
I do remember the numerous times Hi5, Digg or Facebook were down and, guess what, those are PHP and Java applications.
MacRuby 0.1
- 2 Comments
- Published April 18th, 2008 in Free Software, Ruby, Apple
I am pleased to announce the first release of MacRuby, 0.1.
MacRuby is a version of Ruby that runs on top of Objective-C. More precisely, MacRuby is currently a port of the Ruby 1.9 implementation for the Objective-C runtime and garbage collector.
So far, since the project beginning was announced a few weeks ago, many bugs were fixed and features added. MacRuby is still at this point experimental, although if it’s also usable.
The purpose of this version is to release functional code, and also to let you test the new user experience. Please note that the project implementation will change deeply in the next releases.
You can learn more about the project on its homepage, and download a binary installer.
Enjoy!
Having access to the full potential of ObjectiveC by using Ruby (in the same fashion that one can use .NET through IronRuby) would be something of amazing and might draw a lot of attention back to Cocoa and application development on Mac OS X.
Dell Portugal vs Dell Spain
- 3 Comments
- Published April 7th, 2008 in Tech Comment
OOXML becomes an ISO standard
- Comments Off
- Published April 3rd, 2008 in Politics
Lesson of the day: money wins.
getElementsByClassName has changed
- 2 Comments
- Published March 26th, 2008 in Web/W3C
Both Safari 3.1 and Firefox 3 Beta 4 have heavily changed the DOM method getElementsByClassName to reflect W3C specifications. Therefore, there's a strong chance that you'll have a couple of users complaining in case you're using this method.
To overcome this your best bet is probably relying on a high level select function like the one provided in Prototype or in jQuery's select.
Sweet Irony
- 9 Comments
- Published March 22nd, 2008 in Tech Comment
vs 
Life is replenished in irony. I've been praying for IMAP support on Gmail for ages. I sent several emails, I had the chance to talk to one of Gmail team engineers at GooglePlex, I wrote several posts begging for IMAP support.
Google finally added IMAP support about half an year ago. I was relentlessly happy. In a flash I was setting up my dusty email clients (Thunderbird on Linux/Windows, Mailapp on Mac OS X) so I could use them again. When I finished doing it, I thought to my self: Great!
But then I started missing Gmail's labels. So easy to support. Soon after I was also missing Gmail's excellent email threading system. And the quick search! Only Mailapp on Leopard (due to Spotlight indexing) was as fast as Gmail on diving through thousands of emails.
All in all, I soon realized that there's no advantage in having an email client comparatively to having Gmail's powerful web interface. But I might be missing something. I'll therefore ask our dear lazy web why should one use an email client like Thunderbird or Mailapp instead of Gmail's powerful web interface.
The iPhone has an SDK
- 2 Comments
- Published March 14th, 2008 in Tech Comment, Apple
Forget the title. I'm not going to talk about the virtues of the SDK or give the already-old news that the iPhone now has an SDK. Just behold on the word now.
One might think that Apple was obliged to create an SDK due to popular demand. But this is Apple. No one forces Apple so if it wasn't their intention to develop an SDK they wouldn't develop an SDK. Furthermore, take a look at how fast they built it. Too fast. It was already being made prior to the launch of the iPhone, one might conclude.
Why did Apple took so long to launch it then? It goes beyond the eyes of the viewer. Steve Jobs is damn smart and so are Apple's Directors. Think about it. The SDK will be of utter importance to the corporate users so they can access their applications and corporate email. Regular users might get a game or two but the default set of applications is already quite good, so the SDK won't bring any breath-taking application.
On top of that, corporate users don't rush to buy the latest tech gadget. Common users do it.
So what Apple basically did was refreshing the hype on the iPhone without having to upgrade it or throw a shiny new model. These guys are good at this, whether you like them or not.
P.S. - As soon as there's a GPS application for the iPhone, I'm finally buying one.
10 things I hate to read on other people’s blogs
- 2 Comments
- Published March 13th, 2008 in Web
Here's a 10 items list of the things that importunate me the most when reading other people's blogs.
10) Top 10 lists like this very one;
9) ?
8) "Links for today" posts. If I want links I'll just go to del.icio.us, thanks;
7) Posts containing images that have nothing to do with its content;
6) Gossip and pop posts;
5) Posts citing other articles and essays that don't contain a link to the original post;
4) Political propaganda (propaganda differs from facts, ideologies or politics in general), being it neoliberal or communist;
3) People begging to subscribe to their feed. If I like your blog I'll do it, if you beg, I won't;
2) Posts garbled with inexcusable grammar mistakes like "I are good to jumping";
1) Writing "M$" instead of Microsoft. C'mon, we all dislike Microsoft a bit (a lot), but that's just childish;
MySQL 5 x64 flies
- Comments Off
- Published March 11th, 2008 in MySQL
I've just installed MySQL 5.0.51a x64 on my development machine (Mac OS X Leopard) and on my test machine (Ubuntu x64) and this is damn fast. No, really, you can notice the speed improvements over the x86 version even without having to run one single benchmark.
If you're not upgrading from heavily different architectures (like *nix to Windows Windows to *nix) copying the entire data/ folder might pull the trick. Migrating from x86 to x64 works because MySQL doesn't store any pointer or other architecture-dependent in the data files, otherwise you'd have to do a full dump and proceed with a restore of all the tables.
64 bits registers in database environments is definitely a blessing. Oh, and making use of more than 4GB of addressing space is also useful.
Vobis Top Laptop Sales
- 2 Comments
- Published March 10th, 2008 in Apple
Vobis is a Portuguese computer store like CompUSA used to be in the US.
Here's the list of the laptop top sales. Apple occupies three slots of the top five, winning the first and second place.
Don’t buy the Macbook Air…
- 2 Comments
- Published March 5th, 2008 in Tech Comment
Buy this brand new Dell instead...

Nãaa.
P.S. - This post serves to show that there are niches for different products, even for this damn ugly Dell.
Going for a cheap NAS
- 6 Comments
- Published March 5th, 2008 in Tech Comment
I'm in the market looking for acquiring a cheap yet powerful NAS.
The first option is maintaining your own machine (choose your *nix flavor) with an array of disks in RAID1 and SMB/CIFS. Yeah, cool, but it has a couple of disadvantages: 1) it wastes more energy because it will probably be running on a more powerful CPU; 2) maintenance is not as straightforward as pushing a reset button; 3) it probably won't allow hot-swap as most NAS devices allow; 4) you'll waste much more time.
If I were to go to a custom-tailored NAS I'd definitely choose FreeNAS, which is a stripped down version of FreeBSD with a very cute web interface for configuring everything. It's stupidly easy to configure (you don't even notice it's running over FreeBSD), lightweight and powerful. But it still suffers from problems previously referred, namely 1) and 3).
In the end, I just want something that you plug, configure an IP and that's it. Considering these requirements of tantamount importance, I've looked up and I got the following contenders:
1) HP mv2120
2) Dlink DNS-323
3) LaCie 2big Network
All of them run on Linux and provide about the same functionalities. Except for Dlink, all of them have a 1Gbps network card, work over CIFS and allow RAID1. They all work over a web interface and have at least one extra USB 2.0 connection that could be used to plug another external hard drive.
The HP model is hot sexy but it hasn't been released yet (expected March 2008) and these kind of business products from HP are usually hard to get for non-resellers like me.
Dlink lacks the 1Gbps port but, except for that, nothing note-worthy.
LaCie seems like the winning contender. It already comes with the two hard drivers which is a major plus, sparing you from having to purchase separate disks. It's nice, sleek and not that expensive. €480 for the 1TB version, which already includes 2x 500GB SATA-II hard drives. Another major plus (along with HP's mv2120) is that it includes a really nice backup utility that might be useful for Windows machines, unaware of the power of rsync.
I'm probably going for LaCie 2big Network 1TB (which is actually 500GB on RAID1).
Even virus run cooler on a Mac ;-)
- 3 Comments
- Published March 5th, 2008 in Apple
P.S. - Contains a video.
Convert a physical Linux to VMWare
- 6 Comments
- Published March 3rd, 2008 in Tips & Tricks, GNU/Linux, Ubuntu
I recently decided to convert a Linux installed on a physical machine to be run inside VMware, hosted on a much more powerful machine. Two reasons for this: 1) the host machine is quite powerful (2x Quad Core Xeon, 4GB RAM); 2) the Linux image was lightweight enough.
The process was quite simple. I started by installing the same version of Ubuntu (Ubuntu server 7.10) that I had previously installed on the physical machine. I could just use dd to make a full copy of the / partition and pray that the devices get correctly re-detected but this way was cleaner and safer. The Ubuntu installer detected all the virtual hardware and configured correctly.
Now it was time to make a raw copy of key directories like /var, /usr, /etc/, ... You can't copy the files while the target Linux is running so I just popped in a Ubuntu Live CD and mounted the target disk. To make things easier, I installed openssh-server on the Live CD Linux instance, mounted the target disk in /media/disk and issued the following command:
-
$ tar -zcvpf - --exclude=/proc/* --exclude=/dev/* --exclude=/media/* --exclude=/boot/* --exclude=/tmp/* --exclude=/var/cache/apt-get --exclude=/sys / | ssh root@new_host "cat> a.tar.gz | tar -xvvf a.tar.gz /media/disk"
The aforementioned command will tar gunzip all the relevant system directories, excluding device files and other system-specific settings.
When finished, you're almost done. The only thing left will be fixing the UUIDs that identify the partition blocks. Just issue a $ sudo vol_id --uuid /dev/sdaX for each partition and replace /etc/fstab and /etc/mtab accordingly.
And you're probably done. This is a very brief tutorial as this is directed for experts. You can fill in the gaps.
Time.now.usec in Windows
- 13 Comments
- Published March 3rd, 2008 in Tips & Tricks, Ruby
There are certain things that one programmer only thinks of when it comes across them. The one I'm about to tell is definitely the case.
I was deploying a custom made Ruby application on some Windows machines of a client. While testing the deployment, there were some weird errors that couldn't be happening: duplicate keys while inserting a record on the database. The field causing the error was set as unique as it is a record id on a third party billing software. It was a timestamp including milliseconds.
Now, generating a timestamp up to the milliseconds level worked fine on my development machine (Mac OS X) and on my server machine (Linux/Ubuntu) as well, but it was failing miserably on Windows. Why's that? Could it be that Windows doesn't update its timer often enough? Gotcha!
For some unexplainable reason, Windows (Vista!) only updates its timer every 10ms, meaning that two consecutive requests for time will get the same timestamp. While on *nix machines you get time updates up to the nanosecond level, on Windows you have a long time before an update happens. And 10ms in the computer world is an eternity!
So here's the quick fix for stopping this from happening. Just stick a Kernel.sleep(0.01) before the Time.now.usec call and you should be fine. It's ugly, it makes you lose 10ms of your processing power but it's a practical and fast fix.
P.S. - You can test this behavior by doing 10.times do puts Time.now.usec end on irb. Depending on your CPU, you might get up to 10 times the same time! On a low-end Dual Core HP laptop I got about 4 different times in 10 successive calls.
Thanks Vodafone
- 3 Comments
- Published March 1st, 2008 in Rant
It's March 2008 and Vodafone's website still doesn't work correctly with WebKit web browsers like Safari or Konqueror.
Who said Apple is expensive?
- 4 Comments
- Published February 26th, 2008 in Apple

Dell is one of dirty-cheapest hardware companies out there.
Whoever still thinks that Apple is expensive must be living in 1980.
Firefox slow on localhost connections on Vista?
- 3 Comments
- Published February 21st, 2008 in Tips & Tricks, Firefox
I've been working on a project for a client consisting of a website running on a couple of laptops (about 10). This project has been developed in Ruby on Rails and everything went fine until the final deployment on the laptop machines running Vista. On these machines (cheap HP G7000 by the way) it was really slooow. And I mean it.
I did some benchmarking and I was getting around 10 reqs/sec on a high load web page without any kind of caching. 10 reqs/sec is more than enough for a single user web application. It couldn't be it. Also, it was working blazingly fast on my laptop.
I never questioned Firefox. I've never had speed issues with Firefox in the past. But anyway, I popped up Internet Explorer and I was incredule to see that the site was flying in IE7.
A quick Google search led me to this. For some particular reason I'm yet to assert, Firefox gets stuck if IPv6 for DNS querying is activated on Windows Vista.
A simple
network.dns.disableIPv6 false
under about:config will fix it.
I disabled it and the problem is gone. I'm wondering who's fault is it.. considering that under the same settings Firefox runs perfectly fine in Windows XP, Mac OS X and Linux I'm very suspicious about Windows Vista. I loath it.
P.S. - Not to add that Vista's unzip utility is seriously broken. It was extracting a 50MB zip file (InstantRails, by the way) at a rate of 5Kb/sec. Downloading the open source 7-Zip, installing and then extracting the file was faster than waiting for Vista's unzip to finish its job.
Se está à procura da versão em português do meu blog 



