Don’t buy this: VCR 2 PC

January 2nd, 2009

I have a couple of hundred VHS tapes in the attic, like so many other people do. During a lightning storm last summer, my VCR died, and I have been putting off getting a new one.

Then I came across the VCR 2 PC product from ION Audio. It looks like a cute VCR player to attach to your PC to get those old tapes onto a hard drive in a user friendly and smart way.

It isn’t.
Read the rest of this entry »

From Infix to Postfix - an alternative to shunting yard

December 5th, 2008

When I was 19 years old I wanted to create a command line interface in gwbasic! I though long and hard about how I would parse a command line and then interprete it. A friend told me I should convert the command to postfix. “2 + 3″ is called infix. Postfix for that would be “2 3 +”. The good thing about it is that postfix is very easy to interprete. Every time you find an argument, such as 2 and 3 in the example, you push it to a stack. When you get to an operator, such as +, you pop the two required arguments from the stack, perform the addition and push the 5 back to the stack.

Dealing with precedence is also very easy. I found a way of doing this, that I think may be original. I would just push every operator to the right following a simple rule. After tokenizing the input string I start with the leftmost token. I walk that token to the right as long as it has lower precedence and as long as it passes the same number of (’s and )’s. After I walk the first token, I walk the second. That’s all there is to it!

This is not the same way Dijkstra does it with the shunting yard algorithm which uses a stack. All I need is an array! I have tried it with lot’s of different scenarios. I treat operands the same as operators.
Read the rest of this entry »