Wednesday, December 14, 2011

Installing Gearman on Ubuntu 10.04

This is a quick guide on how to install Gearman on Ubuntu 10.04 LTS.

I found numerous guides online, but none of them seems to do the complete trick for me. I know most installations are different from each other, so that is probably the reason why non of them worked on my setup. So here is my addition to the list of Gearman install guides.

  1. The first thing you need to do is to find a PPA repository with an updated version of Gearman. The one bundled in Ubuntu by default is very old. The only reasonable up to date repository I could find is

    https://launchpad.net/~gearman-developers/+archive/ppa

  2. If you do not have the add-apt-repository command installed, you have to install it

    $ sudo apt-get install python-software-properties

  3. Now you can add the repository by issuing the following command

    $ sudo add-apt-repository ppa:gearman-developers/ppa

  4. After adding the repository, you should update the package list

    $ sudo apt-get update

  5. Now you can install the latest version of Gearman

    $ sudo apt-get install gearman gearman-job-server gearman-tools libgearman4 libgearman-dev

    Please note that as of December 2011 the latest update to the repository was in May 2011 with Gearman version 0.14.
  6. You are now free to install Gearman extension to whatever language  you like. Most requirements should be covered by the above mentioned packages.
    You can start the Gearman job server by the following comand

    $ gearman -d
References

Wednesday, September 7, 2011

Sticky session on Linux

Today i stumbled upon the slides from a talk given at Confoo 2011 by Sean Coates called "Fifty Tips, Tricks and Tools ...in one talk". Most of the stuff was not new to me, but still informative. But slide 56 gave a very usefull snippet "Sticky shell start", which allows you to login and be placed where the last shell operated.

You should place the following snippit in your ~/.bashrc or ~/.profile

cd () { builtin cd "$@" ; pwd > ~/.pwd ; }
cd "`cat ~/.pwd`"  

To me this is very usefull since i often jump between different servers and often need to go to the same place every time. so this saves me a lot of typing.

Tuesday, August 16, 2011

Quick tip: Save without permissions in VIM

Like many others I use VIM for my daily work. And like many others I often forget to open files with the right permissions (i.e. sudo vim ...).

To save a file that you need special permissions for, do the following:

:w !sudo tee %

this will allow you to save the file even though you do not have the right permissions (You need to have sudo rights of course).

More tips can be found here.

Friday, March 18, 2011

Edit existing SVN commit messages

I tend to forget things easily and for that reason I often go to my trusted old friend, Google to find stuff. But at times this can be cumbersome since Google results tend to be very cluttered, especially when trying to find tech stuff.

So I took up the advice of @lornajane and write down my finding i my blog, mainly because it is easier to find it again. And "Yes", I will forget it again and I will have to find the stuff again.

Sometimes the fingers work quicker than the brain and the eyes. I my case this often shows in log messages when committing new code. So here it is. If you want to change an exsisting commit message, use the command below.

svn propset -r N --revprop svn:log "new log message" URL

N is the revision number and URL are the repository URL to the fil you changed.

NOTE you need to be administrator of the repository, in order for this to work. I mainly use Google Code for hosting code and if you are the repo owner, you are the administrator.

The above example where found here.

Friday, January 14, 2011

Navigating BASH history

Today I came across this blog post by @lornajane describing how to navigate your BASH history using Ctrl-r. I have used this functionality in the past, as it is very useful when trying to find past commands or for doing repetitive tasks with small modifications that are to small to be automated. But when working in the terminal all day, I find this approach a bit to inconvenient, i.e. I have to think to much ;-)

So I have switch to another approach which works a lot better for me. I use the up and down keys for searching back and forwards in my BASH history. I have added the following to my .bash_profile:

# make bash autocomplete with up arrow
bind '"\e[A":history-search-backward'
bind '"\e[B":history-search-forward'

This enables me to quickly "auto complete" the commands I am typing. Although this approach has some drawbacks as well. If you have pressed the up or down key, you wont be able to further narrow your search. For me this is not a problem, since most of the time I only need to go back a few commands in the history, so a small narrowing of the suggestions are fine for my needs. But if you need to search further back in your history or not quite sure what you are actually looking for the Ctrl-r approach will probably be better for you.