python

Magic considered harmful: teaching the first programming language

8 minute read Published: 2011-03-26

This might come off as yet another developer ranting against java, so let me state this before even stating my goal today: I think java is a neat language which shows off some good ideas that have clearly influenced the programming community for the past years. But, as highly as I think of java as a kinda good designed product and harbinger of very nice things, like the java virtual machine (cradle of fine languages like scala and clojure)and the widespread use of just-in-time compilation, I consider that teaching it as a first programming language is harmful, because in teaching it you have two choices: either delve into thorough and sometimes hard explanations as to why things have to be done the way they're done or resort to magical explanations: "write it like that because I say so". And both have equally pejorative consequences: the former leaves little time to teach the fundamentals of programming, like control flow, functions, recursion, environments/computational objects, logic and testing; and the latter sets a rather weak foundation which dooms the future of future engineers/computer scientists.

Mixed indentation in python, the phantom menace

1 minute read Published: 2010-08-25

Little known python microframeworks

1 minute read Published: 2010-08-23

The last couple of days I've been doing some Sinatra hacking, and in a serendipitous google search, stumbled upon these two little guys: itty and juno. They look like interesting python microframeworks, take 'em for a spin!

Turning into rageguy, python and the UnicodeDecodeError

2 minute read Published: 2010-08-17

My main projects are in Django, and I've become accustomed to developing in english. But my main audience speaks spanish. So crazy stuff happens when other people test my apps and we see, astonished and enraged, a UnicodeDecodeError. In fact, I took a picture of myself when such an error occurred:

Uploading pdfs to google docs via the gdata python api client

3 minute read Published: 2010-08-04

And remain sane and alive ------------------------------------+++

Here's the deal, the Google docs API is really neat, if you can dance oauth. But, by allowing to do all that crazy stuff with documents is bound to be really complicated -just read that xml, is like something only robots should ever gaze at!. But the nice guys over at google have developed some client libraries, and one of those is the gdata python client library. Which combines all that power with the python inherent simplicity.

But there's a caveat: there's so much stuff that the documentation is sometimes outdated or just plain wrong, as is the case with pdf uploads via the version 1.0 of the API. They would swear that you can upload pdf files. But no, you can't, not with old versions of the client nor with the latest release (at least as of the writing of this post, the version 2.0.11).

So, let's just show our users a message that says "oops, bummer, no can do".

Or not.

Serendipitron is born

3 minute read Published: 2010-08-02

Serendipitron is my new weekend project; find it here http://serendipitron.appspot.com.

Markdown in django

2 minute read Published: 2010-08-01

Last week, I added markdown support to a little blog engine I wrote for a django tutorial. And well, I accomplished it in minutes! I like markdown because is really easy to write and generates amazing html. It is presented here and the syntax is explained neatly in Stack Overflow, and they use it, too.

My approach was really simple: I wanted to write the posts in markdown with a preview (like in the question edition in Stack Overflow), store the posts in markdown and display them in html.