Wednesday, April 29, 2009

Hollywood != Real World

This is why I boycotted Slumdog Millionaire:

Two months ago, the child star of the hit movie "Slumdog Millionaire" was worrying about what to wear to the Oscars. Now she has come home to a very different problem: How to get the fetid water out of her family's one-room shack.


Read the rest of the story.

Tuesday, April 28, 2009

Moved hosting DreamHost -> WebFaction

Following in Douglass Clem's footsteps (and thanks for the tip about scp), I migrated my domain hosting and this blog from DreamHost to WebFaction, for many of the same reasons. I wasn't unhappy with DreamHost, I just want to try out Pylons and WebFaction seems to be the place to be for that.

Wednesday, April 22, 2009

my .irbrc file

require 'irb/completion'
IRB.conf[:AUTO_INDENT] = true
IRB.conf[:USE_READLINE] = true
IRB.conf[:PROMPT_MODE] = :SIMPLE


\# call ri from within irb
def ri(*names)
system(%{ri.bat #{names.map {|name| name.to_s}.join(" ")}})
end

Thursday, March 5, 2009

How to make an empty file on Windows

To makes an "empty" file,  containing only a single newline, type this in a Windows command prompt:
c:\>echo. > somefile.txt

The dot immediately after the echo command outputs just a blank line to the file. I think this technique works for Windows NT and better.

Apparently you can also use the fsutil command to make a file of any size filled with zeros:
c:\>fsutil file createnew filename length

Monday, February 2, 2009

jEdit delete duplicate lines

In jEdit's Search and Replace dialog, select "Regular Expressions",  then Search for:
^(.\*)$\n\1

replace with:
$1

This tells jEdit to

  • start at the beginning of a line ^

  • find any characters, spaces, etc .*

  • up to the end of the line $

  • including a carriage return \n

  • that matches the text on the following line \1

  • then replace it with just the first matched line $1


The result is any lines that are duplicated will be replaced with just a single copy of the line.

Tuesday, December 16, 2008

Using caret '^' in Windows batch files

The caret '^' character serves two purposes in Windows batch files:

1. line continuations:
~~~
@echo off

dir ^
/ad ^
c:\temp
~~~~
results in dir /ad c:\temp, which lists only the directories in C:\temp. (Thanks to SteveGTR for that example.)

2. Escaping reserved shell characters & | ( < > ^. Use a preceding caret to escape and print the character:



echo this pipe will print ^| but this one won't |
echo and this will print one caret ^^

Tuesday, December 2, 2008

Monotype font for Wordpress "Write Post" text area

I like to use a monotype font (e.g. Courier) when I edit my blog posts in HTML mode. Wordpress seems to default to a proportional font. Try as I might, I couldn't find an easy way to change this from the WP admin pages, so I resorted to hacking the responsible stylesheet, /wp-admin/wp-admin.css, adding the font-family declaration for the #content text area:


editorcontainer #content {
font-family: Courier New, Courier, sans-serif;
padding: 0;
line-height: 150%;
border: 0 none;
outline: none;
}