Wednesday, July 01 2009 12:46:44 PM

Canada Day! 142 years. Alex took a flight up to Windsor today, for different reasons though. Our kitchen remodel is well underway, so Kristiana and I will be eating out a few times this week.

Saturday, June 27 2009 12:54:55 AM

Memory upgrade on helium from 4G to 8G done tonight. This will allow more virtual machines to run at the same time.

Thursday, June 25 2009 10:31:20 PM

When I was in 6th grade I cut a reproduction of Farrah's famous pinup poster out of a magazine, took it to school, and impressed all my friends with it.

Saturday, June 20 2009 11:09:20 PM

I'm thinking of moving my site from a set of static pages generated by custom Python scripts to a dynamic EEJB site with a Postgres database under it.

Friday, June 12 2009 01:36:10 PM

I just ordered a paper copy of one of my favorite books: "The Metamorphosis of Prime Intellect" by Roger Williams. In my life I've only read a few books more than once, and that includes MOPI (3 times) and the entire Dune series (2 times). I may as well own a physical copy.

Tuesday, June 09 2009 12:57:20 AM

For a long time now I've struggled with the American English placement of punctuation inside of adjacent quoted words.An example would be ending a sentence with a quote; for example here, Abraham Lincoln's famous phrase "four score and seven years ago." That previous sentence is properly ended with the period inside of the ending quotation, according to the American convention. This is fine for conventional English. In England, apparently the convention is to place the period outside of the ending quotation.

When the American convention is followed in computer instruction manuals, it can cause confusion. For example, a manual might instruct a computer to list the directory by typing "dir." If the user entered the quotation as written, D-I-R-{period}, that would be an error. Only someone who was already familiar with the correct command syntax would be able to tell if the period was required.

It would be possible to clumsily rephrase each sentence to not end with a quotation, but it would be far preferable to just abandon the American convention in favor of the British convention. The punctuation should always be placed outside of the quotation mark. I think that this usage will become more and more common as the meaning of a quotation becomes understood as a literal sequence of characters. Any other convention invites ambiguity.

Sunday, June 07 2009 09:37:57 PM

I've been working on a recursive zipfile reader that uses the Poco Zip library. Poco Zip is really easy to use for extracting zipfiles, but I needed it to also look at zipfiles inside of zipfiles (as many levels deep as needed). I thought the PartialInputStream library was going to work, but it's buggy. It doesn't keep a proper file position pointer.

My solution was to mmap the file and use that as a buffer on a StringStream to read the file. Enclosed zip files just needed the buffer to be mapped to a new location in the mmap and call the extraction recursively.

Friday, June 05 2009 11:14:38 PM

POCO Partial Input Stream

Constructor:
PartialInputStream(
std::istream & istr,
std::ios::pos_type start,
std::ios::pos_type end,
bool initStream = true,
const std::string & prefix = std::string (),
const std::string & postfix = std::string ()
);

It's a tricky class, and the documentation isn't useful at all, so here's a better description of this useful function.

A PartialInputStream reads a subset of bytes from the istream passed in. The 4 parameters PLUS the file position of the istream passed in determines what subset is actually read.

Case #1
The input stream is used to directly initialize the PartialInputStream. Start is set to 0, meaning that the character counter starts incrementing from 0. End is set to 7, meaning that the PartialInputStream will return eof()==true when it the character counter reaches 7. The total number of characters read is the end position-start position (7).

Test input file:
0123456789 (10 bytes)

ifstream inp("testfile", std::ios::binary);
PartialInputStream pis(inp, 0, 7, false);

while (!pis.eof()) {
int ch = pis.get ();
cerr << (char) ch << " " << (int) ch << endl;
}
output:
0 48
1 49
2 50
3 51
4 52
5 53
6 54
? -1


Case #2
The input stream is used to directly initialize the PartialInputStream. Start is set to 2, meaning that the character counter starts incrementing from 2. End is set to 7, meaning that the PartialInputStream will return eof()==true when it the character counter reaches 7. The total number of characters read is the end position-start position (5).

Test input file:
0123456789 (10 bytes)

ifstream inp("testfile", std::ios::binary);
PartialInputStream pis(inp, 2, 7, false);

while (!pis.eof()) {
int ch = pis.get ();
cerr << (char) ch << " " << (int) ch << endl;
}
output:
0 48 character counter is 2
1 49 character counter is 3
2 50 character counter is 4
3 51 character counter is 5
4 52 character counter is 6
? -1 character counter is 7

Case #3
This is just like case #1, except the initializing input stream has a byte already read from it. The character counter starts at 0, and reading continues until the character counter reaches 7. Because the initializing input stream was positioned at file position 1 instead of file position 0, the output is slightly different from case #1.

Test input file:
0123456789 (10 bytes)

ifstream inp("testfile", std::ios::binary);
inp.get();
PartialInputStream pis(inp, 0, 7, false);

while (!pis.eof()) {
int ch = pis.get ();
cerr << (char) ch << " " << (int) ch << endl;
}
output:
1 49
2 50
3 51
4 52
5 53
6 54
7 55
? -1

Case #4
This is just like case #3, except the initStream flag is set to true. The initializing input stream had a character read from it, but the initStream flag instructs the PartialInputStream to ignore that. The PartialInputStream doesn't begin reading from the file position of the initializing istream, but from the beginning of the initializing istream. Therefore, despite the inp.get() which moved the file position, the PartialInputStream behaves as if that character had not been read at all.

Test input file:
0123456789 (10 bytes)

ifstream inp("testfile", std::ios::binary);
inp.get();
PartialInputStream pis(inp, 0, 7, false);

while (!pis.eof()) {
int ch = pis.get ();
cerr << (char) ch << " " << (int) ch << endl;
}
output:
0 48
1 49
2 50
3 51
4 52
5 53
6 54
? -1

Case #5
This is just like case #1, except the prefix and postfix strings are set. The output contains the prefix and postfix strings on the front and the back of the stream. The data is otherwise read from the file as expected.

Test input file:
0123456789 (10 bytes)

ifstream inp("testfile", std::ios::binary);
PartialInputStream pis(inp, 0, 7, false, "prefix", "postfix");

while (!pis.eof()) {
int ch = pis.get ();
cerr << (char) ch << " " << (int) ch << endl;
}
output:
p 112
r 114
e 101
f 102
i 105
x 120
0 48
1 49
2 50
3 51
4 52
5 53
6 54
p 112
o 111
s 115
t 116
f 102
i 105
x 120
? -1


Friday, May 29 2009 03:50:08 PM

My AT&T Call Vantage service is being discontinued for my second home line, so I signed up for Vonage service instead. No problems, it works pretty well.

Tuesday, May 26 2009 01:05:43 PM

The California court upheld Proposition 8, a very sad day in our history. The precedent is now set in California that a simple majority+1 vote is sufficient to remove a civil right.

This means that if just 50%+1 of Californians decide that if Black people shouldn't marry White people, then that's enough to outlaw mixed marriages.
Our Constitution is supposed to protect ALL of us equally. It should never be possible for civil rights to be voted away by a bigoted majority.

Monday, May 25 2009 10:00:46 PM

I built a bench for our deck out of cedar today. It's 2' x 5' and is meant to hold my tomatoes. Total cost of materials was less than $60, a savings over the flimsy benches at Target. Mine is solid and heavy.

Wednesday, May 20 2009 02:37:32 PM

Just watched two fawns born in my backyard.

Thursday, May 07 2009 11:44:40 PM

Just wrote a comment on Kos which is as close to a review of Star Trek as I'm going to get:

I really liked the movie, but the most glaring thing about it is its irrelevance. If there is anything that Star Trek always was, it was relevant to the world that we live in, while looking forward to a world that we can build.

No spoilers here, but the movie was full of action without relevance. Save the universe - again. And instead of looking forward, we got to look backwards. The original Star Trek was conceived in a time when people were preparing to go to the MOON.

There's something really wrong here. We're not going to the moon any longer. Our grand challenges aren't ones that capture the imagination. Gene sequencing? It's been compared to the Apollo Project, but it's not the stuff of idealistic dreams.

I was entertained and amazed by the new Trek film. I was thrilled to hear the familiar lines from legendary characters. "I'm giving you all she's got, Captain!" It was a pure delight to watch the Enterprise on the screen again. But ultimately I was left cold.

Maybe I was not quite right about the relevance of this Trek film. Perhaps it's relevant to us in an important but unflattering way.

As I left the theater, I thought that it reminded me of Detroit's latest cars. You know the ones. The Mustang. The Camaro. The Charger. The Challenger. Detroit is mining the glory days of 40 years ago looking for anything that will sell, rather than keeping the focus on the future. When we were going to the Moon, the car that Detroit was making 40 years previous was the Model T.

Detroit doesn't exist in a vacuum. They are just responding to their read of the winds of our culture. Detroit is rehashing 40 year old designs because that's what Americans see as the best of times. Everybody is looking back to the good old days which never were instead of forward to the good new days which are to come. Hollywood is doing the same thing to us, mining every last comic book character they can find. Maybe we'll hit bottom on this trend when something like "Mork and Mindy" gets "reimagined." Or should we be treated to some more of the Fonz? I hope not. Leave the Fonz alone!

So for the first time watching Star Trek I wasn't seeing an optimistic vision of the future. The Star Trek of the future was always supposed to be a reflection of our aspirations, and a challenge to build a better world of the future. Now Star Trek is telling us the old dreams were all we needed.

Thursday, May 07 2009 10:36:16 PM

I saw the new Star Trek film on the IMAX screen, and it was quite good. But I am conflicted about what I really think about it.

Tuesday, May 05 2009 02:42:43 PM

I only say good things about businesses when they have superior customer service. American Eagle Appliance in Austin http://www.americaneagleappliance.com/ 512-341-9111 is a local business that I've used several times. A few years ago on Thanksgiving the fridge broke right after the leftovers had gone in. The technician repaired the refridgerator at 11:30 at night on Thanksgiving, saving all that food. They don't even charge extra for emergency calls. The cost of the repair was just the same as if it were a regular day.

Friday, May 01 2009 11:47:57 PM

Just bought my ticket to the new Star Trek movie. I'm going to see it at the IMAX theater on opening night.

Friday, May 01 2009 10:29:55 PM

Bought a dress for Kristiana from Target. The silk screening on the dress has a strong chemical odor, so I wrote the following review on the website:

We bought this dress for our daughter and noticed that it had a strong chemical smell very much like gasoline coming from the silk screening inks used to make the pattern on the dress.

We're taking the dress back because we have no idea what kind of health hazard these volatile compounds might pose to a child.

Friday, May 01 2009 09:52:19 AM

The logo of the new GOP: