Wednesday, June 27, 2007

miniature engines

I just found a New York Times article which brought back fond memories. It's about people who build scale model replicas of engines as a hobby. One guy built an amazing 1/6 scale model of a Chevy V8. These really must be seen to be believed. The pistons are not much larger than a quarter. The rocker arms (the parts which help the valves open and close) are incredibly tiny. It's hard to believe these small engines actually run.

I mentioned that seeing these brought back fond memories. No, I didn't used to build working engines though I did spend many happy hours in my younger days building model cars. This reminded me of one of my favorite books of all time, Trustee from the Tool Room by Nevil Shute. Shute is my favorite author of fiction, bar none, and Trustee is an excellent example of his best work. It's the story of an engineer who builds and writes articles about miniature machines including engines. He undertakes a very long journey due to a strange twist of fate and develops some well deserved self confidence along the way. Sadly, like many of his books, it's no longer readily available in America. You can still get many, if not all, of his books from Amazon UK though.

Sunday, June 24, 2007

vi macros

Many years ago I learned vi, the visual editor which came with Unix. At the time it was one of two full screen editors readily available on nearly every version of Unix - the other being Emacs. For some reason, the vi commands seemed more intuitive to me. This was probably because I'd previously spent a fair amount of time using a PC editor distributed by IBM called "PE" (which stood for personal editor). In any case, it turned out to be a fortunate choice because vi quickly became available for every computing platform I used. Emacs was also ported to the same platforms but had higher resource requirements (memory and disk space) than I could afford on my hobbyist budget.

I wouldn't recommend anyone not already familiar with vi go through the steep learning curve to learn its somewhat cryptic commands. For those of us who have gone through that painful learning experience, the commands become second nature.

The end result is that I've been using vi for about 20 years and have come up with a few macros I use to save time. These are two character macros which help me perform various operations on blocks of text. My favorite vi port, vim, has many additional commands such as visual block commands which I use frequently. People learning vim and not needing to switch back to a more standard version of vi will probably not find these terribly useful. However I sometimes still need to edit files on Sun servers where vim is not readily available, so I find my macros pretty handy.

Here's a list of the block macros I use most often.

\m - marks beginning of line block
\y - yanks from beginning of line block to current line
\d - deletes from beginning of line block to current line
\p - pastes block previously yanked or deleted to current line
\i - indent block by shiftwidth
\I - indent block by 1 character
\u - unindent block by shiftwidth
\U - unindent block by 1 character

Here are the actual macro definitions. In the following definitions, the ^M is entered by typing a Control-V (which causes the next character to be entered without any special processing) followed by a Control-M (also known as a carriage return).

" delete lines (from mark to cursor pos. - uses b mark, b buffer)
map \d mb"ad'a`b
" indent one shiftwidth (which I have set to 4 characters)
map \i :'a,.>^M
" indent (1 char)
map \I :set sw=1^M:'a,.>^M:set sw=4^M
" mark beginning of a line block (uses the a mark)
map \m ma
" paste lines previously yanked or deleted at cursor pos.
map \p "aP
" unindent one shiftwidth (4 char)
map \u :'a,.<
" unindent (1 char)
map \U :set sw=1^M:'a,.<^M:set sw=4^M
" yank lines (from mark to cursor pos. - uses b mark, b buffer)
map \y mb"ay'a`b

Friday, June 22, 2007

OpenDNS problems?

For the last few days, I've been noticing my DNS lookups are much slower than usual. Today I actually had to retry several times because of timeouts in a proprietary registration application I couldn't control. I decided to bypass the OpenDNS servers and go back to those provided by my ISP. Strangely enough, my browsing is back to normal speed after making the change. I tried to look at their system status link but got a blank page back after quite a long wait. I wonder if OpenDNS is a victim of their own popularity? Something is causing their web site to behave so slowly.

I guess I'll wait a few days and try them again to see if this is just a short lived glitch.

Monday, June 18, 2007

Fighting Spyware

Jeff Atwood over at Coding Horror has an interesting article about the numerous steps necessary to fight a Spyware infestation. It goes to show that you can't trust web sites just because lots of people link to them.

I run a Firefox plug-in called NoScript which allows the user to select web sites which should be allowed to run scripting languages like Javascript, Java, and Flash. Scripting languages are very dangerous so it's imperative that users only allow their browser to run scripts from trusted web sites. I'd caution people that they should mistrust all web sites by default. Just because a friend sends you a link is not enough reason to trust a web site.

It's much easier to prevent a Spyware infestation in the first place than it is to remove one from a PC after it's gained a foothold.

Wednesday, June 13, 2007

Goodbye Mr. Wizard

Don Herbert, TV's Mr. Wizard, has died (see article). I credit Mr. Wizard for instilling a love of science in me as he did for several generations of kids. You've really got to admire people like him and Carl Sagan for helping popularize science.

Monday, June 11, 2007

Saving electricity

O'Reilly Radar's blog (always an entertaining read) has an interesting article about tools you can use to help save power. I picked up a Kill A Watt not too long ago and was amazed by how much power is consumed by my computers when they're in standby. Other things like the cable box and DVD player also use a fair amount while they're supposed to be powered off.

We all need to take steps to conserve power wherever possible.

Wednesday, June 06, 2007

Stan Kelly-Bootle

The latest issue of the ACM Queue has an interesting article by Stan Kelly-Bootle. I always loved reading Stan's articles in Unix Review and Software Development magazines. Sometimes his column was the only thing I'd find of interest in the magazine. Thank goodness for complimentary subscriptions, eh? I always got a chuckle and usually learned something by reading his articles. He has a real gift for making technical discussions interesting. Check out his article if you have time.

Also worth reading is his book, The Devil's DP Dictionary. I purchased my copy quite a while ago which is a lucky thing as it seems a little tough to find copies. It's very amusing.

New note: A good friend has pointed out that the new edition of Stan's book is called The Computer Contradictionary. That may even be the edition I have... it would be tough to tell since I can't lay my hands on it at the moment.