Tuesday, January 22, 2008

Selection sort in python

I'm learning python, so I decided to write selection sort in it. I converted the CPP code from 24btes.com. Here's the code (the array at the beginning contains the numbers that will be sorted):


a = [90, 96, 74, 10, 44, 53, 61, 77, 37, 52, 25, 60, 9, 14, 20, 93, 5, 59, 29, 86, 6, 64, 4, 38, 51, 24, 11, 16, 85, 69, 34, 62, 50, 87, 55, 92, 98, 47, 46, 91, 57, 36, 23, 97, 3, 48, 83, 99, 12, 31, 2, 76, 28, 27, 39, 68, 49, 58, 95, 21, 17, 79, 71, 45, 65, 70, 33, 56, 43, 35, 81, 75, 72, 26, 19, 13, 30, 22, 1, 15, 63, 18, 8, 73, 66, 67, 54, 100, 40, 89, 78, 7, 42, 32, 84, 88, 94, 80, 82, 41]

def selSort (array):
i = 0
listLen = len(array)
while i < (listLen - 1):
minat = i
minval= array[i]

j = i + 1
while j < listLen:
if minval> array[j]:
minat = j
minval= array[j]
j = j + 1

temp = array[i]
array[i] = array[minat]
array[minat] = temp
i = i + 1

print array
print listLen


selSort (a)

Tuesday, January 15, 2008

"Interesting" Quicktime + iTunes license agreement

I was just updating Itunes and Quicktime on my computer, and I got the following license agreement:


What's up with that, eh? I think that it is in english, but with that font how can you be sure? I would be interesting to know exactly how the bug worked that caused this.

Macworld brings down large websites

At the time of writing, engadget and twitter, among others, are down. The outages are the result of people trying to view updates of whats going on at the 2008 macworld keynote. No other event brings down sites on such a large scale.

Thursday, January 10, 2008

Friday, December 14, 2007

Peer pressure

I was surfing the web and found something I thought was funny:
Q - Why did the monkey fall out of the tree?
A - Because it was dead.
Q - Why did the second monkey fall out of the tree?
A - Because it was tied to the first monkey.
Q - Why did the third monkey fall out of the tree?
A - Peer pressure.
(I found it here)

I don't know; maybe this is less funny if you are fully awake.

Thursday, December 13, 2007

New flickr feature

I just noticed a small new feature on flickr: photo stats.

It requires a pro account to use (which I don't have) so I can see exactly what it does.

My favorite XKCD comics

After watching the video of Randall Munroe (the creator of XKCD) give a speech at Google, I thought that I would post my favorite XKCD comics.

Wednesday, December 12, 2007

Top 10 songs of 2007

Jeph Jacques of questionablecontent.net just released his list of his top 10 songs of 2007.

Friday, December 07, 2007

Another picture of the snow day

So this blog is slowly becoming a photography blog. Oh well, I like photography blogs. Anyway, here's the picture:
Title: Snow everywhere Details: A picture of a snowy scene taken with a canon digital elph powershot SD600

Thursday, December 06, 2007

Snow day

It snowed here yesterday (for the first time this winter), so I went out with my camera and took some picture. Here's one:
Snow day
A note on taking picture of snow: set the exposure compensation to +1 ev or else the picture will be much too dark (the white of all the snow confuses the camera).