Auto-advance WordPress’ TwentyEleven showcase slides

WordPress default theme, TwentyEleven, has a built-in showcase mode that is displaying a set a slides (composed of sticky posts) at the top of a page. This mode can be activated by creating a static page and set its Template page attribute to Showcase Template.

The problem with this mode to me was the lack of an auto-advance feature that will cycle through the slides every X seconds. Luckily I found a way to automate implement this with some lines of JavaScript:

<script type="text/javascript" charset="utf-8">
    // Auto-advance the showcase slider
    // Source: http://pastebin.com/s6JEthVi
    jQuery(document).ready(function(){
        var change_every = 5; // The number of seconds that the slider will auto-advance in
        var current = 1;
        function auto_advance(){
            if(current == -1) return false;
            jQuery('.feature-slider a').eq(current % jQuery('.feature-slider a').length).trigger('click', [true]);
            current++;
        };
        setInterval(function(){auto_advance()}, change_every * 1000);
    });
</script>

All you have to do is to embed this snippet of code within your home page. It could either be in the static page you use as a showcase template or in a showcase widget. The latter is the exact same method I used earlier that year to customize CSS in WordPress without messing with the original code.

And of course this code is currently live at the front page of that very blog.

Increase Dropbox free capacity with Google AdWords

I started to use Dropbox 6 months ago at work, but I only use it for personal files since November. Now that I seamlessly integrated it on my Kubuntu thanks to Kfilebox, it quickly became clear that Dropbox will potentially be part of my everyday computer life. But before definitely integrate an external dependency to my workflow, I had to test Dropbox further, which requires me to go beyond the default 2Go account.

To maximize the free storage capacity of my account, I completed all the basic installation steps (earned me 250 Mb), then I connected my Dropbox account with Twitter to get 500 Mb. I could have got more free space if I had a Facebook account or was a student.

What’s left to enlarge your capacity is referrals. To speed up this process, and following the steps of others, I setup an AdWords campaign (all of this triggered by a post on Hacker News).

I only targeted the French audience because I feared the HN post would have temporarily inflated the cost of English keywords. Here are the daily stats of my campaign:

And here are the ads I created:

The paused ads above are those which didn’t invited the user to install the Dropbox desktop client. And the latter action is absolutely required to unlock the bonus capacity.

And if your interested in all the details involved, here is a keyword report.

At the end it costs me 31.77€ to get 8Go of additional Dropbox capacity trough referrals:

That’s not cheap, but was a fun hack and a great excuse to learn how to use Google AdWords. And next time I know what I’ll do with those AdWords coupons I regularly give away;)

WordPress commands

  • To activate the debug mode of WordPress, add the following PHP code in wp-config.php:
    define('WP_DEBUG', true);
    
  • This SQL query remove all revisions of posts having the topic, reply and attachment type (tested on WordPress 3.1.x):
    DELETE child.* FROM wp_posts AS child LEFT JOIN wp_posts AS parent ON parent.ID = child.post_parent WHERE child.post_type = "revision" AND parent.post_type IN ("topic", "reply", "attachment");
    

Live Browser : a Python web app using Microsoft Live Connect API

5 months ago I was called by a recruiter for a position in a startup building cloud-computing solutions. At the end of my first interview with the engineers of the company, I was asked to write a little web application to test my technical abilities.

The goal was to create a back-end talking to Microsoft’s Live Connect API and keep a cache of user profiles. Then a front-end demonstrating my HTML/CSS/JS know-how was to be built. User authentication was supposed to use OAuth.

The only technological constraint was to use Python. I decided to use CherryPy and Mako to leverage the boilerplate code I just released back then. For the persistent layer, my first intention was to use SQLAlchemy, but quickly switched to MongoDB as I never played with it and this project was a great opportunity to.

If my web app was far from finished, it was still well-received by the team. After other interviews I was made an competitive offer. I finally declined as I wanted to finish what I stated at my current company.

What’s left of this experience is Live Browser, the web app I created, which source code is now available on GitHub.

Nichrome Preview (and Behind the Scene) video

Featured

Two months ago (October 8th) I shot a video for Cool Cavemen. I haven’t talked about it on this blog yet, let’s fix this right now:

The song is Nichrome, which is a brand new song that will be available on Cool Cavemen’s upcoming album (to be released in 2012). This is the first time Nichrome is made public. The video is only a preview of the song: it only contains the first 2 minutes and the audio track is a demo, not the final studio version.

Demos are used not only for reference, but also for rehearsals when a band member is missing. That’s the case in this video: there is no bass player, but his parts are played in all musician’s headphones. Shooting the video in this playback setup is a huge advantage for me, as it removes all issues related to audio/video synchronizations and tempo deviations.

I shot with my Canon EOS 7D (1080p, 23.976 fps, 1/50s shutter speed) and a Tokina 11-16mm f/2.8 wide open. I used this lens over my 8mm f/3.5 Fish-Eye to save the distorting effects of the latter for others projects.

Shades of magenta were produced by 2 PAR-56 LED cans (controlled in DMX with QLC). I did not initially planned to bring them, but they were lying in the trunk of my car and I never filmed them, so I took the opportunity. Unfortunately, as you can see in the video, the frequency of the PWM that is driving the LEDs is not high enough and generate ugly flickers.

ISO was set to auto as the lighting conditions were really messy. A quick test in the darkest area of the room showed me that ISOs were pushed too high, increasing the noise too much. I avoided this issue by mounting an HDV-Z96 LED light with its CTO diffuser filter, and carefully set its light level (around 60%):

According EXIF data, ISO did not get over 2500 with this method, and was measured at 5000 in the darkest place. Average seems to be around 600. But take these numbers with a big grain of salt as I have no better sources than the .THM preview files generated by the camera for each .MOV clip.

Meta-data also tells me that the white balance was set to auto at 2900K but I remember having set it manually to keep consist images colors. Always according EXIF, color profile was set to standard.

Finally, I created the title cards in Gimp and edited the video in Kdenlive (on Kubuntu 11.04):

And two weeks after releasing Nichrome’s preview video, I edited another one with all left-overs. Here are the outtakes (which may not be as funny to you as for a French-speaking person, sorry):

GPG commands

  • Generate a key (interactive mode):
    gpg --gen-key
    
  • You can use the key generator in an unattended mode. Values in the example below are the same as the defaults proposed in the interactive mode above. Parameters in comments are there for reference:
    gpg --gen-key --batch <<EOF
    Key-Type: RSA
    Key-Length: 2048
    Subkey-Type: RSA
    Subkey-Length: 2048
    Expire-Date: 0
    Name-Real: Kevin
    # Name-Email: kevin@deldycke.com
    # Name-Comment: My auto-generated key
    # Passphrase: my_secret_passphrase
    EOF
    
  • List available keys for the current user:
    gpg --list-keys
    
  • Decrypt a file:
    gpg --decrypt archive.001.tar.gpg --output archive.001.tar
    
  • Same as above but for a collection of files:
    gpg --multifile --decrypt archive.*.tar.gpg