Chuck Lorre Vanity Cards

Posted at 10:48 PM on July 23, 2010

Chuck Lorre maker of “Dharma and Greg” and “The Big Bang Theory” managed to sneak a series of subliminal vanity cards into his sitcoms.

After reading a number of these, I’m convinced that Lorre is an artist of the highest order forced to slum in the sitcom ghetto for his day job. His hidden vanity cards reveal the few scant frames of flickering truth shone through the Devil’s dream box each week.

My favorite so far is this…

I believe that the very act of believing in something causes us to distance ourselves from that thing, thus a duality is created: oneself and the thing in which one believes. Now since we all know that in order to fully understand a thing one must be that thing — walk a mile in its shoes so to speak — it seems obvious that the state of believing in something inevitably causes us to not truly understand that thing in which we believe. This noncomprehension leads to all sorts of difficulties. “I believe in love” has a better than even chance of leading to divorce, while “I believe in God” seems to end in variations on the Spanish Inquisition. But — and it’s a big but — if one were love, one couldn’t help but be affectionate and caring towards oneself and others. If one were God, one would act toward all beings and all things as if they were one’s own creations. And that, my friends, is the secret of life in a two-second vanity card. Of course, the secret could also be “Sit, Ubu, sit.” We have to keep an open mind.

Adobe Photoshop CS5 Write Perimissions Error on Snow Leopard

Posted at 2:33 PM on June 13, 2010

My upgrade to Adobe Photoshop CS5 on OS X 10.6 (Snow Leopard, 10.6.3) has been a complete shambles. Any operation involving writing to the temporary disk like “Save for Web & Devices” would only result in an error dialog reading “The operation could not be completed: A write permissions error has occurred”.

Also, on exit, CS5 would reliably crash with the error: “Could not save Preferences because the file is locked or you do not have the necessary access privileges”.

Fortunately, I’m not the only early adopter suffering from this problem. The issue appears to be that Adobe’s DMG installer incorrectly sets some permissions under ~/Library/Preferences.

What cleared up this issue was executing the following command ( in Applications -> Utilities -> Terminal ).

sudo chmod -R u+w ~/Library/Preferences

These are the specific directories that were errantly set to read-only after my CS5 install.

~/Library/Preferences/Adobe/Extension Manager\ CS5
~/Library/Preferences/Adobe Photoshop\ CS5\ Settings
~/Library/Preferences/ExtendScript\ Toolkit

CNet has an article mentioning other directories that can sometimes be affected. So, if setting only Preferences didn’t work, you can try the following.

sudo chmod -R u+rw ~/Library/Application\ Support
sudo chmod -R u+rw ~/Library/Adobe

TextMate is an application downloaded from the Internet.

Posted at 12:11 AM on June 07, 2010

I got the dreaded “TextMate is an application downloaded from the Internet” error again after manually upgrading to the latest version on Snow Leopard.

The fix is quite simple, but rather hard to find in the first page or so of Google results. All that’s required is a single xattr.

sudo xattr -d com.apple.quarantine /Applications/TextMate.app

Facebook, Virtual Goods, and the Post-Economic Economy

Posted at 8:43 PM on June 02, 2010

Last week, my favorite financial anarchist, Max Keiser ripped apart the business model of Zynga’s Facebook virtual currency comparing it to that of his archnemesis, Goldman Sachs.

Zynga is giving away Farmville dollars as a promotion for people shopping for vegetables at supermarkets. So, if you buy a zuchini at the supermarket, you get Farmville dollars which is a virtual currency which you can then use in Farmville on Facebook to grow virtual vegetables. Those vegetables trade on the Zynga virtual cash exchange for hard US Dollars. That’s a naked long.

So, the spread between naked short sales and naked long sales is enormous. A naked short sale of a credit derivative makes Goldman Sachs billions where a naked long sale of a virtual vegetable on Farmville makes somebody two dollars. The naked credit default swap is worth about the two dollars it takes to print nonsense on a piece of paper. The naked long virtual Farmville currency is worth two dollars in hard money after you spent 20 hours viewing ads on Facebook. So, why are the naked long people making $2 for twenty hours viewing ads, and the people at Goldman get two billion dollars for manufacturing credit default nonsense because they’re hooked into the US Government.

Keiser has the uncanny ability to zoom out to a macro view of the economy which reveals nothing more than a bunch of unevolved apes playing petty power games amongst ourselves. However, he makes a good point in that we are tending to stray away from our meritocratic roots in favor of a system based on cronyism, nepotism and outright fraud through naked short selling.

On the other side of the blogosphere, David Harvey has spent years promoting the idea that the capitalist system has mainly become concerned with creating money out of money. Keiser’s views on the Facebook/Zynga virtual economy fits in with Harvey’s theory. Essentially, these fictional markets are really just imaginary stopgaps so we can all pretend that we’re achieving the 3% growth per year to keep the wheels from falling off the status quo.

Keiser calls these fictional markets a zombie economy. Whether you’re an individual trading virtual goods over the Internet or an investment bank selling derivatives of derivatives of insurance on derivatives, you are participating in a fictional market where what’s being bought and sold has no actual value. The virtual goods are just as worthless as the mortgages written and sold to finance now empty houses built in Detroit during the housing boom. While online virtual markets are more benign ecologically than zombie housing, both are socially and economically useless and attempts at feigning wealth.

In the 1500′s, the Spanish learned this lesson the hard way. They conquered parts of the New World and imported tons of gold from their adventures. The biggest tangible result of this effort was that people in Spain owned more physical gold which caused 300% inflation. The general thinking is, if economic advancement isn’t backed by real innovation and improvements to the society at large, all you’re really doing is pretending to be wealthy.

Ultimately, creating virtual currencies and goods, fictional markets and zombie economies are equivalent to expropriating gold from tribal nations, printing dollars, or betting against credit default swaps. These are all misguided attempts by poorly evolved mammals at being acquisitive and maintaining power. If things proceed as they are, we will continue moving away from production, thrift, and savings towards a post-economic economy where all goods and money are virtual and nothing real is really worth owning.

Pulga Bridge HDR

Posted at 3:07 AM on May 24, 2010


CA-70, Pulga, CA

Deer Creek Falls HDR

Posted at 10:13 AM on May 18, 2010


Near Chester, California

Using FORCE INDEX with Rails

Posted at 9:16 PM on April 04, 2010

Avoiding a full table scan when performing a MySQL query with both an ORDER and a WHERE clause is more difficult than you would think. This is especially true if you’re only selecting a subset of the table from a foreign key.

First off, you must add a compound index with the order column first. If the index is constructed with the column used to order the table last, the index will not work as expected.

add_index :posts [:created_at, :blog_id]

Next, you have to specify the index in the ActiveRecord call with USE INDEX or FORCE INDEX or else MySQL will not use it by default.

named_scope :ordered, {
            :from => 'events FORCE INDEX (index_posts_on_created_at_and_blog_id)',
            :order => 'created_at DESC' }

The Rails add_index method names the MySQL index as index_table_name_on_column_1_at_and_column_2 by default. If you want to list the indexes available for your database, you can perform the query: SHOW INDEXES to investigate.

It’s possible to test the index by copying the MySQL queries from your Rails log and prefixing them with EXPLAIN or EXPLAIN EXTENDED. Using either of these will display the number of rows searched for each query. If your query is scanning more rows than you’ve selected, that is a clear sign that the index your using is either not being used or incorrect.

Rails Join Query For Empty Right Tables

Posted at 7:38 PM on February 04, 2010

Say you wanted to select all the accounts from your applications with no associated users. You’d think this would be obvious, however I racked my brain for a few minutes thinking of a Rails-way of sorting this out.

The good news is with Rails 2.2 or later, it can be accomplished like this thanks to join hashes.

Company.find(:all, :include => :users,
             :conditions => { :users => { :id => nil } })

Before Rails 2.2, you would have had to resort to the following.

Company.find(:all, :include => :users,
             :conditions => "users.id IS NULL")

Transamerica Building Panorama

Posted at 11:35 PM on November 20, 2009


First attempt using a Canon EOS 7D.

Interactive Memcached Debugging with Rails

Posted at 6:17 PM on June 20, 2009

The memcached support in Rails is great, but it’s a bit difficult to see what the heck is going on in a production environment. The first problem is, by default Rails doesn’t keep a list of all memcached keys that are available on the system. So, you have to use a plugin like memcache_store_with_delete_matched to have memcache itself store a list of all available keys.

You can install this plugin with the typical script/plugin command.

script/plugin install git://github.com/lacomartincik/memcache-store-with-delete_matched.git

Then, you configure memcached in your environment.rb like this.

mem_cache_options = {
    :c_threshold => 10000,
    :compression => true,
    :debug => false,
    :timeout => false,
    :namespace => 'app',
    :readonly => false,
    :urlencode => false
  }
  config.action_controller.cache_store = :mem_cache_store_with_delete_matched, ['127.0.0.1:11211'], mem_cache_options

The other benefit to using memcache_store_with_delete_matched is that regular expressions within expire_fragment works.

expire_fragment(%r!/index_user_.*!)

So, down to debugging. If you want to see all keys in a script/console, you can do the following.

YAML.load(ActionController::Base.cache_store.fetch("memcached_store_key_list"))

You can select certain keys from the memcached_store_keylist.

YAML.load(ActionController::Base.cache_store.fetch("memcached_store_key_list")) .detect{ |k| k.match(/index/) }

Once you have the list of keys, you can plug them into a fetch command.

ActionController::Base.cache_store.fetch("app/blog/index")

You can also manually expire keys from a console.

c = ApplicationController.new
c.expire_fragment(/index/)