Friday, December 26, 2008

Mailbox-to-mbox

Hello,
lately I've been looking for a way to convert a mailman archive to an mbox format so that I could open with mutt.
I then found a couple of scripts, but the one I've found simpler and working for my needs is mailbox2mbox.pl.
Sample usage:

$ gunzip YourArchive.txt.gz
$ perl mailbox2mbox.pl < YourArchive.txt > mbox
$ mutt -f mbox

And it simply works!
Does anybody know a method as simple as the above one but more powerful?

PS: Happy holidays!

Sunday, December 21, 2008

Global keybinding on X

Hello,
lately I've been looking for a way to create a desktop-wide keybinding for FreeSpeak.
I first looked into Tomboy and Deskbar source codes but the egg was too huge to be adopted, and it would have brought C dependency which isn't always nice for a Python project.
Then fargiolas pointed me to a blog post where I could find about gnome keybindings owned by gnome control center. Well that was only a mirage as it doesn't really grab the key but it's only a visual entry in the keyboard shortcuts preferences.
After a few days I've finally found a not-so-hackish solution in about one hundred lines of Python code.

Here is the snippet (download), only using Xlib and GTK+ Python bindings.

Sample usage:

def callback (keybinding):
print 'Callback!'
gtk.main_quit ()

gtk.gdk.threads_init ()
keybinding = GlobalKeyBinding ("/apps/appdir", "key_binding")
keybinding.connect ('activate', callback)
keybinding.grab ()
keybinding.start ()
gtk.main ()


The only problem is that it doesn't make use of GDK filters because PyGTK doesn't provide such function wrappers and there's no GDK-to-Xlib mapping available.
But yes, it works very good.

Monday, December 01, 2008

Aptitude-gtk progress

Hello,
I was curious to see if aptitude-gtk was making some progress. I haven't followed the project since it's been merged into aptitude.
Well, I found it more functional and complete. Here's a screenshot showing pending packages for upgrade after an update:
From GNOME

The team is definitely doing a good job. Hopefully I'll find the time to give some help as I'm really interested in such full-featured GUI frontend.
Keep going on!

Sunday, November 30, 2008

FreeSpeak gains translation suggestions

Hello,
it hasn't been a long time since FreeSpeak 0.2.0 has been released. One of the TODOs for the next release was to support open-tran, and more over translation suggestions for development.
This is a screenshot of what's been included in the repository today:
From GNOME
FreeSpeak is a GNOME frontend to online translator engines.

Friday, November 28, 2008

FreeSpeak 0.2.0 has been released

Hello,
after some work in these weeks now I have released a new version of FreeSpeak.

FreeSpeak is a free (as in freedom, developed and released under the terms of GPL) frontend to online translator engines (such as Google, Yahoo, etc.). It is written in Python, it uses the GTK toolkit and some GNOME infrastructure features



.
It's been rewritten almost from scratch so I think there's no need to post release notes here. Anyway you can always read what changed from the old version released a couple of years ago here.

Notice that the project homepage has been changed. The project has now moved to BerliOS.de.

Sunday, November 23, 2008

Replace GTK+ with Clutter for fun

Hello,
lately I was having fun with Clutter and Python. I've started by creating some Gtk-like widgets (such as GtkWindow, GtkBox, and GtkButton) in Clutter.
Well, this is the result... it's a simple example of a very poor toolkit, but it works:

Try it, it's only one .py file source code

Sunday, November 16, 2008

Single app instances, Python and DBus

Hello,
I'm working on FreeSpeak lately and I needed to run the application once per session, as it's got a trayicon and a notebook (maybe windows with an applet is better?)
I decided to use DBus for making the application run only a single instance; when you try to open it again it won't start another process, instead it will use the already running one.

This is how I would create a generic single app instance with dbus-python:
import dbus
import dbus.bus
import dbus.service
import dbus.mainloop.glib
import gobject

class Application (dbus.service.Object):
def __init__ (self, bus, path, name):
dbus.service.Object.__init__ (self, bus, path, name)
self.loop = gobject.MainLoop ()

@dbus.service.method ("org.domain.YourApplication",
in_signature='a{sv}', out_signature='')
def start (self, options={}):
if self.loop.is_running ():
print 'instance already running'
else:
self.loop.run ()

dbus.mainloop.glib.DBusGMainLoop (set_as_default=True)
bus = dbus.SessionBus ()
request = bus.request_name ("org.domain.YourApplication", dbus.bus.NAME_FLAG_DO_NOT_QUEUE)
if request != dbus.bus.REQUEST_NAME_REPLY_EXISTS:
app = Application (bus, '/', "org.domain.YourApplication")
else:
object = bus.get_object ("org.domain.YourApplication", "/")
app = dbus.Interface (object, "org.domain.YourApplication")

# Get your options from the command line, e.g. with OptionParser
options = {'option1': 'value1'}
app.start (options)
How it works?
  1. Setup the mainloop for dbus
  2. Request a session bus name, so that other applications (in our case another instance of the same application) can connect to it
  3. Create a new instance at path / if the bus name doesn't exist (so we are the primary owner). If it exists, then obtain the object from dbus and call the method on the remote Application object using the known interface.
  4. The Application.start method checks if it's already running then decide what to do in both situations.
Creating a GTK+ application this way is really easy. It only needs to use the GTK+ mainloop.
Let's suppose we want to present() the GtkWindow when the user tries to open another instance of the application:
import dbus
import dbus.bus
import dbus.service
import dbus.mainloop.glib
import gobject
import gtk
import gtk.gdk
import time

class Application (dbus.service.Object):
def __init__ (self, bus, path, name):
dbus.service.Object.__init__ (self, bus, path, name)
self.running = False
self.main_window = gtk.Window ()
self.main_window.show_all ()

@dbus.service.method ("org.domain.YourApplication",
in_signature='', out_signature='b')
def is_running (self):
return self.running

@dbus.service.method ("org.domain.YourApplication",
in_signature='a{sv}i', out_signature='')
def start (self, options, timestamp):
if self.is_running ():
self.main_window.present_with_time (timestamp)
else:
self.running = True
gtk.main ()
self.running = False

dbus.mainloop.glib.DBusGMainLoop (set_as_default=True)
bus = dbus.SessionBus ()
request = bus.request_name ("org.domain.YourApplication", dbus.bus.NAME_FLAG_DO_NOT_QUEUE)
if request != dbus.bus.REQUEST_NAME_REPLY_EXISTS:
app = Application (bus, '/', "org.domain.YourApplication")
else:
object = bus.get_object ("org.domain.YourApplication", "/")
app = dbus.Interface (object, "org.domain.YourApplication")

# Get your options from the command line, e.g. with OptionParser
options = {'option1': 'value1'}
app.start (options, int (time.time ()))
if app.is_running ():
gtk.gdk.notify_startup_complete ()
How it works?

Let's say we're running the Application for the first time, the loop begins and when it ends running is set to False, so gtk.gdk.notify_startup_complete() won't be called. Instead, if the application is already running, start() will be called on the remote object running the loop. The method then returns immediately so gtk.gdk.notify_startup_complete() will be called.
If you don't notify to the launcher that the startup is complete... guess what happens to your mouse and to your taskbar panel...

If the loop is running, the window is presented to the user with a little delay. If you don't use any timestamp, the UI interaction won't let the window have the time to be presented.

Of course, you can use DBus for many more things, like both setting options from the command line, as explained in the above code, and let other applications communicate with yours and viceversa.
Nowadays almost all systems use DBus, so it won't be a pain to add such dependency. In my opinion, it would be much more painful to use lock files, FIFO, unix sockets or whatever. FreeSpeak used such old technologies and it was a very poor emulation of what DBus already offers.

Monday, October 20, 2008

ping.fm is dead

Hello,
lately I've been using ping.fm for a couple of weeks because I've found it really useful.
Today I've tried to update my status through sending a mail but I received delivery failures... I then discovered that ping.fm is dead!

Tuesday, October 14, 2008

FreeSpeak, a GTK+/GNOME translator

Hello,
I've worked on FreeSpeak a couple of years ago, a Python/GTK+/GNOME project to translate text and web pages by querying already existing online translation tools.
PRO: It has been packed for Ubuntu and it has been publicized by a journal in Italy.
CONS: It has been discontinued until now. In fact I restarted the project and I'm doing a huge refactoring because of the ugly code I wrote in the past.



It's already working, but some features are still missing.
The new approach will allow applications to use FreeSpeak as a Python library to embed the translation widgets.



Contact me if you intend to help the project with suggestions, bug reports, critiques and coding.

Thursday, September 11, 2008

Debian Get Satisfaction


Hello,
lately I've found getsatisfaction, a social web2 free customer support for all companies and products.
Of course, what have I done is to look for the Debian company. Well it's there, but unused.

  1. Easy for novice users to ask and find answers there.
  2. You can share you ideas and get help
  3. Report problems and get help on bug reporting
  4. General and specific discussion
  5. Subdivide the service in variuos products (for examples ports and distributions)

Monday, September 08, 2008

GTK Apps to replace Gnome Files

Hello,
everyone knows that gnomefiles has went offline with that boring redirect to osnews.com.
Now many people is looking toward gtk-apps.org, I didn't know it before. It's looking really good.
The only problems is that I had (and I guess I'm not the only one) a few unmaintained projects on gnomefiles and they are now lost.
I'm wondering if it will be publicized a day by gtk.org to be something more official.

Saturday, August 23, 2008

Where are you? Yahoo! Fire Eagle

Hello,
the Twitter question was "What are you doing?". The new question is now "Where are you?"

Yahoo! has launched a sort of social application called Fire Eagle for updating your location and share it across other web services.

Saturday, August 16, 2008

Cincom Industry Misinterpretations reached the 100th podcast


Hello,
I'm listening to the Industry Misinterpretations podcasts (though my English is so poor to understand only a few words) and now they reached the century mark. They're managing an account on Podcast Alley.

Stay tuned!

Interviewed by Clubsmalltalk

Hello,
lately I've been interviewed by the new clubsmalltalk. Hey, I know, I'm not so good with English ;)
I'm glad of this, thanks to Hernan Galante.

Vagalume, GTK+ and Last.fm

I've found this great gstreamer application to listen to the last.fm stations. It works perfectly, fully functional and up-to-date. Features several IM status updates, including telepathy. It's definitely good-looking with my dark theme.
Homepage: http://vagalume.igalia.com/
Last.fm group: http://www.last.fm/group/Vagalume

Monday, August 11, 2008

Compiz with ATI RS480 on Debian

Hello,
after years that compositing has been introduced in our desktop, it's finally come the time to try it.

Uninstall fglrx
My video card is not supported very well with Mesa 7.0.x, in fact I've been using the fglrx driver for a long time.... until now!
I had to manually dpkg --purge all the related packages.
Now it's better to rmmod fglrx.

Install mesa 7.1 from experimental
On #compiz-fusion some guys hinted me I should have used Mesa 7.1rc because of recent improvements on my video card. The only way to get such version was to include experimental sources.
Ok, no problem, if it doesn't work I can downgrade back to the previous one.

Upgrade xorg to experimental
But there're still problems, I had to upgrade to the latest xorg in experimental because of mesa compatibility. In fact AIGLX couldn't load DRI drivers because of missing symbols.
I had to dpkg -l|grep xorg the install the one by one. I did pray for everything to work, really.
Now backup xorg.conf and go ahead with X -configure.

Install compizconfig-settings-manager and compiz-fusion-plugins-extra
For some reason, the first time I've tried running compiz it's gone Segmentation Fault. On the IRC channel they hinted me to install the crash handler plugin to back track the error. After installing such packages, magically compiz --replace worked!
Now I have a GNOME Desktop with the Blue-Joy theme and the Avant Window Navigator.

Everything both nice and unuseful, but now I understand how eye-candy fancy stuff can change your desktop.

Before the war:


After:

Thursday, August 07, 2008

iStream


iStream
Originally uploaded by Lethalman
Very useful applet for listening to the radio. It lacks a perferences dialog, but it's still nice.

Gnome main menu


Gnome main menu
Originally uploaded by Lethalman
Hello,
while I was playing with apt-cache I've discovered a new kind of main menu in GNOME. It's being developed by SuSE. It feels nice, robust and innovative.
The screenshot is showing the documents tab.
To install, aptitude install gnome-main-menu and add the new applet.

kqemu on Debian amd64

Hello,
I've been using qemu a lot lately because I'm creating an usb hdd with debian live.
The image contains a system running postgresql, development packages for gtk and python and gnome-core . All this ends up loading in more than 5 minutes, this is really boring.

Then I begun looking for a faster virtualization system, and found KVM. Unfortunately my processor hasn't the right flag for it.

Finally I found kqemu, which is a module for the kernel that speeds up a lot qemu. I never thought it could speed up things...... so.... much!
Let's install it:
m-a a-i kqemu
modprobe kqemu
That's it, for those who owns an amd64 processor, this is the right way to use kqemu:
qemu-system-x86_64 -kernel-kqemu [your options]
You shouldn't get any error, if you do... boh.

The image now boots in 33 seconds down to the bottom init scripts, and GNOME works only with a slight delay but it's definitely a great speed up. With the real machine, I enter gnome in about 40 seconds.

Keep going the good work Qemu team, and thanks as usual to everyone who helped me on IRC.

Wednesday, August 06, 2008

Debian and zd1211 wifi

Hello,
I'm using debian lenny and I've got these two problems:

  • With versions of the linux kernel prior to 2.6.20 (maybe) I could install zd1211 firmware using the module-assistant which has been now dropped from testing and unstable.
  • Boot process slowed down by 30 seconds and couldn't plug-in the usb pen because udev/hal screw up

What I've done is to remove the source and its created firmware, with the one shipped with testing and unstable (bug #411912):

aptitude remove --purge zd1211-firmware zd1211-source
aptitude update
m-a clean zd1211
aptitude install zd1211-firmware

Now let's fix the hotplug part, open /etc/udev/rules.d/z25_persistent-net.rules and remove similar lines:
# USB device 0ace:1215 (zd1211rw)
SUBSYSTEM=="net", DRIVERS=="?*", ATTR{address}=="00:1d:0f:b3:66:f7", NAME="eth2"
Now try to detach and reattach your usb pen and everything should magically work.

Thanks to Nss (#debianizzati), dcbw NetworkManager developer and gsimmons (#debian).

Sunday, July 13, 2008

Syx gaining more stability and speed

Hello,
in the new branches of Syx (an open source Smalltalk-80 implementation) we're working to try a new kind of memory management and add many features that have been missed until now to focus on other stuff.

The new faster and more modern v0.1.8 release will contain the following refactoring:
  • Objects will be variable-length (minumum 12 bytes on 32-bit processors and 16 bytes on 64-bit processors)
  • By changing the objects also the GC changed to a mark and compact GC
  • Threaded-switch statement to run processes
  • More efficient method cache (maybe a simple global cache lookup for this release)
API for primitives will only change slightly.

Suggestions for any new particular technologies are welcome.

Thursday, July 03, 2008

identi.ca is worse

Hello,
I'm using Twitter in this week and the API works "almost" perfectly while the website is down most of the time.
I've recently heard about identi.ca, so I decided to try it.
My first impression was bad, because I've seen many redirects of the page, and DNS changes sometimes.
But ok, I tried to register and again... I had problems. When I submitted the registration twice it just did nothing.
I then waited for a couple of hours then I've been registered to identi.ca.

Once I tuned all my account settings, the service has gone down. What happened? Too many twitterers have switched and now identi.ca is out of service? In the while Twitter has magically reopened its gate.

Monday, June 30, 2008

New debian tool proposal

Hello,
this is my second post about Debian. I'm lately discovering all the tools for both managing my Debian system and creating packages.
dh_make is the first tool I've used for the "first debianization" (called so by the New maintainers' guide) which creates a basic template for your package.
Anyway after a few packagings I've seen that something redundant could be automatized further.
What I suggest is a tool that does the following stuff after dh_make has been called:
  1. First dpkg-buildpackage -rfakeroot
  2. Check for libraries and binaries and create new packages in debian/control
  3. Find docs in usr/shared and modify the doc-base
  4. Check for .desktop files and .xpm then create menu
  5. Find info and manpages files
  6. Obtain copyright from COPYING/LICENSE and such, authors from AUTHORS and so on
  7. Find ITP on BTS and fill in the bug number in the changelog
  8. Rebuild the project
  9. Check for lintian errors and warnings and try to fix them (such as empty directories, wrong library name, etc.)
I'm sorry if I'm missing any files such as init.d or cron.d but I'm still newbie with packaging and I haven't tried all the stuff yet.
How this tool sounds to you? Would it be useful and easy to make at least for simple autotooled projects?

Saturday, June 07, 2008

Syx 0.1.7 has been released

Hello,
after several months a new version of Syx has been released. This release contains mostly VM changes and some changes to the Smalltalk Collections. As usual, release notes follow:

This versions enhances a new version of the interpreter, major updates to the scheduler, and as usual a lot of bug fixes. Syx left the Google Code SVN repositories because of many connection problems.

You can find informations about the new GIT repository here: http://code.google.com/p/syx/wiki/GitSource?tm=4

Installation instructions: http://code.google.com/p/syx/wiki/InstallationInstructions

API and environment:

  • SYX_ROOT_PATH and SYX_PLUGIN_PATH environment variables have been introduced.
  • Process and context creation changed.
  • New functions have been added for the scheduler, for manually do events iteration and adding idle functions to wake up semaphores.
  • Startup responsibility has been dropped from libsyx.
  • Added syx errors for system signals to be used with syx_signal.
  • Image recovering has been fixed.

Smalltalk:

  • Covered several standard methods for Collections, Numbers and Object printing/storing.
  • Error reporting from the VM now drops the exception to the Smalltalk environment when the interpreter is running.
  • Random class has been added.
  • Signal handling improvements for the GTK+ plugin.
  • #display family methods have been introduced for Smalltalk objects.

Interpreter:

  • System signal handling has been improved.
  • Cache hash code of Symbols.
  • The interpreter has been refactored to use one stack per Process.
  • Contexts are now created only on demand.
  • Optimized Symbols creation.
  • Signal class has been abstracted.

Parser:

  • The parser have been changed for handling new interpreter specifications.
  • Several fixes to the parser for special cases.
  • Fixed blocks scope.
  • Support <- assignment.

Image:

  • Image snapshot will nullify C pointers
  • Image format has been changed for handling new interpreter specifications.
  • Handle internal interpreter C pointers to be restored the right way.

Scheduler:

  • Different behavior of the scheduler for POSIX and Windows systems has been introduced.
  • Scheduler external idle sources have been added.
  • Asyncronous command line and GTK+ loop using semaphores. This leads to dropping readline.
  • A simple round robin scheduler has been added.
  • Dropped image saving of POSIX fd poll

Documentation:

  • Added lots of new comments.
  • Started documentation project including a manual still under development and a manpage.

Thanks to everyone contributing to the project.

See the ChangeLog for a complete list of things that changed.

Friday, May 23, 2008

Syx, GTK+ and threading

Hello,
you all know that Gtk+ has locks for the GUI when dealing with the X server and prevent async events to be sent. This is done by manually acquiring/releasing the lock on Gdk. Many Gtk+ ports don't do this automatically.

Syx used gtk_main() into a thread and automatically put gdk enter/leave for each function in its wrapper. It would be somewhat ugly in Smalltalk code having to enter/leave each time.
Of course, on Windows everything leads to troubles with threads.

But Smalltalk has Processes, handled by an internal scheduler. I decided then to not create a thread but cycle through Gtk+ events in the scheduler itself. Now everything works correctly.

Difference with other wrappers? The way Smalltalk is thought let you perform multi-tasking without the need to use OS threads, which means no problems on Windows and no need to take care of the Gdk lock everytime.

In addition, I rewrote part of the Console (Smalltalk-side) to be asyncronous using Semaphores. Now you can work on widgets after you run Gtk main! A small example:

Smalltalk YX 0.1.7 is ready.
Type "help!" to get help.
> Smalltalk loadPlugin: 'gtk'!
true
> | w |
> w := GtkWindow new.
> Gtk main.
> w add: (GtkLabel new: 'hello').
> w showAll!
a GtkWindow
You can imagine the result ;)
If you want to try it out you can download the scheduler branch snapshot.

Stay tuned for next 0.1.7 release.

Friday, May 02, 2008

Syx Manual

Hello,
I report the post on the mailing list below:

Hello,
with the next release 0.1.7, once I get a working interpreter and updated all the parts of Syx,
I will move output of doxygen to doc/reference and start a texinfo manual in doc/manual.

My idea is to have this kind of manual:
1) What is Smalltalk
2) Why Smalltalk YX
3) Introduction to the language
4) Introduction the Syx environment
5) COMPLETE Class and methods documentation, EACH non private method will be documented with examples
and EACH class will have usage examples
6) Embedding
7) Advanced topics, internal documentation

I know it's not the time yet for Smalltalk YX to get such documentation but I think it will be
a nice boost for the project and also for the entire Smalltalk community.
Since I don't have such fantasy now I will start directly with all except the 5th topic.

Any hint will be appreciated.
Bye.

EDIT:
The Smalltalk reference will be created automatically from Smalltalk itself.

Tuesday, April 22, 2008

Time for Debian

Hello,
I switched to Debian lately and i think it will become my preferred distribution.
I started with Slackware, then an LFS and then Gentoo. I never found them definitive for me.

I used Slackware by compiling sources most of all, then i didn't see any reason to continue using it.

The LFS came since my new PC as a test, and as long I could maintain it I had no problems and had fun with it.

I then installed Gentoo when i got my first DSL. But the updates are slow for lack of testing, I'm on an amd64. I tried to contribute someway but for the time I've been using it I never seen a open and innovative development (not in the sense that it wasn't friendly). And also, I've seen many developers leaving the project.

In other words, I "almost" used always source-based distribution. All the time I tried other binary-based distribution also to change my way of linux-life, like OpenSUSE, Ubuntu, Kubuntu, Foresight, and so on but no one satisfied me.

Then i wanted to try Debian, hoping it was different than Ubuntu. And in fact it is!
What I like of Debian is it's very high QA, how new users deal with bugs, how stable it is, how the BTS work, how the packaging works (eventough there are lots of useful tools I still don't know), the rapid updates, the security.

The thing I dislike from other distribution is that they release new stable versions but that are not so stable at first. For example i had troubles with the package manager with both Ubuntu and Foresight. Boot problems with Ubuntu, several crashes with Foresight, and so on.

But, I don't want to say Debian is now my preferred distro (I'm still afraid of binaries), but this is the good way and hopefully the last choice. Go Debian!

Tuesday, April 15, 2008

Smalltalk YX toward a new interpreter

Hello,
Smalltalk YX is currently working on refactoring a part of the interpreter, relative to contexts and stack management.
The current version uses one stack per process but always create contexts for each method or block entered.
The new branch, called newinterp, won't create those contexts anymore but they will be created only on-demand (e.g. thisContext). This means both less resources and garbage collector usage, and a possible speedup.

More informations on the mailing list here.

Monday, January 07, 2008

Smalltalk YX 0.1.6 has been released

Hello,
as usual these release notes follows.

This is a major bug fixes release, but introduce as usual many features. First of all this release put the GNU build (autotools) as first build system, and SCons as secondary which is still useful for MingW and the WinCE port.

  • Full GNU build support
  • X11 plugin
  • A basic CommandLine class for parsing the command line
  • Basic support for handling foreign C pointers and structs/unions from Smalltalk has been added
  • Several fixes for building on Sparc 64 using SCons
  • The -e option from command line has been added
  • Some help and Syx status will be printed in console mode
  • FileStream fileIn has been fixed
  • Class declaration from Smalltalk has been fixed
  • Lexer fixes for symbols, identifier and strings
  • FileStream now handles FILE* instead of file descriptors and this fixed several bugs
  • System startup has been fixed when fileing in files
  • Dictionary rehashing has been fixed
  • Basic support for handling foreign C structs and unions from Smalltalk has been added

Thanks to everyone contributing to the project.

See the ChangeLog for a complete list of things that changed.

Saturday, January 05, 2008

Google search? No thanks, Yahoo!

Hello,


lately I've been searching for "maemo emulator" and "mod_python psp" and the results weren't good to me.


If you don't trust, try the above searches (without double quotes) with both Google and Yahoo. This happens with many more searches.


In my opinion, Google lately is lacking a good page weight system and therefore it breaks results showing for example mailing lists instead of more important web pages.


Conclusion? I'm using Yahoo! as my default search engine until Google fixes these troubles.