2007-10-27

Demeter's Revenge

More evidence that if something in Ruby or Rails seems to be more work than it ought to be, you’re probably doing it wrong:

http://www.lukeredpath.co.uk/2007/10/18/demeters-revenge

In this case, mocking ActiveRecord associations was unreasonably inflating the ratio of lines of test code per lines of application code tested.

If ActiveRecord saves you from needing to manually (or otherwise) generate boilerplate ORM code, but you give that advantage back by writing tons of test code, your net advantage just shrank. Also, consider that an excessive ratio of test code to application code acts_as_ball_and_chain, reducing the agility with which you can respond to changing business conditions.

The solution described has two parts: 1) Follow best practices (in this case observe the Law of Demeter) and 2) apply a little more meta-programming goodness.

2007-09-08

iTunes Tip

Here is a tip you’ll find useful if you use iTunes to subscribe to podcasts. I managed to only get 43 seconds of Coverville episode 356 and it wasn’t obvious to me how to download it again. This tip did the trick.

2007-08-10

Humor for Lexiphiles

I wondered why the baseball was getting bigger. Then it hit me.

Police were called to a day care where a three-year-old was resisting a rest.

Did you hear about the guy whose whole left side was cut off? He’s all right now.

The roundest knight at King Arthur’s round table was Sir Cumference.

The butcher backed up into the meat grinder and got a little behind in his Work.

To write with a broken pencil is pointless.

When fish are in schools they sometimes take debate.

The short fortune teller who escaped from prison was a small medium at large.

A thief who stole a calendar got twelve months.

A thief fell and broke his leg in wet cement. He became a hardened criminal

Thieves who steal corn from a garden could be charged with stalking.

We’ll never run out of math teachers because they always multiply.

When the smog lifts in Los Angeles , U.C.L.A.

The math professor went crazy with the blackboard. He did a number on it.

The professor discovered that her theory of earthquakes was on shaky ground

The dead batteries were given out free of charge.

If you take a laptop computer for a run you could jog your memory.

A dentist and a manicurist fought tooth and nail.

A bicycle can’t stand alone; it is two tired.

A will is a dead giveaway.

Time flies like an arrow; fruit flies like a banana.

A backward poet writes inverse.

In a democracy it’s your vote that counts; in feudalism, it’s your Count that votes.

A chicken crossing the road: poultry in motion.

If you don’t pay your exorcist you can get repossessed.

With her marriage she got a new name and a dress.

Show me a piano falling down a mine shaft and I’ll show you A-flat miner.

When a clock is hungry it goes back four seconds.

The guy who fell onto an upholstery machine was fully recovered.

A grenade fell onto a kitchen floor in France , resulted in linoleum blownapart.

You are stuck with your debt if you can’t budge it.

Local Area Network in Australia : The LAN down under.

He broke into song because he couldn’t find the key.

A calendar’s days are numbered.

A lot of money is tainted: ‘Taint yours, and ‘taint mine.

A boiled egg is hard to beat.

He had a photographic memory which was never developed.

A plateau is a high form of flattery.

Those who get too big for their britches will be exposed in the end.

When you’ve seen one shopping center you’ve seen a mall.

If you jump off a Paris bridge, you are in Seine .

When she saw her first strands of gray hair, she thought she’d dye.

Bakers trade bread recipes on a knead to know basis.

Santa’s helpers are subordinate clauses.

Acupuncture: a jab well done.

2007-07-04

Disturbing Simulation

This isn’t exactly a game. It’s more of a simulation, along the lines of John Conway’s “Life.” However, the creatures are disturbingly, er, life-like.

2007-06-14

Clearing IP Address Cache in OS X

Windows has ipconfig /flushdns.

The Mac equivalent is lookupd -flushcache.

2007-06-09

Einstein's Formula for Success in Life

“If A is success in life, then A equals x plus y plus z. Work is x; y is play; and z is keeping your mouth shut.”

—Albert Einstein

2007-05-31

Consistency

“A foolish consistency is the hobgoblin of little minds, adored by little statesmen and philosophers and divines.”

- Ralph Waldo Emerson

2007-03-27

Kuala Lumpur: My New Favorite City

I love Kuala Lumpur. I could live here. It is by far the most cosmopolitan city I have ever visited. It appears that Malaysians have embraced their ethnic diversity and made a really vibrant country from the resulting epoxy.

The quality and variety of the food is just to die for. It’s a pity I can only eat three meals a day. As a vegetarian, I feel especially welcome here. Most places in the U.S., I am regarded as some kind of freak who “only eats salad.” In Korea, they’ve never heard of vegetarians and get this puzzled look when told I don’t eat meat (Direct quote: “That’s not meat, that’s ham!”). Here, I can go to the food court at the mall and there’s a vegetarian section where I don’t have to ask, “Is there meat in that? Chicken? Fish? Ham? Anything that once moved under its own power?”

I’m not entirely certain, but the easy availability of vegetarian food may stem from the intersection between the Muslim dietary laws with those of the Hindus and Sikhs. The food court section I had lunch at today had been officially certified by an Islamic organization as “Halal.”

If you’re more of the carnivorous persuasion, don’t let my vegetarian talk turn you off—you’re more than covered. I’ve been told that some Buddhist Chinese practice vegetarianism, but that does not seem to be the rule here.

Society here appears to be quite tolerant. For example, although Islam is the official religion of Malaysia, alcohol and tobacco are readily available. One thing that is not tolerated, however, is drugs. There is a mandatory death sentence for anyone caught in possession of illegal substances, including cannabis.

It’s possible I may have looked like some kind of country bumpkin on his first trip to New York or Chicago when I first visited the Petronas Twin Towers—the tallest buildings in the world—but you go there and see if you don’t crane your neck and snap some pictures.

Despite having a population comparable to Phoenix, Kuala Lumpur has a well-developed public transit system, including rail, buses and taxis.

Everyone I have met has been very polite and helpful. They’re a little aggressive when behind the wheel, but that seems to be more the rule than the exception in this world.

Overall, I give this country an A+ and recommend it as a travel destination to non-drug-users who can endure the trip required to get here.