All the Movies

2009-10-17

I thought it might be fun to compute the total number of possible movies, based on frame rate, resolution, and the number of possible colors on a standard high-definition digital blu-ray or something. So with some input from people who know more than I do about those things, I came up with the following numbers:

2203 = 10648000 colors/pixel
24 frames/second
1920*1080=2073600 pixels/frame
And I want to calculate all of the possible movies with runnings times less than or equal to exactly four hours.
(4 hours = 14400 sec) * (24 frames/sec) = 345600 frames
Based on the numbers for colors/pixel and pixels/frame, the number of possible frames should be
106480002073600
So for any particular number of frames n, we should have exactly
(106480002073600)n
possible movies. So for all possible movies less than or equal to four hours, we have to sum up these terms for all n from 0 to 345600. According to the appropriate summation formula, this is equal to exactly
(106480002073600)n+1
106480002073600-1
And by plugging in the appropriate value, we get, finally,
(106480002073600)345601 =
106480002073600-1
=
10648000716638233600
106480002073600-1
If we want to use logarithms to estimate the size of this number, we can safely ignore the relatively inconsequential bottom half of the fraction and compute
log10(10648000716638233600) =

716638233600(log1010648000) = 5036008956987
So we're talking about a number that has over five trillion digits. That's so many movies that if you watched a movie every day for the rest of the month, you still wouldn't be done!

Comments

There's some javascript trying to load some comments, and if you're reading this, it's probably not working.

Ugly Duckling

2009-10-12

Don’t these Facebook applications have access to profile information such as gender? These English pronoun misuses shouldn’t be necessary.

And if you’re thinking perhaps the person didn’t actually specify gender in her profile, good guess. But she did.

Comments

There's some javascript trying to load some comments, and if you're reading this, it's probably not working.

Rails Serialization

2009-10-11

This morning I discovered a minor issue with Rails serialization. Any class such as

class Thing < ActiveRecord::Base
  serialize :value
end
uses YAML for serialization, and issues come up if you want to store a String object that happens to have some YAML in it:
>> my_string="---\n:this_should_be_a_string:\n- 1\n- 2\n- 3"
=> "---\n:this_should_be_a_string:\n- 1\n- 2\n- 3"
>> t=Thing.new(:value=>my_string)
=> #<Thing id: nil, value: {:this_should_be_a_string=>[1, 2, 3]}>
I checked the YAML spec and they certainly provide for this (as expected in any serious markup language), using escaped double-quotes. Things get really weird when I try to store a string representing the YAML escaped-double-quoted representation of the above string:
>> t=Thing.new(:value=>"---\n\"#{my_string.gsub("\n","\\n")}\"")
=> #<Thing id: nil, value: "---\n:this_should_be_a_string:\n- 1\n-
2\n- 3">
>> t.value
=> {:this_should_be_a_string=>[1, 2, 3]}
>> t
=> #<Thing id: nil, value: {:this_should_be_a_string=>[1, 2, 3]}>
I checked the rails source and couldn't find anything about YAML anywhere (though several instances of JSON and XML). So I don't know what's going on. I doubt this problem would come up much, but it still surprised me.

Comments

There's some javascript trying to load some comments, and if you're reading this, it's probably not working.

Website Rearranged

2009-10-03

I’ve rearranged my website. Aside from my blog, there is a Sandbox area where I’m grouping my programming projects and web applications. I had an old original section, but I’m phasing that out now.

I’ve also finished a new interactive Polynomial Enumerator for the Sandbox. It’s based on something I tried on my old site, but never made into anything user-friendly until now. If you like silly visual math things like I do, try it out. It falls into the category of playing-around-with-infinite-things. There’s also an accessible explanation for people who don’t regularly dream about set theory.

Comments

There's some javascript trying to load some comments, and if you're reading this, it's probably not working.

C++ Upsets Me

2009-09-27

I promise $25 to the first person who can explain to me what the difference here is:

error: no matching function for call to `Station::setStationAnimationID(int)’ note: candidates are: void Station::setStationAnimationID(int&)

SCREAMING

Comments

There's some javascript trying to load some comments, and if you're reading this, it's probably not working.