Wanna Simulate the Universe?
The next step for this project is to output a list of points and times, and an OpenGL renderer that presents the data.
Also, I'd like to simulate mass aggregation to see if I can get black holes and the like.
Christopher Lord // I work on compilers for a major corporation, specialized in computer languages and the parsing and optimization thereof. In my spare cycles I hack on Haskell, Ruby, and Objective C. Outside of programming, I am an outdoorsman, a skilled photographer, a student of typography and design, and a patient, better driver. buzz.
The next step for this project is to output a list of points and times, and an OpenGL renderer that presents the data.
Also, I'd like to simulate mass aggregation to see if I can get black holes and the like.
I've successfully ported freshslowcooking.com from Rails on an SQL backend to Sinatra running on a MongoDB backend. Everything is going through rack-cache, but even without the caching, things are running much faster in my benchmarks. The official site is still running on rails (no deploy yet) because zibi wants to do a quick redesign to commemorate the faster backend and the change of season.
If you've never seen a street view car, and want to, check this out. How delightfully meta:
Click "View Larger"
For a cooking website I recently worked on, I needed to display decimal floating point numbers as fractions. I needed to come up with the fraction closest to what the user typed. For example, 0.33 should resolve to ⅓. When I googled for a solution, most of the code I found was slow, buggy, and too precise (returning 33/100 for the above example.)
require 'fraction' num, den = 0.33.fraction # num==1, den==3 # You can also get the error num,den,err = 0.33.fraction #=> [1, 3, -0.0033333333333333] # you can choose a different maximum denominator than the default value of 10: num, den = 0.51.fraction(100) #[51, 100, 0.0]
You can get fraction from gemcutter
Here is a quick test of this code:
require 'rubygems'
require 'fraction'
# Google for "ruby fraction" and you find this code
class Float
def number_decimal_places
self.to_s.length-2
end
def to_fraction
higher = 10**self.number_decimal_places
lower = self*higher
gcden = greatest_common_divisor(higher, lower)
return (lower/gcden).round, (higher/gcden).round
end
private
def greatest_common_divisor(a, b)
while a%b != 0
a,b = b.round,(a%b).round
end
return b
end
end
starttime = Time.now
1_000_000.times do
n,d=0.5.to_fraction
end
endtime = Time.now
feeling_lucky=endtime-starttime
puts "I'm Feeling Lucky: " + feeling_lucky.to_s + "s"
starttime = Time.now
1_000_000.times do
n,d=0.5.fraction
end
endtime = Time.now
fractionmod=endtime-starttime
puts "fraction: " + fractionmod.to_s + "s"
starttime = Time.now
1_000_000.times do
n,d=[1,2]
end
endtime = Time.now
max_speed=endtime-starttime
n,d=(fractionmod-max_speed).fraction
puts "algorithm itself requires only #{n}/#{d} of a second for 1,000,000 iterations"
Fantastic! It looks like the "digital divide" is reversing itself in dramatic fashion. Small towns are getting exponentially better internet service than people in the big cities.
Internet should be a service with some baseline quality expectations, and that the only way to provide this (especially in the markets with few incumbent players, like Toronto) is to provide some baseline of competition that raises the game out of the mud of deep packet inspection and excessive overage charges.

The Guardian has been prevented from reporting parliamentary proceedings on legal grounds which appear to call into question privileges guaranteeing free speech established under the 1688 Bill of Rights.
Today's published Commons order papers contain a question to be answered by a minister later this week. The Guardian is prevented from identifying the MP who has asked the question, what the question is, which minister might answer it, or where the question is to be found.
So what's this all about? A British company is dumping toxic waste in Africa. Not just any company either, Trafigura. It's one of those commodity companies that is raping the world for profit.
A boat chartered by the company, the Probo Koala, was caught dumping 528,000 litres of extremely alkaline waste off the Ivory Coast. The Guardian obtained internal Trafigura emails which are claimed to show the company knew the crap was toxic, but was dumping anyway. Now the Trafigura is going sue-happy with the help of their retained legal firm Carter-Ruck. They're trying to prevent this news from breaking, but the Internet is aware, now.
The new MacRuby 0.5 runtime is built upon LLVM, a compiler infrastructure also sponsored by Apple. Thanks to LLVM, MacRuby is able to transform the Ruby abstract syntax tree (AST) from the parser directly into highly optimized machine code. MacRuby supports both Just in Time (JIT) and Ahead of Time (AOT) compilation. The JIT mode will compile down the code at runtime, and the AOT mode will allow you to save on disk the compilation result. AOT compilation makes MacRuby a true Ruby compiler.
I'm excited about the prospect of building cocoa apps in Ruby, and compiling everything down to objects. What's better than that? Well, they've fixed the concurrent performance of Ruby by sharding the global interpreter lock, and they threw in GCD for good measure. I believe developments like this herald the end of C/C++ hegemony. At some point in the near future, this will be the default method of building apps on OS X.
In fact, those people have it all backwards. Humans are immensely good at concurrent thought, and really bad at sequential thought.
In a graphic illustration of the new world order, Arab states have launched secret moves with China, Russia and France to stop using the US currency for oil trading
This looks like the first step towards a pan-asian economic bloc, much like the eurozone. This new denomination would be a formidable competitor for the Euro and the Dollar.