Wednesday, June 15, 2011

I love KDE's new addition: Activities

As a developer I find myself desiring a way to segment the many applications I end up running which clutter both my task bar and my screen. I've tried using virtual desktops, where you have N screens on which you can place applications, with only one showing at any point in time. I've always found the management of the application on the screens and the switching to screens less than seamless.

Perhaps it's because I'm a gmail fan that I like what the developers of KDE have implemented in Activities. Activities are tags on a window, like Googles tags on an email message. You define your activities and associate your applications with a tag. When you switch to a new activity, only the applications with that tag are shown. Smartly, only the applications appropriate for the current activity are shown in the task bar also, further reducing clutter. Additionally, only desktop widgets for the proper activity are displayed

For example, I have a Development activity that includes Eclipse, DB-Visualizer, Chrome, and a terminal window. I also have a Overhead activity that includes LibreOffice, Kontact and Chrome. When I activite my Development activity, I only see Eclipse, DB-Vis and Chrome. When I activate my Overhead activity, I only see Kontact, Office and Chrome.

I found it best to use with the addition of a panel that lists my activities. So I just click on Development to see my development toolset. Email notification? Click on the Overhead activity and development windows disappear and I see my email. After processing the email, I just click back to Development and pick up where I left off.

Here's how it looks, and know in your heart that I'm running Eclipse, DB Vis, Kontact, Kopete, Chrome, Firefox, KRDC, Amarok and Terminal. This is my "clean" activity.



So my activities are "Escalation" (things related to dealing with customer problems, "Development" (things related to developing new features or fixing bugs), "Overhead" (things like email, time tracking) and "Desktop" (a clean area for clearing my mind).

KDE also provides some template activities like Photos, Newspaper, Search and Launch.

Monday, June 6, 2011

The bat of 2011 - part 2

I periodically opened the door a crack to get a glimpse of our visitor having his way with our bedroom. Zoom, zip, swoop, then finally a landing. He landed first on the curtains near the open window, looked around a bit, then climbed down to the floor.

Bats are actually kinda cute when they're crawling. He was turning his head left and right, looking for the Exit sign, but not finding one. So he started flying again.

He landed a second time beneath the curtains on the floor and crawled along the baseboard. I was ready to jump in with my shoe box to catch him, when I saw him jump/fall into the heat/ac register on the floor. The openings are quite literally an inch square and he just plopped right in like they were sized just for him.

I rushed into the room and put a big piece of cardboard over the register, then ran down to the basement to close the vent off. Now he was trapped in the ductwork. I tossed around in my head what my next move would be, but ultimately decided to return to sleep since I had to wake up at 5:30am to teach a Spinning class.

So having had naughty Mr. Bat trapped, I carried on with my day. I came home tonight and rigged up an intricate system of levers and pulleys to trap Mr. Bat. Actually I made a little tightly contained chute leading from the vent to the window.

At about 9:30, Mr. Bat showed his ingenuity by escaping and terrorizing Anne and the kids. This time I trapped him in William's room. I peeked in and there was no activity. Poor dude was probably tired. Anyway, I found him on the back of a curtain. I carefully lowered the upper pane of the window and coaxed him out!

I hope that's the end of the saga, as the Bat Man (batproofer) is coming over tomorrow to figure out how they're getting in and seal it up for us.

Keep your fingers crossed that he can fix it and that the bat that I let out was the same bat that got in last night. (the other possibility being a second bat)

The bat of 2011 - part 1

Just found this draft and decided to share!  I pray that it's the only one this summer.

As I lay in bed, resting soundly, I was awakened by a small bump. Anne frequently opens the window but not the blind, so I just assumed it was the blind blowing in the wind and bumping against the window frame. Then I heard the flutter of a wing and knew the terrible truth that would prevent me from getting a good nights sleep. A bat had broken through our perimeter defenses.

I opened my eyes and my worst fears were realized. A bat doing laps around the bedroom ceiling. I leaned over and tapped Anne. Startled, she yelled "WHAT?!" There's a bat in here. "WOOOOOO", and the sheets were pulled over her head. She apparently believes the myth about bats getting caught in womens hair.

So we both laid there waiting for each other to make a move. Finally I said "lets proceed in a calm and orderly fashion to the door", and we made our move. Thankfully, we were able to close the bedroom door behind us with the bat trapped in the room.

I peeked in, opening the door a crack to verify that the little jerk was still doing laps looking for an exit strategy. This went on for about 5 minutes.

Read on! Part 2

Thursday, January 13, 2011

cd command with two arguments to do directory substitution

At some place I've worked in the past I had the ability to issue a CD command with two parameters. Extensive googling for this resulted in nothing, so I wrote this bash function to do it.

Using 'cd' in this mode will replace the first occurrence of the first parameter with the second parameter. The simplest use case is changing from classes to src directory when in a deep directory structure:

$ pwd
/home/rcs/project/src/com/xyz/custom/some/really/deep/path
$ cd src classes
$ pwd
/home/rcs/project/classes/com/xyz/custom/some/really/deep/path


function cd {
if [ -z $2 ]
then
builtin cd $1
else
builtin cd `echo $PWD | sed s/$1/$2/`
fi
}


It's not bullet proof, but it's decreased the achyness in my typing fingers!

EDIT - I found a few bugs with the function; namely I could not change dir to a directory that contained spaces. Once I made a change to correct this problem, I could no longer issue 'cd' to return to my home directory.

Here are my change to correct these problems:


function cd {
if [ -z "$2" ]
then
if [ -z "$1" ]
then
builtin cd
else
builtin cd "$*"
fi
else
builtin cd `echo $PWD | sed s/$1/$2/`
fi
}

Tuesday, January 11, 2011

KDE Kontact using 100% CPU

I observed a problem with Kontact maximising one of my four cores periodically. After extensive Googling, it seemed that I alone was having this problem, and so began my analysis.

Since it wasn't happening continuously, I figured it was a periodic event and the most likely periodic event was a POP3 mail check. I disabled "interval mail checking", but that didn't resolve the issue. It would still periodically consume 100% of one of the CPU cores.

On a whim, I decided to use the telnet command to connect to my POP server. After authenticating and issuing the list command, I observed a LONG LONG pause. I waited nearly 5 minutes before I got the response back, 19k messages and hundreds of megabytes!

At every interval mail check (set at 5 minutes), I was asking the POP server to count the number of messages and number of bytes in those messages. To resolve it, I added an automatic archival of messages older than 6 months on my mail server, dramatically lowering my inbox size, resulting in a minimal delay when checking for new mail, and no noticeable CPU usage!

As to why Kontact was using 100% CPU while simply waiting for a response from the POP3 server, that is still unresolved.

Sunday, October 10, 2010

Getting the most out of batteries

Having a 4 and 5 year old in the house has caused our battery consumption to grow exponentially because of all the toys and gadgets. Where out family used to remove, replace and toss old batteries, we've adjusted to a remove, replace and evaluate approach.

It seems that some devices require a battery that puts out a very high level of wattage where other devices require less wattage. Here's a rough list I've built, with the most demanding devices at the top and the most forgiving at the bottom

Electronics devices with no motors or lights
Devices with motors or lights
Remote controls
Mechanical clocks
Flash lights

So, when we pull the AA batteries from the Wii remotes, they don't go into the garbage. Instead they go into a "second chance" bin. When we have a remote control, clock, or flash light that needs new batteries, we always get them from the second chance pile.

We're gradually switching to rechargeable batteries now, so this problem will eventually become moot.

One last note. Don't combine fresh and old batteries in a device. It can lead to battery acid being released and we know that leads to extra work. And who wants to do extra work?

Tuesday, June 1, 2010

Thermostat location for heated tile floor

A few observations about installing a thermostat in a heated tile floor after having been through the experience.

1. Purchase and install a redundant thermostat. Run the lead and position the thermostat in a different part of the floor than the primary.

2. The tip of the thermostat is somewhat large and may impact the tile height. If the tip appears larger than the expected depth of the thinset, notch out a pocket in the underlayment into which the thermostat will rest

3. Position the thermostat away from any heat source, such as heat ducts running under the floor, or air flow from heat registers in a forced air system.

4. Label the lead of the redundant thermostat so that the next person occupying your home will know what it is. You may also consider noting the position of the thermostats in the box housing the actual thermostat.