Computers: November 2002 Archives
So for 5.6.1r2, I have left to clean up the docs, build Shuck 1.7.0 (which has some really nice new additions, along with some significant improvements and bug fixes in parsing and rendering of the POD text), release new versions of a few of my modules (e.g., Mac::Glue) with recent modifications, and that's about it.
I duplicated ~/Library/Mozilla/ in case I broke something, then deleted the Application Registry file inside that folder, and then started Mozilla. It asked me to create a new profile; I obliged. New profile, I want my old prefs back. I quit Mozilla, copied the contents of my old profile into the new one, and then started Mozilla again. Everything back to normal.
Although, I cannot tab in between form elements anymore. I used to be able to select form elements with tab. What gives?
Now Playing: Bound To Come Some Trouble - Rich Mullins (Never Picture Perfect)
I sent him some code I think others might find interesting and/or useful.
The MacPerl module (which runs in a limited fashion under Mac OS X perl, in Mac::Carbon) has a function called Volumes(), which returns all mounted volumes in list context, and the startup volume in scalar context. The paths returned text representations of FSSpec data structures, which can be converted to native paths (with slashes in Mac OS X, and colons in Mac OS) with MacPerl::MakePath():
$ perl -MMacPerl=all -le 'print join "\n", map { MakePath($_) } Volumes()'But that is not too helpful for getting the startup volume name under Mac OS X. You can, however, merely strip off everything up to the ":" in the FSSpec to get the volume name:
/
/Volumes/Bourque
/Volumes/Bird
/V olumes/Diablo II Play Disc
/Volumes/Diablo II Cinematics
$ perl -MMacPerl -le 's/^.+://, print for MacPerl::Volumes()'
Orr
Bourque
Bird
Diablo II Play Disc
Diablo II Cinematics
Now Playing: Growing Young - Rich Mullins (The World As Best As I Remember It, Vol. 2)
Next up: STA Vice City! If only I had a PS2 ...
Now Playing: Where You Are - Rich Mullins (The World As Best As I Remember It, Vol. 1)
Update: BTW, yes, this means I didn't do much work on MacPerl tonight. I needed a pre-break break. I might do some over Thanksgiving, at night when the family is asleep. As usual.
It's sortof a pain sometimes to deal with the MacPerl sources, because I have the source in CVS, and across three branches in perforce (maint-5.6/macperl, maint-5.8/macperl, macperl). I've not touched them in awhile, so I will need to sync them with what is current in maint-5.6/perl, maint-5.8/perl, and perl. I really only have one change to the perl core, a couple of lines for signals in util.c.
Last time I left a bunch of docs and sample code out of the MacPerl distribution, and I need to add them back in.
I've made a few changes to a few module distributions that are separate (like Mac::Glue), plus Mac::Carbon, so I need to sync those up and release them.
Mac::AppleEvents doesn't look too hard, just a lot of work going over what is still good or not in the API, and making changes to a few changed portions of the API (hopefully, this won't be too difficult, but some of the API has subtly changed, in part because direct memory access is now a no-no, and in part because some of the API used to be in a separate third-party library and Apple changed it when they swallowed it up).
I also need to come up with the AE idle procedure, which I have no real idea how to do. ;-) MacPerl's SubLaunch.c has SubLaunchIdle(), which uses a global called gMacPerl_HandleEvent. Now, SubLaunchIdle() and gMacPerl_HandleEvent are only used in Mac::AppleEvents (outside of the application, which is not being used here), so I can probably make it "global" to AppleEvents.xs, if I even need it; it looks to me like gMacPerl_HandleEvent itself is only used by the app, so I can modify SubLaunchIdle() to work without it (the procedure first checks to see if there is a MacPerl event, and if not, it checks to see if there is an Apple event waiting). OK, fine. Looks pretty straightforward (especially compared to the API changes).
I am still not sure how well AEs will work, coming from perl instead of an application. In a week or three, I imagine I'll find out. :-) I suppose if the AppleScript code works, and it does, then there shouldn't be a problem. I am optimistic that I will have something working before the end of December. Look for it in Mac::Carbon 0.03!
Now Playing: My Ship - Miles Davis (Love Songs)
The scores are achieved by ranking many different parameters, including existing laws, support from political bodies, deaths, etc. The governor's office got a D, while the nationwide average is a C. I wonder if having a teetotaling Mormon -- the very antithesis of what it means to be a Masshole -- in the corner office will make a difference for next year's grade. :)
Now Playing: Just Like You - Jacob's Trouble (...Let The Truth Run Wild)
Now Playing: Little Red Words - Jacob's Trouble (Knock Breathe Shine)
Now Playing: Days That Passed Me By - Jacob's Trouble (...Let The Truth Run Wild)
Here's a perl script I keep in the Big Cat folder called "Set Type - BBEdit".
#!/usr/bin/perlAhhhhhhhh.
use MacPerl 'SetFileInfo';
SetFileInfo('R*ch', 'TEXT', @ARGV);
Now Playing: Henry Kissinger - Monty Python (Sings)
I got a good chuckle, but then I started noticing other similarities. Sweathogs at Hogwarts? Horshack's scarf on Harry Potter? I am sure if I had ever seen a movie or read a book from the Harry Potter series I could come up with more similarities.
Please excuse Chris from having to watch Harry Potter. He has an inner ear problem: he hates to hear himself scream. Signed, Epstein's Mother.
Now Playing: Robinson In His Cadallac Dream - Counting Crows (This Desert Life)
So my program uses Mac::Glue to tell Interarchy to fetch certain directory listings and files, and opens them in BBEdit; then BBEdit is told to compare that file to the local copy. If they don't match, I look at the differences side-by-side in BBEdit's differences windows.
One problem with this setup is that it makes it hard when I am on the road. But Interarchy now has both SSH/FTP and SFTP. And all I need to do is change the $host parameter to include ";ssh" after it, or add sftp => 1 to the edit() method:
# username/password retrieved from Keychain; sftp for extra securityI just need to get Mac::AppleEvents (a future part of Mac::Carbon) ported to Mac OS X so I can run the script from Mac OS X instead of MacPerl under Classic (though it works fine under Classic, controlling Interarchy and BBEdit under Mac OS X, it is still
my $err = $interarchy->edit(path => $r_path, host => $host, sftp => $sftp);
if ($err) {
$interarchy->close($i_window); # clean up
} else {
my $result = $bbedit->compare($b_window, against => $l_path);
if ($result->{differences_found}) {
print "Hit Return when done comparing:\n $lpath";
$bbedit->activate;
exit if <> =~/^q/i;
} else {
$bbedit->close($b_window);
}
}
Now Playing: Like A Diamond - Tom Petty & The Heartbreakers (The Last DJ)
#!/usr/bin/perl
use Mac::Speech;
my $voice = $Mac::Speech::Voice{Victoria};
my $channel = NewSpeechChannel($voice);
for ( reverse ('blast off!', 1.. 10 ) ) {
SpeakText($channel, $_);
print "$_\n";
sleep 1;
}
sleep 1 while SpeechBusy();
DisposeSpeechChannel($channel);
Now Playing: Blue Sunday - Tom Petty & The Heartbreakers (The Last DJ)
Mac::Carbon is a Carbon/Mac OS X port of the Mac:: modules included with MacPerl. It's in development, but a lot of it works, and it is available, on the CPAN (soon) and on SourceForge.net (now). To discuss Mac::Carbon, check out the macosx@perl mailing list.
NAME
README - Carbon API for perl on Mac OS X
SYNOPSIS
This is not release-quality software. It is still in development,
and not recommend for use in a production environment.
Mac::Carbon is a collection of perl modules for accessing the Carbon
API under Mac OS X. It is a port of the Toolbox modules written by
Matthias Neeracher for MacPerl.
Part of the current strategy is to make Mac::Carbon the intersection
of the old and new Mac OS APIs. We will not be adding new function-
ality from Carbon, except as needed, for now. This may change over
time as Mac::Carbon stabilizes.
See the documentation in the Mac::Carbon manpage for more
implementation details, bugs, etc.
HELP ME
There are probably a lot of bugs, especially in Carbon.h. Bugs are
listed in the section on "Known Bugs" in the Mac::Carbon manpage;
please feel free to report them on the MacPerl bug reporting page,
in the "Mac Toolbox" category. Patches are welcome, too, of course.
For large patches, such as stuff for test suites and building,
please do coordinate with me before spending much time on it.
http://sf.net/projects/macperl/
REQUIREMENTS
Mac OS
These modules all build under Mac OS, but it is recommended you build
them as a part of MacPerl itself, or at least under the MacPerl
source. See http://dev.macperl.org/ for more information.
Under Mac OS, the full Mac OS API is available, not just the
Carbon-compatible routines.
Mac OS X
To build these modules on Mac OS X, the Developer Tools are required.
The Test::More module is required for running tests.
The separate Mac::Errors module is not required, but is highly
recommended.
These modules have only been tested with perl 5.6.0 on Mac OS X. See
the note in the BUILDING manpage.
The modules will compile and test remotely (such as via ssh, instead
of via the Terminal), but some of the tests might not run properly,
and one of the tests (for Mac::Notification) wants user feedback
(though will work without it).
BUILDING
Matthias added some extensions to XS for his Toolbox modules; they
were never fully embraced by p5p, and as a result, we have a
separate xsubpp for these additional XS macros. There is currently
no resolution to this problem. Either we write a pre-preprocessor
that converts the.xs files to be able to be handled by perl's
xsubpp, or we modify the.xs so that it can be handled by perl's
xsubpp, or we distribute a separate xsubpp (which is dangerous, as
xsubpp changes with versions of perl).
Currently, Mac::Carbon is distributed with the already-processed.c
files. If you really want to compile with the.xs files, you can use
the xsubpp programs (either the 5.6 or 5.8 versions) included in the
distribution. This is only temporary, until we have a permanent
resolution to these issues.
You might want to run the test suite with `make test TEST_VERBOSE=1'.
It's cool.
SUPPORTED MODULES
Currently, only a subset of the modules are supported. The ported
modules are:
Mac::Components
Mac::Files
Mac::Gestalt
Mac::Memory
Mac::MoreFiles
Mac::Notification
Mac::Processes
Mac::Resources
Mac::Sound
Mac::Speech
Mac::Types
Coming next, hopefully:
Mac::AppleEvents
Mac::OSA
Mac::AppleEvents is going to take more work than the others, as it
involves some significant API changes.
Following those, the pure-perl modules, which should not take much
work, as long as the core XS modules they rely on are working:
Mac::AppleEvents::Simple
Mac::OSA::Simple
Mac::Glue
And, possibly:
Mac::InternetConfig
Mac::SpeechRecognition
There are currently no plans for the other (GUI) modules, including:
Mac::Controls
Mac::Dialogs
Mac::Events
Mac::Fonts
Mac::Lists
Mac::Menus
Mac::Movies
Mac::Navigation
Mac::QDOffScreen
Mac::QuickDraw
Mac::QuickTimeVR
Mac::TextEdit
Mac::Windows
We could do these eventually, if there is enough interest. They don't
port as easily as some of the others, for many reasons, not the
least of which is that we need a framework to handle events etc.,
which for MacPerl is mostly implemented in macish.c / macish.h.
AUTHOR
The Mac Toolbox modules were written by Matthias Neeracher
<neeracher@mac.com>. They are currently maintained by Chris Nandor
<pudge@pobox.com>.
VERSION
$Id: README,v 1.1 2002/11/13 02:04:50 pudge Exp $
Deletions:
$CPAN/authors/id/C/CN/CNANDOR/DBI-1.08-bin-2-MacOThat's 3,762,910 bytes. Enjoy!S .readme
$CPAN/authors/id/C/CN/CNANDOR/DBI-1.08-bi n-2-MacOS.tar.gz
$CPAN/authors/id/C/CN/CNANDOR/DP rof-19990108-bin-1-Mac.readme
$CPAN/authors/id/C/ CN/CNANDOR/DProf-19990108-bin-1-Mac.tgz
$CPAN/aut hors/id/C/CN/CNANDOR/Data-Dumper-2.101-bin-1-Mac.r eadme
$CPAN/authors/id/C/CN/CNANDOR/Data-Dumper-2 .101-bin-1-Mac.tgz
$CPAN/authors/id/C/CN/CNANDOR/ GD-1.19-bin-2-MacOS.readme
$CPAN/authors/id/C/CN/ CNANDOR/GD-1.19-bin-2-MacOS.tar.gz
$CPAN/authors/ id/C/CN/CNANDOR/MD5-1.7-bin-1-MacOS.readme
$CPAN/ authors/id/C/CN/CNANDOR/MD5-1.7-bin-1-MacOS.tar.gz
$CPAN/authors/id/C/CN/CNANDOR/MIME-Base64-2.11-b in-1-Mac.readme
$CPAN/authors/id/C/CN/CNANDOR/MIM E-Base64-2.11-bin-1-Mac.tgz
$CPAN/authors/id/C/CN /CNANDOR/Math-Random-0.6-bin-1-MacOS.readme
$CPAN /authors/id/C/CN/CNANDOR/Math-Random-0.6-bin-1-Ma c OS.tgz
$CPAN/authors/id/C/CN/CNANDOR/SQL-Stmnt-0. 1012-bin-1-Mac.readme
$CPAN/authors/id/C/CN/CNAND OR/SQL-Stmnt-0.1012-bin-1-Mac.tgz
$CPAN/authors/i d/C/CN/CNANDOR/Set-Object-1.00-bin-2-MacOS.readme
$CPAN/authors/id/C/CN/CNANDOR/Set-Object-1.00-bin -2-MacOS.tgz
$CPAN/authors/id/C/CN/CNANDOR/Storab le-0.6@4-bin-1-Mac.readme
$CPAN/authors/id/C/CN/C NANDOR/Storable-0.6@4-bin-1-Mac.tgz
$CPAN/authors /id/C/CN/CNANDOR/String-CRC-1.0-bin-1-MacOS.readm e
$CPAN/authors/id/C/CN/CNANDOR/String-CRC-1.0-bin -1-MacOS.tgz
$CPAN/authors/id/C/CN/CNANDOR/Text-C SV_XS-0.18-bin-2-Mac.readme
$CPAN/authors/id/C/CN /CNANDOR/Text-CSV_XS-0.18-bin-2-Mac.tgz
$CPAN/aut hors/id/C/CN/CNANDOR/Text-Metaphn-1.95-bin-1-Mac.r eadme
$CPAN/authors/id/C/CN/CNANDOR/Text-Metaphn- 1.95-bin-1-Mac.tgz
$CPAN/authors/id/C/CN/CNANDOR/ Text-Soundex-2.20-bin-1-Mac.readme
$CPAN/authors/ id/C/CN/CNANDOR/Text-Soundex-2.20-bin-1-Mac.tgz$ CPAN/authors/id/C/CN/CNANDOR/perlpkg-5.004.readme
$CPAN/authors/id/C/CN/CNANDOR/perlpkg-5.004.sit.h qx
$CPAN/authors/id/C/CN/CNANDOR/perlpkg-5.005_02 .readme
$CPAN/authors/id/C/CN/CNANDOR/perlpkg-5.0 05_02.sit.bin
Now Playing: Every Grain Of Sand - Bob Dylan (Biograph)
av_push(PL_preambleav, newSVpv("BEGIN { bootstrap MacPerl; bootstrap OSA; bootstrap XL; }",0));All three packages are statically linked, and are a "part of" the MacPerl package (that is, they get compiled into the same static library file). When porting this to Mac OS X, it causes problems: in MacPerl.pm, no bootstrap is done because it is not necessary, having already been done.
Normally, one could just do a conditional bootstrap, but this is complicated by the fact that a bootsrap OSA (we skip XL for Mac OS X) will look for a dynamic library named "OSA.$dl_dlext". But we don't have that. So instead, we first bootstrap MacPerl, and then find the file that was used for MacPerl -- don't load the file, it's already been loaded -- and use that to install our OSA::boostrap, before finally calling it.
It's possible I am overcomplicating things or doing something wrong, but hey, it works
# bootstrap MacPerl is already implicitly done by your MacPerl binary
unless ($^O eq 'MacOS') {
# use Config;
# my $dl_dlext = $Config::Config{'dlext'};
my $dl_dlext = 'bundle';
require DynaLoader;
push @ISA, 'DynaLoader';
bootstrap MacPerl;
# because OSA is in MacPerl.bundle, not OSA.bundle
my $file = "auto/MacPerl/MacPerl.$dl_dlext";
foreach (@INC) {
$dir = "$_/auto/MacPerl";
next unless -d $dir;
my $try = "$dir/MacPerl.$dl_dlext";
last if $file = -f $try && $try;
}
for my $mod (qw(OSA)) {
my($xs, $symref);
for (@DynaLoader::dl_librefs) {
last if $symref = DynaLoader::dl_find_symbol($_, "boot_$mod");
}
next unless $symref;
$xs = DynaLoader::dl_install_xsub("${mod}::bootstrap", $symref, $file);
&$xs($mod);
}
}
Now Playing: Ribbon In The Sky - Stevie Wonder (Original Musiquarium I, Vol I)
I think I am going to skip the rest of the test suite for now (patches welcome :-) and come back to it later. It's a 0.01 release, after all.
It is not just additional scenes: it is a lot of additional shots interspersed in existing scenes. So they had to rerecord a lot of the score to fix the length, and do a lot more to get it to work, and it looks great.
I was happy to see some of the additional footage, such as Galadriel talking about her ring and giving the gifts to the fellowship. All told, it was over 30 minutes of extra footage, including 5-6 new scenes. The running length is now over 3 hours, 45 minutes. However, that's including 20 additional minutes of credits, showing nothing but names of charter members of the LotR fan club. Heh.
The DTS 5.1 was cool; and by cool, I mean totally sweet. Someday I need to get me a digital TV so the picture looks as good.
I did a make dist and copied it to another Mac OS X box and did the old perl Makefile.PL ; make ; make test ; sudo make install, and it all worked, so it's Good Enough for now.
I've added a Mac::Carbon module, which will serve primarily as documentation for the rest of the distribution, but also as a front-end to the rest. See, in Mac OS, you need to #include each individual header file for the Mac API that you want; in Mac OS X, you can just #include . So Mac::Carbon will give you all of the symbols from all of the modules, if you want them.
So what next? I might try to integrate it into the MacPerl source ASAP, and (if I feel up to it) add some Files/MoreFiles/Resources tests, and then ... release. Woop.
Now Playing: Supervixen - Garbage (Garbage)
pdcawley asks how many of those quotes were sarcastic. I can't see how it matters. :-) It can have so many meanings, all of them true in their own way.
Now Playing: Rockin' the Suburbs - Ben Folds (Rockin' the Suburbs)
I am even using Test::More, which makes life easier. I may need to include it in MacPerl. It's all working really well thus far.
ok(my $h = Handle->new('xyzzy'), 'new handle');I just need to add some more tests for Mac::Files and Mac::MoreFiles, then clean it up (which includes making it build on machines other than this one and integrating the changes with MacPerl). Then: profit! I mean: release!
is($h->get, 'xyzzy', 'get handle');
is($h->size, 5, 'handle size');
is($h->get(2, 2), 'zz', 'get handle portion');
Now Playing: Fired - Ben Folds (Rockin' the Suburbs)
But man, is it ugly. mount_webdav requires you to write out a file with the username and password in it, then pass the file descriptor to the program as an argument. So I encode the username and password, then make a temp file and unlink it, prepare the file with select() and fcntl(), then print to it and call mount with the appropriate arguments.
And then, it seems Mac OS X's open command won't open the new volume most of the time. I also tried AppleScript, with open location, and that similarly failed. Bug.
#!/usr/bin/perl -w
use strict;
use File::Temp 'tempfile';
use Fcntl 'F_SETFD';
my $server = 'dav.example.com';
my $path = '/Volumes/dav';
my $user = 'login';
my $pass = 'password';
# encode username and password
(my $ulen = sprintf "%4s", chr length $user) =~ s//\0/g;
(my $plen = sprintf "%4s", chr length $pass) =~ s//\0/g;
my $data = sprintf "%s%s%s%s", $ulen, $user, $plen, $pass;
# create mount point and temp file, and unlink file so no one can see it
mkdir $path;
my $fh = tempfile();
unlink $fh;
# autoflush
select( (select($fh), $|++)[0] );
# get ready to pass fd
my $fd = fileno($fh);
fcntl($fh, F_SETFD, 0) or die "Can't clear close-on-exec flag on temp fh: $!\n";
# finally, write username and password and mount
print $fh $data;
system('mount', '-t', 'webdav', '-o', "-a$fd", $server, $path);
# open (first usually fails, don't know why; but you can just open the
# icon in the Volumes folder, which is just as good as opening the icon
# on the Desktop
system('open', $path);
system('open', '/Volumes/');
# clean up
close $fh;
__END__
Now Playing: What It Takes - Aerosmith (Pump)
Jesse Ventura, who had previously agreed to appoint the winner of tomorrow's election as the senator to finish out the current session (which ends in January), was miffed at the tone of the memorial service/campaign rally on Tuesday, and so he appointed an independent instead, and he did it shortly after 11 a.m. today, briefly upstaging the debate.
Now, the makeup of the U.S. Senate is 49-49-2, with the President of the Senate holding the tiebreak vote for the Republicans. The Senate could hold new leadership elections now, just as they did in the opening months of the Congress almost two years ago, when a Republican senator became an independent. That independent voted for the Democrats; if this new independent would vote Republican, then Trent Lott would be the Majority Leader for the first few, and last few, months of the Congress, whereas Tom Daschle had all the months in between.
Weird.
In the debate, Mondale was very snippy, while Coleman was quite polite. I don't know which will appeal more to the MN voters, but they both seemed to hold their own on the issues.
In less of a leap, David Ogden Stiers played Cogsworth, the clock.