WordPress “Pages” No Longer Work

All the “pages” linked from my weblog — for example, my “about” page and my PGP key — are broken. I’ve posted in the WordPress Support Forums with no luck. I’m not sure when or why they stopped working, but if any readers have any suggestions of how to troubleshoot, I’d love to hear about it. Nothing relevant appears in server logs.

In the meantime, apologies if you came here trying to find out about me. I’m temporarily out of service.

A Much Simpler Fix for the r8169 “Link-Down” Problem

There is a widespread problem with the Linux driver for the Realtek 8168/8169 cards where the modules load properly and the card is visible but no link is detected. E.g.:

Jun 21 18:28:41 localhost kernel: r8169: eth0: link down
Jun 21 18:28:41 localhost kernel: ADDRCONF(NETDEV_UP): eth0: link is not ready

There are lots of details and suggested solutions from the Ubuntu people. None of the suggestions worked for me, however. Several of them suggest configuring the card under Windows, but the box containing this device is a single-boot linux fileserver. The “wake-on-LAN” functionality seems to be implicated, but not in a way I can see how to fix.

After much head-banging (in the bad sense), I found a simple solution:

(1) Install ethtool
(2) Modify /etc/network/interfaces as follows (substitute your r8169 interface for ‘eth1′ and other settings accordingly):

iface eth1 inet static
pre-up /usr/sbin/ethtool -s eth1 autoneg off
address 192.168.98.1
netmask 255.255.255.0

This did the trick for me where no other solution would work. Of course, link autodetection no longer occurs, but that’s a small price to pay for connectivity.

This is a Debian etch installation using a slightly more recent kernel (2.6.25-2-686).

As an interesting side note, on this new box, the interface appears as eth0 in the kernel logs, but is actually mapped as eth1. Similarly, a second Ethernet interface appears in the log as a different device number than that by which it is referenced. Any ideas why?

Update 6/22/08: Still not getting 1000BaseT (Gigabit), however. If I force 1000BaseT with ethtool -s eth1 speed 1000, the link goes down again (even with autoneg off). The same card in another box, however, detects the link and goes to 1000BaseT automatically. So I’m stuck at 100BaseT.

Update 6/24/08: Linux 2.6.26-rc5 fixes the problem 100% for me.

Technorati Tags: , , , ,

No time for blogging, but…

I’ve been on the road a lot lately with no time to blog (or sleep).  Following are a couple items to keep this space from going completely dead.

A wild turkey stopped by our backyard (in Boston):

a turkey

I called city animal control, and they said these guys are everywhere. Apparently there is no more wild left for the wildlife.

In other news, Gears is finally available for Firefox 3! For me, at least, this is a big deal, since I frequently depend on offline mode for Google Reader and have otherwise fully migrated to FF 3 for the speed benefits. Since RC2, it’s mostly stopped crashing as well.

Technorati Tags: , , , ,

Microsoft Outlook 2003 Tip: VBA Macro to Remove Stationery from Email Message

Quick link to ClearStationery.bas

I don’t have much (any?) history of posting tips for the Windows platform, but I’m currently stuck with it for daily work use, so I figured I might as well share some tips that my readers who happen to be in the same predicament will find useful. (Planet Debian readers please have mercy.)

One of the worst things you that Microsoft Outlook allows a user to do is select a “stationery” for email. Stationery goes beyond regular old HTML mail (e.g., fonts, colors, and bullet lists) to add a patterned background, invariably rendering the content much less readable than it would be with a white (or even any other color) background. What’s worse is every reply to an email with stationery also adopts the original sender’s stationery!

I searched quite a bit for a solution that does not involve sending a nastygram to the original sender. Of course you can convert the email to plain text (or set Outlook to only display the plain text version) and then convert back to HTML or Rich Text, but you’ll also lose other formatting that you might want to retain. You could cut and paste the text into a new email, but what is really needed is a simple VBA macro that will strip the stationery but not other formatting.

Strangely, I don’t think that macro already exists. So I wrote one, to some extent cribbing from related code snippets (mostly from here). I now present to the world ClearStationery.bas, my best contribution to date to the Outlook ecosystem. Simply paste it into your Outlook Visual Basic Editor (ALT-F11) and then map the macro ClearStationeryFormatting() onto a toolbar with a hotkey, and you can instantly remove stationery from any email, whether it is in the “preview” pane or the full message view.

Comments, bug reports, and improvements are welcome:

Sub ClearStationeryFormatting()
On Error GoTo ClearStationeryFormatting_Error
    Dim strEmbeddedImageTag As String
    Dim strStyle As String
    Dim strReplaceThis As String
    Dim intX As Integer, intY As Integer
    Dim myMessage As Outlook.MailItem
' First, check to see if we are in preview-pane mode or message-view mode
' If neither, quit out
Select Case TypeName(Outlook.Application.ActiveWindow)
    Case "Explorer"
        Set myMessage = ActiveExplorer.Selection.Item(1)
    Case "Inspector"
        Set myMessage = ActiveInspector.CurrentItem
    Case Else
        MsgBox ("No message selected.")
        Exit Sub
End Select

' Sanity check to make sure selected message is actually a mail item
If TypeName(myMessage) <> "MailItem" Then
   MsgBox ("No message selected.")
   Exit Sub
End If

' Remove attributes from <BODY> tag
intX = InStr(1, myMessage.HTMLBody, "<BODY", vbTextCompare)
If intX > 0 Then
    intY = InStr(intX, myMessage.HTMLBody, ">", vbTextCompare)
    strReplaceThis = Mid(myMessage.HTMLBody, intX, intY - intX + 1)
End If

If strReplaceThis <> "" Then
    myMessage.HTMLBody = Replace(myMessage.HTMLBody, strReplaceThis, "<BODY>")
    strReplaceThis = ""
Else
    Err.Raise vbObjectError + 7, , "An unexpected error occurred searching for the BODY tag in the e-mail message."
    Exit Sub
End If

' Find and replace <STYLE> tag
intX = InStr(1, myMessage.HTMLBody, "<STYLE>", vbTextCompare)
If intX > 0 Then
    intY = InStr(8, myMessage.HTMLBody, "</STYLE>", vbTextCompare)
    strReplaceThis = Mid(myMessage.HTMLBody, intX, ((intY + 8) - intX))
End If

If strReplaceThis <> "" Then
    myMessage.HTMLBody = Replace(myMessage.HTMLBody, strReplaceThis, "")
End If

If InStr(1, myMessage.HTMLBody, "<center><img id=", vbTextCompare) > 0 Then
    strEmbeddedImageTag = "<center><img id="
    '"<center><img id=""ridImg"" src="citbannA.gif align=bottom></center>"
    intX = InStr(1, myMessage.HTMLBody, strEmbeddedImageTag, vbTextCompare)
    If intX = 0 Then
        Err.Raise vbObjectError + 8, , "An unexpected error occurred searching for the embedded image file name start tag in the e-mail message."
        Exit Sub
    End If
    intY = InStr(intX + Len(strEmbeddedImageTag), myMessage.HTMLBody, " align=bottom></center>", vbTextCompare)
    If intY = 0 Then
        Err.Raise vbObjectError + 9, , "An unexpected error occurred searching for the embedded image file name end tag in the e-mail message."
        Exit Sub
    End If
    strEmbeddedImageTag = Mid(myMessage.HTMLBody, intX, intY - intX)
    intX = InStr(1, myMessage.HTMLBody, "<CENTER>", vbTextCompare)
    intY = InStr(intX, myMessage.HTMLBody, "</CENTER>", vbTextCompare)
    strReplaceThis = Mid(myMessage.HTMLBody, intX, intY - intX) & "</CENTER>"
    myMessage.HTMLBody = Replace(myMessage.HTMLBody, strReplaceThis, "", , , vbTextCompare)
End If

' Finally, saved modified message
myMessage.Save

On Error GoTo 0
Exit Sub

ClearStationeryFormatting_Error:

MsgBox "Error " & Err.Number & " (" & Err.Description & ")"
Resume Next

End Sub

Stationery-B-Gone!

Proof of Fall 2007

I’ve been playing around with Gallery and wpg2. I’m still a bit puzzled attempting to integrate Gallery and Wordpress. I’ve resolved most issues; the main remaining issue is to display images in the Ajaxian theme without running over the borders in the Ajax/slideshow views. Also, the embedded image apparently doesn’t render in the RSS feed. Update: I’ve given up on the G2 tinymce plugin and the WPG2 tag for now and just hardcoded the image and album URL. Update 2: now the embedded image is working again for no good reason. Suggestions on the entire configuration are welcome.

In any case, I took some pretty photos today in our back yard (use left and right arrow keys to scroll through images after clicking on the one below — I still can’t get the navigation icons to appear):

p1040772

Before: Proof of Spring 2007.

Technorati Tags: , , , , ,

Search Keys For Google Patents

The Search Keys extension for Firefox is perhaps my favorite plugin. I tweaked it so it will work with Google Patent Search as well. The only additional code needed is in the searchkeys.js file:

{
name: "Google Patents",
test: function (uri) { return uri.host.indexOf("google") != -1 && uri.path.substr(0,9) == "/patents?"; },
testLink: function (linkNode) { return (linkNode.className == "big"); }
},

I added a new minor version number and posted it here for download. Hopefully the patch will be adopted upstream.

Windows Tool of the Century

Okay, maybe “century” is overblown, but the True X-Mouse Gizmo for Windows is the best thing since sliced bread (if you use Windows):

Have you ever paid attention to striking difference in the thickness of forefingers in X11/Unix and MS Windows users, respectively? The latter have much more muscular forefingers that often suffer from chronic aches in their joints. They also much more often develop mouse arm, pain in the neck and shoulders, and other troubles known as Repetitive Stress Syndrome and associated with excessive usage of a pointing device. Why?

The Gizmo even solves the classic X copy/paste buffer problem where you want to select text to paste the contents of your copy buffer over it, only to replace your copy buffer with the newly selected text. Linux could use such a solution, as well!

Sodoku SQL Solution

In case this blog hasn’t been meeting its geekiness quota, I present the following. Ken (who deserves to be better known in the blogosphere and elsewhere) wrote a Haskell program to solve Sodoku with a single SQL query:

SELECT * FROM values AS aaaa, values AS aaab, values AS aaba, values AS aabb, values AS aabc, values AS aaca, values AS abab, values AS abba, values AS abbb, values AS abbc, values AS abcb, values AS abcc, values AS acba, values AS acbc, values AS acca, values AS accc, values AS baaa, values AS baac, values AS babb, values AS babc, values AS bacb, values AS bacc, values AS bbba, values AS bbbc, values AS bcaa, values AS bcab, values AS bcba, values AS bcbb, values AS bcca, values AS bccc, values AS caaa, values AS caac, values AS caba, values AS cabc, values AS cbaa, values AS cbab, values AS cbba, values AS cbbb, values AS cbbc, values AS cbcb, values AS ccac, values AS ccba, values AS ccbb, values AS ccbc, values AS cccb, values AS cccc WHERE aaaa.v <> 3 AND aaaa.v <> 9 AND aaaa.v <> baaa.v AND aaaa.v <> 4 AND aaaa.v <> bcaa.v AND aaaa.v <> caaa.v AND aaaa.v <> cbaa.v AND aaaa.v <> 8 AND 3 <> 9 AND 3 <> baaa.v AND 3 <> 4 AND 3 <> bcaa.v AND 3 …

(edited for brevity)

WordPress Upgrade –> 2.2

Just upgraded to WordPress 2.2. That took all of 18 seconds.

Grimmelmann on PrawfsBlawg

Not to be missed: well-known enfant terrible James Grimmelmann is guest-blogging on PrawfsBlawg. His opening commentary on the relationship between law practice and computer science:

Practicing lawyers, like practicing programmers, are professional pragmatists. Both must make their cases (and case mods) out of the materials they have available; both starve or eat steak depending on whether their creations work. The day-to-day practice of law is unlikely ever to require much high theory. We can mourn that fact because it means that they look at us with suspicion, or celebrate it because it frees us to chase Truth and Beauty—and it will remain a fact either way.

Aside from the fact that I don’t eat steak, I think this is correct.

Via a commenter on James’ entry, I learned that the 7th Circuit Court of Appeals is implementing a wiki (the entry page could surely use some more content). Surprisingly, it was not Posner but Easterbrook who spearheaded the effort. This is a very interesting development, but I expect it will be quite a while before any other circuit takes up the idea.

Finally, I have been meaning to write about this New York Times story describing Jonathan Coulton’s success as a musician breaking with the traditional distribution /promotional channels (via 43 folders, a productivity blog that is still on my “probation” list). Unfortunately, slashdot beat me to it. I first re-discovered Jonathan Coulton during his guest episode of the Show with Ze Frank. In any event, the article is well worth reading:

More than 3,000 people, on average, were visiting his site every day, and his most popular songs were being downloaded as many as 500,000 times; he was making what he described as “a reasonable middle-class living” — between $3,000 and $5,000 a month — by selling CDs and digital downloads of his work on iTunes and on his own site…

Coulton realized he could simply poll his existing online audience members, find out where they lived and stage a tactical strike on any town with more than 100 fans, the point at which he’d be likely to make $1,000 for a concert. It is a flash-mob approach to touring: he parachutes into out-of-the-way towns like Ardmore, Pa., where he recently played to a sold-out club of 140….

In total, 41 percent of Coulton’s income is from digital-music sales, three-quarters of which are sold directly off his own Web site. Another 29 percent of his income is from CD sales; 18 percent is from ticket sales for his live shows. The final 11 percent comes from T-shirts, often bought online…