January 28th, 2005

  • evan

find the bug!

A friend got me with this one:
... One of my co-workers has spent the past 4 days debugging garbled output from the UI library I own ... The problem ended up being in his code:

string displayable = longerString.substr( 0, COLS );
Where’s the bug?
(If you wanna hide your answers I think you can wrap them in <div style='color: white; background: white'></div>.)
  • evan

tracking down nfs stats

tcpdump on my machine indicates:
09:09:03.835014 IP mouse.2280902084 > trout.nfs: 144 fsstat [|nfs]
09:09:03.835208 IP trout.nfs > mouse.2280902084: reply ok 168 fsstat [|nfs]
09:09:04.331178 IP mouse.4224086465 > trout.nfs: 144 fsstat [|nfs]
09:09:04.331382 IP trout.nfs > mouse.4224086465: reply ok 168 fsstat [|nfs]

and so on approximately every 0.5 sec. How do I track down what process is doing this?
I have some guesses, but is there a more principled way of going about it than killing things one by one?

Oh wait, lsof -N does it, I think? Ok, then, how do I track down what’s causing a process to respawn? ps axf indicates it has no parent which means it just daemon()‘d?
  • evan

regarding managing your time

Robin remarked:
I just started keeping logs of what I did every day. I keep it in a personal cvs repository, and whenever The Boss asks, “What have you been up to lately?” or anything of the sort, I whip it out and show it to him. I take printouts to meetings. Pretty soon after I started, other people saw that it really helped, and a few other people started doing it.
I have found success along similar lines with VimOutliner. I tend to context-switch rapidly as various things get blocked on various other things, whether it be as simple as a long-running computation or more social problems like needing to get a consensus during an upcoming meeting, so I have top-level bullets that are each of my projects, sorted by priority. Beneath each of these I have a list of what needs to be done to move them forward.

I also have a cronjob generate an HTML version of it that I publish to my intranet website, but I’m not sure that’s actually useful. (But if you do end up using this I’d be happy to send you the code.)

VimOutliner helps by coloring different indentation levels differently and doing outliner-style folding. It also adds some keystrokes. One is simply “append current date to this element”, which I add on bullets like “get so-and-so to do [x]”-style of projects as a reminder to myself to nag them if enough days elapse. Another is “add checkbox” along with “check off checkbox”, which also checks off parent tasks whenever all of the subtasks are complete.

It’s really easy for me to get distracted (by, say, posting to LiveJournal!) so it’s good for me to have a simple list: what do I do now? Just take the top unchecked item off the list and do that.

(PS: I found this after being inspired by mattm doing a similar thing in emacs.)
  • evan

highlight nofollow links

In your ~/.mozilla/firefox/.../chrome/userContent.css:
a[rel~=“nofollow”] {
 border: thin dashed firebrick ! important;
 background-color: rgb(255, 200, 200) ! important;

I had no idea CSS could do such fancy selectors!

Test it by clicking around on fexweb and looking for the red background on links.
  • evan

find the bug, 2

Here’s the answer to find the bug.

Unfortunately, giving you the full context pretty much gives the answer away, but this sorta functions as a hint:
The UI library supported Japanese.

And if you still don’t have it:
Multi-byte characters were getting snipped mid-character. The basic red flag is that you’re passing COLS (presumably columns, a character offset) to substr, a function that takes a byte offset.