Moving my WordPress blog to Heroku (and Amazon S3)

Knowing that there are plenty of pages out there to walk you through the exact same thing, I won’t make this guide too long: only five steps, with some bullet points for future reference.

1. Create a Heroku project

  • Create an empty folder, locate it in Terminal and:
    $ git init
    $ git add .
    $ git commit -m "init"
    $ heroku create
  • Setup the name of the Heroku app and make your domain point to it
  • Add a ClearDB database to this Heroku project

2. Make a copy of your WordPress site

  • Download all WordPress files and copy them to the Heroku project’s folder
  • Create a dump of the database (the easiest way is to use this WordPress backup plugin)
  • In the Heroku project, make sure all domain values in the files’ content point to the right address. I had quite a few ‘hardcoded’ values in the footer still pointing to wimagguc.hu – a quick search and replace on all textual files took care of this.
  • Pro tip: if you had a .htaccess file, make sure to copy that as well

3. Migrate your database to ClearDB

  • Connect to ClearDB via MySQL Workbench (or a similar tool), and import the SQL dump you created in step 2.
  • Your articles and settings will still point to your old domain. Fix these with three simple updates:

    UPDATE PREFIX_wp_options SET option_value = replace(option_value, 'www.OLD-DOMAIN.com', 'www.NEW-COMAIN.com') WHERE option_name = 'home' OR option_name = 'siteurl';
    UPDATE PREFIX_wp_posts SET guid = replace(guid, 'www.OLD-DOMAIN.com','www.NEW-COMAIN.com');
    UPDATE PREFIX_wp_posts SET post_content = replace(post_content, 'www.OLD-DOMAIN.com', 'www.NEW-COMAIN.com');
  • Edit your wp-config.php:
    $db = parse_url($_SERVER["CLEARDB_DATABASE_URL"]);
    define("DB_NAME", trim($db["path"],"/"));
    define("DB_USER", $db["user"]);
    define("DB_PASSWORD", $db["pass"]);
    define("DB_HOST", $db["host"]);

4. Make The Heroku project run locally

  • (Now this step is far from mandatory, but I find it easier to add plugins and double check everything on localhost.)
  • You probably have your xAMP environment set up already. So did I, and therefore all I needed to do was to:
  • Set the CLEARDB_DATABASE_URL variable to whatever URI “heroku config | CLEARDB_DATABASE_URL” displays
  • Create a symlink to your apache document root: “ln -s /Users/wimagguc/heroku-wordpress-folder/ /var/www/heroku-wordpress-test”

5. Add S3 to handle file uploads

  • The best practice is to keep dynamic file content off from Heroku: in case you have multiple instances running, files uploaded to one dyno might be missing from other ones. Keeping all uploaded files on Amazon S3 is one way to solve this problem.
  • Go to amazonaws.com and register for Simple Storage Service (now there is a free usage tier for the first year!)
  • On the S3 console, create a bucket for your blog
  • Get the login credentials from Amazon
  • Install this great S3 for WordPress plugin and set it up to use with your bucket

Further reading:

j j j

Why does Android look dodgy?

As much Android deserves the love for the great freedom it gives to its users (try to install a file manager to your stock iPhone or copy music to a friend’s computer), the user interface is just not there. They surely have put a lot of effort into Jelly Beans, but the devil is in the details. Look at these widgets, for example.

Android widgets: power control, music and weather
different colors, sizes, outer glow – on stock elements

In every operating system, at least the stock widgets should look alike – but, to mention just a few flaws, the three main widgets (power control, music and weather add-ons) are different in size, colors and they use different spacers between the buttons. The widgets coming from 3rd party developers in Google Play are not much help either: even the ones that claim support for the stock Ice Cream Sandwich are missing the guidelines with a mile or two.

Maybe Google’s development teams don’t work together very well. Maybe the UI teams’ quality assurance is missing. Maybe they just don’t care, because manufacturers like Samsung, Motorola and HTC have their own design tweaks anyway.

Either way, in 2012, the pixel-perfect paradise is not here yet.

j j j

Silly season

Almost only tech magazines and marketing bloggers keep filling up my RSS reader – this is the time of year when one better reads books than news: the silly season.

The US expression refers better to the fact that during these few weeks in the end of Summer, not many important things are happening out there: in the “slow news season” the Parliament, the courts – and actually almost everyone – is spending holidays.

Here in Germany, the name of the silly season is “Saure-Gurken-Zeit”, which would be something like cucumber-time or pickles-time in English. This expression originally referred to the time of year when only a few types of food is available – a great metafore to the lack of newsworthy.

j j j

Prisoner’s dilemma: want to win?

Princeton University mathematicians discovered a previously unknown strategy for the prisoner’s dilemma, which guarantees one player a better outcome than the other. As the game has been widely used to understand to situations like the climate change negotiations or the Cold War, the new findings will surely rise a couple of questions.

That’s a monumental surprise. Theorists have studied Prisoner’s Dilemma for decades, using it as a model for the emergence of co-operation in nature. This work has had a profound impact on disciplines such as economics, evolutionary biology and, of course, game theory itself. The new result will have impact in all these areas and more. — Technology Review

Much more information in the paper: Iterated Prisoner’s Dilemma contains strategies that dominate any evolutionary opponent

j j j

London Eye will be lit up by Olympic tweets

One of London’s most important landmarks got a spectacular decoration for the Olympics from EDF Energy: the lights will change their color according to tweets sent with the hash tag #Energy2012.


Lightshow and more info on edfenergy.com

The company developed an algorithm that filters tweets, and the more positive tweeps are, the more lights on the wheel will be lit. The highs and lows of the day’s major sport events, together with Twitter results will be displayed every night in form of a lightshow, between 9pm and 10pm on the EDF Energy London Eye.

j j j

Timelapse layer for Google Earth

To celebrate Landsat’s 40th birthday, Google made available a bunch of timelapse videos about Earth’s surface. With that, can watch the globe change over the last decade: the growing Las Vegas, the deforestation of the Amazon or the Aral Sea drying out. Amazing pictures and some food for thought.


more info and videos on Google Earth Engine

Google Earth Engine brings together the world’s satellite imagery — trillions of scientific measurements dating back almost 40 years — and makes it available online with tools for scientists, independent researchers, and nations to mine this massive warehouse of data to detect changes, map trends and quantify differences on the Earth’s surface. Applications include: detecting deforestation, classifying land cover, estimating forest biomass and carbon, and mapping the world’s roadless areas.

via 9to5Google

j j j

Evolution of the F1 Car

An animated timeline of all F1 seasons from 1950 to 2012, created by Rufus Blacklock. If you don’t like motorsports but have an eye for graphic design, you will still love this video.

Evolution of the F1 Car from Ruf Blacklock on Vimeo.

More infographics available on Rufus’s blog at biplaneblues.blogspot.de, as well as a list of sites that featured the video: among others it’s Engadget, Autoweek – and probably many, many more. Another reason to aim for the highest quality you can do.

j j j

Inspiration: Indie Game – the Movie

The first rule for using my computer was, not to play games. A bit later, to play only with those I wrote. Of course I cheated from time to time, but at least I had a few goes making them – only to gain enough experience to know that this is an extremely hard thing to do. Maybe this is why watching Indie Game – the Movie was so catching, but nevertheless, it’s great fun to watch these guys sweating blood and tears for success.

First-time filmmaking duo Lisanne Pajot and James Swirsky capture the emotional journey of these meticulously obsessive artists who devote their lives to their interactive art. Four developers, three games, and one ultimate goal – to express oneself through a video game.

You can watch the whole movie online at indiegamethemovie.com.

(In the meantime I get off the shelf my most recent game loop. Muwhahaha!)

j j j

The first iPad – from 2002

As a result of Apple’s recent patent wars we can see now some pictures about the first iPad prototype as it looked in 2002. A piece of history, and also a chance to see how an idea develops into a product before it finally reaches the market – in about a decade.


iPad then and now – more from the old video on NetworkWorld

“I’ll tell you a secret. It began with the tablet. I had this idea about having a glass display, a multitouch display you could type on with your fingers. I asked our people about it. And six months later, they came back with this amazing display. And I gave it to one of our really brilliant UI guys. He got [rubber band] scrolling working and some other things, and I thought, ‘my God, we can build a phone with this!’ So we put the tablet aside, and we went to work on the iPhone.” — Steve Jobs in 2010, at the All Things Digital conference

As for the patent war, I hope that brilliant minds keep chasing their ideas – and don’t mind that others use those to make their own products. In the end, being the only one in the market can be good from the business perspective, but having competitors moves the world forward in a much higher peak. A proof: Apple worked on the iPad for 10 years – for Asus, Acer, Samsung and others it took only a few to catch up.

j j j

Phones and updates

These are the best times for smartphone users: the choice on the market is beyond imagination, operating system vendors go crazy with their innovations and device manufacturers break their legs to deliver the newest updates for the devices. Or are they? I quickly collected some data about software updates to figure whether Apple, Google or Microsoft spoils their users the most.


Android, Windows, iOS – stunning looking UIs

Windows (Microsoft)

It’s certainly not Microsoft that has the happiest users nowadays: according to recent news, regardless of the fact that the Nokia Lumia phones are only 1.5 years old, they won’t be updated to Windows 8 – ever. And if this is not enough, there is an even bitterer pill to take: the apps written for the new OS won’t run on the “old” devices.

Microsoft has a good enough excuse for this, as they rewrote Windows from ground zero. It’s hardly satisfactory for the users though, especially those who bought the devices just now: they feel like Microsoft owns them at least an apology for knowing this all along – but deciding to be silent about it.

Android (Google)

If Windows users are unhappy, it’s because they have never waited for an Android update. Although Google is rolling out updates in a pace no one has seen before, hardware manufacturers are unable to keep up with them. The main reason for rolling out their own versions is that they want to differentiate their products on the market; for HTC for example, Sense is still a strong selling point.

Cold comfort it is for the ones with an abandoned device – some of which never actually had an up-to-date operating system. The Understatement blog has a list of the devices and their software updates from last year, and the picture probably even worsened since: only around 10% of current devices updated to even Ice Cream Sandwich yet, the one before Android version – which came out end of last year.

iOS (Apple)

For now it seems that iPhone users are the luckiest of them all, as Apple still sells the iPhone 3GS, a device that came out three years ago. Compared to Android or Windows phones, it might be true: even those ancient phones will be able to be updated to iOS 6, Apple’s new operating system introduced last month.

The future is not so bright though: while the operating system and the new UI shine is coming to all devices, some features will be missing on some older iPhones. According to the iOS 6 teaser page – among others – turn-by-turn navigation, Siri, FaceTime will be available only on iPhone 4S – and so it will be exclusive to the latest devices. The iPhone 3GS seemingly leaves out of almost everything.

Well, having the new Maps app is still better than nothing.

With all that, based on the updates only, if I would buy a new phone now I would consider offers in this order:

1. Android (Nexus devices only)
2. iPhone
3. Android devices from other manufacturers
4. Windows 8 phones

j j j