FOSS
New release of lekhonee-gnome
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.
- 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)
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
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
Fedora Project day in foss.in started
Kital is giving the first talk on Fedora Security Spin. The room is not full yet, people are still coming in slowly. Kital just a very nice example of robbing bank and how one should go ahead to plan and execute that :)
The post is brought to you by lekhonee v0.8
sparcy — command line utility for Spac Systems Limited GPS loggers
Few days back I bought a new GPS data logger from Sparc Systems Limited , GDL 3204. It comes with a nice 3 page manual. The last page explains the data format of the logs.
The device works in a very nice and easy way, it is having 32 channels.
We already had a nice python script to parse the log and create gpx files. But for me , every time “cat”ing the device and then convert the log is a difficult task.
Sparcy , which can get the data from the device and convert them into gpxfor you. If you already have the raw data, you can convert them to gpx too. People from #osm helped me a lot to understand how latitude and longitude calculations are done.
RPMs are available here.
The post is brought to you by lekhonee v0.8
lekhonee-gnome 0.8 released
I just released lekhonee-gnome-0.8 . This is actually a splitted source from the main lekhonee project. There are two major changes in this release.
- i18n done properly
- Error messages are now being shown properly
The first point means now you can run lekhonee-gnome in your mother tongue. Some translations already submitted through fedora transifex.
You can get it from my yum repo.
The post is brought to you by lekhonee v0.8
