Sick of getting your wordpress hacked? (contest below)

Crashed again

I sure am. After a proper installation/configuration, the most important factor is to always stay updated to the last version. I’m managing at this time 8 or more blogs/websites running different versions of WordPress and it’s hard to keep them up to date.

Automatic upgrades help, although they still terrify me after the 2.8 crash.

The problem is, some of these blogs are set up for friends or old projects, and I forgot to frequently check if they are using the latest version. Most of the times, they become crammed with spam, and eventually trigger google’s malware detectors. Most of the times I notice the hack because of firefox malware warning.

So I started a side project to help me keep track of all those blogs and their versions, and it’s seems is close to see the light. This is how it looks right now:

beta screenshot

I will need testing, so if you want to participate in the beta, fill the signup form, and I’ll send some invitations.

Also, I’m looking for a nice name for the thing. If you have a good idea, put it in the ‘Proposed name’ field on the signup form. The winner(*) will get the first beta invitation and free full access to the product for 1 year after it launches. Make sure a .com domain is available for the name you propose or it won’t have many chances.

(*) There will be only 1 winner: the first person to propose the chosen product name. Simple rules, but… without rules we are nothing but savages.

Discovr: a flickr experiment gone wrong

I need help with this. I had a dream… Well, not so much as a dream, maybe a “It’d be cool to…”

I thought it’d be nice to discover new photos on flickr using your favorite photos and the people who also favorited those photos, and the favorite photos of those who also favorited my pictures. Still with me?

It’s actually a quite simple code (about 500 lines, check it on github: discovr), but it’s terribly slow. Some possible reasons:

  • Way too much data. I’ve found people with around more than 18000 favorites, and there are photos with more than 2k fans. After limiting to 50 last favorites, the numbers are still creepy. Following from my personal favorites (366), I discovered 1268 users and 52632 photos
  • Too complicated for an API. This is the kind of feature that wouldn’t be so hard to implement if you have access to the flickr database directly, but having to do so many requests adds a lot of time to the process.
  • Inefficient library. I had to do some modifications to the flickr ruby library just to make it work, but it’s still quite inefficient in some cases. Want to know the url of a picture (knowing the picture id)? 4 (completely unnecessary) API calls
  • My code is bad. OK, I know it’s ugly to start blaming everyone else. I know my code is not very good, as it’s a quick prototype. Still, I’m not sure if making my code/libraries better would be enough improvement given the network/api bottleneck

The simplified algorithm goes like this.

  # method from class User
  def similar_pictures
    similar = {}

    favorites.each do |favorite|
      favorite.favorited_by.each do |user|
        user.favorites.each do |v|
          similar[k] ||= {:weight => 0, :picture => v[:picture]}
          similar[k][:weight] += 1
        end
      end
    end

    similar.values.sort {|a,b| b[:weight]  a[:weight]}.select {|v| v[:weight] > 1}
  end

So I’ve created a github repository and uploaded the code: discovr at github. Feel free to clone, test and improve

42foo: all the virtual hosts you need for your web development

I’ve done a fair amount of web “design” (mostly implementing designs of others) and development in the past, I usually set up a lot of virtual hosts in my local apache. I’ve done that in three different ways.

The quick&dirty hosts file

Point any of your development domains to 127.0.0.1 in the /etc/hosts file. It’s the easiest way, but you need to add them one by one. At some point, mine could look like this:

127.0.0.1 warp.dev
127.0.0.1 ebox-platform.dev
127.0.0.1 ebox-technologies.dev
127.0.0.1 jorgebernal.dev
127.0.0.1 projectA.dev
# ... and so on

Getting smart with dnsmasq

This is a more automated method. You install dnsmasq and configure 127.0.0.1 as your DNS server. Then add this to your conf:

address=/.dev/127.0.0.1

This worked well, and acted as a dns cache. But I had some trouble with dynamic dns entries at our old office: projects.warp.es would point to a local address inside the office and our remote IP from outside, so I found myself clearing the cache too often.

42foo: the zero-code web service

So I made it external. I bought 42foo.com and set up a bind zone with this:

@                       A       127.0.0.1
*                       A       127.0.0.1

So warp.42foo.com, ebox-platform.42foo.com or whateveryourprojectis.42foo.com always point to 127.0.0.1

You still have to set up the virtual host, but there is one step less for web development. Feel free to use it, and let me know if you set up something similar with a shorter domain name :)

MySQL Conference 2009, I need an idea

I had a sad time this year when I missed the MySQL conference, since I had much fun last year in Santa Clara. I can’t miss it next year.

As a MySQL partner, and after almost 2 years doing MySQL training, I sure have interesting things to tell in the conference, but I’m not sure about what.

I will be thinking about this in the next weeks, but I’d appreciate some help. What topics are you interested in?

Store countries with ISO-3166 codes in rails

I’ve been trying to give rebirth to an old internal project at my company, abandoned circa 2006, and this is one of the code pieces I think it could be useful to others.

I wanted to store country information as an ISO code, so here is the plugin to make it work

It’s translated using the translation from the iso-codes package, so I guess it’s as good as it can get by now. If you want to contribute, please do it to the iso-codes package and let me know, so I can update it too.

iso_countries – Store countries using ISO 3166 codes

This rails plugin enables you to store country info only with the country’s ISO-3166 code

Example

  class Company < ActiveRecord::Base
    iso_country :country
  end

  c = Company.new :country => "es"
  c.country                 # => "es"
  c.country_name            # => "Spain"
  c.country_name = "France"
  c.country                 # => "fr"
  ISO::Countries.set_language "es"
  c.country_name            # => "Francia"

Download

You can get it from http://github.com/koke/iso_countries/tree/master

eBox premieres new website

eBox-web-shot.jpg

Since I didn’t have any MySQL public courses planned this summer, I’ve been using my work time from the last week in the new eBox website.

I’m still far away from what I’d like, but I’m proud my design skills have improved considerably.

For those of you who still don’t know what it is, eBox is a server for the easy administration of corporate networks. eBox was included with the last release of Ubuntu. See eBox in Ubuntu

Flickr commentr

Update: I forgot to mention, the source code for the server part is available at flickr-commentr

flickr commentr is a simple tool to allow you post flickr pictures on flickr comments, or any other forum or blog

To install it, drag this bookmarlet to your bookmarks bar

flickr comment

When you are browsing a flickr photo, click the bookmarklet and you’ll see a popup like the following screenshot, where you can select the size and attributes to show, and copy the HTML code to post the picture.