Personal Rapid Transit

September 15th, 2005

It would be so cool if they built this. Be sure to watch the video. I can imagine similar systems scaled up to entire cities and making urban cars obsolete.

In related news, my bicycle has a flat tyre which is tremendously annoying (especially as it happened 3 miles from home on a rainy day). Given how much stuff I have to do over the next couple of weeks, I have no idea when I'll get time to have it fixed.

Bootstrapping a compiler from nothing

September 14th, 2005

Two posts today 'cos I missed yesterday due to being disorganized.

Recently I've been working on bootstrapping a compiler from nothing. Just for fun. I know it's been done before but I wanted to learn about parsing and optimizing and how compilers are constructed.

The first stage of my compiler is a pretty clever hack, even if I do say so myself. I didn't want to use any external tools to get my compiler started, but that left me with a problem - how do I generate the first executable file? Well, one way to generate an arbitrary file from Windows is to just use an "echo" statement in the Windows command prompt and redirect the output to a file. But that only works reliably for ASCII characters (and not even all of those). This poses a problem, because the opcodes for even simple "MOV" instructions are all non-ASCII characters. But it turns out that the "constrained machine code" for x86 consisting of only ASCII bytes is actually Turing-complete and can be used to do useful things (non-ASCII opcodes such as the one for "INT" can be constructed using self-modifying code). So I put together an ASCII program that takes two characters from the command line, combines them into a byte and outputs the resulting byte (which can then be redirected to a file). Calls to this program can be strung together to make (almost) arbitrary binary files, which can be used to compile more complex languages.

In this way (13 iterations later) I have built up a simple but effective 2-pass 16-bit DOS assembler which outputs .com files. I have also written a recursive descent parser for simple infix expressions on unsigned 16-bit integers, and am working on writing a code generator which can output binary code for these expressions.

Eventually I hope to evolve this into a fast and powerful language to rival C++. It will be a language which combines very low-level and very high-level concepts, and will therefore be an ideal language for writing compilers (such as itself) in. I could then use it for writing all sorts of other fun things - maybe I'll tackle an OS when I've finished the language. But for now I'm just having fun learning about things.

Overreactions to terrorism

September 14th, 2005

I do not understand why a terrorist exploding a bomb which kills (say) 50 people is considered so much worse of a crime than (say) a serial killer murdering 50 random people for non-terrorist reasons. The objection people have to terrorism is, after all, the killing rather than the motive. If Al Qaeda pursued non-violent means to their ends instead of violent ones, they would not be nearly the enemy of the US that they are (in fact, their requests might even be taken seriously if they could persuade the US government to listen to them without violence).

I guess the point of taking terrorist crimes more seriously is prevention. Serial killers generally work alone, so once you have arrested one the stops. But if you arrest one terrorist (or he dies in the explosion he causes) there is always another to take his place. So in order to put an end to terrorism, the US government is attempting to eliminate all the people who could become terrorists, even if they have done nothing wrong. The trouble with that plan is that you have to turn this wonderful free country into a police state to do so. It is not enough just to arrest people who attempt to create or buy explosives or who contribute financially to terrorist causes, you also have to arrest people for the books they read, the photos they take, the websites they visit, the people they talk to and the things they say. You have to spy on everyone to find out if they have any sympathies for terrorist organizations. You have to completely gut the concepts of free speech and privacy which are some of the most important principles upon which the country is based. Already such rights are being eroded, and terrorism is showing no signs of disappearing. And instead of abandoning these dangerous and ineffective policies, the US government is trying to expand these anti-terrorist activities and erode more rights in the process. I think most people would (if they thought enough about it) rather take the freedoms we have along with a small chance of being killed in a terrorist attack than live in the world of 1984 but be safe from terrorists. As with all law enforcement it is a question of balance. I for one am more afraid of being arrested on suspicion of terrorism charges than I am of getting killed by a terrorist, which means that the balance has swung too far to the side of fascism. In fact I was in two minds whether to post this lest it be interpreted as supporting terrorism.

Here is what I think the government should do instead: treat terrorists as the criminals they are. There is no need to implement any special policies like deporting people to countries where they will be tortured, or imprisoning people indefinitely without trial, or removing judicial oversight from surveillance operations, or requiring libraries and bookshops to hand over their records. None of these things were needed in the past when it was just normal criminals that were being dealt with, so they should not be needed now. All that is needed is a sensible set of laws and the ability to enforce these laws. If we need laws against things like "possession of explosives with intent to murder" or "financially aiding a criminal organization" then so be it but no laws should be made limiting free speech or evading the checks and balances that have evolved to keep the system fair and just.

At the same time, the US government should be more open to considering the points of view of any political group who feels they have a legitmate gripe, even terrorist ones such as Al Qaeda (there is no point excluding the terrorist ones because any such organization will just split into two groups - a "political" one which does not officially endorse terrorism, but which secretly funds it, and a "military" one which blows things up). The idea is that if a group is given the same amount of attention whether or not they commit terrorism, there will be no incentive to commit terrorism. And there is still a definite incentive not to commit terrorism - namely that if you do so, your followers are liable to get arrested. Also, no-one should ever be left feeling that terrorism is the only option they have to get their point across.

And once you have your enemy sitting at the same table as you and prepared to talk, the war is half over.

Iraq army

September 12th, 2005

There is a lot of talk in the media at the moment about when and how to withdraw US troops from Iraq. Here's a suggestion - the US army should gradually withdraw as the Iraqi army grows (in size and capability), and when the size of the Iraqi army reaches the size of the number of (US + Iraqi) soldiers currently in Iraq, there should be no US soldiers left. The US soldiers should train the Iraqi soldiers to take over the jobs that they are currently performing. They should give the weapons and equipment necessary to do these jobs.

Of course, the danger then is that this new super-duper Iraqi army might then be so big and powerful that (if they wanted to) Iraq could then turn around and invade the US.

Time travel

September 11th, 2005

Suppose that some time in the future, humankind figures out a way to make possible time travel into the past. Suppose, furthermore, that it turns out that the universe is holonomic - that is, there is only one past and one future and we can't change it (so we can't create an "alternative 1985" like in Back To The Future II). Effectively, the entire history of the universe would be predestined. So the going back in time would also be predestined. Anything that the time-travellers do while on their trip to the past would have already have happened and would always have happened. So we know that the time travellers cannot kill their past selves (or they would not be in there in the future to make the trip). In fact, anything that they do in the past must guarantee that the time travellers are alive and sufficiently healthy in the future to be able to make the trip back (which would not necessarily be the case if the time travellers were not there). So effectively, the time travellers would be their own guardian angels, "protecting" their past selves (deliberately or not) simply by the virtue of existing in the past.

Now, suppose that you are a future human in possession of a time machine. You don't worry about "responsible time travel" since you can't break anything or rewrite history. It's only natural for you to wonder just how far back in time you can go. With sufficient technological advancement, you might be able to go right back to the moment at the very beginning of the universe. And, just maybe by going back to that point in time you actually initiate the creation of the universe - you become God.

Sometimes I wonder if the universe is like that. But I suspect it is not - I find it very difficult to believe that free will is just an illusion.

The Lego Imperial Death Star II

September 10th, 2005

Is it so wrong that I want one of these? At 3449 pieces, it is the largest lego set ever made. Yeah, despite the mortgage and forthcoming wedding I am still a child at heart. I really hope that when I have children of my own they like Lego and will let me play with it with them.

Talking of Lego, do you why Americans call Lego bricks "Legos"? It's because they needed somewhere to put the "s" from "maths". Thank you very much - I'll be here all night. Try the chicken.

Pope joke

September 9th, 2005

When the pope was elected I made this joke to Gennie and she said I should post it.

So the new pope will be called Pope XVI Benedict. I wonder if the pope from 6 Benedicts ago was called Pope X Benedict (eggs benedict - get it?)

Yeah, I know, it's pretty awful.

The big scary list of things that we need to do to the house, in no particular order

September 8th, 2005
  • Yard/exterior:
    • Remove ivy/vegetation growing closer than 18" to the house
    • Regrade surface adjacent to building
      • Ground needs to be at least 6-inches below wood frame on all sides of the house
      • Ground needs to slope down away from the house for at least 5-10 feet
    • Remove trash from underneath porch deck
    • Sow more grass seed
    • Ensure there is not too much water coming down the embankment
    • Patching/repair of siding/trim
    • Exterior repainting
    • Replace house numbers
  • Storm drains:
    • Evaluate condition of lines
    • Rout out lines
    • If lines are clogged or broken and can't simply be cleaned out:
      • Repair or replace lines with newer material
      • Install below-grade storm water draining system using solid non-perforated pipe, maintain 2% minimum slope (4% or more is better)
    • Unclog line at northwest corner of house
    • Connect downspout at north side adjacent to the masonry chimney (and any other disconnected downspouts) into the rest of the system.
    • Determine where the lines discharge to.
    • Clean and caulk gutters and roof storm drainage system
  • Heating system:
    • Ask previous owners about heating installation and obtain records or receipts if available.
    • Floor framing has been left exposed and needs to be enclosed
    • Service furnace
    • Water ponding on floor next to furnace (from disconnected condensate line?)
    • Evaluate adequacy of return air and exhaust installation (white pipes)
    • Vacuum clean heat registers
    • Vacuum blower compartment of furnace
    • Replace furnace filter
    • Find out normal operation and emergency procedures (find manual or ask furnace service firm)
    • Install/improve combustion air intakes
    • Change furnace air filter
    • Check furnace heat exchangers
  • Decks:
    • Attach decks and front porch to house more solidly
      • Use 5-6 inch lag bolts to supplement existing nails
    • Replace rotting wood
    • Treat new decking boards with penetrating stain
    • Increase spacing between deck boards
    • Re-seal deck boards
  • Kitchen:
    • Fix stove ventilation fan
    • Have plumber evaluate and if necessary correct drainline air gap vent for dishwasher installation
    • Raise height of light near large floor-standing cupboards that I keep banging my head on
    • Clean sink strainers
  • Hall bathroom:
    • Route ventilation fan ducts to exterior instead of into attic space
    • Replace sink stopper
  • Garage:
    • Replace or fix garage door locks & springs
    • Lubricate garage door mechanism
    • Replace broken wood in garage door
    • Add automatic garage door opener
    • Add self-closing door mechanism between house and garage
    • Fix gypsum wallboard
    • Ask previous owners about what repairs were done where the ceiling is open
  • Electrical:
    • Terminate/cap off wires in panel and at furnace
    • Replace wall outlet cover plates
    • Replace light receptacle/switch cover plates
    • Have an electrician check the complete system
  • Miscellaneous:
    • Fix squeaky floorboards
    • Replace carpets
    • Interior painting
    • Replace interior doors
    • Fit closet doors
    • Replace windows with holes or where condensation is present between panes of glass
    • Replace remaining blinds with curtains
    • Fit mantlepiece/shelf above fireplace?
    • Buy a new chest of drawers for bedroom
    • Change locks
    • Have ceiling finish tested for asbestos
    • Check for leaks in water service line
  • Basement:
    • Redecorate
    • Add home cinema and one of:
      • Pool table
      • Foosball table
      • Table-tennis table

Lyrics competition 2005 answers

September 7th, 2005

(1)
We may lose and we may win,
But we'll never be here again.

Eagles - Take It Easy

(2)
Unless the moon falls tonight,
Unless continents collide,
Nothing's gonna make me
Break from her side.

Del Amitri - Driving With the Brakes On

(3)
This whole damn world can fall apart.
You'll be OK, follow your heart.
You're in harm's way
I'm right behind -
Now say you're mine.

New Radicals - You Get What You Give

(4)
You got to cry without weeping,
Talk without speaking,
Scream without raising your voice.

U2 - Running To Stand Still

(5)
But the truth is:
I never could stop dreaming,
Anymore than I could
Make them all come true.

Dar Williams - The Kid

(6)
The rocks may melt
And the seas may burn

I threw this one in as a trick question (or possible tie-breaker). Two possible answers would have been accepted:
Mary Chapin Carpenter - 10,000 Miles
Tom Petty and the Heartbreakers - Learning to Fly

(7)
I'm soaking through and through.
Then you handed me a towel
And all I see is you.
And even if my house falls down now,
I wouldn't have a clue
Because you're near me.

Dido - Thank You

(8)
You'll never see the end of the road
When you're travelling with me.

Crowded House - Don't Dream It's Over

(9)
You took off your coat, stood in the rain.
You were always crazy like that.

Jewel - Foolish Games

(10)
If it seems I'm floating in the darkness,
Well I can't believe
That I would keep you from flying.

Tori Amos - 1,000 Oceans

(11)
You fill up my senses
Like a night in the forest,
Like the mountains in springtime,
Like a walk in the rain.

John Denver - Annie's Song

Please keep all negative comments about my taste in music to yourselves - I've heard them all before.

Lens doctor - stay away!

September 6th, 2005

Normal service is now resumed (I was out of town for a few days and am still catching up with things).

A while ago I found that the lenses of my sunglasses had somehow become scratched. They were fairly expensive sunglasses so I decided to see if I could fix them using one of those glasses repair kits that you see on the infomercials. Well, just like the other infomerical-advertised item I have bought in the past (the "quick chop") it is completely useless. The solution solidifies alright, but rather than spreading out into a thin, smooth, uniform layer first (as claimed), it just solidifies in place like glue, leaving a smear on the lens which is far more annoying than the original scratch. How a product can be advertised to do a thing and so utterly fail to do that thing is a complete mystery to me. Avoid at all costs.

Don't forget that today is the last day to enter the lyrics competition.