March 21, 2009

Tabs are evil, and not just in whitespace

Of the many great things that Firefox has brought us, tabbed-mode is the earliest, and arguably the greatest. Tabs existed in applications before Firefox, but I believe it was Firefox that made them mainstream. Soon, many applications started touting tabbed windows as one of their main features. Tabs were a good way to keep all "related" windows together - finding the window you needed was never easier/faster.

But now, tabs only seem to hinder my workflow. During the past few years, Firefox has grown, and so have I. However, Firefox still focusses on one task - web browsing, and I have moved on to doing things that involve more applications. When I am developing, I usually have two instances of my IDE, API documentation in Firefox, IM windows in Pidgin, and git terminals. Most of the times, I cannot reach the window I want to in a single attempt. Going back to a page I am browsing from my IDE involves Alt-Tabbing to my browser, and then Ctrl+Tabbing to the correct tab.

I seem to have found a solution to my window switching woes on Windows, although I needed two applications to get what I want. The first - TaskSwitchXP (use compatibility mode in Vista). All my applications now run in non-tabbed mode (here's an extension for Firefox to help with this). When I need to switch to between windows of all applications, I Alt+Tab to get this -


However, when I need to switch between instances of the same application, I Ctrl+Alt+Tab my way to this -


Notice that the taskbar shows many application windows open, however, the switcher only shows Firefox windows. This is very similar to Ctrl+Tabbing within an application.

Multiple windows can be a pain though, once you have too many of them. Not very uncommon while browsing. If the window is too far back on the Alt+Tab MRU list, I use the second application - this autohotkey script - to do an incremental search-as-you-type in the existing windows list. Like so -


I'm still looking for something like this on Linux - an application instance switcher, and an incremental search for all windows. The problem is somewhat mitigated through workspaces, but not completely solved, IMHO. You can group related windows on a workspace, and the window switching you have to do gets a lot lesser. But the tabbed applications still break this flow, and you can never get to the window you want directly.

Mac OS X apparently already has a shortcut to this effect.

March 19, 2009

On git, gitosis, and python issues on Windows Vista

Some browsing, debugging, and IRC chats later, I have managed to set up a git repository on Windows Vista using cygwin, with a few unexpected hiccups. I will try to repeat the process on a virgin setup to come up with a more authoritative flowchart of how to go about things. For now, I'll just list down the issues I faced.

I used gitosis to host git repositories over ssh. It's pretty elegant, really. Administering gitosis is limited to managing a configuration file and user keys, which itself themselves are in a gitosis hosted git repository. Neat.

These two articles

cover everything you need to do to host git repos. The first link should be straightforward. However, since the second link is for linux users, there are a few deviations for windows. Try to follow the link, if you face difficulties, refer to the tips below.

Installing gitosis

Log in to an administrator account. Do a

cd ~/src
git clone git://eagain.net/gitosis.git
cd gitosis
python setup.py install
If the last command fails thusly
Traceback (most recent call last):
File "setup.py", line 2, in ?
from setuptools import setup, find_packages
ImportError: No module named setuptools
you may need setuptools from here. Scroll to the bottom, download an egg, and do
sh setuptools-0.6c9-py2.5.egg
Repeat the last step. After you have installed gitosis successfully, run the following command
chmod +r /usr/lib/python2.5/ -R
This was the first wtf. The downloaded egg we just installed gets installed with administrator ACLs, the above command ensures that everyone has access to the downloaded eggs.

Setting up gitosis

You need to add the git repository user `git' the windows way (the adduser command in the second link will not work). Once you've done that, make sure you've run the following commands

# in the new 'git' user's account
ssh-user-config

# from the admin account
# (domain users need to add '-d domain_name' to the mk* commands)
mkpasswd.exe -l > /etc/passwd
mkgroup.exe -l > /etc/group
Also, the command
sudo -H -u git gitosis-init < /tmp/id_rsa.pub
will need to be run as
# git user's account
gitosis-init < /tmp/id_rsa.pub
Of course, this assumes that you've copied your key to the /tmp folder.

The rest of the write-up should be fine, except for one thing. When you try to `git commit' you repo configuration, you may see an error like :
Counting objects: 5, done.
Compressing objects: 100% (3/3), done.
Writing objects: 100% (3/3), 307 bytes, done.
Total 3 (delta 1), reused 0 (delta 0)
To git@localhost:gitosis-admin.git
989f371..0616ebb master -> master
: invalid optione: line 2: set: -
set: usage: set [--abefhkmnptuvxBCHP] [-o option] [arg ...]
Second wtf. Damn those pesky windows newlines. Do a
# `git' user's account
dos2unix ~/repositories/gitosis-admin.git/hooks/post-update
and you should be good to go.

This should do it. If you still run into problems, let me know. If you find solutions to them, post them up so that I may link to you. And when you do have a git repository up, give me the url to fork from :)

Edit: fixed grammar