Monday, December 20, 2010

Libferris hits the presses again...

The January 2011 issue of Linux Magazine has some information on Federated indexing with libferris. Nice timing for the upcoming talk on libferris at next month!

Friday, November 19, 2010

Foray into Qt Models with libferris

Version 1.5.2 of libferris, released yesterday, includes both a QAbstractTableModel and QSortFilterProxyModel targeted at exposing libferris to the world of all things Qt. In libferris a great amount of information is exposed as virtual Extended Attributes for a file. As you can see in the below shot, the md5 as well as "ls -lh" size is available directly as attributes. Before you wonder, the md5 is only calculated on demand and is then cached relative to the mtime of the file.

Each file has thousands of attributes on my machine, these include tagging, geospatial information, extracted metadata, and RDF. In my GTK+2 model/view pair I allow the user to "sort" on a column but really have the view sort on another one. For example, as you see below, sorting on size-human-readable either means Qt or some class you provide needs to know how to properly sort on size strings like 14.2k etc. Instead of this, the QSortFilterProxyModel converts some column names into others, so a size-human-readable sort becomes a sort on the "size" column. As the latter is simply a number Qt knows how to do the right thing (TM). Although both columns are shown in the example shot, there is no need to have the size column visible too.

The mtime is actually converted to a QDateTime by the model. It is stored internally as an epoch integer. Thus the mtime-display column was added in libferris which shows you a human readable version. This is handy for command line tools and others which do not want to know about presentation etc and just want something nice to show the user. Most of these attributes in libferris have schema information, which makes it possible to pass them on to Qt in a nice way. Tags should come through as checkboxes etc.

The next logical step is to get at this from QML. I'll wait until I update to Fedora 14 which has Qt 4.7 in it. With the model, and some way to play back audio I should be able to make an audio player in QML. Two things help here; searches can return their results as a virtual filesystem which can then be shown in the QAbstractTableModel, and filesystem "selections" can be built as filesystems which can also be then displayed in the same way. So I have search and playlist support already from that and ffmpeg or some low battery way to make ogg into air oscillation then completes the loop.

Monday, November 15, 2010

Sharing is Caring...

My repository now contains a steaming ferris-sharing-plugin_0.2_armel.deb which will hook up libferris to the Nokia sharing system on the n900. This lets you click the funky Brussels atom building "sharing" icon from many places and copy images to flickr, 23hq, facebook.

There isn't much feedback at the moment, that is planned for "the future". You might also like to install the ImageMagick from my repo. Simply expand it to /opt and make a link /usr/lib/ImageMagick-6.6.0 -> /opt/ImageMagick-6.6.0/lib/ImageMagick-6.6.0. This gives you proper handling of exif orientation during scaling prior to upload with libferris.

I also have some tweaks to libferris itself which will be in the upcoming 1.5.1 release to help with annotations etc during upload. The next step is to get vimeo and youtube upload support happening too, since libferris can already upload to those.

Friday, November 12, 2010

Pop Quiz Hot Shot - ssh

You have ssh'ed into a host via three others and just noticed a file(s) you would like on the laptop you started all this merriment from, what do you do? Of course you don't have a control connection or tunnelling already setup because its a "once off" multi hop connection.

A solution that is not quite as widely known as I'd thought is to use the sz and rz pair. Hurrah the zmodem programs are still just as useful today as they were in the years of yore. The snag is that your local terminal needs to have some knowledge of this, konsole works nicely and will pop up a dialog asking where to save files "sent" to it. So doing ssh server; date >/tmp/df; sz /tmp/df will result in a dialog appearing on your local display asking where to save the df file to. Note that this works over multiple intermediate ssh hops. Just perfect for when you have routed your way into a protected network via 4 hops and find out that /etc/foo.conf which is 8kb would be *really* nice to have on the laptop.

This is packaged as lrzsz for Fedora and I've made an lszrz tarball available in my n900 repository. Let the zmodem goodness rain down...

Monday, November 8, 2010

Clawmotia and QML: Moving the TV

Some may know that Clawmotia is my MythTV remote control which started back in the n810 days. For a bit of fun while recovering from jet lag I decided to port Clawmotia over to using QML and take advantage of some of the n900's capabilities such as the accelerometer. Shown below is controlling the playback speed by moving the device. Apologies for the flicking video, it seems mythtv doesn't like the mov file in software playback much, but the Bunny is free to use so he made the audition.

Controlling MythTV with an n900 accelerometer from Ben Martin on Vimeo.

The normal functions from the older qedje remote are also available on the main page shown in the video below. I have now put the cursor keys into a submenu which is opened by both the joystick and menu buttons, the latter first getting mythtv to open the menu and then changing the remote configuration to show the cursor key submenu. This explains the vacant positions in the grid in the new design -- submenu shuffle has given me a few extra spots to play with. Also the settings can be set in the program itself now instead of the old edit the launcher file and set environment variables. I would like to make the volume adjustment use a popup slider and also route the hardware vol +/- keys to mythtv, but I'm still working out how to do the later.

Clawmotia QML: The Qt MythTV remote control from Ben Martin on Vimeo.

Interestingly, the big "oh no" moments came when I tried to do trivial things from QML such as reading a file (the accelerometer in /sys). I would have thought that QFile was available but it seems not. Perhaps it is from dedicated javascript files or I'm just doing it wrong^TM. I also notice that the simulator doesn't update that /sys file so you have to test that on the device :/

I also bumped into other things like hooking up signals bidirectionally which would need pass by reference or similar to make it useful in custom QML elements. I might also make some data bound classes to use with QSettings, it seems like an idea for a QString like class to update the QSettings automatically when you assign new data to it.

I also tinkered in Nokias SDK environment for this but reverted to emacs and js-mode because there are just too many things my hands are used to happening that don't in the SDK editor. Though for QML stuff I suspect I need to update my elisp to have better "add property" support so the get/set/signal/member declarations are all added from a "QString foo" input. I have part of that done but need to revisit it.

Monday, November 1, 2010

CRUD, metadata, indexing and Trees, please

For those in Australia who want to hear about libferris and doing interesting things with data using a everything is a file paradigm then you might like to drop by OSDC later in November and LCA in Brisbane in late January 2011. Both of these events will include a session with me talking about not only strange but also hopefully interesting and useful things you can do with your data using libferris.

Examples include mounting flickr, facebook, youtube, gstreamer et al. Just "cp" your image to upload. With gstreamer just "cp" from the camera on the n900 to your web service of choice. And heavier data manipulation like interfacing with SQLite and XQuery to get at any data the filesystem exposes such as these web services, berkeley db, relational data, dbus, running applications, composite files etc. I might also throw in some ODF processing such as using document forms to edit postgresql databases through virtual documents. Though what is in the main talk and what is in the post amble at the pub is yet to be delineated.

Wednesday, September 29, 2010

Open or Edit a QML file?

One limitation of doing things based purely on the MIME type of a file is that sometimes things that might be sniffed as C source code are really not. This also comes up with XML files. One solution which feels like adding a level of indirection is having the sniffer say this is XML and what the schema is, or this looks like C source but is really a QML interface. While this blog post presents a libferris oriented solution, I thought I'd syndicate because the core problem is broadly applicable.

Because I tend to want to have the computer do different things for the same mime type depending on where it is located or other metadata, libferris lets you tell it what to do based on any arbitrary predicate, instead of a mimetype == value test.

Like most things, this is setup and edited using... drum roll... a filesystem. The filtered bindings are evaluated before the normal mimetype value tests, and if a filtered binding is found it is used instead of any "generic" mimetype based action.

So, for the Qt SDK, I can have double click run the QML application and middle click open the source in emacs with a setup like the one below. Notice that I restrict the override to only /usr/local/qt URLs so I don't go handing QML files from arbitrary sources to qmlviewer. For those new to libferris the "| ferris-redirect" is like the shell ">" but can operate on any virtual filesystem object directly, without using FUSE etc.

fmkdir mime://filtered-bindings/qt-qml
fmkdir mime://filtered-bindings/qt-qml/actions
echo '(&(url=~file:/*usr/local/qt.*)(name-extension==qml))' \
| ferris-redirect mime://filtered-bindings/qt-qml/ffilter

ftouch mime://filtered-bindings/qt-qml/actions/open
echo -n misc/qmlviewer \
| ferris-redirect -a ferris-appname mime://filtered-bindings/qt-qml/actions/open

ftouch mime://filtered-bindings/qt-qml/actions/edit
echo -n emacs \
| ferris-redirect -a ferris-appname mime://filtered-bindings/qt-qml/actions/edit

These actions are used in the ego file manager as well as from the command line with
$ ferris-file-action -v foourl.qml
to view. Of course, alias fv="ferris-file-action -v" is your friend.

Saturday, September 25, 2010

n900: The claw arrives!

Clawmotia is a MythTV remote control written using Qt and EFL technology. My repository contains a tarball ready to install clawmotia onto an n900. Desktop shortcut optional :)

Simply extract the tarball into /opt on the device. From there, you currently have to install the desktop file yourself to get it onto the menus. Finally, you'll need to edit to tell the application where your mythtv server is at and which client you want to control through that server. I plan to add dynamic client selection and a user configuration window in the app itself, but I seem to have more plans than the clock allows.

Wednesday, September 22, 2010

Camera to Web the eagle has landed!

Pop quiz, hot shot; an n900 sits before you and something wonderful is happening in the distance. You've love to take advantage of the rear camera and share images of the wonderful event on any flickr API website or some sort of facial book site. What do you do? The camera has all sorts of custom APIs to access it, and the web sites all need some authentication and use REST.

Well, for those who know me, or of me, the answer is quite simple... just "cp" the data from your camera to the Web. And I've now got this working on the n900. I tried the front camera too, but unfortunately it comes out quite underexposed on in house shots.

To read the camera, libferris uses gstreamer. Because there are a whole bunch of ways you might like to read information, frame rates, transcodings etc, you use a file in your ~/.ferris directory to tell libferris how to create virtual files for your input hardware like so:

cat ~/.ferris/gstreamer.xml
<file name="live.jpg">
v4l2src num-buffers=1
! videorate ! video/x-raw-yuv,framerate=\(fraction\)3/1
! ffmpegcolorspace ! jpegenc
! appsink name=sink

Those with a keen eye will notice that the live.jpg is generated with the same thing you can use in gst-launch to create a jpeg image. The final element is an appsink which is where libferris gets the bytes from. I made that last element explicit because you can tee the data in gstreamer and do other things to have multiple end points.

Then to take a photo and put it up on the net:

$ fcat gstreamer://capture/live.jpg >| /Card/tmp/out.jpg
$ ferriscp gstreamer://capture/live.jpg 23hq://monkeyiq/upload

Of course, the fcat line above hints that you can use ssh to grab an image from the n900 to your laptop or server and upload it from there. See the ferris-capplet-auth for how to authenticate with the web sites and also how to have libferris scale before upload (optional) and what privacy settings to add during upload.

Next up is using the vimeo and youtube mounting in libferris to stream video to the net.

Monday, September 20, 2010

n900 goodies: unison, gphoto, working soprano, libferris, sixdof, coreutils, xerces3 et al

Some goodies for the n900 are now in my repository. Yes, I know it's evil to have my own, but if that's all it takes to be George Thorogood then so be it. In the at the aforementioned link you will find unison, gphoto, stldb4, libferris, ocaml, a compiled install of coreutils to avoid battling busybox, xercesc, xalanc, xqilla, and a (more) working soprano.

I'm a tad surprised that unison hasn't made its way into the main repositories yet. I can't imagine that outsiders like me are the only ones who use it or want to. If you follow the "only one me" assumption then unison works well for providing bidirectional data syncing. I have compiled unison without a GUI under the assumption that you will be starting the process from the laptop or other more endowed machine. Although unison is written in ocaml, you shouldn't need to install that to get the unison package going.

The coreutils is just a compile and DESTDIR install wrapped up into a tarball. Shove them into /opt somewhere and prepend them to your path and magically df -lh and other normal commands work again.

I have ported libferris to xercesc3 finally, so I had to package that for maemo5 too. Which explains the xml packages. I put xalanc and xqilla there too so I can play around with xsltfs:// and XQuery on the device. It's powerful enough for these things so why not do them ;)

Once I installed libferris on the device I discovered a strange crash. Long story short, the soprano on the device was using redland as it's backend, and redland was defaulting to using its hashes backend (Berkeley db) which wasn't available. So the current soprano works only with memory models it seems. Though support for sqlite is compiled into redland it isn't the default for soprano persistent storage. What is stranger is that db4.2 was already on my n900. So all of this could have gone away if redland was compiled with db4 support (which happens automatically when the db4-dev package is installed before compiling redland). To see if your redland will work with db4 run these on your n900... The first works if SQLite is supported, the second will fail if you do not have berkeley db4 support compiled. The redland (librdf) from my repository uses libdb4.2 on the device to enable the second command to work properly.

$ rdfproc -s sqlite myrdf add \
'' \
'' \
rdfproc: added triple to the graph

$ rdfproc -s hashes myrdf add \
'' \
'' \
rdfproc: added triple to the graph

So now the fun part starts, using libferris to "copy" images from the camera to flickr, mounting the sqlite databases on the device as filesystems, gluing the geolocations markers to those created on the desktop and other data/filesystem games.

Wednesday, September 15, 2010

n900: The new device!

Last week I got a wonderful surprise in the mail, a tasty new n900! The package "from" lists Quim Gil as the sender, so its come directly from half way around the world. Thanks Quim! And now for my initial thoughts and investigations; some of this will be of no surprise to existing owners, some of it was of some surprise to me. Oh, before I begin and loose folks to the down arrow key, anyone know of plasma packages for the n900? I'd like to port my abomination australian weather plasmoids over for mobile use.

Firstly, the device feels much faster than the n810. I'm not sure how much of this to attribute to the 50% faster clock of the CPU, the new GPU, differences in the ARM core itself or differences in software stack optimizations.

I should mention that during installation I found a few warts and issues here and there. Overall I really like the device, please don't consider the following criticisms as my only thoughts on the device, but given a limited amount of time with it so far, these bumps are still on my mind. Good points and comments about libferris on the n900, efl apps, accelerometer fun, and other hacking will likely follow once I get scratchbox up and running in a 32bit ubuntu vm.

As a filesystem guy I noticed a few rather nasty warts off the bat. A little constructive criticism for the new device?

Firstly that MyDocs is vfat, which I discovered when trying a good old ln(1) invocation. This is fairly easy to fix, and its now an ext4 filesystem. Soft links aside, the shared map tile cache gets put into ~/MyDocs/.maps by default, and I've seen some reports of bad internal fragmentation arising if that has remained vfat.

The temptation for btrfs was of course there, but for now MyDocs and /MemoryCard are ext4. That brings up the second thing I noticed, plugging in a new sdhc card, it was mounted and offered right off the bat. But if you mkfs.ext3 on that card (and change it to the right part type), the n900 doesn't want to know about it. There are fixes for this, mainly hacking /usr/sbin/mmc-mount to accept partition type 83 (Linux) and mount it "auto".

If you start hacking with partitions and whatnot, make sure you peek at and probably mangle /usr/lib/genfstab.awk to be smarter. I'm not sure using awk for creating /etc/fstab is a gain here. Especially inferring /home and ~/MyDocs based on partition type. Filesystem labels might be a wiser choice if lvm is not sought. I mention this because I managed to get the device into an endless reboot cycle which I suspect is due to it not finding the right filesystems early in the boot. As /opt is on /home and stuff gets shoved into /opt to save space on / (which is /usr too) then not finding /home might have some negative impact during boot.

For now I just made a more solid entry for /home and ~/MyDocs in the BEGIN block. Device boots up fine, is vfat partitionless and has goodness of ext3 and ext4 filesystens.

I then spent a bunch of time getting syncevolution to be happy. The result is I now have contacts and events from desktop, laptop, e71, and n900 all syncing. The issue that frustrated me was that the n900 was dropping timezone info and just calling imported events GMT. Of course this winds up shifting events in the calendar off by your UTC offset. For now, forcing syncevolution to use the older text/x-vcalendar format to hand to the n900 works around this issue. But it took at while to find that one out. Thanks to the syncevolution guys for their quick responses to my bug report. To get things clean, I need to move the report to the respective software that handles the data that syncevolution offers the n900.

I have KOffice installed on the n900 and abiword. The former brings RDF to the device and the later will soon join its ranks. Rich RDF cut and paste anyone? There are some very interesting possibilities using office documents, RDF and an Internet connected device when on the move. But I need to get some more lines of C++ out of my head and into my emacs before I can show them in action.

Wednesday, September 8, 2010

Metadata extraction and segv

This is a post about metadata extraction from files for desktop search. While it applies specifically to libferris, the same considerations apply to anything which trawls an entire filesystem looking to create a rich index of metadata to allow desktop search to run queries in a reasonable timeframe. Ferris runs fine on KDE and the n810 (soon n900?) so its applicable to both syndications in a way.

Back in January 2008 I released a version of libferris which allowed metadata extraction to be performed out of process. While this obviously means some context switching is added, it is not necessarily slower for it. It will likely be slower on a single core ARM chip, but on a four or more core desktop the processes can run in parallel and so might actually be faster for it.

I recently tinkered with this, moving to using QT for DBus inter process communications and activation. The design uses a worker interface which has simple get/set methods which take the URL and name of the metadata to fetch and return the data. The set also takes the new value to set.

There is a broker which sits between the client and the worker and provides an async interface and also allows more than one worker to be spawned and controlled without the client needing to worry or care about this. The broker has asyncGet which takes the same URL and metadata name, and returns a numeric ID for this request. A signal is then fired either for success (with value) or failure (without). A failure might occur when the file at the URL is corrupted and the library used to inspect it for the metadata crashed. This is of course recorded so it doesn't constantly happen for that file.

The upshot is that I can use libferris to view a directory and if the xine metadata plugin crashes, the file manager stays around and only the background dbus worker process crashes. This is not to pick on Xine, which is a great project, but if hacking on libferris has told me anything it is that there is always a file on the drive which has some bytes in a strange way that is unexpected.

Perhaps more interesting than the file manager, the file indexer can trawl through everything and will not itself crash when a strange invalid file causes a segv in metadata extraction. So partially downloaded (and failed) content in my ~/FromInternet folder will not halt the indexing process with a segv.

Using DBus with a simple interface like that also allows new metadata extractors to be shared more easily. It doesn't matter if Strigi, Tracker, Beagle, or Indexer Foo use C++, Qt, mono, perl or whatever, as long as they can offer two methods on DBus. Though some factory/activation stuff is also needed to let the indexers and projects know that metadata these plugins can handle.

For those who haven't hit the pagedown by now, the interfaces are in
and worker_introspect.xml in the upcoming release of libferris (ie, the one that will happen in the next week or so when I get a moment). The DBus processes live in the apps/metadataserver of the libferris tarball.

The broker interface looks like this:

<method name="asyncGet">
<arg type="s" name="earl" direction="in"/>
<arg type="s" name="name" direction="in"/>
<arg type="i" name="reqid" direction="out"/>

<signal name="asyncGetResult">
<arg type="i" name="reqid" />
<arg type="s" name="earl" />
<arg type="s" name="name" />
<arg type="ay" name="value" />

<signal name="asyncGetFailed">
<arg type="i" name="reqid" />
<arg type="s" name="earl" />
<arg type="i" name="eno" />
<arg type="s" name="ename" />
<arg type="s" name="edesc" />

Friday, August 27, 2010

Yubikeys and KDEs

The yubikey is a small usb flash drive like device which can generate a one time password on demand. When it does this it inputs it as though it were a usb keyboard. You can set your own keys on the device and authenticate yourself locally using OTPs which is useful as well as cool.

A little series of hurdles later and I have the key unlocking KDE4. Some of the issues you are likely to see are that /etc/yubikey needs to be +rw by whatever is trying to use it. So making a yubifoo group and setting /sbin/yk_chkpwd to be setuid that group can be a plus. The biggest problem I had was trying to get the YubiPAM module to unlock KDE. It turns out that it was getting the user name and sending that to a child yk_chkpwd to verify instead of sending the current auth token.

To fix it, you might like to mangle pam_sm_authenticate() to use the following to get the authtok and send it through as the one time password for verification...

const char *prompt = 0;
const char *authtok;
int rc = pam_get_authtok( pamh, PAM_AUTHTOK, &authtok, prompt );
if( rc == PAM_SUCCESS )
otp = authtok;

REMOVE these two lines which don't seem to work

otp = get_response(pamh, "Yubikey OTP: ", verbose_otp);
retval = pam_set_item(pamh, PAM_AUTHTOK, otp);

With this in place and the normal line in /etc/pam.d/kscreensaver:

auth sufficient

the key should unlock you, or a regular password too. If you want two phase then it is easy to hack that into pam_sm_authenticate() looking for a pin prefix inside the authtok. Breaks the rules of module stacking in PAM, but works as they say.

To setup an offline aes key, make one somehow and use

ykpersonalize -o fixed=$modhexwhatever -a $aes_key_here \
-o -static-ticket -o -strong-pw1 -o -strong-pw2 \
-o -man-update

ykpasswd -d $my_user_name
ykpasswd -a $my_user_name -k $aes_key_here \
-f $modhexwhatever \
-o OTP

ykvalidate -u $my_user_name OTP

where OTP indicates a tap of the yubikey.

You can also get a layer down from ykvalidate using

echo -n OTP | /sbin/yk_chkpwd $my_user_name

There are other groovy scripts around to lock the screen when the yubikey is removed from the machine which might be a nice next step... now that it actually works to *un*lock.

Monday, July 26, 2010


For those who haven't done seen it, now has its CFP open, till 7th Aug. It was quite a tight window this time around, but if you already knew about the conference, you probably already have something to pitch to the call :)

IMHO it would be nice to see RDF/Nepomuk folk(s) and some maemo/moblin/i-rebrand mobile hackers too. So please excuse the dual syndication on the premise that some hackers might not have noticed the CFP but have cool stuff which just might be made cooler by chatting over a few beers in 30C summery weather.

Tuesday, July 20, 2010

Winning the West...

This morning I discovered that the UPS had played games during the night and my server was thus off. Turns out the machine endured a hard power drop complements to the APC 1500 UPS. I must say, less than impressed is a euphemistic rating for that particular rack mount UPS. On the other hand, the little 620VA APC unit I have works fine.

Anyway, so the server didn't want to boot, one of the XFS filesystems was wedged. Setting aside the fsck.xfs == nothing glory, at times you do need to xfs_repair. I've hit this once before, having to repair and zero the metadata log to regain mount ability. No log zeroing was needed this time it turned out.

The trick here is that during booting of a Fedora machine, if a local filesystem complains during fsck -A loud enough then you get offered a root shell assuming you have the password. Unfortunately, every character typed seemed to be taken as the password, so if root has a password of length > 1 char then you can't login this way. And with 20 local filesystems and no indication of which was the problem this makes for hours of bliss. Forget rides in the mountains, nice scotch, or a good book, Russian roulette with fsck is the edge of the seat fun way to spend a few hours.

Anyways, having a 4gb live Fedora USB stick helped. Having access to rpms for XFS helped too, and those were extracted and installed on the USB stick should the need arise again. For those finding this through the libferris internet searches, the command you are after is

rpm2cpio foo.rpm | cpio -id

to extract the foo.rpm to paths relative to the current directory. Though if that command escapes you then having a wedged ext? or XFS not permitting you to boot up would likely be an epic problem. FWIW I also managed to wedge btrfs into a charming state recently due to a non UPS backed power failure. This is not a slur on any of these filesystems. Trying to get performance and durability in the face of arbitrary hardware and firmware paths is not hard, its rock hard^TM. There is no substitute for a good UPS if you care about your byteses.

Saturday, July 10, 2010

Take the Wrather With You...

If anyone in the maemo world knows of recent plasma packages for the n810, please drop a line or leave a comment linking to it from here.. The post is about Abomination, my perl/KDE4 code to grab and log data from the Australian Bureau of Meteorology and present it in an interesting way.

I notice that doppler wind is now available from the Australian Bureau of Meteorology. Also, I didn't notice the up to 512km composite rain maps before. The plan is to include support for both of these radar types into my KDE plasmoiods. I think having the doppler wind as a transparent overlay above the rainfall overlay would be quite telling, being able to see why clouds burst at given points.

Though this doesn't solve the deeper, more interesting question of if the system that is causing the interesting wind trend will remain for the next 2 hours while you are outside performing activity-Y and wanting to remain dry.

Sunday, July 4, 2010

Perl io::all, REST, and libferris, wagging the dog

A feature that I've had planned to add to libferris since the UKUUG spring conference earlier this year is Perl io::all support. I've syndicated this because adding an io:all interface to KDE kio stuff would also be very cool IMHO.

I'm digging around for others who think io:all is cool and perhaps that libferris is "plus neutral" and might have some time to help out with the creation of a CPAN module to let the two things work together. In libferris there is a single shot interface to get metadata or file content as a single std::string or an std::iostream based interface allowing seeks, streaming and all that jazz. Ultimately I'd like to make the streaming stuff meet perl::io and also have a fake hash there to allow EA to get read on demand. The C++ and to a fairly large extent the Perl binding side I have knowledge of. But I admit to mostly being a Perl user rather than developer of the language or CPAN modules.

If anyone has pointers to stuff that would help out doing this stuff (tutorials and the like) or would like to support the feature in other ways please drop me a line or comment here. Otherwise, I'll probably dig into this later this year, time permitting.

I'm also thinking about making a REST server for CRUDing libferris. This should make Web clients much simpler to create, for example file managers in Yahoo widget UI. Once again, if this interests you, feel free to jump on in ;-p I'll have a survey of existing REST apis for this sort of stuff, obviously providing a similar interface will help other clients to interface. Luckily I can reuse some of the knowledge I gained when mounting web services as filesystems in the creation of the libferris web service server.

Saturday, June 26, 2010

Meritocracy, Fate Or Anarchy

Many folks on a higher pay grade than mine tout that open source thrives as a Meritocracy. In this model, folks who are interested enough create a project and release the source under GPL/Whatever and if the project is "good" or "gooder" than other ones it has more merit and will advance to become more widely used etc. One interesting counter point to this made by Alain de Botton in his TED talk where if this rise due to merit, then things also sink due to it. Alain is not talking open source, but if we switch to that context, then if your project is not becoming successful, or you are struggling, then the Meritocracy eye balls would see that since you created the project, by implication you are scum.

During such talks of open source, I have to remove myself from the direct discussion. My hubris is not quite up to the task to extrapolate my situation, be it good or bad, to the larger context.

However, I have seen other people who have single handedly created fairly complex projects over many years only to have large corporate sponsorship arrive for other offshoot or fairly recently created projects. In this case I often wonder that it really doesn't seem that merit has much input into the funding decision. Of course, some will say that to talk about open source and funding is crass, if you like to do it then you will regardless of the open fingered gloves and dynamo powered netbook. But seriously, if a project gets 5-10 full time paid developers, are you confident you can "compete" with that, for 6 months, 3 years, 10 years? Or is it the case that more or less your project has been swept under the bridge by a corporate funding decision you were not even aware was happening?

Another good example of this is the Linux distributions who want a project for "Y" and decide to create a solution themselves rather than trying to adopt something that a committed developer has been working on for years. In some cases the "owning" the code can be more important than reuse, and most often the code is released under and open source license. But this be a fairly vicious demotivator for folks who were writing the existing "Y" solutions.

The specific examples of these sorts of things that I've seen over the years have led me to wonder what sort of model open source really follows. It does seem that Fate or Anarchy are most close to the process at times. Fate particularly coming into play when a developer is at a conference and happens to bump into the guy who works at a company who might be funding a project in a similar area soon. This angle has implications for open source conferences and CFPs in general. If you are not living in Europe or the USA then you will have a lesser exposure to conferences in those spheres and to some degree your project will have less chance of success, no matter what the code does or how well. While many conferences have a travel budget, where you are living will be a factor in whether your project Y or somebody else doing Y2 will get to talk.

Unfortunately these thoughts do not really have a strong conclusion. I thought I'd throw it out there a long with a few TED links to try to brighten up some a few folks who might have read about open source as a meritocracy and started to feel gloomy. Another interesting and related TED is by Dan Pink.
And all ya'll might like the metated which lets you grab talks from a single link source. Its really just an XML file with direct links and metadata, so if your downloader doesn't like it, emacs and wget are your friend.

Monday, May 31, 2010

redrum a distro: rm -rf /Fedora13

Some discussion recently came up as to what the outcome of a "rm -rf /" would be on a Linux machine. It's been ages since I last tested, and at the time there was no LVM in use, and /dev was actual nodes instead of a virtual filesystem. So, I was installing Fedora 13 64bit to test some hardware out and couldn't resist "seeing what happens". Needless to say, its not going to be an outcome that is pleasant, but academically interesting perhaps. If you don't know what the command does, don't execute it! And probably, don't even if you know what it does ;)

Also, I ran this from a gnome-terminal under a normal graphical session.

The filesystem layout was:

Filesystem 1K-blocks Used Available Use% Mounted on
51606140 3111784 45872916 7% /
tmpfs 769704 548 769156 1% /dev/shm
/dev/sda1 495844 28538 441706 7% /boot
560152184 203192 531494900 1% /home

The home partition still contained /home/whiteele/.gvfs and the root lvm had var/lib/nfs/rpc_pipefs and empty boot, dev, home, proc, selinux, sys directories. But other than that everything else was eaten by the rmrf. Oh yes, and you have to supply the --no-preserve-root option to ensure the rm command that you know you are being silly.

Friday, May 28, 2010

Libferris and flickr, vimeo, facebook etc.

If you don't read Linux Format, issue 133 and 132 have some good material on how to mount web services as filesystems using libferris.

Friday, May 14, 2010

Plasma, libferris, and Google Spreadsheets

In my previous post I talked about how libferris now has a Plasma DataEngine which lets you get at the entire virtual filesystem (on demand) from plasmoids.

I've since extended things so that the DataEngine now includes a Service object, allowing plasmoids to write data too. Instead of tracking an XWindow, this time around I'll track a Google Spreadsheet and update it through the plasmoid. Doing this makes a mounted web service like GSpreads into a pastebin with access control applied. So you can share your clipboard with anyone in your "group" or company and stop others getting at it.

The two plasmoids show two spreadsheet cells, the top one is the top coloured cell and the bottom plasmoid is the lower, purple cell. The purple cell in the spreadsheet is the sum of the three cells in the column around the peachy cell above it.

First, updating the spreadsheet through the browser is reflected in the plasmoid. Towards the end I copy and paste a number into the top plasmoid, which updates the peach cell in the spreadsheet, which in turn causes the purple cell to update and so the lower plasmoid shows this updated sum. Of course, these two plasmoids don't have to be on the same machine. For tracking sums or other formulas, the ferris_graph might be more interesting if you are more interested in the trends than the current value.

plasma-google-spread.avi from Ben Martin on Vimeo.

Wednesday, May 12, 2010

Plasma & the libferris DataEngine

In a previous post I mentioned that libferris can now mount Plasma DataEngines. Of course, the opposite would have to follow; you can now access the entire virtual filesystem of libferris as a Plasma DataEngine. For those who are unfamiliar with libferris, it is my little virtual filesystem project which can mount xml, isam files, relational databases, flickr, vimeo, google spreadsheets, Firefox, XWindows, and shall we say one or two other things :)

To play around, I now have a DataEngine that ships with libferris itself (which exposes libferris to plasma), and a few custom plasmoids which basically ask the libferris data engine to "cat" files and metadata.

One of the things that libferris can mount is the XWindow system. This lets you see all your windows and their size and location. This data is exposed in xwin://localhost/window and the Extended Attributes (EA) x,y show the x and y position of each window. For example, the below command will show you the name and location of the window "foo" on your local X:
fls --show-ea=name,x,y xwin://localhost/window/foo

The libferris data engine makes "sources" on demand. You ask for a source by supplying the URL you want to read, the data engine makes the source for you and the content key contains the contents of that URL. If you want to get at metadata through the EA interface, just use @attribute in XML fashion.

The two plasmoids I made are libferris_cat and libferris_graph. The former just shows you text of the URL you have configured, the latter allows up to four files to be read and graphed. Obviously the latter plasmoid is meant for numeric data.

So to see the location of a window with ferris_cat set the URL to:

Which is what I've done in the below video. Notice that there are two plasmoids so I can track the X and Y ordinates of the window as I move it.

plasma-cat-window-position-encoded.avi from Ben Martin on Vimeo.

The same data is shown using ferris_graph below.

plasma-graph-window-position-encoded.avi from Ben Martin on Vimeo.

Libferris can also mount postgresql and other relational databases. For postgresql you can run SQL and execute database functions through the filesystem as well as interact with the base tables. Lets assume you have a simple database like the one shown in the below setup:

drop database testplasma;
create database testplasma;
\c testplasma

create table folks ( name varchar, salary int, id serial );
create view stats as
select min(salary) as min, max(salary) as max, avg(salary) as avg
from folks;

insert into folks values ( 'Fred', 15 );
insert into folks values ( 'Mary', 17 );
insert into folks values ( 'Henry', 21 );

select * from stats;
min | max | avg
15 | 21 | 17.6666666666666667
(1 row)

To get at this with libferris you might start by probing around the pg:// or postgresql:// URLs:

fls pg://localhost/testplasma
folks stats

fls -0 pg://localhost/testplasma/stats
15 21 17.6666666666666667 17.6666666666666667-21-15 avg-max-min
Adding the --xml switch to shows something including:
avg="17.6666666666666667" max="21" min="15"
name="17.6666666666666667-21-15" primary-key="avg-max-min"

Because the view has no primary key, libferris has used the values of the whole tuple to form a unique file name. This is less than optimal for our needs when using the DataEngine because we want a stable filename. The solution is to leave out the name and just use "*" to have libferris expand it for us! So the below URL will have ferris_cat track the "min" value in the view:

The below video shows ferris_cat on the left viewing the min, the ferris_graph in the center shows min, max and average, and the avg is shown in the ferris_cat on the right. I add and remove a few folks from the table to see the effect on the plasmoids.

plasma-ferris-postgresql-encoded.avi from Ben Martin on Vimeo.

Of course, for a production PostgreSQL server you would use a scratch table and triggers to update it so that aggregates are not computed over mid to large sized tables all the time. Another advantage of triggers and a scratch table is you can easily handle rolling averages and delve into more advanced statistics while keeping the overhead known.

In short, if you can ferrisls and fcat something interesting, you should be able to drop it onto your desktop and monitor it now too :) All I need now is to get plasma onto my n810 :/ I have a feeling I'll be playing with tracking facebook and online spreadsheets using plasma+ferris soon ;p

Saturday, May 8, 2010

Desktop Annotations...

OK, so a post about annotating files and desktop search. KDE guys might be interested because libferris uses soprano, the base of RDF on that desktop, maemo guys might be interested because all this works on that platform too, and I have a specialized index structure for n810 power level devices in libferris.

Tagging and Annotations are closely related. Tags (or emblems in libferris terms) are great for assigning one or more concepts to a file.
Annotations are great for adding some free text to something. While a short annotation might seem like one, two, or three tags, as in the example below, annotations also carry linguistic weight. Normally with tags you don't care about the order the tags are added to the file. With an annotation and a full text index you should be able to do proximity matching and ordered searching "seed collection" matches but "collection seed" doesn't. There are also issues of human language stemming which many tag systems silently ignore but full text indexes tend to have to address.

Below is the ego file manager 0.30.0 with the Annotation side panel. This panel auto saves the annotation if you select a new file or if you stop changing it for a few seconds. Hotkeys make this all quite handy. I'm using Control-t to start interactive tagging and Control-6 to switch to the annotation sidepanel with focus in the text block there. Hitting tab in the annotation sidepanel moves focus to the file list, so you can skip to and from annotating each file without the rodent.

You can of course add, view, and edit these same annotations from the command line. The fedit command runs vi on the annotation, allowing you to freely change it.
I have just fixed a slight inconsistency in the fedit command so it now accepts the "-a attribute" option too. The fcat views the annotation "-a attribute" from the file.

$ >| tfile
$ fedit -a annotation tfile
$ fcat -a annotation tfile
hi, the new annotation

$ feaindexquery '(annotation=~new)'
Found 1 matches at the following locations:

Another nifty trick is to see the annotation right inside an fls output. Use mtime-display if you want the time to be more human readable than an epoch time_t.

$ fls --show-ea name,size,mtime,annotation tfile
tfile 0 1265954823 hi, the new annotation

Remember also that fls --xml gives you XML output, so with an XSLT stylesheet you can serve a directory of files and their annotation through your web server.
If this is of interest, see apps/phpsearchinterface/xml-results-to-xhtml.xsl for an initial stylesheet with row colour striping. It should be easy to extend the stylesheet to present other attributes. Bonus marks for anyone who makes it handle arbitrary XML attributes and orders them according to a predefined POSET. Patches always welcome...

When libferris saves an annotation, if DBus is enabled a signal is emitted on the session bus: "org.libferris.desktop", "AnnotationSaved"
which carries the URL and Path for the file you changed. This allows not only reindexing to happen, but you are free to hook up some Perl or whatnot to monitor this signal, then you can actually run some logic to work out what to do. If an annotation is saved, you might like to update an RSS feed for example.

And so ends the libferris tip of the day... happy annotating!
This post has been fueled by 99% cocoa, thanks to Jan-Piet Mens ;-)

Thursday, May 6, 2010

Plasma: Tree Shaped Eyes

After digging into KDE4's plasma a little bit it smelt a bit like an old friend. In Plasma you have one or more data engines, and each engine can have many sources. Each source offers a list of key-value pairs, which are updated at a nominated interval.

Normally folks think of filesystems as directories and files. But these days, you have to consider the Extended Attribute (EA) interface that filesystems offer as well. This makes a filesystem much closer to a large XML repository than just a collection of files accessible through a tree namespace (the directories). In libferris, each EA key-value pair can also tell the developer/user what schema that value has. This closes the gap between what a filesystem is and what a plasma data engine is just a little bit more. In fact, one might think of a plasma data engine as a virtual filesystem with a touch of extra stuff to allow a plasmoid to poll the data engine easily. This is not to detract from plasma at all, saying its "just a filesystem" means it is like postgresql, xml, or emacs to me ;)

For example, to see some current weather using my ABOMiNation plasma data engine and libferris (dev trunk), I can see the wind and also what type of value that EA or data engine key-value is:

$ fls -l \
--show-ea=name,air-temp,wind-speed,wind-gust,schema:wind-gust \

nnn1 22 15 26 schema://xsd/attributes/decimal/integer/long/int

One major upshot of looking at plasma in this way is the major upshot of everything being a filesystem. I can "cat" values directly from a data engine and also use fls to inspect data engines and their values from the command line while developing. plasmaengineexplorer is very nice, but its a bit of a pain to use a GUI tool to test out if the data engine is working when you are in a compile, run test cycle. It is also really easy to pluck out data from plasma with libferris, for example, the above fls with a --xml on the command line will do what you imagine. And if you are a nepomuk fan, using fls --rdf will give you an RDF/XML file to enjoy.

I found a few of the data engines would crash if they are started with a QApplication that forces GUI to off. So I black list
s == "tasks" || s == "mouse" || s == "keystate"
in order to mount plasma at the moment. Also, I'm using the signal/slot callbacks to get at the source key-value hash because the immediate mode methods don't seem to want to work for me :/

Tuesday, April 27, 2010

Plasma: Environmental Awareness

Last time around I mentioned the plasmoids I finally decided to write to show information from the Australian Bureau of Meteorology, or BOM as it's lovingly known in some circles. I have put in place a few more touches to make it useful and have been experimenting with it since the last post. Shown below is the updated radar view which uses a custom background image and a modified locations overlay. The sat images are from Google Maps.

This gave me the idea that this particular plasmoid should be "Environmental" instead of just weather. If there is a crash on the north bound road that you use, seeing a little red dot there would be great. Having it pulse when you animate the radar would also be good so you have a much greater chance of seeing it. Likewise, for bus and train services, seeing which lines of interest are inactive due to track work or where delays are. It is more about showing things that are of interest today than just the weather.

I'm thinking that using Marble and Nepomuk (RDF) here would be the way to go. Telling marble that the doppler radar images are for dlong/dlat and extend to dlong/dlat should be OK for overlaying them. Nepomuk would be the way to go for harvesting the other information, like the delays or traffic reports and if they are properly geotagged, perhaps geo84, then a sparql should be able to bring them to the map. Of course, a timeline slider would then live on the top so you can see things that might have happened but been already resolved.

My mind's eye could see the benefit to the gust / average wind speed vs time plot plasmoid, but now that I have had it running for a while I can also show folks that I wanted... as you can see, looking at the plasmoid on the right, the red is the average wind speed and the blue extends to the gust speed. It becomes obvious not only if it is breezy, but if there is a large amount of variability in the wind. This metric is very important to some activities that are sensitive to wind. For weather geeks, the drop in wind should also show in the temp graph on the left because the apparent temp will alter as well. Though at 16C with winds < 10km/h it is to small to really see. BTW I know that the times are wrong in the title, there is an erroneous UTC offset happening to that epoch somewhere along the lines it seems.

I am not fully happy with the Forecast view. The icons and max temps for today and tomorrow are shown on the left and the detailed text on the right. It is very hard to show the detailed BOM text graphically, as things like "Chance of a late storm" require strange combinations of the "Fine" and "Storm" icons from the KDE set, and that doesn't take into account the "chance of" part in the text forecast.

These will likely be shoved into KDE's svn as aaron suggested. If anyone feels strongly _against_ that choice then please ping me, otherwise I'll assume sunshine and lolly pops.

Monday, April 26, 2010

Plasma: It's an abomination I tell's ya...

Now that I have your attention and defences up, abomination is the name of my new plasmoids for showing the Australian Bureau of Meteorology (ABOM) National weather info, thus it is an ABOMiNation. Yes, my humour is offered for free, though you die a little with each joke.

Things are split up into Perl scripts, data engines, and plasmoids. Its still version 0.0.1 so expect a reading of the README and a bit of tinkering to get going.

One of the nice things is that the radar image loop can be offered on the desktop with just the latest doppler radar overlay. As the background, topographic and locations are all separate PNGs you can easily get a custom look and feel or theme for your version too.

Observations are downloaded for your nominated cities. The observations plasmoid can show the ambient and apparent temperature, wind average and gust speeds, and rainfall on a rolling graph. These screenshots were taken with a sample time of 1 second and a random multiplier to test, in reality you should see nicer bell like curves for temps and less sporadic curves for wind. Seeing the gust as a cumulative on the same graph is handy for motorbike riders so you can see how "choppy" things are at a glance. Especially if you have observations for other places that you are heading towards which might be 100-200km away from your abode. For temps as shown below the -1 as the offset to apparent temp from ambient temp. The time is always when the latest observation was taken.

As you see below, the blue area is the gust speed above the average. So a variable wind will show up graphically. The direction is shown in the title along with the average and gust relative to avg speeds. I particularly hate the weather applets that show the direction as an arrow, and wind speed as a smaller number. Chewing up screen for something I don't care about and not showing detailed wind observations.

As this was my first foray into KDE applets, I found the many tutorials on DataEngine and Applets to be a good start, but there are still times when you have to RTFS and grep the subversion to work out how to do things. I still have another plasmoid to write but a release will happen very soon. I infact tried today but its interface is annoying so I'll likely shove it up on in the next few days.

Friday, April 23, 2010

Looking for some coding work...

If you are on the lookout for a C++, GTK+2, Qt, Linux developer with a PhD and experience in persistent storage and indexing then I'm looking for you!

For those who don't know me, I am "the libferris guy". Which means I have played with virtual filesystems for many many years and implemented a good handful of ways to index and search diverse filesystems. Some of the articles I did for Linux Journal and will give an impression of the sorts of things libferris can do, and in the next months the Linux Format includes information on Web services as a filesystem, eg, mounting flickr, youtube, and facebook.

After hacking RDF support into KOffice earlier this year, I would very much like to work more with Soprano and RDF technologies. But anything involving indexing and storage is also of huge interest. In fact one of the things I like about RDF at the low level is that it overlaps these desires too, for example, my custom model partial implementation for Soprano which is targeted at great performance on embedded devices.

I have implemented some GIST trees for PostgreSQL and worked with C++ and development on a Linux platform for over 10 years. If you are interested in these things or just want a Qt hacker for a while then please drop me a line using the nick for this blog at gmail or sourceforge as email address.

Thursday, April 8, 2010

Nepomuk & Social Networking: The Golden Opportunity

After reading an article on Boxee recently which described it's social network integration it occurred to me how wonderful this would be to have for KDE. Having tags and ratings on the desktop is a really nice thing, but having tags and ratings coming through for arbitrary pieces of information from your "friends" makes things quite interesting.

From the Boxee example, why can't I see that Fred has also scheduled to watch Program-X. At the moment such recommendations are handled by many folks through IM or email, which is quite kludgey to say the least. There is no simple click to record or accept a recommendation, you have to mentally context switch to the TV schedule and update.

One thing that makes this all come together is not thinking of tags or ratings as binary or a single 1-5 range. To quote my own code, if a tag is able to also record the thoughts of many actors as a range, say a double from 0-100, and each actor has a level of trust associated, then the system itself can infer that if Fred is watching something and it is rated SciFi then automatically I want to take a peek too. By allowing tags and ratings to capture more complexity behind the scenes, the computer can infer more for us, and part of that can be a traditional 1-5 rating or whatever... hey, I work on virtual filesystems, is it really that strange that I would want to virtualize file ratings too?

The big gain here is if KDE itself can provide the spine for this. In my own system I stopped short of being able to automatically distribute these tag and file ratings. Surely they can be sent to other libferris systems and integrated, but that process, and the one of tracking friends and assigning privileges to them is not 100%.

Combining RDF with the social network element is an interesting chance here IMHO. Perhaps a central server of sorts is only really needed for tracking the privileges and assigning friends, and a p2p protocol can then be used to actually transmit the RDF you have decided to share to your associates. Though a fully central server implementation would probably provide a quicker starting point. As an upside, this would allow syncing RDF between many of your own devices -- tags from the desktop appearing on mobile devices when the VPN is up.

Of course, information sharing would have to be explicitly condoned by the user, and public key crypto would be needed to ensure integrity, privacy, and authenticity etc.

This sort of thing extends nicely to audio and image apps like Amarok and KPA. If I give somebody a copy of some images I took of London, when I add tags, they should also trickle through the system to them. If they are looking at a photo of the Wigmore Hall I took, they might like to know more about that place, and perhaps which CDs I have of chamber music from that trip.

This is something I'd love to hack on when I get the chance. In the meantime I thought I'd drop the idea here in case there are other folks who are also interested and we can combine forces.

Saturday, March 6, 2010

Can't get *there* from here

I've been thinking for a while about an application for mobile devices that knows rail, bus, ferry, and magical flying eagle timetables and stops. The idea is to be able to glance at a mobile device and see it say "hey you are at foobar, its 9pm, I guess you want to go home/to hotel, and here's how you can do it, how regularly that happens and the last time you could do it today".

Of course, n900 guys will want to just use a web service for this. But as mobile data costs kidneys in some parts of the world, I'm more inclined to choose a design that precaches the data when free wifi is available. This also plays well for travelling with roaming charges etc.

If you are travelling, then the machine should already know where you are staying and when, so it can direct you to the metro line of interest from where you are to get there. Again for travelling, being able to wangle a timeline to move "now" forward and see that the app can suggest reasonable options as it goes is also a good idea. You don't want to rely on it to suggest and then find you are late for the jet.

I'm thinking perhaps Qt/Soprano for this, but the exact RDF vocabulary for the bus, train, etc timetables is not jumping out at me. There are many adhoc designs I've thought about, like a series or RDF list of ical entries for each bus run, perhaps with each entry using geo84 or some other ICBM assocation method. If you know of a good RDFS for this, please let me know. I don't know when/if I'll get to hack on the code, but the itch to do so is unlikely to go away by itself.

Friday, February 26, 2010

Everything is a filesystem. Everything is an emacs buffer.

I finally started hacking on TRAMP to add libferris support. I notice that in 2009 GVFS support was added to TRAMP which is very cool. I was originally poking around the lisp sources for the various things that TRAMP can use as a virtual filesystem when a fairly clean design hit me. Instead of bringing TRAMP to libferris, why not do the opposite?

So I started digging into the 8,000 odd line main tramp.el file and tracing ssh connections to see what commands were executed in the background. The plan being to add any of the POSIX commands that tramp wanted which libferris didn't already have clones of. It turns out there weren't too many, mainly ftest and fstat. These are needed to poke around and obtain details from the filesystem in order for tramp to know if things exist and more information about them. The twist of course if that much of the "stat" data is not available for some libferris filesystems. For example, an element in an XML file might not have a proper octal access mask, or indeed any explicit user/group information.

I currently have load/save working for subelements in XML files, and keys in an ISAM file like a berkeley db4. The patch to tramp itself is around 10-15 lines. Much of this can be abstracted out so you can nominate to use "the libferris command" instead of the normal coreutils one. eg, using fstat instead of stat.

$ fcreate --create-type=db4 --rdn=isam.db .
$ date | ferris-redirect -T isam.db/subfile1
$ db_dump -p isam.db
Fri Feb 26 18:24:55 EST 2010\0a

And to edit the subfile1 inside that berkeley db file over the network:
$ emacs "/monkeyiq@myserver:/tmp/isam.db/subfile1"

For performance, it is handy to play with version control and how backup files are made. The later is actually quite important for editing part of an XML file, because you can't have "elementname~" as a valid element in an XML document.

This works OK, but having the backups on the local machine is even faster.
(setq backup-directory-alist
. "/monkeyiq@myserver:/tmp/.saves")))

And now to get editing data from postgresql happening too, and oh, editing a buffer in an emacs process on a remote host which is mounted by libferris?

Saturday, February 20, 2010

Five Star General

I've been thinking about proxy patterns a Soprano lately. It seems like a great idea to create a Soprano::Model shim which logs mutable operations to an SQLite database. This would allow intermittent syncs between devices, so a maemo device could have a full local mirror of RDF and communicate with your laptops, servers and desktop machines to keep semantic knowledge in sync.

There are a bunch of nice little edge cases which make this deceptively complex. bnode handling for one changes the rules because identity must be preserved.

I'm not sure if/when I'll hack on such functionality, but I thought I'd blog about it in case somebody else is also kicking around the same ball :)

Sunday, February 14, 2010

Libferris: now and then...

Those who have been following libferris developments over the recent years will have noticed that I switched over to using Soprano for RDF support in 2009. I also added support for mounting relational databases (using QtSql) and converted the http and ftp mounting over to use Qt for network IO. This later point also extends to the support for mounting flickr, vimeo, google spreadsheets and docs etc. So Qt is slowly marching closer to the "kernel" of libferris.

I've been toying around with switching over some of the core parts of the libferris kernel to using Qt. Things like using Qt's smart pointers instead of the policy based ones from Modern C++ Design, switching over to using Qt signal/slots, and perhaps offering both iostream and QByteArray data access methods in parallel.

There are a number of "smaller" tasks to support this. For example, creating a stldb4 like library allowing access to Berkeley db4 and other ISAM files with a "Qt native" style API. Stldb4 only supports bdb files, whereas allowing other ISAM like gdbm, tdb, and WhateverDB to be accessed through the hypothetical QISAM library would be nice. If anyone has recommendations along these lines please drop me a line or leave a comment. I mention smaller in quotes above because I know this task is quite difficult to do well, things like ordering and prefix ordering of keys come up as well as support for secondary indexing and other goodies which are really needed to milk performance out of custom ISAM solutions.

The harder part would be porting over the core kernel of libferris to Qt stuff. As it would be extremely hard to do piecewise it would require a contiguous block of free time. It is also a fairly hard thing to try to get financial support for because the only "feature" it adds is the possibility of ports for other platforms. My point of mentioning this is that at some stage, libferris ports for Symbian and other Qt supported platforms will become much simpler. Finally I could "cp" an image directly from the camera of my s60 phone to flickr without the annoying third party apps.

As an aside, I was wondering how long it has been since I started using RDF on the desktop. The November 2003 version 1.1.12 release mentions mounting RDF... so it's been a while. RDF is extremely handy for separating data access from personal metadata. If you want to add an extended attribute to a read-only NFS share, with libferris and RDF you can, and you just use the same API as normal ;)

Monday, January 25, 2010

KOffice and RDF: Say it with Style...

This scattered series of posts has been about the RDF support I'm working on for KOffice. The ODF document format lets you store RDF/XML data inside the document file, which in turn lets both a human reader and a computer know about things that comprise an office document. You can refer to a person, place, or time and have the computer know what you are saying without having to resort to heuristics.

Having RDF support in document formats means you can send somebody a single file containing exact information about real world events. The RDF can contain details which can be pulled up in the formatting of the text that you see. For example, for a given contact you might know his phone number, home page, normal business location, email address etc. You might only want to see a small fraction of this information at one place in a document, but perhaps for a header you want to know the postal address too. Stylesheets are what I'm working on right now to let that happen.

At the start of the video below, you can see James, Joyce and Mark. As I click on these contacts, the RDF docker tells me information about them. As you can see, there is more information known to KOffice than is shown in the document (first & last name). However, for Mark, we also know where he is and that is shown in the RDF docker.

James is mentioned in the second paragraph, and the document is talking about giving him a call to verify something. Instead of hunting down his phone number, you can set a semantic stylesheet for that particular reference to him in the document to include is phone number inline in the document text. The added advantage here is that if you edit his phone number via the RDF docker, all the places in the document text that cite the phone number are updated for you. KOffice knows that those digits are James' phone number, so it can modify them for you.

Later on we again cite the event itself, just saying its "next weekend", which isn't an ideal description of when a specific event is happening. Luckily, we have cited the RDF event, so it shows up in the RDF docker and the stylesheets are available to reformat the text. In this case I want to see the summary and when it starts.

I'm working on adding user specified stylesheets now too, as the Format menu shows in the video. When you create a user stylesheet it is also saved in RDF, so the stylesheets you make become part of the document itself. They will be available when some other KOffice user loads the document.

The File/Document Information widget has a new RDF section which lets you see and directly edit the RDF triples if that's your thing, the semantic tab shows you all the higher level things that KOffice has seen in the document, like poeple, places, and events, and finally the stylesheets page lets you nominate how you want things formatted by default. For example, you might want to see a persons name and phone number so setting that to the default lets you then drag and drop some contacts from kaddressbook into the document and you will see the phone number as part of the document text.

Of course, you can drag and drop items from the RDF docker into kaddressbook and korganizer. These pieces of information should be able to be moved into and out of an ODF file using KOffice without thinking about it. You want to add Fred to the text, pick him up from your kaddressbook and drop him into the RDF docker. Your default contact stylesheet is then used to insert some text into the document at the current cursor location showing you the Fred contact. Quick and simple... Lets make RDF something everybody uses but nobody needs to learn about (unless they want to).

KOffice and RDF: Say it with Style... from Ben Martin on Vimeo.

Saturday, January 2, 2010

KOffice & RDF: Who, What, When, Where?

As mentioned in a previous post, ODF documents can contain one or more RDF/XML files. These files allow you to unambiguously encode information for both computer and human consumption. So you can describe a person in a way that tells you their phone number and also lets the computer know that these digits are a specific person's home phone number. Common data formats like vcard and ical have some encodings in RDF and soon a KOffice near you will understand these pieces of data from ODF files.

KOffice currently understands some of the FOAF vocabulary (storing contact data), and the rdfical format (for events). There are a few ways to encode longitude and latitude in RDF. The current patch supports two of them, with optional linking to rdfical. This is one of the major strengths of RDF, you can say who, where and when and also link these things together so an event carries not only a time but its location information too.

The below video shows the new RDF docker in aciton. As you click on text that has associated RDF, the docker shows you the interesting information. Frodo and Sam are assoicated with both traditional contact data and a location. The items in the RDF docker let you import them into your system (into kaddressbook or korganizer) or export them to well known desktop formats like vcard and ical. Editing locations is done with Marble and there is only a minimal set of information for contacts and events currently. Note that mid way through when I edit an event, timezones are respected. If the RDF describes an event as being in Tokyo, that timezone offset from your current localtime is respected.

Towards the end of the video I show that contacts can be simply drag and dropped between koffice and kaddressbook. This also works for events to/from Evolution but I had some issues with korganizer for events. D&D makes KOffice and ODF quite a convenient format for transmitting semantic information to colleagues in a single, self describing file.

KOffice & RDF: Who, What, When, Where? from Ben Martin on Vimeo.