Random Tips

Created 2007-08-25 / Edited 2007-08-25

Today while reading some random article I noticed someone doing

strace -p 12345

Which is to say, attach strace to the running process numbered 12345. So cool! I've always like strace, but apparently didn't take enough time to read the manger to learn this usage.

I'm slowly reading Meta Math! by Gregory Chaitin and am enjoying it very much. Today he proved that there cannot be a purely algorithmic way to prove a given program is as simplified as possible. From that a simple proof of the halting problem will follow, I believe. His writing is very enthusiastic and inspiring, drawing attention to some of the most fascinating parts of mathematics. Plus he loves to use exclamation marks! The tone reminds me of Feynman.

So here's the tip: don't try to find an algorithm to provably simplify any given program to it's most minimal form, because it won't work out very well. Stick with a heuristic approach.

A few days ago our apartment building's fire alarm went off before work. I decided that it might be a good exercise to take the kitties with us, even though the odds of it being a real fire rather than a false alarm were extremely low. After managing to shove Mia into the carrier we decided there was no way they'd both go in there. So I grabbed Miko and put her harness on and proceeded to carry her out into the hallway.

The blaring alarm in the hall wasn't the sort of thing that Miko wanted to be involved with, so when I stepped out with her in my arms I quickly learned how little control I actually had over her. It was like an invisible wall in my doorway that she refused to go beyond, and in this case it meant she had to go through me to get back inside. The scratches on my arm and neck are actually almost gone now, but the tip stands: if you are going to rescue a cat from a pretend fire, do your best to find a box to shove her in and try very hard to avoid carrying her out in a more direct fashion!

Your .vimrc file can have conditional sections based on environment variables, such as $HOSTNAME. With that in mind I've been able to create a unified .vimrc to use both at home and work. The only real difference is that at home I generally avoid all tabs, whereas at work tabs are the standard for indenting.

" Working at LSI ... they like tabs
if ($HOSTNAME == "wickedwitch")
  set sw=2                " Width to shift and indent things
  set ts=2                " Set tabsize to 2 (to view other people's crap) 
  set noet                " Use tabs. Even though tabs are the devil.
  match errorMsg /[^\t]\zs\t\+/

When doing the T9word mode on cellphones the '1' key will do punctuation. Plus they often have smilies in their dictionary!

And finally a tip inspired by a recent Paul Graham essay.

When reading code you don't see all the pieces that were left out. Therefore, without knowledge of this non-present code, you will understand code you read less than code you write. This applies to creative mediums well beyond code.