GnuCash: Editing Currency Exchange Rate

GnuCash can deal with multiple currencies. However, its behavior when setting currency exchange rates is somewhat obscure and had me spend literally hours to figure out how to get it under control a couple of times.

The use case. Account A is in USD currency, account B is in UAH currency. You need to transfer funds from A to B, which involves currency exchange rate.

When you do this the very first time, you enter Description of the transaction, specify the account B to transfer funds to, and key in Debit/Withdraw value of say 150USD and then hit Enter key, GnuCash then will present you with an exchange rate editor window where you should be able to enter the exchange rate for this transaction.

As it often happens, many transactions are repetitive, and luckily GnuCash helps making these records fast by offering you a history autocompletion function, much like one found in LibreOffice and Bash/Linux/UNIX terminal.

So, typically a user would quickly create another new record in a ledger for account A, specify a different amount of Debit/Withdrawal this time and find out that the resulting value in account B is wrong.

Continue reading

Lightning add-on with Google Calendar-like color palette

I’ve started using Lightning add-on for Thunderbird lately. Oh and Thunderbird, too. Again.

I just figured Evolution is unreasonably resources demanding, works a bit slowly on my notebook (Intel(R) Core(TM) Duo CPU T2250 @ 1.73GHz, 4GB RAM, ATI Xpress 1250 with 256MB), has a terrible connection error dialog that looks stylish in red and overlays message window list but pops up way too often — with many accounts and a bit flaky Internet connection and/or frequent sleep and resume cycles that gets just irritating because as a user I have to dismiss them manually or else they remain in their place forever limiting view of the list of new and old messages. Evolution also offers a pretty inconvenient way to turn HTML formatting on or off on a per single message basis. You’d have to go all the way to preferences and locate it in some section and tick the box off or on to get a single e-mail sent out in HTML if you prefer plain-text most of the time. That’s just too time-consuming and frustrating and IS a lot of work. Finally, I figured it crashes quite often under certain circumstances. Overall it works stable 98% of the time and is a very good mature e-mail client and I’d personally recommend it to a lot of people.

I didn’t feel like hunting down its bugs, though, because at the end of the day performance wise I’d still not be happy with Evolution, so I decided to give Thunderbird another try. I used to run it, it was OK. It met most of my expectations back then but at some point in time I defined my own user policy where I’d strive to use default DE applications as much as I could. I felt it would give me a more consistent look and feel, which kinda matters to me when I become a regular desktop user and not a Linux administrator who works mostly with black terminal and a web-browser.

So, I used to use KMail and Evolution and they were both OK. Since the last time I’ve used Thunerbird it got a cool add-ons manager and plenty of useful extensions (like Lightning, Gnome Integration, Copy As Plain Text, Personal Level Indicators, etc.) as well as nifty personas, sort of skins that can deliver a really nice touch of personality to your Thunderbird  if chosen wisely. Some of the extensions that I found useful and a very cool persona/skin can be seen in this screenshot:

Extensions that I found useful and persona/skin demonstration

Continue reading

Apple keyboard in Linux

I’ve got myself a wired aluminium USB Apple keyboard, and I’m running Arch Linux that mostly hasn’t been updated since the end of the summer of 2011 (just to give you some idea about how recent my software is: gnome-desktop 3.0.2, gtk3 3.0.11, compiz-core 0.8.6, glibc 2.13, gcc 4.6.0, etc).

As it was reported in this nice post, all keys except Expose and Dashboard work right out of the box (or, more accurately, are recognized but not necessarily do the expected; pleased read on). I successfully assigned Expose key to the Compiz Scale plug-in, however Dashboard was giving me a hard time. I ended up assigning keycode 212 to F13 key symbol, that works just fine, for some reason unknown to me XF86Calculator doesn’t play well with this button.

In my case I have Apple keyboard connected to a Samsung R-20 notebook computer, that is physically placed behind a 24″ DELL display. So, I’m not sure whether there’s some sort of conflict between the two keyboards that have multimedia keys on them connected to a single computer:

% xinput list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=10 [slave pointer (2)]
⎜ ↳ Logitech USB Receiver id=11 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=15 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Power Button id=8 [slave keyboard (3)]
↳ Sleep Button id=9 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=14 [slave keyboard (3)]
↳ Apple Inc. Apple Keyboard id=12 [slave keyboard (3)]
↳ Apple Inc. Apple Keyboard id=13 [slave keyboard (3)]

Continue reading

Placing Evolution windows to specific viewports with Compiz

Compiz has lots of nifty plug-ins and one of them is called Place. What it does essentially it takes a window and puts it on a specific desktop you tell it to.

The tricky part is to write rules to select windows. Evolution proved to be quite a pain to handle. I usually use 6 virtual desktops, or viewports in Compiz parlance. I have two rows of them, each has 3 virtual desktops. I’m used to having an e-mail client running in viewport 3, row 1 (X3:Y1) web-browser and console in viewport 1 (X1:Y1).

Well, initially my idea was to  grab a Window Title for Evolution’s Compose Message window and have it explicitly excluded in the rules. That kind of approach worked just fine on my office workstation where I use Thunderbird, but with Evolution this sort of rule:

title=Evolution & !title=”Compose Message”

Just didn’t work. What happened was either Compose Message window would be still forcibly placed to viewport 3, or, totally weird, main Evolution window would be transferred to active viewport and Compose Message window would take place of main Evolutoin window defined by Place plugin rules (in my case viewport 3, X3:Y1).

But as I said a little earlier, I keep my Chromium window in viewport 1 and when I click an “e-mail to” link I’d love to see Compose Message window in viewport 1, or in other words I want it to follow the viewport I’m working in. Well, that logic expressed in a rule above proved to be a total failure. I tried literally all the options for matching rules: window class, title, role, etc. — none of them worked. I’ve actually almost given up on this idea to take control of Evolution’s windows and left the rules as they were the last time I messed around with Place settings.

Eventually, what I ended up with, though, and it comes as a surprise to me as well, was a simple:

role=EShellWindow

Which was created sort of accidentally, a leftover of the code from the last time I attempted to figure out the matching rules for Evolution, but it turned out to be exactly what I needed.

So, if you need to forcibly place Evolution on its launch to any viewport, just use this rule to match the Evolution main window. That’s it. Compose Message will follow your viewport.

If you feel a little uncomfortable with Compiz’s matching rules syntax, don’t worry I felt it was a little unusual as well! Here’s a nice post, though, that breaks down the most important aspects of the window matching deal:

http://technology-flow.com/articles/control-window-behavior-compiz/

Extracting a Radio Station URL from Banshee 2 SQLite DB

I’ve wanted for a while to extract a radio station url for HBR1, Ambient from Banshee 2.0.1.

My first thought was to grep recursively and disregarding character case for ‘hbr’ in $HOME. That didn’t work.

After some time I realized that probably Banshee stored most of the data in a sqlite db. I was right about that, but  finding the radio station url still wasn’t as simple.

Here’s what I did to get it printed out on my console:

~/.config/banshee-1 % sqlite3 banshee.db ‘select * from CoreTracks’ | grep -i hbr
3|2586|12|463|0|0||http://ubuntu.hbr1.com:19800/ambient.ogg||0|0|0|0|5|0|HBR1, Ambient|hbr1 ambient||,    �
!/Q    2!p�|0|0|0|0|0|0|Ambient|||||||0|0|0|0|||1294327820|1326656231|d6bb2e3f688f3bb51bbf660a6707629e|0||0
3|2587|12|464|0|0||http://ubuntu.hbr1.com:19800/tronic.ogg||0|0|0|0|5|1|HBR1, House|hbr1 house||,    �
!/,|��!|0|0|0|0|0|0|House|||||||0|0|0|0|||1294327883|1320570155|0d8fca4c8853d6f5da29987a912f0ea6|0||0
3|2588|12|465|0|0||http://ubuntu.hbr1.com:19800/trance.ogg||0|0|0|0|5|0|HBR1.com – I.D.M. Tranceponder|hbr1com – idm tranceponder||,    �
!3

Yeah, not pretty, but who cares as long as you can extract your data, right? Of course, if you’re going to re-use the output in your scripts you’ll have to figure out how to make the output prettier. If you do that, drop me a line in the comments section, please.

Ordering the GNOME systray

I love exactly this sequence of icons in my GNOME systray

See those icons in the systray? While plenty of people do not care in what order those icons are placed in their systray I do. And this topic has been on my mind for some time since the realization of how great control over the system and its components can be in a Linux environment dawned on me.

My first try was with KDE 3.5.x and it was a no go. I came up with this idea of running a simple bash script, essentially an ordered sequence of applications I always need to run upon the new login session, but it wouldn’t work as expected. For some reason sleep command was ignored and to put applications in a specific order it was basically impossible. I think it could be due to poor idea implementation but since I moved away from KDE and use GNOME these days it doesn’t matter anymore.

Here I am working in GNOME and after having to run 7-8 applications each time I start up the laptop or login anew, which in itself takes up about 5-7 minutes and requires human attendance, this quickly became a real pain. 2011, advanced computing technology is abundant, automation is thriving as never before and here I am spending about an hour a week or so doing what, running 7-8 applications – a pointless, dumb activity.

So, I decided to try it again and this time I got it done right. GNOME simply follows the logic that I use when think about how GNOME could handle autostart applications, such as a bash script, which eventually enables me to run:

  1. pidgin
  2. stardict
  3. zim
  4. transmission
  5. banshee
  6. miro
  7. evolution

in exactly that sequence automatically.

Here’s how it’s done.  I created a bash script ~/scripts/autostart.sh, gave it execution bit by chmod +x. Its contents is outrageously simple:

#!/bin/sh
stardict &
sleep 25
zim &
sleep 1
transmission-gtk &
sleep 3
banshee-1 –redirect-log –play-enqueued %U &
sleep 5
miro &
evolution &

sleep parameter is needed to introduce pauses in between the execution of applications (so that they’re not run and placed in systray haphazardly) and tuned to account for time required to start an application. In my case stardict takes quite a bit of time to start due to a big number of dictionaries needed to be loaded so it’s 25 seconds. It’ll all depend on your very own set of applications and how fast they load. Conduct an observation session and note down the results, then use them as parameters for your script.

When your script is ready go to System->Preferences->Startup Applications and add new program, your script.

Startup Applications

Adding new program, my autostart script

Log out and log in to see how it works. I had to log out and in a few times to get the timing right and now I have GNOME running these 7 applications for me, in exact sequence as I defined and placing their icons in systray the way I want them to be placed.

Which is awesome.

Oxygen Style for Emerald

I had to switch from KWin to Compiz-Fusion since KWin with or without Composite tended to bring my system’s performance rate almost to a grinding halt.

I also had to use Emerald for window decorations. There’s one nuisance about it, though. Most of the themes look cartoon-ish and simply break this almost perfect look of Oxygen Style you can see in KDE 4.5.

I googled up a few solutions and one turned out to be almost what I was looking for. Alas, it looks.. well shall I say a little awkward?

It’s a typical Emerald theme – bulky and looking cartoon-ish – that incorporates Oxygen Style imagery and color scheme.

I wanted a theme that would resemble an Oxygen Style that is found in KDE as much closely as is possible. I found none so I created one for myself. And I’m writing this post to share it with you, of course. Not to just tease. I’m all for sharing information and stuff (no, not money. Don’t bother to ask).

Let met show how it looks:

Oxygen Emerald KDE 4.5 v.1.0

As I said it’s a derivative work. The changes are the following:

  • smaller size window control buttons (15px height, just as original KDE Oxygen theme)
  • button distances resemble those in KDE’s native Oxygen Style: Close button is separated from Minimize and Maximize
  • no glow and animation for control buttons in on hover state
  • smaller size decoration borders (top, bottom, left, right)
  • Smaller title font
  • Black shadow instead of light blue

So, if you’re interested you can download my Emerald Oxygen KDE 4.5 version 1.0 theme on Compiz-Themes.org. You can vote (and you should) and you can also favorite this theme if you like it (do it if this is the case! :]