Akash Xavier RSS


About

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

Social
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. :)

Jan
18th
Sun
permalink

You know the "Security Rings" in PHP? :D

I just cleaned my cupboard and found a lot of old print-outs of tutorials and worked-out algorithms. Those were around 3 years old :) no wonder why I would still be having sessions and cookie tutorials for PHP which I then fancily called “Security Rings”. LOL.

Now after 3-4 years and half a dozen more languages into this deep web and programming pit, I know I was silly back then. So I’ve got a fact - I’m improving and making bigger mistakes now. :)

Today my favourites are: Python, Ruby, HAML (yeah! better way of writing HTML code). I still have to mess with JavaScript anyway. Anybody’s developing something like HAML for JavaScript?

Jan
16th
Fri
permalink

Kubuntu (8.04) bug fix for Dolphin file manager

I just switched from Ubuntu to Kubuntu. Infact screwed up my ubuntu install due to another fatal bug in ‘tasksel’. Doing “sudo tasksel install lamp-server” actually begins to remove the ubuntu-desktop and whatever thats selected in the menu other than installing the lamp-server. Sounds crazy!!!

Then when I just installeed Apache to reinstall the Shindig OpenSocial container to tinker with it again, I found another bug in the Dolphin file manager in KDE. When there’s an XML file or HTML file in the current folder a message box pops of often relating to “addApodcast” menu in Amarok media player… something like “invalid menu entry bla bla bla”. And good heavens there’s a bug fix for this.

Method-1: Using a DebDiff file

Here’s the link to the DebDiff file for the fix

And if you wanna know how to use DebDiff files look here

Method-2: Update using Adept package manager

This is the easier one. Just search for ‘Dolphin’ in your package manager and you’ll find a ‘upgradable’ note next to the Dolphin package. Upgrade it and you are done!

permalink

Tinkering with Shindig OpenSocial container

Just downloaded and setup the Shindig OpenSocial container. Getting a ‘real’ social app requires Partuza to be installed. Our app Casbour runs fine on Partuza.

Note: To connect Shindig to Partuza’s social graph, you need to deploy php classes and connect these classes to Shindig via the a local.php file or container.php file in the config dir of Shindig.

Thanks to Chris Chabot for help me out.

Dec
12th
Fri
permalink

Yeah! Got OAuth working with OpenSocial today!

Learnt how to use OAuth in OpenSocial apps. It took a dozen-dozen page refreshes and reuploads of my application to get this right.

Dec
10th
Wed
permalink
permalink
permalink
A line of code a day keeps the recession away.
— Akash Xavier :]
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.

Dec
9th
Tue
permalink

Some work with Haml

Finally, I could design a fairly attractive UI for my app. Got to work with Haml and I’m beginning to understand more than the bare bones of Rails.