Archives / Search ›

Another day, another WordPress upgrade

Running WordPress 2.0.4 now. The upgrade took longer than expected, but I’ve documented what I need to do for next time, and upgraded a couple of my plugins as well. Hopefully nothing broke.

The ICeCoffEE 1.4.3 release went pretty well—I’ve received two crash reports, and one user claimed it didn’t work for him. One of the crashes is not my fault: Safari crashed during a page load triggered by a Command-click. For the other one, I discovered that I had completely stripped the distributed binaries, which isn’t too useful for debugging:

Thread 0 Crashed:
0   com.apple.CoreFoundation       	0x90853b76 CFBundleCopyLocalizedString + 106
1   net.sabi.ICeCoffEE             	0x002e5358 APEBundleMainLateLoad + 23883
2   net.sabi.ICeCoffEE             	0x002e569b APEBundleMainLateLoad + 24718

I haven’t yet figured out how to map those addresses back to the source code, so I’ll repost 1.4.3 with symbols later this weekend. It’s now less than a week until I leave for WWDC, the pace of my research work continues to quicken and I’ve got a lot left to arrange.

Restoring backslashes in WordPress

Sorry if anyone tried the scripts I posted yesterday and found them inoperative—they were missing backslashes. I used to always verify this stuff back when I was using more finicky blogging tools, but given WordPress generally does the right thing™ I didn’t worry.

WordPress strips backslashes inside <pre> tags because quotes get escaped. I spent a while searching for the responsible regular expression substitution before finding out PHP had a function to strip backslashes. The line responsible is the second last of wpautop in wp-includes/functions-formatting.php:

$pee = preg_replace('!(</pre><pre .*?=".*?">)(.*?)</pre>!ise', " stripslashes('$1')
                    .  stripslashes(clean_pre('$2'))  . '' ", $pee);

While this eliminates the extra backslashes before quotation marks, it also removes other backslashes. Here’s a fix:

$pee = preg_replace('!(</pre><pre .*?=".*?">)(.*?)!ise', " stripslashes('$1') 
                    .  str_replace('\\\\\"', '\"', clean_pre('$2'))  . '' ", $pee);

Most incompatible blog ever

So I saw a link to this weblog on Planet Python, and thought it would be interesting to subscribe. But…

  • Even simple display of blog entries requires JavaScript, so they don’t render in NetNewsWire (where I have JavaScript disabled).
  • Even with JavaScript enabled, entries don’t render in released versions of Safari, and links to old posts are broken in Opera. Everything appears to work fine in Mozilla and WebKit trunk.
  • With browsers that actually load the pages, there’s often an annoying lag between when an empty page shell loads, apparently completely, and when the content deigns to appear. If you try to expand a post, the page inexplicably scrolls to the top for a second, before giving you what you asked for.
  • The RSS feed is titles-only, so I can’t read it that way either.
  • There are no visible permalinks on the site itself: every link just calls some JavaScript function or other.

So in order to find the first entry (which, conveniently, is #15) I had grab it from the RSS feed, or guess. The author is aware of the problems, as shown by a comment on that post. His name and email address, of course, appear nowhere apparent on the blog, but can be obtained through whois or his PyWeek entry (the latter seems to be a reasonably normal Web page).

After all that, the content is actually pretty decent, so I’ll remain subscribed; I’ll just curse loudly every time I have to switch browsers to view an entry. I look forward to version 2.0 implemented entirely in Flash.

Terminal.app cloning script

I’ve been doing some Java programming locally on my Mac recently, and one thing I became frustrated at was navigating Java hierarchies in Terminal. Here are a few zsh snippets I wrote to help me:

clone() {
  local cmd ws
  if [ $# -eq 0 ]; then
    cmd="cd \"${PWD:q}\""
  else
    cmd="${@:q}"
  fi
  ws="{ WindowSettings = ( { ExecutionString = \"clear;${cmd:q}\"; } ); }"
  plutil -convert xml1 =(print ${ws:q}) -o /tmp/$$.term && \
  open /tmp/$$.term && \
  rm /tmp/$$.term
}

This one, if invoked with no arguments, creates a new Terminal window changed into the current directory. With arguments, it executes the named command in a new window.

After writing it, I did a quick Google search to see if anyone else had written something similar, and found this post by Marc Liyanage. Like I did originally, his version uses osascript, which is rather slow to start; so instead I write a temporary terminal settings file and open it. The plutil invocation is there to make sure I don’t end up creating an invalid plist; managing the quoting is a bit painful even with the power of zsh. Feel free to replace open with my launch utility, which will make it even faster.

The second one is rather simple and self-explanatory:

# ctrl-up arrow inserts "../"
bindkey -s '\eOa' '../'

When typing a long string of ../../../../, I tend to get the dots and slashes mixed up. Control-arrow mappings are not standardized (the one above is from rxvt), so you’ll have to configure it the Terminal inspector if you want to use it. With zsh‘s AUTO_CD option, you don’t need the cd to change directories, either.

The last one is extremely specialized, but if you need it, you need it:

upload() {
  local sddisk=${$(diskutil list | grep miniSD)[(w)-1]}
  local bndl
  if [ $# -eq 1 ]; then
    bndl="$1"
  else
    bndl=work/3.0/*.bndl
  fi
  print upload bundle ${~bndl} | pbcopy && \
	htconsole && [ ! -z $sddisk ] && disktool -e $sddisk
}

This one helps you upload bundles to the hiptop3 when you’ve got USB mass storage support enabled. It’ll copy the upload command to the clipboard, and unmount the device after htconsole exits. Replace “miniSD” with the volume name of your SD card.

ICeCoffEE 1.4.3 released

ICeCoffEE 1.4.3 is out, and it’s Intel native. Thanks to Sven-S. Porst for his help in getting it ported (which really just involved recompiling) and tested. This evening, I finally had a chance to test it for myself on a friend’s Intel iMac. Everything is so fast… can’t wait until I get a new machine myself.

Here’s a full list of changes:

  • Now a Universal Binary, compatible with Intel Macs
  • Updated to Application Enhancer (APE) 2.0.1 and Unsanity Installer 3.6.1
  • Supports Smart Crash Reports
  • Removed TEClick support
  • Added standard APE icon
  • Restored Services in recent Camino versions’ contextual menus
  • Fixed Terminal crash when clicking disabled minimize or close controls in Open dialog
  • Strips whitespace from URLs
  • Corrected Command-clicking behavior in development WebKit versions
  • Upgraded project to Xcode 2.3; various packaging improvements; eliminated pesky warnings from release build

I haven’t seen any new bugs or flakiness in my testing, but as always, if anything comes up, post a comment here or email icecoffee at sabi.net. Enjoy!

‹ Newer Posts  •  Older Posts ›