Programmer questions

What is the output for the following 3 code snippets? // Snippet 1 $x = 3; if (4 < $x) { print "The quick brown fox jumps over the lazy dog."; } else { print "She sells seashells on the seashore."; } // Snippet 2 $x = 1; $x = ++$x * 2; print $x; // Snippet 3 $x = 1; $x = $x++ * 2; print $x;

Google Chrome (BETA) for Windows

Nice comic book published at http://www.google.com/googlebooks/chrome/; I promptly downloaded Chrome, of course, from http://www.google.com/chrome/. The UI is pretty sweet, and it feels faster than Firefox 3. Way to go! I hope a (Debian) Linux version comes out soon!

Useful MySQL commands

# Set the auto_increment value (e.g. `id`) to one more the highest `id` value currently alter table `foo` auto_increment=1; # Show how MySQL will parse this query, including key (indices) used and any additional parameters explain select * from `foo`; # Show indices for the given table show keys from `foo`;

Disk usage sorted by file size

The following shell command runs the du command to a max folder depth of 1, pipes its output to sort, and the finally writes it du_log; e.g., du -h --max-depth=1 | sort -n -r > du_log

xDSL Internet connection sharing

Want to share your xDSL Internet connection? You’ll need three devices: A xDSL modem; A router (optionally, wireless); One (or more) machines. Some of the newer modems have router/switch functionality, but we’ll focus on making the modem act as a bridge, a so-called dumb device, between the Wide Area Network (WAN) and your Local Area Network (LAN); which comprises of your router and machine(s). If you already have an existing xDSL service, you will already own a modem and host machine, so all you will need in addition is a router; I recommend the Linksys WRT54G (or WRT54C is OK too), which has served me faithfully.