Telemeter plasmoid v0.2

Most important improvements are:

  • Auto refresh respecting server-side request throttling.
  • Asynchronous webservice request prevent plasma from freezing (when webservice time-outs)

Keep in mind: the telenet webservice does not always work. 😉

Changelog
– added icon
– don’t let theme determine label color
– autorefresh option: takes ticket expiry into account
– deny refresh request when request is in progress
– don’t fetch at startup when configuration is needed
– gui feedback when refreshing
– show usage and next request time in tooltip
– on error, show webservice error message in tooltip
– refresh in separate thread: fixes plasma hang when webservice is out of service

Download

Telemeter plasmoid v0.2

Telemeter plasmoid v0.1

The telemeter plasmoid works for some time now but when I tried to distribute it, I entered packaging hell and things got deferred.. until some guy reminded me about it in the comments. 🙂

I could explain how I eventually managed to work around the packaging issue, but I’ll save that for another post 😉

Without further ado, Telemeter plasmoid v0.1 is released, go get it at kde-look.org!

Changelog:
v0.1 / 2011-04-06
=================
– fetch telenet account usage from telemeter webservice using gsoap
– store credentials in plasmoid config or kde wallet
– click on plasmoid to trigger manual refresh (telemeter service protects itself by denying access when too many requests happen consecutively, the plasmoid currently does not prevent you from doing this)
– automatically refreshes at configurable interval
– use Plasma::Meter::AnalogMeter with custom svg for better text positioning

Telemeter plasmoid configuration

Win7RCAutoShutdownAlarm v0.2

Today I finally discovered why there always remained some garbage in the transparent area of the systrayicon where the piechart had passed by. It also turned out it really pays to read up-to-date Qt docs. I accidentally noticed the difference when reading the source. 🙂

Things learned:

  • when constructing an QImage you plan on using transparency on, always initialize it properly (using some fill you like).
  • when using QPainter on QImage, always use a alpha premultiplied format, for performance reasons.

I thought this new acquired knowledge justifies a new release. 🙂 So welcome v0.2 with the following changelog:


v0.2
- fixed systray render bug leaving garbage in transparent area
- added 128px taskbar icon
- added transparent circle background, otherwise you don't see anything near the end ;)

I <3 libpcap

A few years ago, I wrote a small app showing the open network connections (announcement following shortly). I never figured out how to measure transfer rates over the connections since the kernel does not seem to provide this info through the /proc filesystem (only some data queue length which is related to kernel mem usage).

Today we all know and love iftop, but where does it get that info? Simple: pcap! Out of curiosity, I checked out the libpcap docs to see how hard it would be to get started. Turned out to be pretty simple! There are a few excellent tutorials which get you started real fast. In about half an hour I made this very simple sniffer which accumulates the received bytes and packets per second and prints it out when the second changes. Each line contains the timestamp (sec), KB/s and number of packets received in that second. Here you can see me watching a youtube vid 🙂

Opening device eth0
ts = 1285276934, load = 0.7 KB/s (4)
ts = 1285276935, load = 0.3 KB/s (1)
ts = 1285276939, load = 0.9 KB/s (4)
ts = 1285276940, load = 14.4 KB/s (44)
ts = 1285276941, load = 294.9 KB/s (764)
ts = 1285276942, load = 608.9 KB/s (1505)
ts = 1285276943, load = 1164.4 KB/s (2882)
ts = 1285276944, load = 1242.6 KB/s (3064)
ts = 1285276945, load = 1166.6 KB/s (2880)
ts = 1285276946, load = 69.9 KB/s (179)
ts = 1285276947, load = 140.1 KB/s (363)
ts = 1285276948, load = 139.9 KB/s (361)
ts = 1285276949, load = 139.7 KB/s (358)
ts = 1285276950, load = 139.7 KB/s (358)
ts = 1285276951, load = 139.3 KB/s (358)
....

It is a good test to see if the calculated payload is correct. The initial burst of ~1.2MB/s confirms that. 🙂

Project announcement: Win7 RC auto reset alarm

Okay, this is becoming a bit outdated since windows 7 has been released for quite some time now, but you never know there are some other poor lads like me out there still using the RC. =)

Why I am using the RC is quite a story actually.. About a year ago, I bought this really beefy game rig. I tried some games using wine and although in general I managed to play them, I found it a bit silly that I wasn’t enjoying my new box for a 100% since there was always some direct3d feature not implemented yet or subpar framerate. So I decided I’d buy a game console software, aka Windows. But XP was almost EOL, Vista was a mess and Seven wasn’t released yet. So I figured I’d install the release candidate and see how it went from there.

All went well! And for the first time in many years, I even felt Microsoft was back on track. All my games ran very well. Until the day of doom, March 1st 2010. 🙂 On that day, Microsoft started to reboot all windows 7 rc’s every 2 hours. And by reboot, they don’t mean clean shutdown, they mean hard reset! Fair enough, it’s not like I paid for it.

Anyway, since I use Wintendo only for games, I realised it was actually a good thing that windows made me take a brake every few hours. It’s a good time to reassess the situation and maybe conclude to stop and do something else. 😉 No matter how I tried, I would always lose track of time and end up with game progress not being saved, steam stats not updated/lost, etc. So that’s where my little “windows 7 rc auto power off alarm” comes in. =)

This little utility will give an audible warning every minute when 1h45min have passed by. 10 mins later it will warn you with an additional sound, every 2 secs, that now the time really has come to finish your current mission/save your progress and do a proper shutdown. It is advisable to put this program in your startup folder so that it automatically starts when you log in, although it does not really matter when you start it as it initializes the timers using the boot time and not the time the program is started.

When the program is started, it sits in the system tray. Clicking on it will show you how much time is left. If you have a second monitor you can also use the pie chart countdown widget to have a visual indication on when to shutdown. Activate it by right-clicking on the systray icon and click “Show timer”. It shows green and should turn red when 0-hour is approaching. Click and drag it to move it around, scroll on it to scale.
Win7RCAutoShutdownAlarm desktop widget Win7RCAutoShutdownAlarm systray icon

Source is on gitorious, binaries can be download from qt-apps.org.

That’s it!

Telemeter plasmoid update

This week I’ve been plasmafying my telemeter widget. I’m documenting the stuff I learn along the way in my personal page over at the kde community wiki.

Here’s a first screenshot of the plasmoid in action in its natural habitat:

Telemeter plasmoid

Notice the change in looks (ditched the qneedleindicator in favor of a native plasmoid widget Plasma::Meter). I’ll do a blog post later to detail the changes. It shows a fetch error as it accesses the webservice with invalid credentials.

Project announcement: Telemeter widget / plasmoid

Lately I’ve been running low on my internet download/upload quota. Although my ISP (Telenet) trippled my quota, a combination of new suse release, new steam games and my isp failing to reset my quota (bug in upgrade process I guess), I managed to reach its limit inadvertently at 200 MB left. Since a) my ISP offers a webservice to access your usage data, b) I always wanted to write a useful plasmoid and c) wanted to try out soap services using Qt, I contemplated to write a quota monitor widget / plasmoid. This evening I gave it a shot.

After comparing available c++ toolkits for web services, I stuck to gSOAP rather than QtSoap as gSOAP seems the de facto standard when it comes to soap and cpp. gSOAP has some handy JAXB-ish utils to convert your wsdl into proxy classes. For a moment, I was afraid I would have to give up the nice and easy Qt network support (proxy, ssl,..) but it seems gSOAP has abundant support. All in all, in a few hours I had it up and running. Actually, I lost most of the time finding the relevant webservice url (you have to subscribe to a private wiki although eventually someone mailed it to me through a fairly private mailinglist I found on a user forum). In the meantime I found that putting a #define in my main is not the same as adding it as a compiler flag even when you rebuild everything. 😉 Adding a compiler flag the right way using qmake, goes like this:

QMAKE_CXXFLAGS += -DWITH_OPENSSL

When I finally could connect to the webservice, I received bogus data, all 0 usage! Only to find out that this was a problem with my account only. Btw, I good and cross platform tool to try out / debug webservices is SoapUI.

To keep it a little sexy, I threw in the QNeedleIndicator I recently stumbled upon on qt-apps.org and adapted it a bit to my needs and voila, we have an alpha:

Telemeter widget

It is not a plasmoid yet and credentials are hardcoded so it’s not useful to anybody but I couldn’t wait to blog. 😉 Note that in the screenshot I seem to have plenty of quota left. That’s only because it shows my parent’s account usage. 🙂

It is currently developed as a Qt app but I definitely plan on wrapping it in a plasmoid. Maybe I’ll keep the Qt app alive for some poor windows users. After I clean it up a bit I will post the code on gitorious.

Project announcement: ClockCalendarWidget

Although you can hardly call this one a ‘project’, I still categorized it as such as it comes with a matching project on gitorious.

In corporate environments, administrators like to put users in jail, or with an euphemism: a sandbox. At our company, the day has come that we can’t double-click on the system clock to quickly look up a date, do a simple time measurement, etc.. Although I understand it is a bug in Windows XP, it is still annoying as **** since it’s quite handy and why wouldn’t I be allowed to do that when I am adminstrator of my own machine anyway.

A workaround is putting another tool in the system tray which yields the same functionality and why not improve it while we’re at it. Today I created a very basic first version: qt clock example enhanced with seconds hand and put a calendar aside. No configuration at the moment. I created the systray icon in Inkscape and it should scale nicely in larger systray environments.

I plan on making the colors configurable and a written time under the analog clock, with maybe a simple timing functionality as a side dish.

ClockCalendarWidget