June 2011 Archives

1/3 of Americans have nonalcoholic fatty liver disease

Please exercise and eat smart because fat is destroying millions of Americans' livers:

Two-thirds of Americans are either overweight or obese, and doctors say they’re seeing more and more patients like Wilson Alvarado [whose liver disease caused him to become irrational and violent].

“It’s overwhelming how many patients we’re seeing with this problem,” says Dr. Naim Alkhouri, a hepatologist at the Cleveland Clinic.

Dr. William Carey, also a hepatologist at the Cleveland Clinic, adds, “This is huge. We didn’t even know this disease existed 30 years ago. Now it’s the most common liver disease in America.”

‘We won’t have the ability to treat all these patients’

About a third of the U.S. population has nonalcoholic fatty liver disease, according to Dr. Michael Curry, a hepatologist at the Beth Israel Deaconess Medical Center in Boston.

Curry said most of those people — about 80% — will not develop significant liver disease. The other 20% will develop a disease called nonalcoholic steatohepatitis, or NASH. Of those, about 20-30% will go on to develop cirrhosis and end-stage liver disease, where the only real treatment is a liver transplant.

“That’s about 6 million people. We won’t have the ability to treat all those patients,” Curry says. “If we even have a fraction of that number of patients, it will overwhelm liver transplant programs.”

Posted by James on Jun 21, 2011

Building "a sustainable culture of customer focus and product excellence"

Excellent article on product development by former GM, Chrysler, BMW and Ford executive Bob Lutz.

Lutz argues the best short-term manager is an omniscient autocrat, like Steve Jobs or former Volkswagen CEO Ferdinand Piëch:

Astonishingly, in this critical area of product creation, where the future of the car company hangs in the balance, the much-scorned autocratic style of management works well, and numerous success stories confirm it. The big proviso, of course, is that the autocrat must be so steeped in the car business, and have so much taste, skill, intuition, and sense for the customer, as to be nearly infallible. (I shall eschew discussion of the less-than-knowledgeable autocrat, who delves into things he or she knows little about and demands that it be done this or that way. It is a near-infallible recipe for disaster.)

But, Lutz continues, dictatorial management is a lousy long-term strategy because it’s unsustainable:

I often ask myself if the company could have achieved the turnaround in product excellence faster if I had been less patient and more brutal in my approach.

One of the things I found I had to do was teach the basics of what constitutes a beautiful interior, beautiful paint and superb fits of outside sheet metal. Friday after Friday, I was in one engineering shop or another, surrounded by midlevel engineers, designers and manufacturing execs, going over a future model in tiny detail, showing everyone how the same part looked on an Audi or Lexus (we always had one of each for comparison), then asking why we couldn’t execute it like that, and listening to more or less valid answers.

I had to ask myself, and still do today, if it is the proper role of a vice chairman of a company with annual revenue of $200 billion to get down in the trenches for hours on end, teaching the love of perfection in the smallest details when perhaps a more impatient autocrat would simply have ordered—nay, demanded—that it happen, laying down a deadline and then firing masses of people if the deadline came and the results weren’t there.

The fact is, though, that my effort to instill into the organization a drive for perfection and customer delight in all things was successful. And still I wonder—was I right? Did I change the core of the product development culture by teaching, or did I rely too much on my own will and my considerable influence to get what I wanted?

If the latter, excellence will soon be lost again, and talk of “how much we can cut before the customers start complaining” will rear its ugly head again. It will be death by a thousand small cuts, because anytime the company loses the focus of providing the very best it can, delighting the eye, ear, butt and wallet of the customer more than the competitors do, the inevitable decline sets in.

Posted by James on Jun 12, 2011

Coastal/island climates vs. continental climates

I’ve split my January/July average high temperature data into two subsets: 1) Islands, West Coast states, and Florida; and, 2) Everything else (continental United States).

The subsets obviously constitute two completely different climate patterns:

Climate pattern of islands, West Coast and Florida vs. everything else

(The outlier on the continental U.S. plot is the top of Mt. Washington in New Hampshire. There’s little reason to expect a 6,288-foot mountaintop to fit the continental pattern.)

Posted by James on Jun 14, 2011

Data analysis: Lifestyle plays huge role in health, healthcare's value less obvious

I created a dataset with many health-related variables with one observation for each state (plus Washington, D.C.).

I then ran a principal component analysis to generate the following plot of the first two principal components:

Principal component analysis plot of lifestyle and healthcare dimensions

The 1st principal component, which explains 31.6% of all the variation in the dataset, is easily interpreted as HEALTHY LIFESTYLE CHOICES AND BETTER HEALTH. High scores on the 1st p.c. are strongly associated with exercise, high school graduation, flu vaccinations, and healthy birth weight babies. High scores on the 1st p.c. are strongly negatively associated with: smoking, teen pregnancies, obesity, diabetes, and cancer deaths (colon, prostate, lung, breast, and overall). States scoring high on HEALTHY LIFESTYLE CHOICES AND BETTER HEALTH include: Utah, Vermont, and Minnesota. States scoring low include: Washington, DC, Mississippi, Louisiana, Alabama and Kentucky.

The 2nd principal component, which explains 20.1% of all the variation in the dataset (so the first two p.c.s together explain 51.8%), is easily interpreted as QUALITY HEALTHCARE. (Confusingly, I’m interpreting negative scores on this p.c. as QUALITY HEALTHCARE. Positive scores represent POOR HEALTHCARE.) The QUALITY HEALTHCARE p.c. is strongly associated with vaccination of babies, use of medical screening tests (cholesterol levels, colonoscopies, pap smears, fecal occult blood tests, mammograms), prophylactic administration of antibiotics before and after surgery, and administration of flu vaccines to at-risk groups. The QUALITY HEALTHCARE p.c. is strongly negatively associated with suicide. This initially struck me as odd, but it makes sense because quality psychiatric treatment can prevent many suicides. States scoring high on QUALITY HEALTHCARE include: Rhode Island, Massachusetts, and Delaware. States scoring low include: Nevada, New Mexico, and Wyoming.

What jumps out at me is that the 1st principal component represents both healthy lifestyles and greater health and lower death rates. The 2nd principal component represents quality healthcare but isn’t linked to better health outcomes. It’s not obvious from this analysis that QUALITY HEALTHCARE is actually improving health or lowering death rates. Perhaps I’ve not included variables that would pick up this positive health impact. But QUALITY HEALTHCARE seems, if anything, to be associated with higher cancer death rates and lower birth weight babies. Though this effect is almost certainly not causal, neither is it evidence of a strong relationship between QUALITY HEALTHCARE and better health outcomes.

The 3rd principal component (soaking up another 14.7% of the variance in the dataset) seems to be identifying states with more smokers and obese people who are dying of cancer at higher rates. These 3 principal components together explain 66.5% of total variation in the dataset.

My takeaway from this analysis: Your health is largely a function of healthy lifestyle choices. If you smoke, eat fast food, don’t exercise, weigh too much, etc., don’t expect hospitals to keep you alive. Great medical treatment may add a few years of fragile life. But healthy living can avoid cancer, heart disease and diabetes, giving you — potentially — a happy, healthy, active, decades-long old age.

Posted by James on Jun 14, 2011

Data suggests exponential growth in weather disasters

This Guardian article on recent extreme weather around the globe provides some hard numbers that seem to confirm my gut sense that the frequency and severity of global warming-related extreme weather events will increase not linearly but exponentially:

Killer droughts and heatwaves, deeper snowfalls, more widespread floods, heavier rains, and temperature extremes are now the “new normal”, says Nikhil da Victoria Lobo of the giant insurance firm Swiss Re, which last month estimated losses from natural disasters have risen from about $25bn a year in the 1980s to $130bn a year today….

Oxfam reported that while the number of “geo-physical” disasters – such as earthquakes and volcanic eruptions – has remained more or less constant, those caused by flooding and storms have increased from around 133 a year in 1980s to more than 350 a year now.

Until now, oceans have absorbed much excess CO2 and heat. But we’ve exhausted our natural buffer, and the atmosphere is starting to go into overdrive. (Nevertheless, humans are pumping more CO2 into the atmosphere than ever before!) Feedback effects will make matters even worse, as frozen tundras warm — releasing massive quantities of methane (a potent greenhouse gas) — and snow/ice that reflects energy away from the Earth melts, causing oceans to absorb more of the sun’s energy.

Hard data says severe weather is already dramatically worse than two decades ago. That bodes very badly for our future.

Posted by James on Jun 14, 2011

Free textbooks! Get your free textbooks!

I’m brushing up on my linear algebra and today went looking for free online textbooks. I was amazed by how many great textbooks are available (legally) for free online. I downloaded many statistics and linear algebra textbooks that have been made freely available and are linked to from OERCommons.org.

Commercial textbook publishers have wisely been working hard to create rich interactive and multimedia content because they’re facing stiff competition from free textbooks.

Posted by James on Jun 06, 2011

Greenwich's poll tax for beaches

After Black Americans were given the right to vote, many Southern states and towns imposed “poll taxes” — “which often included a grandfather clause that allowed any adult male whose father or grandfather had voted in a specific year prior to the abolition of slavery to vote without paying the tax” — to keep them from exercising their right to vote.

Well, after the courts forced Greenwich, CT to open its public beaches to, um, the public, Greenwich created its own “poll tax” to keep out the rabble. Good luck using Greenwich’s beaches, writes Rabbi Shmuley Boteach:

We arrived at Greenwich Point Park, a jutting peninsula that looked pretty. They would not sell us a pass to get in. They told us we had to drive back into the city, go to some bureaucrat’s office, and pay $20 for the car and $5 for each person to sit on a beach. We were happy to pay but couldn’t we do it right there? No, the attendant explained to us that we had to follow this map back into the city and go to an office that hopefully was open on Memorial Day.

The children and I were deflated. We gave up on the park and proceeded to drive around Greenwich looking for a pretty place to stroll. We found a gorgeous coastal walk, parked the car, and climbed over a small stone fence onto a tiny and mostly unoccupied beach. Immediately a man in a suit and a tie alighted on us to tell us that the beach was private. He was the manager of a club that owned it. We had to leave immediately. We climbed back on to the sidewalk.

But the manager was not finished with us yet. We had to leave the street as well, he told us. Turns out we had driven into a private community and the very street and sidewalk were off limits. By now I was getting tired of this. I asked the manager how a street could be private. He explained that the residents paid a special tax. I responded that I had the misfortune of living in a city in New Jersey that had some of the highest taxes in the nation. Still, we didn’t close our streets to visitors. He proceeded to call a patrol car that was driving by. Within minutes the police officer was telling me, right in front of my kids, that if I did not leave he would arrest me. ‘But there was no sign saying any of this was private,’ I objected. ‘No one stopped to tell us we were in a private area. We just wanted to go to a beach. We drove up, parked, and started to walk. Is that a crime?’ He told me I had received my first warning and this was my final chance. He reached for something in his pocket to begin the booking process. I thought to myself, ‘if I’m arrested my children will be stranded in this private community, they won’t have anyone to drive them off, and soon they’ll be arrested as well. Then my wife would come to find us and she too would be arrested. The whole family would be behind bars.’ I politely agreed to leave. The policeman smiled warmly and politely gave me directions to a ‘public’ beach in a nearby town. ‘It’s where I take my grandkids,’ he told me.

Posted by James on Jun 02, 2011

House prices should continue plunging

I used Federal Housing Finance Agency (FHFA) data and Holt-Winters forecasting to generate house price projections for eight major housing markets. Extrapolating current trends into the future is hardly foolproof. (In fact, it’s a big part of how we got into the housing crisis in the first place!) But current trends suggest house prices will continue falling rapidly:

House price forecast chart Another house price forecast chart

Posted by James on Jun 13, 2011

Incompetence squared

Rep. Michele Bachmann (R-MN) chose “John Wayne” as her presidential campaign launch theme and then traveled to the birthplace of serial killer John Wayne Gacy to make her grand announcement!

In an interview yesterday with Newsmax, [Rep. Michele Bachmann (R-MN)] said she wants to live in “John Wayne’s America.” And in the Iowa town of Waterloo today, where she announced her presidential candidacy, Bachmann told Fox News, “John Wayne was from Waterloo, Iowa. That’s the kind of spirit that I have, too.” But unfortunately for historically challenged Bachmann, as the Washington Times points out, the John Wayne born in Waterloo is John Wayne Gacy, the notorious serial killer who murdered 33 teenage boys and young men, not the iconic Western actor.

Many Republicans want this woman to have the power to launch America’s nuclear weapons?!?!? “What do you mean I just nuked Moscow, Idaho?”

Rep. Bachmann appears to live in a fantasy world unconstrained by facts or reality:

Examining 24 of her statements, Politifact.com, the Pulitzer Prize-winning fact-checking service of the St. Petersburg (Fla.) Times, found just one to be fully true and 17 to be false (seven of them “pants on fire” false). No other Republican candidate whose statements have been vigorously vetted matched that record of inaccuracy.

Inability to distinguish fact from fiction is not a trait I value in presidents.

Posted by James on Jun 28, 2011

Integration testing with encrypted passwords

Unit tests and functional tests are essential tools, but they can’t exercise your browser-side Javascript/JQuery code, and that’s where some features on my website broke — to my great embarrassment — some time over the past few months. I updated many things — JQuery, Rails, JRuby, several JQuery plugins, my JQuery code, rails.js, replacing will_paginate with kaminari, etc. — before realizing that somewhere along the line some of my client-side Javascript had broken.

Last year, I did some integration testing using Capybara (previously Webrat), Cucumber, Selenium, RSpec, and FactoryGirl, but I never got very far because I always got stuck on how to test Devise, with its encrypted passwords, password salts, and confirmable module. Fixtures wouldn’t work because passwords are not stored directly in the database; encrypted versions of passwords are stored.

I’m happy to have finally gotten past that annoying hurdle after realizing FactoryGirl provides four different build strategies:

  • “build()” creates an instance without saving it to the database
  • “create()” creates and saves an instance to the database
  • “attributes_for()” defines a set of valid attributes without creating an instance
  • “stub()” creates an object with stubbed attributes

The solution to my problem is having FactoryGirl hand each test a valid set of attributes, which the test then uses twice: first, to create and save a user object, and, second, to log in as that user. (If you’re using the confirmable module, you’ll also want your test code to call “user.confirm!” before attempting to log in.)

One other problem that caused me much grief is that Capybara works with various engines, but you can’t mix syntaxes. This works:

get new_user_session_path
response.body.should include("Sign in")

And this works:

visit new_user_session_path
page.should have_content("Sign in")

But this will fail (and possibly cause you to tear your hair out, as I nearly did):

get new_user_session_path
page.should have_content("Sign in")

So, be careful not to mix-and-match!

Posted by James on Jun 20, 2011

Is China a house of cards?

To many in the West, China appears an unstoppable economic juggernaut. But China’s economy will soon confront some serious problems. And hedge funds smell blood in the water.

Even today, China looks much rosier from the outside looking in than from the inside looking out, as this English translation of a Chinese news article explains:

Nearly 60% of [Chinese] people interviewed claim they are either considering emigration through investment overseas, or have already completed the process, according to the 2011 Private Wealth Report on China published by China Merchants Bank and a business consulting firm Bain & Company. The richer you are, the study suggests, the likelier it is that you resort to emigration. And among those who possess more than 100 million yuan, 27 % have already emigrated while 47% are considering leaving.

The fact that more and more rich Chinese are seeking to emigrate is turning into a hot topic in China, and statistics prove that the trend is a real one. According to Caixin online, a Chinese website specialized in finance, the compound annual growth rate of overseas investment by Chinese individuals approached 100% between 2008 and 2010. The compound growth rate of the Chinese who used investments to emigrate to the United States in the past five years is 73%.

…[T]here are a lot of things in China that even the richest cannot buy… like [good] laws and regulations, the education system, social welfare, inheritance tax, quality of air, investing atmosphere, food safety, ability to travel, and so on. In short, these are the material factors that any State must provide to its people in order to ensure their happiness. In emerging countries such as China, these factors are still often found wanting.

Emotional reasons behind rich people’s immigration are generally linked to the lack of a sense of personal safety, including safety of personal wealth, as well as fear about an uncertain future.

…A recent Gallop Wellbeing Survey showed that most Chinese people feel depressed, even as China has sky—high economic growth rates that Europe and America can only dream of. According to the survey, which asked respondents to choose between “thriving,” “struggling,” and “suffering” to describe their situation, only 12% think themselves as “thriving,” while 17% describe themselves as “suffering,” and 71% “struggling.” The number of Chinese who feel that their life is improving is comparable to the number of Afghans and Yemeni who feel the same way, while the number of persons feeling they are “struggling” is approximately the same as in Haiti, Azerbaijan and Nepal.

…[A]s the gap between the rich and the poor is getting wider, and the poor are complaining more and more, the rich are also getting more nervous.

Posted by James on Jun 12, 2011

My favorite app: GoodReader

Whenever I get my wife hooked on a paper book — as I have with “Big in China: My Unlikely Adventures Raising a Family, Playing the Blues, and Becoming a Star in Beijing”, which I enjoyed first and now she’s enjoying — I get to use the family iPad as we ride stationary bikes at the gym.

Last night, I peddled through R Cookbook. Since I’ve written programs in R, I’m not learning a ton from R Cookbook, but it is a good refresher and the material is clearly presented, with illustrative examples. In the 36 hours I’ve had it, I’ve already read through well over half the book in just a few hours, so there’s not a lot of advanced material for people who’ve used R before, but it’s a worthwhile refresher and reference at $16 (after 50% off from an O'Reilly coupon I found online).

The only paid app I’ve purchased (other than stuff for our kids) is GoodReader, a terrific app for reading PDFs. I’ve stuffed GoodReader with books on Git, Ruby, Selenium, RSpec, Rails, Vim, R, RabbitMQ, PostgreSQL, Node.js, shell scripting, Apache, statistics, and more. And I can carry the tall “stack” of books with me anywhere and search for whatever function or concept I need. It’s also lighter than holding a tech manual while riding an exercise bike.

My only complaint is Apple’s proprietary operating system and file system. I should be able to attach the iPad to my (Linux) laptop and copy my PDFs to a folder on the iPad for viewing later. Instead, the easiest method I’ve found is to copy my PDFs from my laptop to the public directory of one of my Apache servers and then download the file into GoodReader by typing the URL. It’s a hassle. That’s Apple’s fault, not GoodReader’s. But openness and hackability will definitely be big factors when deciding on our family’s second tablet.

Posted by James on Jun 07, 2011

No new coal/nuclear power plants! Solar is nearing cost-competitiveness

Solar power keeps getting cheaper and cheaper. In fact, solar should be cost-competitive with nuclear and coal (in sunny climates) before new nuclear and coal plants could become operational.

And “cost-competitiveness” doesn’t even factor in the REAL cost of coal and nuclear, both of which create huge negative externalities that aren’t priced into their market cost. The “price” of nuclear power includes neither incredibly costly nuclear disasters nor our inability to get rid of deadly nuclear waste. Similarly, the “price” of coal does not include the immense future costs we’ll pay as our planet warms and our climate changes in devastating ways.

For more good news on solar, see these pretty charts and economic analysis of solar power.

Posted by James on Jun 14, 2011

Oceanic summer cooling effect

I’m playing around with data today and was surprised when I plotted historic January high temperatures against historic July high temperatures. I expected them to plot along an upward-sloping line. Instead, I saw a curve going up (as I expected) but then bending downward:

Historic high temperatures in January and July

The same effect shows up when I plot average January high temperatures against average July high temperatures:

Average high temperatures in January and July

I initially assumed a data problem. But I quickly discovered that most of the outliers — i.e., observations with much cooler July high temperatures than predicted by their January high temperatures — are islands in the Pacific Ocean or Atlantic Ocean coastal cities:

                                      JAN       JULY
EUREKA, CA.                           55.0      63.3
LONG BEACH, CA                        68.0      82.9
LOS ANGELES AP, CA                    65.6      75.3
SAN DIEGO, CA                         65.8      75.8
SAN FRANCISCO C.O., CA                58.1      68.2
SANTA BARBARA, CA                     65.4      76.7
SANTA MARIA, CA                       63.9      73.5
KEY WEST, FL                          75.3      89.4
MIAMI, FL                             76.5      90.9
HILO, HI                              79.2      82.5
HONOLULU,HI                           80.4      87.8
KAHULUI, HI                           80.3      86.9
LIHUE, HI                             77.9      83.9
GUAM, PC                              84.0      86.8
JOHNSTON ISLAND, PC                   81.9      86.5
KOROR, PC                             87.6      87.5
KWAJALEIN, MARSHALL IS., PC           85.6      86.6
MAJURO, MARSHALL IS, PC               85.2      85.9
PAGO PAGO, AMER SAMOA, PC             86.8      83.8
POHNPEI, CAROLINE IS., PC             86.8      88.2
CHUUK, E. CAROLINE IS., PC            87.0      87.7
WAKE ISLAND, PC                       82.4      88.8
YAP, W CAROLINE IS., PC               86.5      87.2
SAN JUAN, PR                          82.4      87.4

Oceans moderate air temperature fluctuations because oceans are colder than than the air in summer and warmer in winter. Consequently, the linear shift in land temperatures we observe over much of the continental United States (i.e., significantly higher temperatures in summer than winter) does not hold for locations on or surrounded by oceans. (This is obvious to anyone who has fallen in love with Hawaii or Silicon Valley for their moderate winters.)

Posted by James on Jun 13, 2011

Programming advice from Ancient Rome: "Festina lente"

Studying Latin in high school, I was perplexed by the phrase festina lente (“hurry up slowly”).

On its face, it’s an oxymoron, but it became an aphorism — and has stuck in my head for a quarter century — because it expresses a profound truth. We should aspire to achieve our goals quickly but without moving so fast that we trip ourselves or drift off in the wrong direction. We must regularly adjust our course and run slowly enough that we don’t run off a cliff or twist an ankle stepping in a rabbit hole.

I mention this because I failed to do this on my PowerMandarin project and am now suffering the consequences.

First, the good news: Every change I’ve made to my website has been stored in a “version control system” (Git), so I have been able to roll back in time to February and am now going through all my subsequent changes and re-applying the good stuff. I’ll then go back again and look carefully at possibly problematic changes. But I should have avoided this whole nasty mess.

I made two inexcusable mistakes. I’ve read a number of excellent books on how to program (including: Ship It!, The Pragmatic Programmer, Code Complete, Practices of an Agile Developer, etc.). They all stress: 1) Write a solid test suite with broad coverage of your program; and, 2) Change your code in small chunks and test each chunk before moving on to the next chunk.

I’ve had these concepts drilled into my brain. But only after discovering that something since February broke several JQuery/Ajax features on my website have I FELT the need to create a solid test suite and use small “topic branches” to implement new features in isolation from other code changes. I made several months of changes in my “master branch” before realizing something had broken several JQuery/Ajax features. The suspects were too many: Upgrades to Rails, upgrades to JRuby, upgrades to JQuery, upgrades to JQuery plugins, upgrades to rails.js, upgrade of pagination.js, replacement of the will_paginate gem with the kaminari gem, etc.

Had I written a comprehensive test suite that exercised my JQuery/Ajax code and tested my changes before committing them (ideally using a “continuous integration server”), I would have immediately detected the problem and known what caused it. Instead, I’m stuck wading through months of code patches. Never again! Another key lesson learned — at great and avoidable pain — in my march to become a quality programmer.

Posted by James on Jun 01, 2011

Self-paced learning especially powerful for adult learners

Many students prefer to watch a video lecture than attend an actual lecture because they can pause a video lecture or rewind and watch something again. (Also, many students don’t like dragging themselves out of bed at a particular time, sitting in large lecture halls, being distracted by other students, worrying about their appearance, etc.)

This past weekend, I experienced another huge advantage. I spent part of the weekend refreshing my rusty knowledge of linear algebra. I watched about thirty of Sal Khan’s linear algebra lectures. Since I once knew this stuff well, I was able to skip past material I felt comfortable with, like the tedious algebraic steps to convert an augmented matrix into reduced row echelon form. I needed only a quick reminder of the process, not a demonstration of the mechanics, so I skipped it. I also skipped several lectures, including “Proof of the Cauchy-Schwarz Inequality.” I can always go back and watch it, but right now that material seems of minor importance.

Posted by James on Jun 07, 2011

Stupid method names -> Angry programmers

Which of these commands do you think installs package “spoon” if you don’t yet have package “spoon” on your computer:

“bundle install spoon”


“bundle update spoon”

Correct answer: “bundle update spoon”

I’ve correctly run “bundle update xyz” many times but today forgot and typed the more intuitive “bundle install xyz.” I realized my error as soon as I hit “Enter,” but it was too late.

I noticed the strange “success” message:

Your bundle is complete! It was installed into ./spoon

The path argument to bundle install is deprecated. It will be removed in version 1.1. Please use bundle install --path spoon instead.

So, “install spoon” does not install the package “spoon” but, instead, creates a “spoon” directory and re-installs all your packages there.

I figured I would just delete the “spoon” directory and run “bundle update.” But nothing worked.

A quick Google search revealed that Bundler didn’t just create the “spoon” directory but also made it the new default location for all my packages. Reversing the damage was easy. But this demonstrates the importance of naming objects and methods intelligently.

Naming methods to match users' intuition is very important, esp. if you’re creating an API thousands of programmers will use. If you’re going to make your package-installing software’s “install” command do something totally different than install a package, you shouldn’t assume the first parameter passed to “install” represents a new directory name the user wants to use as a non-standard package repository.

The Bundler folks eventually figured this out and will soon require “—path” between “bundle install” and the new directory name. But they should have avoided this confusion when they initially coded “bundle install” and “bundle update.”

Posted by James on Jun 17, 2011

Thank you, Dr. Kevorkian

Both my grandmothers lived wonderfully rich lives into their late nineties. But one of them suffered horribly her last year or two, to the point that she pleaded with me repeatedly that she just wanted to die, as if I could somehow make that happen. She had lost hope and knew only pain. I felt absolutely horrible because I could do nothing except try to comfort her and remind her of the wonderful life she had led.

Given my grandmother’s politics and religion, I’m certain she — for her entire adult life — despised Dr. Kevorkian and everything he stood for. I’m pretty sure I once heard her say so, making a dirty face while spitting out his name.

But your perspective on assisted suicide broadens when you’re the one in terminal agony. I only wish Dr. Kevorkian could have been by my side when my grandmother begged me, over and over, to die.

When we learned of her passing, we were all relieved. I still miss my grandmother terribly and choked up horribly this week at a wake telling a friend it was good his 85-year-old mother had not suffered because memories of my grandmother flooded back. My grandmother’s pain haunts me.

Someone living in constant pain with no hope of improvement should be entitled to choose to end their life with dignity on their own terms at a time of their choosing. I wish I could have given my grandmother that basic human right.

Posted by James on Jun 03, 2011

The (near) future of education

I discovered KhanAcademy.org about a year ago and have subsequently mentioned Khan and his website to every educator I know. Last month, I emailed a link to this BusinessWeek article with a message:

Empowering kids to control their learning really motivates and enables them to learn much faster. One principal at a school where kids are learning from free KhanAcademy videos and learning tools says “Students are working at a level of mathematics that I have never seen in an elementary school before, maybe not even in a junior high school.” One 5th grader in the article is already doing differentiation using the chain rule!

Khan Academy is hardly the only organization building powerful adaptive learning programs. Other successful innovators in this emerging field — now beginning to revolutionize learning — include Carnegie-Mellon’s Open Learning Initiative, Grockit, and Knewton.

I mention Sal Khan, founder and “faculty” of KhanAcademy.org, here not because he has produced more than 2,100 free video lectures and math learning tools for K-12 (though that’s extremely cool).

I mention him because I’ve spent the day watching videos of Khan discussing Khan Academy, and he really maps out a compelling vision of what tomorrow’s classrooms will look like. Struggling students discovered Khan Academy (and commercial sites like Grockit and Knewton) long ago. What’s exciting is how these new tools promise to reshape learning inside and outside of classrooms. Smart teachers have begun leveraging Khan’s lectures to flip the teaching model from class lectures and homework to home video lectures and working problems in class (where students can receive immediate feedback and help). Khan Academy gives each teacher a dashboard to view each student’s progress at a macro level and drill down to exact question responses and time spent watching each video. It awards students badges for completing tasks. It even flags students who seem to be struggling with a particular module and recommends certain other classmates who could help teach their struggling peers.

I can’t boil down Khan’s insights (and humor) in a short blog post, but he has posted many excellent videos describing Khan Academy and his views on the future of education. If you care about optimizing education, you’ll want to watch. A good place to start is this 20-minute TED talk. I also especially enjoyed and watched twice this 83-minute MIT Club of Northern California talk.

Posted by James on Jun 02, 2011

Top climate "scientist" bought and paid for by oil & coal companies

The Guardian reports

One of the world’s most prominent scientific figures to be sceptical about climate change has admitted to being paid more than $1m in the past decade by major US oil and coal companies.

Dr Willie Soon, an astrophysicist at the Solar, Stellar and Planetary Sciences Division of the Harvard-Smithsonian Centre for Astrophysics, is known for his view that global warming and the melting of the arctic sea ice is caused by solar variation rather than human-caused CO2 emissions, and that polar bears are not primarily threatened by climate change.

But according to a Greenpeace US investigation, he has been heavily funded by coal and oil industry interests since 2001, receiving money from ExxonMobil, the American Petroleum Insitute and Koch Industries along with Southern, one of the world’s largest coal-burning utility companies. Since 2002, it is alleged, every new grant he has received has been from either oil or coal interests.

In addition, freedom of information documents suggest that Soon corresponded in 2003 with other prominent climate sceptics to try to weaken a major assessment of global warming being conducted by the UN’s leading climate science body, the Nobel prize-winning Intergovernmental Panel on Climate Change.

…In 2003 Soon said at a US senate hearing that he had “not knowingly been hired by, nor employed by, nor received grants from any organisation that had taken advocacy positions with respect to the Kyoto protocol or the UN Framework Convention on Climate Change.”

Posted by James on Jun 29, 2011

Why I'm shockingly apathetic about tonight's Bruins Stanley Cup Game 7

Growing up in the wonderful Boston suburb of Wayland, I was a rabid Red Sox, Patriots, Celtics and Bruins fan. I enjoyed more than my share of Celtics World Championships, thanks to Bird, McHale, Parish, DJ, Ainge, Walton and friends. Watching the Patriots win multiple Super Bowls was an over-the-rainbow high… a feeling I long thought I would never experience, after cheering for the Patriots throughout the 80s and 90s. The Sox choking away — to a lame Mets team, no less — a World Series they were one strike away from winning was devastating, so watching them win several World Series a decade later was cathartic.

So I must be thrilled the Bruins — the only Boston team never to win a championship since I was a wee boy too young to remember — could win the Stanley Cup tonight, eh?

Not really. Before I explain, a digression…

I love college hockey. In fact, I managed to snag one of only 500 tickets allotted to Harvard for the “Frozen Four” (held in Minneapolis) the year the Crimson won the NCAA Championship 4-3 in sudden death overtime against the Minnesota Golden Gophers. Almost everyone else in the Harvard section was a hockey player parent, band member, or wealthy athletic donor/alum.

College hockey is about crisp passing, fast skating, body control, solid defending, quality goal-tending, accurate shooting, etc.

Pro hockey, on the other hand, has long been about gladiatorial combat. I grew so sick of the fighting that I swore off pro hockey perhaps fifteen years ago. It may be less violent now. I wouldn’t know. But several “highlights” I’ve seen from the Bruins' playoff run have left me sick to my stomach. I’ve seen plenty of what appear to me to be cheap shots of Bruins players by Canucks players. And Bruins players have been involved in several plays that severely injured opponents.

After learning that Canucks player Mason Raymond fractured vertebrae early in Game 6, I was set to declare myself too disgusted to watch tonight’s decisive game. But I decided to first seek out an unbiased assessment of the injury (which I have not seen). Veteran NHL ref Kerry Fraser gave this analysis of the play, concluding that the Bruin player — who was not penalized on the play — deserved a minor penalty but that the severe injury was basically a fluke and not the Bruin player’s fault.

So, I’ll likely catch part of the game and cheer for my hometown team. But I’m scarcely excited. I wish they would rid NHL hockey of its gratuitous violence so fans could enjoy the natural beauty of the game, not cringe as players attempt to injure one another. It’s hockey, not Rollerball.

Posted by James on Jun 15, 2011

Why I use Linux (reason #457)

I intensely dislike proprietary, closed-source operating systems. Over the past three years, I’ve fired up my old Windows laptop exactly three times: once a year at tax time. And, as much as I admire Apple laptops, I wouldn’t consider buying one because I love Linux too much.

Why do I distrust Apple? Here’s an example:

Apple is famous for going to absurd lengths to enforce its patents and trademarks. It recently sued Amazon for calling its app store Appstore. And it has publicly lectured competitors to “create their own original technology, not steal ours.”

But the company isn’t always as fastidious about respecting the ideas of others. Consider the case of UK-based developer Greg Hughes. Last year, his app for wirelessly syncing iPhones with iTunes libraries was unceremoniously rejected from the official App Store. The software developer took the denial in stride, submitting Wi-Fi Sync to the Cydia store for jailbroken iPhones, where the app is a top seller.

Fast forward to Monday, when Apple unveiled a set of new features for the upcoming iOS 5, including the same wireless-syncing functionality. Cupertino wasn’t even subtle about the appropriation, using the precise name and a near-identical logo to market the technology.

The logo is a total rip-off. It’s sickening enough Apple killed the guy’s software — which would have made him a fortune because he earned close to $500,000 just from jailbroken iPhones — and then built the same thing themselves. But to then copy the guy’s logo too! They might as well have issued a press release saying, “Yeah, we’re a monopolist and we’ll blatantly steal from our developer community to maximize our profit. What are you going to do about it? Ha, ha!”

Posted by James on Jun 12, 2011