
Monday, September 27, 2010
LinuxMag: Byobu #2 of 10 Essential Linux Admin Tools

Ken Hess of Linux Magazine names Byobu #2 of 10 essential Linux admin tools:
The article is a good, quick read, and I'm quite proud of Byobu considering its company on that list, among webmin, tcpdump, nagios, and vnc.
Cheers,
:-Dustin
Wednesday, September 15, 2010
My First Year of Solar Power

I've posted a few times now about the 6.7KW photo-voltaic (solar) power system we have on our roof in Austin, Texas. It was activated one year ago, today.
Many, many people ask me about it. It has been operational for about a year, so I can finally analyze it's performance each month out of the year. This is important because the energy produce depends greatly on the position of the sun in the sky, the length of the days, and the weather. Different amounts of power are produced at different times.
I'm currently using Curt Blank's aurora program to gather data from my inverter. I have packaged this for Ubuntu, by the way. You can find it in Ubuntu 10.04 and beyond.
My current inverter reading as of today looks like this:
Current date/time: 15-Sep-2010 11:30:02
Daily Energy = 7.314 KWh
Weekly Energy = 91.434 KWh
Monthly Energy = 366.448 KWh
Yearly Energy = 7123.188 KWh
Total Energy = 9433.281 KWh
Partial Energy = 1537.161 KWh
Current date/time: 15-Sep-2010 11:30:05
Input 1 Voltage = 244.048767 V
Input 1 Current = 9.157255 A
Input 1 Power = 2234.816895 W
Input 2 Voltage = 255.783203 V
Input 2 Current = 3.767791 A
Input 2 Power = 963.737732 W
Grid Voltage Reading = 239.640839 V
Grid Current Reading = 12.036012 A
Grid Power Reading = 3196.468750 W
Frequency Reading = 59.966419 Hz.
DC/AC Coversion Efficiency = 99.9 %
Inverter Temperature = 54.750835 C
Booster Temperature = 49.749878 C
The most important number above (for this post) is:
Total Energy = 9433.281 KWh
In the last 365 days, this system has produced 9.4 Megawatt-hours of power.
What does this mean in terms of cost savings? Roughly, I know that electricity in Austin is about $0.115/KWh, so that's approximately $1,085 in savings on my electric bill. The real formula is actually a far more complicated differential equation, as I buy and sell electricity at two different rates, the rates change slightly every month, etc. But this is a reasonable ballpark figure.
Austin Energy actually has a web application where I can view and analyze my usage online. Here's a screenshot of my last 2 year's usage. Note the "Solar kWh" row, as well as the year-to-year difference in "$ Billed".
I can also download these stats in a CSV format, drop it into a spreadsheet and print some pretty cool charts. Analyzing the data directly, I can see that my solar investment has saved me exactly $1,210.71 over the last 12 months -- about $100/month, which is what I expected when I purchased the system.
Accounting for both the Austin Energy PV Rebate, and the Federal Tax Credit, our system is well on its way to paying itself off in just a few short years.
Once again, thanks to the outstanding individuals at Texas Solar Power Company in Austin for their outstanding service and timely installation.
As George Harrison wrote, "Here comes the sun!"
Doo do doo doo,
:-Dustin
Java isn't Evil, but it's not for Me
First off, I apologize. In my last post, I called Java "evil". That's not fair, and several people called me out in the comments. The post has been updated to drop the "evils of Java" verbiage.
My statement was a reference to the humorous-though-irreverent Call of Codethulhu.
It's a personal taste issue. I dislike writing Java, packaging Java programs, chasing down Java dependencies, and even reading Java code. There's nothing necessarily "evil" about it. I have declined job offers that require work to be exclusively performed in Java. I just don't like being around Java and really dislike some of the habits it encourages.
Before I started my University work, I had extensive programming experience in Basic, Pascal, C, and C++ as an ambitious (dorky?) high school kid. The "Intro to Computer Programming" class most Computer Science freshman at my University took was based in Java. And at that time, they were being taught on Windows computers.
I found it very disappointing that a more UNIX/C approach was not used to introduce most of my college freshmen computer science classmates to programming. The approach nursed bad habits, and many programming fundamentals were missed, in my opinion.
A few years later, while working at IBM, I again landed on a series of projects where Java was king. And once again, I found some of these Java programmers lazy in their approach, and bloat-ware abounded. 2GB of memory were required to run simple services that should run in a few MB. Do-one-thing-and-do-it-well was no where to be found And finally, write-once-run-anywhere couldn't have been further from the truth.
I exited myself from the Java world, once again, choosing C, Python, Perl, PHP, and Shell for the projects I initiated and maintain. I'm able to use sound object oriented practices (in Python, Perl, and PHP), and able to honor to the principles of UNIX (with C and Shell).
Occasionally, I'm required to deal with Java when maintaining or packaging something for Ubuntu. I generally start from scratch, trying to have an open mind, but within minutes or hours, my skin starts to boil and steam flows out of my ears. I find over-engineered code in the source, binary JARs lumped within other projects out of laziness, and memory requirements that are simply staggering for the goal of the program.
Sorry, that's not for me.
Still, thanks for keeping me honest, making me explain myself, and pruning the potentially offensive language out of the other post.
Cheers!
:-Dustin
Learning to Wink, Learning to Code

My wife, Kim, isn't a hacker.
She's a kindergarten teacher. She likes to crochet, and she's pulling a needle and thread through some embroidery on the couch next to me right now.
And this is why I nearly choked on my tortilla chips at the Red Iguana in Salt Lake City a few days ago when she asked me, "When you say you're coding, what are you actually doing?", soon followed by, "So why do you hate on Java so much?"
Kim wasn't asking just to wind me up or kill time -- she was genuinely curious about my work, perhaps for the first time. Fortunately, we had a 3+ hour drive after dinner that night. In the passenger seat, she cracked open her Lenovo S10-2 netbook running Ubuntu 10.04 and wrote hello world in 5 different languages: C, Perl, Python, Shell, and Java. Kim particularly liked how Gedit color coded her syntax.
We worked through the difference between compiled and interpreted languages. Unsurprisingly, she found Perl, Python, and Shell straightforward, and C slightly more complicated.
Her favorite language after 30 minutes of experimentation was Shell, so we decided to try something slightly more interesting: input and output. Here's what she came up with:
#!/bin/sh
echo "what is your favorite color?"
color=$(head -n1)
echo "oh, $color is my favorite too"
Kim finally asked, "What is this Byobu thing you're always talking about?" Yep, I lit up like a light again. So I demonstrated Byobu for her, and she took to the status notifications at the bottom of the screen.
She suggested creating a plug in that would remind me to take a break from work periodically and have dinner :-) We shelved that one for now, and instead, she made a plug in that "winks" every few seconds. Here's her code:
/home/kim/.byobu/bin/2_wink
#!/bin/sh
if [ -f /tmp/wink ]; then
echo ":)"
rm /tmp/wink
else
echo ";)"
touch /tmp/wink
fi
She made it executable with:
chmod +x /home/kim/.byobu/bin/2_winkAnd a few seconds later, Byobu is winking at her!I'm extremely proud of Kim's keen curiosity about my work, and particularly her follow-through . I'm not sure I'll be crocheting a doily any time soon, but I am running her winky face notification in Byobu. It reminds me what a lucky guy I am. ;-)
:-Dustin
Monday, August 30, 2010
How My Work Benefits Free Software
I'm personally offended when Canonical and Ubuntu are dogged about a perceived lack of contribution to the Free Software ecosystem.
- Packaging
- Documentation
- Communication
- Conferences
- Upstream Contributions
- Being an Upstream
- Bringing Free Software to the Masses
1. Packaging
Perhaps the highest volume, least glorious work I do is around a process called "packaging". It's not very sexy, but it is tremendously important. Packaging is what allows you to go to the Ubuntu Software Center, choose a program, click 'install' and then run that program. Packaging also allows command line (server) users to simply type "sudo apt-get install
I've packaged many dozens of applications for Ubuntu (and some of those have been uploaded to Debian as well). In many cases, this is work that the developers of this software is unwilling or unable to do.
In practice...
About a year ago, I had solar panels installed on my roof. The power inverter attached to those panels actually has a USB input and some Windows-only software that can read statistics about my photo-voltaic output. I first checked the Ubuntu archive for a package that could communicate with my inverter, to no avail. Searching the web, I found a guy named Curt Blank who wrote just such a GPL Free Software program called 'Aurora'. After a few dozen emails back and forth, and sending patches his way, we finally got it working like a charm against my hardware. I wanted to make sure the next Ubuntu user to buy an Aurora inverter could simply "sudo apt-get install aurora", so I packaged Curt's project and uploaded it to Ubuntu. It's available now, as of 10.04 (Lucid). Curt was pleasantly surprised and appreciative of having his software included in a distribution, and available to all Ubuntu users!
2. Documentation
No one should *ever* play down the importance of documentation! Shrink-wrap software always comes with a manual. Many Windows/Mac users buying shrink wrap software consult that manual when something goes awry. Free Software is delivered almost exclusively electronically -- but this is no excuse for omitting a manual! Documentation for Free Software comes in many forms. Web delivered content, such as Wiki's are quite popular. The http://help.ubuntu.com/community documentation wiki is *outstanding*!
As an Ubuntu Community Member, I am a frequent contributor to that documentation, particularly in the UEC and Virtualization sections. This information helps many first time Free Software users clear their first hurdle, and gives them confidence that there is a tremendous community of fellow users who have solve many of the problems they encounter. Ubuntu Community documentation is some of the best around. Google for almost any given Linux help topic (printing, dvd, kvm, etc), and the word "Ubuntu", and you are sure to find some pertinent, accurate, informative documentation.
In practice...
When I first joined the Ubuntu Server Team in 2008, I found myself needing to read hundreds of manpages (text manuals for the command line). In some cases, I did not have the needed manpages on my local system. In other cases, I needed a generic way of search for multiple terms in all manpages. And in general, I prefer reading documentation in a web browser rather than a terminal. Thus, I created http://manpages.ubuntu.com/, which is a web application updated nightly, generating HTML versions of all manpages in the Ubuntu distribution. This site contains hundreds of thousands of pages, all indexed by Google (and thus searchable), marked up using HTML for readability, cross-linked for easy traversing through manpage-to-manpage references, and able to render a printer-friendly PDF of any given page. I continue to maintain the source code that generates manpages.ubuntu.com (which is also Free Software), and the hosting of the content is courtesy of Canonical.
3. Communication
On a daily basis, there are several hundred of Ubuntu developers and community members distributed across hundreds of IRC channels, mailing lists, and web forums. These are open communication channels whereby we develop Free Software and support its millions of users. We respond to messages in real-time, helping individual users with their issues. All of these media are archived and published, and the Internet has a very long memory. Quite often the most important service performed is not the assistance of the single user asking the question. Rather, it's the scores of others who search the web for that same question weeks, months, or years later, find the archive, and solve their own problem without needing to register for or learn the nuances of IRC/lists/forums.
Blogs and Launchpad bug reports can serve these same purposes. Any time a person contacts me privately to discuss a bug or a problem, I always kindly request that we move the conversation to a public forum (usually a launchpad.net bug report) so that others might learn from our discussion. For frequently-asked-questions, I tend to use my blog, so that I can update the response at a later date (should things change), and always refer future questions to the same URL.
In practice...
I developed and maintain a feature in eCryptfs which allows users to encrypt their home directories. Recovery of such encrypted data can be slightly complicated, if you know nothing about data encryption. Many new users have struggled with this, and many have been saved by: http://blog.dustinkirkland.com/2009/03/mounting-your-encrypted-home-from.html. The latest comment, AUGUST 23, 2010 8:46 PM: "scratchr said...THANK YOU THIS SAVES MY BUTT!!!!!!". This is but one of a couple hundred posts that I have syndicated to planet.ubuntu.com in about 2 years.
4. Conferences
Twice-a-year we hold an open developer summit, where we brainstorm our next release. These sessions are broadcast over the Internet, and anyone in the world is welcome to attend, and have their opinions heard. The open communications and friendly nature of our developer summit encourages collaboration and participation across many facets of the Free Software sphere.
External to Ubuntu, we also travel to countless tradeshows, summits, festivals, conferences, and gatherings of software technical and business people. Quite often, we are introducing people to the concept and practice of Free Software. Other times, we are collaborating with other Free Software developers, helping further the over all cause.
In practice...
Over the past 3 years, Canonical has sponsored (all or in part) my attendance to, and I have taken time out of my personal and work schedule to actively participate in multiple Ubuntu Developer summits, LinuxCons, Linux Plumbers, Linux Conf AU, CloudCamps, Texas Linux Fest, et al. Many of these were sponsored by Canonical, helping the conference pay for itself.
5. Upstream Contributions
Ubuntu is a "distribution" -- a collection of the best of open source software. You may think of Ubuntu as a grocery store. We seek out the best fruits and vegetables, and the best canned, bottled, and boxed products we can find, and make them available to you. In some cases, we do the canning/bottling/boxing (aka, packaging) for you. In other cases, we make available the products of our distributors (Debian, typically). You, the shopper at the Ubuntu grocery mart, have hopefully come to trust the quality of goods we provide, and trust your family and friends to use our packages too.
Sometimes the items we receive from our upstream have flaws that we can detect and fix. It is quite easy for us to fix those issues, and make the improved packages available to our users. It takes a bit more effort to send those fixes upstream, to the people we received the subject code from. And although it does take effort (tremendous effort, in some cases), it's a very important part of being a good citizen in our community. Communicating with upstream is a critically important part of my job, and one that I take very seriously, and in which I take much pride.
In practice...
Update-motd is a package that I initially created to allow for Ubuntu Server administrators to dynamically create the Message-of-the-Day, /etc/motd, by placing scripts in a specific directory, /etc/update-motd.d. These scripts would run at login (or at a specified interval), and command-line users would see the latest and greatest information at each login. This program stood alone for a while during its experimental phases, and I eventually ported it to C, generating a patch against PAM itself. Now that the functionality has stabilized, it is included in Ubuntu's upstream, Debian's, PAM package.
6. Being an Upstream
Returning to that grocery store analogy, sometimes the Ubuntu Supermarket lacks a particular "product" that either our customers ask for, or that we think our customers might want. In such cases, we may "become" an upstream and write some new software to serve our purposes and provide new features to Ubuntu users. Some of these projects are essential to improving the Free Software end user experience. A few that come to mind immediately: command-not-found, apport, and upstart.
Ubuntu as a whole, though, is an Upstream to various derivative distributions, such as Kubuntu, Xubuntu, Mint, and TurnKey Linux cloud appliances. We are furthering Free Software by producing a rock solid base that other people can use to build innovative derivatives that serve unique purposes and reach all sorts of interesting people.
"Being an upstream" maintainer is perhaps my favorite part of my job at Canonical, working on Ubuntu. We have an amazing suite of utilities (Launchpad, Bazaar, PPAs, and Ubuntu itself) for making the upstream experience simply outstanding. We have both a corporate and a community culture that strongly encourages the development of GPLv3 (and AGPL) Free Software. The software we develop and maintain as upstream is tightly integrated into Ubuntu, but it is freely available for inclusion in any other distribution as well.
In practice...
I have initiated several upstream projects, to fill gaps that we perceived in our Ubuntu Server distribution. These are all 100% Free Software, developed and maintained in Launchpad/Bazaar, included in Ubuntu, but sometimes included in other distributions as well. Byobu is an elegant configuration and usability layer on GNU Screen, which makes it quite functional as a text-based window manager. TestDrive is a handy utility that synchronizes daily ISOs (from Ubuntu or other distributions) and launches them in a virtual machine (KVM, VirtualBox, or Parallels) for your perusal -- without having to know anything about virtualization. PowerNap operates much like a desktop screen saver for command-line-only servers, bringing systems down to a lower power state when underutilized. eCryptfs is a cryptographic filesystem in the Linux kernel; I maintain the user space tools, which have been enhanced to support per-user encrypted home directories. This is a feature that was pioneered and funded by Canonical, and contributed directly to the upstream project. For fun, and in my spare time, I spend many hours working as an upstream developer of Musica, Pictor, Screenbin, BogoSec, Lynx-web-app, as well as Byobu, PowerNap, and TestDrive.
7. Bringing Free Software to the Masses
By far, the most important contribution I make to the Free Software world is doing my little part within Canonical and Ubuntu that makes Free Software available to the entire world. From Canonical's partnerships with OEMs such as Dell for desktops/laptops/netbooks, to our Cloud server images available in Amazon's EC2, we are making Free Software available to people who have never used Free Software before. Call us a "match maker" or "middle man" if you will, but we are undoubtedly helping connect the dots, and plug many new people into Free Software.
In practice...
Believe me, I had tried for nearly 10 years (1998-2007) to convert my wife, mom, dad, sisters, friends, and extended family to join me in replacing Microsoft Windows with Linux and Free Software. In 2005, I managed to convert my lovely, non-technical wife, Kim, to Fedora -- but I failed on every other account. I'm ever so proud to say that all of the above (wife, mom, dad, siblings, inlaws, and friends) are proud users of Linux and Free Software today, August 24, 2010. And Ubuntu is the reason why. Ubuntu is Linux for Human Beings. Their wireless just works. Their printing just works. They can play music and watch videos and browse the web. They can work on documents, spreadsheets, and presentations. When they need a new program, they can find it and install it. They can upgrade across releases all by themselves. They can plug in peripherals and video conference with their kids and grandkids. All of this was possible with Linux and Free Software in 2004, for an subject matter expert like me (or perhaps you). None of this was possible for my non-technical relatives before Ubuntu. THIS is what we do, and THIS is why Ubuntu is important to the Free Software ecosystem. We are mainstreaming Linux and Free Software. This is a dream thousands of us have had for 20+ years, and it is something that we have been promising (promised?) for that same length of time. It has been co-joined with "Open Source", it has experienced some individual successes on Servers, and with particular projects (Firefox, OpenOffice, Apache), but never before has Free Software opened Desktops by the millions -- yes MILLIONS -- as it has with Ubuntu as a distribution.
I am helping that happen in very tiny ways, but I'm very, very, VERY proud of it.
:-Dustin
Thursday, August 26, 2010
And Now, For Something Completely Different...
My buddy Nate showed me this website today, XtraNormal.com. You can register for an account and direct your own animated movies. Write the script, cast the actors, choose the set, select the score, direct the camera angles, expressions, animations. It worked well enough for me in Chromium in Maverick.
Check out my first video below ... :-)
:-Dustin
Buy 1, get 8 Free! Or, a Useful Awk Hack...

But first, a couple of updates...
- If you appreciated my errno post, you might be happy to know that /usr/bin/errno is now provided by the ubuntu-dev-tools package in Maverick. This probably won't be the permanent home for the utility (currently in discussions with Joey Hess about putting it in moreutils, and the kernel team about putting it in linux-tools). But while we debate among ourselves about the permanent location of the bike shed, you -- our Ubuntu users -- are welcome to go about using the tool.
- And if you liked my bash alert post, you might also be happy to know that the alert alias is also in Maverick's skeleton .bashrc. This only affects new Maverick installs, and you'll have to install the libnotify-bin package, but still, it's a useful tool, and a good start. Several people have suggested UDS-Natty sessions on how to make the tool more universally useful, and it would be cool to see those move forward in the next cycle.
Okay, now for another fun set of tools!
All too often, I found myself typing something like this:
... | awk -F":" '{print $3}'
That's a lot of wasted characters, and it's easy to flub them up.
And so I generalized it, with this 2-line shell script in /home/kirkland/bin/1:
#!/bin/sh
[ -n "$1" ] && ifs="-F\"$1"\" || ifs=
eval awk $ifs "'{print \$$(basename $0)}'" /dev/stdin
And then I made symlinks to this one script, for numbers 2-9:
cd $HOME/bin
for i in $(seq 2 9); do
ln -s 1 $i
done
And now I can:
errno "" | 1
euca-describe-instances | 2
cat /etc/passwd | 7 :
I started out with just simple aliases for 1..9, but I found myself often needing to change the input field separator (IFS). In case you'd prefer the simple aliases, you can use these:
for i in $(seq 1 9); do
alias $i="awk '{print \$$i}'"
done
What do you think?
- Would you like to see these as /usr/bin/1 ... /usr/bin/9 in Ubuntu Natty?
- Do you have a more efficient implementation?
:-Dustin
p.s. My wife, Kim, took both of these pictures recently, on the side of the road in Michigan and New York, respectively. Pretty birds, hard to photograph! :-)
Subscribe to:
Posts (Atom)



