Akash Xavier RSS


About

Everything interesting that I come across in my life, I post it here.

Social
Feb
21st
Sat
permalink

ShoutJam: Welcome Ram Bhat !!!

ShoutJam’s now run by a small team of two.

I just found another guy excited about the idea I was working on. We had a small chat and boom, we are now working togther on ShoutJam.

Welcome Ram Bhat !!!

Apart from both of us being geeks, Ram and me work on different language stacks and hence have complimentary skillsets which we hope would get ShoutJam a long way. We met in college around 3 years back (yeah, we’ve known each other for sometime). So watch out for some action :)

Ram Bhat is on ShoutJam as ram

Akash Xavier as akash

Feb
19th
Thu
permalink

ShoutJam now stable

There was a technical fault in the ShoutJam system which prevented it from being active today morning. This was the same bug that caused the downtime yesterday.The problem has been corrected.

Feb
18th
Wed
permalink

Now tinkering with OpenStreetMaps, Gosmore and routing

I’ve got myself a new problem to solve, routing on maps based on live traffic data. Well, before that I’ve got to add new commands to ShoutJam.

Feb
11th
Wed
permalink

PyS60 Bluetooth stress tests

I’ve been testing my phone’s bluetooth connection to my PC.

Here’s my config: Nokia N70 phone programmed in PyS60, PC with Ubuntu Linux kernel 8.04, Bluez, PyBluez and programmed in Python. And my phone and PC are sending data almost every half second, so there’s no chance of a timeout due to idle connection.

Feb 9:

Connection lasts only for 20-30 minutes. After that the phone’s bluetooth isn’t detectable by the PC and the phone’s bluetooth has to be restarted.

Feb 10:

Conditions worsens after a workaround. The script on phone works fine only for around 10 minutes. Then a broken pipe error is returned. Bluetooth doesn’t require a restart as before but the script needs to be restarted. My battery is drained out quickly. No idea why. The same happens again during midnight.

Feb 11:

Phone fully charged up. Started phone and PC scripts at 7:45am. Connection surprisingly withstands until 10am. Received broken pipe error. Bluetooth needs restart again. Called up Nokia customer care. Reset the phone’s settings. Connection started again at 10:15am. Connection is again surpassing previous active connection time. It’s 1:30pm and connection is still on. It’s been around 3 hours. Battery usage is fine. Just 30% of the battery has been drained out since morning.

update: I shutdown the phone’s script manually at 2pm to recharge the phone’s battery. The script working for 4hrs approx is proof that it can manage the load. Looking forward for an error-free launch today evening.

Feb
8th
Sun
permalink

Workaround for PyS60: Sending SMS in a loop

It isn’t possible to send SMS in an iteration in PyS60 since the messaging.sms_send() will raise an error if the previous SMS isn’t sent (or failed to send). The PyS60 docs say that the state of the previous SMS can be determined by using the callback function as an argument in messaging.sms_send() and then checking the state of the SMS by testing with messaging.ESent, messaging.ESendFailed and other messaging.E* states.

When you want to send SMSes repeatedly in an iteration you’re stuck when it comes to determining whether the previous has been sent. So here’s a quick and easy workaround.

Use the try-except to detect errors and loop until the previous SMS has been sent.

permalink

Auto-Commit mode in Python-SQLite

I executed all the insert statements for SQLite in Python and was wondering why my database was empty when I queried it. This I did from my Python script.

I was scratching my head as to what’s wrong and then found out that the isolation_level must be set to None while connecting to the database like below

from pysqlite2 import dbapi2 as sqlite
connection = sqlite.connect(‘jaxfu.db’,isolation_level=None)
cursor = connection.cursor()
bla bla bla… here goes your code… :)

Now it should work fine!

Jan
31st
Sat
permalink

Bluetooth programming in Python

I have been tinkering with my bluetooth dongle and Nokia N70 phone trying to make a  connection between them in Python. N70 is a S60 phone and supports PyS60 a limited version of python (but cool).

I tried to setup Bluetooth stack on Windows XP, but my bluetooth dongle driver is BlueSoliel and the latest version is being sold at a price. The BlueSoleil SDK has C++ and C examples which I don’t understand much. Python modules for bluetooth on Windows is PyBluez. But it supports only the Microsoft Bluetooth stack and the Widcomm stack. So I booted my Kubuntu and used the PyBluez on it. It worked fine and detected my bluetooth dongle. I am now also able to discover devices. I also tried lightblue, which depends on PyBluez, OBEXopen and Bluez. But lightblue seems to have a problem with the lightblue.advertise() function which enables to advertise devices on the open network.

Just noted that the kbluetooth tool must not be running to get the connections working. I just tried to make connections and it used to fail. Even now I’ve not got a connection right, but I just moved a step forward. I now get the usual password box on my phone. I’m using the Nokia N70 phone as a server(listening to a port) and my computer as a client to push data.

Jan
20th
Tue
permalink

Compiling libfbml for Facebook Open Platform on Ubuntu

Heard a lot of people saying that this Facebook Open Platform’s libfbml compiles fine on Fedora Core 6 and CentOS, but since I favour Kubuntu for it’s ease of management, I decided to go with it. Follow the install procedures right and check the whether you’ve got all the dependency libs installed or else you will run into a lot of errors. I screwed up one ubuntu install and two kubuntu installs because of doing the wrong stuff.

I also tried installing Gentoo in-between and I didn’t even pass the Gentoo install. Gentoo seems to be for pros. So I got back on Kubuntu. The following install is done on Kubuntu 8.04. It should work on all Ubuntu flavours (and forks too).

This blogpost assumes you can manage to play around with the terminal and have a basic knowledge of vi too (if not just refer some online tutorial while you edit the file. It’s only a few keystrokes and fun). And you’ll have to be daredevil enough to perform some stunts like editing the /usr/include files and and do some rocknrolla. After all this blogpost will save you two days of time.

Copy the 14 downloaded packages as per the Facebook Open Platform release notes to the dependencies dir in the libfbml dir. Do not use any updated versions of those libraries. This way you’ll avoid a lot of problems.

Apart from those there are a few more things that should be checked.

  • libexpat1-dev
  • zlib1g-dev
  • g++ 4.2
  • libjpeg62-dev
  • xorg-dev
  • bison
  • byacc
  • php5-dev (yeah not ‘php5’)
  • x11proto-render-dev
  • libxml2-dev
  • gettext
  • flex (This one is a fast lexical analyzing tool. This is not Adobe Flex.)

I use Kubuntu 8.04 and the above were available from the ubuntu repo. So just use your package manager to get these if you use any flavour of Ubuntu.

I strongly recommend avoiding the use of the build-all.py file which the readme in libfbml recommends. Ofcourse if you know a bit of python you can make build-all.py do the stuff for you but with a little bit of tweaking. If you want to play safe, just follow the blog post.

Now just untar each of those libs in the dependencies dir and do the following on eash of those packages.

./configure
make
sudo make install

This is an exception for libXft, Xrender and firefox which is explained below.

When you are abt to fo ./configure for glib, wait, cd into the untared dir of glib, and find modules/printbackends/cups/gtkcupsutils.c and fire up a text editor to edit that file.

In the beginning of the file find the following

#define HAVE_HTTP_AUTHSTRING 1

Change it to…

// #define HAVE_HTTP_AUTHSTRING 1

You are just commenting out the line. :)

And once before and after you compile and install the glib, do an to do a sudo ldconfig. Or else you are mostly bound to receive an error regarding the pkg-config modversion returning Glib version 2.16.6 while you have 2.16.3.

If you run into errors relating to Xrender.h, add the x-include path option for configure of libXft and xrender. For all Ubuntu flavours the path would be /usr/include

The configure command should now look like this should look like this

./configure —x-include=/usr/include

If that fails use the same path with the x-libraries option also with the above.

After this is done, you are most likely to get errors related to render.h (file found but not able to compile) or renderproto.h or render(version is too old to use). Now you’ve got to edit the file in /usr/include/X11/extensions/render.h (preferbly using vi editor) so that should be…

sudo vi /usr/include/X11/extensions/render.h

Find the following var initiations…

typedef XID Glyph;
typedef XID GlyphSet;
typedef XID Picture;
typedef XID PictFormat;

Change it to…

typedef unsigned long Glyph;
typedef unsigned long GlyphSet;
typedef unsigned long Picture;
typedef unsigned long PictFormat;

That sounds like a temporary solution to me. This the permanant solution would be to find and include the header file which contains definitions for XID. But there’s isn’t going to be any problem with editing this file. The doing sudo apt-get install render-dev indicates that this file and it’s package is obselete and is replaced by Xrender which is included in the OS’s latest render lib, which is x11proto-render-dev in our case since we are using Kubuntu 8.04. Just took a look at the bug logs at the debian site. Bug or not, that doesn’t concern us though (we just need the fb platform running right?).

Now we should begin doing with the mozilla HTML parser thing (which I often refered to as firefox, coz it is firefox what we are messing with). Now cd to you home($HOME) dir and create a file .mozconfig with the following content. You’ll have that file already if you have firefox or something of mozilla installed. No problem. JUst go ahead and replace that file. You want to get that facebook platform running right?


.$topsrcdir/browser/config/mozconfig
mk_add_options MOZ_OBJDIR=@TOPSRCDIR@/ff-opt
mk_add_options MOZ_CO_PROJECT=browser
ac_cv_visibility_pragma=no
ac_add_options —prefix=/usr
ac_add_options —with-system-jpeg=/usr/lib
ac_add_options —with-system-zlib=/usr/lib
ac_add_options —with-system-png=/usr/lib
ac_add_options —enable-default-toolkit=gtk2
ac_add_options —enable-application=browser
ac_add_options —enable-xinerama
ac_add_options —disable-accessibility
ac_add_options —disable-installer
ac_add_options —disable-tests
ac_add_options —enable-places
ac_add_options —enable-safe-browsing
ac_add_options —enable-xterm-updates
ac_add_options —enable-cpp-rtti
ac_add_options —enable-reorder
ac_add_options —enable-system-cairo

Now untar the firefox package and do a configure and make. While doing configure just be sure that you do it with the following options.

./configure —enable-application=browser —enable-system-cairo

If you are using the 64-bit version of Ubuntu, then find the text “os_Linux_x86.o” in the build-all.py file and change it to “os_Linux_x86_64.o”. Open the Makefile in the libfbml dir and again do the same text edit. The Makefile I’m refering to is in the one in the same dir as the build-all.py file.

It looks like some moron wrote the code for the fbml.cpp file in the src dir. Find where the goto label ‘exit’ and whereever it’s used (it’s used twice). Re-write the code to use if statements.

Open the file rules.mk in the libfbml dir. find the following and delete it:

ifndef NO_WERROR
CXXFLAGS += -Werror
endif

Thats because the Werror option tells GCC to treat all warnings as errors.

Edit the build-all.py file so that it doesn’t do configure and make for any of the dependency packages including firefox, because you’ve already done it manually. Edit it in such a way so that it starts after the end of the firefox part and run it. It will now do the rest for you perfectly.

Your libfbml is now ready. You now have it as a php extension fbml.so Restart your apache server and you’ll find your fbml extension loaded (edit your php.ini file and include the extension fbml.so). That ends the buggy part. Follow the README in the fbopen pkg to get the Open Platform working fully.

Thanks to rchennau for a list of things to check out. But I just figured out that a lot more than those need to be checked and done to get the whole thing perfectly running. :)

Dec
10th
Wed
permalink
permalink

Announcing a new app and OpenSocial CSS Kit

Update: I just put up the project at http://code.google.com/p/opensocial-css-kit/

The project is still an alpha. I’ll continue developing this one.


Just started working on a new app with pd.

The idea was the outcome ot a chat session. pd just mentioned the idea and we agreed to work on it. And almost everything was on the floor immediately. Just within hours. It was around 3PM in the evening when PD mentioned the idea and after a while at 9PM we had the UI mockup and decided on the database models. pd is doing the development on AppEngine which we decided to have as our app server. I completed the conversion of the UI mockup to HTML. I used HAML and BluePrintCSS to get the job done. The HTML code looks way cleaner and easier to maintain with HAML.

Also, I edited the BluePrintCSS framework to be used with Orkut-OpenSocial. I’ve still got to strip the package off some code to make it compact only with the required modules.

I’m gonna call it the “OpenSocial CSS Kit”. Currently the CSS Kit supports only Orkut. Will add support for more containers in the future. I’ll put up the download links soon.