Just got an email from Tim Conner, developer of BlogApp and BlogScript (also, he has some neat AppleScript snippets as well) with a couple of string functions he uses:

(**** Example ****)
-- this example will find the word "work" in the string 
-- "Bob went to work." and replace it with "the beach".
set myResult to snr("Bob went to work.", "work", "the beach")
display dialog myResult
--
(**** fast search and replace methods ****)
on snr(the_string, search_string, replace_string)
  return my list_to_string((my string_to_list(the_string, search_string)), replace_string)
end snr
on list_to_string(the_list, the_delim)
  my atid(the_delim)
  set the_string to (every text item of the_list) as string
  my atid("")
  return the_string
end list_to_string
on string_to_list(the_string, the_delim)
  my atid(the_delim)
  set the_list to (every text item of the_string) as list
  my atid("")
  return the_list
end string_to_list
on atid(the_delim)
  set AppleScript's text item delimiters to the_delim
end atid

Should come in handy next time I take the fork to the eye.

Thought: would remove human error from spam/ham classification if you sent for training based on message location (if misclassified message is in inbox, always classify as spam, if it’s in the error mailbox, always classify as ham); working on that tonight.

OK, done. Here’s a version of my script that will automatically submit as misclassified spam anything in the inbox, and misclassfied ham if its anywhere else (easier than coding the specific folder, should be just as effective). Sure it has the possibility of being slightly usafe, but less than human error for me at least. (Alternate method would be to tokenize message and find out if it’s classified as spam or not and reverse, actually not that hard since I already tokenize to strip the X-CRM-Status header)… Well, it’s late and I’m lazy. Good enough.

I finally got around to setting up postfix, courier, procmail, getmail, and crm114 all up on my server. It was surprisingly painful considering I already had postfix and courier working. I’ve not figured out why mutt is being a pain…

In any case, I’m now training CRM114. Having done only a few dozen error corrections, it’s already starting to get pretty good. Hopefully I’ll have enough volume in the next couple of weeks to really get it well trained, and then never have to worry about it again.

Training involves forwarding erroneous mail back to yourself prepended with a ‘spam’ or ‘nonspam’ command and your password. Since Apple’s Mail.app doesn’t do full-source forwarding by default, I wrote to AppleScripts to automate the process (one of Apple’s included scripts gets you half-way there). They send out an email automatically as spam/nonspam (stripping the bad X-CRM114-Status line as well) and either delete or move to the inbox as appropriate. (I also have procmail set up to move the training results into its own folder)

Rename the last part to whatever you want your key command to be, and put it in your ~/Library/Scripts/Mail Scripts/ folder.

Lastly, I want to reiterate how much AppleScript documentation sucks total ass. The Language Guide is useless since it doesn’t have any references to basic operations (so, if Google doesn’t turn anything useful up on applescript string parsing, you’re up a creek – this stuff isn’t in the application dictionaries either…). Basically, the only way to get anything done is to dig around until you find an AppleScript that does something similar.

Well, this month has just flown by. Link-dumpy:

  • Jason Schultz (EFF) misquoted in recent LA Weekly article on RIAA raids
  • Visualizing Social Networks by Linton C. Freeman, UCI

    This paper documents the use of pictorial images in social network analysis. It shows that such images are critical both in helping investigators to understand network data and to communicate that understanding to others.

  • Locative Packets – debuting @ ETCON, coming up in… 3 weeks (!!!)

    The Locative Media Lab is co-sponsoring a Collaborative Mapping
    workshop

    at O’Reilly’s Emerging Technology 2004 conference in San
    Diego, CA. We invite developers to join our experiment in collaborative
    geoannotation by connecting their applications to the workshop
    aggregation service.

    The workshop’s aggregator will offer a REST interface with a simple
    RDF/XML format for geoannotations, ‘locative packets’, with, we hope,
    the following aims:

    • A simple XML serialisation that different applications can produce and consume, without even having to be RDF-aware.
    • A shared ‘protocol’ which different applications can accept and send via HTTP POST, Jabber, …

    • Simple guidelines for RDF vocabularies to use in geoannotation.
  • Spamassassin Custom Rule Emporium! – although, why bother now that CRM 114 is now at 99.9%+ accuracy? (Postfix HOW-TO)
  • I’m an Expert – reaction to stupid alarmist CIO.com article on The Future of Security (is this where CIO’s get their harebrained ideas? I can imagine some PHB reading and nodding along to this article)
  • You mean stop the fraud – spam is fundamentally a fraud problem (although I suppose tweaking either the economics or the authentication model would be good fixes; post along those lines)
  • The Spammers’ Compendium

    Being a public exposition of tricks,
    secret ploys, ruses and techniques
    employed by those that send many
    scurrilous messages through the ether
    using the mysteries of electronics and
    other modern marvels to dazzle the eye,
    lighten the wallet and clog the recipient.

  • Clark’s True Colors – is this the alternative to Bush?

    Clark’s new book, Winning Modern Wars, is 200 pages long, all about the Iraq war. Yet there is only one instance in the entire book in which he gives a physical description of the death of a human being, that being a mention of some Marines in Nasiriyah who were found with bullet holes in their heads. Everywhere else, human beings are described as “targets” or “objectives” or even “high-value targets,” and their deaths are rendered with sports/ football metaphors (“going ‘downtown’ with air power,” “Red Zone” attacks, “the Big Win,” etc.) and bloodless euphemisms for words like “kill” or “assassination” (“destroy,” “decapitating strike”). Moreover, he never mentions civilian casualties without qualifying his statements–the “alleged mistakes of the bombing campaign,” the “hapless women and children reported to be victims of the bombing.”

    If this kind of talk sounds familiar, that’s because it is. Clark doesn’t hide it. “I’m a product of that military-industrial complex General Eisenhower warned you about,” he said with a smile a few weeks ago, during a speech at the UNH campus in Manchester. The general assumed–correctly–that the term no longer inspired revulsion in young audiences.

    He says it’s something else, but maybe this is what Clark means by the New American Patriotism. New faces, no memories. Fresh recruits to replace the defeatists. A new base for Big Win thinking.

    [this is disturbing]

  • Quarantining dissent: How the Secret Service protects Bush from free speech – speaking of the dubya
  • And nailing his puppeteer Rove: The CIA Agent Flap: FBI Asks for Reporteres to Talk
  • State of the Union Scorecard – play along at home on Tuesday (or, if like me, you can’t stand the sound of dubya’s voice, read the transcript and play along on Wednesday)
  • The Doctor Is In – The Rolling Stone Interview with Howard Dean

    So you are just going to change the subject?

    Yeah. If we allow the Republicans to run the campaign based on divisive
    issues — like prayer in school, gay marriage and gun control — then
    we lose. The right wing will try to make a big issue of it, and they’ll
    get some votes from some people who would have voted for them anyway.

    Most people do not want to traffic in hate. And this election is going
    to be about whether we cater to the worst in us or cater to the best in
    us, and I intend to do the latter.

    A lot of people say that maybe we don’t have much economic
    pressure against the Saudis. They hold billions in U.S. Treasury notes.
    What if they responded by threatening to liquidate their investment in
    our government? Wouldn’t we be screwed?

    Balancing the budget would help that. I mean, this president has made
    us much weaker than we were when we got here: $500 billion deficits as
    far as the eye can see is a terribly weakening thing to the economy.
    Both the Chinese and the Saudis, and others, hold enormous amounts of
    T-bills. That’s a huge problem for us in an era with a declining dollar
    and a huge deficit. If most Americans understood what you just said,
    George Bush would be gone.

    See The Triumph of Hope Over Self-Interest:

    The most telling polling result from the 2000 election was from a Time magazine survey that asked people if they are in the top 1 percent of earners. Nineteen percent of Americans say they are in the richest 1 percent and a further 20 percent expect to be someday. So right away you have 39 percent of Americans who thought that when Mr. Gore savaged a plan that favored the top 1 percent, he was taking a direct shot at them.

blogs: bIPlog – Berkeley Intellectual Property Weblog, socialfiction.org – web/tech, Napsterization – P2P/social, Orcmid’s Lair – programming/tech