Posts

Showing posts from 2007

Demand, Supply by Rhythm, Rhyme, Results

I thought this was hilarious. It's actually a good song, educational rap. But what do I know?
Demand, Supply by Rhythm, Rhyme, Results



From Freakonomics

Installing Ubuntu 7.10

It almost went flawlessly. The default boot from the live CD gave me hashed squiggles all over the screen, so I rebooted and chose 'safe graphics'. Fine. Then I installed, and tried to resize the partition on my largest drive. I got an error saying the resize didn't work. So I booted to Windows and defragmented my drive. More free space at the end of the drive, and presto, this time the partition resize worked. So I take out the live CD, and boot, and I get:

GRUB Loading stage 1.5.
GRUB loading, please wait...
Error 17

And it stops. What? and my PC won't boot! Yikes!

Of course I'm actually a geek, so there are two other PCs and a wireless network in the house. Forums suggest checking whether all drives are accessible in the bios. They are, but the 300 Gb drive is showing up as 137 Gb in the bios. Hmm, very suspicious, because my new Ubuntu partition is in the last 70 Gb of that 300 Gb drive. Sigh. I look carefully at the bios, and discover I have an Intel motherboard. S…

Creative Destruction vs Team Rodent

I've rarely read two books that can comment directly on each other the way Creative Destruction by Tyler Cowen and Team Rodent by Carl Hiaasen do. Cowen argues in a relatively scholarly work that trade generally increases cultural benefits, instead of decreasing them. Hiaasen says that Disney is a blight, a destroyer, and a homogenizer of the worst sort - they are nice. I find it fascinating that Team Rodent directly illustrates many of Cowen's points. Disney moving into Orlando completely shook up the local culture, just as Americans moving into a foreign country often do. Disney World brings a huge amount of money to Orlando, mostly in the form of tourists - the equivalent of the population of California visits Disney World every year - which is targeted by tourist traps ringing the park. The people of Florida now have a much bigger economy, much more choice; and some of them, like Hiaasen, clearly resent the cultural change. The question is whether the change was worth it. …

Coffin for Dimitrios, by Eric Ambler

I believe this book was originally copyright 1934, and I got it on this recommendation from Marginal Revolution:
"I reread Eric Ambler's Coffin for Dimitrios; few people know this novel but it is one of the best spy/detective stories, period."

Overall, a fun read. Pretty quick, some nice spy-suspense elements. It made me think what it would be like for an ordinary person, the novelist narrator, to stumble into the world of spies and killers.

I found it mildly grating that the narrator had only a mild sense of danger, and didn't seem to take seriously protecting his own life.

Info at PBSwap

Rainbows End, by Vernor Vinge

wow. WOW. What a phenomenal book. This story is so far out, yet believably set just 20 years in the future. Not once was I brought up short thinking "nah, that couldn't happen." I was completely sucked in, and I'm left with an ache trying to decide whether I want it to happen, or whether I should work to stop it from happening!
Info at PBSwap.

WorldWebPages telemarketing scam

worldwebpages.net scammed me. I hate that they scammed me, because I think I'm pretty good at resisting telemarketing techniques. Here's what happened. Beware.

Around August 27th, 2007, they called our small business with the pretense that they were updating a directory at the request of our phone company, Verizon. Then they asked if I had the authority to make billing decisions. I said yes, because I thought I would save my boss some time. I was assured that I had to go through a recorded voice-mail session to be out of their database so they wouldn't call anymore. The recorded script said that I was signing up for a service, some kind of web site or web listing, which was free for the first month, but there-after cost $9.95 to set up and $34.95/month, charged to our phone bill! The first time through I said "no, I don't authorize this", and then hung up when the marketer tried to convince me I should complete it. He called back, and assured me that I was not…

Discover Your Inner Economist review

I'm a fan of Freakonomics, and I found Tyler Cowen's blog, Marginal Revolution, through them. Tyler's latest book, 'Discover your Inner Economist', is significantly different than Freakonomics. It takes some of the quirks of economics as a given, like the inadequacy of the 'perfectly rational consumer' model of a person. It has short sections that are easy to read, but each caused me to examine myself or the behavior of others around me in a new light. I changed where I went with a friend to lunch yesterday based on this book, and I had a brand-new dish in a Korean Barbecue restaurant that was delicious, even though I was in a strip mall next to a tire outlet. A small thing, but positive and worthwhile. I found this book filled with other examples like this. Highly recommended.

Our App on Vista

What's different about Vista, for an application written for Windows XP?
We write a config file in our application directory. When the user changes preferences, they are written to the config file. On XP, this file is located at C:/Program Files/DeltaSphere/bin/SceneVision-3D.cfg. Vista pretends that the file is still located there, but silently redirects it to C:/Users/username/AppData/Local/VirtualStore/Program Files/DeltaSphere/bin/SceneVision-3D.cfg. Got it?We need to update some drivers to Vista specific ones.
We use the installer from VS2005 standard, and that seems to work fineWe even use visual-basic scripts in the installer, and those still work. I bet Norton will still complain, though, just like on XP.
We have a splash-screen app that auto-runs from our install CD, and Vista complains that it is unsigned.
That's about it. Not too bad. I was prepared for much worse. Of course, we aren't really following the standards for where to locate our data and such, but we won&…

Perl regexp, one liners

The command
perl -pe
lets you do a line-by-line perl command on piped input and output. I discovered today that that means you can't use it on regexp that are supposed to match multiple lines.

Keyboard Macros in Emacs

A very useful tool in Emacs is the keyboard macro. Every so often I need to perform a repetitive task that is slightly different each time. This time, I was changing casts again, in C++. I had a series of casts, that looked like this:
(MeasureLine *)(annot->newCopy());
and I needed to replace them with this:
dynamic_cast<MeasureLine *>(annot->newCopy());
So I defined a keyboard macro, where I first selected 'MeasureLine *', and the macro would cut that text, type in 'dynamic_cast<', paste, then type '>'
The keyboard macro is started by the keystroke 'Ctrl-x (', and ended with 'Ctrl-x )'. It is run by 'Ctrl-x e'

When I found another spot in my code that looked like this:
(ConstraintPlane*)(annot->newCopy());
I could drag over 'ConstraintPlane*' with my mouse, and hit 'Ctrl-x e', and it turned into:
dynamic_cast<'ConstraintPlane*>(annot->newCopy());
Done. Another trick is that 'Ctrl-u' follow…

Useful Regexp in Emacs for C++

First press Ctrl-Alt-Shift-5 to get Query-Regexp-Replace
Then I want to find C-style casts in my .cpp file, and replace them with C++ style casts. For example:
GeoData *gd = (GeoData *)mThreeDData;
becomes
GeoData *gd = dynamic_cast<GeoData *>(mThreeDData);

First I figure out that this: (\w+ ?\*)[A-Za-z_]+
will find the expression I want. It's finding the parens, then \w is a 'word-constituent' which fits our type names nicely, followed by an optional space and the * for pointer. But in variable names, we often use underscores, so I search for those explicitly.

Now I need to save parts of the search expression and use them in the replace expression. So I enclose in \( \), and reference with \N
The search becomes:
(\(\w+ ?\*\))\([A-Za-z_]+\)
and the replace becomes:
dynamic_cast<\1>(\2)

A case this doesn't handle is if the C-style cast was on a method or function call, or array reference.
so
(Outline *)annot_to_save[i]
became
dynamic_cast<Outline *>…

Locust in glass

Image
This is the best picture my wife has taken. At the North Carolina Museum of Life and Science.

Humming bird nest

Image
Lichen and spider webs. There is one egg in the nest.

Slaughterhouse Five

or The Children's Crusade
by Kurt Vonnegut, Jr.

The author writes about Billy Pilgrim, who becomes unstuck in time. He witnesses the firebombing of Dresden in WWII, and is kidnapped by aliens.


"If I hadn't spent so much time studying Earthlings," said the Tralfamadorian, "I wouldn't have any idea what was meant by 'free will.' I've visited thirty-one inhabited planets in the universe, and I have studied reports on a hundred more. Only on Earth is there any talk of free will."

A phrase used to connect deaths in the book:
So it goes.

Billy is disturbed, checks himself into an asylum, but his time-travel and display in the alien zoo are treated as obviously true. Because he is changing time-lines constantly, he is passive in everything that happens to him.

Kilgore Trout appears a sci-fi writer whose "prose was frightful. Only his ideas were good."

This book is a classic because it makes a lasting impression. I picked it up and read it agai…

The Sum of All Fears, by Tom Clancy

The Sum of All Fears
Author:Tom Clancy
ISBN-13: 9780425184226
ISBN-10: 0425184226
Book Type: Paperback

I stayed up late finishing it. Compelling read. The final note from Tom Clancy tells how worried and amazed he is that it would be relatively easy for a rich and secretive person to fabricate a hydrogen bomb, given some access to raw materials, as in the novel. Engrossing, entertaining, _and_ made me think - the best traits in a spy novel. I have not yet seen the movie.

My only objection: it's too long (~900 pages). It suffers with sub-plots that are developed and then thrown away after interacting briefly with the main story line. It all ties together, but some of the ties are to weak and coincidental to be interesting.

Info at PaperBackSwap