Move a panel between monitors in Gnome
January 21st, 2010
I’ve used two monitors for years now on a kinda cheap card with one DVI and one VGA port. Naturally, I use the DVI one as the primary monitor, keeping the VGA as a supplement for extra space. However, my card detects the VGA as the “primary” monitor and puts my Gnome panels on that monitor. I learned to live with it, almost enjoying the fact that my primary workspace had no decorations at all.
However, I got curious and dug into it to find the setting to change this:
gconftool-2 -s /apps/panel/toplevels/top_panel/monitor --type int 1
Alternatively, use gconf-editor to navigate to that location and change monitor from 0 to 1 from there. I didn’t even need to re-login, it just hopped across to the other monitor.
UPDATE: Ya, so apparently you can just alt + left click to move the panel between monitors. The interwebs is awesome, thanks to mbooth in the comments for that one.
Screen
January 19th, 2010
I love when I find useful built-in commands that I never knew about. When starting out with Linux, I heard about the typical heavy hitters like grep, sed, and awk. Then I discovered some variations on common commands, such as htop and less. And then every so often, someone mentions a command in passing that causes me to say “Wait… what is that?”
Screen is one of those sorts of tools. I was watching a VNC demo of one of our team’s sprint reviews and was distracted by the fact that he had a tab bar on the bottom of a terminal. It turns out that was just part of the coolness of “screen”.
Screen is basically a window manager that runs in a terminal, letting multiple shells run within the single terminal. I’m sure there are other features that I’d find awesome, but there are two that immediately stood out.
As I mentioned, screen allows you to run multiple shells inside of a single terminal. Instead of starting up a handful of separate SSH sessions to a server, I now just use screen to manage multiple shells inside of a single connection. Each call to screen creates a new shell, with a simple emacs-like syntax to switch between them:
ctrl + a + n # next ctrl + a + p # previous ctrl + a + 0 # select screen 0
One side note on this, by default the tab bar displaying the running shells isn’t displayed. Adding the following to ~/.screenrc enables a visual indicator of the current and possible shells that are open:
hardstatus on
hardstatus alwayslastline "%{-b gk}%-w%{+b kg}%50>%n %t%{-b gk}%+w%< %= %{w}%D %M %d %C%a"
While useful, it can still get a little confusing when a bunch of shells are opened. The title can be set by:
ctrl + a A

The second major piece of awesomeness is the ability to detach from a running screen and reattach later. Going back to the SSH example, this lets me leave some shells running, detach, completely disconnect from the server, and then reattach to the screen later (with everything left exactly as it was).
Again, an emacs-like syntax for detaching from a running screen:
ctrl + a + d
Later, to reattach to the running screen detached from earlier:
screen -dr
Like I said, I’m not trying to make this post sound like I’ve discovered some hidden black magic in Linux. It’s just an attempt to let new users know about this awesomeness.
From Java to Python
January 13th, 2010
I’m not completely sure why, but I’m a bit embarrassed to admit to Planet Fedora how little my Python experience is; the majority of my experience is in Java. I was able to read and bug fix the Python code in Spacewalk, but I hadn’t really dug deep into my own project. Now that I’m not teaching any longer and have some free time (one of my main reasons for quitting), I can finally sit down and dork around with the language. After spending some time working on some basic games and a simple IRC bot, I figured I’d step back and think about what the transition from Java to Python has felt like.
Don’t Fear The Whitespace
I constantly hear people mention the indentation in Python as the first thing when talking about moving to the language. Not only is it not as jarring of an experience as people make it out to be, it’s downright awesome. I’ve always been compulsive about my code format anyway, so the biggest difference is the lack of curly braces.
Collections Are Awesome
It’s much lighter-weight to throw things into a list or map (dictionary in Python) than it is in Java. Get out of the mentality that you have to jump through import hoops and rigid notation to create, access, or return collections. In Python, they even let you do cool things like assign multiple variables as a return from a call:
exceptionType, exceptionValue, exceptionTraceback = sys.exc_info()
Looping Feels Weird At First
I got a little thrown off by this initially. Most loops read really well:
for square in openSquares:
However, when looping through a set of numbers, you need to use the range method:
for i in range(0, 10):
Looking at both of those examples brings me to my next point…
Don’t Forget The Colon
This keeps throwing me off, but after declaring a function*, loop, or if statement, don’t forget to end the line with a colon. I’m happy to be rid of curly braces, but I get over-ambitious and forget the colon too.
Don’t Over-engineer Configuration
Depending on what you’re doing, you can likely just stuff configuration values into a script and import it (not needing to compile really is liberating in this respect). That’ll also give you the use of lists and maps by default. If you’re not reading between the lines I’ll spell it out: no need for XML-based configuration, which is one of the more evil trends in Java.
There are definitely more things I could mention; don’t take this to be the only lessons I’ve learned (any other hints/tips are appreciated). But I do want to avoid a mammoth blog post that causes readers to go into a zombie-like trance, so I’ll stop it here for now. I do want to thank Devan (dgoodwin) and Jesus (zeus) for dealing with the Java-veteran-turned-Python-noob and not finding a way to crash my chat client to avoid more questions.
* I haven’t seen a solid explanation of “Call them ‘functions’ because you’ll sound like a Java guy calling them ‘methods’”, but this feels like something where using the wrong term will make me stand out as a Java developer in a Python world. So I’ve been advised to take a militant approach of “Yes, I’m a Java guy learning Python, deal with the occasional terminology missteps.”
Dangers of working at home
January 8th, 2010
My mouse died yesterday, so I’m using an old trackball. My 2 year old daughter just came in to say goodbye before they went out. She took one look at the it, grabbed the ball out of the rest of the mouse, and ran out of my office to go play with it.
Since it fully renders my mouse useless, this is actually more crippling than the last such incident. I keep my RSA FOB on a lanyard. A few months ago, my daughter saw the lanyard and then ran around the house showing off her “new jewelry”.

