Kushal Das4

FOSS and life. Kushal Das talks here.

8051 development on Fedora

First install sdcc #yum install sdcc

Next is a small example to blink a LED connected to P1.7

#include <8051.h> void main(void) { int i=1; P1=0; /* P1.7 used as LED output / while(1) { P1_7=!(P1_7); / toggle P1.7*/

for(i=1;i<25000;i++); /* for delay */

} }

Compile it and get the hex file from intel hex $sdcc-sdcc blink.c $ sdcc-packihx blink.ihx > blink.hex

Now you can upload the hex to the programmer :D /me is also just starting up.

How to do XMLRPC calls in Vala using libsoup (tutorial)

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

Webcast on FOSS

Update: Direct link You can watch it live here. These talks are part of the National mission on education through ICT. More information available here.

Date: Friday, July 10th, 2009 Time: 2.30 pm IST ( 09:00 UTC )

Talk 1: 10 things a FOSS developer should know

Abstract: FOSS development is easy. A simple set of rules and protocols would get anyone started on FOSS development. In this talk, the 10 essential things are discussed in a form that is easy to remember and, easy to tell others. Mostly interactive and example-driven, the talk builds on the fundamental principles of Software Development and provides relevance within the FOSS model of doing things.

Speaker: Ramakrishna Reddy is a Sr Software Engineer at Red Hat. A self-confessed Python fan, Ramakrishna is currently involved in authoring a book teaching non-programmers the fundamentals of computing. He is a regular on various Python forums along side NLP related forums. Ramakrishna maintains various eclectic packages in Fedora and, is also active in the Debian community.

Talk 2: How to use infrastructure for FOSS Projects

Abstract: Infrastructure is an important part of a FOSS project’s lifecycle. In this talk, Prasad talks about how to set up a development environment for a developer and, how best to set up a development/project infrastructure. Touching upon the essential infrastructure aspects, Prasad takes an example of his own project to demonstrate how important infrastructure is for projects.

Speaker: Prasad J Pandit is a Software Engineer at Red Hat. A developer who professes a love for Perl and C, Prasad maintains packages in Fedora. He also provides guidance to new participants in FOSS development showing them how to get their feet wet.

Talk 3: Communication in a FOSS Project

Abstact: Any project is based on communication. Clear, precise and accurate information at the right time helps to build communities around projects. Rahul delves into his experience as a Fedora Community Wrangler to talk about the ways and means to maintain a dialogue with an evolving community as well as how best to build up communication skills.

Speaker: Rahul Sundaram has been working within the Fedora community for close to 5 years now. He works as a Software Engineer at Red Hat and, provides inputs and guidance in various aspects of The Fedora Project ensuring that concept of collaboration is well established. He also writes in various publications and online journals. His profile is available athttps://fedoraproject.org/wiki/RahulSundaram

The post is brought to you by lekhonee v0.6

Pony v0.2 released

I just released Pony v0.2 . It is still under constant development and will go some db changes before v1 release. Please delete .pony.db under your home before using the new release.

$rm ~/.pony.db

Viewing an Image

Among new features one can now see the EXIF information of an image.

Showing EXIF information

Deleting tag option is also added.

Showing tags

Get the source or rpms from here.

Now I have to add TODO file as too many things need to be fixed. If you have any suggestions please mail me or file a ticket.

pyexiv2 problem in rawhide

pyexiv2 is the python extension of Exiv2 library. It helps to find the EXIF information from an image.

The current rawhide version is broken, it just can not be imported.

[kdas@d80 ~]$ python
Python 2.6 (r26:66714, Mar 17 2009, 11:44:21)
[GCC 4.4.0 20090313 (Red Hat 4.4.0-0.26)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
>>> import pyexiv2
Traceback (most recent call last):
  File “<stdin>”, line 1, in <module>
  File “/usr/lib/python2.6/site-packages/pyexiv2.py”, line 60, in <module>
    import libexiv2python
ImportError: /usr/lib/python2.6/site-packages/libexiv2python.so: undefined
Tried to find what that symbol is using c++filt
[kdas@d80 ~]$ c++filt _ZNK5Exiv29Exifdatum6typeIdEv
Exiv2::Exifdatum::typeId() const
Now is this a very new pyexiv2 which contains symbols from latest exiv2-lib or a problem itself ? The bug is here.

Update: It seems to be a local symbol. It comes from exiv2-lib only , but it shows as local with “notype” from the eu-readelf output :(

Summer training 2009

You can find the wiki page here. This year we want to make groups such that there are two students in a group and make them work on any upstream project or  a new project. They should start the work of finding the project ideas within first two weeks of the program.  Comments/suggestions are welcome.

We have added a few buzz words in the poster to attract students. Generally students prefer to go to different small institutions to do summer project where most of the times they pay a good amount to get a certificate. Trying to change the situation slowly.

Thanks to Nicu for the poster.

How to install Soas on your regular box

Soas (Sugar on a Stick) is a LiveUSB system with sugar on it. It is based on Fedora. You can carry it and boot anywhere as you want like any other live system. You can download the ISO from here.

I was using it on a Eee PC (4GB model), suddenly thought of installing it on the system.

The other Fedora based systems have an option on desktop to install on hard disk, but this system is running sugar so no desktop means no such option. From the #fedora-devel I found the command is “liveinst” which is part of anaconda.

So I installed anaconda ( #yum install anaconda ) and then used the command “liveinst” ( without quotes) , this will fire up the installer for you. Then go through like any other installation. After finishing the installation I found X was crashing, tried with many different config but nothing helped. Finally decided to install gdm and gnome on that box ( #yum install @gnome-desktop gdm ),  also installed system-switch-displaymanager using which I changed the display manager to gdm. Next task was to change the init to 5 in inittab. Rebooted and found gdm , chose “sugar” as the desktop option and logged in :)

If you want any help come to #sugar on freenode.