Computers: August 2002 Archives

Warripping

| | Comments (0)
I just had a thought today, in the bathroom, where I have most of my good thoughts.

When the iPod was released, I bemoaned that it had no wireless connectivity. But now that iTunes will have Rendezvous capability -- share your playlists with any other Mac on the LAN, automatically -- I wonder if a wireless iPod isn't around the corner.

Imagine, having an iPod that just automatically picked up the playlists in the general vicinity. It's a new form of wardriving: walk around the city and steal^Wlisten to other people's music! use.perl.org

Bomb bomb bomb, bomb bomb Iraq

| | Comments (0)
There's a lot of nutty talk going on about Iraq these days. Should we attack? Should we first get a coalition and allies to back us? Is Iraq about to strike us?

Let me state a couple of ideas to cut through some of this crap:
  1. We should only attack Iraq if it is necessary to do so to protect ourselves or our allies; in other words, only if an attack by Iraq is in process, or imminent.
  2. In such a case, where an attack is in process or imminent, approval by allies or backing by a coalition is moot.

All this about when we should attack is crazy talk, unless there is the possibility of us attacking unnecessarily. If someone is questioning whether now is the right time to attack or not, the answer is No. When it becomes necessary, we should attack. And not before. People talking about coalitions are sidestepping the real issue.

The question is, though: is Iraq attacking?

Part of the problem is that I don't believe for a second that Iraq is going to directly attack the US or its allies. If they did today, they would be gone tomorrow. As noted, we won't wait for allies or coalitions in such a case. And we won't hold back our wrath. So what's the issue?

I think that Iraq is most likely behind much of the terrorism against the US, Israel, and much of the West, including the first WTC attack by likely Iraqi agent Ramzi Yousef, and perhaps even the September 11 attacks, that Iraq is providing weapons, money, and in some cases personnel, and that Iraq is working hard to keep evidence of its involvement in these matters secret, so it is difficult for the world to make a case against it. And I think that the US government is scramnbling furiously to get the scarce evidence together.

Whatever the case, I think it's unreasonable for the US to go to war without providing the evidence to its people. But even if the evidence is provided, unless Iraq is actively engaged in attacks against the US or its allies, a military strike against Iraq is unreasonable; and if it is engaged in such attacks, the US has every obligation to respond militarily. The evidence is the key. use.perl.org

Who's Who?

| | Comments (0)
In the latest Who's Who book, they used four times more to describe Hillary Clinton's accomplishments than they did for Bill Clinton's. Heh.
Who's Who seems pretty stupid to me though. If you are really someone "important," you don't need to be in the book; if you aren't someone "important," then you don't deserve to be in the book. In theory, anyway. In reality, anyone who gives them money to have an entry published is "important." use.perl.org

Mac OS X 10.2 Review

| | Comments (0)

Note to Self

| | Comments (0)
Never do that again. Apparently "100 minutes of Jaguar" is waiting in line for 100 minutes in a mall that isn't air conditioned, only to be rushed through the store as quickly as possible by store personnel and local police. I did get a mouse pad, though. And my company was most most enjoyable, even though many of the people around us were really scary. My only regret is that I was too tired to stick around to watch the ensuing riot when police told most of the people still behind us that they wouldn't be allowed in (unless they changed their mind and stayed open later). use.perl.org

Jaguar Party

| | Comments (0)
I'm going to the Jaguar party tonight at Cambridgeside's Apple store in MA. I don't know why ... it must be my inner geek, but I feel strangely compelled. use.perl.org

More on "Mac OS X"

| | Comments (0)
I don't want to harp on this, but this is a great example, I got in a Slashdot submissions bin, of confusion over the name of the OS.

Microsoft has released a remote desktop app to allow users of OS X to connect to Windows Servers running terminal services. This is rather a nice little app and runs natively in X. I had been using RDEsktop running under OroborOSX, but this runs nativley and has a rather small footprint.


He mentions both Mac OS X ("OS X") and X11 (via OroborOSX, a frontend to XFree86 for Mac OS X). From the context you can guess he intends "X" to refer specifically to Mac OS X, but noticing he was talking about X11, I at first assumed he meant X11. Maybe "OS X" is specific enough, though I think it's lame shorthand (like "'nix"), but "X" is not acceptable at all. :-) use.perl.org
I was having problems with my IC mappings (IC == Internet Config / Internet Control Panel / Internet System Preferences, stored in com.apple.internetconfig.plist now in Mac OS X) not being carried over. So in many cases, my files ended up the wrong type.

I found out I could change single entries under Classic, via the Internet Control Panel. I guess the CP calls the IC API which now writes the plist file in Mac OS X instead of the resource file in Mac OS.

So I wrote this little program which gets the data from the IC prefs and writes it out into the right format. It must be run under Mac OS v9, NOT Classic. It just prints out the data to then paste into the proper location in the plist file (overwriting the corresponding entries). I pasted in the new data (after backing up the file) in Mac OS, before rebooting into Mac OS X.

An interesting note: what would have been nice to do is just get the raw data structure as a string, and encode_base64() it. But the module didn't allow for that, so rather than trying to add that to the module, I just re-packed it back into its original format, using the IC headers as a guide. :)

#!perl -w
use Mac::InternetConfig;
use MIME::Base64;
 
my %dups;
for my $e (keys %InternetConfigMap) {
    next if exists $dups{$e->extension};
    $dups{$e->extension}++;
    my $c = pack 'sa4a4a4l',
        $e->version, $e->file_type, $e->file_creator,
        $e->post_creator, $e->flags;
 
    my $d;
    for $meth (qw(extension creator_app_name post_app_name MIME_type entry_name)) {
        my $s = $e->$meth;
        $d .= sprintf "%s%s", chr(length $s), $s;
    }
 
    my $b = pack 'ss', 4+length($c . $d), 22;  # 22 is constant
 
    my $a = $b . $c . $d;
    $a = encode_base64($a, '');
 
    print "\t\t\t\t\t\t<data>\n";
    for (split /(.{28})/, $a) {
        print "\t\t\t\t\t\t$_\n" if $_;
    }
    print "\t\t\t\t\t\t</data>\n";
}
 
__END__

use.perl.org

Entry Deleted

| | Comments (0)
I deleted the journal entry previous to this one. I don't need the aggrevation of being personally attacked for my beliefs, and the content of the comments was, frankly, making me ill. I only post this entry because people in the past seem to suspect conspiracies when journals disappear: when journals are deleted, so are associated comments. use.perl.org

Another Mac OS X Gripe

| | Comments (0)
In the Finder, when I do something the Finder has a problem with -- such as copying a file to a directory where a file of the same name exists, or perhaps trying to empty the Trash when a file in it is in use -- I get a little dialog that says Stop or Continue. Good. But unlike Mac OS, I can't hit escape or cmd-. to Stop, or return or enter to Continue.

(BTW, this is still Mac OS X 10.1.5, of course; I am hoping many of my gripes are fixed in 10.2, and I will surely report back. :-)

Update: In the case above, there is no glowing/plusing button, so at least I have a visual clue that I can't hit return or enter. But in some cases -- such as saving a file here in Mozilla -- there is a pulsing button ("Save") and no amount of hitting return or enter will cause the button to be "clicked." That's just Bad. use.perl.org

Latest Mac OS X Gripes

| | Comments (0)
I am just noting these here kinda for reference; so I can remember all the things that bug me about Mac OS X, primarily as differences from Mac OS.
  • I don't know if I've mentioned it before, but the black I-bar cursor in Mac OS changes color as it passes over dark backgrounds. Now, in BBEdit in Mac OS X, it still does this, but in other apps it doesn't. I don't think it is Carbon vs. Cocoa, because other Carbon apps don't. The I-bar instead has a grey shadow or something, which makes it very difficult to see when the entire background is black. I often lose my cursor in Mac OS X.
  • In many text boxes (such as cmd-~ from the Finder, to open a named directory, which in itself is cool), if you arrow left or right, the cursor disappears until I let go of the arrow key. So I can't hold down the arrow and move the cursor to a specific location, as I never know when to stop. Very annoying.
  • I don't know of any way to do custom contextual menus. In Mac OS, I have these little files to handle all sorts of things; for instance, I can ctrl-click on a file and select "Open Using -> file2clip" and it puts the path for that item on my Clipboard. Or select text and choose "CPAN" and it will automatically search for that text on search.cpan.org. That is something I use a lot, and it doesn't appear to exist in Mac OS X.
use.perl.org

pudge.net Down

| | Comments (0)
Grrr. pudge.net is down for going on 12 hours now. This suxorz. I hope nvp has some way of dealing with it. I'll try calling him in a bit, I guess; hope he's around. use.perl.org

FYI

| | Comments (0)
Being sick sucks. I just hope I am well enough to play hockey tomorrow night. use.perl.org

Fun with Mac OS X Preferences

| | Comments (0)
Mac OS still uses Internet Config to some extent, but it is different than in Mac OS 9 in a few ways. First, there's no UI to edit all of the fields; so if you want to edit something, and it's not provided in the Internet prefs box, you're sorta out of luck. Second, it doesn't use the same file format; it uses the XML plist format.

So my problem is that in Eudora, I like using ProFont ("Programmer's Font", similar to Monaco, but easier to read for code at small point sizes) for messages, but I check Eudora's prefs to use Internet Config (for SMTP host etc.), and there's no way to change the default screen font from Monaco to ProFont.

One solution might be to port Mac::InternetConfig, and use the API. But I tried something else.

I opened /Users/pudge/Library/Preferences/com.apple.interne tconfig.plist -- an XML file -- and poked around. Nothing in there for ScreenFont, the pref I want to set. I poke around a little more to figure out how to add it if I want to. A standard entry looks something like:

            <key>WebBackgroundColour</key>
            <dict>
                <key>ic-data</key>
                <data>
                ////////
                </data>
            </dict>

OK, so what's the data? It looks suspiciously familiar. The first line of the XML file, after the declaration, is:

<!DOCTYPE plist SYSTEM "file://localhost/System/Library/DTDs/PropertyList .dtd">

OK, so that file tells us:

<!ELEMENT data (#PCDATA)> <!-- Contents interpreted as Base-64 encoded -->

Nice. Sure enough:

% perl -MMIME::Base64 -le 'print ord decode_base64(shift)' ////////
255

OK, so now I just need to get the data for ScreenFont, in the right format, then encode it in Base64. MacPerl to the rescue!

#!perl -wl
use MIME::Base64;
use Mac::InternetConfig;
print encode_base64($RawInternetConfig{kICScreenFont()}) ;

%InternetConfig gives a sane human-readable value (in this case, ProFont). But %RawInternetConfig provides the raw packed data. I encode it and print it out:

AAkAAAdQcm9Gb250AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA/////wAAAAA4W4tIAA2Q VAAi
WYgDhACj97QAAAAiWYgAMzACAAAAAgCmiLIADt6oAA7e nGj/90AApoirAAAAAAAID0xURVhUdHR4
dAANkFSIhAAiZJgD AwCj97QAAAAiZJ4AAAAAAAgAotoAAIEAAAAAAADMzMzMzMzMzA CmiLpAnfFQ
AKLTKAAiVlL///8AACJWQkCJXpYAotqg////AA AiVkI=

So I reformat it a bit to have the same line lengths as the other entries in the file, and end up with:

            <dict>
                <key>ic-data</key>
                <data>
                AAkAAAdQcm9Gb250AAAAAAAAAAAAAAAAAAAAAAAAAAAA
                AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
                AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA////
                /wAAAAA4W4tIAA2QVAAiWYgDhACj97QAAAAiWYgAMzAC
                AAAAAgCmiLIADt6oAA7enGj/90AApoirAAAAAAAID0xU
                RVhUdHR4dAANkFSIhAAiZJgDAwCj97QAAAAiZJ4AAAAA
                AAgAotoAAIEAAAAAAADMzMzMzMzMzACmiLpAnfFQAKLT
                KAAiVlL///8AACJWQkCJXpYAotqg////AAAiVkI=
                </data>
            </dict>

I quit Eudora, save the plist file, and reopen Eudora, and there it is as my new screen font: ProFont, size 9.

Yay! use.perl.org

bash

| | Comments (0)
I finally got sick of not having proper shell redirection, and set my Mac OS X box to use bash as my shell. Basically, I ran:

fink selfupdate
fink update-all
fink install bash

Then I just needed to set up .bash_profile and .bashrc (using source /sw/bin/init.sh instead of .csh for the fink init file), and set my prefs to use the right shell. For this, I ran:

sudo niutil -createprop / /users/pudge shell /sw/bin/bash

Then in Terminal.app I set it to use the default login for this user. use.perl.org

Whining About Open Source

| | Comments (0)
Dave Winer is at it again about Open Source. He's really got a pickle up his butt about it, and this is just another chapter in the saga.

He starts out by commenting:

Is it me or is it weird that so many open source purists, people who swear by it, argue it to death, and would die for it, seem to like Apple, which isn't open source? Maybe I'm missing something.

Yes, you are. You're confusing people who like Open Source with those who think everything should be Open Source. I know a ton of people who like Open Source and also like Macs or Apple: not one of them, to my knowledge, thinks that everything should be Open Source.

BTW, imho, "open source" is a vestige of dotcom mania.

Two problems: first, none of Winer's opinions are humble.

Second, "open source" has been around a lot longer than "dotcom mania" has been. Sure, it was popularized in large part because of "dotcom mania", but Open Source software runs far deeper than dotcoms ever did; it's been the backbone of many technologies for decades, and continues to be today. TiVo lives on Open Source software. The top web server and scripting language are Open Source. It's not a vestige, it's a way people do things. That's like saying the Internet is a vestige of "dotcom mania". It's nonsense.

One more thing, open source zealots, like all zealots, checked their minds at the door when they joined the party. They're anti-intellectual, can't handle disagreement, are about anything but freedom.

This, from the person voted most-likely-to-be-avoided-in-an-online-discussion (OK, not really, but I bet if there were such a vote, he'd win) because of how much he can't handle disagreement.

Most of the Open Source advocates I know are anything but anti-intellectual; Winer is the one who chastised me for correcting him when he posted a "truly random number generator" on his site that was actually pseudorandom, and for this he commented "my readers are system managers not Math Majors" and called me "small-minded." Maybe he was not being anti-intellectual, just a snob?

Neither are Open Source advocates against freedom; that doesn't even really make sense. Most of them think people should use whatever they want to use (as shown in Winer's own example about them using Macs).

And what is a "zealot"? It is the same thing as the aforementioned "purist"? If so, then one or both of the labels is obviously misapplied. If they are intended to be different, then he is lumping them together inappropriately. It's a case of "condemn people I don't like by labelling them." Most people who use and like Open Source are not zealots, are not purists.

But what am I doing trying to inject logic into this? The real point is here:

In the late 90s open source defined a club that excluded many well-intentioned hard-working developers.

Translation: "When Open Source was popular, I wasn't, and I am bitter about it." use.perl.org

Mac OS Style Guide

| | Comments (0)

There is no MacOS. There is no MacOSX, nor MacOS9, nor OSX.

There are two operating systems, Mac OS, and Mac OS X. The former is currently at version 9.2.2, and the latter at 10.1.5. The full names are "Mac OS 9.2.2" and "Mac OS X 10.1.5". Throw in a "v" or "version" if you like.

Using "OSX" is barely acceptable, if only because so many people use it, but it is too non-specific: what is "X"? If "OSX" is to be used for "Mac OS X", then why not "OS" to refer to "Mac OS"? It should be avoided.

"MacOSX" is not acceptable, nor any other form omitting the space between "Mac" and "OS". Using "Mac OS" to mean "Mac OS X" is not acceptable; they are two different operating systems. "Mac OS 9" is acceptable, to distinguish it from previous versions of Mac OS, and barely acceptable to distinguish it from "Mac OS X", only because so many people incorrectly use "Mac OS" to refer to "Mac OS X".

Mac OS Style Guide

| | Comments (0)

There is no MacOS. There is no MacOSX, nor MacOS9, nor OSX.

There are two operating systems, Mac OS, and Mac OS X. The former is currently at version 9.2.2, and the latter at 10.1.5. The full names are "Mac OS 9.2.2" and "Mac OS X 10.1.5". Throw in a "v" or "version" if you like.

Using "OSX" is barely acceptable, if only because so many people use it, but it is too non-specific: what is "X"? If "OSX" is to be used for "Mac OS X", then why not "OS" to refer to "Mac OS"? It should be avoided.

"MacOSX" is not acceptable, nor any other form omitting the space between "Mac" and "OS". Using "Mac OS" to mean "Mac OS X" is not acceptable; they are two different operating systems. "Mac OS 9" is acceptable, to distinguish it from previous versions of Mac OS, and barely acceptable to distinguish it from "Mac OS X", only because so many people incorrectly use "Mac OS" to refer to "Mac OS X".

Also printed on my personal site. use.perl.org

perl on Mac OS Slides

| | Comments (0)
I don't know if I ever mentioned them, but here they are. They include good examples for using Inline and osascript, and a super-cool macperl command line program for Mac OS X, that pretends to be "Classic" MacPerl on Mac OS X, but really calls MacPerl in Classic via AppleScript. use.perl.org

Mac::Memory, Mac::Carbon

| | Comments (0)
Warning: everything here is subject to change. I am just picking names and moving code around arbitrarily, more as a proof of concept.

In Mac OS X:

pudge% perl -Iblib/arch -Iblib/lib -MMac::Carbon -MMac::Memory -wle '$x = new Handle "abc"; print $x->get(0, -1); $y = new Handle ("x" x 2**30); print Mac::Carbon::Error(); print $y->size'
abc
-116
Can't call method "size" on an undefined value at -e line 1.

In MacPerl on Classic, to look up the error:

print $^E = -116
 
Size check failed (OS error -116)

So I got everything to compile and work. It'd be nice to have Error() be $^E, but that isn't likely for right now, as I believe it needs core support, and even then, I don't know if it would be feasible (are Carbon/Cocoa values compatible? how do you tell them apart, if not?). If they are the same, great, I can set $^E now via SETERRNO, and perhaps add the needed support later to get the text of the error message, and in the meantime supply a function to look up the text of the error message.

I am probably going to implement the missing C functions in Mac::Carbon (name, like everything else, subject to change), and require Mac::Carbon be loaded at the beginning of all other modules that need it. That'll work.

So the next step is to implement those missing GUSI functions and compile more extensions.

I'll need to redo most of this, though; I am modifying the generated C files, because MacPerl uses a custom xsubpp, and these .xs files won't currently work. Matthias at one point suggested a separate preprocessor, such as macxsubpp or somesuch, to generate the XS files. I think that might be the way to go.

Again, this is all subject to change. :-) use.perl.org
<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 August 2002.

Computers: July 2002 is the previous archive.

Computers: September 2002 is the next archive.

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