Del.icio.us to WordPress

I’ve just uploaded a new project on Github called delicious_wp: it’s a small Ruby script that simply fetches the items stored in del.icio.us the previous week and creates a blog post with them. You can set up a small cron job to execute this script every week, which is what I’ve done for this blog :) I know del.icio.us has a similar feature integrated, but it executes daily, instead of weekly, which is what I wanted.

To use it, just clone the repository, copy the config.yaml.sample file as config.yaml and edit its values inside. Run the script and voilà! A new blog post entry with your del.icio.us bookmarks.

The script can also be helpful to those wondering how to use the XML-RPC interface of WordPress from a Ruby script, or how to use the Net::HTTP library to consume a REST API.

[source:ruby] def get_delicious_bookmarks # Connect to delicious and get updates http = Net::HTTP.new(DELICIOUS_SERVER, DELICIOUS_PORT) http.use_ssl = true req = Net::HTTP::Get.new(DELICIOUS_DATES_PATH) req.add_field(“User-Agent”, DELICIOUS_USER_AGENT) req.basic_auth username, password response = http.request(req) results = response.body [/source]

[source:ruby] def post_to_wordpress(title, text) entry = { :title => title, :description => text } # Connect to WordPress using the XML-RPC interface blog = XMLRPC::Client.new(server, path, port) blog.call(“metaWeblog.newPost”, blogid, username, password, entry, true) [/source]

Enjoy! As usual, the code is released with a BSD license.

Reflexions on the Software Business

There are basically two things you can do to earn a living when you write code:

  1. Consulting
  2. Products

When doing consulting, you write code, and somebody else owns it; you are blamed for its bugs, rarely praised for its benefits, and usually you only sell one copy of your work. When working on products, you write code, and you actually own it; you can brag about it on your blog without pissing anyone, and if you are lucky you sell as many copies of it as you want, all for basically the same production cost.

Now, here’s an insider tip: if your objective is living a nightmare, tearing yourself apart and swear never touching a keyboard again, choose option 1. If your objective is enjoying a healthy life, making money and living long and prosper, choose option 2.

This fact is explained by economists as a “diseconomy of scale”: this means that fixed costs are very low relative to variable costs, which means that the cost of creating a new copy of your finished product is virtually zero. You only have to invest in the building, not on the replication. Actually this is not 100% true, because you should spend on marketing anyway, and you might as well add new features on the way, but the truth is that well-run software companies make more money than drug dealers, and guess what: software is an activity usually considered legal.

However, there is a tacit consensus in Switzerland, apparently, by which there can’t be successful companies doing software in this side of the world. And most companies choose option 1 above. Which has interesting side effects. Continue reading

Who do you want to work with?

When you are a kid in Argentina, there are invariably three questions that you’ll always get asked whenever you meet a grown up person:

  • How old are you?
  • What’s your favorite football team?
  • What do you want to be when you grow up?

The answer to the first question depends on the moment, of course, and it’s simply a test to see if you know how to count. The answer to the second depends on your parents (this is like religion down there) and the city where you live (but there’s a 90% chance your answer will be either River Plate or Boca Juniors).

The third question, however, is problematic, no matter what the answer is. Because at a large degree we build our lives around that “what do you want to be?” question, whether we like or not what we do, whether we believe or not that what we want to do is doable or not, or if it pays well or not, or if we will like at all, or if we will end up doing something completely different whatsoever by the time we retire.

This single question shapes a lot our lives, without even realizing it, and we pollute otherwise peaceful kids with the realization that there’s much more to life than school and Wii and friends and chocolate milk.

The problem is, for me this is clearly the wrong question to ask. We should be asking kids “who do you want to work with?”, instead. Continue reading