Search Results: "mak"

29 December 2005

Decklin Foster: lastfmsubmitd

Apparently, tis the season to be writing your own Last.fm plugin. So here is mine. I finally got fed up with finding and causing bugs in mpdscribble (I am a bad sponsor!) it s written in C with libsoup, blah blah, can t stand C, and so I revived the MPD pseudo-listener I had started on as a replacement for that awful orphaned cacheless one-off we were all using before mpdscribble. I also fixed a few issues that were bugging me, like failing to detect restarts and tag changes. Not wanting to muddy up any of that logic with HTTP gar, I decided to write a separate program to queue, cache and send along song submissions. They re two or three hundred lines of Python each, and single-threaded (yes, that means child writers blocking and hanging around if the network code is in the middle of timing out or backing off. Deal with it! This is UNIX). I m pretty happy with the design, although the implementation is still very rough. This also mimics the model they want to move to for player plugins in general, which is good, because it will be less work for me to implement version 2.0 of the protocol once that is finalized. Additionally, I was able to find a more satisfying way to solve the disconnected-CD-player problem than my previous dreadful method of either using a few kludgey scripts to frob around in my primary plugin s cache or dealing with using cdscrobbler and having to be very careful about one plugin not stepping on the other s toes and invalidating my backlog. So this is the second example program included. (Oh yes, that part uses the Python bindings for MusicBrainz. MB is awesome. The Python bindings are hideous, however straight port of the C++ API. I d probably be better off just dumping the RDF into a real RDF implementation and doing my own cross-referencing, instead of prying it out piecemeal with select queries and non-polymorphic getters and all the other absolute nonsense you have to deal with when writing in a language without high-level data types or garbage collection. But regardless of implementation woes, this has kept me close to the MB metadata for my favorite CDs, and so I ve been busy all week entering and voting on mods (and doing research to justify my changes), which is very satisfying. I have yet to begin the gargantuan task of adding MB tags to my Ogg collection (I know, this is really just a matter of babysitting tp_tagger, but I ve got some work cut out for me to even get to that point).) And of course, once this becomes less prototypey, anyone who likes it can knock all the networking code out of their plugin and use it as their system service . Perhaps if I m agile enough this can become official code! It is at least a mootable proof-of-concept that UNIX systems don t necessarily need a heavyweight libscrobbler to abstract the service stuff out of the player plugin. I won t get my hopes up though. Still a bit unsure about the name. Theoretically it seems the service (you know, the thing we pay money to if we like it) should be Last.fm, while the software and protocols should still be Audioscrobbler, but the distinction does not seem to be drawn very clearly in practice. With the analogous situation of livejournal vs. ljcom you had a grokkable technical delineation (different repositories) as well as other widely used installations besides ljcom (DeadJournal, etc). I really can t see there ever being a competing installation of Audioscrobbler, because licensing the streamables is a formidable investment hurdle, and there s a negative market effect (also, the web site is not open source). But I am also bored of just sticking scrobble onto something else, so I wanted to grab sticking last onto something else before it got old. I haven t the faintest clue what makes me prefer whimsical names for some projects and prosaic ones for others. Note to actual MPD users (all, like, 5 of you): the stuff in the package will not handshake at the moment, as I have not yet gotten Russ to bless the client ID I made up. Will try to catch him tomorrow. Or later today I suppose. It s ready to go now. Next up: Because it s either this or Sound Juicer, I think perhaps it s time to bid adieu to abcde and write a MusicBrainz plugin for jack (jack is nice enough, I just haven t had a truly compelling reason to switch, and there have always been lots of good eyeballs on abcde). FreeDB delenda est.

Decklin Foster: Humane interfaces

You know, I think the whole thing missing in this whole kerfuffle (as James Robertson put it) from a few days ago is that it s not list.first(), it s list.first. Just pretend you re sending a message, baby. Of course, if your brain is still stuck in imperative mode, the first is available; it s simply a matter of how to express what you wish to convey that you are doing, which is really not something that minimal class design defines as part of the problem. So. Ahem. Curtain.
HAMLET
Java s a prison.
ROSENCRANTZ
Then is the world one.
HAMLET
A goodly one; in which there are many classes, methods, and runtimes, Java being one o the worst.
ROSENCRANTZ
We think not so, my lord.
HAMLET
Why, then, tis none to you: for there is nothing either functional or procedural, but thinking makes it so: to me it is a non-Lisp.

Daniel Stone: [tech/x] not to be left out

Since all the cool kids are doing it:
daniels@ephemera:~/x/xorg/xserver% diff -urN xorg ,.xkb /xkb diffstat tail -1
 27 files changed, 1437 insertions(+), 7439 deletions(-)


Hacking on XKB as recreation. Whoohoo.

(Oh yeah, and that removal of 6000 lines of code actually adds some really cool new features to the server, including some which make it significantly more complex -- XML parsing, i18n, you name it. How's that?)

Joachim Breitner: Tad Williams' Otherland - Part II

Just before Christmas, I finished reading the second volume of Tad Williams’ “Otherland” quadrilogy, “The river of blue fire”. Most of what I said about the first part still holds, especially what I said about the similarty to “games” like Second World, and how Williams forsees where stuff like Telepresence leads us.

By now, some of the story lines have crossed or merged, others are still independant and a few new ones have begun. The largest part of this volume consists of helplessly stumbling through virtual worlds. By doing so, Williams has all freedoms to create strange and interesting settings. At quite a few spots I thought: Wow, that would make a great movie szene. I hope some visually gifted will someday make a (or better: a few) Otherland movies.A few of these worlds are perverted versions of famous literature, notably H.G. Well’s “War of the Worlds” and “The wizard of Oz”. Oddly, I have only heard of these stories before, but just about the time I read about them in Otherland, they somehow re-appeared somewhere around me: The recent “War of the Worlds” movie (which I actually haven’t seen) and the old “Wizard of Oz” movie being shown at a small local theater in Karlsruhe.I’m looking forward to reading the next volume, but I have to wait for my brother to finish it, so I’ll probably squeeze another book in between.

27 December 2005

Jose Carlos Garcia Sogo: "Legal" Merry Xmas

This is a transcript of what a friend of mine sent as a Xmas card. Of course she is a lawyer, so I hope that this text can transmit you exactly my feelings.
Please accept with no obligation, implied or implicit, our best wishes for an environmentally conscious, socially responsible, low-stress, non-addictive, gender-neutral celebration of the winter solstice holiday, practiced within the most enjoyable traditions of the religious persuasion of your choice, or secular practices of your choice, with respect for the religious/secular persuasion and/or traditions of others, or their choice not to practice religious or secular traditions at all. We also wish you a fiscally successful, personally fulfilling and medically uncomplicated recognition of the onset of the generally accepted calendar year 2006, but not without due respect for the calendars of choice of other cultures whose contributions to society have helped make America great. Not to imply that America is necessarily greater than any other country nor the only America in the Western Hemisphere. And without regard to the race, creed, color, age, physical ability, religious faith or sexual preference of the wishee. By accepting these greetings you are accepting these terms. This greeting is subject to clarification or withdrawal. It is freely transferable with no alteration to the original greeting. It implies no promise by the wisher to actually implement any of the wishes for herself or himself or others, and is void where prohibited by law and is revocable at the sole discretion of the wisher. This wish is warranted to perform as expected within the usual application of good tidings for a period of one year or until the issuance of a subsequent holiday greeting, whichever comes first, and warranty is limited to replacement of this wish or issuance of a new wish at the sole discretion of the wisher.

Joey Hess: all this for a progress bar?

Over the past months we've been working on a big change in the debian installer, removing base-config from the installation process. Doing this has required a great many changes, some of them user-visible. The installer now configures the timezone, users and passwords, and apt all in the first stage instead of after rebooting. Some preseed values have been removed or changed, including base-config/early_command and base-config/late_command. The biggest change of all, the the hardest to get working, has been moving of the selection of tasks and the installation of all packages into the first stage of the installer. Now tasksel pops up a debconf question that looks like any other question d-i asks, and the installation of packages is hidden behind a nice clean progress bar, and if any packages use debconf to ask questions, d-i will display those questions using its frontend too. I'd include a screenshot, but really, it's just another progress bar, how boring is that? By the way, if you maintain a debian package and it prompts without using debconf (when debconf is available), then your package will obviously break this, and it's well past time to fix it. I think that all the packages d-i installs do use debconf except for possibly a few like libc during upgrades. Upgrades are theoretically possible at this step for any packages debootstrap installs, so those will need to be fixed too. This has been a long, long time coming. Some milestones include: So yeah, this has been in er, progress for 8 years, and at least three Debian derived distributions have come up with thier own approaches in between with only the last one being quite similar to the end result, and the other two being rather dead. I don't know whether this is a study in how Debian is slow, or a study in how we do eventually come up with infrastructure that is done right and ends up being used by everyone. Or both.

Erich Schubert: Fixing planet

Today I've been fighting Planet, the well-known blog aggregator tool. After a while I had found out how/why it was scrambling Atom feeds horribly. I'm not sure if actually is a planet bug - maybe it is fine with older python versions. The SGML parser of python2.4 however fails on tags such as <br />, a very common case in blogs and thus in atom feeds. Strage additional > brackets appeared in the output. The reason is, that the SGML parser as of Python2.4 is looking for <tag/foo/ as an equivalent to <tag>foo</tag>, and thus treats <br/><br/> the same as <br>><br<br>> with the inner chars somehow magically escaped... The fix is quite simple: add
sgmllib.shorttag = re.compile('<([a-zA-Z][-.a-zA-Z0-9]*)/(/*)>')
to your feedparser.py file in the obvious place (next to sgmllib.tagfind). This will break support for these true SGML short tags, but I've never heard of a blog feed using them anyway. I told you that I'm not really sure whether this is a planet bug: It might be a bug of pythons sgmllib, too. But maybe Planet should just use a XML parser for XML files, and fallback to an SGML parser (or maybe a robust XML parser) for other files (unfortunately, many blogs - including mine - do not ensure correct XML). And Planet could use some proper XML handling, too, anyway... Right now, the code is so string-array-based, it makes me sick. You might also want some extra magic to re-fold <br/> tags to not confuse older browsers.

Enrico Zini: How to put your /etc under svk

This is convenient, here's how to do it:
# Install svk
apt-get install svk
# Initialize a depot in /root/.svk
svk depotmap --init
# Import /etc making it a working copy
svk import --to-checkout //etc /etc
# Make your depot not that readable
chmod -R go-rwx ~/.svk
# Remove volatile files from revision control
cd /etc
svk rm -K adjtime ld.so.cache
...and voil , you have /etc/ under revision control, without CVS or .svnor arch or .bzr files around. The syntax of svk is just like the syntax of svn, of which it's a distributed extension.

Matt Brown: Miredo/Toredo Patent Status

Miredo is an implementation of the Teredo - IPv6 over IPv4 tunnelling protocol which I have been playing with lately. I have filed an ITP bug to get Miredo into Debian, however this has been delayed while I try and get a handle on some of the patent issues surrounding the Teredo protocol. While Miredo itself is licensed under the GPLv2 the state of the Toredo protocol is less clear. Teredo was created by Christian Huitema, an architect with Microsoft. It is currently a Proposed Internet Standard waiting for the IETF editor to review it and assign an RFC number for it, IANA will then assign a permanent prefix for use by Teredo clients, servers and relays. According to the IETF IPR disclosure page, Microsoft has filed a statement of claim against the technologies described in the Proposed Standard. Microsoft states that they will provide a Royalty-Free, Reasonable and Non-Discriminatory License to All Implementers in their statement. Specifically the license that they offer the Teredo protocol under is called the Microsoft Royalty Free Protocol License Agreement. This is a catch-all license that Microsoft uses for all client-server protocols used by Windows. The license itself doesn’t make any claims about Microsoft’s IP rights, it simply gives you a license to use any rights Microsoft may have in the specific protocol you are using. For example at the end of the license agreement you select which protocols you wish to have covered under the agreement. Alongside Teredo you can also choose protocols such as IPv4, DNS, 6to4 and lots of other common protocols. The actual patent application for Teredo is incredibly difficult to find, the IETF IPR disclosoure doesn’t link to it, none of the proposed standards link to it and googling for “Teredo Patent Application” isn’t particularly successful either. In the end it turns out that the title is quirkily named “Allowing IPv4 clients to communicate over an IPv6 network when behind a network address translator with reduced server workload” and was published as Patent Application 20040190549 on the 30th September 2004. Incidentally if anyone knows of a nicer way to link to a US Patent Application than the ugly URL above, I would love to know. Half the reason that the Patent Application was hard to find is that it doesn’t actually mention Microsoft anywhere at all, unlike the ~5000 odd other Patent Applications currently filed by Microsoft. From what I can tell it appears that Christian Huitema has filed the application through is own personal attorneys independently of Microsoft. So where does this leave us in terms of getting Miredo into Debian? The short answer is I’m not entirely sure. I can’t seem to find a definitive statement regarding Debian’s position on patents anywhere, the best I’ve been able to come up with is a debian-legal post from Andrew Suffield from Jan 2005 which offhandedly describes the informal Debian patent policy as:
“ignore patents until somebody starts to wave them around, then drop the offending thing like a hot rock”
So maybe I’ve already shot Miredo in the foot, by investigating its Patent Status… :( My take on the situation seems to be that Debian is perfectly happy (and perhaps has no other option but) to ignore patents applicable to software in Debian until it becomes apparent that a particular patent is being enforced or has the potential to be enforced. So the question now becomes whether the Microsoft Royalty Free Patent License is acceptable enough to Debian to allow Miredo to be included in main or non-free, or whether it simply can’t be redistributed at all. The main problem I see with the license is that it does not permit you to sublicense other parties to make use of the Toredo technology used by Miredo. If this were a copyright license then that would most certainly fail to pass the Debian Free Software Guidelines, does Debian treat patents in the same manner? I think it’s time for me to post to debian-legal to seek some “official” guidance on the situation, but hopefully this post has ordered my thoughts enough that I can now write a coherent mail seeking help. If you have any comments or pointers to Debian statements on this sort of situation that I have missed they would be most welcome.

Eric Dorland: contrary to popular opinion, we do actually fix bugs

A recent post by Ingo Juergensmann lamenting m68k not making the cut in this round of architecture qualifications. While it is a shame I think, I don't think it's necessarily the end of the world and his complaint that developers will now stop fixing bugs is crazy. Just because they're suddenly not release critical doesn't mean (good) maintainers will be unwilling to fix them. Most architecture bugs are toolchain bugs (ie not the package maintainer's fault), general types of architecture bugs (eg endianess, int size) that affect more than one architecture and tend to get fixed quickly and easily and really freaking hard problems that most package maintainers don't have the skill to fix on their own (eg #343687, help!). But if someone submits a bug that's trivial to fix, or gives me a patch, that bug will get fixed. I don't like bugs in my packages and probably most other developers don't either.

26 December 2005

Jordi Mallach: GNOME's dbus 0.60 transition done

Following up on my previous post, here's a new status update of the whole GNOME situation. Very soon after posting that roadmap, the two steps in the process were completed, with the ftpmasters freeing dbus into experimental, and seb128 doing a round of GTK+ family uploads. No big problems have been detected in GTK+ 2.8 in unstable, so those bits are going very well. As soon as dbus 0.60 hit experimental, both the KDE and GNOME camps got busy recompiling their stuff. KDE 3.5.0 moved from Alioth to experimental, and sjoerd got busy in a recompile quest to make sure GNOME was installable again in experimental. The dbus 0.60 transition in experimental was done in barely a few hours, and some extra dbus-using packages have been transitioning since then. So, what's holding our unstable upload? We first need to wait for KDE 3.4 enter testing, thus clearing the major blocker for the C++ ABI transition. The number of packages involved in this is so big it's not even funny, so it's quite complicated. In short, the GNOME team is sitting on their hands watching some C++ fun. There are a few more news bits though. Last night, there was a round of experimental updates, bringing most of the modules to their 2.12.2 versions (just 2 or 3 are missing now), and meta-gnome2 was again updated to support these versions. If you issue your usual aptitude install gnome-desktop-environment, you'll pull newer versions of most of the stuff, if that's the way you update your experimental packages. Also, the gnome package now supports gnome-screensaver. Give it a try, and be ready to purge xscreensaver if you're happy with it!

Tollef Fog Heen: Mail based tracking systems: RT

Philipp Kern asks about mail-based tracking systems. Even though he specifically says "no" to RT, I would recommend it. The source is very hackable and making up commands for changing ticket properties is easy.

Matthew Palmer: Making DVD Movies

I recently came into posession of a collection of (smallish) WMV files containing photo slideshows. Unfortunately, they don't play on my DVD player, and SWMBO's laptop has No Hope of playing anything remotely like a video. So, technology to the rescue. Initially, I was just going to convert the movies into something that the DVD player would actually play, but by the time I had those, I was 95% of the way to doing the job properly, and it would (of course) look far nicer with menus and other Shinyness (instead of just a boring file menu), so I went all the way and made a complete DVD movie disc. The whole process was non-trivial to discover, but ultimately straightforward in practice (once you know the set of command line options to use), so I'm archiving this for posterity. I use Ubuntu Breezy. A lot of the packages I've used are under really heavy development, so slightly older versions may not work. If you're running another distro, finding compatible versions may be tricky (or not). Try the process with whatever you've got; if it works, great; if it doesn't work, try upgrading versions or something. Step 1: Convert Video Files To Something Less Bong Packages used: transcode 1.0.2-0ubuntu2 (trivial backport from Dapper; mail me if you want it, but the one in Breezy will probably work OK), mplayer 1.0-pre7cvs20050716-0.1ubuntu9, mjpegtools 1.6.3+rc2-0.0ubuntu2 As far as DVD players are concerned, WMV is non-existent (clever things). DVD players like some form of MPEG-2 video with AC3 or MP2/3 audio. So, we use transcode to convert the video. For WMV files in particular, only mplayer does the decoding right (the af6 plugin seemed to work, but the resizing didn't turn out too well). So, our command is:
 transcode -x mplayer -i $FILE.wmv -g 640x480 -e 44100,16,2 -o $FILE.tc --export_prof dvd-pal
Items of note: As I mentioned, the output from the transcode run is two separate streams -- an audio and a video stream. We want to combine them. This is quite easy:
 mplex -f 9 -o $FILE.vob $FILE.tc.m2v $FILE.tc.mpa
This is a simple "glue them together" command -- the only interesting bit is -f 9, which simply specifies a particular MPEG-2 multiplexing method (full DVD-compatibility, or some such). If things aren't working out for you, try -f 8, which I believe also works. Since you'll probably have a bunch of video files to convert at once, you'll want to automate all of this with a shell script or shell 'for' loop. Step 2: Make a DVD Layout Packages used: qdvdauthor 0.0.10-0.1 This is the bit that I thought would be hard, but is actually amazingly easy (the previous step took me two days to get completely right, this bit took me about an hour). Fire up qdvdauthor, answer any stupid questions it might come up with. When the main screen comes up, click on the 'Add Movie' button on the left hand side, then select the first video you want to add. Repeat as required to add all of the videos you want. (Remember to add the VOB files you created earlier, and not the WMVs you might still have laying around. D'oh!) Clicking on the 'Video' tab on the left hand side should list all of your videos. Check they're all there, and are the correct size. Next, create or find a suitable background picture or video to make your main menu background. I've only tried with an image, but it seems to accept videos if you give them to it. Click on the 'Add Background' button on the main qdvdauthor screen. Pick your image. The image will probably need resizing; just go with the flow and pick the correct image size. Now you need to add those funky little menu items for selecting on. This is the really cool bit. Right-click on the background image you've got, and select 'Add Text'. Drag on the background to create a text box. You'll get a dialog come up, type some text in the bottom box, then click 'OK'. This'll create the text on the background. Drag it around if you need to. Finally, right-click the text and select 'Define as Button'. Another dialog box will appear. Rename the button if you like, then pick which video you want to play from the select box marked 'vmgm'. Click 'OK'. Repeat as necessary. That's all the hard stuff done. You can add a sound clip to play over and over again if you like, but I haven't done that yet, so you're on your own there. Step 3: Make the DVD For this step, I needed to compile toolame from source. Get it from http://toolame.sf.net/. This is super-simple. Basically, just click on the giant icon labelled 'DVD' in the top toolbar. Follow the prompts. Click 'OK' as necessary. When the process is done, check the 'Keep Open' checkbox quickly, and go over the output to ensure nothing completely crapped out. Assuming all is well, you can make your DVD image by running:
 mkisofs -dvd-video -udf -o /tmp/dvdimage.iso $DVD_DIR
Naturally, replacing /tmp/dvdimage.iso and $DVD_DIR with appropriate values. Lastly, cook the ISO to appropriate media with something like:
 cdrecord -dao -eject -v speed=2 dev=1,0,0 /tmp/dvdimage.iso
Assuming all went according to plan, you should have a physical DVD you can stick in your DVD player and watch to your heart's content. Congratulations! You just did all of this in about a 50th of the time it took me.

Julien Danjou: I am a "not so bad" maintainer :)

I just fixed some RC bugs in my packages to get my ass not kicked.
I uploaded a small update for apt-build. I tried to use it, and it seems to be totally dead. Trying to build blackbox (my reference test, this is historical), make died with a segfault, and at the end, apt-build died with a segfaults. Yee-pee ! And I don't know why, this is weird. I also asked the removal of torsmo (superseded by conky) and orphaned manderlbot, since I have no skill in Erlang. I also find out why I could not fix the f****** FTBFS on svnmailer. And it was because the -I.svn option of dpkg-buildpackage I used, skipped the svnmailer.conf.example file, obviously... Raaahhh, bad shell alias configuration => headache !

John Goerzen: A Christmas Conspiracy

There's been a bit of a plot in the air at church this Christmas. Mystery. Intrigue. Conspiracy. Even some good-natured holiday ribbing. And it's my fault. So let me explain. A little awhile ago, my dad and I pooled some money and purchased a nice Nikon Coolscan V negative and slide scanner. My first batch of slides to scan on this consists of 3 reels plus one box of slides from the church archives, some 600 images or so. I've got 350 scanned so far. We'll be using these in the centennial book we're working on, and I'll burn some DVD-Rs for use by the church in the future. There are some real treasures in this set. Some extremely rare color photos of the old church building (torn down in 1965), including its interior. All sorts of people in their younger days, plus photos of quite a few people that have since passed on. There were also many photos from 1983 for the church's 75th anniversary celebration. It's safe to say that few, if any, people have laid eyes on these photos in the last 25 years. About two weeks ago, I was remembering how I surprised Aunt Viola by giving her a print of a photo of the choir she directed in 1946. It occured to me how many photos are in this slide set that people would love to see. I started thinking "Hmmm....." As I was sitting there scanning, I had lots of time to think. (Each slide takes about 3 minutes at 4000 DPI). I finally decided that I could make nice prints of these images by uploading them to a photo printing service. I'd surprise a few people with an anonymous gift of photos on Christmas. Well, a "few" grew into "as many as possible", and I wound up ordering 175 prints. But I'm getting ahead of myself. I ran into a problem early last week. I don't know who many of these people are, or who their relatives are that still attend our church. I needed help. I had to enlist my dad in my conspiracy -- he knows many of these people and who they're related to. With his help on Monday, we identified people in some 300 photos. I rushed to get them uploaded to Shutterfly and place an order with overnight shipping to make sure they'd arrive by Christmas. They finally did. Terah helped stuff envelopes while I sorted out the photos. Each envelope had the name of the recipients, plus "Merry Christmas!" written on it. Our names were nowhere to be found. Saturday afternoon, before the big Christmas Eve program, my brothers and I (who had heard the conersation with my dad, but were good at keeping secrets) helped me stuff mailboxes at church. We escaped without tipping anyone off to what we were doing. The Christmas Eve service came and went. I tried to listen for conversations about pictures, but didn't hear any. I was a little concerned -- hopefully people liked these photos. I knew that the moment my aunt saw her photos, she would be able to figure out it was me behind it, and would spread that, but I figured I'd remain anonymous for awhile. It's fun to keep people guessing. Well, I accidentally blew my own cover this morning. I asked my aunt about her pictures, but she hadn't opened the envelope yet. Oops. (In my defense, that's not very like her!) But it turns out that these photos have been a topic of many conversations over the past two days. Lots of 70- and 80-year-olds "blaming" each other for delivering surprise photos on Christmas. Wild speculation about who this anonymous Santa is. And where did these old pictures come from? Whose closets would still have such a thing? Plus, lots of checking to see exactly what photos each person got. (I tried to give people photos that would be meaningful to them -- friends, relatives, etc.) There was even some amateur handwriting analysis going on. Apparently nobody even suspected me at all. This was probably the most time I've put into a Christmas gift in a long time. But also the most fun and rewarding. I got to see somebody run out the church to show a picture of some high schoolers in 1965 to a friend before they drove off. This is what makes Christmas such a fun time of year -- touching someone's heart. The sort of thing that can't be found on any Walmart or mall shelf. I've never been able to give a meaningful Christmas gift to so many people before, and it is a really wonderful feeling to have surprised so many this year.

25 December 2005

Andres Salomon: Dabber

I’ve begun writing a jabber client, initially using xmpp4r, but after realizing that it’s missing features, I think I’m going to write ruby bindings for some other (C or C++) based library that has more features (any suggestions for which one?). I’m working on the interface using Glade 2. Overall, I’m quite impressed with it. I’ve discovered that it makes more sense to have a separate project per window (versus keeping all windows in memory, even when they’re never used). What this ends up looking like is this:
  include LoginWin
  def login_window(conn)
    if @loginwin.nil?
      l = GladeXML.new('../dabber_loginwin.glade')    h  method(h)  
      @loginwin = l['loginwin']
    end
    conn
  end
	
  include ChatWin
  def chat_window(conn)
    if @chatwin.nil?
      c = GladeXML.new('../dabber_chatwin.glade')    h  method(h)  
      @chatwin = c['chatwin']
    end
    if conn.nil?
      login_window(conn)
    end
    conn
  end
The last gtk project I worked on was Sinek. Working with gtk in Ruby instead of C, combined w/ tab completion (
require 'irb/completion'
ARGV.concat(['--readline', '--prompt-mode', 'simple'])
in your .irbrc) means I don’t have to waste time poring through the gtk manual looking up what methods a given object actually supports; I just create the object, hit tab a few times, and see a nice concise list. *Much* nicer to deal w/!

Enrico Zini: drezza - Get a picture collection ready for publishing

I've been having three wishes since some time:
  1. Lean Ruby
  2. Find an easy and fast way to find digital camera shoots that need an invocation of exiftran, and invoke it
  3. Find a comfy way to code user interfaces. In particular, I've always dreamed of sticking closures into event handlers.
I've recently managed to fulfill these three wishes in a single shot by coding dr zza, a minimal picture browser with quick links to invoke exiftran. If anyone is wondering, "dr zza" means "make it straight" in Bolognese. It is simple, it is easy, it does all I need: you invoke it and it will show all the pictures in the current directory. If you invoke it with a directory as commandline argument, it will show all the pictures in that directory. It will display the pictures in a list together with their thumbnail. The thumbnail is taken from the EXIF thumbnail. If a JPEG file has no EXIF thumbnail, it invokes exiftran to generate it. Clicking on an image in the list shows it in detail. In the toolbar there are buttons to rotate the image with exiftran, which uses a lossless transform and respects exif data. The tool comes in a single file, no need to install. The source code is clean and commented, and is also a nice demo of various Ruby/GTK2 and Ruby/Gnome2 features and programming tricks, including:
  • subclassing GTK widgets
  • creating custom signals
  • reacting to widget resize
  • processing GTK events during long computations
  • updating the Gnome status bar
  • embedding pixmaps in the source code
  • using custom pixmaps for the toolbar
You can get it from here. If you play with it, let me know and I'll keep it up to date.

Enrico Zini: Including inline images in Ruby GTK2

Including inline images in Ruby GTK2 I'm making a simple application and I'd like to keep it self-contained into a single file; however, I'd like to use some custom icons in it. I tried storing a pixbuf in a string:
ICON = <<EOT
/* XPM */
[...]
 ;
EOT
icon = Gdk::Pixbuf.new ICON
but it tried to open a file called "/* XPM */\n....". I tried with an array:
icon = Gdk::Pixbuf.new ICON.split("\n")
But I kept getting GdkPixbuf-WARNING **:Inline XPM data is broken: Invalid XPM header. Note that trying to write that data to a file and loading the file, worked. This worked:
icon = Gdk::Pixbuf.new "pippo.xpm"
This didn't:
tmp = IO.readlines "pippo.xpm"
icon = Gdk::Pixbuf.new tmp
I finally managed using csource:
  1. gdk-pixbuf-csource --raw --name=antani image.png > /tmp/antani

  2. insert /tmp/antani in the Ruby source code, strip away the comments, concat the various strings:

    ICON = ""+
      "GdkP"+
      "\0\0\4\30"+
      "\1\1\0\2"+
      "\0\0\0@"+
      "\0\0\0\20"+
      "\0\0\0\20"+
      "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"+
    [...]
    
  3. load the data with icon = Gdk::Pixbuf.new ICON.unpack("C*"), true

A possible improvement could be using --rle in gdk-pixbuf-csource: raw is good for avoiding to copy the image data, but I don't feel comfortable in doing it since the image data is an integer array temporarily generated by unpack. As usual, if you know of better ways please send me a mail and I'll update the blog entry.

24 December 2005

Steve Kemp: The evolution of a shell script

The script starts out small and does a single job. You realise that you can do so much more, so it gets bigger and more arguments get added to it. Passing more than four parameters, in the correct order, gets painful so you add some option parsing code. Suddenly the number of options grows, so you add a manpage to try to explain the parameters and what they are used for. Other people start using the script and wish to change the behaviour, so you add yet more command line switches and complexity. Gradually you realise your once-tidy script is now a complete mess, so you remove 50% of the code and move it into external “plugins”, or helper scripts. The small script is now much neater, but suddenly users cannot find the code they wish to change - they have to grep through all your helper scripts and plugins to find the code to change. Beacuse users cannot find the right code they submit patches making your script bigger and more complex. Repeat indefinitely. p.s. xen-tools 0.6 is out. It has plugins ;)

Simon Richter: Shopping made easy

I do a lot of the christmas shopping on the 24th every year. The salespeople have grown tired of the christmas music, and it is wonderfully quiet in most shops. Most shoppers are men with a hit-and-run strategy in mind (shopping is, after all, a stressful hunting situation), which makes the queues rather short and leaves you the possibility to ask questions. Everyone is happy that the madness will be over in a few hours. You just have to make sure you're out on the street by five minutes to shop closing time to avoid the last-minute rush. All in all, this has been a very relaxed tour and now I

Next.

Previous.