Archive for the 'Tech' Category

Comment Spam

Sunday, October 24th, 2004

I’ve been suffering from the latest epidemic of WordPress comment spam. Most of the spam was stopped for moderation, but it’s still annoying to have to go in and reject them all. I decided to skip most of the usual advice and move directly to
renaminng the wp-comment-post.php file.

Once the file is renamed, you just need to go in and replace the old filename with the new one in a few other WP files. The files I edited were:

wp-comments.php
wp-comments-popup.php
wp-comments-reply.php

I apologize in advance if anything breaks

Update: Well, it worked for one spammer, but now I seem to have picked up a new spammer, though this one isn’t quite as active.

Update: I’m also trying this hack to mass-delete comments, while I wait for the new, more spam-proof version of WordPress to come out.

LJ RSS Feeds with Locked Posts

Monday, October 18th, 2004

Note: There is content after the geeking, really.

I found a couple of blog entries about authenticating LJ RSS feeds so you can see friends-locked posts in NetNewsWire and better RSS readers everywhere: eclecticism (Reading protected LiveJournal entries via RSS) and
life - listed chronologically (LiveJournal RSS Celebration).

The LJ FAQ (Question #149) isn’t nearly as informative. It doesn’t mention putting the username and password into the RSS URL. I’ve been experimenting with leaving it out, and NetNewsWire will ask me for the password and save it in the keychain if I do. That’s probably a better approach.

Jerie was kind enough to lend me a test account to try it out, and it does all work. Rather than make everyone friend a sockpuppet, though, and since the RSS feed thing gives me a use for one for the first time, I made my own LJ account. I’m not planning to post anything there except possibly Stargate fic announcements, but friend the new me if you want me to see your friends-locked posts. I will still read your LJ RSS feeds even if you don’t friend me, and I won’t get offended or anything about it.

Zoom into Links

Tuesday, October 12th, 2004

Here are some fun and handy links I’ve come across recently:

Tabbar

Monday, October 11th, 2004

This entry inaugurates my new emacs category, which I’ve already stocked with some old emacs-related posts. (Emacs is the infinitely extensible text editor with a soft spot in its heart for elisp.)

The emacs extension of the day is tabbar.el. I was feeling jealous of cool new Mac text editors like TextMate with their drawers and their clickable tab-like buttons. How I wished that emacs had a pop-out drawer, or at the very least, tabs.

So I googled for tabbed emacs, and found the magic elisp file at EMHACKS. (Download it from the tabbar files section.) In just a few short moments, I had tabs!

Although it is documented, tabbar has no handy start-up guide for beginners. With the help of Zhou Chen’s Emacs Tools page, I figured out that I needed to add

(require 'tabbar)
(tabbar-mode)

to my .emacs file just to get the tab bar to show up.

Next, I wanted to do a keybinding to get emacs to switch tabs with command-shift-left-arrow and command-shift-right-arrow, the way Safari and iTerm do. With the help of the emacs function keys info node, I found the right combination for my .emacs file:

(global-set-key [A-S-left] 'tabbar-backward)
(global-set-key [A-S-right] 'tabbar-forward)

[The above may depend on (setq mac-command-key-is-meta nil). If you don’t have that setting, then try M-S-left and M-S-right instead.] You can also assign ‘tabbar-backward-group and ‘tabbar-forward-group the same way, but ‘tabbar-backward and ‘tabbar-forward will scroll through groups as well so I didn’t bother.

I didn’t like the way tabbar assigned my buffers to groups, so I wrote my own version of the tabbar-buffer-groups function and put it in my .emacs file, too.
(more…)

The New PithHelmet

Thursday, September 30th, 2004

Survey of the day: Outboard Brains for Mac OS X, an old survey article from MacDevCenter.com

I was happy to discover that my Amazon problem is not all in my mind—they really do have extremely annoying Javascript focus code on their site that shifts focus to an Amazon page when I don’t want to look at it. For I while I just blocked Amazon completely using PithHelmet 0.7.2a for Safari, but that’s a brute force solution.

What I really needed was a Safari plug-in that would turn off only the offending javascript (since nobody these days can live without Javascript), or barring that, one that would turn Javascript off just for the offending websites. PithHelmet 2 is supposed to be able to do both.

Unfortunately, as has been reported by many users at VersionTracker, PithHelmet 2.0.1 is a buggy swamp. It has an obscure and counter-intuitive interface (both the annoying menu and the new preference panel), it slows down page loading, it doesn’t import rules from previous versions, and it forgets its own settings. It refused to load the included Python script designed to demoronize Amazon, though the promise of that sample script was my main reason for installing 2.0.1 despite the bad experiences reported in the VersionTracker comments. Maybe I needed some sort of Python compiler. That wasn’t mentioned in the documentation—but usability was clearly not the hallmark of this release. At least the option to turn off Javascript for Amazon.com did seem to work.

I saw all these problems in the few minutes I ran it before downgrading to 0.7.3. On the bright side, it did turn on the Safari Debug menu for me, and left it on after the downgrade. Since PithHelmet has gone from freeware to shareware, I hope Mike Solomon will start treating it like real mac software—that means providing real documentation and an intuitive interface. (Hide the regular expressions, at least!)

Since I canned the above entry, PithHelmet has gone up a subversion to 2.1. The changelog claims it’s faster and that some of the preference bugs have been fixed, so I’m giving it another try.

Someday, somehow, Amazon will be demoronized.

Scary System Crash

Sunday, September 26th, 2004

As the Apple Turns discusses the recent loss of “talkie with the big flying things” in LA:

According to Techworld (which in turn cites an LA Times story from a week ago), the Windows-based radio system for an air traffic control center in Southern California took a three-hour coffee break recently, leaving “800 planes in the air without contact to air traffic control.” But hey, how dangerous could that possibly be?

I heard about the failure, but not that it was Windows’ fault. I should have known. As the Apple Turns looks toward the Windows future:

…while we’d never wish a midair plane crash on anyone, part of us can’t help but suspect that if anything can get the Windoid lemmings to consider that “hey, maybe this operating system kindasorta sucks rocks out loud,” it would be a fiery hail of twisted, screaming metal and black and red body parts pummelling the tarmac at LAX. Will a near-miss or two be enough of a wake-up call? We sure hope so.

If that doesn’t do it, maybe the radioactive glass crater will do the job. Somehow I suspect even that won’t work unless by chance a Windows-guided missile takes out Redmond.

NetNewsWire 2 in Beta

Thursday, September 23rd, 2004

A mac-attack link dump:

Pretty Pages

Wednesday, September 22nd, 2004

I like looking at lovely web pages. Here are some I’ve spotted recently

Converting .webloc files

Sunday, September 19th, 2004

Speech of the day: Aragorn’s ever-popular not this day monologue

Warning: Geeking ahead!

Safari and most other Mac browsers will save individual links as a clickable .webloc file, recognizable by the little “HTTP” on the document icon. I’m always dragging links from Safari or Mail to the desktop for later reading, blogging, or filing away. When I’m off-line and I just want to click something later, a webloc is fine, but when I have a huge folder full of links, reopening each one in Safari can be a pain. Cutting and pasting links for a link dump blog entry is time-consuming. There ought to be a script for that, so I wrote one.

Webloc files are hard to work with because the URL is in the resource fork. Here are a few useful links that discuss getting the URLs out of the resource fork—incidentally, this link dump is an example of my new script in action:

The case I really wanted to handle was my collection of reference links. Normal people would bookmark them but I keep them in folders sorted by topic, along with html and other files. I’ve tried wikis and blogs and xml DTDs for keeping information organized, but I’ve found that the best knowledge management software for me is the Apache webserver that came with my mac. Safari will display xml, text, html, pdf, and rtf, plus my local WordPress writing journal, so I keep all my writing info on my local website. I use a php script to index each directory and provide navigation. The system works perfectly, except that I can’t see the .webloc files or open them through Apache—they can only be opened by clicking on them in the Finder.

So I took a shell script from one of the macosxhints articles about converting Mac weblocs to the PC analogue, and hacked it until it took a bunch of weblocs and converted them to an html list, which can be easily cut and pasted into the blog. The output is actually a full html page (sent to stout) which I can use for my local web pages. The script can be edited easily to change the html. At some point I may make a version that outputs markdown-native links.

To use the script, download linkdumper.txt. Change the permissions so it’s executable (chmod 755 linkdumper.txt), rename it if you’d like, then run it in the Terminal. Typing ./linkdumper.txt *.webloc should work, if you don’t understand shell scripts. If you type just ./linkdumper.txt, you get a short help blurb. I keep my copy of the script in ~/Library/Scripts/, though I had to add that directory to my path. Please keep in mind that I know very little about shell scripting, and weird things may happen. Weird things happened during the hacking of this script, though I’ve been unable to reproduce them.

Pardon the extreme geeking.

P.S. I forgot to link Faviconic, a nice little program to add a site’s favicon to its webloc icon.

Cool Color Tool

Friday, September 17th, 2004

Voet Cranf has a neat color tool. Click on one of the colored squares, and then on the plus sign that appears in the lower right corner of the square. Then slide the sliders! Or read the directions and find out what all the other controls do.