Archive for April, 2008

Installing Joomla! on your Nokia phone

Tuesday, April 15th, 2008

With its PAMP (Personal AMP - Apache, MySQL and PHP) for S60 project Nokia has made it possible to install nearly all web based systems created for the popular trio Apache, MySQL and PHP. Here I will show how you can use it to install the content management system Joomla!, http://www.joomla.org, to your phone. (Note that currently only Nokia N95 8GB and E90 phones are supported)

1. Point your phone to http://download.mymobilesite.net, download and install the client, then create an account to the MWS using the software.

2. Next go to http://sourceforge.net/projects/pamp and download the PAMP install (using your PC). Follow the guidelines here for installing, http://wiki.opensource.nokia.com/projects/PAMP:Installation.

3. When everything is installed the next step is to get your phone available  through the public internet. In order  to do that simply start MWS and then PAMP (http://wiki.opensource.nokia.com/projects/PAMP:Connectivity, under the title MWS Gateway)

4. Now you should be able to access https://youraccount.mymobilesite.net/ and see

It works!

Next you can try phpinfo.php.

If that works, then you are all set for installing your favourite CMS!

These ones have been tried:

5. Next step is to create a database for joomla on your phone, there are two ways to do that

You need the MySQL command line tool installed on your PC if you don’t have it download it from http://www.mysql.com, then open your cmd promt and type

mysql -h address
Where address is the IP address of your phone on your WLAN, then create teh database with
mysql> create database joomla;

Query OK, 1 row affected (0.09 sec)

6. Next go to http://www.joomla.org and download the latest release, unzip the archive and copy it to your phones htdocs folder
Nokia Phone Browser\Nokia N95 8GB\Memory Card\Data\apache\htdocs
using Nokia PC suite

7. Next delete index.html from your phones htdocs folder

8. Next open http://YOURPHONESIPADDRESS/ and start the Joomla installation

9. When you reach the database configuration enter

Host Name: 127.0.0.1 (not localhost)

MySQL User Name: dummy

MySQL Password: dummy

MySQL Database Name: joomla

10. Proceed until you reach step 3, then change URL to https://YOURACCOUNT.mymobilesite.net, provide a email address and choose a password.

11. Now delete the installation folder from htdocs

12. Go to https://YOURACCOUNT.mymobilesite.net, you should see the joomla front end :)

PyS60 using appuifw from a non UI thread

Sunday, April 6th, 2008

PyS60 scripts that are running in a non UI thread have the limitation that they can not use the appuifw library to do GUI task. Trying to importing appuifw will result in the following error:

ImportError: No module named _appuifw

This can be a limitation when there is a need to have a application running as a server interact with the user. I encountered this while working with the mobile web server and wanted to display a simple message to the phone user.

The solution is to create a standalone PyS60 application and let the server thread application/script execute it through e32.start_exe() call.

I have created a generic application for this purpose that I call pyLaunch and can be easily extended for this purpose.

You can download it here, pyLaunch.

Install pyLaunch.sis on your phone to the c: drive, the application should appear in the Application menu.

Copy the file pylaunchlib.py into e:\python\lib or c:\python\lib (or any other directory that you are sure is in the python path)

pylaunchlib.py can be extended as needed, just create a new function implementing what ever you want to do and then register it in the getFunctionMap function with
funcmap = {’displayMessage’ : self.displayMessage, ‘yourfunctionname’ : self.yourfunctionname}
Yes this could probably be made a little more sophisticated ;)

Now from the script running in the server thread you can successfully execute your function with
f = open( ‘c:\\commands_file.txt’,'w’ )
f.write(’yourfunctionname:param1;param2;param3\n’)
f.close()
   
e32.start_exe(u’c:\\sys\\bin\\pyLaunch_0xe8f72d57.exe’,”)

e32.star_exe will fire up pyLaunch in a separate thread (UI thread) that will read the commands_file extract the function name and parameters and make the appropriate call.

I initially tried to use e32.start_exe to pass the parameters with
e32.start_exe(u’c:\\sys\\bin\\pyLaunch_0xe8f72d57.exe’,'yourfunctionname param1 param2 param3′)
but I was not successfull in reading the parameters in pyLaunch. I therefore went for a file based approach to transfer the parameters, another possible approach could be to use sockets between the two applications.

The reason the application has to be started with the name pyLaunch_0xe8f72d57.exe is that I used ensymble to create the sis packet and it adds the UID in between the application name and ending in this case the auto-generated test UID 0xe8f72d57. When creating a new sis packet the appropriate UID will have to be used.

Since I consider my self a Python and S60 beginner all comments on improvements would be very nice.