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.

WordPress 2.8 and the get_link() error in line 647 of dashboard.php

Wow, that’s a long title, but it should drive people with this problem right here. If you have upgraded your WordPress installation to 2.8, you might have encountered a nasty error in your Dashboard, which says something about a

Fatal error: Call to a member function on a non-object in /home/user/www/wp-admin/includes/dashboard.php on line 647

This has been reported in the WordPress site but no fix has been provided. I found elsewhere a possible fix, but in my case, the new URL would not be saved at all, and the problem would persist.

I fixed it using a good old method, enabled by Open Source™: editing the code directly; I’m posting it here for those of you who would like to do it, until 2.8.1 is released:

[source:php:firstline(646)] $author = $item->get_author(); if ($author == NULL) { $site_link = “”; $publisher = “Someone”; } else { $site_link = esc_url(strip_tags($author->get_link())); if ( !$publisher = esc_html(strip_tags($author->get_name()))) $publisher = __(‘Somebody’); if ($site_link) $publisher = “$publisher“; else $publisher = “$publisher“; } [/source]

600th Post & Mobile Version

This is the 600th post in this blog! It all started with this post written in the airport of Buenos Aires, coming back to Switzerland. And the news of the day is that, thanks to Donncha O Caoimh, the new WordPress Super Cache plugin now works with MobilePress, which officially enables a mobile version of this site.

Thanks to all of you who visit this blog (you’re over 6’000 every month!), to all of you who’ve left 563 comments (no mention of the 28,304 spam comments caught by Akismet) and I hope that my writing will still be of interest to all of you in the years to come.

wp-super-cache problem? Easy fix

I’ve just installed the excellent wp-super-cache plugin to accelerate things a bit in this blog; today somebody sent one of my pages to reddit and I’ve had more users than usual! – by the way, thanks for coming! :)

Update: I admit, it also has a bit to do with the reading of today’s entry in Coding Horror ;) But I love WordPress nonetheless. I prefer it over MovableType (which I used during one year and a half).

The only glitch was: at first, it didn’t work. I think you know the feeling.

The plugin was enabled, everything was activated, yet no files were cached: exactly this same problem. And I found a quick fix to it, hence this post: fire your FTP client of choice and go to /wp-content/cache. If you don’t see a “supercache” folder in there, just create it. Magically, if you have some traffic on your blog and you dig in that folder a couple of seconds later you’ll see already lots of files! No need to modify .htaccess whatsoever.

If you want to populate it, log out of the WordPress admin and start clicking on your blog. This plugin only creates cached files for anonymous visitors! I also turned on the compression so you should start having faster response times.

It was the only thing to do manually to get it working. Hope this helps! Any comments, as usual, more than welcome.

WordPress 2.5

I’ve just upgraded this blog to WordPress 2.5 and so far I love it. The only glitch was an easy-to-fix UTF-8 problem but that’s it. Everything’s working.

By the way, I love its new media browser! It makes it easy to find old items I’ve published ages ago, like the image below :)

Update, 2008-03-31: There is a problem with comment moderation

Update, 2008-03-31: I found the error with the comment moderation! Somehow the updater failed to create an index in the comment_date_gmt column of the wp_comments table! If you fail to manage your comments properly, go to your preferred MySQL interface (command line, or like in my case, phpMyAdmin) and add an index to that column, reload your comment management page, and you’re done!

That nice freedom of modifying software

One of the best learning tools I have found in my career is to take someone else’s code, and to modify it slightly to see what happens, to play with it, and eventually to release that code in this blog, or send it to the original author, fixing it somehow or adding some feature:

Continue reading

Subscribe to comments!

To celebrate the third anniversary of this blog, I’ve (finally) added the most requested feature ever: e-mail comment notifications! For this I’ve used the Subscribe to Comments WordPress plugin which comes in handy to fulfill this task.

To use it, just click on the checkbox below the comment field, and you’ll receive an e-mail every time someone else adds another one.

I hope that you’ll like it, and that it’ll boost the rate of comments in this site :)

Preferred WordPress plugins

It is amazing to see the quantity of plugins that are available for WordPress; so far, I’ve found a plugin for every idea that I’ve had for this blog, so these are the links of each one of them:

Another worth mentioning is Gengo for localizing (translating) your pages and posts; I have played with it and it is simply awesome!

Finally, I also add here a “plugin” in the generic sense – since it is not a WordPress plugin, but a JavaScript library that can be used in any website: dp.SyntaxHighlighter that can be used to highlight the syntax of code shown in blog posts… really simple to use and with great capabilities (I’ve already mentioned it before).

It allows you to do things like this:

[source:sql] SELECT TOP 10 FirstName, LastName, Email, –SUBSTRING(Phone, 2, 3) AS CityCode, SUBSTRING(Phone, 7, 8 ) AS PhoneNumber, upper(LanguagePref) AS Language, Address1, UpdatedOn AS CreatedOn FROM profiles WHERE — Exclude all test emails Email NOT LIKE ‘%test%’ AND Email NOT LIKE ‘%asdf%’ ORDER BY UpdatedOn DESC [/source]

Particularly, the WP Unformatted plugin must be installed and enabled to use dp.SyntaxHighlighter, since otherwise WordPress “reformats” the text of the posting, and this affects the inserted code. To use WP Unformatted, just create your post and add two custom fields: “sandpaper = 1″ and “sponge = 1″, and that’s it! Your code will appear correctly formatted.

<

p>

Update, February 20th 2007: Using the SyntaxHighlighter Plugin from Erik Range makes WP Unformatted unnecessary! Thanks Erik!

Starting again

So here we go again. They say that the only constant thing is change.

Back to blogging, but with a few differences. Not only on the screen, but in real life too.

This time, I drop the idea of maintaining several blogs at once, as I did before with those previous blogs. It was much too work :-P actually, only two of those were purely mine, since “Stop the Press” was more a blackboard to put interesting stuff that I find elsewhere, trying to keep it in a handy place. As a matter of fact I always feared that someone e-mailed me telling me to take those copies offline, but it never happened, and I hope it doesn’t; I like to have all of that online.

I also drop Movable Type altogether, and instead choose WordPress. For several reasons:

  • WordPress is open source software; Movable Type is not, although it is free;
  • WordPress is easy to install, to use, etc, etc, etc.;
  • WordPress has lots of cool plugins and themes;
  • WordPress has a rich text editor for posts that works also on the Mac;
  • WordPress looks and feels nicer (purely subjective)
  • Scobleizer uses WordPress :D

The old blogs will remain at the same URL as before, since some posts (particularly those related to Ubuntu and the Linksys wireless card configuration) are referenced from other sites, and I do not want people to get lost. Those pages are very important to me, and hopefully to others as well.

And in my life… well, Claudia came to Switzerland and we’re finally married. Life starts again, better than ever. My working life has also changed substantially; I no longer work with or for Microsoft technologies; I am now senior C++ software developer in riskpro technologies AG, happily using and discovering wxWidgets, Boost, Ubuntu, Ruby on Rails and lots of other cool things going around, free to discover, to enjoy, to use, and to fix, if needed. I have discovered lots of cool stuff, and everyday the open source world keeps me more amazed, entertained, and productive than ever before; this is something that Microsoft ceased to do long ago…

So here we go again, because I still have a lot to say. Stay tuned!