Justin Watt received a cease-and-desist letter from Exodus International for posting this image.
Mike Cohen
Batch rename
Several times I’ve had to rename a group of files, usually to change extensions. I usually ended up using a shell command such as ‘for f in *.xyz …’, but thanks to the comments at this blog post, I discovered two very nice batch rename utilities. Renamer4Mac is very nice, free GUI utility. There’s also an elegant command line tool, rename, which lets you use perl expressions to specify how the name should be modified.
Whiners grow up to be conservative, study claims
Via Minipundit: A study has shown that “whiny, insecure” children grow up to be conservatives, while “confident, resilient, self-reliant” children grow up to be liberals.
MacBook Pro
I ordered a MacBook Pro from PowerMax with a trade-in of my 15″ PowerBook G4. I also bought that machine from them, trading in my 12″ PowerBook G4. I should have it next week. This leaves my G4 minitower as the only PowerPC system for testing & development.
Python
I’ve started learning Python, which I’ve wanted to do for a long time. One thing that always bothered me about it is that whitespace is significant. Unlike most languages where blocks are delimited by begin..end or {…}, in Python a block is delimited by all statements being indented the same amount. Am I the only one bothered by that?
A real stumper
I’ve run into a puzzling problem that’s kept me stumped for several days. I have a command-line tool that simply can’t be debugged. I’ve built it with optimizations turned off and debugging symbols enabled, but it won’t stop at any breakpoints, even if I put a breakpoint at the first line of main().
Someone suggested adding the command set start-with-shell off to ~/.gdbinit, but that didn’t help. I’ve also tried running gdb from the terminal and turning off ‘start executable after starting debugger’ in XCode’s preferences, but neither one helped. It will load into gdb without starting, but no source will be shown and it will run without stopping as soon as I start it.
I figured out a snippet of code that can identify whether or not it’s running in the debugger, and it properly recognizes that it’s running in the debugger, yet it won’t stop.
For anyone interested, here’s how you can tell if you’re running in a debugger:
int AmIBeingDebugged(void)
{
int mib[4];
struct kinfo_proc info;
size_t size;
mib[0] = CTL_KERN;
mib[1] = KERN_PROC;
mib[2] = KERN_PROC_PID;
mib[3] = getpid();
size = sizeof(info);
info.kp_proc.p_flag = 0;
sysctl(mib,4,&info,&size,NULL,0);
return ((info.kp_proc.p_flag & P_TRACED) == P_TRACED);
}
Changing my religion
Text editors are like religions, inspiring bitter rivalries. The most intense rivalry is between vi & emacs. Although vi was the first Unix text editor I used, I soon discovered emacs and became an emacs fan. I feel at home in emacs and I instinctively use emacs keystrokes everywhere, which most Mac applications support.
However, I found that Linux-based devices like the LinkStation or the GP2X usually have vi but not emacs, which is understandable since emacs is huge and needs lots of elisp support files. Since I started hacking my LinkStation I’m now trying to break the emacs habit. I find that vi, in particular VIM, doesn’t suck too badly so I’m now using vi instead of emacs and I’m slowly getting used to it.
Great text utility
Thanks to this tip at MacOSXHints, I discovered a great utility in OS X 10.4 that I didn’t know existed: textutil. It can easily convert files to plain text, html, rtf, doc, and other formats. To convert a .doc file to html, you can just do: textutil -convert html file.doc.
First Harvest
I picked the first tomatoes from my garden today. Unfortunately some animal or bird got to one before I could pick it. I ended up with 4 good ones. It looks like two eggplants will be ready soon, and I’m now on the second planting of lettuce.
I always enjoyed gardening, but this is the first time I’ve been able to have my own garden. Last year I couldn’t plant much behind my apartment since a large tree blocked the light. With the tree gone, I now get enough sun to grow some vegetables. I’m in a good location to plant a garden, since my building is one of the few that faces the outside rather than another building.
