“An underlying problem with artificial intelligence that I have personally experience in my forty years in this area is that as soon as an AI technique works, it’s no longer considered AI and is spun off as its own field (for example, character recognition, speech recognition, machine vision, robotics, data mining, medical informatics, automated investing.)”—Ray Kurzweil
“There are two ways of constructing a software design: One way is to make it so simple that there are obviously no deficiencies, and the other way is to make it so complicated that there are no obvious deficiencies. The first method is far more difficult.”—Tony Hoare
“A human being should be able to change a diaper, plan an invasion, butcher a hog, conn a ship, design a building, write a sonnet, balance accounts, build a wall, set a bone, comfort the dying, take orders, give orders, cooperate, act alone, solve equations, analyze a new problem, pitch manure, program a computer, cook a tasty meal, fight efficiently, die gallantly. Specialization is for insects.”—Robert A. Heinlein
“I didn’t really expect anyone to use it because it’s so hard to use, but that turns out to be its big appeal. No technology can ever be too arcane or complicated for the black t-shirt crowd.”—Linus Torvalds on Git
“We believe it is better to have application programmers deal with performance problems due to overuse of transactions as bottlenecks arise, rather than always coding around the lack of transactions.”—Several Google authors in the Spanner: Google’s Globally-Distributed Database paper (PDF link)
/usr/lib/ruby/gems/1.8/gems/fpm-0.4.17/lib/fpm/../../templates/rpm.erb:68:in `output': undefined method `shellescape' for Shellwords:Module (NoMethodError)
from (eval):3:in `each_without_optional_block'
from (eval):3:in `each'
from /usr/lib/ruby/gems/1.8/gems/fpm-0.4.17/lib/fpm/../../templates/rpm.erb:67:in `output'
from /usr/lib/ruby/gems/1.8/gems/fpm-0.4.17/lib/fpm/package/rpm.rb:189:in `output'
from /usr/lib/ruby/gems/1.8/gems/fpm-0.4.17/lib/fpm/command.rb:368:in `execute'
from /usr/lib/ruby/gems/1.8/gems/clamp-0.3.1/lib/clamp/command.rb:64:in `run'
from /usr/lib/ruby/gems/1.8/gems/clamp-0.3.1/lib/clamp/command.rb:126:in `run'
from /usr/bin/fpm:19:in `load'
So after some Googling, I found that I needed to monkeypatchShellwords.shellescape. I’d heard about monkeypatching in Ruby before and even had an idea of how to do it if I were developing an application myself, but in this case, I need fpm to use this monkey patch.
With my limited Ruby knowledge, the crude solution was to patch /usr/lib/ruby/1.8/shellescape.rb itself:
--- shellwords.rb.orig 2012-09-21 18:56:38.000000000 -0300
+++ shellwords.rb 2012-09-21 18:56:50.000000000 -0300
@@ -56,5 +56,31 @@
+ def shellescape(str)
+ str = str.to_s
+ # An empty argument will be skipped, so return empty quotes.
+ return "''" if str.empty?
+ str = str.dup
+ # Treat multibyte characters as is. It is caller's responsibility
+ # to encode the string in the right encoding for the shell
+ # environment.
+ str.gsub!(/([^A-Za-z0-9_\-.,:\/@\n])/, "\\\\\\1")
+ # A LF cannot be escaped with a backslash because a backslash + LF
+ # combo is regarded as line continuation and simply ignored.
+ str.gsub!(/\n/, "'\n'")
+ return str
+ module_function :shellescape
+ class << self
+ alias escape shellescape
“- Avoid overengineering datastructures. Tuples are better than objects (try namedtuple too though). Prefer simple fields over getter/setter functions.
- Built-in datatypes are your friends. Use more numbers, strings, tuples, lists, sets, dicts. Also check out the collections library, esp. deque.
- Be suspicious of function/method calls; creating a stack frame is expensive.
- Are you sure it’s too slow? Profile before optimizing!
- The universal speed-up is rewriting small bits of code in C. Do this only when all else fails.”—Guido van Rossum, Some patterns for fast Python
“I think less code should be written in C/C++ than actually is – the safety problems of pointers/array overruns and explicit memory management are much worse than the performance benefits for most applications.”—John Carmack, father of Wolfenstein 3D, Doom, Quake, among others
I have OS X set to use English language but Brazilian formats, which confuses R:
During startup - Warning messages: 1: Setting LC_CTYPE failed, using "C" 2: Setting LC_COLLATE failed, using "C" 3: Setting LC_TIME failed, using "C" 4: Setting LC_MESSAGES failed, using "C" 5: Setting LC_PAPER failed, using "C" [R.app GUI 1.42 (5933) i386-apple-darwin9.8.0] WARNING: You're using a non-UTF8 locale, therefore only ASCII characters will work. Please read R for Mac OS X FAQ (see Help) section 9 and adjust your system preferences accordingly.
Found this great mnemonic for the main causes of data loss:
Dud, Flood, & Bud.
Duds are hardware that goes bad, like a disk drive, network adapter, NAS, or server. There are an infinite number of ways and combinations things can break in a moderate sized IT shop. How much money / effort are you willing to spend to make sure your weekend isn’t ruined by a failed drive?
Floods are catastrophic events, not limited to acts of God. Your datacenter goes bankrupt and drops offline, not letting you access your servers. Fire sprinklers go off in your server room. Do you have a recent copy of your data somewhere else?
Bud is an accident-prone user. He accidentally deleted some files… the accounting files… three weeks ago. Or he downloaded a virus which has slowly been corrupting files on the fileserver. Or Bud’s a sysadmin who ran a script meant for the dev server on the production database. How can we get that data back in place quickly before the yelling and firing begins?
There are more possible scenarios (hackers, thieves, auditors, the FBI), but if you’re thinking about Dud, Flood, & Bud, you’re in better shape than most people are.