Obsession with perfection

My little doodle in the morning. An observation on what’s common in any organization. Even when we knew there is a problem, still, any proposed solution would need to be perfect, or we would rather stick with the broken path. But perfect is the enemy of good, planning forever for that perfect solution might lead us to nowhere at all.

Carrierwave mini magick error

Been using paperclip mainly for file attachment in rails application. When there is a need to add in file uploading feature for a small apps in the company, I decided to give carrierwave a spin, just for the sake of trying out a different gem.

I mainly refer to carrierwave github site and tutsplus tutorial  for installation and setup, which is pretty straightforward to be frank.

However, when I tried to upload image thru the application, an error message saying “translation missing: en.errors.messages.mini_magick_processing_error” appear.

A quick google confirm that it is quite a common problem, a few suggestions are made,

But none of these solve my problem. Suddenly it hit me that maybe ImageMagick is not working properly, I did a check by just type in magick command into the command prompt, sure enough it said magick is not a recognizable command.

As suggested by ImageMagick page , look like I need to install Visual C++ 2013 Redistributable Package  to get the file vcomp120.dll.

And viola, that did the magick trick and solve the problem J

Also, if the name of “command prompt” haven’t given enough clue, I am developing rails apps with a Windows machine. Hope this could be a useful tips for those need to make rails apps and carrierwave work in windows 😉

Writing, again

Been a good 3 years not writing anything in the blog. The easiest excuse that one could blame on is of course being busy, but distraction from various social networks is the real culprit, the false sense of achievement posting to facebook and the subsequent likes earned from the post somehow fulfilled the urge to create something more meaningful than just posting food, baby, or travel photo.

So I want to get back to the habit of writing more often, that I use writing to crystallize my thinking, that I appreciate a fruitful discussion more than just another mindless likes.

This mark the beginning for me to write more often this year.

The Inner Working of a subscription box service

The Inner Working of a subscription box service. Gems everywhere. Almost couldn’t refrain to copy and paste everything here

About competition: “the market is oversaturated”, but you often find it is saturated with a LOT of bad players, and they’re making a LOT of money despite being so bad.** This is the perfect situation.

About Idea: Ideas hold little intrinsic value without execution. However, you can start to extract value when you get feedback on it, massaging it, push and poke it, and really run it through the wringer.
About passion: Quite often the least sexy industries are where the big money is being made. So while most of the brainpower is busy chasing sexy mobile apps and such, you can make bank by selling ugly widgets or providing basic services.
About starting small: You don’t get good at running marathons by reading about running marathons. And you don’t get good at business by reading about business. You get good by doing. And doing it over and over again. But just like you wouldn’t expect to win the first marathon you entered, why put so much pressure on yourself to win at the first company you start? Or worse yet, paralyze yourself with fear into never running at all because you’re afraid you won’t win?

The best of all, “At some point we have to just say ‘Fuck It’ and get to work!

Why should a person buy a computer?

An excellent interview with Steve Jobs by Playboy.
“Why should a person buy a computer?” the interviewer asks.

Remember, it is 1985. Computer is not as common and not as advanced as today. Normal human reaction toward changes is to resist, hence we fall back to what we know best, what we have been doing all along.

Whenever a new technology shows up, we quickly proclaim, “Who would want that? Who would buy that?”
“I can balance my checkbook faster by hand than on my computer. Why should a person buy a computer?”
We often overlook two things. Technology will improve and human will adapt, eventually they meet halfway. What perceived as totally unnecessary can become a necessity. Before the creation of mobile phone, we have no problem tolerate with waiting for someone on a street without the mean to check if that person is stuck in a traffic jam or just around the corner. Heck, we don’t even feel the need to tolerate; we simply don’t know there are other ways around.
Now, in hindsight, it felt comical that Steve Jobs have to convince the interviewer why someone needs a computer; some of the arguments are eerily prophetic though.

“So far, that’s more of a conceptual market than a real market. The primary reasons to buy a computer for your home now are that you want to do some business work at home or you want to run educational software for yourself or your children. If you can’t justify buying a computer for one of those two reasons, the only other possible reason is that you just want to be computer literate. You know there’s something going on, you don’t exactly know what it is, so you want to learn. This will change: Computers will be essential in most homes.”

“The most compelling reason for most people to buy a computer for the home will be to link it into a nationwide communications network. We’re just in the beginning stages of what will be a truly remarkable breakthrough for most people—as remarkable as the telephone.”

“A hundred years ago, if somebody had asked Alexander Graham Bell, “What are you going to be able to do with a telephone?” he wouldn’t have been able to tell him the ways the telephone would affect the world. He didn’t know that people would use the telephone to call up and find out what movies were playing that night or to order some groceries or call a relative on the other side of the globe. ”

I really like the invention of telephone as an example. Sometime even the inventor wouldn’t be able to tell us how his invention will change the world, how people will use it eventually, but just a sense that something very big is going to happen with it.

“I can balance my checkbook faster by hand than on my computer. Why should a person buy a computer?” You can replace “balance checkbook” and “computer”, and you get all the hysterical reaction towards any new tech/gadget/tools nowadays. We are too eager judging something new with our mind that already been clouded by the current state of how we do thing, and we forgot to just allow the new technology to ferment, to evolved, to let everyone get over the inertia and embrace it.

Jekyll on Windows

There are already guide out there to get Jekyll installed on Windows machine.

I have problem to start it after installation though, a long list of errors follow,

D:\ruby_projects\olla\jekyll serve
Configuration file: D:/ruby_projects/olla/_config.yml
Source: D:/ruby_projects/olla
Destination: D:/ruby_projects/olla/_site
Generating... Liquid Exception: cannot load such file -- yajl/2.0/yajl in _posts/2013-10-22-welcome-to-jekyll.markdown

And of course, solution is out there as well https://github.com/brianmario/yajl-ruby/issues/116, make sure to read till the very end of the thread. Pre-compiled gem is not Ruby 2.0 compatible, if there is already x86-mingw32 version of yajl installed, make sure to uninstall it then follow these steps

D:\ruby_projects\olla>gem install yajl-ruby --platform=ruby      
Fetching: yajl-ruby-1.1.0.gem (100%)                             
Temporarily enhancing PATH to include DevKit...                  
Building native extensions.  This could take a while...          
Successfully installed yajl-ruby-1.1.0                           
Parsing documentation for yajl-ruby-1.1.0                        
Installing ri documentation for yajl-ruby-1.1.0                  
Done installing documentation for yajl-ruby after 2 seconds      
1 gem installed

If one decided to do development works in a windows machine, by faith you have to jumped over lot of hoops to make thing happen. Latest pygments gem just refuse to work

D:\ruby_projects\olla\jekyll serve                                                                                                 
Configuration file: D:/ruby_projects/olla/_config.yml                                                                              
            Source: D:/ruby_projects/olla                                                                                          
       Destination: D:/ruby_projects/olla/_site                                                                                    
      Generating... C:/RailsInstaller/Ruby2.0.0/lib/ruby/gems/2.0.0/gems/posix-spawn-0.3.6/lib/posix/spawn.rb:162: warning: cannot 
  Liquid Exception: No such file or directory - /bin/sh in _posts/2013-10-22-welcome-to-jekyll.markdown

A little search show the solution in StackOverflow, just uninstall the latest pygments gem, and install version 0.5.0 as suggested. Tada, you can jekyll serve and point to localhost:4000 finally.

Now compare all those steps with this one
jekyll_quick_start

Can’t help but feel like developing in Windows environment waaaay more fascinating. Ha.

Testing in Sublime

Following railstutorial again, to strengthen my rails basic and pick up new shiny things in rails 4.

Getting sublime to run test directly is quite awesome, I mean you just need to highlight part of the test you wish to run, cmd + shift + R, boom you got your test result, all without needing to leave the comfort of sublime. Sweet.

On the next day though, suddenly it refuse to run, complaining

/bin/sh: rspec: command not found

Stackoverflow answer here go for this one. But a simpler solution below work for me, just go to ~/.config/sublime-text-2/Packages/RubyTest/RubyTest.sublime-settings file and set configuration option “check_for_rvm” to true and you have your mojo back.

test_in_sublime

Trick that work in irb and python shell

This irb tip is from Natasha the Robot. Often we forgot to assign an expression to a variable, you could of course use up arrow to retrieve last command and then move all the way to the front, add a variable and equal sign to it, but that is a lot of troubles.

An easy way is just assign a variable to underscore, like this

text = _

Then you have your previous expression assigned to a variable called text. Magical.

What is more surprising is that just found out that this magical trick works the same in python shell! Even more magical.

Open up another terminal session at the same path

I often needs to open up multiple Terminal session on the same path, example, one to launch rails server, then another to actually working with it. There are a few tricks on the internet, but most involved writing some applescript to achieve that.

I prefer a straightforward solution hence I keep on looking, finally found this piece in the trusted stackoverflow as usual.

Just need to type

open -a Terminal "`pwd`"

Just take note that it is a backtick and not the single quote mark, then you should have another terminal session open up at the current path.

Even easier in Windows Command Prompt, just type “start” at wherever you are, another cmd windows pop up at the same directory. Wow.

Something I learn from a boring talk

Attended an information sharing session this morning.

One problem stood up. The person conducting the session is a bad presenter, not very fluent in English, and speaks with very heavy accent. Most of us are at a lost on what he tries to convey. Twenty minutes into his talk, half of the audiences already give up on trying to understand at all. Some play with their phone, some doodling on a paper, some just fall asleep.

The usual lessons learn here is presentation skill is really important. The thing strike me today is, how easily we give up even when those information is for our good. “They should present it better”, or “They should find someone with better English”, we often complain. It is not our fault that we don’t understand what he said, and we are fully entitled to turn off our attention. At the end we are the one wasting time pretending we are listening, but gain nothing at all at the end of the session.

Just as my mind about to wander around, I decided to stop it, and try, really try to figure out what he is trying to say. Looking at his slides, try to pick up the words he say, try to really pay attention. Then almost magically his words become slightly clearer, his talk becomes slightly more interesting, and instead of wasting two hours being mindless, I actually learn something from it.

If you decide to make the best out of a situation, then you can learn something from almost everyone. My thought.