Speed , Vala, Sqlite3 and optimization
Posted: 2010-07-07T18:07:50+05:30

All started as just another stupid idea, writing an image indexer (reinventing the wheel ).  The code should do the following things:

  • Index images for any given folder with user provided tags
  • Extract and keep EXIF information from the files
  • Extract or generate image thumbnails for all files
  • Should be able to provide the thumbnail even if the original file is missing (may be in a usb hdd)

Wrote some test code to see how much time it takes to do the above for a folder with 36GB+ in size and 5044 images (both JPEG and NEF ) 

1st run 

real 30m39.178s
user 0m45.561s
sys 3m42.557s

2nd run with out thumbnail generation but with EXIF information

real 10m14.281s
user 0m58.208s
sys 0m45.969s
3rd run with out thumbnail generation and with out EXIF information
real 14m40.503s
user 0m1.585s
sys 0m7.535s

Here I am confused, managed to find out that transaction in sqlite can cause delay, so changed the code to do everything in single transaction 4th run with out thumbnail generation and with out EXIF information

real 0m1.032s
user 0m0.216s
sys 0m0.134s
5th run with out thumbnail generation but with EXIF information
real 3m1.191s
user 1m2.525s
sys 0m34.524s

6th run with everything 

real 16m47.241s
user 0m43.652s
sys 3m21.640s

So the major bottleneck is thumbnail generation, which I am currently doing Gdk.Pixbuf , for EXIF information I am using beautiful gexiv2 from awesome yorba guys.

Now to optimize I have to use some other library to generate thumbnails, which other libraries I can use ?

On the side note, I am not saving the thumbnails on disk but creating base64 encoded strings of them (I know I am bad, not following the thumbnail spec).


lekhonee-gnome 0.11 released
Posted: 2010-06-24T15:28:18+05:30

I just released lekhonee-gnome 0.11, you can download the source from here, a yum repo for Fedora 13 can be found here.

Release Details:
  • Add new category button is re-enabled and it works :p
  • Updated translations
  • About dialog bug fixed


Timelapse using Fedora and D80
Posted: 2010-06-05T23:48:28+05:30

My first timelapse movie: /me trying to clean the kitchen 

ogv or in youtube
Shot in a Nikon D80 using entangle (#yum install entangle ) and a small python script.
Resized using imagemagick and video created using mencoder. 
Comments are welcome :)


lekhonee-gnome 0.10 released
Posted: 2010-06-03T15:42:13+05:30

lekhonee-gnome 0.10 is just released. You can download the source from here

This release comes with new translations for languages like Gujarati or Punjabi, also spell checking option is not anymore under right click menu ( something changed in webkit)

Here is an image of the right click menu used to look like.


Posted: 2010-05-31T16:18:37+05:30

So this weekend we had FAD Pune 2010. Being organizer the main issue was to get inside the office before everyone else :)

Among the things done:
  • Packaged accessx ( with help from Sayamindu to patch it for Fedora)
  • Updated code in Pony so that it works with new flickrapi API (committed but not pushed yet)
  • Now we have cover images in Pathagar , the digital library system.
  • Helped people with packaging
Yesterday in the last hours almost everyone were busy with packaging and helping each other. Had fun with all other contributors for 2 days, now getting back to the normal routine. Photos will come up later this week. I also recorded Sayamindu’s talk on OLPC as a downstream of Fedora project, you can view it here (111MB).



I Know What You Are Going To Do This Summer 2010
Posted: 2010-05-18T15:25:29+05:30

Hi all,

We are happy to announce “I Know What You Are Going To Do This Summer
2010”,[1] a free (as in freedom), online (IRC-based) [2] training
sessions for wannabes to Free/Libre/Open Source Software at #dgplug on
irc.freenode. net [3].

If you are a mentor, or trainer, or prospective enthusiast who would
like to participate in this years’ sessions please go through last
years’ IRC logs:

We will have a review or Q&A session on last years’ sessions before we
proceed into new topics, this year.

The session timings are mostly varying, usually after 1900 IST every day.

To participate you need a good internet connection and any latest
linux installed (Fedora 1213 preferably ). Anyone can participate.

If you are interested in participating, please confirm your
participation by sending an off-list mail to me (kushaldas AT gmail DOT com).

URL: http://dgplug.org/intro/
Planet: http://planet.dgplug.org/
Wiki: http://wiki.dgplug.org/
Mailing list group (for queries, discussions) :

[1] http://wiki.dgplug.org/index.php/SummerTraining10
[2] http://en.wikipedia.org/wiki/Internet_Relay_Chat
[3] http://fedoraproject.org/wiki/Communicate/IRCHowTo


lekhonee-gnome 0.9.1 is released
Posted: 2010-04-29T15:29:22+05:30

I am happy to announce the release of lekhonee-gnome 0.9.1 . You can download the source or check for koji builds for F12 or F13. New features are like:

  • Supports multiple Wordpress accounts
  • Tabbed UI for different modes
  • Now supports adding <br> tag using tool button
  • Preview mode (more details on this below)
  • Advertisement message is disabled for this release
  • Stopped segfault(s) in couple of corner cases
  • Supports <video> and <audio> tags in Visual and preview mode (you may have to write the details in HTML mode)
  • Can watch youtube videos in Preview mode (not an actual feature :p )
So the main two new features are multiple account handling and Preview mode. In the preview mode you can see how the post will look like in your blog with the theme you are having. To fetch the blog style please click on the small download style/theme button in the toolbar (this button will only come in the toolbar if you don’t have cached theme downloaded in your system), though you need internet connection for this mode to work.


New release of lekhonee-gnome
Posted: 2010-04-06T18:18:06+05:30

I just released lekhonee-gnome ( desktop client for Wordpress ) v0.9. You can download the source from here or look for the rpm F-12 or F-13

This is a complete rewrite of lekhonee-gnome in Vala. So, it is not anymore a gtk frondend to the previous python based one. 

Around 2 weeks back mether pointed me to Vala and I started porting lekhonee-gnome. The developers from IRC room #vala helped me a lot to learn and understand the basics of this new language and solving issues while I was working on it. Later siddesh , rakesh and paragn helped me to do the autoconf/autotool things fixed.

  • By default it will open WYSIWYG editor mode , people can still edit raw HTML by clicking the “Edit HTML” button in the right hand corner.
  • Added option for of extra HTML tags (HTML Tags menu) if one is editing HTML
  • Save/Open blog posts in the local computer in plain xml format , so that you can edit them in any editor
  • the configuration file is now a keyfile
  • In the WYSIWYG editor one can do Spell check by right clicking into  “Spelling and Grammar” submenu
  • While editing HTML one can use Spell Check box
  • There is a progress bar in the statusbar area which will give visual feedback to the user whenever it will connect to server for any task
  • The “Add Category” button is disabled in this release, will come back in the next release :)
We need more testing and please file bug reports according to that. 

The post is brought to you by lekhonee-gnome v0.9


How to do XMLRPC calls in Vala using libsoup (tutorial)
Posted: 2010-03-22T16:04:15+05:30

This is small tutorial showing how one can do XMLRPC in Vala using libsoup. We will call a default demo.sayHello method in Wordpress, this will just return a string “Hello!”.

The code:

using Soup;

public void main(string[] args) { var message = xmlrpc_request_new(“http://kushaldas.wordpress.com/xmlrpc.php","demo.sayHello"); var session = new SessionSync(); session.send_message(message);

    string data = message.response_body.flatten().data;
    Value v = Value(typeof(string));
    try {
        xmlrpc_parse_method_response(data, -1,v);
    catch(Error e) {
        debug("Error while processing the response");    
    string msg = v.get_string();
    debug("Got: %s\n", msg);


At the very first line we mention that we are using the libsoup, then using xmlrpc_request_new method we create a message. It requires the URL and method name strings. It also takes optional arguments to the method (which we will see in the next example). Then in the next few lines we are creating a SessionSync object and call the method using send_message method. The response stays in the same message object we created before. We get the response as string in the variable data.

xmlrpc_parse_method_response takes the response as a string in the first argument, next is the length(size) of the response (Note: I used -1 so that it will take the size of data, it comes handy when the response contains unicode chars) and 3rd argument is the Value where it will store the parsed result. string msg = v.get_string() gives us the final result , which we print using debug.

Now to compile the code I gave the following command $ valac –pkg libsoup-2.4 –thread xmlrpc-test.vala The output $ ./xmlrpc-test ** (process:28319): DEBUG: xmlrpc-test.vala:17: Got: Hello!

In the next example we will try to add two numbers using another demo method given by wordpress. The code is given below

using Soup;

public void main(string[] args) { var message = xmlrpc_request_new(“http://kushaldas.wordpress.com/xmlrpc.php","demo.addTwoNumbers",typeof(int),20,typeof(int),30); var session = new SessionSync(); session.send_message(message);

    string data = message.response_body.flatten().data;
    Value v = Value(typeof(int));
    try {
        xmlrpc_parse_method_response(data, -1,v);
    catch(Error e) {
        debug("Error while processing the response");    
    int msg = v.get_int();
    debug("Got: %d\n", msg);


Here while creating the message, we passed the required arguments to the method demo.addTwoNumbers, it goes as type and value pair, so we wrote typeof(int) and then the integer value.

Compilation and result

[kdas@d80 vala]$ valac –pkg libsoup-2.4 xmlrpc-test2.vala –thread [kdas@d80 vala]$ ./xmlrpc-test2 ** (process:28565): DEBUG: xmlrpc-test2.vala:17: Got: 50

A small tip: If you don’t know the return type , use type_name() to find out. Thanks to the people in #vala who are continuously helping me to understand more of it.

The post is brought to you by lekhonee v0.8


FOSS.IN 2009 in a total
Posted: 2009-12-11T17:01:26+05:30

5 days of full of excitement and fun. This year I tried to break/arrange my times in few things I wanted to work on. So the first decision was not to take many photos , I tried to keep my camera inside my bag only. The idea worked, I found more time on hand than last few years. From the speaker’s list I already knew who else is coming so fix up my mind according to that.

On the first day we took charge of the Fedora booth. Kital, Heimanshu sat on the table, /me and Sayamindu sat on the ground behind the table and started discussing many things. Next table was full with KDE-IN team with many swags. Day 1 I spent mostly meeting old friends and talking. It was nice to meet Kital once again :)

I managed to find Girish Ramakrishnan in a table in the first floor. So asked for his help to have a long waiting feature in pony. I wanted to view images with a semi-transparent background just like picasa does in windows systems. While working on it Prashanth Udupa also joined and helped to visualize what I was trying to achieve. Finally it was done with 2 lines of code :)

I also had a plan to sit with Sayam and discuss two of projects , Jukebox and Lekhonee. Got couple of unknown areas cleared in sugar activities. In lekhonee-gnome I tried to have a WYSIWYG editor using gtkwebkit and later also tried libabiword. This work is not completed yet. Will see which one comes out better.

Meanwhile 2nd day of the event was Fedora Project of the day. Mether, Kiltal, Kedar, /me, Shrink, Susmit, Ankur, Heimanshu many others were there. I gave a talk on python-newt module and tried to show how easy to use that while developing console based applications.

This year was again special as Milosch and Brita came again to FOSS.IN. Russ Nelson also joined along with his talk on arduino boards. /Me and Sayam bought two boards from a Bangalore based firm in the same day. Milosch gave an inspirational talk on how one should start working hardware based projects. He bought me couple of cool gifts so that I can start working of my own. He and Russ had great workshop on 8 bit and 32 bit (OpenBeacon) small computers. I spent the last two days of the event with them only learning small small things. One of the biggest outcome of the event is computerclub.in (not ready yet), a group to work on hardware-software related stuffs. We have our initial mailing list and sf.net project created. Please join if you are interested. The Bangalore group already fixed their first physical meeting.

The event ended with a great performance trdp. Enjoyed the show too much, never took out my camera :)

All shots can be found here.

The post is brought to you by lekhonee v0.8


Contents © 2004-2014 Kushal Das - Powered by Shonku