mod_rewrite primer

I’ve had to write a number of .htaccess files over the past week or so. My uses of mod_rewrite are simple enough, but I thought to post here since there in case anybody just wants to accomplish something quickly. Ask your server administrator to set the “AllowOverride” property to “FileInfo” or “All”, so as to enable .htaccess overrides.

Permanent (301) redirect everything:
RewriteEngine On
RewriteRule ^(.*)$ [R=301,L]

Permanent (301) redirect some_page.htm (note to prefix your URL with “^/” and escape fullstops (.) with “\”):

RewriteEngine On
RewriteCond %{REQUEST_URI} ^/some_page\.htm
RewriteRule ^(.*)$ [R=301,L]

That’s all for now, folks!


Wireless setup on Debian (Fujitsu Lifebook S7110)

WARNING: The following set of instructions is based on my on experiences setting up my wireless card, which was a big pain. No guarantees that anything mentioned below should work, of course.

The S7110 uses the Intel® PRO/Wireless 3945ABG Network Connection adapter (iwl3945). Use “lspci” as root to find out what type of network card you have:

# lspci -nn | grep "Intel"
05:00.0 Network controller [0280]: Intel Corporation PRO/Wireless 3945ABG Network Connection [8086:4222] (rev 02)

Now we’re are good to go. You’ll need at least the 2.6.24 kernel, which is available on “lenny” onwards. If you’re using Etch (or even Sarge), tough luck. Significant upgrades to follow. Find out what kernel is loaded:

# uname -a
Linux woteba 2.6.26-1-686 #1 SMP Thu Aug 28 12:00:54 UTC 2008 i686 GNU/Linux

I’m using 2.6.26, which is recent. Otherwise add the following line to /etc/apt/source.list:

deb lenny main contrib non-free

Now use Synaptic Package Manager to download at least the following packages:


After everything is downloaded and set up successfully, you’ll need to restart, and choose 2.6.26 during the boot sequence. Once booted into the new kernel, try:

# modprobe iwl3945
# iwconfig
wlan0     IEEE 802.11  ESSID:"MakeTeaNotWar"
Mode:Managed  Frequency:2.412 GHz  Access Point: 00:1F:9E:CF:58:B0
Bit Rate=54 Mb/s   Tx-Power=14 dBm
Retry min limit:7   RTS thr:off   Fragment thr=2352 B
Encryption key:6565-1671-75
Link Quality=76/100  Signal level=-58 dBm  Noise level=-87 dBm
Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
Tx excessive retries:0  Invalid misc:0   Missed beacon:0

If “iwconfig” fails, you might need to download “wireless-tools”, using Synaptic. Good. The wireless card has been detected as “wlan0”. Your entries may differ, of course. The output above shows a connection to the router with SSID “MakeTeaNotWar”.

I use this software called “wlassistant”. It is a QT-based program, and has several dependencies, but it’s really easy to use. You can get it via Synaptic, of course. Once Wireless Assistant is up and running, you should be able to connect to most wireless networks.

References: Debian Wiki.


Hug a developer today…

Read the text comments here.

Programmer questions

What is the output for the following 3 code snippets?

$x = 3;

if (4 < $x) {
print "The quick brown fox jumps over the lazy dog.";
} else {
print "She sells seashells on the seashore.";
$x = 1;
$x = ++$x * 2;
print $x;
$x = 1;
$x = $x++ * 2;
print $x;


Google Chrome (BETA) for Windows

I just read the lengthy comic, and then downloaded it. Check it out here.

As far as I am concerned, the UI is pretty, and it feels faster than even Firefox 3. Way to go! I hope a (Debian) Linux version comes out soon!