Archive for August, 2008

Firefox 3: Restoring http://www. .com URL expansion behavior

Firefox 3 defaults to searching words entered in the URL area. This makes sense, as the Mozilla Foundation makes a bit of money every time they send a search to Google.

I don’t like this behavior, as there’s a perfectly good Google box to the right. If I type in google/calendar, I want http://www.google.com/calendar/, not Google’s search results for “google calendar”. After some searching, I found out how to disabling this feature, but it wasn’t in the first 10 things I found. So here’s a breadcrumb for the next person who prefers to partial URL canonicalization rather than using Google as a keyword finder (shades of AOL!).

http://support.mozilla.com/en-US/kb/Location+bar+search#Turning_off_and_on


Also, on the subject of Firefox 3.0.1, here’s the list of keyboard shortcuts, which appears to auto-customize to the browser’s reported OS.

And my first Firefox 3 bug: I was unable to cycle to the left of the left-most tab with Command-Shift-[; after I had cycled past the right-most tab, I was suddenly able to go past the left edge. Bizarre.

Comments

Time for More RAM

pepper@prowler:~$ top -l1|head -7
Processes:  105 total, 3 running, 4 stuck, 98 sleeping... 439 threads   20:08:26

Load Avg:  0.68,  1.05,  1.10    CPU usage: 22.86% user, 42.86% sys, 34.29% idle
SharedLibs: num =    4, resident =   41M code, 3032K data, 3172K linkedit.
MemRegions: num = 39625, resident =  824M +   20M private,  207M shared.
PhysMem:  269M wired, 1159M active,  554M inactive, 1990M used,   58M free.
VM: 16G + 374M   5256473(0) pageins, 1406422(0) pageouts

A pair of 2gb DIMMs are en route from NewEgg, for $75.

Comments (1)

MySQL Initial Setup Crib Sheet (RHEL5)

Update 2008/08/22: There’s actually a simpler command to create the database, once MySQL is secured and the account exists:

mysqladmin create newdatabase -u existinguser -p.


To test Movable Type, I needed a new MySQL installation on a CentOS 5.2 (equivalent to Red Hat Enterprise Linux 5.2) system. Here’s a crib sheet with the steps I took to set up a new MySQL installation.

Get and Start the Software

  • yum install perl-DBD-MySQL mysql-server # Install MySQL server and the DBD perl module that Movable Type needs to talk to it.
  • service mysqld start # Start MySQL server.
  • chkconfig mysqld on # Set mysqld (the MySQL ‘daemon’, or server) to run at boot in future.

Secure MySQL

MySQL uses internal accounts which are totally separate from UNIX accounts. My MySQL installation came with 3 distinct root accounts (without passwords); a RHEL4 system configured MySQL with a pair of anonymous accounts! In the past, I have used mysqladmin, which is quicker, but apparently it doesn’t do a complete job. MySQL offers [instructions on how to secure the initial accounts](http://dev.mysql.com/doc/refman/5To test Movable Type, I needed a new MySQL installation on a CentOS 5.2 (RHEL 5) system. Here’s a crib sheet with the steps I took to set up a new MySQL installation.

Get and Start the Software

  • yum install perl-DBD-MySQL mysql-server # Install MySQL server and the DBD perl module that Movable Type needs to talk to it.
  • service mysqld start # Start mysqld (the MySQL ‘daemon’, or server).
  • chkconfig mysqld on # Set mysqld to run at boot in future.

Secure MySQL

MySQL uses internal accounts which are totally separate from UNIX accounts. My MySQL installation came with 3 distinct root accounts (without passwords); a RHEL4 system configured MySQL with a pair of anonymous accounts! The MySQL RPM suggests securing the default accounts with mysqladmin, but the website points out that mysqladmin doesn’t get all the accounts. Fortunately MySQL offers instructions on how to secure the initial accounts manually.

mysql> select host, user from mysql.user;
+----------------+------+
| host           | user |
+----------------+------+
| 127.0.0.1      | root | 
| localhost      | root | 
| mmm.reppep.com | root | 
+----------------+------+
3 rows in set (0.00 sec)

In WordPress, each blog has its own account and database (that’s how I configure them, anyway). In Movable Type, a single account & database will be used for my whole Movable Type installation, which makes administration simpler.

  • Secure both root accounts by setting strong passwords.
  • Delete both anonymous accounts.
  • Create a new account for the blog.

To make sure I really did configure a required password for root, I logged out of MySQL and then tried to login without a password (which is how got in initially). This failed, telling me I had successfully disabled passwordless root access. Then I logged in as root with a password, to continue setting up MySQL tables. Note that I never supply passwords on the command line, because that’s insecure. Instead I supply the password when prompted by the mysql command, which keeps it out of command history and ps output.

  • mysql -u root # Log into MySQL, which doesn’t yet have a root password.
  • Delete the non-localhost root account.
  • Set passwords for root@127.0.0.1 & root@localhost.
  • Log out of mysql:
[root@mmm ~]# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> drop user 'root'@'mmm.reppep.com';
Query OK, 0 rows affected (0.00 sec)

mysql> set password for root@127.0.0.1 = password('unencryptedpassword');
Query OK, 0 rows affected (0.00 sec)

mysql> set password for root@localhost = password('unencryptedpassword');
Query OK, 0 rows affected (0.00 sec)
mysql> exit;
Bye
[root@mmm ~]# mysql -u root
ERROR 1045 (28000): Access denied for user 'root'@'localhost' (using password: NO)
[root@mmm ~]# mysql -u root -p
Enter password: 
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 4
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> exit;
Bye
[root@mmm ~]# 

Create a MySQL Database & Account for Movable Type

mysql> create database movabletype;
Query OK, 1 row affected (0.01 sec)

mysql> grant all on movabletype.* to movabletype@127.0.0.1 identified by 'unencryptedpassword';
Query OK, 0 rows affected (0.00 sec)

Backups

I’m not covering MySQL backups here, but I use http://sourceforge.net/projects/automysqlbackup/.

Comments

Red Hat Kickstart without DHCP

Red Hat Kickstart is the right way to install RHEL, but Red Hat’s Linux documentation assumes the host can boot via DHCP. If DHCP (or bootp) isn’t available, there are some obscure options to provide the network configuration on the linux command line (at the boot: prompt). These options are ip, netmask, gateway, and dns, as in:

linux ks=http://10.10.10.100/kickstart.cfg ip=10.10.10.101 netmask=255.255.255.0 gateway=10.10.10.1 dns=10.10.10.100

I found several pages of kickstart docs which are missing these options, but they are listed on http://www.redhat.com/docs/manuals/enterprise/RHEL-5-manual/Installation_Guide-en-US/s1-kickstart2-startinginstall.html.

Comments

Suggested iPhone apps

Frank just got an iPhone, so I was listing off suggested apps, and decided to post the list. Almost all of them are free.

  • NetNewsWire/iPhone: RSS reader which synchs with NNW on Mac, FeedDemon on Windows, and Newsgator Online; all are free
  • Instapaper: Multi-computer bookmarking service — links to http://www.instapaper.com/
  • (paid) Twitteriffic Premium (Free shows ads): http://twitter.com/reppep
  • Stanza: ebook reader
  • Remote: iTunes & AppleTV control
  • (paid) TouchTerm: ssh client
  • (paid) pTerm: ssh client
  • Facebook
  • AIM (just for free SMS)
  • Now Playing
  • Scribble: need a drawing program to play with Julia
  • Shazam: identifies recorded music the iPhone can “hear”
  • Shakespeare: complete works
  • Yelp (Amy likes)
  • Google

Games

  • (paid) Toy Bot
  • Phone Saber
  • Fire Drop
  • Moonlight Mahjong Lite
  • Labyrinth LE
  • Life
  • Tap Tap Revenge
  • Advent (I don’t play it, but keep it for the ecstasy it will someday induce in an old Zork fan)

Comments (1)

UltraEdit

I’ve been a serious BBEdit user for years (I suspect a beta password many years ago was a joke at my expense). I use vi daily but am not a fan, and I find emacs inexplicable. As an system administrator, editing text files (typically configuration files and scripts) is a large part of my job.

So spending my days using Windows, with no BBEdit, was a concern.

I used kate a bit, and it’s not bad, but it’s limited (cannot even compare 2 windows!), and Exceed’s Copy & Paste support is extremely erratic.

Many people suggested UltraEdit, but due to an installer issue, I was unable to use it. That issue has been fixed, and I got it running today. I’m quite impressed, although I have already discovered that its sorting capability is downright feeble compared to BBEdit’s GREP-enhanced sorting. I see that UltraEdit offers 4 different flavors of Find & Replace: Plain, perl regex, UNIX regex, and UltraEdit regex. This seems crazy to me — I consider anything that’s not 100% backward-compatible with PCRE a bug, but I am not selling to a population of users who live in MS Word.

Truly weak: Find for $ doesn’t work properly in perl regex mode with UNIX line endings.

I am both impressed and mildly aggravated. UltraEdit is much better than anything else I’ve used on Windows (or Linux or Solaris), but it’s also less polished than BBEdit. I’m not sure how much of my frustration is because I have the advantage of years of experience of BBEdit — compared to only a few hours to learn UE so far — and how much is real deficiencies and lack of polish in UE.

Comments

Indirection in Configuration Management

“Give me a place to stand and a lever long enough and I will move the world.”

I was grumbling under my breath at a configuration management system today, and reminded of this wonderful statement by Archimedes.

Configuration management is the discipline of building systems which manage other systems — cfengine is a well-known open source example. I needed to reboot a few hosts on a regular schedule — easily handled in 5 minutes with “vi /etc/crontab” on each, or an ssh loop to append to the crontab on each affected system. I was struck by how many levels of indirection I needed to traverse to get this done with configuration management. This in turn prompted some thought about why jumping through the various hoops was worthwhile.

There are many excellent reasons to use configuration management:

  • Time savings — over repeating the same actions over and over; this increases with the number of hosts involved.
  • Consistency — configuration management ensures that (portions of) systems which should be identical really are.
  • Reproducibility — because CMS is naturally tied into version control, it is easy to either examine or recreate the state of affairs at an arbitrary time in the past.
  • Modeling — a CMS ends encompasses a representation of all the systems it manages. This efficient representation of those systems is quite useful for examining and comparing them. It’s especially useful with a large or dynamic population of administrators, as it provides a single place to learn about the whole constellation of systems, and enforces some consistency among the various ways admins can manage systems.

In the simplest case, to make a machine reboot once, I could pull the plug and put it back (assuming I was near, or could get to, the machine). In a non-CMS scenario, I would do it with ssh and the shutdown -r. In this case, it was considerably more involved:

  • Launch PuTTY.
  • Log into a system with a checkout of the CMS configuration files.
  • Find the appropriate file (non-trivial if the managed constellation is complicated).
  • Fetch the latest version of the file (with multiple users, it’s unlikely my checkout is current).
  • Edit the file corresponding to /etc/crontab or /var/spool/cron/root (I used kate, as I don’t enjoy either vi or emacs, and BBEdit wasn’t available); kate popped back an X11 session tunneled through ssh.
  • Create a pair of local machine sets in the file (cfengine calls these ‘aliases’), each including half the covered systems (the systems reboot at staggered times, so they’re not all down at once).
  • Create the pair of crontab lines, one for each machine set, embedding the pair of different reboot times and the shutdown -r command.
  • Check the modified crontab file back into the version control system; enter a message for the change log.
  • In a distributed CMS, staging hosts pick up the changes from version control, either on a schedule or when manually kicked for emergency/rush changes.
  • The affected hosts pick up the change from the CMS, and implement the specified change.

The reason Archimedes’ quote is apropos is that configuration management provides excellent leverage — I can edit one file in one place, and easily affect several systems (potentially hundreds or thousands). Each hoop I have to jump through provides an additional fulcrum. I can sit at my desk and use PuTTY to log into dozens of systems, across the world — without even knowing where they are. Each change I make to the version control system is automatically picked up by every host participating in the system, and available to every admin with a checkout. I don’t have to log into 8 machines (even uninteractively) to make them reboot — I can orchestrate it all from my local workstation.

Unfortunately, mistakes are leveraged too; there is often no good way to test changes to production systems during business hours. If the changes are restricted to non-production hours, when the admin might not be around to monitor them (and shouldn’t have to — it’s an automated system, after all!), the window could be closed by the time the admin sees whether the change was successful. Missing a change window can easily defer a change 24 hours.

Comments

iPhone 2.0 Subtleties

I upgraded to iPhone OS v2.0 a while before I got a 3G iPhone (very worthwhile for me, since I spend most of my time outside Wi-Fi coverage now). Since the upgrade, I have noticed a few things which I have not seen mentioned elsewhere.

Continual pseudo-GPS updating in original models

On my original iPhone under iPhone OS v1.x, tapping the crosshair button in Maps used to locate me — the button turned blue while the iPhone was fixing my location, then turned grey again when done. To update my location I had to tap the button to get a new location fix. Under v2.0, after tapping the button it stays blue, and the iPhone updates my location automatically until I tap again (to turn it grey and switch location auto-updating off) or exit Maps. This is well-known on 3G models, but I was surprised and pleased to see auto-relocation on the original iPhone.

Pause to rotate (walker unfriendly)

Under iPhone 1.x, I could rotate the iPhone to re-orient Safari while walking. Under v2.0 the iPhone does not reorient while I am walking — I have to stand still for it to notice the change in orientation and rotate. Annoying, as it means I will have to stop in the middle of crowds to trigger rotation.

More switches to iPod.app when resuming music playback?

Under v1.x, after a sync or reboot, the first time I hit the earphone button to start music playback, the iPhone would switch into iPod mode, but I could stop and start without switching into iPod mode. I have a feeling that it switches into iPod mode sometimes now (after I first started and stopped playback), at times when it would not have before. This is unconfirmed, though.

Upside-down for iPod videos

I believe this changed from v1.1.4 to v2.0, but could be wrong about when. In earlier software versions, iPod movie playback only worked when rotated 90° counterclockwise. Alex hates this, as it puts the speakers behind your right hand. With v2.0, iPod movies can also be played back 90° clockwise, which puts the speakers under the left hand. YouTube still only works counterclockwise, though.

Loss of background functionality with apps vs. Safari

I am very happy with NetNewsWire, Twitteriffic, and Instapaper, but iPhone 2.0 doesn’t let them run in the background. This means NetNewsWire and Twitteriffic always need to update when I launch them, as opposed to the Mac apps which update automatically in the background. It also means I cannot multitask — when I was using NewsGator Online and m.twitter.com, I was able to switch between Safari tabs and Mail, and keep them working in the background as I switched to whichever was done. The apps are much better than the webapps, but the regression of having to wait really bugs me. Fortunately it’s lessened somewhat by the 3G iPhone’s improved update speed.

Another disappointment is that neither NetNewsWire nor Twitteriffic supports rotation. I thought Apple didn’t support it outside Safari proper (both NetNewsWire and Twitteriffic incorporate the WebKit engine Safari uses) until I realized Instapaper supports rotation, and Stanza supports rotation (even upside-down, which Safari does not). I’m sure there are real reasons Brent & Craig have not yet provided rotation in their apps, but as I understand it, they are not allowed to discuss them, or how Instapaper & Stanza do it — even under NDA, despite the fact that this is released software!

On the other hand, reading Slashdot via NewsGator Online stunk. The delay to get each article was very aggravating, and NGO was useless on the train. NNW/iPhone makes reading Slashdot a pleasure.

Also, Remote is great.

Comments