Disclaimer: I am not an investment advisor. When I describe my own trading activities, it is not intended as advice or solicitation of any kind.

19 December 2011

How To Save A Dog's Life In Chicago

On Wednesday, a stray Rottweiler showed up in our alley. Since my wife was working at home, she got involved in trying to make sure its story had a happy ending. This is a synopsis of what we went through trying to do right by this dog, and all the confusion, misinformation, and apathy we encountered along the way. Ironically, the only way to ensure the dog's life would be saved was to get it to the one place we were certain was a death sentence: Chicago's Animal Control Center.

If you find a cooperative lost pet dog in Chicago, do the following:

  1. Take it to your local vet and see if it has a chip. This might give you a fast track back to the owner, who will love you forever.
  2. Call 311 and request Animal Control to come collect it; if they come, make sure to tell them it's a stray, not yours.
  3. If they don't come, take the dog to your local police district and make them take the dog. They will try not to take it, because they don't want to have to care for the dog - too bad, it's their job.
  4. Contact the appropriate rescue agency and let them know that the dog is entering the system over the next 12-24 hours. They will watch out for it and make sure to collect it the day the dog's ownership reverts back to the city.

This is Bob

This is Bob's story.

My wife and two other neighbors managed to trap the poor scared Rottie in a fenced yard, but the owner of that yard was very uncomfortable with his presence. She has no experience with dogs, and undoubtedly felt threatened by the "vicious killer breed" prowling around back there waiting for an opportunity to tear out her throat. She called 311, the Chicago non-emergency response number, and requested that Animal Control come collect the dog. She was unconcerned with what happened after that, of course, but in any case that is standard city procedure for any stray animal, so I can't really fault her. Animal Control rolled by the front of the house and didn't see the dog (he was in the back yard), and left. Further calls to 311 revealed that they may not be back for days. The yard owner called my wife, pleading to have the dog removed from her yard, saying, "I feel like a prisoner in my own house."

You seem nice. Can I live here?
My wife discovered that approaching with a Milk Bone and a leash was a good way to make a lifelong friend, and had no trouble getting the dog into our own yard. Then began a couple of hours of neighbor discussions and trying to find out if anyone who had a Rottweiler might be missing one. No luck, so she put an ad on Craigslist in case the owner looked there. The dog was proving to be very friendly and easy to manage, so she decided to walk him up to a local vet, Mayfair Animal Clinic, to have him scanned to see if he had a tracking chip and to get some advice. There was no chip, they discovered, but they gave her what seemed like obvious advice: Don't take this dog to Animal Control whatever you do - they'll kill him for sure.


Now, bear in mind, this dog was not the stereotypical stray. For one thing, he was in great shape, maybe even slightly overweight. For another, he smelled like pet shampoo - that's not the aroma one associates with strays or abused killing machines. Finally, he would get really excited whenever he saw a leash, meaning he knew how incredibly awesome it is to go walkabout with a human. He immediately took to me, giving me kisses whenever he was able to sneak past my defenses. For lack of a better name, we started calling him Bob. He didn't really answer to it, but it beat "hey you!"

Mmm. Water.
It was warm that evening, so we set him up with a bed in the garage, and reviewed our options. We have friends who work with Recycled Rotts, a greater Chicagoland rescue agency, and we figured that unless we could find the original owner, they were the best option. Failing that, we knew about one other rescue agency (THORR), and then PAWS or even the Anti-Cruelty Society were distant final choices. Beyond that we weren't even willing to contemplate; my wife put it succinctly: No one is killing this dog. So with this priority list in mind, we called our friend "Cindy" and asked her to use her contacts to get us in touch with the right people at Recycled Rotts (all personal names are changed here in case their owners don't want their privacy violated). We also called THORR and left a message, and my wife filled out a found-dog profile at the Illinois Lost Dogs facebook page. I also sent a description and pictures to Cindy's husband "John" so he could make sure they got passed along. It was getting on in the evening, so we weren't that surprised that no one called back.

The next day, still no calls back by 10am, so she called PAWS and left a message. After still no response by anyone by noon, she decided to call 311 again and ask what to do. Note that 311 did not tell her to take the dog to Animal Control; instead, they said to call the local police district and fill out a report, since the owner might go there looking for his dog. She did, and the police took her report without telling her one very important piece of information: every police district in Chicago has the facility to safely and securely store stray dogs while Animal Control is called to come get them. That little gem would have saved us a trip the length of the city later.

By mid-afternoon, we were both getting pretty desperate to find a safe place for this dog. The good luck with the weather the previous night wasn't going to hold: the temperature was dropping fast, and was supposed to fall well under freezing overnight. We discussed taking the dog in, but he wasn't very well-trained, and we have two (spayed) females: a greyhound and a beagle. That pair would be a recipe for trouble for a fully-loaded 100lb male Rottweiler. I got in touch with John again, and started pushing him hard. He and Cindy have taken Rottweiler fosters from Recycled Rotts in the past, and I was hoping I could get him to offer to take Bob from us; he wasn't willing to cave to that, but he did agree to pull some strings and get the president of RR to call us, "whatever it takes." Just like us, he thought the only way to guarantee this dog's safety was by getting it directly from our hands to Recycled Rotts' hands.

"Cathy" from Recycled Rotts did eventually call my wife, extremely annoyed that she had to interact with us at all. My wife is a saint, and if she describes someone as "snippy" on the phone, you can bet they were snippy and then some. She asked for help, saying that we were desperate to get this dog somewhere safe and warm for the night. After brow-beating her for a while, Cathy eventually gave my wife a piece of information that would have saved everyone a great deal of trouble at the beginning: For legal reasons, rescue agencies cannot take stray dogs directly from the people who find them. The dogs must go through the City of Chicago (Animal Control) first, so that ownership of the dog reverts to the City; only then can a rescue agency claim the dog and get it into its foster program.

Heck, it makes sense when you hear it snapped at you over the phone, but it sure would be nice if a single one of the agencies' websites would have that information on them. Or if 311 would have told us one of the times we called. Or if the local vet would have known and not told us to do the opposite thing. Or if one of the three different agencies we left messages at could have picked up the phone and gotten back to us to tell us this. Or if the police would have told us that, or told us to bring the dog by. But no, we had to manipulate friends and maybe damage their relationship with their rescue agency. THORR has never yet returned our call. I suspect RR wouldn't have either, without John's intervention.

I begin to see why people tie stray dogs to the door of the local doggy daycare place.

Oh boy, a car ride!
The story gets happier from here on. That evening after traffic died down, we started attempting to get Bob into the Ford Escape so we could take him to Animal Control. He made it very clear he wasn't jumping in on his own, and Bob is 100 pounds (guesstimate) of solid Rottie. He thought I was pretty cool, but he was NOT OK with me trying to grab him and lift him into the truck. Finally, I ended up reinforcing a huge piece of plywood and turning it into a ramp. A Milk Bone later, Bob was making happy slurping noises in the back of the Escape.

Bob drools a lot, and he really really wants to ride in the front seat. It was an interesting trip.

I am ashamed to admit that I was expecting a clinical bureaucratic death camp filled with jaded hateful people, but Animal Control was a wonderful surprise. They treated us with respect, they treated Bob as well as any vet would, and they explained how the system worked and reassured us that there was almost no chance that Bob would be destroyed. They could immediately tell that he was a happy-go-lucky 100-lb idiot, not a threat to society; and as long as that assessment didn't change over the next 5 days, it was a virtual certainty that he would get scooped up into the rescue system just like we wanted. Recycled Rotts and other agencies tour the Animal Control Center on a daily basis, it turns out, looking for candidates. If they see a dog like Bob who fits the bill, they will either make a note of him and his release date or ask ACC to put a note on his cage to call them when he comes up for grabs.

So Bob is in jail for the time being, but we're confident that his life is about to get much better.

What could be done to make this process easier on people who want to do the right thing and want to make sure a sweet dog like Bob has a fighting chance at survival? I have a few suggestions:

  1. PAWS, Anti-Cruelty Society, THORR, and RR all have websites primarily designed to get people to take a dog. I understand that: they have more dogs than people to take them. But they, like us, are in this to save the lives, right? A simple How-To page on their website telling people what to do (and why) when they find a stray would go a long way.
  2. The Chicago Animal Control website talks about how many strays they take a year, and gives hours for dropping strays off, but doesn't explain how the system works. Every pet owner knows that Animal Control is a kill-shelter, so we assume it isn't safe to take someone's pet there.
  3. Every agency I called has a long outgoing answering machine message designed to discourage voicemail. It gives various tidbits of information so that most people will get their answer from the message and hang up. Add, "if you find a stray dog, we can't take it; take it to Animal Control instead." Is that so hard?
  4. It would be nice if the cops had been a little more service-oriented. Instead of, "yeah sure we'll take your report and file it under 'hopeless'," it would have been much better if the officer on the phone had said something like, "oh, you found a stray dog? if you can transport it here, we can get it into the right hands for you." Or even, "we'll send a car over to pick it up." Yeah, I know: fantasy.
  5. The Animal Control responder shouldn't have rolled by the house and left. If given an address and told the animal is confined, ring the damn doorbell.
  6. When vets in Chicago give out incorrect information, they cause a lot of harm. Mayfair Clinic was trying to help, but in the end they hurt the process. It doesn't seem unreasonable to expect a vet in Chicago to know how the stray dog system in Chicago works.
I hope someone in our situation, searching the web for clues like we did, might stumble upon this blog post. If they only get as far as the "what to do" section at the top, then I have served my purpose. If anyone reads the story and gets a few chuckles picturing Bob's antics in the car, even better. And if the real message reaches even one person with the power to achieve one of the items on the list above, then I will be truly satisfied.

Good luck, Bob. I hope you find a wonderful home.

04 December 2011

Happy 1985

It is 1985 in the Year-a-Month project, and I'm pretty late this month: I blame Skyrim. As with previous months, I dropped Pantera due to high-priced glam-rock transgressions. Just as well - I didn't need any more disappointments this month. The surprise from Megadeth made it all worth it, though - I had no idea how hard they rocked in 1985. Everyone else... well, maybe 1986 will be better.

Accept: Metal Heart - This album by Accept alternately reminded me of AC/DC and the Scorpions. That is not entirely a good thing, as both bands can really get on my nerves. I hope this is just a phase they're going through.
Anthrax: Spreading the Disease - I bought Persistance of Time back when it was newly released, and liked it well enough. But many of the songs felt too similar to each other and ultimately it fell off of my frequent play list. I'm sorry to say that this album is destined for the same fate, and for the same reasons. I listened to it while doing some work at the computer at home, and when it finished I realized I had no idea which song was which.

Dio: Sacred Heart - This Dio album is a little softer than the first two, and frankly reminds me more of Ritchie Blackmore's Rainbow than Holy Diver. It was also Dio's last album to go gold until Dio's 2009 greatest hits album. I hope this doesn't mean the quality is destined to suffer in the years (months) to come.
Megadeth: Killing is my Business ... and Business is Good - Dave Mustaine started Megadeth after getting fired from Metallica in 1983, immediately before their first album, Kill 'Em All, came out. He wrote the lead guitar leads that Kirk Hammett played on that album, and left very pissed off and bitter about it. If it was a pissed-off Mustaine that masterminded this first album by Megadeth, then I for one think we ought to twist his nipples on an annual basis. This album beats the hell out of Kill 'Em All, and that's not something I ever thought I would say. In an otherwise mostly disappointing month, it's nice to have Megadeth.

Overkill: Feel the Fire - I threw Overkill into this list on a whim, based on enjoying their latest album, Ironbound. This first offering is certainly more primitive, but I can hear the beginnings of the sound that I'm familiar with from Ironbound. I wouldn't say it was a groundbreaking album, but I have to admit my head did some banging anyway.
ZZ Top: Afterburner - this album could also be titled Generator, as in cash. This sad excuse for an album is nothing more than an attempt by ZZ Top to cash in further on the success of its previous album. I kept finding myself reaching for the "Next" button on the MP3 player on this one.



Now if you'll excuse me, I have some Megadeth to listen to again.

21 November 2011

Applications: PasswordSafe

See Time For a Change for the first in this series, or check out the index to see all the posts dealing with Arch Linux. Today I will set up PasswordSafe, an open source password manager. But first some information about this excellent program.

There are a number of password managers out there with various features that they hope will differentiate them from the others. PasswordSafe is one of the oldest and simplest ones available. All good password management programs should have a few key features:
  • Really strong, proven crypto - all your sensitive passwords are going in this thing; if you can't trust it to keep them safe, don't use it.
  • Offline database storage - I don't trust another company to store my passwords; I want to know that the file is encrypted well, and I want it on my hard drive. My hard drives are backed up, and they won't get bought up by Oracle or go out of business with my data.
  • Configurable random password generation - with a good password manager, you should only need to remember one more password for the rest of your life. That means the rest of them can be completely random, which is way stronger than "Tr0ub4dor&3".
  • Copy/paste password use - you shouldn't have to type passwords stored in the database; just copy/paste them into the password entry field. This is more convenient and more secure, since it defeats a keylogger.
  • Paranoid clipboard management - the system-wide clipboard is accessible by any program running, including malware. A good password manager will give you options on how aggressively it will clear the clipboard of your sensitive password.
There are many other nice-to-have features, like the ability to run on a USB key, good organization capabilities so you can find things quickly, username/password auto-type, and a software keyboard for accessing the database in case you fear a keylogger might be installed.

PasswordSafe, as you might expect from my preferred application, has all these features and more. Being open-source, it has verifiably strong crypto: anyone can peruse the code and do their best to crack it. It's OK if you're not skilled in crypto-cracking... it's enough to know that other very talented individuals have leveled their weapons at it for many years and its strength is proven. It stores everything in a single data file (encrypted, obviously), which you can put anywhere you want. It treats it like a document, so you can have multiple password databases if you want. Being a simple file, you can back it up, copy it around, synchronize it with Dropbox, whatever your desire and comfort level dictates. Double-click entries to copy the password into your clipboard, which is cleared a configurable time later.

Password generation can be configured application-wide or by individual entry, in case a particular site has unusual requirements; or you can type in an existing password, too. One little trick I like to do is to put my credit card numbers in as passwords and include the expiration date in the username, which is displayed in the list. This lets me copy/paste my credit card # into an online store checkout page without fat-fingering it.

Important note: the PasswordSafe I know and trust is at http://passwordsafe.sourceforge.net/ - there is also a "passwordsafe.com" website that purports to have a password manager called "HyperPassword". I have no idea if this is a good program or not. If you want to use what I know and trust, use the SourceForge link. It's not that I mistrust this other one, per se, but PasswordSafe is well-proven, has an excellent pedigree, and doesn't go off and buy a domain name that might sow confusion. That's a tactic used by malware (PDF, see page 6).

For the longest time, PasswordSafe was developed only for Windows. Being open-source, eventually some Linux developers got involved and ported it to WxWidgets, a cross-platform GUI library. Open-source projects like this typically provide binaries for Windows, since Windows doesn't come with build tools. Then if it supports Linux, there is always a source-based distribution so that users can build it for their Linux distro of choice. Eventually, there may also be binary distributions for various popular distros, Ubuntu usually being the first. PasswordSafe has just barely reached this final stage. Linux support has been marked "beta", probably forever, and the only binaries for Linux are for 32-bit Ubuntu/Debian.

Now, I could just run PasswordSafe's Windows version under Wine on any Linux distro I choose. Doing so is easy: just download the Windows installer and run it - Wine takes over and goes through all the installer steps. But that's cheating! This application is open-source, and it runs fine on 32-bit Ubuntu. Making it run on 64-bit Arch might be a challenge, but it's possible.

Full disclosure: A few months ago I managed to make it work on 32-bit Arch for other reasons. I had to change code to do it, which I posted to the PasswordSafe bug-tracking forum; they responded and told me my changes had been incorporated into the next release, which is now out. But whether that will translate into an easier 64-bit experience is anyone's guess. There is no package for PasswordSafe in the AUR, either, so I'm really on my own for this one.

I will be skipping some the mundane steps in this install, since I expect a more complicated journey. After downloading and extracting the source archive, I perused the Linux installation instructions, which only provide instructions for installing the Ubuntu/Debian binaries, and the Linux Development ReadMe, which was last updated in November 2010. Yeah, on my own here. Most Linux source archives follow the "configure ; make" paradigm, but that didn't work in this case because no one built a configure script. So I tried just "make release", based on experiences with the 32-bit installation, first installing the Xerces-C XML parsing library and the wxWidgets GTK library as per the year-old ReadMe. Wonder of wonders, it built the first time! They must have gotten my changes applied successfully.

Unlike more polished Makefiles, this one leaves the binary buried under the src/ui/wxWidgets/GCCUnicodeRelease subdirectory. I went ahead and ran pwsafe from this directory, and after an error message about help not being available, the application started right up and waited for me to use it. This is a success already, but I would prefer not to see an error message on every startup.

Not being an installer, "make" doesn't put the in-application help repository anywhere helpful. The expected location for that file is hard-coded to be /usr/share/doc/passwordsafe/help/help.zip. But there didn't appear to be a help.zip file anywhere in the source tree after building. Looking through the Makefile.linux file at the top level, it looked like there was no build action for "help", unlike with Windows. So I did it by hand based on what I found in the Makefile.windows by typing "make -C ./help", which built help.zip, as well as several other languages (helpES.zip, helpFR.zip, etc). Then as root I copied help.zip to its expected location and tried again to run pwsafe. Sure enough, no error message, and clicking the Help button brought up the help window.

I don't really use the on-screen keyboard, because I don't fear a keylogger on my home system. But for completeness I gave it a try, and saw an error message in my console window: execvp(xvkbd) failed. It turns out that xvkbd is a package that wasn't listed in the Linux Developer ReadMe, so I installed that via pacman and tried again. Success!

Now that all the pre-authentication stuff is working, it's time to move on to the meat of the application. Unwilling to potentially corrupt my password database, I opted to create a new one. That way I can also put in fake credentials and be unafraid of posting screenshots. I went ahead and added several groups and passwords without incident, using both generated and hand-entered passwords.


Double-clicking an entry did successfully load the password into the paste buffer. However, when I tried the Auto-Type feature, which is supposed to take the selected username and password and paste them into the active window, separated by a TAB, I got some interesting results. I performed Auto-Type into a text editor so I could view the results directly. The screenshot below is the fully-exposed details for my "Tenth-Sixth Checking" account (click to zoom in).


When I use Auto-Type, however, I get: "Ipa.gif;>gpd" (tab) "hs,l<gkjHadhoa". Now, Auto-Type is not a feature I really use, so this is really just an amusing bug, but the interesting thing is that this apparent nonsense string of characters is exactly what I would get if I was typing in QWERTY on my Dvorak keyboard. That must mean that: (a) PasswordSafe is sending fake keypresses, not letters, when it does an Auto-Type; and (b) it pays no attention to the keyboard layout settings, even though I set them at both the operating system and XWindows levels. Sure enough, I found a bug report from a German keyboard user with a similar issue, and the devs had already responded saying it was probably a bug having to do with hard-coded keyboard layouts. I added my own experience to the comment tree in case it helped them figure it out. Since I don't really use Auto-Type, as I noted above, this doesn't slow me down.

One last issue that I won't try to solve because it doesn't really matter is the system tray icon. PasswordSafe tries to give some visual feedback so the user knows whether the safe is "open" (accessible) or "closed" (requires a password to access). In Windows, these two icons look fine, but on my Arch/KDE system, they look like they have some erasing issues. The slightly magnified compound picture below from left to right is Windows Open, Windows Closed, Linux Open, Linux Closed. Again, not a show-stopper, just a little strange. By the way, my Linux taskbar is a little bigger than on my Windows machine, so the size difference is to be expected.


Even the Windows icons, seen magnified, look pretty bad. Seems like a nice vector image in the form of an SVG would be a good idea... but I suspect that wouldn't work on Windows.

The final acid test was to open my real database (after backing it up of course), make some changes, and then attempt to use it again from my host machine. No problems whatsoever! 

Overall, this went far more smoothly than I expected. Having dealt with the compile issues previously and waited long enough for the devs to get the updated release out there definitely helped.

The only thing left is Bacula for backups. I have been putting that off because it is such a pain to set up, and because I will need to redo the VirtualBox networking in order to test it completely.

Next: Bacula
Or check out the index.

10 November 2011

Yaourt and NixNote

See Time For a Change for the first in this series, or check out the index to see all the posts dealing with Arch Linux. Today I will set up yaourt, which makes working with the Arch User Repository (AUR) much easier, and then use it to get NixNote installed.

Yaourt stands for "Yet AnOther User Repository Tool", which is a terrible name, but it is very effective at its job. It makes the AUR significantly easier to work with, by giving a pacman-like interface that does everything pacman does, but adds the AUR as a source. This makes installing packages from the AUR as simple as installing packages from the core repository... usually.

Having fought with and failed to get NixNote installed by hand, I turned in frustration to yaourt, and was pleasantly surprised at how easy it was to use. I still don't trust it entirely, because I can't find much in the way of documentation about it, and there seems to be some contradictory information about whether it is safe to use it for non-AUR packages or not. But I suspect like any labor-saving tool, my comfort with it will come long before my understanding.

I installed yaourt in a very similar manner to my installation of libgcal and akonadi-googledata before. It relies on the package-query package in AUR, which therefore needs to be installed first. The following steps can also be found at yaourt's website:

$ cd ~/abs
$ wget http://aur.archlinux.org/packages/package-query/package-query.tar.gz
$ wget http://aur.archlinux.org/packages/yaourt/yaourt.tar.gz
$ tar xf package-query.tar.gz
$ tar xf yaourt.tar.gz
$ cd package-query
$ makepkg -si
$ cd ../yaourt
$ makepkg -si

Next is to install NixNote. In theory, all I should need to do is:

$ yaourt nixnote

And in theory, there is no difference between theory and practice. But in practice, there is (Yogi, or Al, or Jan). And so it is in this case. After a bunch of package downloading, configuring, and compiling -- all done by yaourt -- I finally get this error:

/usr/bin/ld: /caviar/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../lib/libm.a(k_standard.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC

/caviar/usr/bin/../lib/gcc/x86_64-unknown-linux-gnu/4.6.2/../../../../lib/libm.a: could not read symbols: Bad value

collect2: ld returned 1 exit status
make[1]: *** [libpng12.la] Error 1
make[1]: Leaving directory `/tmp/yaourt-tmp-mark/aur-libpng12/src/libpng-1.2.46'
make: *** [all] Error 2


Let's break this down, shall we?
  • /usr/bin/ld - this is the linker reporting the error, which means that all the code has compiled just fine, and now the build system is trying to assemble it into an executable binary file.
  • .../lib/libm.a(k_standard.o) - the failure occurred while linking the static library "libm.a" into the executable, specifically some reference inside the program module k_standard.c, it doesn't really matter what.
  • relocation R_X86_64_32s against `.rodata' can't be used when making a shared object - I'm not really sure what is going on here, but I suspect it has something to do with some of the weirdnesses of working with 64-bit addressing within libraries that were written assuming a 32-bit world. This sort of thing happens far more often than it should.
  • recompile with -fPIC - advice from the linker on how to solve this issue, I love it.
  • .../lib/libm.a: could not read symbols: Bad value - probably caused by the previous error. Once something goes wrong in a build process, its effect usually cascades forward a ways before the build system stops.
  • make...libpng12.la - we weren't even working on building NixNote, here, but libpng12, one of its dependencies. libpng is a library for manipulating PNG graphics, and the repository version of this library is at 1.4. NixNote is woefully out of date, though, and won't work with anything newer than the old 1.2 version of libpng, and this is that outdated library.

The -fPIC flag to the linker is a new one to me. Here's a man page reference, taken from man ld:

-f name  :  When creating an ELF shared object, set the internal DT_AUXILIARY field to the specified name.  This tells the dynamic linker that the symbol table of the shared object should be used as an auxiliary filter on the symbol table of the shared object name.

This doesn't really clear it up much. Some more searching led me to some related content that implied that the "recompile with -fPIC" advice was actually suggesting that I recompile the math library libm, which is an integral part of the operating system (pun intended). This is probably not a great idea, so instead I'll try to disable the use of shared libraries and PIC (Position Independent Code). By the way, if you want more information about all these issues, read this and then explain it to me. ;-) Anyway, I want to adjust the build process of libpng12, which all starts with the same command:

$ yaourt nixnote

Except this time, I'll answer "yes" when it comes to the libpng12 PKGBUILD question. Within this file, I see a section called "build" contains the line:

./configure --prefix=/usr

This is a very standard way to get a Linux source package ready for building and installation, and the best place to make my change. Specifically, I'll change it to:

./configure --prefix=/usr --disable-shared --without-pic

And this time, it sailed right through, building and installing libpng12, and then building and installing NixNote successfully, even adding it to my KDE menu for me and everything. But when I try to run it:

$ nixnote
...
java.lang.UnsatisfiedLinkError: /tmp/QtJambi_mark_amd64_4.5.2_01_gcc-20090628-2055/lib/libQtGui.so.4: libpng12.so.0: cannot open shared object file: No such file or directory

This isn't a big surprise, since I did disable the building of the shared library libpng with that first additional flag. For some reason, it occurred to me to do a file search on my hard drive for libpng12, and lo and behold, there was a libpng12.so.0 sitting in the Dropbox application directory! Yoink...

$ sudo ln -s ~mark/.dropbox-dist/libpng12.so.0 /lib/libpng12.so.0
$ nixnote

Finally, I can enter my Evernote account details, synchronize my notes from their server, and I'm off to the races. It's kind of sad that I had to jump through so many hoops to get this installed when the right answer would be to update NixNote to use the latest (and fully supported) version of libpng. Maybe someday I'll look at how feasible doing that would be, but today I just want my software to work.



Almost there!

  • PasswordSafe for secure password management
  • Moneydance for personal finance DONE!
  • ThinkOrSwim for option trading DONE!
  • Minecraft DONE!
  • Dropbox for cloud storage DONE!
  • Kontact for e-mail, contacts, and calendar DONE!
  • Choqok for micro-blogging (following and posting to Twitter) DONE!
  • NixNote for notes/personal organization DONE!
  • Okteta hex editor DONE!
  • Bacula for automated backups
  • 09 November 2011

    Applications: Kontact

    See Time For a Change for the first in this series, or check out the index for all the posts on Arch Linux. Today I'll finish getting email, calendar, and contacts working, which I started last time by working with the Arch User Repository.

    Kontact, and Some Light Ranting
    Kontact is the Personal Information Manager (PIM) that comes with KDE. If you've ever used the full version of Microsoft Outlook before, you've used a PIM. Kontact is actually one of the reasons I wanted to give KDE a try, because from everything I've read, it is as well-integrated with the operating system as Outlook is in Windows, and has better extensions for synchronizing with information sources like Google. As an Android user, Google integration is a key feature for me - I find it frustrating that keeping contacts and appointments synchronized seems to be so difficult for the big boys (Microsoft and Apple) to handle correctly. I realize this is by design, of course. Outlook has no revenue value to Microsoft without a big Exchange Server license, and Apple wants your eyes on iTunes, not Google services. Too bad. This is my computer, and I'll make it do what I want. And that goes double for my phone.

    Installing Kontact isn't necessary, since it comes with KDE. But getting it to integrate with Google information services takes a little more work. I installed those extra things last time, and now it's time to get them configured.

    Even before I get started, I can hear you thinking, "geez, this is a lot of work, why don't you just use Microsoft Outlook?" And yes, it's a bit of work. But it's worth it to me to have all my contacts, email, and appointments synchronized across my phone and computer without having to run a big wasteful server in my house. Besides, the Exchange Server at your office that provides all these services is just as hard to set up and maintain (maybe harder), and it doesn't even integrate with anything other than Microsoft Exchange! Try this little experiment: call your IT department and tell them that you want all your Google contacts to show up in your address book in Outlook, and insist that you want to be able to edit them within Outlook or on your phone, and have the changes automatically show up in the opposite location. Now, while you deal with a very annoyed IT department, I'll go ahead and set this all up for myself with no dedicated hardware and no capital expense... in a couple of evenings.

    Configuring EMail
    KMail is the email component of Kontact, and configuring it is just like configuring any other IMAP client. I added accounts for each of my main email boxes, setting my login and password for each. I set up an outgoing persona and hooked it up to my primary email box with authentication so that my email provider would forward my mail out to the world for me. And then I selected the inboxes from each of my email accounts as "Favorites" so I wouldn't have to search through all my folders to see what spam I had. KMail is not as easy to use and customize as Thunderbird, but I can get used to it.

    Here's a screen shot, in case you've never seen an email client set up before.



    Configuring Akonadi - Contacts
    Akonadi is the KDE information service, providing contact, calendar, and general file-indexing services to all KDE applications via a unified API. If this sounds complicated and error-prone, then you are very perceptive. I want to set up Akonadi to use my Google contacts and calendar, and I have two calendars I want to access: my personal calendar, and the shared calendar that my wife and I use to track our joint plans. In my previous post, I installed the pieces necessary to make this happen. Now I need to configure them.

    I start by going into the Contacts section of Kontact (anyone else see the naming oddity here?), and deleting the empty local-storage contacts list that Kontact provides by default. Having that will just lead to confusion later. Next, I right-click in the same pane that the contacts list was in, and select "Add Contact List". At this point I'm offered a choice of what kind of contact list to add. Since the installation of akonadi-googledata went smoothly, the first one on the list is "Akonadi Google Contacts Resource".


    Clicking on this asks for my Google email and password, and after supplying that, all my GMail contacts download into the contact manager, as simple as that. Since my Android also uses my Google contacts, any changes I make in Kontact will show up on my phone automatically.

    Configuring Akonadi - Calendars
    Contacts were the easy part - now for the calendars. As with contacts, I start by switching over to the Calendar (not Kalendar, that would be silly) section of Kontact and delete the local calendar defaulted for me. Then I right-click in that now-empty pane and select "Add Calendar", which greets me with a similar Add window as before.


    But this time, instead of selecting the Google Calendar Resource, we want the choice labelled "DAV groupware resource." This is a standards-based interface, and actually works better with Google Calendars than the other, more intuitive choice. But the setup isn't intuitive at all: the next dialog that pops up is a Logon Credentials window, which I have to Cancel to proceed. Yes.

    Next is the configuration window for this new DAV groupware resource, which I'll show after I populate it with some stuff. The initial tasks are to choose a name (I chose "Google" because I'm very creative), and to click the Add button under Server configuration. Each Google calendar I want to see in Kontact is a line under the Server configuration section. I'll start with my personal one:


    The Google instructions for DAV integration say to use the URL "https://www.google.com/calendar/dav/XXXX/events/", where XXXX is replaced by:
    • your gmail address if this is your primary personal calendar, or
    • a special identifier on the calendar settings page if this is a shared calendar
    Once I put in this URL, and my gmail account and password again, I clicked Fetch and the stuff in the bottom list populated. I repeated this process for the shared McHouse calendar, and that resulted in this nice fully-populated DAV configuration window:


    Click OK, and all my appointments download into the Calendar. It's a pretty light week, thankfully.


    There's still a ton of look-and-feel setup to do, but the important part is that it all works and it's all integrated. The little customizations and tweaks can be done as I use the software.

    Just three left!

  • PasswordSafe for secure password management
  • Moneydance for personal finance DONE!
  • ThinkOrSwim for option trading DONE!
  • Minecraft DONE!
  • Dropbox for cloud storage DONE!
  • Kontact for e-mail, contacts, and calendar DONE!
  • Choqok for micro-blogging (following and posting to Twitter) DONE!
  • NixNote for notes/personal organization
  • Okteta hex editor DONE!
  • Bacula for automated backups
  • 02 November 2011

    Happy 1984

    It's 1984 in the Year-a-Month project, and after trimming off the Ted Nugent and Deep Purple albums originally planned for this month, I'm left with the following:

    Anthrax: Fistful of Metal - this is Anthrax's debut album, and has a different line-up than the rest of Anthrax's career, with Neil Turbin on vocals. I actually like Turbin's voice better than Joey Belladonna, his eventual long-term replacement. Most of this album sounds like a clone of Metallica's Kill 'Em All, except for an incongruous and IMHO terrible cover of Alice Cooper's "Eighteen".

    Dio: The Last In Line - A year and a half ago I bought Holy Diver, and I've been waiting patiently for Year-a-Month to catch up with Dio's solo career. The time has finally come, and this album has more of the same power-metal stuff as in Holy Diver. It's nice to hear The Master's voice again.

    Iron Maiden: Powerslave - I saw the album cover for this one, with its departure from the prominent Crypt Keeper-style depiction of Eddie The Head, and I was worried the music might have succumbed to the same Asia-style nonsense as the cover. It didn't. This album rocks along with the same galloping style that I've come to expect from Iron Maiden. And Eddie is actually there as the center pharaoh, if you look closely.

    Judas Priest: Defenders of the Faith - The song Eat Me Alive on this album got Tipper Gore all hot and bothered, and she ranked it #3 on her "Filthy Fifteen". Oh Tipper, you're so cute. This is the only album that Amazon is charging me more to download than to have delivered, so I won't get to hear it for a few days.


    Pantera: Projects in the Jungle - Sadly, this second album suffers from the same problems as last month's Metal Magic. It costs about twice what the other albums do, and it has a reputation of being more glam rock than metal. I didn't pick this one up.

    01 November 2011

    Arch User Repository

    See Time For a Change for the first in this series, or check out the index for all the posts on Arch Linux. Today I'll get the Arch User Repository working, which will let me configure my email, calendar, and contact integration.

    Setting Up the Arch Build System
    I briefly mentioned the Arch User Repository (AUR) during the Moneydance installation, and during that rollercoaster ride I actually used it in a failed attempt to get Moneydance working. Since it didn't pan out, I didn't include that as part of the post. But in order for Kontact to integrate with Google Calendar and Contacts, I will definitely need the AUR.

    The Arch Way stipulates that everything should be kept as simple as possible - not for the user/administrator, but from a software dependency perspective - so only truly globally-useful software should make its way into the supported package repositories. That means that a great deal of very valuable software either doesn't have a wide enough target audience, or is too encumbered by pervasive library dependencies, or simply doesn't have the bullet-proof cross-platform support necessary to let it graduate into the big leagues. There is still a wide market for these packages, however, so the Arch team developed the Arch User Repository to hold the grab bag of all these fringe applications. This may sound a little Wild West - and it is - but consider the alternative that Windows users deal with every day. If you want something for Windows, you go find it online, download it, install it, and hope it works. It is a slightly different process for every application on your computer, which means that all the version management, update management, dependency checking, and distribution is multiplied by the number of applications on your hard drive. What a waste! By providing a central repository for stuff like this, Arch gives us a single place to look to see if anyone else has configured a given application and made it available.

    To use the AUR, I needed to install and configure the Arch Build System. If you're trying to do this yourself, pay close attention to whether I'm giving root (#) or user ($) commands from here on. There are very good reasons not to use root unless absolutely necessary when working with the AUR.

    # pacman -S abs
    # abs
    # abs

    I ran abs twice because the first time after installation it sets up its own internal indexes but fails to download any updates. The second and every subsequent time it updates everything from the Arch Mothership. This is a lengthy process, so I went and made some coffee while I waited.

    Using the AUR
    Now that the ABS is set up, I can use it to get, build, and install the two Google-integration packages I will need in the next post. First, we have libgcal: this is a Google Calendar library that other applications can use to access Calendars. Second, we have akonadi-googledata, which gives Akonadi the ability to communicate with Google Information Servers. Akonadi is the KDE-wide framework that gives access to personal information like email, calendars, and contacts to applications written to use it. Tying everything together, akonadi-googledata uses libgcal to interact with Google Calendars. If this seems complicated and error-prone, then it's because you are a very perceptive reader. Most of my swearing and hair-pulling with KDE is caused by Akonadi.

    There is an easier way to install packages from the AUR than manually using ABS, as I do below. This easier method, called yaourt (which stands for Yet AnOther User Repository Tool), itself must be set up via the ABS. Since the two packages I need for this step are so simple to do manually, there really isn't any reason to install yaourt to get this job done.

    To get started, I made an abs subdirectory under my home directory, and downloaded libgcal and akonadi-googledata from the AUR into that subdirectory, extracting them there as well. The URLs below aren't magic; I just went to the AUR and searched for the packages, and then ran their URLs through bit.ly so they would fit on one line.

    $ mkdir ~/abs ; cd ~/abs 
    $ wget http://bit.ly/sJXtXi # libgcal
    $ wget http://bit.ly/tZyrQz # akonadi-googledata
    $ tar xf libgcal.tar.gz
    $ tar xf akonadi-googledata.tar.gz

    At this point, both packages are ready for building in ABS. Since akonadi-googledata depends on libgcal, I did libgcal first and akonadi-googledata second.

    $ cd libgcal ; makepkg -si libgcal
    $ cd ../akonadi-googledata ; makepkg -si akonadi-googledata

    Makepkg is part of the ABS, and will read all the meta-files in the AUR tarball, downloading, compiling, and installing as necessary. With the -i flag, it creates a package that can be installed with pacman. With the -s flag, it goes ahead and automatically installs with pacman, asking for my password so it can sudo that operation. You should only use the -s flag if you know and trust the package. AUR packages are scripts and software, provided by other users, that you are using super-user privileges to install onto your system. In the unlikely event that there is malware in a package, you are giving it carte blanche on your computer. So be careful!

    The commands above both output a tremendous amount of stuff, most of it very scary to non-developers. But they do their jobs, limiting their interaction with me to "what's your password" and "please confirm you want to do this", and a quick verify afterward yields good results:

    # pacman -Q libgcal akonadi-googledata
    libgcal 0.9.6-1
    akonadi-googledata 1.2.0-1

    Next: Configuring Kontact
    Or check out the Index.

    28 October 2011

    CS|MACO: Out At Last

    The CS|MACO trade has been long SPY since Mid-March, entering back then on excessive bearishness on the part of the survey-responding individual investors of the AAII (Association of American Individual Investors). It finally exited this morning on excessive bullishness from those same investors. Since it's been such a long holding period, a review of the trading methodology might be in order.

    Every week, the AAII solicits a survey from its members about how they feel about the market that week - bullish, bearish, or neutral. Then they publish the percentages of each of those numbers on their website in time for trading on the open on Thursday morning. Long-term analysis has shown that these respondents get more bullish the higher the market goes, regardless of other factors, and they get less bullish the lower the market goes.

    My own back-testing indicates that there is a significant skew to the results, which I think is best explained in the psychological terms of a typical "amateur" investor. Having been burned before, this investor remains bearish or neutral until the market is so strong that he can no longer deny its strength. Then he flip-flops his opinion, deciding that it's a bull market after all, and buys shares. As the market rises and falls, he is unable to separate himself from his position, rationalizing his losing days and patting himself on the back for his winning days - despite being a passive holder of shares who didn't really do anything. When the market enters a downtrend, he continues rationalizing his position longer than he should, telling himself it's okay because "it's a long-term trade," or "it's a minor correction," or "they're just shaking out the weak hands." He remains bullish until the moment of capitulation, finally selling his shares in despair.

    This is a classic investing behavior that is driven by the sunk-cost fallacy. This dilemma is usually explained in terms of movie tickets: you bought the tickets, but the movie sucks and you want to leave. But you don't leave, hoping against all odds that it will get better, because you don't want to "waste" the price of the ticket. While this example is very easy to understand, and most of us have experienced it directly, it doesn't map perfectly to an investing situation. So let me attempt to redraw it.

    You bought shares in a company, excited because you felt that they were developing the next great product sure to be on everyone's list during the Holidays, and you reckoned the stock was under-priced. Unbeknownst to you, the management team was running the company into the ground by taking crippling salaries and under-funding research and marketing. For months, the stock slid steadily lower for no apparent reason. Your initial investment fell by 10%, then 20%, then 30%. Every month, you reviewed your holdings and couldn't bring yourself to sell, because:

    1. Rationalization: Maybe when that new product comes out, things will be different. Rebuttal: What was your target return on that product at the beginning? 20%? 40%? What kind of a return do you need to get now just to get even?
    2. Rationalization: If you sell now, you'll never make the money back that you've lost. Rebuttal: If you sell now, you can invest in something else with a higher probability of return, enhancing your chances of profiting from now on.
    3. Rationalization: You bought this company because you felt it was under-priced. Now it's an even better bargain! Rebuttal: Imagine how great a bargain it will be when it goes bankrupt.
    Does any of this sound familiar? I'm not immune: I bought Yahoo in 2000 for $100, $80, and again at $40 before I finally capitulated and sold at $20. That sure was a good tax write-off. But I digress.

    This psychology is important to CS|MACO because the trade seeks to get long when the typical investor described above finally gives up and dumps his shares in despair. This is the moment of capitulation, and it generally marks the bottom of a correction in the market. Because most individuals are long-only investors, using the inverse doesn't work so well: it makes no sense to get short when everyone is exuberantly bullish. Also, long-term up-trends are much more common than long-term down-trends - market corrections tend to be much faster and more violent because of the pain-avoidance behavior described above.

    Since long-term up-trends involve ever-higher bullishness on the part of investors, it is frequently the case that the AAII survey gets so bullish that CS|MACO gets an exit-long signal long before the end of the trend. The MACO component compensates for these premature exits by keeping the trade long as long as the daily close price is higher than the 200-day moving average, and the 200-day moving average is itself higher than the 300-day moving average.

    As a matter of fact, the rally that SPY has been enjoying since its low on October 4 is very close to reaching that 200-day moving average. So with a little more buying and a little less bullishness (aka irrational exuberance), CS|MACO might find itself right back in that position.

    So how did it do this time around? Including dividends, it's a 3% return. It's not a tremendously exciting strategy.

    26 October 2011

    Applications: Minecraft

    See Time For a Change for the first in this series, or check out the index for all the posts dealing with Arch Linux. Since I only have a limited time to work on the Arch test machine this evening, I'll tackle something that should be pretty simple now that I have Moneydance working.


    Note that this post is not going to be a description or review of Minecraft. If you want to learn about Minecraft, just Google it and you'll have all the information you want, and a great deal more besides. This is about getting Minecraft working in a 64-bit Arch Virtual Machine.

    Still Here?

    Minecraft is written in Java, and thus is designed to work on just about any major operating system. But when I tried to install it and use it on my Arch 64-bit VM, it crashed on me. I suspected that it was the same problem as Moneydance: OpenJDK vs OracleJRE, but forum reports said would work just fine with OpenJDK. The problem turned out to be that I had not enabled 3D acceleration in my VirtualBox test machine. After a quick shutdown and reconfigure, I booted back up and launched Minecraft again:

    $ java -jar minecraft.jar

    It sent nearly continuous errors to the console, but managed to login and start the game. Not wanting to see these constant error messages, and knowing that they would slow down execution of the game, I slightly modified my command and tried again:

    $ java -jar minecraft.jar &> /dev/null

    The additional characters in this command simply redirect all output to the endless vacuum of space.

    Minecraft came up, and let me login, although strangely I had to click the Login button a couple of times before it succeeded. But as soon as I entered a world, the mouse control was awful. No matter how careful I was, I found myself staring at either the ground or the sky, spinning in place. After some more Googling, I discovered that this is a known issue when using Minecraft in a VirtualBox guest machine, and the solution is as simple as to disable mouse integration when using Minecraft. I tried that, and voila! Resource-gathering goodness.

    In the home stretch now, I used the same menu-editing trick I used for ThinkOrSwim, stealing an icon from my host machine (don't remember where I found it in the first place), and sticking Minecraft under the Games submenu.

    Six down, four to go!

  • PasswordSafe for secure password management
  • Moneydance for personal finance DONE!
  • ThinkOrSwim for option trading DONE!
  • Minecraft DONE!
  • Dropbox for cloud storage DONE!
  • Kontact for e-mail, contacts, and calendar
  • Choqok for micro-blogging (following and posting to Twitter) DONE!
  • NixNote for notes/personal organization
  • Okteta hex editor DONE!
  • Bacula for automated backups
  • 19 October 2011

    Applications: Dropbox

    See Time For a Change for the first in this series, or check out the index for all the posts dealing with Arch Linux. Today I'll get Dropbox installed and configured, so all the files I like to have follow me around will continue to do so.

    If I were using GNOME, installing Dropbox would be really easy: just go to the website, download the installer, run it, and it steps me through. If I were using GNOME within Ubuntu, it would be even easier yet: just select Dropbox in the Software Center and it installs it for me and keeps it up-to-date. But I'm using KDE under Arch, so things are a bit more complicated: Dropbox doesn't directly support KDE, and Arch doesn't directly support Dropbox.

    Getting Dropbox installed and running is still pretty straightforward:

    $ wget http://www.getdropbox.com/download?plat=lnx.x86_64 dropbox-dist.tar.gz
    $ tar xf dropbox-dist.tar.gz
    $ .dropbox-dist/dropboxd &

    The first line downloads the latest version of the 64-bit distribution of Dropbox from their website and saves it as a recognizable archive file (.tar.gz files are the GNU/Linux equivalent of .zip files on Windows). Note: There is a space at the line break: "...lnx.x86_64   dropbox-dist.tar.gz". The next line extracts the contents of the archive, which automatically creates the whole .dropbox-dist/ subdirectory tree under the current directory (in this case, my home directory). And the last line starts the dropbox daemon in the background so it can ask me for my credentials and start downloading my files.

    I get an error message about the Nautilus file manager (default in GNOME) not being installed, because Dropbox is designed to integrate with it like it does with File Explorer in Windows. It's not a big deal, although it is kind of nice to have the little green checkboxes and blue arrow badges on my Dropbox files so I know if there are any synchronizations outstanding. But I can also get that information from the Dropbox taskbar icon, which is fully functional in KDE. It also would be nice to get Dropbox to automatically keep itself up-to-date, but that's true of just about all of these hand-installed applications. Auto-updating is something I'll work on after I move in for good.

    But having Dropbox automatically start when I log into KDE is important, because a file synchronization utility that isn't running also isn't synchronizing. To do this, I had to create a KDE "Desktop" file in the right place. I created a Desktop file when I installed ThinkOrSwim, too, by using the KDE Menu Editor. In that case, it stored the Desktop file in my Menu subdirectory so that the KDE Menu would load the information when I clicked the KDE Kicker button (similar to the "Start" Menu in Windows). But this time I decided to create the file by hand, because I wanted to understand how things worked.

    In order to create a valid Desktop file, I first needed to understand the format. Google is my friend, and so I found this Desktop Entry Specification that answered my questions. That allowed me to create the file ~/.kde4/share/autostart/dropboxd.desktop with some degree of confidence:

    [Desktop Entry]
    Type=Application
    Version=1.0
    Name=Dropbox
    Exec=/home/mark/.dropbox-dist/dropboxd
    Path=/home/mark/.dropbox-dist/

    This is pretty self-explanatory, I think, except for "Version", which refers to the version of the Desktop Entry Spec, not Dropbox itself. After a reboot to verify that Dropbox was auto-starting, I was all set.

    Halfway there!



  • PasswordSafe for secure password management
  • Moneydance for personal finance DONE!
  • ThinkOrSwim for option trading DONE!
  • Minecraft - thought this would be easy, but it crashed on my first attempt
  • Dropbox for cloud storage DONE!
  • Kontact for e-mail, contacts, and calendar
  • Choqok for micro-blogging (following and posting to Twitter) DONE!
  • NixNote for notes/personal organization
  • Okteta hex editor DONE!
  • Bacula for automated backups


  • Next: Minecraft
    Or check out the Index

    15 October 2011

    Dipped in Gold

    With all the Arch Linux posts lately, loyal readers may be tempted to think I have given up the aggressive-investing game. Not true. I recently completed my trade of the year with those out-of-the-money GLD calls I wrote about back in August. I bought them for 25c a share, and sold them for various prices, a few as high as $8. All told, those calls netted something on the order of 800% return on premium paid.

    As I exited the last of those calls, GLD was in the midst of its toughest correction in the past few years. I bought my first shares of GLD in 2009, but even looking back as far as 2006, I don't see a correction as violent or as deep as the one we just completed. Gold bulls were hit with a triple whammy: a technical double-top formation around the end of August was followed by the Fed failing to signal much more in the way of monetary stimulus. As the investment world started its usual flight to quality in the face of disappointing developments, the CME responded to the increasing volatility in gold futures by raising the margin requirements. Everyone in the trading community still remembers how margin increases sparked the recent Silver panic, and so it is no surprise that GLD gapped-down two days in a row in the last week of September. It shed 8% of its value in two trading days, which is a pretty dizzying fall for a physical commodity unaffected by droughts and floods like gold.

    The gold haters came out in droves, claiming this was the "popping of the bubble", and giving target prices of $700/oz (about $70/share in GLD terms). I stepped away from leverage on GLD, which I had planned to do during the fall, anyway, since September-October has historically been a bad season for gold (I have no idea why, it's not like there's a harvest or something). I gritted my teeth and held onto my outright shares of GLD, the straight-up gold ETF, and GDX, the ETF comprised of gold-mining companies. And I bought a few more shares of GLD on the way down, but far too soon (169). I admit I started worrying that the bubble was popping, too, but those fears are past.


    Does the chart above look like a bubble to you? I have added a 100-day simple moving average to the price of GLD over the past 3 years. Notice the double-top, with a high of 185, and the two days of down-gapping shortly afterward. But also notice that GLD stopped its free-fall at the 100-day trendline, and resumed the trend. That's not a bubble-pop, that's the start of the mania phase.


    Here's another chart you might recognize, this time of the NASDAQ from 1996 through 2002. See how there are corrections back to the trendline throughout the 1990s? Some of them undoubtedly looked like The End at the time, but those corrections ended up looking like little squiggles in comparison to the mania phase starting in late 1999, and of course the multi-year sell-off afterward.

    So I'm looking to buy dips in gold again, since I think we'll start another leg up in this market sometime around year-end. I've already bought some shares in GDXJ, an ETF comprised of smaller-cap mining companies, and some calls in GDX, expiring in January. Both are already priced higher than where I bought them, but I can't take credit for that -- it was just an effect of the risk-on-risk-off hokey-pokey the markets have been dancing since 2008. At the moment, we're putting a foot in, so all risky assets are going up. Later, we'll take it out, and they'll all fall again.

    Why mining companies instead of gold itself? I mostly prefer to trade the metal on its own, so as to slightly reduce the vast number of variables acting on my investment, but we are entering Q3 earnings-reporting season. There will be a lot of bad news coming out of the tech industry (Google's blow-out notwithstanding), and a lot of good news coming out of the mining industry, as gold miners realize higher and higher prices for the more or less constant rate of supply they are pulling out of the ground. Also, mining companies have lagged behind gold prices during this bull market. If they close the gap, I'd like to be there to profit from it. And finally, dividends. Gold doesn't pay a dividend, but miners do. Consequently, I might look to buy a few outright shares of individual mining companies so as not to dilute my dividends through the GDX ETF.

    I have some trades unrelated to gold in progress, too, but that's another post.

    14 October 2011

    Applications: Moneydance

    See Time For a Change for the first in this series, or view the index to see all the posts dealing with Arch Linux. This time I get Moneydance installed and functional, despite Oracle's best attempts to thwart me. This one should not have been this hard.

    Personal Finance - Failed First Try
    Microsoft Money was the best personal finance manager I've ever used, but Microsoft withdrew support for it a couple of years ago. And neither it nor Quicken run on Linux, anyway, so I was forced to find a new program. After trying a few, the best one I could find was Moneydance. It has all the quirks of an open-source program, but it costs money. Feh. The quality bar seems to be pretty low for personal finance management programs.

    Installing Moneydance starts with downloading a script from their website. Running it, I get:

    Could not display the GUI. This application needs access to an X Server.

    Two Steps Forward
    Insta-fail! I have an X Server, you morons. I did a little searching around on their website and didn't find much. But I did notice that the file downloaded from the link above included an embedded java runtime. I decided I might try one without the embedded java, and that turned out to simply be Moneydance itself, without an installer at all. That was fine with me... I did the same launcher-creation magic that I did with ThinkOrSwim yesterday, and Moneydance was ready to go.

    A personal finance program is useless without finances, though, and I certainly don't want to throw away all my records from my old machine and start fresh. How to transfer files from the host to the guest? Well, VirtualBox has a great way to do that. I can specify a folder on the host machine to share with the guest. In a Linux guest like Arch, this shows up as a device that can be mounted, allowing me to simply copy files around. I right-clicked the wee folder icon in the bottom-right of the guest's VirtualBox window, and added a folder on the host (real) machine I want the guest (virtual) machine to see. I chose my home directory, giving it full read-write access in case I need to copy files back sometime.
    The wee folder icon
    Then I mounted the directory in the guest like this:

    $ sudo mount -t vboxsf hildehome /mnt/hildehome/

    The first "hildehome" is the name I gave my shared folder in VirtualBox ("hilde" is the name of my host machine), and the second, "/mnt/hildehome/" is the directory in the guest at which I want it mounted. Sure enough, after executing that command, I could see the contents of my host's home directory. So I simply copied the "money.md" file containing the last few years of my financial activity from my host's Documents folder to the same folder on the Arch guest machine, and then launched Moneydance. It asked me what I wanted to do, and I chose "Open an Existing File", and HPFM! it looked just like it did on my host machine.

    One Step Back
    I have an extension installed on the original machine that downloads stock prices from the internet and updates them in Moneydance so I know the current value of my investments. For some reason, Moneydance refused to acknowledge my click on the "Yes, please install" button. More searching on the website, and I discovered that the problem is that for Java I'm using the OpenJDK instead of the Sun JRE. Moneydance Support's advice is to use the Oracle JRE (used to be the Sun JRE until Oracle pulled a Borg on them), but that no longer works now that (F-ing, Evil) Oracle has removed its license to let Linux distros redistribute the Oracle JRE.

    I did some looking on the Arch Wiki, and I can still install the Oracle JRE if I do it via the Arch User Repository (AUR). But apparently because I installed the OpenJDK already, that keeps OracleJRE from getting installed; and I can't remove the OpenJDK to replace it because KDE itself requires it. Great.

    A Different Approach
    What if I install it manually, by downloading the JRE directly from Oracle, the way a Windows user would? After accepting the hell-spawned license agreement and downloading the tarball, I extracted it into a working directory. Inside was a complete Java installation that required no secondary installation, so instead of doing anything fancy, I copied it to a system directory and set up an easy-to-use link.

    $ sudo mv ~/abs/jre1.7.0 /opt/
    $ sudo ln -s /opt/jre1.7.0 /opt/oraclejre

    Now, in theory, I should be able to point any Java-using app to that location instead of the system-default OpenJDK, which is installed at /usr/lib/jvm/java-6-openjdk. So let's look at the script that runs Moneydance. I've trimmed out some script glue to show what's really going on, and I've numbered the lines for reference (the line numbers are not part of the script):

    1. MDHOME=`dirname "$0"`
    2. JAVA_EXE=java
    3. if [ -x ${MDHOME}/jre/bin/java ] ; then
    4.    JAVA_EXE=${MDHOME}/jre/bin/java
    5. fi
    6. exec "${JAVA_EXE}" -mx512m -cp "${MDCLASSES}" Moneydance "$@"
    Line 1 finds the directory in which the script is running and assigns it to the variable MDHOME.  Line 2 sets a default path-based location for Java, essentially defaulting to what a user would get if he typed "java" at the command-line. On my machine, that's the OpenJDK version, which we already know doesn't work. Lines 3-5 test to see if there is an executable named "java" in the .../jre/bin directory under where the script is running. If so, it will use this one instead. This allows overriding the default system Java. Finally line 6 runs Java in the location chosen, and passes the necessary parameters to get Moneydance running.

    The best way for me to trick Moneydance into using my newly installed OracleJRE, without changing this script, is to simply create a link in my Moneydance directory over to where the OracleJRE is. Moneydance's launch script will detect this, and use the OracleJRE. I'll run a few commands below to assure myself I'm doing what I think I'm doing, but the only really essential one is the "ln", which I have helpfully bolded.

    $ java -version
    java version "1.6.0_22"
    OpenJDK Runtime Environment (IcedTea6 1.10.3) (ArchLinux-6.b22_1.10.3-1-x86_64)
    OpenJDK 64-Bit Server VM (build 19.0-b09, mixed mode)
    $ /opt/oraclejre/bin/java -version
    java version "1.7.0"
    Java(TM) SE Runtime Environment (build 1.7.0-b147)
    Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
    $ ln -s /opt/oraclejre ~/moneydance/jre
    $ ~/moneydance/jre/bin/java -version
    java version "1.7.0"
    Java(TM) SE Runtime Environment (build 1.7.0-b147)
    Java HotSpot(TM) 64-Bit Server VM (build 21.0-b17, mixed mode)

    Looks good! When I next ran Moneydance, not only did it come right up as before, but I was able to install and configure the Stock Quote Updater plugin. And my portfolio went up today! Win-win!

    Four down, six to go!

  • PasswordSafe for secure password management
  • Moneydance for personal finance DONE!
  • ThinkOrSwim for option trading DONE!
  • Minecraft - thought this would be easy, but it crashed on my first attempt
  • Dropbox for cloud storage
  • Kontact for e-mail, contacts, and calendar
  • Choqok for micro-blogging (following and posting to Twitter) DONE!
  • NixNote for notes/personal organization
  • Okteta hex editor DONE!
  • Bacula for automated backups


  • Next: Dropbox
    Or check out the Index