Software

Thursday, March 6, 2008

Firebug for OSX

Firebug is an amazing debugging tool but some of us believe that it makes Firefox unstable and I've seen cases where without restarting Firefox, it just stops working so I want to be able to restart Firefox without losing all of my other windows.

The solution to this problem is simple. Since you only want to use Firebug when debugging your own websites (or improving the look and feel which is where it is a true blessing), you just need a separate process running Firefox with Firebug in it than you use for your everyday browsing.

Here is how to do it for OS X (it should then be obvious how to do it for Linux by replacing the bizarre path with whatever `which firefox2` or whatever version you are using returns).

First set up a new debug Firefox profile. Execute this from a shell:


MOZ_NO_REMOTE=1 /Applications/Firefox2.app/Contents/MacOS/firefox -ProfileManager


Use the UI to make a new profile called "debug" and let it save the profile in the strange place it decides (since it really doesn't matter).

Now create your firefox debug script which I call "defox":


#!/bin/bash
MOZ_NO_REMOTE=1 /Applications/Firefox2.app/Contents/MacOS/firefox -P debug


chmod defox to be executable and put it on your path. Then execute it. You should now get a new Firefox process even if you are running your default firefox profile. With that new Firefox started, goto Tools->Add-ons and then click on the little text that says "Get Extensions". At the Mozilla site, search for firebug, click the obvious link and then the install now link which should download it and finish that process off. It will probably restart your debugging firefox instance and then you are good to go by clicking the icon it puts in the button of your window. Search for the internet to learn more about that.

At least under linux, "killall defox" lets me kill my debugging firefox when either it or firebug gets tired. The great thing is that is will ask to restore the session and I tend to get the one or two debugging windows back and I'm off to the races.

Friday, October 12, 2007

Cool OS-X program

There is a great program called Witch which basically is an improvement on Windows style ALT-TAB.

Monday, October 8, 2007

Setting Up Environment Variables in Ubuntu (and probably Debian)

I was having problems getting my environment set up correctly when logging into my Ubuntu machine from the gdm login prompt. The nature of the problem is that bash is never started unless you create a terminal window. If bash is never started, then ~/.bashrc, ~/.bash_profile, etc., never get run. For many people I suppose this isn't a problem, but for me, when I start Emacs via the drop-down menus in the window manager, I wanted my environment variables, like PATH and various perforce environment varaibles, to be already loaded.

The solutions on the web I found in the top 100 google hits for (ubuntu enviornment variables) were all pretty terrible as they suggested changing the system wide settings in /etc/profile and other things that would make it harder for me to use other machines in my organization.

The solution I am using instead is to create an executable ~/.Xsession file which sources the script which sets up my environment variables and then execs /usr/bin/x-session-manager. In between, it is convenient to launch a few extra programs to run as well. So here is my script:


#!/bin/bash

# Force environment variables to get loaded before our window manager starts.
# Perhaps I should just load .bash_profile here but .bashrc will load that
# automatically if necessary.
source ~/.bashrc

# Start up some programs here.
xterm &

# Now, invoke the normal gnome/ubuntu login stuff.
exec /usr/bin/x-session-manager


Hope this saves you a little time and frustration.

Friday, September 28, 2007

OSX Terminals

I'm still looking for a good OS-X terminal. The major problem with Terminal.app is that after poking around, I'm only able to get the meta-key as alt/option. Of course, my carbonized emacs uses the clover leaf for meta so if I'm sshing somewhere and using emacs and using it locally too, I'll end up typing clover-leaf commands at Terminal.app which causes it to do funny things. There are programs that switch alt/option and clover leaf, but they do it globally. I just need to switch it per window, but I don't know how.

I'm trying to avoid installing X-Windows on my mac because of the problems I seem to have with it (namely that it is very slow to start and its windows don't seem to get integrates into the aqua ui for things like clover-leaf tab.

Update: I built my own version of iTerm hacked so that both Alt and Option act as a "Meta" key. It works pretty well though I've mostly resorted to using XWindows when logging in from home because I have better control over the colors.

I'd like to formally complain that the people who came up with ANSI coloring for terminals didn't do something smart like being able to query the terminal for the RGB triples it supports (of course with a shorthand for any) and be able to then specify colors by RGB triples when drawing.

Bold, italic, underlining, and strike-through, would be nice too. (A single fixed width font is fine however, after all, it is only a terminal, not a web-browser.)

Thursday, September 27, 2007

Mercurial

My friend has been trying to use Mercurial which is a version control system written in python. I'm using OSX and I already had python 2.4 installed. While some of the files seem to appear after doing an install of mercurial package, the executable itself never gets installed (and the installer never complains). I was mislead by the documentation and by spotlight. Doing a find I fould hg, a very simple script, in /usr/local/bin. I gave it a spin and it seems to work OK.

I still don't know why the world can't just learn from Apple that installation should be a matter of dragging a single folder into any directory you want. I wouldn't even care if it carried with it the 100mbs of a python as long as it would just work.

About Me

My photo
I'm currently a software engineer at Google though I've worked at other companies as well.