Shishen Sho compiled for N900

I’ve recalled about my old Shishen Sho game, originally developed for N810 (Maemo4) and I was wondering if it would compile for N900 (Maemo5). Well, after some minor corrections to make it work in a more recent version of Vala, it compiled. You can downloaded it here:

https://garage.maemo.org/frs/download.php/7573/shishensho_0.3.1-maemo5_armel.deb

Disclaimer: It’s compiled “as is”, with no adaption for sliding menus, no new hardware keys and no new fancy features. It just works and will let you have a good time while waiting for the bus.

Connecting a laptop to the internet with Yoigo trough N900 using bluetooth

Some simple steps to do tethering over bluetooth to connect to Yoigo Spanish carrier:

  1. Enable the Maemo Extras-devel catalog (URL: http://repository.maemo.org/extras-devel, Distribution: fremantle, Components: free non-free) and install “Bluetooth Dial-up Networking”.
  2. In your computer, edit /etc/bluetooth/rfcomm.conf to look like this, but using your own bluetooth device address (use hcitool scan from your laptop to get it):
    rfcomm1 {
            # Automatically bind the device at startup
            bind yes;                                 
    
            # Bluetooth address of the device
            device 00:11:22:33:44:55         
    
            # RFCOMM channel for the connection
            channel 2;                         
    
            # Description of the connection
            comment "N900";
    }
    

    Channels 1 and 3 are also available and can be defined as rfcomm0 and rfcomm2, but the scope of that is out of this post.

  3. Now edit the file /home/youruser/.wvdialrc in your laptop (using your own username) to look like this:
    [Dialer YoigoBT]
    init1 = AT+CGDCONT=1,"IP","internet"
    Username = ''
    Password = ''
    Modem = /dev/rfcomm1
    Phone = *99#
    

To connect to the internet, simply open a terminal and type:

sudo wvdial YoigoBT

To disconnect, just press CTRL+c and it’s done.

Thanks to this post, which was used as a reference on how to connect using Nokia devices.

Simple HTTP server in Python

Reading blog comments about Meiga out there, I’ve found one particularly interesting. Python has an embedded HTTP server that can serve the current directory from a given port. It can be instanced for port 8282 simply issuing this command:

  python -m SimpleHTTPServer 8282

The funny thing is that… it works on the N810 also!

More info about SimpleHTTPServer here.

A safe upgrade to Diablo

At the end, Maemo Diablo release for N810 is out. But if you have valuable information, programs or configuration on it maybe you’re worried about what you’ll loose in a reflashing. In fact, if you’ve done the upgrade yet you’ll notice that the main part of the apps from Extras repository are missing in Diablo for the moment. Fortunately, there’s a way to install the apps from the old Chinook repository.

Here are six simple steps to perform the upgrade process and restore all your current applications:

  1. Backup your /home/user to a safe place by hand. Standard backup tool won’t
    backup every file you’ve at home and maybe you could need them later…
  2. Do a backup using the backup tool.
  3. Reflash the device with the new image using the flasher tool according to the reflashing instructions
  4. Restore the backup. Some old apps will remain grayshaded because the backup
    tool can’t find them in the now current Diablo repository.
  5. Open Application Manager. Menu, tools, application catalog. Maemo Extras,
    edit. Distribution: chinook, uncheck the “disabled” checkbox, Accept. Close.
  6. Menu, tools, restore applications. Accept.

That’s all. Enjoy your updated device!

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?).

Shishen Sho Mahjongg for Gtk and Maemo

Shishen Sho Mahjongg is a board game similar to Mahjongg. The goal is to remove all the tile pairs. Two tiles can be removed if a line with a maximum of three segments can be drawn between them.

Both the idea and the tile images were taken from kshishen (Shishen Sho 1.5.1), from the package kdegames, which is (C) 1997, Mario Weilguni and distributed under GPL license.

My girlfriend and me are fans of kshishen, so I needed to make a Maemo version to let her play on the N810 internet tablet, free my laptop and let me work on it. O:-)

The game is written in Vala and licensed under the GPL. Vala is a programming language that produces C/GObject source code which can also be compiled independently without the need of the original Vala compiler. Currently, two platforms are supported for the game: i386 (a desktop distribution, eg: Ubuntu Feisty), and also Maemo platform (armel).

21/04/2008 UPDATE: New version 0.1.1 available. Features improved compilation scripts, improved debian package structure and proper installation support from Maemo application manager.

Feel free to send me your comments, suggestions or patches over the original Vala sources. I hope you enjoy the game as much as I enjoyed writing it. 😀