Archive for May, 2009

Mocha. The stubbing library

Tuesday, May 26th, 2009

This example (shortened here):

class Order
  def shipping_cost
    total_weight * 5 + 10
  end
end

require 'test/unit'
require 'rubygems'
require 'mocha'

class OrderTest < Test::Unit::TestCase
  # illustrates stubbing instance method
  def test_should_calculate_shipping_cost_based_on_total_weight
    order = Order.new
    order.stubs(:total_weight).returns(10)
    assert_equal 60, order.shipping_cost
  end
end

and this snippet (emphasis mine):

The more interesting discussion deals with whether to mock or stub your database-backed model. One upside is speed: This test case will not hit the database at all. Another is independence. I completely isolate the code under test to the controller layer.

convinced me that there just might be some treasure to be found beyond the Test::Unit. And I know that it's just the tip of the iceberg.

Debunking the stupidity myth

Wednesday, May 20th, 2009

From Why can’t we concentrate? by Laura Miller:

IQ tests have to be regularly updated to make them harder; otherwise the average score would have climbed 3 percent per decade since the early 1930s. (The average score is supposed to remain at a constant 100 points.) And IQ measures problem-solving ability, rather than sheer data retained, which has grown even faster over the same interval.

And here I was thinking all these years that we, as a global population, are in fact getting more and more stupid. People getting lower and lower grades, coming out of the Universities knowing less and less – it was all just an illusion. Average IQ is climbing. Steadily. Decade after decade we are getting smarter. It’s only that there are too few measures noticing it. Are IQ tests the only ones measuring it?

(via Brutto)

Electricity deficiency

Friday, May 15th, 2009

Yesterday was the day without google. Today was the day without electricity. Now without Google it felt like you didn’t have a right hand, but without electricity, it felt like being crippled. Nothing you could do. Not fun.

Negative consequences of Google’s ubiquity

Thursday, May 14th, 2009

There is at least one. So while today Google is having some heavy troubles with its services, my angry neighbour (who has internet connection through my house) comes at my door saying the network is down.

- So what exactly is happening?
- My Mozilla is not loading.

Google: come back. World needs you.

Moore’s law, 40 years later, still in effect

Thursday, May 14th, 2009

From the informal version of the Moore’s Law:

Moore’s original statement that transistor counts had doubled every year can be found in his publication “Cramming more components onto integrated circuits”, Electronics Magazine 19 April 1965. Moore slightly altered the formulation of the law over time, bolstering the perceived accuracy of Moore’s Law in retrospect. Most notably, in 1975, Moore altered his projection to a doubling every two years. Despite popular misconception, he is adamant that he did not predict a doubling “every 18 months”. However, an Intel colleague had factored in the increasing performance of transistors to conclude that integrated circuits would double in performance every 18 months.

December 15th, 2007: Seagate Barracuda 7200.11 500GB – 427 PLN

May 11th, 2009: Seagate Barracuda 7200.12 1000GB (1TB) – 419 PLN

Same price, twice the capacity. Roughly 17 months and one financial crisis later and the price per GB is almost exactly two times lower. Incredible.

The case of Benjamin Button and 1080p

Saturday, May 9th, 2009

From an imdb review:

Pitt plays the character at almost every age, but it’s almost impossible to tell when the CGI is being used on him. You know it’s there, obviously, but you can’t tell it’s being used. When the transition is just smooth enough for the Visual Effects to be retired, but just rough enough to use makeup, it’s absolutely perfect. If you’ve ever wanted to see Brad Pitt look 20 again, look no further, as the effects that make our actors young again (the same goes for Blanchett) are just as stunning as those that make them older.

Thing is with screen big enough and a 1080p source – you can tell the difference between Brad Pitt and CGI. And you can do it quite easily. Both old and young Benjamin look very much CGI alike. And it’s not that the effects are bad, because they’re not, it’s just that at this level of details (and face close-ups) you need to have your effect to be close to perfect. Seems we’re not quite there yet. The skin, the wrinkles, small hair covering the face, freckles, moles, every face feature – those are things you see and appriciate the most when viewing good HD content. And they make the biggest impresion. I know they did on me. They say animating a face is the hardest thing to do. At HD it’s ten times harder.

Sharing is Caring

Monday, May 4th, 2009

Sharing is Caring

So true, so true.