Recent blog entries for iagorubio

18 Nov 2005 (updated 21 Oct 2006 at 08:31 UTC) »
Python embedding, easy and sweet

Really, when I put my hands and brains to add scripting capabilities to cssed, I didn't thought I was gonna be so sweet.

There were things I thought I was going to face as real problems. First, the scripting support must be added as a plugin, so It must be contained on an external library. Second it had to access a really limited amount of cssed's code, because it can use just the plugin's API, and furthermore it must resemble the plugin's API without extra boilerplate. Third I need more than just some processing capabilities, because I wanted the scripts to be able to show dialogs and windows of its own, and the script's UI should interact with the main application smoothly.

So when I put it all on paper, I thought "It's gonna be a piece of work ...".

Then I came to python. I'd used it, it's a nice scripting language, and it has good GTK bindings - cssed is a GTK application.

So I read the python docs, I looked for some helpers as SWIG - but it was like killing flies with a howitzer - and let's take a try.

Frankly, in two hours I'd got Python embedded into a cssed plugin, from which I can import the python "cssed" object and call some cssed functions.

I was really easy, direct pointer conversion between C and python lets you pass your C structure to any Python function. Lots of the logic falls cleverly into Python, as example, just returning a NULL caused the right exception at the python level. Easy parameter conversion from Python object to C types, and even easier to return Python object from C types, or structures.

Not just that, PyGTK worked so smooth that you'll never be able to tell what dialog is created by cssed, or by a python script. You can even easily embed PyGTK widgets into your application UI, such as adding a tool bar, menu or panel. And I'm not speaking just about Linux/Unix but it runs smoothly on Win32 as well.

If you've been reluctant to take the extra work to add scripting capabilities to your GTK application, because you think it will be a hard work - as I did - just put your hands on Python.

13 Nov 2005 (updated 13 Nov 2005 at 09:29 UTC) »
Advogato lost password, or how unimportant things become important in your life

Yes ! Before so long, so long, so long ... I finally recovered my Advogato password, so here I'm again. And quite happy about that, frankly.

For those trying to recover their lost advogato passwords, don't ask me the magic. I recovered it from my HD, no way to do it in this site, and don't trust the advogato FAQs all around telling you to mail raph. Almost sure his mailbox burned in hell before being so publicly disclosed, and it does not even exists right now.

But what really wonders me is human nature, or at last how hard I'm hit by it. Well I'm human so it's nothing to wonder about, but what happened to me with my advogato lost password it's something that makes me think how much I control my needs, and how much of them are controled by ... instinct?.

I lost my password a year ago. I deleted by mistake some files, and one of them contained all my passwords encrypted. Not a big deal as I have some backups, but they were out of date and there was just one password lost. Advogato one.

I didn't gave it too much importance. Frankly, I thought "well, I really have no time for this, so let it go".

One day I was willing to write something down about recent development of cssed, so I thought; "well advogato have a diary, haven't it? Or may be I can set up a blog of my own in my website". So my first stop was advogato to recover my password, as It was the easier step - yes, now I know, much better to code the blog from scratch in my site.

But - as you may know - no way to do it.

My first thought was, "OK let's surf the net, there must be a way to do it". And I found it, yes so easy!. Just mail raph at and it's over.

Unfortunately my mail bouced back with an "Unknow user" from server.

Then I felt really bad. In this site it's my name and I cannot even update it. This site represents me, but no longer I can edit or add entries to my diary.

I didn't remebered at that time, I gaved up advogato because I had no time to maintain my diary. I didn't remembered that I did not updated my passwords' backup because I didn't felt the advogato one was important at all.

I just entered a rage-like state trying to find a way to recover my advogato lost password. Even thinking things as weird as to forze someone to give me the password, or to delete my advogato page, by suing him, as in my country you have some rights about your data management. I even wondered if breaking into the advogato server to recover my password was legal or not - yes, I know breaking into any machine is not legal, but just note how my desesperation was rising badly.

I sent almost ten mails to raph, changing the name as rhalp, rahp, ralph, and any conbination that passed throght my mind.

Now I've found the password, but before three months of desesperation wasting my time almost daily.

Now I'm wondering why I didn't put a blog to work on my site. Frankly it's a five minutes task, I know how to do it, but the idea vanished from my mind from the moment it noticed I cannot log in advogato anymore, to right now that I can do it.

May be I wanted my advogato password just because I cannot have it? May be desire is increased exponentially by the lack of capability to get the desired object?

Yes, that's for sure ... now I just have to remember what was so dammed important for me to write down here three months ago, because I can't even remember it.

Fighting SCO's Filthy Lucre Tour

As SCO's is running the Sex Pistols' way of try a gain, I finally decided to involve personally, and put my 2 cents against this company.

I know that as an individual, I can do almost nothing to fight SCO.

So, what have I done ?

First of all I drop support for all SCO distros on my project, so bugs from any of the Caldera/SCO distros will be simply ignored by me.

I know that's almost nothing as a little CSS editor is not supposed to be in a SCO Unix server system, but Fyodor have drop Nmap support to those distros and, I'm sure, if more developers do the same, it will hurt.

If all Open Source community drop support for UnixWare and family, SCO user's will have less resources so SCO's distros will be - even - less attractive.

Then I think, how can a company consider a License void and illegal, but accept it's terms ?

GPL's point five states :

You are not required to accept this License, since you have not signed it. However, nothing else grants you permission to modify or distribute the Program or its derivative works. These actions are prohibited by law if you do not accept this License.

Are public challeges considering it "void" and "illegal" enough to prove non acceptance of a License's terms ?

I think that yes, it's enough, so I added a legal notice to the cssed project's site.

If you ask me if I can defend it in court, I will answer that no, it's sure I can not spend the funds required, but I fell much better since I wrote this down ;)

12 Feb 2004 (updated 12 Feb 2004 at 17:45 UTC) »
Dealing with memory

Preparing cssed for a new release, I was wondering about memory management.

I checked - not one but twice - all buffers allocated by cssed were released, but the doubt was in the air.

I didn't like very much memprof, so I decided to try valgrin.

The results of the tests where doubly satisfactory: I didn't find memory leaks in cssed's code, and I find a great tool for memory checking.

valgrid did a great job, checking the program for memory problems.

I build some test apps, to check results, and it found every memory leak and race condition, pointing to source file and line number.

I'm sure it's in my tool box to stay ;)

You've got it here

11 Feb 2004 (updated 12 Feb 2004 at 16:34 UTC) »
Really good news !

Chris Hornbaker (Quanta+) have started a discussion about the creation of an XML based function reference format, common to all Linux web editors.

Olivier Sessink (Bluefish) and Dodji Seketeli (MLView and libcroco) have just joined the list.

I think it's a great idea to try to build standards between open source applications. This will help users to choose in freedom as they'll know their reference files will work in all web editors.

As I know both Dodji and Olivier ( well I mailed Dodji a couple of times, and I help Olivier in the Bluefish project actively) I'm sure I will join the list, to put my 2 cents on the project.

That's something closed source developers can't even dream about ;)

The list is here: </b></b>

10 Feb 2004 (updated 10 Feb 2004 at 20:38 UTC) »

Well, finally I decided to put something here.

I didn't put anything in this diary, because my english is really poor, but - may be - it's a good moment to try to learn it, and the only way to learn anything, is using it.

Other thing that get me far from diaries, weblogs and stuff like that, is I'm not a *guru* or *influent* man, that should spread my word around the world, telling people how they must think, or what they must do.

The net is plenty of such kinds of blogs where not important people, say not important stupid things, in the hope that, someday anyone stop at his blog, and read it.

That's what I will not post here anything about me, my boring life or my personal ideas.

There's only one thing I will speak about here, my current programming project cssed [home page].

If you're looking for any kind of "illumination", a personal guru or a political counsel, it's not a place for you.

Once said that, I will put some words about cssed.

cssed is a small CSS editor for web developers, written in C with GTK2. It uses as editor component the scintilla editor.

Lot of people asked me about why I choose scintilla. Well, the true is I've used scintilla some years ago, and It's full featured, open source and low memory consuming, so my question is: Why I must not use it ?

It works much better that GtkTextView and GtkSourceView. May be when GtkSourceView get a couple of years of development I will switch to it, but right now I recommend everyone to use scintilla.

many people was confused about scintilla itself, there where opinios of all flavors:

  • It's propietary
  • It's not portable
  • It's C++ so you must use C++

But all of them was really confused:

  • Scintilla is open source
  • Scintilla was done with portability in mind
  • Scintilla is a library that can be linked with C code with no problem.
The fact, is most people didn't like it because it sounds as "Windoze" stuff for them.

It's other example about the fact that human stupidness is infinite.

It's open source, so wtf you care about it was done for Windows? Is not enought that scintilla's author made it with portability in mind and build a Gtk1 and Gtk2 versions?

Once explained that - cssed use scintilla because I think it's the best editor control for programers build with Gtk - just some words avbout the state of the project, and I'm sure it's enough for my first diary entry.

cssed is right now running for the beta. That means it's still in Alpha but sounds much better ;)

I'm right now changing the API of some dialogs to run them as independent ones -connected to some callbacks - or with gtk_dialog_run and use a function call to get the dialog results. All this dialogs simply returns a string with a CSS declaration.

That's the main and boring task that gets me working hard.

I will start to describe my advances from this point.

But not today ....

New Advogato Features

New HTML Parser: The long-awaited libxml2 based HTML parser code is live. It needs further work but already handles most markup better than the original parser.

Keep up with the latest Advogato features by reading the Advogato status blog.

If you're a C programmer with some spare time, take a look at the mod_virgule project page and help us with one of the tasks on the ToDo list!