Posts

Showing posts from November, 2008

Emacs 22.3 on Windows

I've been using Emacs 21.3 happily for years. Since 2003 apparently, because I looked at the release dates today when I discovered a new version 22 had been released this year for the first time in a long time. Here's what I found.
Happily, the gnuclientw function has been integrated, as emacsclientw, and all that's needed in .emacs is (start server)They recommend setting an environment var for some reason: set ALTERNATE_EDITOR to runemacs.exeNow I can associate files with emacsclientw.exe to open them in my current emacs session. However, add the '-n' argument so it doesn't maintain a link to explorer, and ask you to hit a keystroke to release the editing buffer. A puzzling default behavior.
I also had to get rid of 'lazy-lock' and 'resize-minibuffer-mode' from my .emacs, but that was it. I turned off the toolbar, too, of course. Easy, painless upgrade.

I was surprised when it was slow to shut down the first time, but it has been much faster each …

Compact flash disk image with dd and cygwin

I found a way to make an exact duplicate of a compact flash card using cygwin. I suspect this method only works with identical flash cards - i.e. both the same capacity, and possibly both from the same manufacturer.
Anyhow, based on Reimaging CompactFlash cards tutorial, I looked in Computer Management, Disk Manager, and discovered my compact flash card was 'disk 2'
Then, using 'a' for disk 0, and 'c' for disk 2, at the cygwin command prompt:
dd if=/dev/sdc of=b2.img
It reports this, for a 32Mb flash card:62592+0 records in
62592+0 records out
32047104 bytes (32 MB) copied, 10.725 s, 3.0 MB/sThen, 'eject' the flash card in explorer, and insert the new one (to be erased and copied over). In cygwin again, note 'if' and 'of' swap:
dd of=/dev/sdc if=b2.img
62592+0 records in
62592+0 records out
32047104 bytes (32 MB) copied, 43.448 s, 738 kB/s
And it works! It's even bootable.
I'm still puzzled by a cygwin list suggestion, which has weird syntax…

Bash script, filenames with spaces

Sometimes these things can be really annoying. Anyhow, good hint here:
Handling filenames with spaces in a bash for or while loop.
Helps loop over filenames which include spaces. Like most normal people do, nowadays.
I also got caught trying to extract substrings. We had the date embedded in the name of some backup files. The substring operator looks like this:
${file:19:8}Get a substring, starting as position 19, 8 chars long.
I wanted from the end, so you make the position negative. But you have to use parens, otherwise it looks like the default-val operator
${file:(-19):8} and not ${file:-19:8}Then I found that the year started with a zero, so it was getting treated as octal, and 08 is not a valid octal number. So I ended up with this to extract the 2 digit year into a integer var:
# 10# in front says 'use base 10', because the 08 was being interpreted as octal.
let file_year="10#${file:(-19):2}"
# get days by asking 'date' to convert the date string for us.
l…

Election day, go libertarians.

I voted. I hope Mike Munger, the libertarian candidate for governor in NC, gets his 2%, so he can automatically be on the ballot next time. I think that's the condition....