Skip to main content

the avatar of Holger Macht

killswitch-applet-0.1 ... or my personal Hello World in Python

killswitch-applet-0.1 … or my personal Hello World in Python

One thing that was on my TODO for already quite some time was to have a look at that half-new language called Python. Because an old-fashioned "Hello World" is far too simple here, I was looking for some kind of project to get familiar with the basic principles.

One thing I found quite annoying in the past was the fact that I always had to disable some kind of radios in some far too complicated ways to save some battery power. Modern laptops often have multiple killswitches for their wireless communication devices like bluetooth, WLAN or WWAN. So that was the chance for me to seize, and the output looks like this:

http://blog.homac.de/images/killswitch-applet-large.png

From the README:

killswitch-applet is a small application sitting in the system tray providing the possibility to manage all the killswitches found in the system. In this context, "managing" means enabling or disabling certain killswitches. This is especially useful if you have multiple killswitches like bluetooth, WWAN or WLAN seen in many modern laptops.

http://blog.homac.de/images/killswitch-applet-screenshot.png Tray Icon on the Left

The source tarball for version 0.1 can be downloaded here: killswitch-applet-0.1

The summary here definitely is: Wow, that was damn simple! Especially when it comes down to GTK programming and D-Bus interaction, Python definitely provides a very good way to hack those things together quite easily. The whole source file contains a whole of 189 lines of code including comments.

Another question: Is it worth creating a sourceforge project for this? I'll wait until and if I'm getting some feedback.

Note for openSUSE users:

Of course this is also available in the openSUSE Buildservice. Go to http://software.opensuse.org/search and search for "killswitch-applet".

a silhouette of a person's head and shoulders, used as a default avatar

A closer look at REST

YaST, the openSUSE installation and configuration tool, is about to get a web based user interface.

The interesting part of this is the proposed service-oriented architecture. REST, Representational State Transfer, is currently the holy grail for managing resources (objects) using http.
REST is not a protocol but an architectural style making best use of the properties of http. And the Internet is the best proof that this style performs and scales well with a distributed client/server architecture.

Roy Fielding, one of the authors of the http protocol, has written a complete doctoral dissertation on this topic. For the purpose of this blog entry, seeing it as a lightweight alternative to e.g. XML-RPC or SOAP is sufficient.

How does it relate to YaST ?

As Stefan has explained on his blog before, a web based YaST will be splitted into client and server parts. This forms a three tiered architecture, where the server runs on the managed system and exposes a REST-style API to access YaST functionality.

Getting this API right in terms of extensibility, flexibility or conformance to REST best practices is an important design goal.

Now whats good REST style ?

There is no fixed list of requirements for REST or a conformance testing tool. Designing a well behaved REST implementation is mostly about learning from others experience and follow common practice.

Browsing through popular REST related bookmarks at delicious.com gives me a much better signal-to-noise ratio than Google. And it pointed me to a couple of useful references for the do's and dont's when planning a REST-style architecture.

  1. REST APIs must be hypertext-driven
  2. Versioning REST Web Services
  3. Common REST Mistakes
Hypertext style

The first is the most interesting (IMHO). Its about exposing only a very limited set of explicit URIs. This also prevents hard-coding them into the client but let the client query the server instead. So you start from a single URI and hop from there (thats what hypertext is all about!) to the right resource. Thats like moving from node to node in a state diagram.

Versioning in media types

When doing API versioning on the web, one might be tempted to do an all-or-nothing approach and embed a version specifier (like .../v1/...) into the URL. The second link above explains why this is a bad idea and comes up with a better one: media types. The client can tell the server how to format the response to an http request by setting the Accept field in the http header. Its like calling a function and telling it the expected return type.

And REST explicitly supports this style as it does not make any assumption on the representation of a resource. Client and server are free to agree on the actual format. Using XML for object serialization is a smart move as it allows for extensibility. Clients just pick the xml tags they need and ignore all others.

Stateless

REST, being based on http, stipulates a stateless protocol. Doing stateful REST is listed as one of the typical mistakes in implementing REST-style.
Considering the proposed YaST web architecture, this means keeping state (session) information in the client and not in the server.

More recommended reading

the avatar of Holger Macht

Tomboy^WGnote

TomboyWGnote

Inspired by a recent blog post, Gnote is now available in the openSUSE build service. If you have been using Tomboy and wouldn't miss any of its plugins (which are WIP), give it a try. The Mono to C++ conversion can be that easy:

  • For Factory: $ zypper ar \

http://download.opensuse.org/repositories/home:/hmacht/openSUSE_Factory/ \ home:hmacht

  • For 11.1: $ zypper ar \

http://download.opensuse.org/repositories/home:/hmacht/openSUSE_11.1/ \ home:hmacht

  • $ zypper in gnote
  • $ mkdir ~/.gnote && cp ~/.tomboy/*.note ~/.gnote/
  • $ gnote

AFAICT, it's running quite well. Tomboy has been the only Mono application I was running, so 'zypper remove mono' removed a bunch of 42 packages.

Have fun, Holger

a silhouette of a person's head and shoulders, used as a default avatar

Short Weekend Trip: Liverpool and Knowsley Safari Park

Having a few days holiday, we decided to visit something here in UK, so we went to Liverpool and Knowsley Safari Park.

"Knowsley Safari Park has become one of Merseyside's premier leisure attractions, winning several awards for tourism and it's animal husbandry."

"These days Knowsley's 500 mammals include rhinos, camels, buffalo, bison, wildebeest, lions, tigers, zebra, baboons, monkeys, deer, antelopes and wallabies."

It was a great weekend a lot of photos are available on my Flickr gallery: Liverpool and Knowsley Safari Park set.

a silhouette of a person's head and shoulders, used as a default avatar

a silhouette of a person's head and shoulders, used as a default avatar

KNetWalk

I'm trying to write an Android game, but I've been rather addicted to playing KNetWalk, which is slowing me down somewhat. I'm getting fast at KNetWalk though - I just did the Very Hard level in 59 seconds without any penalties. I think I might give up now, although I reckon I could probably do it in 50 seconds if I was very lucky.
a silhouette of a person's head and shoulders, used as a default avatar

tinyurl No Longer Breaks My Security Model

At least, not on my Android phone. I've just released Check Redirect on the Android Market (for free, of course), which intercepts view intentions on links, and if the link is a tiny url of some sort (the list of intercepted hosts is configurable) it pops up a dialog letting you know where the link redirects to, and asks if you wish to follow the link.

And when I'm using Linux instead of my phone, I found an extension for firefox which does a similar thing. I can't remember what it was called though.

the avatar of Andrew Wafaa

A Week of Geeko Love

openSUSE Week Counter

openSUSE Week Counter

UPDATE: New Dates. You now have more time to plan!

As you can see the week of the 11th to the 17th of May is openSUSE Week.  What’s so special about this week?  Well in a nutshell, the aim is to get all corners of the community together to focus on specific topics.  These topics range from wiki cleanup to packaging; testing certain features/functions to translation work; discussion with the openSUSE Board and almost anything inbetween.

I’d like to suggest a couple of other items to the list (yes I know I need to add them to the wiki).  Both items are marketing related:

  1. Create good screencasts, ideally of each major component but I’m open to ideas.
  2. As requested by certain a11y users & proponents, close caption the video that we have (and the interviews I still need to upload).
  3. I know I said a couple but maths was never my strong point 😉 Try and do some video interviews that we can group under the “People Of openSUSE” banner.  I’ve already started this but mainly with Novell employees.  If community members are willing to help out, please let me know (it could even be you filming yourself without any need for video conferencing).

So please make sure you come and join the fun, remember the openSUSE community wont succeed unless you join in.  We may even have the opportunity to have a soap box where you can voice your complaints and issues.  The important thing is the openSUSE Week is about you the community for you the community, to get something out of it you need to put something into it.  Lastly it’s all about having good old fashioned geeko fun!  So come along and join the fun 😀

a silhouette of a person's head and shoulders, used as a default avatar

UML diagram of yui objects

Recently I found UML modeling tool - Umbrello. Well, it's not very stable, but there is autosave function ;-)
So I created Class diagram for my small widget_library:



Some objects are missing (work in progress), anyway it's important to visualise objects from begining. It's could be too late when library becomes too complex and relations complicated ...
the avatar of Flavio Castelli

rockmarble: see who is going to rock in your town

During the last weekend I hacked a bit on rockmarble and I added a new feature: retrieve all the events happening in a certain city.

As usual data is provided by last.fm, which should return also the events _“near” _the specified city (don’t ask me to define a value for near :) ).

I have created new openSUSE packages, this time everything should work fine. Just make sure to remove all qjson packages before installing this release (in fact all the previous problems were due to packaging errors of qjson, now I have created new packages called libqjson0).

Packages are available for openSUSE 11.0, 11.1 and Factory (both for i586 and x86_64 architectures).

One last news: rockmarble has also a new site, something slightly better than github wiki ;)