Setting up google calendar with Kontact (or korganiser) using akonadi

It used to be a real pain to try and get google calendar working with kontact/korganiser, however now it is very simple. I have also provided a screenshot walk-through to aide the process.

Just install akonadi-kde-resource-googledata using your package manager or in the terminal with:

sudo apt-get install akonadi-kde-resource-googledata

This will install support of google calendar and google contacts into akonadi. If you’ve not heard of akonadi before, it is a backend that manages communications and protocols. So rather than having developers of separate applications working on the same thing rewriting code that does the same thing they can simply plug into akonadi. Kontact/korganiser can load can load from an akonadi resource:

(see below for walkthough with screenshots)

  • Right Click on calendars and click add resource
  • Select akonadi
  • Click Manage Calendar Sources
  • Click add
  • Select Akonadi Google Calendar Resource
  • Enter your email and password and select ok
  • Your calendar should now sync and appear in korganiser

Screenshot Walkthrough

  • Right Click on calendars and click add resource
  • Google Caldendar integration with Kontact Korganiser 1

    Google Caldendar integration with Kontact Korganiser 1

  • Select akonadi
  • Google Caldendar integration with Kontact Korganiser 2

    Google Caldendar integration with Kontact Korganiser 2

  • Click Manage Calendar Sources
  • Google Caldendar integration with Kontact Korganiser 3

    Google Caldendar integration with Kontact Korganiser 3

  • Click add
  • Google Caldendar integration with Kontact Korganiser 4

    Google Caldendar integration with Kontact Korganiser 4

  • Select Akonadi Google Calendar Resource
  • Google Caldendar integration with Kontact Korganiser 5

    Google Caldendar integration with Kontact Korganiser 5

  • Enter your email and password and select ok
  • Google Caldendar integration with Kontact Korganiser 6

    Google Caldendar integration with Kontact Korganiser 6

  • Your calendar should now sync and appear in korganiser
  • Google Caldendar integration with Kontact Korganiser 7

    Google Caldendar integration with Kontact Korganiser 7

    Read More

    Utilising the notification system in KDE or Gnome in bash scripts (ubuntu 9.10 / linux)

    So you want to use the nice notification features available in your desktop environment (KDE or Gnome) from a script you wrote? Below explains how to do just that for the two different environments.


    The code below will use kdialog (should be installed along with kde) to create a popup message that displays for 3 seconds before closing:

    kdialog --passivepopup 'notification message!' 3

    This should look like the image below:

    kdialog passive popup notification

    kdialog passive popup notification

    Source: stackoverflow


    A similar tool is available for gnome, but to the best of my knowledge (I don’t really use gnome) you need to install a package. The libnotify-

    sudo apt-get install libnotify-bin

    The command notify-send can then be used to create notifications from your script.

    notify-send -t 3000 "notification title" "notification text"

    Where 3000 is the timeout in milliseconds (so 3 seconds). notify-send features some nice additional options such as the ability to include images eg:

    notify-send -i /home/user/exampleicon.png -t 3000 "notification title" "notification text"

    Source: Coder’s Talk

    Read More

    Android: Using SVN with your app’s project (and eclipse)

    When creating any non-trivial program using a versioning system is essential, especially when working in part of a group. This guide aims to be a quick tutorial to the SVN (subversion) tool for versioning and how to use it with an android project.


    • You will need SVN installed on your computer. This can be done using your package manager or by the following command in ubuntu / debian based systems:

      sudo apt-get install subversion
    • You already have an SVN repository configured. If not please view a tutorial like this or if you have a nice webhost like me (thanks dreamhost 😛 ) there may be a simple tool to do this automatically for you in your panel.

    Don’t include the files inside /bin or /gen as they are just build from the source code and will simply fill up a lot space in your SVN. But do include the folders themselves as the project will fail to build without them.

    Command line (recommended)
    For SVN, I am a great fan of the command line. From the few SVN GUI applications that I have used in the past I can recommend Turtoise SVN for windows and kdesvn for linux (kde) but I still prefer the command line.

    The following code will checkout the project from your server. This will create a new folder called “projectname” on your computer and download the project from your server (at this point it is most likely an empty folder).

    # Checkout the SVN directory
    svn co projectname

    You can then copy or create your android project in this directory. In our project folder there are two folders which contain generated files (as opposed to source files) there is no point uploading these to the svn as you will simply take up space and bandwidth. Before you decided to upload your changes to the server you should empty the bin and gen folders:

    # Empty bin and gen folders
    rm -rf ./projectname/bin/*
    rm -rf ./projectname/gen/*

    Each time you add a new file to the project you will need to add (`svn add filename` for single files or `svn add *` for all files):

    # Tell SVN we want to be versioning these files
    svn add projectname/*

    When you are happy with your changes you can commit (`svn commit -m “message”`) your changes to the svn to create a new version, it is mandatory to include a message with each revision and it is best to be as detailed as possible with the changes made. This makes it much easier to hunt down where a bug or regression was introduced.

    # Save the changes and upload to repository
    svn commit -m "Initial import of projectname"

    Each time you commit or wish to upgrade what is stored locally to the latest version on the server you need to use the following:

    # Update the locally stored version
    svn update projectname

    Further points
    Eclipse has a plugin to manage SVN download and install instructions can be found here.

    Read More

    Bash: Script to find active computers in a subnet using ping

    The following is a simple bash script that will scan each ip address in a give subnet and report if they are alive (or accepting ping requests). The code creates processes for each ping so that it completes quickly rather than scanning each ip address sequentially.

    Create a text file called “” and paste the following into it:

    : ${1?"Usage: $0 ip subnet to scan. eg '192.168.1.'"}
    for addr in `seq 0 1 255 `; do
    #   ( echo $subnet$addr)
    ( ping -c 3 -t 5 $subnet$addr > /dev/null && echo $subnet$addr is Alive ) &

    Save and close, then it can be called from the command line like so:

    sh 192.168.1.

    This will scan from to and will return something like the following: is Alive is Alive is Alive is Alive
    Read More

    Bash: Script to convert .flv to mp3

    Flash Video (.FLV) is currently a very popular format of online videos, inparticular youtube. This post explains how to use a simple script to extract the sound from a flash video file and turn it into an mp3.

    In order for the script to work you will need to download ffmpeg (to decode the video) and lame (to encode the mp3). This can be achieve in ubuntu by opening a terminal and running the following or alternatively you can use your package manager GUI to search and download the packages for you.

    sudo apt-get install ffmpeg lame

    You then need to create a new file named “” and paste the following into it using your preferred text editor (which hopefully isn’t VI). Save the file and then change the file permissions so that it is executable (by running:`chmod a+x` in the terminal or via the gui in you file browser)

    # this script should convert files from FLV to WAV and then to MP3
    echo " "
    echo "  Welcome to FLV to MP3 converter!  version 0.1"
    echo " "
    infile_name="[email protected]"
    # exit if the user did not enter anything:
    if [ -z "$infile_name" ]; then
        echo " "
        echo "You did not tell me the file name, so I will exit now."
        echo " "
    echo " "
    ffmpeg -i "$infile_name" -acodec pcm_s16le -ac 2 -ab 128k -vn -y "${infile_name%.flv}.wav"
    lame --preset cd "${infile_name%.flv}.wav" "${infile_name%.flv}.mp3"
    rm "${infile_name%.flv}.wav"
    echo " "
    echo "OK. I'm done! Have fun!"
    echo " "

    You should now be able to convert a flashvideo into an mp3 by running the following command (changing the filenames to fit your purpose):
    sh videofilename.flv

    Extra: Youtube
    In linux it might be worth noting that youtube downloads the flv’s to your /tmp folder and you can easily copy them or convert to mp3’s (Ensure video is completly finished loading).

    Also there is an application called ‘youtube-dl’ which can be installed from the repositories

    sudo apt-get install youtube-dl

    and then run using


    Of course it’s up to your moral guidance to decide what you can and can’t download.

    Read More

    Programming Android Apps: SDK and Eclipse (ubuntu)

    Android is a brilliant smart phone operating system, this is the start of a short series of guides for starting to program applications for it using the android SDK.

    Android SDK
    Download the android SDK

    Once downloaded untar the SDK

    tar xvzf android-sdk_r04-linux_86.tgz

    The SDK is not complete as additional files need to be downloaded in order to compile for different versions of android. Open the SDK and AVG management application by moving into the SDK folder and running the following.

    sh tools/android

    In the avaliable packages select the android versions you wish to develop for, and begin downloading them. Should this fail please read the next section, otherwise skip ahead.

    Failing to download
    If you cannot download from the google website, goto settings and select “force https://… source to be fetched using https://” and click save and apply.

    android force http

    forcing SDK and AVD manager http instead of https for android

    If this still does not work (as was the case for me) it is possible that for some reason a configuration file was not created for this program, this can be solved by creating it manually:

    echo sdkman.force.http=true > ~/.android/androidtool.cfg

    Creating Android Virtual Devices
    You can create virtual android phones using the SDK and AVD manager, click the Virtual Device tab and select new. Enter a name for the device, and a size for the sd card and simply click create AVD.

    android create avd

    creation of an android virtual device

    Once you’ve created you Virtual Device(s) it should look like the following:

    android avd's

    Android Virtual Devices

    You can test these virtual devices and see how nicely the phones are emulated. This is much more useful once you begin writing applications.

    Android virtual device

    Android Virtual Device in action


    I would highly recommend using eclipse as it, along with the android plugin, greatly simplifies production and testing of applications.

    Download eclipse from the ubuntu repositories (or from the eclipse website)

    sudo apt-get install eclipse

    If you do not already have java installed then you will need to install it.

    sudo apt-get install sun-java6-jdk sun-java6-jre

    You will need to add the following line to your .bashrc in your home folder so that the android tools can be used in eclipse (and other programs).

    export PATH=${PATH}:/home/user/android/sdk/tools

    * replace /home/user/android/sdk with the path to where you downloaded the SDK

    Installing the android plugin for eclipse
    Google’s eclipse plugin install guide.

    In eclipse goto help then Install new software and then add the google plugin url

    Install software

    Install new software in eclipse

    Then install Android DDMS and Android Development Tools.

    Should you receive errors (like I did) relating to a missing package you will need to add the eclipse repository and install the missing packages.

    You should then have a fully working eclipse with android plugin.

    Eclipse main window

    Eclipse main window

    What next?
    Now you should have everything setup in order to develop and android applications. I would recommend the google tutorials:

    Read More

    Partitions and disk space in linux

    I’m sure there are many ways to see the partitions and corresponding diskspace in linux, but here is the method I found:

    $df -m
    Filesystem 1M-blocks Used Available Use% Mounted on
    /dev/sda2 7513 5937 1576 80% /
    tmpfs 1005 0 1005 0% /lib/init/rw
    varrun 1005 1 1005 1% /var/run
    varlock 1005 0 1005 0% /var/lock
    udev 1005 1 1005 1% /dev
    tmpfs 1005 1 1005 1% /dev/shm
    /dev/sdc1 469453 353295 92311 80% /media/x
    /dev/sdd1 1408345 979205 429141 70% /media/z

    or visually:

    df -m screenshot

    I kept struggeling to remember what letters it was, as there are many two letter commands beginning with d in linux… (dc, dd, df, dh, do, dl, du). I now remember it, because ‘f’ is next to the ‘d’ key on my keyboard, and because df probably stands for disk-free.

    For more information check out this site

    Read More


    Using the free command gives output something like this (-m just tells free to output in megabytes):

    free -m
    total used free shared buffers cached
    Mem: 2013 1996 17 0 27 1381
    -/+ buffers/cache: 588 1425
    Swap: 956 0 956

    This is useful but annoying as it doesn’t show you how much memory is actually free. Files that are used are kept in the ram (referred to as caching). If the memory is needed it is simply overwritten, however if the file is used again it is already in the memory which saves time.

    I wrote a quick little bash line to get the actually memory in use or the actual memory free. I use grep to select the right line from the output of free, and then use awk to do the string manipulation and math.

    Memory in use

    free -m | grep Mem | awk ‘{x=$3-$7; print x}’

    Memory free

    free -m | grep Mem | awk ‘{x=$2-($3-$7); print x}’

    Read More

    apt – no public key error

    If you add a new repository to apt (/etc/apt/sources.list) you may get the following error when running ‘sudo apt-get update’:

    Reading package lists… Done
    W: There is no public key available for the following key IDs:
    W: You may want to run apt-get update to correct these problems

    As you probably already guessed, running ‘sudo apt-get update’ will result in exactly the same problem. This is because the new repository’s key needs to verified. This is done by the following:

    gpg –keyserver –recv [Key]
    gpg –export [Key] | sudo apt-key add –

    replace [Key] with the key you want to add

    This can also be made slightly easier by using a bash variable:

    gpg –keyserver –recv $1
    gpg –export $1 | sudo apt-key add –

    replace [Key] with the key you want to add

    or as a bash script:

    gpg –keyserver –recv $1
    gpg –export $1 | sudo apt-key add –

    ran by the following:

    ./key [key]

    replace [Key] with the key you want to add
    which then you could place in /bin so you could simply run

    Script can be downloaded here

    Read More