Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

dude, where's my Jaguar?

1 view
Skip to first unread message

Jøhnny Fävòrítê (it means "Japanese Sandman")

unread,
Aug 27, 2002, 2:22:38 PM8/27/02
to
I know, it was only released Saturday. But everybody on my other
newsgroups is talking about it and I WANT IT TOO DAMMIT!

I have an Apple-connected friend who works at IBM in Austin. If you
read any of the Mac news-and-rumor-stirred-in-an-unholy-mix sites they
are all abuzz with the idea that Apple will soon drop Motorola CPUs.
The thinking seems to be that they lag behind Intel on price and
performance and the gap is widening. Further, Motorola isn't all that
interested in keeping up, as they are focused on the embedded market
these days. My IBM friend says this is true.

Apparently not able to think of any alternatives, those same Mac rumor
sites seem to think that Apple will start using Intel CPUs instead. My
IBM friend sez NO WAY DUDE! He works in the IBM division that makes
POWER4 CPUs and he says *that's* what's going to be replacing those
Motorola chips that don't seem to be keeping up with Moore's Law
anymore. The tricky part will be emulating Altivec, since Apple's OSX
is heavily invested in the concept, but my IBM friend says they've got
it under control. I don't know the technical details and frankly don't
care, I'll just take his word for it.

So, I don't know if all this is true or not. It could just be what IBM
*wants* to happen and Apple hasn't signed off on it yet. But I've known
this guy since 1992 when we were both working at Newer Technology in
Wichita and he is not prone to making things up, so if I were going to
bet, I'd say that when I eventually have to buy a new Mac to replace the
one I'm using now it will have a POWER4 chip in it.

Word.

So anyway, this guy got a bunch of OSX golden masters from Apple way
before the ship date, because as is commonly known Apple was actually
ahead of schedule for once. He sent me an e-mail while I was in Seattle
asking if I wanted him to mail me one, but I couldn't get my portable to
make an ISP connection while I was there for stupid reasons I won't go
into, so I didn't reply until I got back, or else I'd probably already
have it.

Bummer.

Today's programming topic is: MENUS. I've been stewing over this for
awhile now because between BeOS and MacOSX/Cocoa, menus couldn't hardly
be any more different. The most obvious glaring difference is that OSX
has the one menu along the top of the screen, BeOS has menus stuck to
the top of windows. I was tempted to do things the BeOS way and put
menus directly on MacOSX windows -- I've seen some strict ports of
Windows software that does this -- but decided I'm not quite ready to
fly in the face of long-standing MacOS tradition. Yet. I might revisit
the subject when I've had more experience.

The other big difference is what happens when the user selects a menu
item. In BeOS you assign a BMessage to each menu item which gets sent
to your app when the user selects it. In Cocoa, each menu item is given
a selector (the Obj-C equivalent of a function pointer) that indicates
the particular object and function name to be called. Ewww. Okay, I
guess I can see how that would keep you from having a big ugly switch
statement in your code somewhere to select functions based on
BMessage::what values. The down side is you've got frigging function
names embedded in your frigging menu resources! Tough luck if you
change a function name somewhere and forget to change it in your menus!
Double Ewwww. And if you've got localized menus in more than one
language you'd have to remember to change ALL of them. TRIPLE EWWWW.
I'll take the ugly switch statement over that any day.

Fortunately I found an "out." Selecting a Cocoa menu item sends a
"notification." You can register a particular object that's interested
in menu notifications and it will get called every time the user selects
a menu item, including a pointer to the item selected. And conveniently
you can assign your own unique integers to every menu item, making it
easy to tell them apart. So I'm able to circumvent their elegant
selector-calling methodology with my ugly switch statement methodology
which will A) work in both BeOS and MacOSX and B) I like it better
anyway, since it works in C++ and doesn't use Obj-C weirdness. Previous
posts should have made it obvious how I feel about Obj-C. (Recap: Ptui!
I spit on Obj-C! HWWWWWACK-PTUI!!)

Okay, I'm a little nervous about circumventing Cocoa that way. Whenever
you fly in the face of accepted local methodology that means you're
probably forsaking certain behaviors you'd get "for free" if you'd just
play along and do it the way they want you to. For instance, at the
moment I have no idea how a Cocoa app keeps the Window menu updated, or
makes the Services menu work right, or knows which items on the Edit
menu to enable or disable (I had to do that semi-manually in BeOS
PNews). A bare-bones Cocoa app does seem to get all that right by
itself without any programmer-added logic, though. So I guess I'm
trading one set of problems for a different one.

Alexander G. M. Smith

unread,
Aug 27, 2002, 5:51:39 PM8/27/02
to
So what context is that menu function call going to be in? Is the GUI code in
MacOS running in your application's main thread? Or is it some kernel thread
that calls your menu function?

- Alex

Jøhnny Fävòrítê (it means "Japanese Sandman")

unread,
Aug 27, 2002, 10:38:11 PM8/27/02
to

I'm 80 percent certain that behind the scenes it's pretty much like
BeOS: user interface events end up in your app via Mach message ports.
The ObjC runtime in your app catches it and translates the menu selector
(Object name/instance and method name) into a function call. So it's
more or less like you were doing the work in BWindow::MessageReceived()
but they've relieved you of having to write a switch statement to hand
it off.

I'm 98 percent certain that they wouldn't DARE call one of your app's
functions from a kernel thread. Most of the Carbon/OS9 crud that's in
OSX is not reentrant. I have a sneaking suspicion that much of Cocoa
isn't thread-safe either, which is stupid. They have no excuse,
NeXTStep was multi-threaded from day one. So they don't want to bring
down their house of cards by making excuses for race conditions, which
means no calling app code from kernel code. They want to keep you as
single-threaded as possible.

Here's another fun thing: Cocoa wants you to keep track of something it
calls "first responder." You have to think about it a LOT, as a matter
of fact, it's got a big icon smack dab in the middle of the Interface
Builder tool palette. Basically, it's the ObjC object that has the
input focus. So while the Quit menu item is always targeted at the
NSApplication.terminate: method, The Paste menu item on the Edit menu is
targeted at the FirstResponder.paste: method.

There's a hole here I haven't yet figured out. In an earlier ObjC post
I stated that if an ObjC object receives a message it doesn't know how
to respond to, it simply ignores it. I was wrong about that, I've since
learned that it's an ERROR to send a message to an object that can't
respond to it. I think you get an exception and if you don't catch it
your app dies.

So surely out of all the objects that might become first responder at
any given moment, at least ONE of them is not going to have a paste:
method, you'd think. So I have no idea why most Cocoa apps don't die
left and right from unhandled messages. Put another way, there's a hole
in my understanding somewhere. I think there might be a chain of
command, like if the first responder can't handle it it's passed on to a
.. "second responder?"

Boy, I'm sure glad BeOS kept me from having to deal with this. Messages
just sort of end up where they're supposed to be, I've never had to
think about it much. "First responder" is the type of concept you need
to make weakly-typed systems work, which is another reason I don't like
them.

Alexander G. M. Smith

unread,
Aug 29, 2002, 11:51:40 AM8/29/02
to
Jøhnny Fävòrítê (it means "Japanese Sandman") wrote:
> Boy, I'm sure glad BeOS kept me from having to deal with this. Messages
> just sort of end up where they're supposed to be, I've never had to
> think about it much.

I had to recently, since I'm sidetracking a bit to write a Bayesian statistical
spam detector (http://www.paulgraham.com/spam.html) for the Mail Daemon
Replacement system. I wanted to make it scriptable, so that involved digging
around to find out about resolving specifiers and whatnot. After a bit of
confusion due to some badly named function arguments, I've got it figured out.
I also learned about STL at the same time, should save quite a bit of work.

It's actually fairly simple, just a bit lacking in example code. And back to
the original topic, it routes messages to particular targets (BHandlers) by
resolving specifiers. Incidentally, specifiers are stacks/lists of names, index
numbers or other things which identify a target such as a particular cell in a
spreadsheet).

- Alex

Jøhnny Fävòrítê (it means "Japanese Sandman")

unread,
Aug 29, 2002, 8:52:54 PM8/29/02
to
Alexander G. M. Smith wrote:
> I had to recently, since I'm sidetracking a bit to write a Bayesian
> statistical spam detector (http://www.paulgraham.com/spam.html) for
> the Mail Daemon Replacement system.

d00d! How about giving that thing an API and putting it in a lib so I
can use it in my mail client? Like maybe I could say "here's the
filename of the e-mail file, is it spam or not?" Or give it to you in a
pre-digested buffer or whatever.

Personally I think the proper response to the spam problem is to get a
mail provider that takes care of it for you. I get absolutely ZERO spam
in my Newsguy in-box and they clean up their USENET feed too. But I
expect not everybody will be convinced that that's the proper solution.

Alexander G. M. Smith

unread,
Aug 30, 2002, 4:02:09 PM8/30/02
to
Jøhnny Fävòrítê (it means "Japanese Sandman") wrote:
> d00d! How about giving that thing an API and putting it in a lib so I
> can use it in my mail client? Like maybe I could say "here's the
> filename of the e-mail file, is it spam or not?" Or give it to you in a
> pre-digested buffer or whatever.

The actual algorithm is short, if you have STL available. About 500% of the
code is scripting interface, GUI interface, saving and loading settings, and
general interface gunk. I'll let you know when it is done so you can scam the
core code and then add your own gobs of gunk for Mac OSX.

- Alex

Alexander G. M. Smith

unread,
Sep 3, 2002, 9:05:06 PM9/3/02
to
Jøhnny Fävòrítê (it means "Japanese Sandman") wrote:
> d00d! How about giving that thing an API and putting it in a lib so I
> can use it in my mail client?

If you don't mind the GPL, http://www.tuxedo.org/~esr/bogofilter/ has Eric S.
Raymond's version of the program.

- Alex

Jøhnny Fävòrítê (it means "Japanese Sandman")

unread,
Sep 3, 2002, 9:17:27 PM9/3/02
to
Alexander G. M. Smith wrote:
> If you don't mind the GPL, http://www.tuxedo.org/~esr/bogofilter/ has
> Eric S. Raymond's version of the program.

Nope, I don't think I can go with GPL, since I will not be revealing the
source to my e-mail client. I notice the OBOS guys seem to be shunning
GPL'ed code also and that's an open-source project, so if they can't
abide buy it I doubt I can either.

Does this mean you're not going to do your own implementation after all?

Alexander G. M. Smith

unread,
Sep 4, 2002, 3:37:54 PM9/4/02
to
Jøhnny Fävòrítê (it means "Japanese Sandman") wrote:
> Does this mean you're not going to do your own implementation after all?

Oh no, it's coming along nicely. Big coding burst yesterday, after getting the
scripting infrastructure finished, parameter settings saving finished, database
load and save finished, MIME type registration working, I finally had it break
apart an email file into words. After some corrections for quoted-printable
encoding (I'm not going to fully decode the article, though I could use the Mail
kit to do that), it works well enough (STL helps a lot). Next up is adding the
words to the main database (easy), doing the spam probability evaluation math,
then doing the GUI side (hard), then the BeMailDaemon add-on, then adding a
special Spam Delete button to BeMail (which will send scripting messages to the
database server).

- Alex

P.S. Here is an example run on your message:

Wed Sep 4 15:28:20 239
/boot/home/agmsmith/Programming/AGMSBayesianSpam>AGMSBayesianSpamUpdater
/tmp/PM999686.pmf
AGMSBayesianSpamUpdater - A Spam Database Updater
Copyright © 2002 by Alexander G. M. Smith. Released to the public domain.

Compiled on Sep 3 2002 at 23:06:36. $Revision: 1.13 $ $Header:
/boot/home/agmsmith/Programming/AGMSBayesianSpam/RCS/AGMSBayesianSpamUpdater.cp
p,v 1.13 2002/09/03 21:50:54 agmsmith Exp agmsmith $

This is a program for classifying e-mail messages as spam (junk mail which you
don't want to read) and regular genuine messages. Actually, this is the half
of the system which learns what's spam and what's genuine. You just give it a
bunch of spam messages and a bunch of non-spam ones. It uses them to make a
list of the words from the messages with the probability that each word is from
a spam message or from a genuine message. Later on, some other program will
use those probabilities to classify new messages as spam or not spam. If the
classifier stops working well (because the spammers have changed their writing
style and vocabulary, or your regular correspondants are writing like
spammers), you can use this program to update the list of words to identify the
new messages correctly.

Usage: Specify the operation as the first argument followed by more information
as appropriate. The program's configuration will affect the actual operation
(things like the name of the database file to use, or whether it should allow
non-email messages to be added). In command line mode it will do the operation
and exit. In GUI/server mode a command line invocation will just send the
command to the server. You can also use BeOS scripting (see the "Hey"
command which you can get from http://www.bebits.com/app/2042 ) to control the
Spam updater. And finally, there's also a GUI interface which shows up if you
start it without any command line arguments.

Commands:

Quit
Stop the program. Useful if it's running as a server.

Get DatabaseFile
Get the pathname of the current database file. The default name is
B_USER_SETTINGS_DIRECTORY / AGMSBayesianSpam / SpamDatabase.absdb

Set DatabaseFile NewValue
Change the pathname of the database file to use.

Create DatabaseFile
Creates a new empty database, will replace the existing database file too.

Delete DatabaseFile
Deletes the database file and all backup copies of that file too. Really only
of use for uninstallers.

Count DatabaseFile
Returns the number of words in the database.

Set Spam NewValue
Adds the spam in the given file or directory (specify full pathname to be
safe) to the database. If you specify a directory, all relevant files in the
directory will be processed (it ignores directories in that directory). The
words in the files will be added to the list of words in the database that
identify spam messages. The files processed will also have the attribute
MAIL:spam added with a value of true. If they already have that attribute set
to true then they won't get processed (and if it is false, they get removed
from the genuine statistics and added to the spam statistics). The command
line version lets you specify more than one pathname (maximum around 100, the
message queue size limit).

Count Spam
Returns the number of spam messages in the database.

Set Genuine NewValue
Similar to adding spam except that the messages are added to the genuine
statistics.

Count Genuine
Returns the number of genuine messages in the database.

ResetToDefaults
Resets all the configuration options to the default values.

InstallThings
Creates indices for the MAIL:spam and MAIL:spam_probability attributes,
identifies them to the system as e-mail related attributes, and sets up MIME
types and icons for the database file.

Bad command line arguments supplied. Here are the 2 parameters:
0: "./AGMSBayesianSpamUpdater"
1: "/tmp/PM999686.pmf"
Wed Sep 4 15:28:32 240
/boot/home/agmsmith/Programming/AGMSBayesianSpam>AGMSBayesianSpamUpdater set
spam /tmp/PM999686.pmf
bleeble word in message: "-0500"
bleeble word in message: "0.9.7"
bleeble word in message: "03"
bleeble word in message: "1.0"
bleeble word in message: "10"
bleeble word in message: "17"
bleeble word in message: "20"
bleeble word in message: "2002"
bleeble word in message: "21"
bleeble word in message: "27"
bleeble word in message: "3"
bleeble word in message: "33"
bleeble word in message: "38"
bleeble word in message: "5.0.3"
bleeble word in message: "563"
bleeble word in message: "8bit"
bleeble word in message: "abide"
bleeble word in message: "after"
bleeble word in message: "alexander"
bleeble word in message: "all"
bleeble word in message: "also"
bleeble word in message: "alt.internet.talk.haven"
bleeble word in message: "an"
bleeble word in message: "and"
bleeble word in message: "arva"
bleeble word in message: "be"
bleeble word in message: "beos"
bleeble word in message: "beta"
bleeble word in message: "bigboote"
bleeble word in message: "bogofilter"
bleeble word in message: "brunsona"
bleeble word in message: "buy"
bleeble word in message: "can"
bleeble word in message: "can't"
bleeble word in message: "charset"
bleeble word in message: "client"
bleeble word in message: "code"
bleeble word in message: "content-transfer-encoding"
bleeble word in message: "content-type"
bleeble word in message: "cr593174-a.rchrd.phub.net.cable.rogers.com"
bleeble word in message: "cyclone.bc.net"
bleeble word in message: "date"
bleeble word in message: "dex"
bleeble word in message: "do"
bleeble word in message: "does"
bleeble word in message: "don't"
bleeble word in message: "doubt"
bleeble word in message: "e-mail"
bleeble word in message: "edt"
bleeble word in message: "either"
bleeble word in message: "enews1"
bleeble word in message: "eric"
bleeble word in message: "esr"
bleeble word in message: "extra.newsguy.com"
bleeble word in message: "f"
bleeble word in message: "from"
bleeble word in message: "g"
bleeble word in message: "go"
bleeble word in message: "going"
bleeble word in message: "gpl"
bleeble word in message: "gpl'ed"
bleeble word in message: "guys"
bleeble word in message: "has"
bleeble word in message: "hell"
bleeble word in message: "hnny"
bleeble word in message: "http"
bleeble word in message: "i"
bleeble word in message: "if"
bleeble word in message: "implementation"
bleeble word in message: "inc"
bleeble word in message: "intel"
bleeble word in message: "iso-8859-1"
bleeble word in message: "it"
bleeble word in message: "j"
bleeble word in message: "japanese"
bleeble word in message: "lines"
bleeble word in message: "m"
bleeble word in message: "mean"
bleeble word in message: "means"
bleeble word in message: "message-id"
bleeble word in message: "messaging"
bleeble word in message: "mime-version"
bleeble word in message: "mind"
bleeble word in message: "minion.nashville.comcast.net"
bleeble word in message: "my"
bleeble word in message: "news"
bleeble word in message: "news.webusenet.com"
bleeble word in message: "news02.bloor.is.net.cable.rogers.com"
bleeble word in message: "news03.bloor.is.net.cable.rogers.com"
bleeble word in message: "newsfeed.telusplanet.net"
bleeble word in message: "newsgroups"
bleeble word in message: "newsp.newsguy.com"
bleeble word in message: "nntp-posting-host"
bleeble word in message: "nope"
bleeble word in message: "not"
bleeble word in message: "notice"
bleeble word in message: "obos"
bleeble word in message: "of"
bleeble word in message: "open-source"
bleeble word in message: "organization"
bleeble word in message: "own"
bleeble word in message: "p-730.newsdawg.com"
bleeble word in message: "path"
bleeble word in message: "pineapple"
bleeble word in message: "pineapplenews.html"
bleeble word in message: "plaid"
bleeble word in message: "plain"
bleeble word in message: "pln-e"
bleeble word in message: "pm0003a93596c67fb8"
bleeble word in message: "pm0003a93881d0a026"
bleeble word in message: "pm0003a93c8301a6f5"
bleeble word in message: "pm0003a95bb3f6fff6"
bleeble word in message: "pm0003a96346309cd3"
bleeble word in message: "pm0003a9c7ff9feda3"
bleeble word in message: "pm0003a9c8332bd7c2"
bleeble word in message: "program"
bleeble word in message: "project"
bleeble word in message: "ps01-sjc1"
bleeble word in message: "q"
bleeble word in message: "r"
bleeble word in message: "raymond's"
bleeble word in message: "re"
bleeble word in message: "references"
bleeble word in message: "revealing"
bleeble word in message: "s"
bleeble word in message: "sandman"
bleeble word in message: "scripting"
bleeble word in message: "seem"
bleeble word in message: "sep"
bleeble word in message: "shunning"
bleeble word in message: "since"
bleeble word in message: "smith"
bleeble word in message: "so"
bleeble word in message: "source"
bleeble word in message: "spln"
bleeble word in message: "subject"
bleeble word in message: "systems"
bleeble word in message: "t"
bleeble word in message: "text"
bleeble word in message: "that's"
bleeble word in message: "the"
bleeble word in message: "they"
bleeble word in message: "think"
bleeble word in message: "this"
bleeble word in message: "this.is"
bleeble word in message: "to"
bleeble word in message: "totally.fake.com"
bleeble word in message: "tue"
bleeble word in message: "user-agent"
bleeble word in message: "v"
bleeble word in message: "version"
bleeble word in message: "will"
bleeble word in message: "with"
bleeble word in message: "wrote"
bleeble word in message: "www.beosdevelopers.org"
bleeble word in message: "www.tuxedo.org"
bleeble word in message: "x-program-url"
bleeble word in message: "x-received-date"
bleeble word in message: "x-registered-to"
bleeble word in message: "xref"
bleeble word in message: "you"
bleeble word in message: "you're"
bleeble word in message: "your"
Result of command to Set Spam "/tmp/PM999686.pmf" is just plain success.

Jøhnny Fävòrítê (it means "Japanese Sandman")

unread,
Sep 4, 2002, 6:24:30 PM9/4/02
to
Alexander G. M. Smith wrote:
> P.S. Here is an example run on your message:

Apparently I tend to use too many "bleeble words." I can't remember, am
I supposed to replace those with active voice or adjectives? Who's got
a Strunk and White handy?

This could be really helpful, actually. E-mail spam is the bigger
problem (for me at least) but those hard-to-plonk USENET posters are a
very real concern. A quick glance at my killfile shows ten entries for
one overzealous poster I don't like, 16 for one just below that, 11 a
bit farther down, etc. And it throws out entries older than six months
or else I *know* this one guy would be up close to a hundred.

I can plonk them faster than they can type in a new alias, and I
optimized my killfile for fast lookups (hence the requirement for an
exact match on the From: line), but geez. And I suspect the Bayesian
approach would even get posts that quote too much of others I don't
like. That would be all k3wl and stuff.

Alexander G. M. Smith

unread,
Sep 5, 2002, 9:45:00 AM9/5/02
to
Jøhnny Fävòrítê (it means "Japanese Sandman") wrote:
> I can plonk them faster than they can type in a new alias, and I
> optimized my killfile for fast lookups (hence the requirement for an
> exact match on the From: line), but geez. And I suspect the Bayesian
> approach would even get posts that quote too much of others I don't
> like. That would be all k3wl and stuff.

And kill those make money fast articles too!

- Alex

Jøhnny Fävòrítê (it means "Japanese Sandman")

unread,
Sep 6, 2002, 12:06:55 PM9/6/02
to
Alexander G. M. Smith wrote:
> And kill those make money fast articles too!

See, that's why you should get a Newsguy account. Spam is almost
unheard of here. They even filter out the meowers, by virtue of not
allowing massive cross-posting.

Today it looks like they weren't able to filter out the guy posting one
message in Spanish to almost every newsgroup I subscribe to, but that's
a very rare exception.

My biggest USENET spam problem is regular people replying to spam I
can't see with their witty retorts. "No, I will NOT buy your advertised
product. Would you like to know why? Because you, sir, are a SPAMMER!
And if you don't stop it, I will APPLY SOME SERIOUS KILLERATIONISM ON
YOU UNTIL YOU ARE TOTALLY COMPLETELY DEAD. There! I guess I showed
YOU, didn't I? Go forth and do not spam again. Wow, you guys sure are
LUCKY to have ME dealing with your SPAM problem around here."

0 new messages