Sunday, February 24, 2008

Google Makes Me Stupid

Does anyone else find that sometimes their first response to a problem is to search Google? I just had the good ol' 500 Internal Server Error in an Apache request and immediately I searched Google for assistance. Given that the web server in question was my own, the reasonable person would first check the server error.log, but I'm apparently not that guy. In my defence, it didn't take long for me to remember this, but still, Google was my initial reaction.

A quick check of said log file suggested an .htaccess issue, and now all is well. Perhaps we're (I'm?) becoming too dependant on our search engine overlords...

Vim and Perforce

My employer has used Perforce as a VCS for several years now. Perforce itself maintains integration plugins for Eclipse, but of course not for editors like Vim so it's up to the community to do so. Lucky for me, extremely capable Vim scripters like Hari Krishna Dara also use Perforce from time to time :). This is the same author who brought us the genutils.vim plugin as well as many other powerful scripts as his vim profile lists. Among these is a fantastic perforce script set that I downloaded to try about a week ago. It was more than I'd hoped for.

This is a very featureful Perforce integration script with a complete set of menus (although I have menus hidden in my vim) and commands. I'm not sure whether the author still uses it or not however because there was a bug in spec-based commands that broke it pretty badly. Of course, there is the possibility that I'm using it incorrectly too. Regardless, I've "fixed" a couple of these bugs and emailed the author with a patch. I also uncovered a bug in the genutils.vim script that it depends on. The author also mentions this in the script page for the Perforce plugin:

--------------------------------------------------------------------------------
Lately, I am not finding enough time to add features to this, so if anybody is
interested to help me add new features or even take over the responsibility, you
are very much welcome.
--------------------------------------------------------------------------------

Although I sent him a small patch in his Inbox, he may not have the time to make a bug fix release, so I've made a little bazaar branch of the complete script on my own little server here for the time being. This branch includes the fixes for a couple of little bugs, and some extra syntax hinting for pending changelists and closed jobs. Aside from that, it's unaltered. You can get it using this command, assuming you have bzr installed.

$ bzr branch http://arker.homelinux.org/~dcraven/bazaar/vim-perforce vim-perforce

I might add a few features or commands that have been included in the p4 client since his last release of the script at some point too. Depending on his email reply (if he replies) we'll see if he'd like my changes included in his next release or not. My additions unfortunately won't be of the same quality as the stuff he's already written. I'm not exactly a seasoned vim-scriptor...

All in all, it's a fantastic script. Check it out if you use Vim with the Perforce VCS, and big kudos and thanks go out to the original author!

Tuesday, February 19, 2008

Stumped by a Captcha

Does anyone see the security code in this captcha?

Bad Captcha Image

This one has me stumped...

Monday, February 18, 2008

GnuCash Broke My Ledger :(

For the past year and a bit, I've been happily using GnuCash with Ledger and it had been a fantastic duo. Several days ago, I upgraded to GnuCash 2.2.3 and the combo doesn't work so well anymore. The problem stems from an internal change that adds a "Root Account" as the top level account in the tree. To say the two don't work together anymore might be a little harsh, but they at least don't work as well together as they used to. For example, this used to work to get a quick net worth:

$ ledger bal ^ass ^liab

The ^ass and ^liab bits are regular expressions that match all accounts that start with the letters ass and liab (assets and liabilities) respectively. This would result in a little chart showing my total assets minus my total liabilities, since "Assets" and "Liabilities" used to be top level accounts. Now with the new structure, these accounts are no longer roots. Instead they look like "Root Account:Assets" and "Root Account:Liabilites". Long story short, this new "Root Account" is the only top level account. To make matters worse, the bloody account name has a space in its name, and we all know how well spaces work on the command line...

Needless to say, the combination became a lot less useful with this update. I'm not sure whether to downgrade to GnuCash 2.0 or not. What a shame.

Saturday, February 16, 2008

Changing the Default Text Editor in GNOME

The "Preferred Applications" menu item in GNOME runs a little app that allows you to change some of the default programs used for various tasks like web browsing, music playing etc. One thing that's been missing for me is the ability to change the default text editor. Sure you can open up Nautilus, right click on a text file, and chose that way, but there are many types of text files, and they are each treated independantly.

Recently I discovered the ~/.local/** path. I'll use gvim as an example for this excersise. This is the ticket for swapping default editors once and for all! First, use the method described above (the right click in Nautilus way). Now you should have a ~/.local/share/applications/gvim.desktop file. That's good. Next, create a ~/.local/share/applications/defaults.list file, and put this in it:

    [Default Applications]
    text/plain=gvim.desktop
    application/x-perl=gvim.desktop
    text/x-chdr=gvim.desktop
    text/x-csrc=gvim.desktop
    text/x-dtd=gvim.desktop
    text/x-java=gvim.desktop
    text/mathml=gvim.desktop
    text/x-python=gvim.desktop
    text/x-sql=gvim.desktop

The contents above were taken from my own system wide /usr/share/applications/defaults.list, just with :%s/gedit/gvim/. This should at least cover the file types that gedit keeps popping open for. You could always modify the system wide defaults.list, but be prepared to lose those changes during your next update. Also, since the gvim.desktop file already existed in my local home path, I never tried just copying the one from /usr/share/applications. That might work too.

I can't believe I've been using GNOME for so long and never knew this :(

Tiny Tiny RSS Feed Reader

Lately, I've been missing something in a feed reader. In the past six months or so I've tried a plethora of different readers of different forms. I tried the desktop application style like Lifrea, the online flavors like Google Reader, and the Firefox extension kind like Sage. All have their benefits, but also disadvantages. For example offline readers make it a pain when one uses different machines, online reader services felt slow or sluggish, and cluttered. Not to mention they can't be modified.

I forget now how I heard about Tiny Tiny RSS now, but if I remember I'll update this post with well deserved props. This thing is perfect in my opinion. It's fast, it's open source, it's written in PHP/MySQL, and it's pretty feature complete. Even setup was a breeze and went without a hitch.

The interface is very clean and well organized. One can tell pretty early that some of the interface ideas in TTRSS were inspired by Google's great GMail interface like the ability to star articles as well as the familiar actions list, and in fact it very much has the feel of using your typical desktop email application. This reader can run in either single or multi-user modes, and you can publish your feeds and articles with others with a single click.

I'll not provide a list of features here since they do a pretty good job of that on their website. If you are not in love with your current reader, I very strongly suggest this gem!