Wednesday, July 30, 2008

Use your laptop to detect earthquakes


Wow!

The Quake-Catcher Network lets you tap into the accelerometer in your laptop to detect and report earthquakes. (Note that not all laptops have accelerometers in them yet).

Apparently, the Quake Catcher Network detected the recent Los Angeles 5.4 earthquake in 7 seconds.

Brilliant!

Update: The only downloadable clients available now are for Macs. They're working hard on a Windows version.

Thursday, July 17, 2008

New portupgrade features: portversion origin and fullname flags, pkgdu

portupgrade's portversion command is handy tool for tracking which third-party packages on your FreeBSD system have newer versions available.

portversion has some new flags and features in version 2.4.6 (committed just yesterday), and a new utility called pkgdu.

First, here's a quick summary of the changes to portversion. (This is just a simplified diff between the previous manpage and the current one):
<    portversion [-hrOqRv] [-l limit_chars] [-L inv_limit_chars]
> portversion [-hFOoQqRrv] [-l limit_chars] [-L inv_limit_chars]

> -F
> --fullname Display a package full name.
>
> -o
> --origin Display package origin instead of package name.
>
> -Q
> --quiet Do not display status chars.
>

Now, for some usage examples. In these examples, I'm using -L = to leave out all lines of output that indicate that the installed version and the version available in the ports tree are equal).

portversion now defaults to not showing the version on the left-hand side.
[royce@heffalump ~]$ portversion -v -L =
lsof < needs updating (port has 4.81A,2)
mytop < needs updating (port has 1.6_4)
net-snmp < needs updating (port has 5.4.1.2)
p5-Pod-Parser < needs updating (port has 1.35_2)
p5-Sub-Uplevel < needs updating (port has 0.1901_1)
p5-Test-ClassAPI < needs updating (port has 1.05)
p5-Test-Harness < needs updating (port has 3.12)
p5-version < needs updating (port has 0.75.01)
rsync < needs updating (port has 3.0.3)
sudo < needs updating (port has 1.6.9.17)
vim < needs updating (port has 7.1.330)

The new default behavior looks cleaner, but if you're used to the old output, it does make it hard to tell just how out of date you are. You can use -F to get the old behavior (with the version number of the currently installed software is displayed):
[royce@heffalump ~]$ portversion -vF -L =
lsof-4.80,2 < needs updating (port has 4.81A,2)
mytop-1.6_3 < needs updating (port has 1.6_4)
net-snmp-5.4.1_5 < needs updating (port has 5.4.1.2)
p5-Pod-Parser-1.35_1 < needs updating (port has 1.35_2)
p5-Sub-Uplevel-0.1901 < needs updating (port has 0.1901_1)
p5-Test-ClassAPI-1.04 < needs updating (port has 1.05)
p5-Test-Harness-3.11 < needs updating (port has 3.12)
p5-version-0.75 < needs updating (port has 0.75.01)
rsync-3.0.2_1 < needs updating (port has 3.0.3)
sudo-1.6.9.15_1 < needs updating (port has 1.6.9.17)
vim-7.1.315 < needs updating (port has 7.1.330)

You can display the ports' origins instead with -o. If you're not sure what a particular port is, you can get a good idea by knowing what subdirectory it's in:
[royce@heffalump ~]$ portversion -o -v -L =
sysutils/lsof < needs updating (port has 4.81A,2)
databases/mytop < needs updating (port has 1.6_4)
net-mgmt/net-snmp < needs updating (port has 5.4.1.2)
textproc/p5-Pod-Parser < needs updating (port has 1.35_2)
devel/p5-Sub-Uplevel < needs updating (port has 0.1901_1)
devel/p5-Test-ClassAPI < needs updating (port has 1.05)
devel/p5-Test-Harness < needs updating (port has 3.12)
devel/p5-version < needs updating (port has 0.75.01)
net/rsync < needs updating (port has 3.0.3)
security/sudo < needs updating (port has 1.6.9.17)
editors/vim < needs updating (port has 7.1.330)

What I'd love to see is an option that leaves the fullname data, but
puts whitespace between ... so that I can still see versions, but
have easy one-click highlighting of the package name:
lsof 4.80,2                 <  needs updating (port has 4.81A,2)
mytop 1.6_3 < needs updating (port has 1.6_4)
net-snmp 5.4.1_5 < needs updating (port has 5.4.1.2)
p5-Pod-Parser 1.35_1 < needs updating (port has 1.35_2)
p5-Sub-Uplevel 0.1901 < needs updating (port has 0.1901_1)
p5-Test-ClassAPI 1.04 < needs updating (port has 1.05)
p5-Test-Harness 3.11 < needs updating (port has 3.12)
p5-version 0.75 < needs updating (port has 0.75.01)
rsync 3.0.2_1 < needs updating (port has 3.0.3)
sudo 1.6.9.15_1 < needs updating (port has 1.6.9.17)
vim 7.1.315 < needs updating (port has 7.1.330)

... or even:
lsof                        <  needs update (inst: 4.80,2     port: 4.81A,2)
mytop < needs update (inst: 1.6_3 port: 1.6_4)
net-snmp < needs update (inst: 5.4.1_5 port: 5.4.1.2)
p5-Pod-Parser < needs update (inst: 1.35_1 port: 1.35_2)
p5-Sub-Uplevel < needs update (inst: 0.1901 port: 0.1901_1)
p5-Test-ClassAPI < needs update (inst: 1.04 port: 1.05)
p5-Test-Harness < needs update (inst: 3.11 port: 3.12)
p5-version < needs update (inst: 0.75 port: 0.75.01)
rsync < needs update (inst: 3.0.2_1 port: 3.0.3)
sudo < needs update (inst: 1.6.9.15_1 port: 1.6.9.17)
vim < needs update (inst: 7.1.315 port: 7.1.330)


Finally, here's the new pkgdu command, which shows disk space used by the
port and pretty much speaks for itself:
[royce@heffalump ~]$ pkgdu | sort -n | tail -20
970 ruby18-bdb-0.6.4
1151 perltidy-20071205
1332 gmake-3.81_3
1512 p5-Perl-Critic-1.08.5
1740 p5-DBI-1.60.4
1853 pcre-7.7
2235 bash-3.2.39_1
2255 autoconf-2.61_2
2385 joe-3.5_1,1
2492 libtool-1.5.26
3147 libiconv-1.11_1
3453 mysql-client-5.0.51a
7548 net-snmp-5.4.1_5
8946 ruby-1.8.6.111_4,1
9322 db41-4.1.25_4
9561 aspell-0.60.6_2
10182 gettext-0.17_1
12822 coreutils-6.9_3
28953 perl-5.8.8_1
30434 vim-7.1.315