GXml-GObject Serialisation: Back to the Future


Part of the past two weeks has been spent updating my system to a modern environment (Fedora 17) which mean development tool updates (like vala and gee) and updating GXml to support the changes there.  It took me a few days to correctly update the NodeList classes as they were Iterable and had Iterators.  One of which changed a little, and both now require implementing a Traversable interface, which turned out simpler than I originally thought it.  I'm not completely sure that I got the Traversable methods right, but I ended up realising that there were generic implementations that I can hopefully rely on.  GXml still passes its tests which seem sufficient.

Once that was out of the way, I could work on making serialisation code compile and base it off of JsonGLib.  (My first prototype was simple and stupid and built up strings that were then converted to a GXml Document :D.)  The current prototype has code that:

  • serialises to XML a GObject with properties (but not its member fields), similar to JsonGLib

  • deserialises from XML a GObject (assuming the type is known to the local system)

  • has an interface a class can implement to handle serialisation itself

Well, the third one probably doesn't work any more, as the first iteration of the JsonGLib-ish design that was using it was rewritten to work on whole objects right now.  Also, the serialisation and deserialisation of objects support most but not all property types so far (e.g. enums are skipped).

I've been documenting challenges I've been encountering under another category on my blog, #Technology.  Most of them involve bumping my head against Vala and figuring out how some things work in it.  It took me an embarrassing while to realise that GValue's transform and conversion methods will not convert strings to things like ints and doubles.  Whoops.

The goals for this next week are:

  • investigate options for serialising non-property fields (if any one has any tips (e.g. GObject Introspections) please note them in a comment :D)

  • get the interface into a happy state and tested

  • make the auto-serialising code more complete and eliminate compiler warnings

The current prototype code is available in GXml's git repository now.  I'm having severe difficulty bringing myself to publish code that's so rough, especially given the high standard I encounter in GNOME when submitting patches to other projects, and it kept me from sharing prototypes until now, but as I'm being reminded, it'll be more important to have it visible so that people who want to help can.


[Technology] Minimising copy and paste

I've spent much of the past two days discovering:

  • GValue does not have a means of converting or transforming strings to other values.  I'll have to parse strings of doubles to actual doubles manually.

  • Vala apparently does not like passing somestruct.somemethod as delegates into other functions (it complains that the struct is not a gconstpointer on the C side)

  • Vala does not like generic values as parameters in delegates.

  • You can't use a switch tree with GTypes as cases (e.g. case typeof (int64):)

The main reason is because after spending a week getting GXml working with the latest vala and gee and getting the serialisation prototype working on it, I would like to get rid of my massively ugly copy-paste if else tree.  The more I know.


[Technology] Lessons

I think I've had a bit of a negative attitude to interruptions to my work flow recently.  So, now I'll have positive ones.

Lesson learned today: the order in which you declare you implement interfaces in vala matters.  So, if you've created a collection that implements Iterable and Traversable from Gee, you need to list Traversable first.

It sort of makes sense, but the compiler doesn't warn you, and when I go to execute code that lists them in the other order, it complains about Traversable not being implemented though I know it is.

At run-time:

GLib-GObject-WARNING **: cannot add interface type `GeeIterable' to type `GXmlDomChildNodeList' which does not conform to prerequisite `GeeTraversable'

I should file a bug or offer a patch perhaps to add some sort of warning?  The run time system cares about the order.

[Technology] Wasting time

A call in Vala to Type.from_name ("gint64") kept returning 0.  I'm not sure how much time I wasted trying to make it work.  And eventually it just did, and now I can't figure out why it did not work.  Sigh. :)  (I'm assuming I had a typo somewhere that I fixed when I rewrote it a couple times.)

One thing I would like is if the documentation enumerated the string names of the known types, at least the fundamental ones.  I'm glad to know that typeof (int64) at least gets you the same value as Type.from_name ("gint64") (that is, 40). 


[Technology] Documentation clarity


Today I had Gee documentation described to me as quite nice.  I raised my eyebrow at that.  I provide the documentation for the new Traversable interface as an example.

I'm not suggesting my own documentation efforts have done better, but having to work with lightly documented interfaces is helping increase my appreciation for well documented APIs.  I must remember to do better!

I'm not just complaining.  I have a local clone of gee now which contains some corrections to the documentation.  I'm not bold enough to really rewrite much because I'm having some difficulty figuring out what the interface in question wants.  Hopefully by the end of the summer I can make a meaningful contribution in clarity.   I'm trying to remember to be responsible to help improve sections of the development ecosystem that cause me issues.

I am grateful to the helpful people in #gee on gimpnet like flo, though of course many questions I have to find the answers to myself.


[Technology] Work flow

In GNOME 2, the desktop was more window-centric.  For instance, alt-tab switching behaviour would switch between windows. 

In GNOME 3, it's application-centric.  Alt-tab switches between applications.  Alt-` switches between windows of the current application. 

I was surprised when GNOME 3 went for an application-centric environment, because my work flow for many activities combines multiple applications working together.  For example, devhelp, firefox, emacs, and a terminal.  It makes alternating between two points feel like shifting gears in a car when I have to alternate between windows in two apps.

In fact, when I have multiple concurrent activities open at the same time, several of them often use windows from the same applications.  This makes it a bit confusing as trying to switch windows within an application or between applications will end up intermingling the two sections a bit as I start tripping over windows for other activities. 

Consequently, I'm finally turning on the extension to revert to classic alt-tab behaviour, after almost at least half a year of GNOME 3.  (gnome-shell-extension-alternate-tab, if you wanted to know.)  This gives me a simple most-recently-used list of windows, so I can mindlessly switch between windows of different applications used under the same activity.  I'm always concerned about relying on extensions, because I feel like support for them could disappear at any point.

What I really wish was that the desktop was now activity-centric.  I thought that there had been talk of that before.  Perhaps it seemed like too difficult of a design challenge.  Perhaps it was not Mac enough.  I sort of effect activity-centric behaviour by moving different activities to different workspaces.  A problem with that is that the GNOME 3 alt-tab behaviour violates workspace boundaries and lets you alt-tab to windows in apps on other workspaces without resistance (just a visual vertical bar which blends all non-current-workspace/activity windows together without further distinction).  Also, the workspaces have been simplified into a dynamic list rather than a well-defined grid, which prevents me from finely spatially orienting activities (e.g. top-right workspace is for school, top-left for GNOME, bottom-left for personal activities, etc.)

I hope that in the future we can have an activity-centric desktop.  I feel like it would help productivity by simply helping focus.  It would probably require applications to be able to separate states for different activities: the browser tabs and bookmarks I want for school are different from the ones I want for GNOME.   I think segregating activities is important to minimising distractions.   I am concerned that the current directions will prevent GNOME as a whole from considering it further, as for me it would involve giving up on some current directions and reverting to things that worked better (for me) before.  I suppose that happened with Spatial Nautilus, though, so it could happen.

So, I'd probably like grid workspaces with distinct window sets again.  It's weird feeling an increase in productivity in that regard when I use GNOME 3's fallback mode (which I need to use for using my second monitor with my intel graphics).  I will say that the minimalism in GNOME 3 helps my productivity.  It turns out panels with window lists and panel applets actually are distracting.

[Technology] Empathy and IRC servers

I need to find out why Empathy fails 3 in 4 times to connect to IRC servers.  I'm supposed to in theory be available on one for GSOC but Empathy doesn't seem cooperative.  (Yeah, I could use another client, but in theory as the default client it should work.)  Whenever I sit down to debug it, though, it suddenly works. :|

[Technology] Vala and iterators

So for GXml last year I implemented a NodeList that complies with the DOM specs semantics for such a list.  Yay.  To make it usable in vala, I also made it iterable.  However, now the Gee.Iterable interface requires the Gee.Traversable interface whose documentation is minimal, leaving me a bit frustrated as I try to make GXml compile again on Fedora 17 so I can resume working on what I'm supposed to.  Sigh.



So, my latest disturbance following my upgrade to Fedora 17 is having installed versions of vala and gee change.  I expected that.  Apparently they're installed in such a way that their version numbers are included in their package name in the autotool files.  That can be worked around.  Strangely, gee now has 0.8 instead of 1.0 installed (change in version numbering scheme?).  That's fine.  Unfortunately, it also has a new interface for collections, Gee.Traversable. 

Now I can't compile the new code for serialisation until I've updated GXml to handle that.  Sigh.   I need it to compile so I can push my first branch of the GSOC.  Sigh.  Sighs all around.


#Development becomes #Technology

I'm renaming my label.  It's bugged me for a while.  It wasn't initially obvious to me how to rename a label so here are the steps I took.

  1. First use the search filter in the top right to filter only the posts with the label you want to change.

  2. Then use the "select all" box to the top left of your post list.

  3. Finally, use the Labels menu next to that box to add the label you want you to relabel things to and then click the label you want to remove (which will be on all of your selected posts since you filtered by it). 

Tada, old label gone, new label there.  A bit obvious, but yeah.


Some neat changes in the GIMP image editor.

  • With single window mode, you get a cool strip of thumbnails along the top for all the images you're editing. 

  • To default to lossless editing, you now don't save to file formats other than XCF (GIMP's format which retains all the information necessary to support its features), but you can export to other file formats like JPG and PNG.  That's great, because now people won't accidentally work on JPGs and lose layers or slowly increase lossy compression noise over multiple edits. :D


Upgrading success, at last


Here is a long-ish post about my trials and tribulations upgrading to Fedora 17 and what I found there.  The only real upgrade problem is anomalous and induced in part by my own creative behaviours.  What I found in the new upgrade was "not much" which is largely a good thing.


I'm always nervous when I upgrade my Linux distribution.  Sometimes it goes swimmingly, more often than not there be frost giants. 

Long ago

This time, a release or two back, I got clever when I wanted to converted my file system from ext3 to ext4: I shrunk my current volumes for root and home to free half of my hard disk, I created new volumes that were ext4, and then I copied the files from the old ones over to the new ones.  I then kept the old ones as "temporary" backups.  This was desirable because there was ext4 metadata that wouldn't exist for my existing files if I just upgraded the file system in place.


However, I forgot about the old volumes and they lingered, unmounted for the ages (months).  Then, when I used preupgrade (+ anaconda) to update my system to Fedora 17 the other day, it ended up finding the old volume and trying to update based on that.  I'm glad it failed to when it couldn't find the old partition that had since been overwritten.  However, it left me puzzled for a while and messing with my fstab.  In the near-end, I ended up realising it was using the wrong partition (anaconda has wonderful debugging information available, hooray!) and then used system-config-lvm to obliterate the slumbering frost giants/volumes. (I double-checked that I didn't want to preserve anything from that.)  You might think I should have noticed that I only had half my hard drive space, but it's a 500GB HD and I've only been using 160GB of that so I wasn't running into any space constraints. 

Stabbing fstab

Unfortunately, as noted above, I had started tinkering with my fstab and ended up rendering my LUKS-encrypted /home partition inaccessible.  The answer was slightly obvious but I messed up the first time I tried it so I ended up swinging my sword at it for a few hours before I came back to the start and got it to re-mount.  Hooray?

Finishing the upgrade

As usual, preupgrade + anaconda does a good job of updating existing installed packages and adding new dependencies, but I still have to do some extra steps to make sure some packages (like yum) are current and that some new packages aren't missed.  After upgrade:

$ yum distro-sync

$ yum grouplist | grep -v "Support \[" | less

I review which groups are available (skipping language support and capturing the list in less so I can scroll it easily) and then do

$ yum groupupdate "<groupname>"

to update groups, like "GNOME Desktop Environment" and "Base" and get any new packages that are a part of them.

This has impacted my productivity for the past two days a bit, with me mostly accessing the Internet via my phone.  However, at least I have a (slightly?) shinier Fedora.


speed and systemd

I think it actually feels faster.  I'm not sure why.  Boot feels a bit slower.  Is that because more things are done with systemd?  I notice that system-config-services doesn't let me disable services now.  I suppose I have to relearn that.  I think that GNOME Shell might be running more smoothly with my Intel graphics though. :)

wacom tablet support

I have a tablet PC, a Compaq tc4400.  When I try to calibrate it with the wacom support in System Settings, however, my screen starts trying to murder me with brilliant and rapid flashing of light.  The system also freezes up in the background.  When I'm not busy, I'll have to induce this cataclysm again and then check for error logs, I guess.

themes work

YES!  yum install gnome-tweak-tool gnome-shell-theme-* gnome-shell-extension-*

GNOME Tweak Tool has given me control over some nifty extensions (modifying font-size, whether some icons appear, enabling old tab switching behaviour, so alt-tab does both windows of the same app and different apps (no longer need to use ctrl-` for windows of the same app), switching themes).  Changing themes is the feature I'm second-most interested in (after modifying font-sizes to increase information density).  That was part of what intrigued me about GNOME Shell's choices for technologies: the promise of more interesting themes.  Hehe.  A friend and I were a bit disappointed with GNOME 3.0 due to the lack of options for this.  In GNOME 3.2, there were shell themes and Tweak Tool, but they didn't seem to work.  It appears there was one line in a .js file that needed correcting.  Anyway, if you'd like some help finding these, go to:


Mostly I'm glad to have a light theme which is proving notably less depressing.

keyboard shortcuts

My ctrl-alt-t shortcut for the Terminal is gone. :(  I've gone back and re-added it though through the Keyboard section of System Settings, and it was quite simple.  Hooray!

GNOME Documents

This now works on my computer.  I'm not sure what to do with it though: it gives me a mostly blank window and I don't have any real options.  When maximised, it enters a pseudo-full screen mode which confused me for a little while.  I did get one document to appear in it magically (but none of the others?  Perhaps they have to be under the XDG Documents directory?) but then when I tried to click on it, I first got an error, then I got told that the document type wasn't supported, then I clicked on it again and it showed me a preview.  I think the first two were happening when it was generating the preview and it wasn't complete?  When I have a moment, I will try to file a useful bug.  If you have any tips on how to get more out of it, let me know!  I read that there are collections.  I look forward to it reaching a comparable level of usability to my beloved shotwell.

Remote Desktop

Since F16, I started getting an icon in the bottom-right system tray for Remote Desktop and whenever I would click it to see what it wanted, it would crash.  It still does.  I bet that's just to do with my configuration.


Neat, gimp 2.8 is here.  Also, it has single-window mode (under the Window menu).  I like that, because it's an interruption to switch which window is on top just to switch brushes, and it's extra work trying to manually arrange the windows to not cover one another each time.  I'm eagre to try out its other goodies.


A bit annoyingly, I don't get a dialogue window asking me where to save them but now they go into my XDG Pictures directory.  Annoying because I put my actual camera photos in there, not screenshots and other images.  It's nice to not have to fiddle with a dialogue though, and I am guessing I can probably change its destination somehow. :)  I just can't find it with dconf.   I also miss being able to copy a screenshot directly to the clipboard from the dialogue that used to be provided.  (UPDATE: Aw, -i returns those features, just need to add that to the keyboard shortcut.)

Online Services

I'm still not sure I trust this. :)

All around smoothness

Everything feels smoother and cleaner.  I'm actually a fan of GNOME's reductionism.  I understand the idea that the Operating System and its Desktop Environment shouldn't be a Thing that the user really thinks about at all.  It should just function correctly in the background supporting your core tasks.  I used to spend a lot of time tinkering with panel applets, custom scripts, etc, but now I wonder why.  Even the tweaks offered by GNOME Tweak Tool feel non-essential (though I'm so grateful to have a light-coloured theme again).

Some of my favourite improvements are underneath.  Boot text is very cleanly organised now (thanks to systemd?).  Switching VTs is trivial and safe and easy.  I can do user switching without wondering whether GDM will crash.  I know these aren't all just in the latest release, but they make me feel incredibly comfortable inside GNOME and Fedora and I'm almost at the point where I'm willing to recommend it to more people.  Whee!

Final Note

I sort of object to the code name Beefy Miracle for Fedora 17.  I didn't want to complain so instead I just ignored this development cycle completely.  (Normally I pay attention and will test alphas and betas and file some bugs.)  The emphasis the release name brought to the exploitation of animals as something to be celebrated was a bit grotesque.  Given the inclusive nature of Fedora and open source in general, I hope we can strive for more sensitive and neutral naming.  (Though I'm all for fun naming. :)


Fedora 17 Upgrade

So, to upgrade, rather than downloading a DVD image to a USB or disc and installing/upgrading from there, and instead of using the system updater (yum) to update OS versions like I do regular applications, I use pre-upgrade.  It purportedly offers you the complete experience that downloading an image does without any of the physical media woes.  Yay!

It has a few stages.  First, it downloads all the packages you'll need to your local machine for the upgrade (from Fedora 16 to 17 this time) and then it asks you to restart.  You then restart into a preupgrade mode which is a minimal system that runs an installer that updates your system.  It's great.

My first problem is this:

Key phrases being "An unhandled exception has occurred", "device has not been created", and "non-existent 0MB storage" with some UUID string.  I assure you, doctor, my devices exist and are relatively healthy.

It seems to be documented well by bug 823048.  I will try to fix that and then update you on my next problem. :)


Bug 825500 ended up helping me resolve my bug.  There was an older root partition that wasn't being used that came first on my hard disk and Preupgrade was finding that instead of my active one.  Once I deleted that volume (using system-tool-lvm) Preupgrade + Anaconda proceeded perfectly smoothly. :)


GXml: bringing Serialisation for GSOC 2012

Hello there.  Here is a quick post because I haven't posted yet, but I am still a bit busy this week.

For GSOC 2012, we're adding XML serialisation of GObjects to GXml!  Whee!  For details, here is the proposal.  I'm happy to be working with my mentor from last year, Alberto Ruiz, again.

Since last summer, the amazing Daniel Espinosa Ortiz added autotools and useful GObject Introspection support.  Hooray!  Sadly, WAF support has languished a little and so have the tests.  My inadequate attempt to push libxml2 vala binding changes upstream also didn't go far, as most of my time went towards my Masters (two semesters to go!).  I'm pleased to be a part of the 2012 Google Summer of Code and grateful for the opportunity to focus time this summer on GXml again (rather than taking another unrelated (albeit exciting) Teaching Assistant position :D). 

So far, I've been

  • investigating other serialisation libraries, such as Java's serialisable interface, XStream, JsonGlib, .NET's XML serialisation, and Buzztard's BtPersistence.  I'm grateful to Emmanuele Bassi for answering questions about JsonGlib so far. 

  • fixing bitrot: I got waf working again, have the tests working again, and have addressed feedback on the vala libxml2 binding patch I originally submitted (and am making better progress now with it split up as a series of patches, thanks to reviews by the timely Evan Nemerson :D).  Relevant bug numbers filed today include 677375, 677374, 677359, 677355, 677354 if anyone's interested.

  • playing with serialisation.  Part of my thesis wants it, so I have a prototype with that, and I have a quick prototype trying to use JsonGlib's approach, but with XML.  This is just for self-educational purpose.

Coming up, an actual design needs to be agreed upon and plans on integrating the new functionality with other people.  Whee! 

Blog Archive

Dieses Blog durchsuchen


#Technology #GNOME gnome gxml fedora bugs linux vala google #General firefox security gsoc GUADEC android bug xml fedora 18 javascript libxml2 programming web blogger encryption fedora 17 gdom git emacs libgdata memory mozilla open source serialisation upgrade web development API Spain containers design evolution fedora 16 fedora 20 fedora 22 fedup file systems friends future glib gnome shell internet luks music performance phone photos php podman preupgrade tablet testing typescript yum #Microblog Network Manager adb apache art automation bash brno catastrophe css data loss debian debugging deja-dup disaster docker emusic errors ext4 facebook fedora 19 gee gir gitlab gitorious gmail gobject google talk google+ gtk html libxml mail microsoft mtp mysql namespaces nautilus nextcloud owncloud picasaweb pitivi ptp python raspberry pi resizing rpm school selinux signal sms speech dispatcher systemd technology texting time management uoguelph usability video web design youtube #Tech Air Canada C Electron Element Empathy Europe GError GNOME 3 GNOME Files Go Google Play Music Grimes IRC Mac OS X Mario Kart Memento Nintendo Nintendo Switch PEAP Selenium Splatoon UI VPN Xiki accessibility advertising ai albums anaconda anonymity apple ask asus eee top automake autonomous automobiles b43 backup battery berlin bit rot broadcom browsers browsing canada canadian english cars chrome clarity comments communication compiler complaints computer computers configuration console constructive criticism cron cropping customisation dataloss dconf debug symbols design patterns desktop summit development discoverability distribution diy dnf documentation drm duplicity e-mail efficiency email english environment estate experimenting ext3 fedora 11 festival file formats firejail flac flatpak forgottotagit freedom friendship fuse galaxy nexus galton gay rights gdb german germany gimp gio gjs gnome software gnome-control-center google assistant google calendar google chrome google hangouts google reader gqe graphviz growth gtest gtg gvfs gvfs metadata hard drive hard drives hardware help hp humour ide identity instagram installation instant messaging integration intel interactivity introspection jabber java java 13 jobs kernel keyboard language language servers languages law learning lenovo letsencrypt libreoffice librpm life livecd liveusb login lsp macbook maintainership mariadb mario matrix memory leaks messaging mounting mouse netflix new zealand node nodelist numix obama oci ogg oggenc oh the humanity open open standards openoffice optimisation org-mode organisation package management packagekit paint shedding parallelism pdo perl pipelight privacy productivity progress progressive web apps pumpkin pwa pyright quality recursion redhat refactoring repairs report rhythmbox rust sandboxes scheduling screenshots self-navigating car shell sleep smartphones software software engineering speed sql ssd synergy tabs test tests themes thesis tracker travel triumf turtles tv tweak twist typing university update usb user experience valadoc video editing volunteering vpnc waf warm wayland weather web apps website wifi wiki wireless wishes work xinput xmpp xorg xpath
Powered by Blogger.