Tuesday, May 27, 2008

Converting The US To Electric Vehicles: Priceless

A non-scientific, but clearly well thought-out back-of-envelope calculation by MIT CS professor Philip Greenspun is food for thought: the cost of replacing the entire fleet of U.S. passenger cars with electric ones would be zero.

Here are some of his numbers:

* total spent per year: $1 trillion
* percentage of oil consumed by passenger cars: 40
* total spent per year on oil for passenger cars: $400 billion [refining into gasoline, distributing, and retailing add even more to this]
* at 5 interest, how much we could we borrow and pay $400 billion every year in interest: $8 trillion
* number of registered cars in the U.S.: 250 million (Wikipedia)
* cost of a new electric car, if mass-produced: $20,000
* value of a used car, if exported to Latin America or China: $5,000
* cost to upgrade average existing American car to a brand-new electric car: $15,000
* number that could be converted for $8 trillion: more than 500 million cars (i.e., twice as many as we have now)

And then here is the money quote:

Instead of sending $400 billion each year to countries such as Saudi Arabia and Venezuela, we could spend it on electric car production in the U.S., Mexico, and China. At current oil prices, it wouldn’t cost us a dime extra to stop importing and burning oil for passenger cars. In fact, if the goal were to end up with the same number of cars on the road, we would have a few trillion dollars left over. One or two trillion dollars would be sufficient to build nuclear, solar, or wind electric power plants to replace all of our plants that currently burn coal and oil (note that less than 1 percent of current electricity generation in the U.S. is from oil).

Now THAT is what I talking about! Let's get on it people... and let's do better than just paying interest only on the bill while we are at it.

Zero Is Special

I just read a fascinating academic paper co-authored by Dan Ariely, author of new book Predicably Irrational, a book I have heard about, but have not yet read.

The paper presents results from a series of experiments into the nature of free pricing. Here is a juicy tidbit from the abstract:

When faced with a choice of selecting one of several available products (or possibly buying nothing), according to standard theoretical perspectives, people will choose the option with the highest cost–benefit difference. However, we propose that decisions about free (zero price) products differ, in that people do not simply subtract costs from benefits but instead they perceive the benefits associated with free products as higher.

Yes, you read that correctly: people can consider something free as more valuable than something that costs money. The authors describe several interesting experiments using chocolate that appear to well prove their point.

Bottom line, so to speak: I need to get this book and read it as soon as I can! Even if it does cost money... actually here are some free excerpts.

RailsConf 2008 Better Be Good

RailsConf 2008 is later this week, as if you all did not know that. Interestingly, this year it has not sold out like it did for 1.0 and 2.0. Increased capacity by O'Reilly? Or perhaps something else at work here...

If you are not aware for the cost of transport, you have been living on another planet. Just the massive increase in time required to make the pilgrimage has been substantial. Many of us have been working at home or within other time-flexible, location-unimportant arrangements for some time now. But we still gathered together unhesitatingly no matter the distance.

Two recent blog postings stood out to me. The first, from Seth Godin said it nicely:

If oil is $130 a barrel and if security adds two or three hours to a trip and if people are doing more and more business with those far afield...

and if we need to bring together more people from more places when we get together...

and if the alternatives, like video conferencing or threaded online conversations continue to get better and better, then...

I think the standard for a great meeting or a terrific conference has changed.

In other words, "I flew all the way here for this?" is going to be far more common than it used to be.

The second was simply an link from from Rails community spokesmodel Obie Fernandez to an article in the Washington Post:

But the truth is that no combination of solar, wind and nuclear power, ethanol, biodiesel, tar sands and used French-fry oil will allow us to power Wal-Mart, Disney World and the interstate highway system -- or even a fraction of these things -- in the future. We have to make other arrangements.

The public, and especially the mainstream media, misunderstands the "peak oil" story. It's not about running out of oil. It's about the instabilities that will shake the complex systems of daily life as soon as the global demand for oil exceeds the global supply.

Already, I was a little bummed out about not being able to eat a delicious Pacific salmon dinner this year. But these two postings really got me to thinking. It would be easy to expect the conference organizers to do all the work. But it is really up to us as attendees to put our hearts into it. Whether it be code drives, or Werewolf sessions, that does not really matter to me personally, although I will be attending the former.

So, all I can say is, this better be good people. We better go up there and really make this thing count, to justify the time, expense, and environmental impact. The times they are a changing, and we need to do something special.

As for me, I will be taking public transport to and from the conference... which is not easy to achieve from down here in L.A.

Sunday, May 25, 2008

The Phoenix Has Landed

Earthlings, we have successfully landed another probe on the red planet. Congratulations to the team at JPL, University of Arizona, and everyone else who made this one happen!

Man, I just love space exploration...

Thursday, May 22, 2008

Got An Eye On You

Read this piece from Rolling Stone magazine on 24-7 surveillance coming soon to a neighborhood near you.

Then be afraid. Very afraid.

Monday, May 19, 2008

In Search Of Search

My client was having troubles. The site was crashing, seemingly at random. QA was baffled, management concerned. After hunting thru logs, the culprit was found: the ferret search service.

Despite having configured acts_as_ferret to use the DRb server option, the "whole thing" would fall apart on a regular basis whenever the ferret daemon would crash... which was pretty often. The ruby on rails plugin acts_as_ferret would revert to a local mode of operation, which would only make matters worse when competing mongrels would corrupt the index files on disk.

Much has been written already about this by more famous Rubyists then myself, so the time had come to make the switch to Sphinx like all the rest of the cool kids. However, there were a few tricky issues that awaited.

One is that the client site was using PostgreSQL instead of the more common MySQL. This meant you had to have already downloaded the pgsql client libs, and also when compiling the sphinx server use the --with-pgsql flag. However, what they didn't mention was that you would need to also download and include the MySQL client libs AS WELL, even if you were not using MySQL. Good to know... seems like a big of baggage to carry, but whatever.

That was one obstacle avoided. The next would prove to be more subtle and complex. There are four different choices of Ruby on Rails clients for Sphinx:

I looked briefly at acts_as_sphinx, but my superficial prejudices against anything named "acts_as_" caused me to continue my search for search. Next, I tried Sphincter, just to prove that I could be accepting about project names. However, I was not successful as getting it working correctly, and project development seemed like it had slowed to near non-existence. The search moved on.

My search was getting desperate as half of the options had been eliminated. I briefly perused UltraSphinx and I started to get a little excited. Development was active, and proper functionality with Postgres was claimed. But there was just one little problem: this client's site is still Rails 1.2.x.

Now, before you all start throwing various disparaging comments my way, consider how much work some clients are willing to pay far vs. something that they can actually see. Multiply that by how long since they started their project, and you are starting to get the idea of where this thing is at. I probably should have MADE them upgrade at that point, but I'm just not that kind of guy.

So that left Thinking Sphinx. I dove in with the manic desperation of someone looking to avoid major amounts of work. That rarely works out well, but in this case it wasn't so bad. The latest trunk of thinking sphinx had comments that said "basic postgres functionality" so perhaps it was possible after all.

Several hours and some major hacking of the original plug-in to actually handle proper psql syntax later, and something was working! I will try to come up with patch to thinking-sphinx for freelancing-god, cause his work was a great help.

Lastly, the delta index. By adding a single field (boolean for MySQL, integer for Postgres) you can remove the need to reindex all data every time a record is updated. Sphinx allows storing the changed records in a separate index (delta) that it will search along with the main index. This way, you do not have to wait for reindexing to be able to search, but you also do not have to reindex the entire data set every time any data within it is changed. You still need to do a complete reindex, but that can occur at off-peak hours, instead of constantly.

The code was deployed, and now all was well with the world. My search was complete.

Tuesday, May 13, 2008

Ain't No Stopping Us Now

According to a recent eWeek article, there will be four times more Ruby programmers within five years. Before all the haters start making cracks about it going from one thousand to four thousand professional Rubyists, here is a juicy bit from Mark Driver, Gartner analyst:

"There are under one million professional Ruby developers now and we're projecting there will be four million plus by 2013."

And oh yeah, what about that whole "Ruby is for hobbyists" misinformation campaign? Officially debunked by Gartner:

Driver later told eWEEK that Gartner's research shows "strong interest" in Ruby and that the percentage of developers that will be creating commercial systems versus those that are hobbyists will be even greater for Ruby than for other languages. "Ruby will be more interesting to commercial developers"

Just imagine the power of one million people out there, right now. Developing, sharing, recruiting others... to use their favorite programming language! What did you think I was talking about, politics?

Friday, May 02, 2008