Monday 18 February 2008

Automatic starting of collection program and transferring data to server

Worked on the project this morning, cleaned up some of the code so I could automatically start the collection program in inet.d. Now it just means I'll be collecting the data all the time the device is on really.


Next need to work on transferring the collected data to a database and GPS location extraction.

Update: Spent this evening on working transferring the data stored in SQLite database to a PostgreSQL server. The problem is that most python libraries are relying on the C bindings, and I could not get them to work on the Nokia tablet. I eventually stumbled onto pg8000 postgresql python library. After few stupid mistakes, I nearly got it to transfer the data, but I'm hitting a problem, which I think is a bug in pg8000.

I can transfer the data fine if I treat the lattitute and longitude as decimals(i.e loosing the precision, which is useless because lattitude 53, longitude -6 is just in the Irish sea close by to Dundalk. If I treat lattitude and longitude as a float, pg8000 basically crashes. Completely burned out now(its after 10pm and I have been looking at this since 5pm...)

Will try to debug this further or find another library/try to compile it on Nokia 770.

Update 20th Feb 08:

This morning I ended up getting PyGreSQL to work on the Nokia Tablets maemo platform. I had to compile the module on Scratchbox on my desktop at home, and then just transfer it to to tablet and it works (presumable because I have the C PostgreSQL bindings installed there). I simply just added the compiled .so module into the projects Subversion repository... Oh, had to fight with svn for a bit with mismatched checksums, took a while to fix, they happened because I have 3 or 4 places I develop (my desktop at home, my desktop/laptop/project pc with sshfs so I can edit the files on the device, my laptop and finally lab machine!) Hopefully will get a chance letter on to get the data transferring to work now that I should have a working postgresql python module!

Update 21st Feb 08:

Messed around with PyGreSQL this morning for a bit and got transferring of the data stored in SQLite database to PostgreSQL to work mostly:



Fairly fast on my desktop if I'm not printing out the values that I'm inserting. My guess is to transfer days of data on the actual Nokia tablet will take few seconds.

A problem that I'm encountering now is that some people have UTF8 characters on their phones, and I'm getting:

"sqlite3.OperationalError: Could not decode to UTF-8 column 'name' with text '���7�X�X�X�X�X�X�X�X�X�X�X�X�X�"

Error message. Will have to figure this out later.




No comments: