Computers: January 2004 Archives

Mac::Glue Article

| | Comments (0)

Stupid Mac::Glue/X-Chat Tricks

| | Comments (0)
X-Chat has a perl interpreter plugin that allows you to compile (and cache, like mod_perl) perl scripts.

One of its functions is to open a URL in a wbe browser when you click on it in a window. gets the URL and opens it via system('open', $url).

I leave X-Chat Aqua open on my server 24/7. Then I use my laptop, right next to it, to do most other work, including web browsing. I've been using ClipboardSharing to automatically sync my clipboards between the two machines, so I can copy the URL in X-Chat on the server, and then paste it in a browser window on my laptop.

But I decided, why not have clicking on the URL open a browser window on my laptop instead of the local server?

Enter Mac::Glue!

I added this to the top of

use Mac::Glue ':all';
my $browser = new Mac::Glue 'Safari';
my $version = $browser->prop('version');
my @hosts = qw(bourque orr);
sub _gethost {
    my $found = 0;
    for my $host (@hosts) {
        $browser->ADDRESS(eppc => Safari => $host);
        $found = 1, last if &_alive;
    $browser->ADDRESS if !$found;
sub _alive {
    return $version->get;

And then changed the open line:

#    system ("open", $url);

Now, if my laptop is on the network (both hostnames are the same machine, one wireless hostname and one wired), it will open the URL on the laptop when I click on it. Otherwise, it opens it locally. Nifty.
Boy howdy, is it. The system is an iBook G3/600 with 256MB RAM. The first test is with Mac OS X 10.2.8.

$ time perl -MMac::Glue -e 'Mac::Glue->new("Finder")->activate'
real    0m21.445s
user    0m7.100s
sys     0m0.510s
$ time perl -MMac::Carbon -e1
real    0m19.885s
user    0m6.810s
sys     0m0.220s

The second is Mac OS X 10.3.2.

$ time perl -MMac::Glue -e 'Mac::Glue->new("Finder")->activate'
real    0m2.067s
user    0m1.430s
sys     0m0.320s
$ time perl -MMac::Carbon -e1
real    0m1.300s
user    0m1.130s
sys     0m0.140s

Wow. That's pretty dramatic. More than 10x faster in real, and about 5x faster in user+sys. Why the speedup?

The slowest thing with Mac::Carbon was always in loading the modules on startup, with most of the time spent in dyld. Over 90% of that time in the Mac::Glue test in Mac OS X 10.2.8 was spent in dyld. In the Mac OS X 10.3.2 version it is still over 75%, but, obviously, much less time is spent there.

Before, it was spending over half of its time in link_library_module and add_reference combined, and about 20% in relocate_symbol_pointers/relocate_symbol_pointers_ in_library_image. Now, it still spends about 20% in the latter, but the former don't show up at all. And that 20% is a lot less than in the original, since the total time is so much shorter.

I don't know what all that means exactly, but I do know that yeeha, Panther is a lot faster at loading in them shared libraries.

Cat Art by a Psychotic

| | Comments (0)

Panther UI Lameness

| | Comments (0)
In list view in the Finder in Panther, the whole line is highlighted to note that the item it selected. But in all previous version of the OS, and in most of Panther, you can drag what is highlighted. But in list view, despite the whole line being highlighted, you can only drag the text and icon, not any part of the highlighted section.

Now, there is a small border around the text and icon that you can also drag, but it is impossible to tell where that border ends, because the highlighting doesn't end at the border, like it clearly should. This is related to the other highlighting problems, such as that something that has a blue label in list view is only barely distinguishable from one that is selected (given a blie highlight color). And if you select the item with a blue label, the label disappears, and you get instead a blue dot next to the name.

It's really exceptionally poor design, how labels and highlighting are done in Panther.


| | Comments (0)
I've seen no complaints about authentication on not working. Could this mean it is working properly for everyone? Say it ain't so!


| | Comments (0)
OK, I know iPhoto sucks, especially in that it is the most non-scalable image cataloging application ever. But oh, it sucks in other ways too. And my problem today is this: is there a way to tell iPhoto to NOT automatically import images? I pop in a card, and iPhoto is running, and it just starts stupidly importing everything. There's only one image I want, and I know what it is, and I want iPhoto to stop being ridiculously dumb.
<pudge/*> (pronounced "PudgeGlob") is thousands of posts over many years by Pudge.

"It is the common fate of the indolent to see their rights become a prey to the active. The condition upon which God hath given liberty to man is eternal vigilance; which condition if he break, servitude is at once the consequence of his crime and the punishment of his guilt."

About this Archive

This page is a archive of entries in the Computers category from January 2004.

Computers: December 2003 is the previous archive.

Computers: February 2004 is the next archive.

Find recent content on the main index or look in the archives to find all content.