↓ Twitter is updated more often, so read it! ↓

2009 Year in Review: Writing, stocks, coding, and more

I didn’t blog as much as I would have liked to this year, mostly because of my crazy busyness.

Gears logoMy article on how to install Gears on 64-bit Linux continues to see quite a bit of traffic. I even host a copy of Gears, even though it’s likely out of date. Also in the Linux vein, my articles on how to buy DRM-free music online with Amazon MP3 on Linux and Android were moderately popular. I wrote an article on how to add CACert root certificates to Chromium on Linux and it sees more traffic than most of my other posts combined.

Launchpad logoI wasn’t as active in the open source community as I would have liked, but I did make some contributions to Gwibber, Astrid, Celtx, and Lernid. I mentioned the first three in my Launchpad activity update. The latter is a newer development by Jono Bacon. I contributed the entire Esperanto translation less than two days after it was available on Launchpad. I have no way of verifying it, but I think that the Esperanto translation was the first complete non-English variant translation available.

I recently wrote two brief articles on how to automate some tasks on Facebook. One was how to rapidly expunge friend suggestions, and the other was how to select all friends in a friend select dialog.

I met Tom Dickson of Will It Blend? fame at CES last year. He was really cool and friendly.

I also wrote a few articles on politics, my favorite being A Comment on Socialism Defined, a comment left on a friend’s blog, Strike the Root!. I’ll not go into how much I think Obama and his friends have screwed up the country already (it’s not all been bad—he has done some good things). That’s something for another article.

A new hobby this year for me has been stock trading. I’d saved up some money and decided to use some skills I learned in middle school to make a buck or two on the stock market. Ironically, not 12 hours after I blogged about my flagship stock being up near 200%, that stock, SPNG, dropped 27.66% in one day, costing me $23,000 of value on a $10,000 investment in 65 minutes. SPNG 2009-06-12 (Etrade graph)It recovered, and I still made out with a profit, but I learned a very, very valuable set of lessons. I still kick myself occasionally because of this and probably will for a long time. My goal of getting into stocks was to generate enough money that I could pay off my student loans really quickly. I could have paid off more than 2/3 and I didn’t cash out when I should have.

I did meet many, many new people in the stock world, especially Stockguy22 and the Bulls on Wall Street crew. I said goodbye to StockTwits after I was temporarily banned for cheering on Vonage (VG) when it was less than 50 cents, riding it to 80 cents, and cashing out. They called it a worthless, crappy penny stock. A few weeks later, it spiked to ~2.20 and has been above a dollar since. HA!

I got some neat advice from friends while considering the purchase of a MacBook Pro (which I got and love) and the acquisition of a PS3 (which I did get).

Vivísimo logo The biggest changes in my life were in my location and work. I got a new job in March at Vivísimo, a search platform maker in Pittsburgh–I even wrote a post on the corporate blog! I moved in with some friends in May, but realizing we were a little cramped, I moved into a new apartment in July (I didn’t write about that!).


I wrote more than 28 articles for Bob Buskirk’s ThinkComputers. My favorites were the Masscool MP-1371RS Media Player and QNAP TS-809 Pro network attached storage device. I use the former alongside my PS3 for video formats my PS3 can’t stream from the latter. The NAS has become the central storage hub for all of my computers, replacing the QNAP TS-109 Pro I reviewed two years ago.

BIOS LEVEL was fairly inactive this year, largely because of a major server outage from May to August. I did write an article on the Orbita Mouse, which I still use to this day at work. I did record and post several videos from Ohio Linuxfest 2009, including Linux Journal editor Shawn Powers’s keynote, Jorge Castro’s talk on building a community around an open source project, and more on licensing, making money from open source, democratized design, and talking to policymakers and legislators about open source. All Ohio Linuxfest videos with a write-up are available on BIOS LEVEL, or on BIOS LEVEL’s Blip.tv channel.

Jon Daniel and I spend most of November cranking out a beta version of Profyle.at, a personal profile directory service. We’re not entirely finished yet, but sign up for our Profyle.at beta and you’ll likely get in! Profyle.at LogoWe want to help people find you on the Internet so your friends and family can follow you on whatever sites and networks you like the most. We pitched for funding and didn’t get it, but were cordially invited to present again during the next round in a month.

Brigette and I are still together, and going strong. We’ve spent most of her winter break together, driving throughout western PA to be with friends and family, too. She’s been working on her web site for her beagle and vizsla show dogs, Glade Mill Sporting & Hound. She’s come a long way, from using a completely WYSIWYG editor to redoing it with a mix of code and WYSIWYG with Adobe Dreamweaver. I’m eager to see what she’s planning for it.

13″ MacBook Pro: I choose you

A month ago, I mused purchasing a 13″ MacBook Pro. My primary reasons for considering the MBP were the freedom of OS choice, “seeing what all the fuss is about,” premium hardware for just a couple hundred dollars more, excellent customer support, and a healthy dose of nostalgia.

Approximately a week after writing the post, a friend let me know of a rare deal: a friend of his who just so happens to be an Apple authorized reseller was in jeopardy of losing her authorization because her sales were really low. In order to meet her goal, she was selling Apple hardware at cost. You can’t beat cost! Combine that ~$300 savings with putting the purchase on a credit card with excellent rewards, and it would put me over the edge of my reward amount needed to get myself with a free flight worth about $400.

So, I bought a stock mid-level 13″ MacBook Pro, the one with a 2.53 GHz Core2Duo, 4 GB of DDR3, and a 250 GB HDD. I did get AppleCare and a remote, although the remote was backordered and mysteriously hasn’t arrived yet (should hear why on Monday).

My thoughts?

Summary

I’ll never go back. Apple has a solid hardware product with bells and whistles which themselves make me glad I bought it, plus a slick operating system which appeases my desire for an easy-to-use, on-the-go environment.

TL;DR version

and it had been on for ~20 minutes

and it had been on for ~20 minutes

Hardware. Seven hours of battery life. Seriously. I got right around that many hours the day I took this screenshot about a week after I bought it. The multitouch touchpad with its gestures are amazing and have seriously changed how I use a touchpad–even more once I enabled tap-to-click I miss them when I use a non-Mac laptop. The magnetic power cord connector should be on every computer: it’s saved my ass twice now. The graphics card is enough to handle Left4Dead with most of the settings on medium, and it’ll certainly handle the older games and casual games I tend to play more often these days. The screen color is amazing and the keyboard is the most welcoming keyboard I’ve ever used. This is the first line of Mac laptops with an SD card reader, and that’s indispensable for me these days with the dog show photography I’ve been doing.

Downsides? I’m not too hot about the non-removable battery, but I’ve never needed a second battery even on my old Averatec which had approximately two hours of battery life. Apple made a data-driven design decision when choosing this path. I’ve not heard many complains except from people who are resistant to change. Folks who really need another battery can suffice for the hour-long charge time while plugged into something like a HyperMac battery. I also wish it had a real microphone port, but how often do I actually use a microphone? Never. The built-in mic is sufficient for almost everything I’d ever use it for. I’m also not too hot about the lack of a DVI or HDMI port and a mini-Displayport instead, but it’s another data-driven design decision and technically Displayport is a better standard for video. I ordered an adapter from Amazon; it’ll arrive this week.

Software. Mac OS X isn’t new to me. I used 10.5 on Jon’s Macbook when I borrowed it for a few months last year, and used 10.1 back in high school. It’s not a huge adjustment for me, so I’ll not go over such nuances. However, there are a few things I must highlight, primarily so that Linux folks like myself can mirror these features in Ubuntu, Fedora, and the like.

Time Machine is indispensible. I configured Time Machine to work with my QNAP NAS and it backs up regularly. The whole system! Efficiently! Recoverably! With an excellent interface for both setup and browsing and recovery. rdiff-backup pulls this off on Linux, but there’s no “don’t make me thing” GUI for it like there is for Time Machine.

Drag-and-drop installation of programs has always been one of my favorite things about OSX. No complicated installer program with click-through EULAs, no broken packages or forced upgrades. Sure, the packages are larger because of universal binaries and statically linked libraries, but I’d rather take up another 10 MB if it means I can simply drop an icon in a directory to install it, or move it to the recycle bin to remove it. I’ve been using iUseThis to track my used programs and combining it with AppFresh for version updates.

OSX is just Unix-y enough for a lot of the stuff I do. MacPorts gives me access to a lot of utilities, especially Synergy, which allows me to use the mouse and keyboard of one computer on another via a network connection. I’ve also used it for up-to-date Python and other scripting and development tools. I use Visor to give me a drop-down, Quake-style terminal in which I do lots of command line stuff, primarily via an SSH connection to one of my many Linux computers.

Perhaps one of the most care-free benefits of OSX for me is painless hibernate, sleep, and suspend. I can shut the lid and forget about it. I’ve rebooted the Mac maybe thrice in the month I’ve had it (outside of OSX updates). I’ve never seen Linux or Windows hibernate/suspend working this well on any hardware.

Downsides? There aren’t many. Sometimes I get frustrated when I can’t find an OSX analogue for a Linux program I’ve used. I have yet to find a decent microblogging client which I like as much as Gwibber on Linux. Despite being written in the highly-portable Python language, Gwibber depends on a few things that OSX just doesn’t provide. I’ve tried Tweetdeck, Nambu, Spry, and a host of others, but just can’t find the feature set I want (eveything most clients have, plus Identica, Facebook, and Flickr plugins). Twirl comes the closest, so I’ve been using it. Eventbox is showing promise as it becomes Socialite, but I’ve yet to actually see it in action.

I’ll eventually get around to trying out Virtualbox’s 3D acceleration for some Windows games, or Wine and WineBottler for some others.

A major problem I have with my OS choices is that I like to tinker. OSX gives me the freedom to tinker with a lot of things, but its defaults suffice for almost everything. I think it’ll be more difficult for me to screw up OSX than it is for me to screw up Linux or Windows.

TL;DR summary:

I’m pleased with my purchase and haven’t had the buyer’s remorse I’ve had sometimes when making such a giant purchase. The MacBook Pro laptop was designed with both low-level and power users in mind, and I highly appreciate it. It’s just enough to not be too much.

HOWTO: Add CACert Root Certificates to Chromium

CACert Logo + Chromium Logo

I’ve recently begun using Chromium for most of my day-to-day browsing tasks. It recently gained support for Adobe Flash and other plugins. I’ll be excited to when it picks up Java, as well—then I’ll have little reason to use Firefox except for development. I’ve enjoyed watching the daily builds go from a virtually a crash-on-click shell to the wonderfully quick tool I’m using right now to type this post.

However, I’m a CACert user (and assurer!) and have several sites and/or utilities which rely on CACert-issued free SSL certificates.

Chromium on Linux doesn’t have its own certificate management system, but instead uses Mozilla’s Network Security Services (NSS) Public Key Infrastructure (PKI). The LinuxCertManagement article on Chromium’s wiki gives some instructions on how to import certificates.

I’ve reproduced these instructions for Ubuntu with some of my own additions below.

sudo apt-get install libnss3-tools
wget http://www.cacert.org/certs/root.crt
wget http://www.cacert.org/certs/class3.crt
certutil -d sql:$HOME/.pki/nssdb -A -t "TCu,Cu,Tuw" -n "CACert Class 1 Root Certificate" -i root.crt
certutil -d sql:$HOME/.pki/nssdb -A -t "TCu,Cu,Tuw" -n "CACert Class 3 Root Certificate" -i class3.crt
rm root.crt class3.crt

You’ll now be able to log in to sites using CACert SSL certificates without needing to click through the red screen of hate.

Note that as of the daily build for August 11, 2009, it is not yet possible to accept and/or present a certificate for use with certificate login. Hopefully, this won’t be too far off. Fortunately, I don’t use this login style very often.

My new hobby: stock trading


It all started a year or two ago when I decided to buy $250 worth of stock in Transmeta (TMTA), which had recently released a new processor design and licensed some technology to Intel or one of the other major processor manufacturers. A few weeks later, and unbeknownst to me, TMTA performed a reverse split to increase the value of its stock and avoid delisting. The stock price went from $8 to $15 and my shares went from approximately 30 to approximately 16. The bad part is that the stock price kept dropping. It was at $12 when I decided to cut my losses and cash out. I lost approximately $32 on that venture.

I convalesced for a while, nursing my $32 wound (not a lot of money, but a chunk for a college kid). I continued to read; continued to list stocks I wanted to watch in my Google Finance porfolios.

I started again last summer (July?) with 17,000 shares of Linux Gold Corporation (LNXGF), $1,020 worth of 6 cent shares. I noticed that the stock was highly volatile: its intraday range was generally between .06 and .10. I hoped to hit that .10 sweet spot for a nice gain. Unfortunately, that day never came after I bought the stock. It stuck at .06 for days, weeks, months. Sometimes it would hit .07, but that wasn’t enough for me. One day, it hit .08, but I was busy working and didn’t catch the spike.

Eventually, I set a limit sell for .07 for 13,400 shares and .065 for the other 3,600. After commission, I got back approximately $1146, a $126, 12% profit. Not bad for someone who had idiotically lost $32 a few months prior.

I would later learn a lot more about the role of volume, and realize that it may have taken days of .10 to offload my 17,000 shares. I would have been better off farming it for that one penny gain all along: buy low, sell high.

In October 2008, the market crashed on account of several American banks’ and insurance companies’ financial insolvency and the American auto makers’ financial revelations. Stocks which were valued in the high tens were suddenly in the low tens, or even in the ones.

By the end of October, I knew that it was certainly a buyer’s market: a cautious buyer’s market, but for most stocks, the only direction to go was up.

I read up on dividends and decided that I wanted to acquire enough holdings in something that I would see some kind of divided check once a quarter. The amount didn’t really matter; I wanted the majesty of telling my father and grandfather that I made a dividend since they both love to use the phrase “it pays dividends”.

I bought 100 shares of Diana Shipping (DSX), a Greek dry shipping company. This set me back by approximately $800 (8.00/share), but the dividend which it was supposed to be paying in two or three days was .39, so I’d see a check for $39 by the end of the year. Unfortunately, I misunderstood the “holders of record” definition and didn’t get the check: I bought in a day late. I decided to hold onto it, as I knew it could only get better. DSX announced that it was suspending its dividend, though, so I was in the hole $800 and wasn’t going to get that skinny little dividend check.

I did some more research and settled on Euroseas (ESEA), another Greek dry shipping company. I got in at $5.65 knowing that, this time, I would get the dividend. It came—all $17.00 of it—and I rejoiced! I made a dividend! w00t!

Unfortunately, my call about “things only going up” was incorrect when applied to ESEA. As of this writing, it’s at $4.84, but has been growing fairly steadily since hitting a low at $3.51 in January. I got another dividend in March, though, but it was less than $10.

$SBLK broke 3.00 for the second time today and doesn't look l... on Twitpic

My positions as of Apr. 17

Since then, I acquired some cash from various sources and bought into other companies. My favorite and the poster child for my “buyer’s market” theory is Star Bulk Carriers (SBLK), another Greek dry shipper. I got in at $1.30 and again at $2.87. It’s currently at $3.01 and I’m in for the long haul. The company is nearly two years old and had a 55.98% profit margin in 2008, paying an 18 cent dividend plus new shares in December. If the dividend holds, I could see a more than $500 dividend when it’s issued in May or June.

I bought into a few other companies somewhere in there, including Level3 Communications (LVLT — made a 28% profit when sold), Taiwan Semiconductor (TSM — advised to buy by my now-former boss, still holding), and Ford Motor Company (F — made a 60% profit when sold).

Recent acquisitions include Vonage (VG) using profits from the sale of some hard assets and Converted Organics (COIN) using proceeds from the sale of F, at the behest of some reputable folks whom I’ve been following on Twitter. One guy made something like $117,000 last week — 30% profit, if I recall correctly — through JAVA, WYNN, DNDN, and a few others.

VG is poised to take off once a brokerage offloads ~400,000 shares. I’d be happy with a 10%-15% gain based on the amount I have in it. However, the theory is that it will hit .60 from its current .37-.40 range as AT&T (T) shuts down its VoIP phone service and customers flock to more proven providers such as Vonage.

COIN, on the other hand, burned me. I chased it. Kunal called it at .82-.83, but I was hasty and got in at .95 with a hefty chunk of change. I’ll sell it as soon as I can make up the cost of commission or it drops to the point that I’ve lost my profits on F.

Stocktwits is an amazing Twitter mashup which connects amateur investors with seasoned professionals and savvy part-timers. I look forward to getting in on their advice and making a dollar or two along the way. I know I’m still quite green and I don’t have a lot of time during the day to watch for spikes, so indispensable is the guidance of those whose livelihoods depend on their good calls.

Government as open source software and development in general

Warning: this article gets a little ranty, but please, bear with me and help improve my thoughts by commenting.

Doc Searls of Linux Journal linked recently in his article Is government open source code we can patch? to an article by Britt Blasser entitled “Oh, if only government went in for an open source make-over…”. The article indirectly cites through a reference to Phil Hughes’ own Our Internet article two articles, FCC: Moving Beyond Network Neutrality and Our Internet!, by Bob Frankston, who Doc Searls recently interviewed for Linux Journal in Beyond Telecom (non-free registration required, subscribers can get it free).

In his article, Searls says:

Democracy is by nature “our government”. The open source twist on that we put it together and can hack improvements to it. Think of elected officials as committers and maintainers and you start go get the idea.

The analogy isn’t perfect, because by nature open source code is purely practical: it has to work. While government often does not. All government is buggy. In the worst cases it crashes outright and is replaced or supplemented by corrupt alternatives.

This analogy is fairly strong. However, commenter Frymaster supplies an addendum which strengthens it:

The US Constitution itself is open source, if you will, and editable. “The Framers” intended that Americans would change it to meet changing times, hence the series of amendments covering key rights like voting, and, most importantly, consuming alcohol. But they set the bar high, requiring super-majorities in both houses of Congress PLUS each of the states.

The Constitution certainly is open source. We’re free to change it, and other countries, fledgling or long-established, are welcome to take our code—our elemental specification of government—and adapt, implement, and utilize it. We’d like to receive contributions back, because they might be worthwhile enough to include in the trunk code. Even if these modifications aren’t strong enough for trunk, they might be strong enough for that government to maintain as a branch.

The Constitution is inherently good. Some might argue that it is outdated, but these folks are in error and their sentiments should be dismissed if they believe that it is irrelevant and should not be followed. The Constitution establishes a rule of law, wherein all citizens of the land give rights to a union of states, called the United States of America. It establishes procedures for updating it through amendments, which require a majority vote not only by two small bodies of people, but a majority vote of the several states, as Frymaster reminds us. This amendment process keeps those two smaller bodies of 535 people from legislating away the rights of their constituents.

I digress.

A government can never truly be open source, at least realistically. There will always be secrets; unpublished code, per say. These secrets are matters of national defense: military operations during a time of declared war, location of the president and vice president so the two are rarely together (for obvious reasons).

However, most of the goings-on of the government should be open. Obama pushes for “open government.” Ron Paul pushes for less government and, presumably, open government, since there would be far less government to hide!

However, open source projects thrive on the involvement of the people. Our current election system does not encourage responsible voting. Take, for example, Pennsylvania’s primary election results. 90,836 PA Republicans voted for Mike Huckabee, who dropped out of the race March 4, 49 days prior to the election. This is like allowing all of the Linux users in PA, regardless of technical knowledge, vote on the addition of one of three kernel features, and giving them only the name of the feature—no description, background, author, codebase, language, performance evaluation, or source! Even more appropriate would be that the developer of the feature conceded that one of the other two features is more efficient and worthwhile than his own!

I’m not saying that only those in-the-know should be allowed the vote. Mistaking my words for that would be fallacious. I believe that every person deserves the right to vote. I believe that every person has the right to have evidence of their vote. I believe that every person has the right to request vote totals for every level of complexity in the elections system: precinct, county, congressional district, state, and federal.

As versatile and open as the Constitution may be—and yes, I believe that it may need some updating to reinforce personal liberty and states’ rights—the government and governance which exists now cannot be patched.

When working on a project, a developer comes to a point where he or she realizes that there is a major defect in the software. He or she (for sake of my fingers, I’m going to use he henceforth, pardon my faux pas) has two options: patch or rewrite. He knows there are serious bugs, bugs which are inherent in the design of the code, as it has been patched since it was written. These most of these patches were good things, but some introduced more bugs which have yet to be fixed.

Should the developer continue to patch the code? Or should he rewrite it, integrating the features of the old version with more manageable code and lessons learned since it was first written?

If he continues to patch it, he treats the problem, but may not actually fix the problem. The problem might be inherent, or the problem may be caused by a combination of other features.

If he rewrites it, he’ll spend a lot of time redoing work he’s already done, but the result will be a more efficient program with fewer bugs (hopefully) and more manageable, cohesive code base. Of course, this new version will have its bugs, too, but they may be easier to find if the code is more manageable.

What the United States needs is a rewrite. The foundations of our government are solid: the Constitution, capitalism and free market economy, liberty for all. These are like the basic functions that make a program tick, “the algorithm,” per say. There are other parts that work, too. However, the maintainers of our government have diverted our attention from the core of the government, preferring us to view the only the parts it wants us to see, i.e. the bling.

The founders—the original authors of the U.S. base code—have long since gone, and they would be disgusted by the mess that is the program and its code base—the federal government—today. Things aren’t going they way that they would have wanted, and there’s a growing part of the population which seeks to return the these ideas, to a set of ideas not much different in theory from the software philosophy of “do one thing and do it well.” The government is bloated, more bloated than any application to which I might possibly compare it.

The founders outlined in the Constitution—a white paper or base algorithm, if you prefer to keep up the programming analogies—the specific functions of the U.S. government. It outlined a process by which the white paper or algorithm itself could be changed to allow more functions or remove functions which endangered the users and their data. However, rather than use this process, the maintainers simply implement functions or remove functions without regard to the users’ opinions, data, or the fact that the users are supporting the maintainers financially.

A fork is nearly impossible. There is no more undiscovered land on the face of the Earth, and it would be difficult for a state to secede. It would be economically infeasible, as well as diplomatically infeasible. The citizens of the new country would have their rights and their government as the Constitution of the U.S.—and of their new country—defines, but they would not have the resources to be self-sufficient, and things imported would cost more.

Fortunately, our government is not setup like the Linux kernel maintenance group in that The President of the United States is not a benevolent dictator (at least not on paper, haha). There are, however, 50 branches of the U.S. kernel which all have their own quirks and maintainers. Like a few projects, perhaps the Debian project included, the U.S. government does have representatives, people who supposedly represent their constituents in the decision-making process having been chosen by those constituents.

The ears of the maintainer are closed. He doesn’t want hear from the users; the people. However, the representatives’ ears are open, and they must be, by definition. In order to change the course of the program; the United States, we, as users; citizens, must elect representatives who believe as we do and not settle for anyone lesser. These representatives will then make the decisions we would make if we were in their position, leading to a program which is more useful, usable, smaller, and most of all, open.

HOWTO Add btnx repository to sources

Olli Salonen made a PPA on Launchpad yesterday, following my request for btnx in a PPA.

There are two ways to get the repository configured: the GUI way and the command line way. I think the command line way is a little quicker, but I’ll give you both. Remember, if you are not running Hardy, you will need to change all instances of hardy throughout these instructions to feisty or gutsy, whichever you are using. Olli did packages for all three versions. If you don’t know which you’re running, go to System > About Ubuntu and read the window that spawns. Your version will be in there somewhere.

First the command line way.

echo -e "deb http://ppa.launchpad.net/daou/ubuntu hardy main\ndeb-src http://ppa.launchpad.net/daou/ubuntu hardy main" | sudo tee /etc/apt/sources.list.d/btnx.list
sudo apt-get update && sudo apt-get install btnx btnx-config

Then, I’d recommend using btnx-config from Applications > System Tools > btnx to configure the tool. You could also do gksu btnx-config at the command line to bring it up.

Next, the GUI way.

If you already have btnx installed, go to System > Administration > Software Sources. Go to the Third Party Software tab. Click +Add and paste the line for each of the two APT lines: deb http://ppa.launchpad.net/daou/ubuntu hardy main and deb-src http://ppa.launchpad.net/daou/ubuntu hardy main. When you click Close, it will ask if you want to reload the sources. Confirm the reload.

If you do not already have btnx installed, go to System > Administration > Synaptic Package Manager. Go to Settings > Repositories and follow the above instructions. One the list finishes reloading, Search for “btnx” and the two packages will be shown in the main screen. Click each to mark it for installation, then click Apply. When it’s finished, you can access btnx-config through Applications > System Tools > btnx from the top panel.

Check out my prior updates on btnx for more information, including how to compile btnx and btnx-config from source.

HOWTO Install btnx for better mouse control in Ubuntu Hardy

When I installed Hardy, I forgot to copy my awesome xorg.conf which held the configuration to enable all 12 buttons of my Logitech MX1000.

Lo and behold, a new method of configuring it has come about, albeit it was around prior to Gutsy.

btnx is the work of Olli Salonen. The program runs as a daemon, catching mouse events and turning them into either key presses or proper mouse events which the system can interpret. This eases the configuration one must do in order to enjoy the full potential of the high-end Logitech mice—a potential which, in my opinion, Windows cannot reach.

The installation process for btnx is pretty easy.

First, I replaced the mouse section of my /etc/X11/xorg.conf with this section. This may not be necessary, but I did it before discovering btnx.

Section "InputDevice"
        Identifier      "Logitech MX1000"
        Driver          "evdev"
        Option          "Name"          "Logitech USB RECEIVER"
        Option          "HWHEELRelativeAxisButtons" "7 6"
EndSection

Next, open a terminal and cd to the location where you keep your sources. I keep mine in ~/Source. This next section prepares the libraries required to build btnx and its support program, btnx-config, as well as subversion if you don’t already have it installed. I prefer to use subversion and checkout tags if they are available. It makes switching to a new version just a svn sw away. Last, it checks out the source for the two programs.

sudo apt-get install subversion libgtk2.0-dev libglade2-dev libdaemon-dev
svn co http://svn.ollisalonen.com/btnx/tags/btnx-0.4.9/
svn co http://svn.ollisalonen.com/btnx-config/tags/btnx-config-0.4.8/

Next, do a simple cm&smi for each program.

cd btnx-0.4.9
./configure && make && sudo make install
cd ../btnx-config-0.4.8
./configure && make && sudo make install

Now that both programs are installed, you must first configure btnx using btnx-config. Start it as root using the command below or go to Applications > System Tools > btnx. Click “Detect Mouse and Buttons”. You’ll probably be able to figure it out from there.

gksu btnx-config

I have the middle thumb button on my MX1000 configured to activate the Rotate Cube plugin of Compiz. I have it configured as Button10 in Compiz and BUTTON_9 in btnx. Remeber: Compiz and many other programs start counting buttons at 1, but btnx starts at 0.

Update: There is a post on Ubuntu Forums about building btnx, too.

Update 2008-04-29 01:18: I’ve posted an update. New versions of btnx and btnx-config are available and so are debs for both 32-bit and 64-bit Ubuntu.

Update 2008-11-05 20:56: As Christopher pointed out, Btnx is useless in Intrepid. Olli, the author of btnx, remarks that the way btnx interacted with the kernel is no longer available, so all development on btnx has ceased. However, he says, evdev is able to recognize all of the buttons on the Logitech MX Revolution. Folks who might be willing to decode the cryptic xevents system and figure out how to assign mouse events to other keypresses and such should contact him.

HOWTO Write a script to update Twitter from Linux

I just signed up for Twitter as colindean. I don’t know what use I’ll have for it, as I’m not one who is much for microblogging or partying.

Anyway, the API caught my eye, and after having read Wayne’s post at Fsckin w/ Linux regarding Twitter clients for Linux, I decided to roll my own rather than use what’s out there. I wanted something simple and bashful.


#!/bin/bash
EMAIL=youremail@yourdomain.com
PASSWORD=yourpassword

WHAT="What are you doing? "
SORRY="Sorry, that was too long."
UPDATED="Tweet submitted:"

function getinput {
  if [ ${TERM} = "xterm" ]; then echo -n "${WHAT}"; read TWEET
    else TWEET=$(zenity --entry --text="${WHAT}" --entry-text="${1}")
  fi
}

function check_length {
  TWEETLENGTH=$(echo -n "${TWEET}" | wc -m)
  if [ ${TWEETLENGTH} -gt 140 ]; then
    warn_user
    getinput ${TWEET}
    check_length
  fi
}

function warn_user {
  if [ ${TERM} = "xterm" ]; then echo "${SORRY}"
    else zenity --warning --text="${SORRY}"
  fi
}
function submit_tweet {
  curl -u ${EMAIL}:${PASSWORD} \
       -d status="${TWEET}" \
       http://twitter.com/statuses/update.xml \
  > /dev/null
}

TWEET=$@ #see if it was supplied on the command line
if [ -z "${TWEET}" ]; then getinput; fi #if it wasn't, prompt for it
check_length #make sure it's less than 140 characters
submit_tweet #submit it since we got past the check

if [ ${TERM} = "xterm" ]; then echo "${UPDATED} ${TWEET}"
  else
    exec 3> >(zenity --notification --listen --window-icon=/usr/share/pixmaps/gnome-irc.png)
    echo "message: ${UPDATED}\n\n${TWEET}" >&3
    sleep 10
    exec 3>&-
fi

Just replace the EMAIL and PASSWORD variables and drop it into a directory in your $PATH. You can add it to the panel, too—it will detect if it’s been executed at a terminal or from the panel or other GUI element. It could also very easily be internationalized.

Let me know what you think of this script—it’s 4:00 am and I’m about to pass out.

Sorry, that one line might overflow the box on slim resolutions. I’ll get that fixed one of these days. Update: That was an easy fix. Added overflow: auto; to the codeblock CSS.

HOWTO Run a game or other program on another display

For some reason probably related to Compiz-Fusion, I could not get Warsow working just now. When I started it, my mouse would be locked in the center of the screen. I had four virtual desktops going within Compiz, so I figured that it was somewhat related.

Rather than figure out the bug or close everything I had open, I decided to simply start another X server to handle Warsow.

I did this with startx ./warsow -- :1. I had to modify /etc/X11/Xwrapper.config and change where it says “console” to “anyone” before it would work, though.

This can be done for any program or game, but it’s best suited for those that occupy the whole screen.

In order to switch back to the regular desktop, hit CTRL+ALT+F7. To go back to your game, hit CTRL+ALT+F8. This is useful for switching between a game and work when it’s not your turn or you’re waiting for a long respawn. In fact, I wrote this post switching between Firefox on :0 (F7) and Warsow on :1 (F8).

Oh how I love the things I can do on Ubuntu that I could never do on Windows.

HOWTO Encode a video for an LG VX-8300 phone using FFmpeg

This script might work for other phones, as well. I only have access to an LG VX-8300. Presumably, this would work on all phones newer than it.

#!/bin/bash
echo "Encoding ${1}..."
ffmpeg -i "${1}" -acodec aac -ab 64K -ac 1 -ar 22050 \
                 -vcodec mpeg4 -s qcif -r 15 \
                 "${1}.3gp"

This works perfectly for me, reducing certain YouTube videos to something portable ;-)