Blog on WordPress using Sublime Text

Since I moved to a Mac, I started feeling a strange lack of freely available software for things I took granted on Linux(or Windows). Lets face it, OSX offers little choice in terms of software powertools. I was looking for a wordpress client for Mac and all I could find was very costly alternatives will even less functionality as their opensource Linux counterparts. As I spent quite a lot of time on Sublime text, I thought of exploring Sublime as a blog client. I stumbled upon Sublpress. If you are familiar with Sublime Text, you will already be using its excellent Package Manager. Installing Sublpress using the package manager is super-easy.

Open the command palette in Sublime Text and search for Package Control’s “Install Package” command. From there you should be able to search for “Sublpress” and have it automatically installed.

Once you have Sublpress installed, open sublime text command palette (CMD+Shift+P) and type WP: Manage Sites. A blank configuration file will be created for you where you can enter your wordpress credentials and type WP: Connect to Site. It’s that easy. Happy blogging.

How to recover your wordpress blog on heroku after recent upgrade

Recently heroku upgraded and migrated their postgres database to a different stack – unfortunately that broke wordpress blogs hosted on heroku. I wrote a detailed article on how to host your wordpress blog on heroku some time back – I found a few very useful wordpress bootstraps for heroku. After the recent upgrade, all the wp-config settings were invalidated and your wordpress blog could not connect to the database. There are two things to notice :

  • Your database is safe – its just moved and renamed
  • You need to edit your wp-config to change the db settings to the migrated database

But, where on earth is my wp-config.php ? If you are like me, you dont have the original copy which you used to create your blog in the first place. Many of you might not have hosted that wordpress installation on github. So how to update the wp-config ?

Trick is to know that heroku internally has a github link to every app it hosts. You will need to find which github repo heroku is internally linking your application to and you will need to find the modified database name, username, password and host.

  • Finding github repo for your app is easy. Login to heroku and click on the app that is used to host your blog.
  • Check the ‘Settings’ tab and you will find something like – Git URL:
  • <yourapp> is the actual name your app
  • Now head back to your terminal and clone this particular repo as follows
git clone -o heroku
Initialized empty Git repository in /Users/adam/facebook-template-php/.git/
remote: Counting objects: 273, done.
remote: Compressing objects: 100% (183/183), done.
remote: Total 273 (delta 2), reused 261 (delta 0)
Receiving objects: 100% (273/273), 25.55 KiB, done.
Resolving deltas: 100% (2/2), done.
  • Once your code is cloned locally, head over to ‘Resources’ tab and you will find a link to ‘Heroku Postgres Dev :: Cobalt’
  • Clicking on this link will show you a page where you will find the migrated DB name, username, password and host – Note these down
  • Head back to your local terminal and edit wp-config.php file and modify the following with the new values :
/** The name of the database for WordPress */
define('DB_NAME', 'new_value');
/** MySQL database username */
define('DB_USER', 'new_value');
/** MySQL database password */
define('DB_PASSWORD', 'new_value');
/** MySQL hostname */
define('DB_HOST', 'new_value');
  • Once you have updated wp-config.php with the modified values. Push it to heroku as follows:
$ git commit -am "changed greeting"
[master 0ff313a] changed greeting
1 files changed, 1 insertions(+), 1 deletions(-)
$ git push heroku

Thats it. Your modified settings are uploaded to heroku and your app is restarted.

Java's LinkedHashMap – demystified. Sort of.

A few days back I came across a problem : Design a system with following APIs :

  1. put(n) : Puts the value n
  2. get() : Gets the first added value

Obviously, this was a queue because we want get() operation to return the element added first. Here the order of adding elements is important. So far, things look good. We create a Queue using a doubly linked list with head and tail pointer so that get() and put(n) are both O(1) operations.

How about adding one more operation to this system? We want to add an API – removeElement(n) – that removes an element n from the queue in best possible time. Hmm, we have a problem. What options do we have ?

Continue reading Java's LinkedHashMap – demystified. Sort of.

rbenv and Passenger – not a good idea.

I read a lot of hype around how rbenv is the best thing since sliced-bread (RVM) – so on a fresh machine, I jumped ahead and installed rbenv instead of RVM – wow, and I loved it instantly. Setup was fast and nothing broke…umm, well not exactly.
I remembered that all my weekend hacks are hosted on servers crunching rubies out of RVM and I am still using Capistrano (with RVM integration) to remotely deploy my code.

Is there a way to use Capistrano with rbenv ? The problem is that passenger does not recognize rbenv’s rubies (check my stackoverflow – ) – so passenger can’t be spawned by nginx. I did not find any answers.
Finally, I removed rbenv and switched back to RVM (but not without problems).

One important thing to remember while installing RVM as root (you will be doing this on your own hosted machines) is that when you deploy your app with Capistrano, always add the following line to your deploy.rb file :

set :rvm_bin_path, “/usr/local/bin”

or you will hit – while doing cap deploy:setup.

Move icons from Message tray (bottom tray) to the Top Bar in Gnome shell

Some might find the notification area icons showing up in the Message Tray (at the bottom of the screen, hidden by default) annoying or confusing. But you can move the icon on the Top Bar using an extension:

sudo apt-get install git-core
git clone
sudo cp -r gnome-shell-gnome2-notifications/ /usr/share/gnome-shell/extensions/

Then press ALT + F2 and enter “r” to restart GNOME Shell.

Passenger can’t compile nginx module under Ubuntu 11.10 ?

Ah! another post discussing Ubuntu 11.10 breakage. It seems that you can’t compile nginx module on passenger if you are on Ubuntu 11.10.

The error is something like :

common/libpassenger_common.a(aggregate.o): undefined reference to symbol 'pow@@GLIBC_2.0'

After some internet search, I found the following solution. Go to directory :


(Your path may vary based on your installation).
Edit file : config and move the following block :

ngx_feature="Math library"
ngx_feature_test="pow(1, 2)"
. auto/feature
if [ $ngx_found = yes ]; then

after this block :

HTTP_MODULES="$HTTP_MODULES ngx_http_passenger_module"
-lstdc++ -lpthread"

Try recompiling nginx again by “passenger start” – see if it works. If you are curious on how this works, take a look at

VMPlayer not compiling for latest Linux kernel ?

I recently upgraded my kernel to and found VMPlayer failing to compile. After so much failed attempts to search over the internet, I failed to compile VMPlayer. VMWare has not provided any patches.

This article(see comment:56) is written for but works fine for newer kernals also.

$ lsb_release -rd
Description: Ubuntu oneiric (development branch)
Release: 11.10

$ uname -a
Linux myUBT 3.0.0-9-generic #15-Ubuntu SMP Tue Aug 30 15:03:37 UTC 2011 i686 i686 i386 GNU/Linux

Close VMware dialog from where you got the error. (no need to uninstall/remove VMware)

sudo -i
mkdir /tmp/vmware && cd /tmp/vmware
cp -R /usr/lib/vmware/modules/source/
cp -R /usr/lib/vmware/modules/source/ /tmp/vmware
cd /tmp/vmware/source
tar -jxvf vmware2.6.39patchv3.tar.bz2
for i in ./*.tar; do tar -xf $i; done
for i in ./*.tar; do mv $i $i.orginal; done
patch -t -f -p1 < vmware2.6.39fixedv3.patch
tar cf vmblock.tar vmblock-only
tar cf vmci.tar vmci-only
tar cf vmmon.tar vmmon-only
tar cf vmnet.tar vmnet-only
tar cf vsock.tar vsock-only
cp -vf *.tar /usr/lib/vmware/modules/source/

Run VMWare Player