Categories

Viewing registry (keys only…) from within SynCE-KPM

After the previous post I started working on integrating the stand-alone prototype within SynCE-KPM. As mentioned, at the moment I only have a view on the keys, not yet the values. Furthermore, at the moment there is no error checking, switching a device will not work, and some other minor things ;)

However, as you can see from the screencast

it is already possible to view all the registry keys that are present in the registry. Also, from the screencast you can see the Fetching… node that is shown to the user whenever the actual data is being queried for the first time. It can also be clearly seen that the fetching is done in a separate thread, not related to the GUI thread, because even while fetching, the GUI still is responsive. Any further requests for fetching the user does, are just queued to the dataserver, which will retrieve them in the order they were requested.

I have already thought about how to incorporate the values and I have come up with a solution that uses the current registry and registry key objects, but with a different model. This means I will have to custom models, both subclasses of QAbstractItemModel, using the same underlying data, but only the parts they need.

One thhings I still need to do is determining what to do with updates (i.e. when to refetch keys, when being clicked on, or have the user explicitly request refetch). Also some GUI things need to be changed. At the moment it appears that the current window width of synce-kpm is not enough for a registry editor, might have to make the application a little bit wider. All in all, plenty of things to be done (and sooooo little time… ;) )

Towards remote registry editor within SynCE-KPM

The last couple of weeks I have been working on the basics for a remote registry under linux for windows mobile devices.

I would like to include this as a new feature within SynCE-KPM, and because this is written in PyQt4, the addition needed to be in PyQt4 also. This meant investigating the MVC concept within Qt4, with the QAbstractItemModel, QModelIndex, and QTreeView (at least for the hierarchical folder structure on the left part of the remote registry editor).

After lots and lots of fighting with the QAbstractItemModel and QModelIndex, I think I have finally understood howto succesfully use them together in order to show a nice treeview structure in the QTreeView widget.

One part that caused me a lot of headaches is what the exact role of the QModelIndex is and how exactly to use these. The problem is that you are not allowed to save them in some dictionary, because they are considered to be volatile. Eventually, with some reading of the Qt website I found out how, given a particular registry key within my own backend registry storage classes (that gets its data eventually from the device), I can create the correct QModelIndex that can be used by the model.

In the end the QModelIndex turned out to be not that difficult, because it basically is only a small holding object, that contains a reference to the actual underlying data that I can access via the internalPointer() method. Another way is to use the internalId() method, but that would require me to keep my own dictionary from internalId to the actual data objects. My first thought, that this QModelIndex needs to contain all information about parents etc, turned out to be false: the QModelIndex just queries the model again for parent information.

Most of the times, when looking back after lots and lots of investigating and frustration, the concept and howto actually use it turn out to be relatively simple :)

The prototype I have at the moment is not yet integrated within SynCE-KPM, it is just a separate program at the moment. Furthermore, it does not show any of the values within the registry just yet, only the structure of the keys are shown via a tree within the QTreeView. I have made a small screencast which you can see below:

For the moment you have to take my word that the data shown is actually taken realtime from the device and is not hardcoded in my program :) One thing that I still like to solve is the issue that can be seen towards the end of the video: clicking on HKEY_CLASSES_ROOT takes a really long time before anything is actually shown. My current idea to ’solve’ this is to give all nodes by default one virtual child key with the name “Fetching…”

When the user expands a node, he will first see the “Fetching…” childkey being displayed. At the same time Synce-KPM will be retrieving the data from the device. After all sub-keys have been retrieved, they will be shown and the “Fetching…” childkey will then be removed.

I have tried implementing the above approach within the current prototype program, but this resulted in a lot of segmentation faults that I could not place. I am not sure what is causing this issue, but it appears that the segfaults are caused when I both delete the “Fetching…” childkey and add the actual childkeys all within the code that handles the the node-expand signal. My guess (well, hope ;) ) is that in the final SynCE-KPM version this should not be a problem: because of the two separated processes (GUI and dataserver) I can ensure that I am only doing either deletion, or adding, but not both.

Still todo are:

  • Include within SynCE-KPM (instead of separate program)
  • Create a listview for the values that are stored the selected key
  • Add possibility of not only viewing the registry, but also modifying :)

Treeviews in PyQt with QAbstractItemModel

For the new feature of SynCE-KPM I am working on at the moment, I want to emulate the look and feel of the windows standard program regedit.exe. This means showing the user a QTreeView showing the hierarchy of the keys and a QListView on the right showing all values within the selected key.

While the other day I have been working (and finished) on the librapi2 stuff, in particular the python bindings, to facilitate a registry editor, for some days I have been looking at this whole QTreeView stuff. I have to say that I really do appreciate the idea behind MVC, but I have to say that to use this in a nice way in PyQt is really difficult. After some days I am now at least able to create a nice QTreeView based on a model that represents the registry. Currently, everything is still hardcoded, but at least I can see a structure now (the QListView with values will come much later :) ).

Next step is to see if I can connect the model to the actual contents of the registry on the device in a dynamic way. The problem is that I need to fetch new data from the registry only when it is needed. One simple approach is to first read the complete registry into the model and then show this to the user. However, I don’t think users will like it if there is a 5 minute delay showing “Fetching data” when going to the registry editor before they can actually use the registry editor. This means I will have to fetch data in some asynchronous way. Fortunately, I already have some ideas about this. For some reason I think this fetching part is again the easy component….. Don’t want to think about all the mess that is involved to show this in a nice way to the end-user.

For the moment just happy that at least the very basics of the left-hand side of the future screen (i.e. the hierarchy of the keys) needed to display actual data are there. Onwards to new challenges with PyQt and its MVC :)

Possible new feature for SynCE-KPM: Remote Registry editor

Now that the moving is almost finished and I have a bit of spare time again, I would like to work a bit more on implementing new things for SynCE-KPM. A lot of people have asked me in the beginning to create a file-browser within SynCE-KPM, though I think that programs like Nautilus are far more suited for this purpose. I have had some ideas about this, and although I am not very much in favor of this, there might still be possibilities to implement this.

One thing I am looking at right now is a remote registry editor within SynCE-KPM that allows you to edit the registry of your device. For this to work I first have to add some additional functionality to the python bindings of the RAPI2 library, which I am working on right now. One of the things I would like to implement is a registry key rename function: Unfortunately, by design you cannot just change a key name; to rename a registry key you must first copy the whole key recursively to the new name and then delete the old key. If somebody does know a better way for doing this for Windows Mobile devices via RAPI, please let me know, really interested in this.

When all the work on the python bindings of librapi2 is finished, I can start working on the QTreeView/QListView stuff that must be added to SynCE-KPM. At the moment really reading into everything that is needed to be able to show the end-user a nice view of the registry on the device.

If you have any other ideas that could be nice additions for SynCE-KPM, please let me know via a comment.

Creating latex-beamer handouts with notes

Update 20091104: Added “1 on 1 with notes landscape”, based on work of Edson Valle. Also added “2 on 1 with notes” and “3 on 1 with notes” layouts.

Update 20091108: Added “2 on 1 with notes landscape”, based on work of Edson Valle.

Update 20091202: Added “1 on 1 with notes”, based on work of Harald Welte.

For all my presentations I have been using LaTeX-Beamer package. One of the things I missed was the possibility of having handouts of my slides with some lines for notes besides the slides. After some searching I found that in the mailing lists of latex-beamer somebody had already come up with a solution.

If you put the fileĀ  handoutWithNotes.sty either in your local texmf directory or in the same directory as your presentation you can include it with the following command

\usepackage{handoutWithNotes}

After that, to get 4 sheets on the left side of the page with on the right side of the page some lines for people to write notes you can use the following command

\pgfpagesuselayout{4 on 1 with notes}[a4paper,border shrink=5mm]

The resulting PDF file will contain pages like:

Example of handout with notes

Updated 20091104.I received a note from Edson Valle that he created an addition to the notes files, namely one that allows you to print your sheets 1 per page, but with notes on the side. Made a some small alteration to his original contribution to allow for easier usage.

I have updated the original download-link, so you only have to download the latest handoutWithNotes.sty file and you should be ready to use it.

Again, make sure that you include the style file with:

\usepackage{handoutWithNotes}

after which you can now use the “1 on 1 landscape” layout with the following command:

\pgfpagesuselayout{1 on 1 with notes landscape}[a4paper,border shrink=5mm]

.

The resulting files will look something like:

Showing the 1 on 1 with notes landscape

Showing the 1 on 1 with notes landscape

While I was at it, right away I also created two additional styles “2 on 1 with notes” and “3 on 1 with notes”. The first of these two was already requested once by kc853. Hopefully this new style will be sufficient for his needs. If not, I hope that it will serve as a good starter for modifications.

The “2 on 1 with notes” layout can be used with the command

\pgfpagesuselayout{2 on 1 with notes}[a4paper,border shrink=5mm]

with the following result:
Image showing "2 on 1 with notes" layout

Finally, the “3 on 1 with notes” pages was created because I think that the “2 on 1 with notes” seemed a bit empty ;) You can use this “3 on 1 with notes” layout with the command

\pgfpagesuselayout{3 on 1 with notes}[a4paper,border shrink=5mm]

with the following result:
Image showing "3 on 1 with notes" layout

Update 20091108 : Based on the above updated styles, Edson Valle provided me with another addition, the “2 on 1 with notes landscape” layout. You can use it with the command

\pgfpagesuselayout{2 on 1 with notes landscape}[a4paper,border shrink=5mm]

and the output you will get will be something like:
Example of "2 on 1 with notes landscape" layout

Update 20091202 : Based on the above updated styles, Harald Welte provided me with yet another addition, the “1 on 1 with notes” layout. You can use it with the command

\pgfpagesuselayout{1 on 1 with notes}[a4paper,border shrink=5mm]

and the output you will get will be something like:
Example output of "1 on 1 with notes" layout

All of the above layouts can be used by downloading the handoutWithNotes.sty file.

Just drop me a note in case you like this or find it useful or in case you have any questions :)

Keys to our new house :)

Today we went to the notary for all the official exchanging of property and after that we received our keys:

Picture of the keys to our new house

Picture of the keys to our new house

Also nice was the fact that the previous owners provided us with a small bottle of champagne :)

So upcoming time will be a busy time of moving and painting… We cannot wait for this to be finished and we will be living in our new house :)

New Toy: Asus EEE box :)

In some weeks we will get the key to our house we recently bought and I thought this was a perfect opportunity to buy a small light-power computer that I can use in the new house as a server. Currently I have my desktop running 24/7 because it also works as a simple webserver and provides me with my email wherever I am.

Yesterday I bought an Asus EEE Box PC. Unfortunately the thing came with Windows XP preinstalled on it, which was not right for the task I had it mind. I thought installing Ubuntu 9.04 Jaunty (server) was going to be really easy, but when I created a bootable USB stick with the installation ISO on it, it did not get recognized by the EEE box as a boot device. I tried all the different USB mass storage device settings in the BIOS, repartitioned my USB stick to use FAT16 instead of FAT32, nothing leading to a satisfying result.

In the end I found a 1GB micro SDHC card I still had laying around, put it in the SD slot and after forcing the BIOS to force the USB boot mass storage device to “Forced FDD”, I finally got the linux boot menu I was looking for (instead of the windows xp boot screen). After I got this far, the rest was really easy and in no-time I had Jaunty up and running.

Now the only thing left is to move all server-data from my desktop computer to this new server and I will be finished completely.

LaTeX Beamer Diepen style

When I was a PhD student I had to give some presentations. I think I tried once to use Powerpoint to give a presentation filled with mathematical equations before I decided that this was not going to work ;)

After some other packages, I finally found LaTeX-Beamer. For the majority of the presentations the default styles provided with LaTeX-Beamer were sufficient, but every now and then I wanted to have a bit more, do I dare to say it, powerpoint like theme ;)

I wanted to have background image over which an white transparent layer would be put, on which the text would appear. I created a latex-beamer style for this and a sample output of this diepen style is given in the two pictures below:

Screenshot showing example title page of diepen style

Screenshot showing example title page of diepen style

Screenshot of normal sheet in diepen style

Screenshot of normal sheet in diepen style

The picture that is on the background can be changed into any picture you choose, although I found that in most cases the result is the best when the used image is not too bright.

To use the style, you must first download the source, unpack it to a directory of your choice in the texmf directory (or your local texmf directory) and make sure that you have run the texhash command under linux or the windows equivalent such that pdflatex is able to find the style files.

After you have done this, you can use it by placing the following command in the preamble of your beamer file:

1
\usetheme{diepen}

The following options are available:

  • backgroundimagefile. The filename (without extension) of the image to use as background (e.g.
    1
    
    \usetheme[backgroundimagefile=schiphol-tower]{diepen}

    to use schiphol-tower image as background)

  • opacity. A float value denoting the opacity of the white overlay on all sheets except the title page (e.g.
    1
    
    \usetheme[opacity=0.78]{diepen}

    to have opacity of 78%).

  • useblacktitletext. Is a boolean and if present the color of the text on the titlepage will be black instead of white
    1
    
    \usetheme[useblacktitletext]{diepen}

    . This option sometimes is useful for background images that are rather light in color

If you have any questions about this diepen style, please let me know.

Sometimes shit happens ;)

For the last couple of days an increasing number of people were mentioning that they had problems with synce in Ubuntu. After running synce-pls they received the following error:

** (process:6884): WARNING **: synce_info_from_hal: Failed to obtain property pda.pocketpc.iface_address for device /org/freedesktop/Hal/devices/net_80_00_60_0f_e8_00: org.freedesktop.Hal.NoSuchProperty: No property pda.pocketpc.iface_address on device with id /org/freedesktop/Hal/devices/net_80_00_60_0f_e8_00
process 6884: arguments to dbus_move_error() were incorrect, assertion “(dest) == NULL || !dbus_error_is_set ((dest))” failed in file dbus-errors.c line 278.
This is normally a bug in some application using the D-Bus library.

** (process:6884): CRITICAL **: synce_info_from_hal: Failed to obtain property pda.pocketpc.platform for device /org/freedesktop/Hal/devices/net_80_00_60_0f_e8_00: org.freedesktop.Hal.NoSuchProperty: No property pda.pocketpc.iface_address on device with id /org/freedesktop/Hal/devices/net_80_00_60_0f_e8_00
** Message: Odccm is not running, ignoring
synce-pls: Could not find configuration at path ‘(Default)’

It turned out to be a small error in the libraries that somehow made it into the launchpad repository. Sometimes Murphy just happens to pay a visit ;)

The problem should be fixed soon, when new packages are uploaded to the repository.

So if you are running Ubuntu and seeing the exact error above, please be patient for some days and try often to see whether there are updates :)

City trip to Dublin

Last weekend I went for a city trip to Dublin together with my wife. Of course we had to visit two things that Dublin is famous for: the Guiness brewery and the Jameson distillery ;)

At the Jameson distillery you have a guided tour that shows you the process of whiskey making. At the start of the tour, they ask for some volunteers, but we did not yet know for what that would be. I was chosen as one of the volunteers, and at the end of the tour it was clear what the task was: a whiskey tasting event :) We had three shots of whiskey, one Jameson, one Jack Daniels, and one Jimmy Walker and at the end we had to answer the question which of these three was the best ;) To prove that I gave the right answer I got the following certificate:

Jameson whiskey tasting certificate

Jameson whiskey tasting certificate

I have to say that this tour was really good fun.

The tour at the Guiness brewery was completely different, you could just walk through the complete museum by yourself, and at the end of the tour there was the complementary pint of Guiness in the Gravity bar, which is on the 7th floor with an amazing view over Dublin.

If you are planning to go to Dublin, I can recommend the above two activities :)