Recently in Computers Category

NAND-OR's White Camel

| | Comments (0)

I am sitting in Damian's talk on rod logic, which followed the White Camel Awards, and perhaps I should have named the album NAND-OR's White Camel instead of Nandor's White Castle. use.perl.org

Time Capsule Software Broken

| | Comments (0)

Brand new 500 MB Time Capsule. Latest firmware, latest AirPort software, latest Mac OS X version.

One of my computers, a Titanium PowerBook, connects just fine and backups and it all seems happy and joyous.

My other one, the MacBook Pro ... not so much. No matter what I try, I get "The backup volume could not be mounted." Here's the system log:

Jun 18 00:49:47 bourque kernel[0]: AFP_VFS afpfs_mount: /Volumes/Shore, pid 206
Jun 18 00:49:47 bourque /System/Library/CoreServices/backupd[327]: Backup requested due to disk attach
Jun 18 00:49:47 bourque /System/Library/CoreServices/backupd[327]: Starting standard backup
Jun 18 00:49:47 bourque /System/Library/CoreServices/backupd[327]: Network mountpoint /Volumes/Shore not owned by backupd... remounting
Jun 18 00:49:47 bourque /System/Library/CoreServices/backupd[327]: [SnapshotUtilities remountVolumeRef] url could not be resolved via BonJour
Jun 18 00:49:47 bourque /System/Library/CoreServices/backupd[327]: Failed to remount network volume.
Jun 18 00:49:52 bourque /System/Library/CoreServices/backupd[327]: Backup failed with error: 19

It's some sort of authentication problem. I could not figure out what it is, tried everything. Tried messing with the Keychain, tried deleting all prefs. Nothing works. I saw a bunch of other people online with the same problem; some had fixed it, some had (apparently) not.

Eventually I figured out that if I mounted the volume as root -- which is what backupd runs as -- then it works just fine.

$ mkdir /Volumes/Shore
$ sudo mount_afp afp://pudge:mypassword@Shore.local/Shore /Volumes/Shore

Then I can run Time Machine and all is happy. Until the next time.

So I wrote this script that gets called from root's crontab. It basically does the same thing (though not quite as "neatly") as Time Machine itself should. Until Apple fixes this insanely stupid bug -- you'd think the thing would work out of the box! -- it should keep me going, although to actually enter Time Machine, I need to manually mount the sparsebundle that's sitting on the Time Capsule, but I can do that without root.

#!/usr/bin/perl
use warnings;
use strict;
 
my $backupd = '/System/Library/CoreServices/backupd.bundle/' .
	'Contents/Resources/backupd-helper';
 
# put password in this file, chmod 0600
my $passf = '/Users/pudge/.backupd-helper-helper';
my $user  = 'pudge';
my $share = 'Shore.local';
my $vol   = 'Shore';
 
chomp(my $pass = do { open my $fh, '<', $passf; <$fh> });
my $dir   = "/Volumes/$vol";
my $url   = "afp://$user:$pass\@$share/$vol";
 
 
rmdir $dir; # let fail silently, we only want to remove if dir is empty,
            # and if it doesn't exist, that's OK too
mkdir $dir or die "Can't mkdir $dir: $!"; # NOW complain loudly if it fails
system '/sbin/mount_afp', $url, $dir;
system $backupd;
 
# usually not necessary, but will fail silently
system '/sbin/umount', $dir;
 
__END__

use.perl.org

So our design guy tells us that it would be much better if, instead of throwing in double <br> tags for paragraphs, we changed it to <p> tags. Oh, and make sure it works in XHTML in case we want to use that someday, which means we need starting and ending tags.

So, this is sortof a pain, doing it right. I am trying to think of all the potential problems, and there's a bunch. So I put in a paragraph tag for the double-linebreak tag, but where do I put the ending tag? What algorithms do I use to find the right place? Pain.

And then I remembered that all comments get passed through a function I wrote several years ago called balanceTags(). You can basically throw any HTML you want at it, and it will return valid HTML. It will balance unbalanced tags (including paragraph tags), it will make sure blockquote tags include block tags inside them, and so on. If the "xhtml" flag was on, it will even make lone tags like linebreaks and images (and some paragraphs) into proper XHTML tags. So switching to XHTML is as simple as flipping the switch.

Therefore, all I had to do is find out where to put the open paragraph tags, and balanceTags() takes care of the rest. Hooray! So in this case it means putting a paragraph tag at the beginning of each comment (which is something I've wanted to do for awhile anyway), and then another one at each double-linebreak, and we're golden.

I was worrying about doing it right for nothing, since I'd already done it right years ago! use.perl.org

The slashd program in slash runs "tasks" which are separate files. It performs a require(). The problem is that sometimes symbols in each task can conflict with another.

We have many tasks so rather than edit each one, we decided to handle the encapsulation in slashd itself. It creates a package name, and has code to import symbols from main into the package, and then sets the line number correctly.

		(my $tmppackage = $file) =~ s/\.pl$//;
		$tmppackage =~ s/\W/_/g;
		$tmppackage =~ s/^([^a-zA-Z])/a_$1/g;
		$tmppackage = "Slash::Task::$tmppackage";
 
		# replace tmppackage in string where appropriate
		(my $addtxt = <<'EOT') =~ s/\${?tmppackage}?/$tmppackage/g;
 
package $tmppackage;
 
{ no strict 'refs';
	my @scalar = qw(me task_exit_flag);
	my @hash   = qw(task);
	my @code   = (qw(
			slashdLog slashdErrnote slashdLogDie
			tagboxLog verbosity db_time init_cron
		),
		grep { *{"main::$_"}{CODE} }
			@Slash::EXPORT, @Slash::Display::EXPORT,
			@Slash::Utility::EXPORT,
			@File::Spec::Functions::EXPORT,
			@LWP::UserAgent::EXPORT, @URI::Escape::EXPORT,
			@File::Basename::EXPORT, @File::Path::EXPORT,
			@Time::Local::EXPORT, @Time::HiRes::EXPORT
	);
 
	*{"${tmppackage}::$_"} = *{"main::$_"}{HASH}   for @hash;
	*{"${tmppackage}::$_"} = *{"main::$_"}{SCALAR} for @scalar;
	*{"${tmppackage}::$_"} = *{"main::$_"}{CODE}   for @code;
}
 
#line 1
EOT
 
		my($tmpfh, $tmpfile) = tempfile();
		my $tmptxt = do { open my $fh, '<', $fullname; local $/; <$fh> };
		print $tmpfh $addtxt, $tmptxt;
		$tmpfh->flush; # can't close fh until we require the file,
		               # else the file might disappear
 
		my $ok = 0;
		eval { local $me = $file; $ok = require $tmpfile };

use.perl.org

Respond to this spam OR DIE!

| | Comments (1)

Literally, I am told that I need to respond to this spam, or die. Since "please give me money, and I'll give you more in return" isn't working anymore, I guess it's time to resort to threats. Apparently this is new; I see some mentions of it, all from this month. Pretty funny, really. Complete spam is enclosed below; if I do die, you can use the header information to avenge me or something.

From: adamsjamil9@gazeta.pl
Subject: Mr SOMEONE YOU CALL YOUR FRIEND, WANTS YOU DEAD.
Date: May 17, 2008 6:36:03 PDT
To: undisclosed-recipients:;
Received: by 10.142.171.6 with SMTP id t6mr2004920wfe.12.1211031363667; Sat, 17 May 2008 06:36:03 -0700 (PDT)
Received: by 10.142.104.18 with HTTP; Sat, 17 May 2008 06:36:03 -0700 (PDT)
Return-Path: <SRS0=SQW4=WA=gazeta.pl=adamsjamil9@bounce2.pobox.com>


I felt very sorry and bad for you, that your life is going to end like this if you don't comply. I was paid to eliminate you and I have to do it within 10 days.

Someone you call your friend wants you dead by all means, and the person have spent a lot of money on this, the person also came to us and told us that he wants you dead and he provided us your names, photograph and other necessary information we needed about you. If you are in doubt with this I will send you your name and where you are residing in my next mail.

Meanwhile, I have sent my boys to track you down and they have carried out the necessary investigation needed for the operation, but I ordered them to stop for a while and not to strike immediately because I just felt something good and sympathetic about

Now do you want to LIVE OR DIE? It is up to you. Get back to me now if you are ready to enter deal with me, I mean life trade, who knows, and I might just spear your life, $8,000 is all you need to spend. You will first of all pay $3,500 then I will send the tape of the person that want you dead to you and when the tape gets to you, you will pay the remaining $4,500. If you are not ready for my help, then I will have no choice but to carry on the assignment after all I have already being paid before now.

Warning: do not think of contacting the police or even tell anyone because I will extend it to any member of your family since you are aware that somebody want you dead, and the person knows some members of your family as well.

For your own good I will advise you not to go out on.

slashdot.orguse.perl.org

Cell Phone Lunacy

| | Comments (1)

T-Mobile is my cell phone provider. I "upgraded" my old Nokia 6600 (four years old now, at least) to a Nokia 6263 for free. But when I got it, I found that -- with the exact same SIM card, same account, same network -- it would not run downloaded network apps like Google Maps.

This makes it subuseful.

So I call them up, and they would apparently rather have me return my phones and cancel my service altogether than give me a working phone. Oh they say they can give me a Blackberry, but it will cost more, and I don't want a Blackberry. And I would rather go phoneless than use a Windows phone.

So I need to either get this phone uncrippled, or find a new cell phone provider. Suggestions welcome.

Finding Lost Cell Phone

| | Comments (0)

While travelling last week I had my cell phone out, and I set it down and couldn't find it when it came time to board. I looked all over and thought it was just lost. I couldn't pull all my bags apart, as I didn't have time while boarding, so it was still possible I had it. I figured, however, I would not give it up entirely until I tried one more thing to find it.

I had been using my Bluetooth headset thingy, and I knew it had plenty of battery, so chances are if it was in the bag, the Bluetooth was still on. So when I got into my next destination, I pulled out my laptop and did a Bluetooth device scan. Sure enough, there it was. Either it was in my bag, or the person who stole it was still nearby.

It was buried in my bag. use.perl.orgslashdot.org

Stupid File Size Calculations

| | Comments (0)

I back up my PS3 to a USB drive, which has a FAT32 partition. The archive folder reported only 3.2GB, but there was about 7.2GB in use.

The Finder and du both reported 3.2GB. I finally tracked it down to a file that is 4GB, but reports as 0. Most of the time. Note that even ls -s gets it wrong, but ls -l gets it right.

$ du archive2_00.dat 
0	archive2_00.dat
$ ls -s archive2_00.dat 
0 archive2_00.dat
$ ls -l archive2_00.dat 
-rwxrwxrwx  1 pudge  pudge  4294966784 Feb 21 22:21 archive2_00.dat

The Finder was similarly confused:

Well, There's Your Problem

use.perl.org

Now Playing: Writ On Water - Trappease

*Really* Stupid Mac::Glue Tricks

| | Comments (0)

I keep all my music in lossless format (unless acquired compressed, such as through iTunes Music Store), so I am guaranteed it will sound perfect on my home systems, and so if I ever want to re-encode, I have the originals: no need to re-rip.

I have a pair of Perl scripts that convert those lossless files to 128 kbps AAC for use on the iPods. The first script will mount the drive of the iPod computer over the network, and compress any lossless file (using Mac::Glue/iTunes) that does not exist on the remote drive, or if it does exist, if it was last modified since the modification date of the lossless file. It will also straight copy any non-lossless file, and then write out text file representations of my playlists.

On the remote computer, the original computer's drive is mounted, and the first thing it does is look to make sure that every file in its directories exists on the original drive. If not, it deletes the file. Then it goes through iTunes (again, with Mac::Glue) and removes any library tracks whose file is missing from the filesystem. Then it adds any files from the filesystem missing in the library, and finally, recreates the playlists.

So last weekend I ran the first program, then the second. I came back to find the entire iPod library gone. What had happened is that the mount failed somehow, but the directory for it was there, so it was looking for the original files in an empty directory, and deleting files that didn't match, which was all of them.

Oops.

So now I am recreating the whole library, which is a simple -- but very slow -- matter of re-running the first program, then the second. I estimate it will take about 3-4 days, running nonstop (it's a G4/867 doing the main encoding job), for about 8500 files, with maybe 6000 or so of those needing encoding.

Of course, I patched the second program to make sure that the mount point really is there. A simple matter of looking for the existence of a directory or file that will absolutely be there if the mount is correct, and will not be created by the program -- so should not exist -- if it is not.

I run the first program again. Everything is basically fine ... until my local hard drive fills up.

Same problem again, on the other side: the mount failed, and so it is copying files TO the wrong place: the local drive.

At least I didn't lose much time: I move those files out of the way, mount the remote drive, and copy them into place. Then I patch the second program in the same basic way, and run it again.

Hopefully it all works this time. I've run these programs many times over the last few years, and then two failures of the same type on different machines in the same week. Weird. use.perl.org

So I tried connecting our Jabber bot to our new Jabber server (OpenFire). It wasn't happy.

At first I thought it might be SSL, and after wrestling with that and many other things, I finally decided to randomly comment out things I didn't understand. Well, not randomly: one of the errors I kept seeing when I was pretty sure I had everything right was:

Can't use an undefined value as a HASH reference at
/usr/local/lib/perl5/site_perl/5.10.0/XML/Stream.pm line 1165.

But I don't know what the heck is going on in there. Poking around though, I see that $self->GetRoot($sid) is returning undef, and right above that, there's a call to delete($self->{SIDS}->{$currsid}). And GetRoot($sid), in fact, accesses $self->{SIDS}->{$sid}.

So I add in some print statements and see that, in fact, $sid and $currsid are the same.

So, I says to myself, comment out the delete call. And so I do. And so it works.

I don't know why that was necessary. And I should send this to the XML::Stream author. Tomorrow. use.perl.org

I have been using a MacBook Pro for several months, and I finally got around to upgrading Perl on it. I figured 5.10's release, and Christmas vacation, was a decent opportunity.

I ran into a lot of problems.

  • First, note that my existing Perl/Apache installs were PPC. And this is an Intel Mac. And because some systems are not very careful about what they use to do things, I had to make sure I basically hid all the PPC things in my path. For example, a PPC perl in my path was used for part of the mod_perl build process, even though I used an Intel perl for the Makefile.PL, which caused some symbols to go missing.

  • Similarly, the Apache config kept picking up a random library I had in /usr/local/lib, and throwing errors. So I finally figured I should just move all of /usr/local/bin and /usr/local/lib out of the way until I got everything built. I selectively brought things back later.

  • But this was not my only problem with Apache. Oh, no. Apparently mod_perl 1.30 and perl 5.10 simply do not get along. I kept getting errors about bad file descriptors every time I tried to start Apache. I finally found discussion from p5p about it, from a few weeks ago, and used Andreas Koenig's patch for mod_perl, taken from Steve Hay's fix slated for mod_perl 1.31. This fixed the problem, apparently.

  • However, apparently this patch only works for fixing non-threaded perl. So I then had to rebuild perl to be non-threaded. I had wanted to keep my perl config as close to the default Mac OS X build as possible, for binary compatiblity reasons, but it's not that important, I suppose, since 5.8 and 5.10 are not binary compatible anyway, and Mac OS X 10.6 (the first likely to use 5.10.x) won't be out for a long time. So, I don't need threads, and therefore, non-threaded it is.

  • And then there was libapreq. I don't know how to properly solve this problem, but I kept getting errors about my_perl being undeclared in two functions, hooks for uploading files. As I don't use that functionality, I simply commented out the body of the functions. It was getting late.

  • Most of the other modules were pretty smooth though. DBD::mysql kept looking for the mysql libraries in /usr/local/mysql/lib/mysql instead of /usr/local/mysql/lib. I couldn't see an obvious reason why, so I just added a symlink. Shrug.

  • Also, Mac::Carbon had some errors in the tests. Those should be fixed, but I have a lot of other fixes to make before uploading a new version. More on that some other time. The broken test was for Mac::AppleEvents, and I even have a comment in there about how the tests were very likely to be broken. I was right!

  • Mac::Glue posed a problem: the glue files are not byte-order independent. Maybe they should be, but that won't help me now. So I needed to rebuild all my glue files, which isn't a big deal.

  • Also not byte-order independent: the "friends" field in the Slash database. Like the glue files, it uses Storable. I know there are ways to make it work, but I did not use those ways previously, so now I am stuck. For Slash, I just wrapped the thaw() call in an eval for now, but I'll pull that later, after I call the rebuild task.

  • Speaking of modules, what got all this started was that I was trying to build XML::LibXML for my MacBook Pro so I could use XML::Atom to make posts from BBEdit to <pudge/*>. But building a PPC binary for an Intel machine ON an Intel machine turned out to be just too much for me. So I figured it was time to just start over.

  • The CPAN autobundle worked pretty well, although after installing Bundle::CPAN and Bundle::Slash, I then took my autobundle and wrote a quick script around it to basically call perl -M$module -e1 and note any errors, and that way I could skip most of the bundle, since I am still using the pure perl version of many modules, that I already had installed, and I don't necessarily want to install every upgrade to every module, since some of them can break (cf. XML::RSS). Then I scanned the uninstalled/broken module results and installed any I wanted by hand.

  • I make note here that Data::JavaScript::Anon is "still broken." Version 0.9 is broken, version 1.00 works, but CPAN still gives me version 0.9 unless I ask for 1.00 specifically, and so when I installed Bundle::Slash, I got the wrong one. But that has nothing to do with this, it's just Something Else.

Bottom line is that now I have Slash running on my Intel Mac with native Apache 1.39, mod_perl 1.30 (with patch), and perl 5.10 (without threads), and the only brokenness -- that I know of -- that remains is missing functionality in Apache::Request that I don't use, and lack of thread-capable perl for mod_perl.

It was a long day making all that work, too. Dang it was long. Lots of futzing around. But I also now apparently have almost no more PPC apps running on a regular basis on my Mac: just Eudora. Which sucks. But not as much as every other mail app. I dunno, maybe I should give Thunderbird another go. I hate that it is not a native Mac UI, but it's not like Eudora has a great UI either. Maybe I'll try Mail.app again. use.perl.org

Leopard, CoreFoundation, and exec()

| | Comments (0)
Under Leopard, using Mac::Carbon:

[pudge@bourque ~]$ happening
Running background process /Users/pudge/bin/happening (983)
The process has forked and you cannot use this CoreFoundation functionality safely. You MUST exec().
Break on __THE_PROCESS_HAS_FORKED_AND_YOU_CANNOT_USE_THIS_C OREFOUNDATION_FUNCTIONALITY___YOU_MUST_EXEC__() to debug.

Apparently, fork-without-exec with CoreFoundation has always been bad. But it is now an exception.

So in the happening program, I had:

$pid = fork;
exit if $pid;

Now I have:

if (!$nofork) {
    $pid = fork;
    exit if $pid;
    exec($0, '-nofork');
}

YMMV. use.perl.org

Beards

| | Comments (0)
Many people on YouTube are commenting on my beard.

For what it's worth, I've had this beard for 16 years, and it's not coming off any time soon. (I've had *a* beard for about 18 years, but I periodically shaved it until first semester of my freshman year of college. It's existed ever since.)

use.perl.org
It thinks I am Japanese. Tiger Front Row did not.

It does not show cover art for shared sources. Tiger Front Row did.

When I am fast-scrolling down a list of items, and I see the item I want, and so I let go of the button to stop scrolling, I go way past that item as the list slows to a stop. Tiger Front Row stopped pretty much immediately, on or near the thing I wanted.

It does not have any way to repeat. At least with Tiger Front Row, I could use my (non-Apple) remote to tell iTunes make the currently playing playlist to repeat. I'd hit play in Front Row, then hit the button to call my "Repeat" AppleScript.

I preferred the Tiger Front Row. slashdot.org

pudge posted a photo:

Leopard Front Row Ignores Shared Source Cover Art

pudge posted a photo:

Leopard Front Row Thinks I Am Japanese

Incidentally, the top two videos in Japan are apparently both by Avril Lavigne.

So a lot of times when using Spaces under Leopard, windows just ... disappear. They are not visible in any space. So I have to open up the System Preferences and turn Spaces off, and then back on, which fixes it.

Here's a script that I put in my Script Menu (~/Library/Scripts/Reset Spaces.scpt) so I have quick access to it.

tell application "System Events"
    set (spaces enabled of spaces preferences of expose preferences) to false
    set (spaces enabled of spaces preferences of expose preferences) to true
end tell

Oh. You want a Perl version, do you?

Fine.

#!/usr/bin/perl
use warnings;
use strict;
 
use Mac::Glue;
 
my $sysevt = new Mac::Glue 'System Events';
 
my $enabled = $sysevt->prop('spaces enabled',
    of => 'spaces preferences',
    of => 'expose preferences'
);
$enabled->set(to => 0);
$enabled->set(to => 1);

I prefer AppleScript for stuff like this, since it's quicker to execute and I have to use AppleScript to figure out how to do it in Perl anyway, since AppleScript is sometimes easier to prototype with when you don't know what properties and objects you're working with. But it took only a minute to convert it to Perl, so no biggie.

System Events in Leopard has a lot of new junk in it for scripting preferences. Pretty neat, you can script many difference preferences now. Here's a list.

    appearance_preferences_object
        A collection of appearance preferences
 
        Properties:
 
            appearance: the overall look of buttons, menus and windows
            double_click_minimizes: Does double clicking the title bar minimize a window?
            font_smoothing_limit: the font size at or below which font smoothing is turned off
            font_smoothing_style: the method used for smoothing fonts
            highlight_color: color used for hightlighting selected text and lists
            inheritance: All of the properties of the superclass. (read-only)
            recent_applications_limit: the number of recent applications to track
            recent_documents_limit: the number of recent documents to track
            recent_servers_limit: the number of recent servers to track
            scroll_arrow_placement: the placement of the scroll arrows
            scroll_bar_action: the action performed by clicking the scroll bar
            smooth_scrolling: Is smooth scrolling used?
 
    cd_and_dvd_preferences_object
        user's CD and DVD insertion preferences
 
        Properties:
 
            blank_cd: the blank CD insertion preference (read-only)
            blank_dvd: the blank DVD insertion preference (read-only)
            inheritance: All of the properties of the superclass. (read-only)
            music_cd: the music CD insertion preference (read-only)
            picture_cd: the picture CD insertion preference (read-only)
            video_dvd: the video DVD insertion preference (read-only)
 
    dock_preferences_object
        user's dock preferences
 
        Properties:
 
            animate: is the animation of opening applications on or off?
            autohide: is autohiding the dock on or off?
            dock_size: size/height of the items (between 0.0 (minimum) and 1.0 (maximum))
            inheritance: All of the properties of the superclass. (read-only)
            location: location on screen
            magnification: is magnification on or off?
            magnification_size: maximum magnification size when magnification is on (between 0.0 (minimum) and 1.0 (maximum))
            minimize_effect: minimization effect
 
    expose_preferences_object
        user's expose and dashboard mouse and key preferences
 
        Properties:
 
            all_windows_shortcut: the key and mouse binding shortcuts for showing the all application windows (read-only)
            application_windows_shortcut: the key and mouse binding shortcuts for showing the current application windows (read-only)
            bottom_left_screen_corner: the bottom left screen corner (read-only)
            bottom_right_screen_corner: the bottom right screen corner (read-only)
            dashboard_shortcut: the key and mouse binding shortcuts for showing the dashboard (read-only)
            inheritance: All of the properties of the superclass. (read-only)
            show_desktop_shortcut: the key and mouse binding shortcuts for showing the desktop (read-only)
            show_spaces_shortcut: the key and mouse binding shortcuts for showing spaces (read-only)
            spaces_preferences: the spaces preferences (read-only)
            top_left_screen_corner: the top left screen corner (read-only)
            top_right_screen_corner: the top right screen corner (read-only)
 
    network_preferences_object
        the preferences for the current user's network
 
        Properties:
 
            current_location: the current location
            inheritance: All of the properties of the superclass. (read-only)
 
        Elements:
 
            interface, location, service
 
    security_preferences_object
        a collection of security preferences
 
        Properties:
 
            automatic_login: Is automatic login allowed?
            inheritance: All of the properties of the superclass. (read-only)
            log_out_when_inactive: Will the computer log out when inactive?
            log_out_when_inactive_interval: The interval of inactivity after which the computer will log out
            require_password_to_unlock: Is a password required to unlock secure preferences?
            require_password_to_wake: Is a password required to wake the computer from sleep or screen saver?
            secure_virtual_memory: Is secure virtual memory being used?
 
    spaces_preferences_object
        user's spaces application bindings and navigation preferences
 
        Properties:
 
            application_bindings: binding of applications to specific spaces
            arrow_key_modifiers: keyboard modifiers used controlling the arrow key navigation through spaces (read-only)
            inheritance: All of the properties of the superclass. (read-only)
            numbers_key_modifiers: keyboard modifiers used controlling the number key navigation through spaces (read-only)
            spaces_columns: number of columns of spaces
            spaces_enabled: is spaces enabled?
            spaces_rows: number of rows of spaces

use.perl.org

That Is Not An Available Option

| | Comments (0)
Playing MLB 07 The Show on PS3. Doing a season. Simulating most of the games, playing a few.

On September 22, with a solid lead on the wild card, and having won 10 games in a row, including sweeping the Yankees at home, we lose a simulated to Tampa Bay, with Josh Beckett starting.

The computer tells me upon game completion, "Josh Beckett sustained an injury (shoulder separation) during today's game. It appears he will be out for about 2 to 3 months. What would you like to do?"

The options are Keep Active, 15-day DL, or 60-day DL. None of the options are "kill myself," so I'm stumped! use.perl.org
So my memory usage in Leopard is WAY down. I have Safari, DragThing, SSHKeychain, perl daemons, MySQL, Apache, MacCvsX, Eudora, BBEdit, iChat, Terminal ... a lot of things running. Before this would put me into swap. Now, it does not. Not even close: with 2GB total, I have about 700MB unused.

It's ... just wow. HUGE performance increases in Leopard for me, just by not going into swap. I think some memory leak was fixed, or something. I dunno. But I like.

The biggest new memory pig is "helpdatad." Open Activity Monitor, sort by RSIZE, go into the Help menu of Activity Monitor, type into the new "Search" field, hit return, and watch helpdatad climb to the top. 180MB without breaking a sweat.

I killed the process and vowed to never type into that field again. use.perl.org

Sox Win, As Formula Predicted

| | Comments (0)
So in 2004 I predicted the Red Sox would win in 2006, using a mathematical formula. I was wrong. So I realized that my formula was off. Because the length of difference between last year won and the pivotal year of beating St. Louis crossed millennia, we had to add an extra year.

#!/usr/bin/perl
use warnings;
use strict;
 
# script to predict when the next Boston team championship
# will occur after either:
#
# * winning first championship in team history, against St. Louis
#
# OR
#
# * winning first championship since St. Louis existed as a team
 
my %boston_team = (
    # team        last year won,  year beat St. Louis
    Celtics   => [1957,           1957],
    Bruins      => [1941,           1970],
    Patriots  => [2002,           2002],
    'Red Sox' => [1918,           2004],
);
 
for my $team (sort { $boston_team{$a}[1] <=> $boston_team{$b}[1] } keys %boston_team) {
    printf "%s: %d\n", $team,
        predict_year(@{$boston_team{$team}});
 
}
 
sub predict_year {
    my($last_won, $beat_stl) = @_;
    my $base_year = $beat_stl + 2;
    $base_year += int($beat_stl/1000) - int($last_won/1000); # adjust for difference
    return $base_year;
}
 
__END__

This formula correctly "predicts" the next championship of each team:

Celtics: 1959
Bruins: 1972
Patriots: 2004
Red Sox: 2007

I CALLED IT!!!!!</colbert> slashdot.org

Tainting

| | Comments (0)
So the question is: is there a way to detaint arbitary data in Perl without using hash keys or regexes or XS?

Something hit me. This:

#!/usr/bin/perl -sTl
use warnings;
use strict;
 
use Scalar::Util 'tainted';
 
no strict 'refs';
for my $name (keys %{'::'}) {
    printf "%s:%d\n", $name, tainted($name)
        if $name =~ /^[a-z]\w+$/i
        && $$name;
}

Execute that like ./taint.plx -dakdjhasd and you get $name with dakdjhasd in it, untainted.

This is not the same thing, but what it does do is take some untrusted data that you normally might expect to be tainted, since it's just data on the command line, and makes it trusted. But this is not arbitrary data, and it is not tainted in the first place (and therefore not untainted). Interesting though. Then I thought:

#!/usr/bin/perl -Tl
use warnings;
use strict;
 
use Scalar::Util 'tainted';
 
no strict 'refs';
 
my $foo = $ENV{HOME};
printf "%s:%d\n", $foo, tainted($foo);
 
${'::' . $foo} = 'la la la';
 
my $bar;
for my $name (keys %{'::'}) {
    if ($name eq $foo) {
        $bar = $name;
        last;
    }
}
 
printf "%s:%d\n", $bar, tainted($bar);

W00t. Data is untainted!

Now, I know, this is still basically using hash keys, since the symbol table is a hash. But I don't care. Also, it wouldn't necessarily work with arbitrary data, given symbol table limitations.

Just something passing through my head. use.perl.org
Back up your hard drive before upgrading.

You're welcome.

I back up my HD every night with SuperDuper!, and I make a special point to do it for any significant system upgrade, including a minor revision (like 10.4.9 -> 10.4.10). It it borks my system, I reinstall it from the backup.

It really works. Really. slashdot.org

Slashdot Party!

| | Comments (0)
The party last night was great. We had significantly less than the 157 people who signed up, but still a lot: about a third of that, I'd say. Plenty large. Amazon provided pizza and drinks (for which there was a lot of extra for people to take home!) and I had a great time meeting new people and meeting old friends for the first time in real life, and seeing old friends I hadn't seen in awhile.

Thanks again to Amazon and especially cjcollier for all the work he did to bring it all together.

Unfortunately I forgot to bring my camera. If you took pictures and you post them, please let me know! slashdot.org

"Still Alive" Cover

| | Comments (0)
I've posted my cover of "Still Alive" by Jonathan Coulton, from the video game Portal, on the Longest Concert Evar. slashdot.org

Seattle Slashdot Party

| | Comments (0)
Don't forget to sign up for the Seattle Slashdot Party! Here's some of the details:

OK, we have a location: the 8th floor of the PacMed building on Beacon Hill. (Yes, that is Amazon HQ!).

The date is Saturday, October 20. Time is 6 p.m until whenever.

Because of security, please send me e-mail (pudge -at- slashdot -dot- org) with your name, and bring ID to the party confirming. If you don't, no huge deal, but you may need to spend a few minutes at the front desk while you fill out a paper and they print out a badge. Sorry about the minor hassle, but it'll be worth it!

Parking is free and available on the north side of the building (the graded area on the down-slope of Beacon Hill in the picture). If you give me your name beforehand and bring your ID, go to the west entrance. Otherwise, use the lower, north entrance. (If you have RSVP's and have your ID, but need a more accessible entrance, use the north entrance but skip the line and show your ID.)

If you want to network with people OR computers, feel free to bring the appropriate gear: resumes, business cards, laptops, etc. No WiFi provided (doesn't mean not allowed!).

Some food will probably be provided. Updates to follow on that. Alcohol will not be "provided."

Thanks very much to Amazon and their hospitality and generosity.

We will have some free t-shirts and things to give away.

See mullein's comment for bus information.

Thanks all, should be a great evening. See you Saturday. slashdot.org

Slashdot Party in Seattle Update

| | Comments (0)
The location and time are set for the Slashdot Party in Seattle. Address is at the top of the page.

For more information, see the comment with details. slashdot.org

Cocoa

| | Comments (0)
I am thinking about learning Cocoa just so I can write a Mac e-mail client that doesn't suck.

Eudora sucks but it is the best of the bunch, but it is buggy on Intel for me. My Inbox keeps losing memory of labels and what's been read (even what I have already filtered out).

Everything else is pretty bad in various ways. Mail is not a serious mail app. Thunderbird isn't a Mac app at ll. Mailsmith doesn't do IMAP and is bloated. Google Mail isn't local.

Sigh.

Maybe I'll just give up e-mail altogether! use.perl.org
Safari 3 has greater scripting abilities. This script will allow a user to use the frontmost window, full of tabs, as a basic slideshow. It will start at the current tab (unless the current tab is the last tab, in which case it will start with the first tab) and pause 7 seconds on each before moving on to the next. If you switch the tabs in between, the script will pick up from where you are now, not where you left off.

Of course, requires updating your glue file to Safari 3, if you've not done so. Just re-run sudo gluemac /Applications/Safari.app.

I put an alias to the script in my Safari scripts folder so I can access it through Script Menu.

#!/usr/bin/perl
use warnings;
use strict;
 
our $sleep_time = 7;
 
use Mac::Glue;
 
my $safari = new Mac::Glue 'Safari';
$safari->activate;
 
my $window    = $safari->obj(window => 1);
my $tab_count = $window->count(each => 'tabs');
 
my $current = $window->prop('current tab');
my $index   = $current->prop('index');
 
sleep $sleep_time;
 
my $i = 0;
until ($i >= $tab_count) {
    $i = $index->get;
    $i = 0 if $i >= $tab_count;
    $current->set(to => $window->obj(tab => ++$i));
    sleep $sleep_time;
}

use.perl.org

Two Types of Programmer

| | Comments (0)
From Brent Simmons:

There are, roughly, two types of programmers. One type was in the computer club at high school and got a computer science degree (or two or three). The other type, well, didn't--they were English majors, college dropouts, busboys, artists, odd-job-doers. (Cue Captain Renault: "That makes Rick a citizen of the world.")

My advice to young people is to get a computer science degree, if for no other reason than you can avoid those odd jobs and get right to the programming. And it also gives you an early chance to find out if you were, in fact, born a programmer.


In my experience, in general, I prefer working with individual programmers who didn't get a CS degrees. That's not universally true: there are some CS-degree holders I love to work with. And it doesn't imply a particular causal relationship: it could be that people I enjoy working with are simply those who are less likely to get a CS degree, rather than my enjoyment stemming from the fact that they didn't. use.perl.org

MacBooks Are Naturally Occurring

| | Comments (0)
A lot of people do not know that MacBooks are naturally occurring. But they are, so I thought I'd let everyone know.

Everything physical is, by definition, naturally occurring, unless you believe in direct supernatural intervention in the physical world. I don't know how life began -- and neither does anyone else -- but we have a pretty good idea of how everything else happened, how we got here, and so on.

Man is naturally occurring. Everything man touches is naturally occurring. Man, trees, many metals, and so on would not exist without bacteria and plants and other things that create us and our environment. Life forms create oxygen from their environment. Life forms create spider webs from their environment. Life forms creare ... MacBooks from their environment. And they are as natural as anything else. There's no rational distinction between "natural" and "man-made" unless you are going to re-define "natural" to mean "not-man-made," but then we need another word for "natural," and besides, there's very little reason to such segregation. It seems to me either extremely and falsely arrogant, or extremely and falsely humble, depending on how you look at it. But it's extreme, and it's false. slashdot.org

Yojimbo Script for Setlist

| | Comments (0)
So I saw some Yojimbo scripts over at DF and I remembered I have a Yojimbo script I use quite a bit, to create a setlist in which I keep song lyrics and chords and so on.

The setup required is to change the $htmlfile variable for your location of the created setlist; create a "Music: Setlist" group in Yojimbo (which contains note items with titles for song names, tags for artist names, and the contents in the note [with an optional __BR__ text to force a column break, such as you can see in several of the songs).

And of course, you need Mac::Glue installed, and glues for Safari and Yojimbo created.

And you need a stylesheet, which you can get from the source in the finished file.

#!/usr/bin/perl
use warnings;
use strict;
 
use File::Spec::Functions;
use Mac::Glue;
use URI::file;
 
our($header, $mid, $footer);
init();
 
my(%setlist);
my $artists = $setlist{ARTIST} = {};
my $songs   = $setlist{SONG}   = {};
 
my $yojimbo = new Mac::Glue 'Yojimbo';
my $browser = new Mac::Glue 'Safari';
 
my $set = $yojimbo->obj(collection => 'Music: Setlist');
my $count = my @items = $set->obj('items')->get;
for my $item (@items) {
    my $song    = $item->prop('name')->get;
    my $text    = $item->prop('contents')->get;
    my($artist) = $item->prop(name => of => 'tag')->get;
 
    $text =~ s/(\015\012|\015|\012)/\n/g;
    my $key;
    $key = $1 if $text =~ s/^(\[.+\])\s+//s;
    (my $songlink   = $song)   =~ s/\W/_/g;
    (my $artistlink = $artist) =~ s/\W/_/g;
 
    push @{$artists->{$artist}}, $song;
    $songs->{$song}{artist} = $artist;
    $songs->{$song}{alink}  = $artistlink;
    $songs->{$song}{text}   = $text;
    $songs->{$song}{key}    = $key if $key;
    $songs->{$song}{link}   = $songlink;
}
 
$count += scalar(keys %$artists) * 2;
 
##########################
 
my $htmlfile = catfile(
    '/Users/pudge/MacOS/pudge/work/songs/music',
    'setlist.html'
);
my $uri = URI::file->new($htmlfile);
open my $fh, '>', $htmlfile;
 
##########################
 
print $fh $header;
 
my $c = 0;
my $d = 1;
for my $artist (sort keys %$artists) {
    my $artistr = $artists->{$artist};
    print $fh qq[\t<li><a name="$songs->{$artistr->[0]}{alink}">$artist</a>] ;
    print $fh qq[<ul class="setlist_inner">\n];
 
    for my $song (sort @$artistr) {
        my $songr = $songs->{$song};
        print $fh qq[\t\t<li class="setlist_inner"><a href="#$songr->{link}">$song</a>];
        print $fh " <i><small>$songr->{key}</small></i>" if $songr->{key};
        print $fh "</li>\n";
        $c++;
    }
    print $fh "\t</ul></li>\n";
    $c += 2;
 
    if ($c > $d*int($count/3)) {
        print $fh qq[</ul></div>\n<div class="wrapper"><ul class="col">\n];
        $d++;
        $c--;
    }
}
 
print $fh $mid;
 
for my $artist (sort keys %$artists) {
    my $artistr = $artists->{$artist};
    #print $fh "\t<h2>$artist</h2>\n";
 
    for my $song (sort @$artistr) {
        my $songr = $songs->{$song};
        my $text = $songr->{text};
        $text =~ s/</&lt;/g;
        $text =~ s|__BR__\s+|</pre><pre>|gs;
 
        print $fh qq[\t\t<h3><a name="$songr->{link}">$song</a>];
        print $fh qq[ <i>$songr->{key}</i>] if $songr->{key};
        print $fh qq[</h3>\n\t\t<a href="#top">Top</a>];
        print $fh qq[ | <a href="#$songr->{alink}">$artist</a>];
        print $fh qq[\n\n<pre>$text</pre>\n\n\n<hr>\n\n];
    }
}
 
print $fh $footer;
 
##########################
 
close $fh;
$browser->activate;
$browser->open_location ($uri->as_string);
 
##########################
   
sub init {
    $header = <<EOT;
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html lang="en">
<head>
    <meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
    <title>Pudge Setlist</title>
    <link href="../style.css" rel="stylesheet">
</head>
<body style="font-size: 11px">
 
<h1><a name="top">Pudge Setlist</a></h1>
 
<div class="wrapper"><ul class="col">
EOT
 
    $mid = <<EOT;
</ul></div>
 
<div class="body">
 
EOT
 
    $footer = <<EOT;
<pre>__END__</pre>
</div>
</body>
</htm l>
EOT
 
}

use.perl.org
I don't know if Gruber-man ever came up with a solution to the unscriptable tabs, I have a workaround.

You cannot use Apple events to get every URL of every open document in Safari: the documents in nonvisible tabs are unavailable. So this workaround uses UI Scripting (turn it on in System Preferences -> Universal Access -> Enable access for assistive devices) to flip through the tabs. It (perhaps unreliably, if you have the same URL open in more than one tab) stops when the first URL fetched is equal to the last.

It does this for each window, then closes the window and moves on (it is not a simple matter to switch windows, and since I use this for quitting Safari, I want the windows closed anyway). It then simply prints out all the URLs into a Data::Dumper data structure.

#!/usr/bin/perl
use warnings;
use strict;
 
use Mac::Glue ':all';
 
my $safari = new Mac::Glue 'Safari';
my $sysevt = new Mac::Glue 'System Events';
 
my $next_tab = $sysevt->obj(
    menu_item               => 'Select Next Tab',
    menu                    => 1,
    menu_bar_item           => 'Window',
    menu_bar                => 1,
    application_process     => 'Safari'
);
 
$safari->activate;
 
my @windows;
my $win = 0;
 
my $windows = $safari->obj('windows');
for my $window ($windows->get) {
    my $url;
    while (defined(my $url = get_doc_url($window))) {
        push @{$windows[$win]}, $url if length $url;
    }
    $win++ if defined $windows[$win];
    $window->close;
}
 
use Data::Dumper;
print Dumper \@windows;
 
sub get_doc_url {
    my($window) = @_;
    my $document = $window->prop('document')->get;
    return unless $document;
 
    my $url = $document->prop('url')->get;
    $url = '' unless defined($url);
    return if @windows && $windows[$win] && @{$windows[$win]} &&
        $url eq $windows[$win][0];
 
    $next_tab->click;
 
    return $url;
}

Then you can do what you want the data structure. Here's what I do:

#!/usr/bin/perl
use warnings;
use strict;
 
use Mac::Glue ':all';
 
my $safari = new Mac::Glue 'Safari';
 
$safari->activate;
 
sub open_windows {
    my($windows) = @_;
    for my $window (@$windows) {
        $safari->make(new => 'document'); sleep 2;
        $safari->open_location($_) for @$window;
    }
 
}
 
my $VAR1;
 
$VAR1 = [
          [
            'http://pudge.net/',
            'http://pudge.net/tunes/'
          ],
          [
            'http://projects.pudge.net/'
          ]
        ];
 
open_windows($VAR1);

Saving and restoring to a file instead of copying/pasting the data structure is an exercise left to the reader. use.perl.org

Sex Tips For Geeks cover

| | Comments (0)

pudge posted a photo:

Sex Tips For Geeks cover

The latest O'Reilly book is destined to be a big hit.

cf. www.flickr.com/photos/pkdouyk/241484893/ and www.catb.org/~esr/writings/sextips/ and www.oreilly.com/catalog/cathbazpaper/

If you can, please try this script out, using the latest Mac::Carbon (0.77). Especially on Intel.

#!/usr/bin/perl -w
 
use Mac::Processes;
 
while ( ($psn, $psi) = each(%Process) ) {
    print $psi->processName, ' ' if $psi;
    print "$psn\n";
}

Let me know what platform you are using, and if the script terminates (as opposed to it just printing the same $psn forever (have your ctrl-C ready!)). use.perl.org

FOONET

| | Comments (0)
I've been rsyncing my local CPAN mirror from FUNET for years. A week or so ago, I started getting this:

rsync error: timeout in data send/receive (code 30) at io.c(171) [sender=2.6.8]
rsync: connection unexpectedly closed (13002061 bytes read so far)
rsync error: error in rsync protocol data stream (code 12) at /SourceCache/rsync/rsync-14/rsync/io.c(342)

What's that mean, and how do I fix it? use.perl.org

Mmmmmm Ears

| | Comments (0)

I Love John Gruber

| | Comments (0)

Translation From Pundit-Speak to English of Selected Portions of John Gruber's "Translation From PR-Speak to English of Selected Portions of Macrovision CEO Fred Amoroso's Response to Steve Jobs's 'Thoughts on Music,'" Intended In All Good Humour

Source: "Translation From PR-Speak to English of Selected Portions of Macrovision CEO Fred Amoroso's Response to Steve Jobs's 'Thoughts on Music'".

I would like to start by thanking Steve Jobs for offering his provocative perspective on the role of digital rights management (DRM) in the electronic content marketplace and for bringing to the forefront an issue of great importance to both the industry and consumers.

Fuck you, Jobs.

I'd like to start off with a good laugh line that also immediately lets you, the intended readers, know that I'm on your side.

Macrovision has been in the content protection industry for more than 20 years, working closely with content owners of many types, including the major Hollywood studios, to help navigate the transition from physical to digital distribution.

We've been helping and encouraging the entertainment industry to annoy its paying customers for more than 20 years.

I have an amazing power to state the obvious.

We have been involved with and have supported both prevention technologies and DRM that are on literally billions of copies of music, movies, games, software and other content forms, as well as hundreds of millions of devices across the world.

Remember those squiggly lines when you tried copying a commercial VHS tape? You can thank us for that.

I am old. And that's totally not a bad thing. In this case.

While your thoughts are seemingly directed solely to the music industry, the fact is that DRM also has a broad impact across many different forms of content and across many media devices. Therefore, the discussion should not be limited to just music.

We recognize that if getting rid of DRM works for the music industry, it's going to open the eyes of executives in other fields, and it could unravel Macrovision's entire business.

I have some level of business acumen, and most of you have none -- except what you learn from me -- so you can trust what I am saying is true.

DRM increases not decreases consumer value

Up is down. Black is white.

Did I tell you that I am funny, and can grasp the obvious? Because I am, and I can.

Similarly, consumers who want to consume content on only a single device can pay less than those who want to use it across all of their entertainment areas -- vacation homes, cars, different devices and remotely. Abandoning DRM now will unnecessarily doom all consumers to a 'one size fits all' situation that will increase costs for many of them.

Abandoning DRM will prevent us from forcing our customers to keep paying us over and over again for the same movies and songs they've already paid for.

Um. Wait a second. Did that Macrovision guy just say he wants me to pay more if I listen to music in more than one PLACE?! What the f-- ... oops. I just broke character. OK, back to the translation.

Well maintained and reasonably implemented DRM will increase the electronic distribution of content, not decrease it.

I am high as a kite.

OK, even if you don't find me funny, I am, at the very least, pretty damned hip. Getting high is still hip, right?

At Macrovision we are willing to lead this industry effort.

If we could get everything under our control we could make a lot of money.

I can just imagine Steve Jobs reading my words and nodding and laughing. Maybe he reads Daring Fireball. Even if not, I bet Phil Schiller does, and he probably forwards stuff like this to Steve. But it wouldn't surprise me if Steve reads the site. I mean, who else writes good stuff like this? Sure CARS does, but they also write a bunch of crap, too, and Steve's way too busy to wade through CARS to find the good stuff, you know? Hm. I wonder if he bought a DF membership under an assumed name.

We offer to assist Apple in the issues and problems with DRM that you state in your letter. Should you desire, we would also assume responsibility for FairPlay as a part of our evolving DRM offering and enable it to interoperate across other DRMs, thus increasing consumer choice and driving commonality across devices.

I realize Apple is never going to work with Macrovision, so I have decided to insult you and your company by insinuating that your 'Thoughts on Music' open letter was an expression of frustration at technical hurdles Apple just can't figure out on its own.

Seriously, Mr. Jobs, I totally think you're awesome, and I hope that you understand when you read this that I am just, well, in tune with you. If you'll pardon the pun. Unless you like puns. And I think you do, because I really, really, get you. And I know you don't really want to hire me, and I wouldn't want to, because that is not how blogging should work, but I dunno, maybe we can work something out. How about t-shirts for your employees?

As an industry, we should not let that happen.

As a company whose only purpose is to provide copy protection, we can't let that happen.

Thank you, Macrovision, for giving this story more legs. I am sick of writing about that assclown Enderle.

slashdot.org

-s: Not Just For File Sizes!

| | Comments (0)
So apparently a lot of people do not know about -s. Not the file test for size, but the command-line switch. From the docs:

-s enables rudimentary switch parsing for switches on the command line after the program name but before any filename arguments (or before an argument of --). This means you can have switches with two leading dashes (--help). Any switch found there is removed from @ARGV and sets the corresponding variable in the Perl program. The following program prints "1" if the program is invoked with a -xyz switch, and "abc" if it is invoked with -xyz=abc.

        #!/usr/bin/perl -s
        if ($xyz) { print "$xyz\n" }

Do note that --help creates the variable ${-help}, which is not compliant with "strict refs".


I use this a lot. A good 20 or so of the scripts I keep in my private bin directory have it, and I use it fairly often for one-offs too. Here's an example, from my bbeditp script:

#!/usr/bin/perl -s
our $g;
my $prog = $g ? 'gluedoc' : 'perldoc';
my $doc = shift;
open STDOUT, "|bbedit --view-top --clean -t $doc";
system $prog, '-t', $doc;

If I call bbeditp Finder, it looks for a perl module named "Finder", and opens it as an text window in BBEdit. If I call bbeditp -g Finder, it looks for a glue doc file for the application "Finder". use.perl.org

Pats by 24

| | Comments (0)
In my previous entry about the Pats, I should have factored in the Jets.

You see, the Pats three biggest rivals under Brady and Belichick have been who? The Steelers, Colts, and Jets. And every playoff game under B/B in years they went to the AFC Championship were won by three points except for games against their rivals, which were won by 7, 10, 14, 17, and 21.

So, Pats by 24.

I am probably the only one making that prediction. But if I am right, I will have bragging rights for time immemorial.

Oh, and also, everyone is still picking the Colts. For the same reason: they are "due." Yeah, they were due in '04 too, and they lost by 17. They might win, but it won't be because they are "due." use.perl.org

Pickin' the Pats

| | Comments (0)
Last week, I heard only two people on TV pick the Pats, and both were named Boomer: Berman and Esiason.

This week, I don't know about Esiason, but Boomer is the only one I've heard so far pick the Pats again. Everyone else has picked the Colts.

Works for me. use.perl.org
Ovid had a code snippet for opening a new terminal window in the current Terminal directory. It was in AppleScript, and because it's what I do, I rewrote it in Mac::Glue, and also rewrote it to work in iTerm, whch is what I use.

I have for awhile wanted something similar for the Finder, but never got around to it. That is, open a terminal for whatever Finder window I am in. So ... here it is.

#!/usr/bin/perl
#
# Open a new terminal in the Finder cwd
#
 
use Mac::Files;
use Mac::Glue ':all';
 
my $finder = new Mac::Glue 'Finder';
my $cwd = $finder->prop(target => window => 1)->get(as => 'alias');
$cwd ||= FindFolder(kUserDomain, kDesktopFolderType); # default to Desktop
$cwd =~ s/'/'\\''/g;
 
my $iterm = new Mac::Glue 'iTerm';
$iterm->activate;
my $term = $iterm->make(new => 'terminal');
$term->Launch(session => 'default');
$term->obj(session => 1)->write(text => "cd '$cwd'");

If you want to use Terminal, replace the lines about iTerm with these:

my $term = new Mac::Glue 'Terminal';
$term->do_script(with_command => "cd '$cwd'");

use.perl.org

Houston

| | Comments (0)
In regards to YAPC::Houston, and the summer I spent there 15 years ago, I am reminded of the Chagall Guevara song "Take Me Back (To Love Canal)," which has the wonderful lyric:

Come on, little baby, you'll like it up there
The wide open space and the big blue air
You'd be surprised what you can get used to
When your only other choice is Houston


use.perl.org

Mac-Glue-1.30 Released

| | Comments (0)
Mac-Glue-1.30 has been released. Download it from the CPAN or SF.net.

(Note: it may take time for the release to propagate to the various download mirrors.)
Changes:

* v1.30, Wednesday, January 3, 2007
 
   Dynamically load application's scripting additions before sending event.

Posted using release by brian d foy.

use.perl.org

Mac-Apps-Launch-1.93 Released

| | Comments (0)
Mac-Apps-Launch-1.93 has been released. Download it from the CPAN or SF.net.

(Note: it may take time for the release to propagate to the various download mirrors.)
Changes:

* v1.93, Wednesday, January 3, 2007
 
   Bundle IDs can have non-alpha chars.

Posted using release by brian d foy. use.perl.org

Discussion Updates

| | Comments (0)
If you have the "I am willing to help test Slashdot's New Discussion System" checked, you get two cool new features today.

First is that you get a pair of neat CSS/JS sliders in place of the old box with arrows on it. Drag them up and down and you see how many comments are available at each "threshold." Let go and the page updates to match your selection.

The other is that if a comment is hidden, it is not put into the page, to save on initial page load. The comment is then loaded on demand via Ajax. If you started with 0 hidden comments, slide the sliders to show greater-than-zero hidden comments, then reload to get a new version of the page. Then drag the slider back down to reveal the hidden coments. You'll see a "Loading ... Please wait" text pop up under the slider box as the comments load in. Same thing if you click "$n hidden comments" text to reveal the hidden comments: if they are not already loaded in, they are fetched, on demand. slashdot.org

use Perl; Discussion Updates

| | Comments (0)
If you have the "I am willing to help test Slashdot's New Discussion System" checked, you get two cool new features today.

First is that you get a pair of neat CSS/JS sliders in place of the old box with arrows on it. Drag them up and down and you see how many comments are available at each "threshold." Let go and the page updates to match your selection. (This widget is on the lefthand side of the page, covering up text. A horizontal version is coming soon. In the meantime, click the top right corner of the widget to make it go away, if it gets in your way.)

The other is that if a comment is hidden, it is not put into the page, to save on initial page load. The comment is then loaded on demand via Ajax. Slide the sliders to show greater-than-zero hidden comments, then reload to get a new version of the page, then drag the slider back down to reveal the hidden coments. You'll see a "Loading ... please wait" text pop up under the box as the comments load in. Same thing if you click "$n hidden comments" text to reveal the hidden comments: if they are not already loaded in, they are fetched.

Of course, none of this serves a big purpose for useperl, with its relatively tiny discussions, but on Slashdot, it should be a huge improvement.

use.perl.org

Apple "Service"

| | Comments (0)
So we have a five-year-old dying iBook. It has the right serial number, and symptoms listed there (black screen on startup), but apparently this computer model has recently gone from "Supported" to "Vintage" so they won't touch it without us paying the "preferred customer" fee of over $300.

I don't even want to know what the normal fee is.

What really kills me is that the guy on the phone tells us that three years is really old for a computer anyway, so why not just buy a new one? Besides, he goes on, $1100 for a new MacBook is not that much (um ... it's a lot more than zero, which is what I would have to pay if you covered the logic board under the repair extension program [which I know expired over a year ago]), and if you want to buy one, here's my direct phone number and I can process that for you! Yeah, pull the other one. slashdot.org

Dead Sea Scrolls

| | Comments (0)
I went to see the Dead Sea Scrolls exhibit a the Pacific Science Center in Seattle today. It was OK. It had very few actual manuscripts -- six biblical manuscripts, and five others -- but it was better than nothing. I was glad I saw it, because it's a rare opportunity. The most impressive one was 11Q5, a Psalms manuscript.

They had a bunch of textiles, jars, coins, and other things found at Qumran, too.

The least impressive part was at the very end: in a fit of political correctness, they decided to display a bunch of old manuscripts from various religions: Islam, Hindu, Buddhism. That would be like going to a guitar exhibit and having an accordion and tuba next to the door on the way out. Silly. slashdot.org

Burger King

| | Comments (0)
I hate the new Burger King ads. The've had them for over a year, the ones with the guy with the King mask stalking people. I despise these ads, as I have mentioned before.

I don't get fast food option, but all my life, I've preferred Burger King over McDonald's. I like their fries, shakes, and burgers better. And they have onion rings. And better BBQ sauce.

I maybe get fast food every few months. It's very rare. And I have not gone to Burger King the last few times, just because of the ads. Today, I went to McDonald's, even though Burger King was slightly closer. slashdot.org

Quoting In Comment Replies

| | Comments (0)
Now you can click the "Quote" button in your reply to, you know, quote the comment you're replying to.

See examples below. use.perl.org
<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.