Richard Stallman

August 15th, 2008

Saw RMS at Canterbury University today.  He has an interesting point of view, very liberal, but also a point of view that is based on old technology.

He said that sites like Google Docs are a problem as you are running a program on their machine, a program that you don’t have control over.  The solution is to install your own version on your own machine.  I wonder how you can do this and still get the advantages of hosted software, such as lower cost, lower administration, and higher availability.  I don’t want to manage any of the software I use, and one solution is to let someone else do it.

He’s not concerned about embedded systems where a processor is used instead of a dedicated circuit, such as in a microwave.  However, my microwave gains time and I’d rather have it show time in 24 hours to match the stove.  Both I could fix with the source.  Then you have car computers such as the Nissan GT-R that changes the car response if it is on a race track.  I heard a rumor of the NSX requiring you to take the car to the dealer if it goes anywhere near a known track.

Hmm.  Perhaps the embedded/mechanical equivalent is the Maker Bill of Rights from Make Magazine.

Zen of website maintenance

August 5th, 2008

A certain website had a few vuneribilities including XSS and leaking passwords.  The fixes were:

  • The <script> tag was turned on for pending users.  Configure off.  All other users get their tags filtered against a safe list
  • The superuser always skips the filter and sees all tags.  I can’t fix this, but I’ve changed the cookie so that its not useful to a cookie catcher
  • The ‘password’ in the cookie was just a hash of the password.  It is now a hash of the password, the IP address of the client, and a secret.  A leaked password should only be usable from the same IP
  • The ‘password’ field has been removed from all forms and replaced with cookie based authentication

Fun and games with Python vs C

August 2nd, 2008

I’m using Python to test the code generated by a C compiler.  Many of the tests are along the lines of:

a = 5
b = 10
result = run_c_code_for_add_in_emulator(a, b)
assert result == a + b

This works fine except when dividing integers with rounding. Under GCC on x86, -100/30 is -3, but in Python -100//30 is -4.  Hmm.

This has the interesting side effect that in Python 2.5 -a/b != -(a/b).

The work-around seems to be to do it explicitly as int(float(a) / float(b)) is -3.

Big Mac Calories

July 20th, 2008

Why does a NZ Big Mac have 464 calories, a UK one 495, and a US one 540?  It might be differences in weight but it’s hard to tell.

Seen on reddit

January 31st, 2008

A man goes to his doctor and tells him, “I’ve had the song ‘What’s New Pussycat’ stuck in my head for weeks, and it’s driving me crazy.”

The doctor says, “Well, I think you may have Tom Jones disease.”

The man says, “I’ve never heard of that. Is it rare?”

The doctor says, “It’s not unusual.”

Moving to Dreamhost

December 13th, 2007

Thought I’d move from Rimu Hosting to Dreamhost.  The VPS we’re on is just too slow and anything that brings the load down is good.

I can’t move the secure sites as Dreamhost doesn’t provide any type of SSL, even a self signed cert from the wrong address, without switching to a static IP and handing over $50 US a year.

And as always happens, I got part way into the move and accidentally broke  something on the original and had to do a rush switch.  Ah, well.

Comparing integers

December 13th, 2007

Notes for next time:

You can check if the unsigned integer ‘a’ is greater than ‘b’ by adding the ones complement of ‘b’ to ‘a’ and testing carry.  A twos complement subtraction doesn’t work as a > 0 is always false.

Signed integers are similar but you first add 0×80000000 to both a and b.  This makes both unsigned without changing the order.

Test after move

December 6th, 2005

All relocated and imported. Now does posting work?

Engines for metaphilter++

September 20th, 2005

Django looks quite decent. Python (not PHP - good), built in basic admin, built in basic user accounts, and the template system is directly applicable to metaphilter.

I’ll give it a try using sqlite 3.2.6 and pysqlite 2.0.4.

Planet Planet Planet

September 3rd, 2005

Planet Planet Planet Mushrooms Mushrooms!