How to send SMS in Linux using Skype

Skype for Linux doesn’t support SMS sending from the user interface. But that functionality is in fact implemented in the library and external apps can use it via the public API. I’ve found a working example of that nice feature. Just do these simple steps:

  1. Download Skype4Py from here, uncompress it and install it typing sudo python setup.py install
  2. Download Skype tools 0.11 from here and uncompress it
  3. Open your Skype client and prepare for the authorization dialog that will appear when you execute the next step
  4. Enter into the previous directory and send the SMS: ./send_sms.py +34123123456 My test sms

If the message takes too much to be sent, stop the app (CTRL+C), delete the authorization using the Skype options dialog, and try again. Third and next times worked fine for me.

Shishen Sho Mahjongg 0.3 released

Version 0.3 of Shishen Sho Mahjongg has just been released. The main improvements since 0.2 are: Gravity, hints, undo history, time counter and speed improvements.

You can download the game and know more about it visiting the project page at Maemo Garage.

Enjoy it!

Click here to install this application

28/05/2008 UPDATE: Now the application is also available in Maemo Extras repository and listed in Maemo Downloads with its own green “click to install” icon 🙂

Shishen Sho Mahjongg 0.2 released

Last month I published Shishen Sho Mahjongg for Gtk and Maemo, a board game similar to Mahjongg where the goal is to remove all the tile pairs and two tiles can be removed if a line with a maximum of three segments can be drawn between them.

Today I’m announcing version 0.2. The main improvements since 0.1.1 are Hildon integration (fullscreen, embedded menu, notifications) through conditional compilation and drawing of matching path when two pieces are matched.

You can download the game and know more about the project following these links:

Feel free to send me your comments, suggestions or patches over the original Vala sources.

Thank you! 🙂

Setting up Vala on Maemo and CPP integration

Until now, when I wanted to build some Vala source code for the Maemo platform I generated C code using the i386 Vala compiler and then builded the executable inside the scratchbox using gcc. That was fine until I wanted to use Hildon features (not available for i386). I definitely needed the Vala compiler running on the scratchbox.

This weekend I’ve put myself on the way and managed to compile Vala 0.3.2 on the scratchbox for the CHINOOK_ARMEL target. The process was much simpler than I expected and consisted of these few steps:

  1. Log into the scratchbox and choose CHINOOK_ARMEL
  2. Download the compiler from http://live.gnome.org/Vala/Release (I tried version 0.3.2)
  3. Untar it: tar jxvf vala-0.3.2.tar.bz2
  4. Enter the vala-0.3.2 directory and configure the package for ARMEL cross compiling: ./configure --host=armel
  5. Compile and install: make; make install

Alternately, to build for target CHINOOK_X86, repeat the previous steps but logged into the CHINOOK_X86 target. In step 3, issue ./configure without arguments instead.

That’s it. You have now the Vala compiler ready to be used. But if you want to develop a multiplatform project, you’ll need to avoid compilation of the Hildon related code when not building for Maemo target. The best way I found to do that was to use CPP as a preprocessor to allow me to use #ifdef’s in the code.

This is a simple way to use CPP to preprocess a single file:

cpp -P -Dsymbol1 -Dsymbol2 ... source.vala destination.vala

But I’ve managed to tweak my compilation script to preprocess all the files, write the result to a directory called CPP and finally compiling the result. Here’s the source:

# File compile.sh
export DEFINE=""
export APPNAME="myapp"
export PACKAGES="--thread --pkg gtk+-2.0 --pkg gdk-2.0 --pkg libglade-2.0 --pkg gmodule-2.0"

# Perform preprocessing and output to CPP directory
# Arguments to this script are "defined" and passed to CPP
for i in $@
do
 DEFINE="$DEFINE -D$i"
 case $i in
  MAEMO)
   PACKAGES="$PACKAGES --pkg hildon-1"
   ;;
 esac
done
if [ ! -d CPP ]; then mkdir CPP; fi
for f in *.vala; do cpp -P $DEFINE $f CPP/$f; done
valac $PACKAGES CPP/*.vala -o $APPNAME -X -g -X "-Wl,--export-dynamic -rdynamic"`
rm -rf CPP

The compile.sh script can be used by passing it the symbol set that should be defined. For instance, ./compile.sh MAEMO DEV would define both MAEMO and DEV symbols. Note that with this approach you should check the source files in the CPP directory when errors happen, because the line numbers referenced by the Vala compiler will be related to them and not to the original files.

I think this approach will be useful for other programmers too, so I’ve contributed it to the Vala FAQ (Does Vala have a preprocessor?).