Fixing the Firefox 4 open tab / open window nonsense

April 15, 2011

Firefox 4 has got it into its head that tabs are better than windows, despite the fact that tabs use up more UI and look ugly, while windows are nice and clean.

In order to promote their tab agenda, they’ve changed the order of the context menu so your muscle memory for “Open Link in New Window” now brings you “Open Link in New Tab”. Ugh.

Luckily, there is an answer for this.

Create a userChrome.css file in your profile/chrome directory (on Windows, C:\Documents and Settings\user\Application Data\Mozilla\Firefox\Profiles\somethingrandom.default\chrome\):

#contentAreaContextMenu > * {
-moz-box-ordinal-group: 2;
}
#context-openlink {
-moz-box-ordinal-group: 1 !important;
}

This doesn’t change the order under the file menu, but at least when you’re using the context menu it will work right.

Advertisements

Configuring a website on Apache2 with server-side includes

January 22, 2011

I recently got myself involved in helping with a website for a local club. In order to maintain it, I wanted to set up an Apache instance at home as well.

Luckily, in Ubuntu 9.10, it’s almost all set up by default. The only changes I had to make were to change the DocumentRoot directory and enable server-side includes. Here’s what I did:

Changing the document root

First I edited /etc/apache2/sites-available/default to put my document root in DocumentRoot, and also changed the two directory references that did point to /var/www to my new document root. Then I made sure all the parents of my document root had r+x permission for the Apache user.

Turning on server-side includes

My hosting facility has server-side includes turned on for .html. This is not the best use of resources, but this website doesn’t get enough traffic to make a difference. So I added:

AddType text/html .html
AddHandler server-parsed .html
Option Include (plus whatever options were there before)

to the two directories that used to be /var/www and /. After that, I had to enable mod_include with:

cd /etc/apache2/mods-enabled
sudo ln -s ../mods-available/include.load include.load

Then restart apache with sudo /etc/init.d/apache2 restart


Creating thumbnail images with convert

January 1, 2011

A little while ago, I found I had a bunch of images that needed thumbnails that were 100×75. This isn’t hard to do – I used convert and a pair of bash for loops.

The core was a call to convert, which is part of ImageMagick.

convert -thumbnail 100x75 input.jpg thumbnail.jpg

All of my images happened to be 4:3 – if they hadn’t, I might have used 100x75! or rotated/resized them.

Next, all my files had numbers of the form file01..file09 file10 file11… etc. If you’re nuts, you try to figure out how to do this in a single for-loop with a condition for the first 9 elements that start with 0.

If you’re lazy like me, you use two loops, with a cursor-up in bash so you don’t have to type as much:

export INFILEPREFIX=file
export OUTFILEPREFIX=file
for i in {1..9}; do convert -thumbnail 100x75 ${INFILEPREFIX}0${i}.jpg ${OUTFILEPREFIX}0${i}t.jpg; done
for i in {10..25}; do convert -thumbnail 100x75 ${INFILEPREFIX}${i}.jpg ${OUTFILEPREFIX}${i}t.jpg; done

For the non-thumbnails, I resized as well, using -resize 800×600.


Scale your website images

January 1, 2011

I just noticed that if you scale an image using width= and height= attributes of the img tag, Firefox 3.6 will (sometimes) put a thin border on the top and left of the image – something that you can’t get rid of with CSS/styling.

Weird – but a good rule seems to be scale your images to the correct size before using them in HTML.

This is different from the “border around link images” issue – which is easy enough to get around by using
border-style: none in CSS.


Exposing the Firefox Location Bar behaviour

February 19, 2010

On several machines, I’ve got Seamonkey 2.0.2 installed. It has some very nice fine-grained preferences to control what shows up in the location bar.

I’ve also got a netbook where I put Firefox 3.6 because I didn’t need everything that’s in Seamonkey. Firefox has really limited preferences to control what shows up in the location bar.

Luckily, both browsers behave the same way using about:config. So it’s possible to get Seamonkey’s fine-grained control on Firefox, as long as you don’t care about a UI to do it.

A very useful article can be found here: http://kb.mozillazine.org/Browser.urlbar.default.behavior.

I read that article, and was about to calculate the value I wanted, when I realized the simplest way to do it is to go to the Seamonkey install, set up the preferences the way you want (“Autocomplete from your browsing history as you type”, “Match only websites you’ve typed previously”, “Only match locations, not website titles”, “Match anywhere but preferring word boundaries”, “Automatically prefill the best match”, “Show list of matching results”).

Then look at the values on Seamonkey for

browser.urlbar.default.behavior

using about:config, and enter that value (and any others you care about) in Firefox using about:config on that browser.

In my case, I set browser.urlbar.default.behavior to 49 to get what I wanted.