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.

Installing PostgreSQL 8.3 on Leopard

This is the documented path to my discovery of PostgreSQL 8.3, which I’ve never used before. Now that MySQL‘s community is getting hammered to death by Sun, and thanks to all the good things I’ve heard about it over the years (including enhanced performance on multicore systems and greater scalability), I really wanted to install it and play with it.

Frankly, it’s not easy. At all (actually this is why I think MySQL is so popular, because of the ease of installation!) So hang tight and read on. Continue reading

Extracting e-mails from a vCard file with Python

Let’s say that you have a vCard file. You can export it from your Mac OS X AddressBook.app, or from any other similar application. Now you need to extract some information from it, namely the e-mails, for spamming your friends with some boring news. Typical.

Enter vobject. This Python library is part of the Chandler effort (which seems to be somewhat ill-fated since Mitch Kapor announced he was leaving the project). Anyway, you can download this library from here and then install it using the common sequence:

python setup.py build python setup.py install

Finally, here’s a bit of code to quickly extract the names and e-mail addresses from a vCard file called “vCards.vcf” containing lots of vCard instances, one after the other (AddressBook.app exports data this way, instead of creating on file per contact):

[source:python] import vobject

f = open(“vCards.vcf”) s = “”.join(f.readlines()) f.close()

a = vobject.readComponents(s)

counter = 0

while True: try: # “next()” seems to throw an exception # when there aren’t any more “Components” # in the stream… # Talk about nice flow control! b = a.next() counter += 1 if b.contents.has_key(‘email’): # “repr()” below avoids # unicode –> ascii exceptions print repr(b.fn.value), repr(b.email.value) except: break

print “%d e-mails found.” % counter [/source]

The library documentation, to put it simply, isn’t as good as the library itself (see? I can be politically correct sometimes :) Maybe I missed a better way to iterate over the contents of the whole stream of vCard instances inside the file (using exceptions for that is yuck!), but then again, feel free to add your comments below as usual.