<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-7396374313002634273</id><updated>2025-11-14T16:19:13.531-08:00</updated><category term="programming"/><category term="ubuntu"/><category term="linux"/><category term="rubyonrails"/><category term="management"/><category term="ruby"/><category term="web2.0"/><category term="firefox"/><category term="design"/><category term="productivity"/><category term="python"/><category term="recipe"/><category term="sysadmin"/><category term="tech"/><category term="usability"/><category term="widget"/><category term="creativity"/><category term="git"/><category term="inspiration"/><category term="mac"/><category term="psychology"/><category term="regex"/><category term="vim"/><category term=".net"/><category term="amarok"/><category term="asp.net"/><category term="bash"/><category term="business"/><category term="f1standings-uwa"/><category term="feeds"/><category term="java"/><category term="job"/><category term="learning"/><category term="security"/><category term="sgmf-uwa"/><category term="subversion"/><category term="testing"/><category term="think"/><category term="thought"/><category term="versioncontrol"/><category term="windows"/><title type='text'>Code FTW</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>60</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-3973304856613893100</id><published>2015-09-09T17:28:00.000-07:00</published><updated>2017-10-01T23:40:55.577-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="git"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="psychology"/><title type='text'>Code like you have anterograde amnesia</title><content type='html'>There is this &lt;a href=&quot;http://c2.com/cgi/wiki?CodeForTheMaintainer&quot;&gt;advice&lt;/a&gt; around about how we should write our code:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Always code as if the person who ends up maintaining your code is a violent psychopath who knows where you live.&lt;/blockquote&gt;
&amp;nbsp;I wonder if it can be written as &quot;always code as if you have anterograde amnesia&quot; instead.&lt;br /&gt;
&lt;br /&gt;
&lt;a href=&quot;https://en.wikipedia.org/wiki/Anterograde_amnesia&quot;&gt;Anterograde amnesia&lt;/a&gt; the inability to form new memories after the moment that caused the amnesia.&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Henry_Molaison&quot;&gt;H.M.&lt;/a&gt;&amp;nbsp;is the famous case that you should have encountered if you&#39;re into psychology. You can also watch movies like &lt;a href=&quot;https://en.wikipedia.org/wiki/Memento_(film)&quot;&gt;Memento&lt;/a&gt;. Or you know, from first-hand experience, that night when you drank so much you didn&#39;t remember what happened?&lt;br /&gt;
&lt;br /&gt;
In programing, the moment the amnesia sets in should the moment just before we start writing the code. It does have some truth to it because just a a month later, we&#39;ll only remember very little.&lt;br /&gt;
&lt;br /&gt;
What would you do? What would be different? It seems like the end result is the same, but while a violent psychopath doesn&#39;t give guidelines about what you should do, anterograde amnesia reminds you that you&#39;re going to forget everything and that you need to do something about it.&lt;br /&gt;
&lt;br /&gt;
How should code be written so that you&#39;ll still be able to understand it later? You have to keep your code simple, easy to understand, and if something is abnormal, it has to be documented.&lt;br /&gt;
&lt;br /&gt;
You&#39;ll keep your version control history clean, make sure your &lt;a href=&quot;https://github.com/git/git/commits?author=peff&quot;&gt;commit messages explain the change&lt;/a&gt; well, and that your &lt;a href=&quot;http://seesparkbox.com/foundry/atomic_commits_with_git&quot;&gt;commits are atomic&lt;/a&gt;. This will help tremendously when you&#39;re trying to find out the context about a line of code using git blame.&lt;br /&gt;
&lt;br /&gt;
You&#39;ll also link to references whenever you can. Did you copy a code from blog or gist or elsewhere? Paste the URL so that other programmers can look at the original source and understand what it is about.&lt;br /&gt;
&lt;br /&gt;
You&#39;ll use design patterns (when it makes sense), follow conventions, and as I wrote previously, it&#39;s pretty much just following programming best practices.&lt;br /&gt;
&lt;br /&gt;
Steve McConnell summarize it best on Code Complete:&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
The bottom line is that programmers who compensate for inherent human limitations write code that&#39;s easier for themselves and others to understand and that has fewer errors.&lt;/blockquote&gt;
One of those inherent human limitations is that we&#39;ll forget. It&#39;s a real thing that I&#39;m sure you have experienced, unless… maybe if you have&amp;nbsp;&lt;a href=&quot;https://en.wikipedia.org/wiki/Hyperthymesia&quot;&gt;hyperthymesia&lt;/a&gt;…&amp;nbsp;Well, enough psychology for today!</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/3973304856613893100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/3973304856613893100' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/3973304856613893100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/3973304856613893100'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2015/09/code-like-you-have-anterograde-amnesia.html' title='Code like you have anterograde amnesia'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-3915961290039081428</id><published>2015-01-06T10:59:00.001-08:00</published><updated>2015-01-06T12:28:53.048-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="learning"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>Learning the fundamentals</title><content type='html'>I notice that some programmers jump straight away to the more advanced concepts while still lacking the fundamental knowledge. For example, not understanding the principles object-oriented design, but readily applying design patterns everywhere.&lt;br /&gt;
&lt;br /&gt;
The trouble with this is that you don&#39;t know if the design pattern you&#39;re using is appropriate for the problem because you don&#39;t know the trade off involved with that pattern versus other patterns. And worse, some apply design patterns before even understanding what the problem is.&lt;br /&gt;
&lt;br /&gt;
Even to do object-oriented design well, you need to understand the concepts of modularization, isolation, cohesion, coupling, etc. Those basic design principles apply not only to program design, but also pretty much all complex things, like mobile phones, nuclear power plants, rockets, etc.&lt;br /&gt;
&lt;br /&gt;
When you jump to patterns immediately, it&#39;s like using a chainsaw before learning how to use a hand saw. A chainsaw is powerful and may get your work done sooner, but it is not for all situations and it is more dangerous. You need to understand the situation and learn when is a good time to use one instead of the other. If you are a beginner, it is recommended that you stick with a hand saw. Yes, it will be inefficient, but it&#39;s much better than losing limbs.&lt;br /&gt;
&lt;br /&gt;
I think this tendency to jump to advanced concepts is because the programming community tends to be filled with experienced programmers. So they talk about advanced concepts because those are the interesting things to talk about.&lt;br /&gt;
&lt;br /&gt;
This gives a distorted view of the world for beginners. They think those are the most important things. Just like you don&#39;t see racing drivers talk about how to change lane safely, you don&#39;t see experienced programmers talk about the basic stuff. They&#39;ll talk about NoSQL instead of relational database, actor model and software transactional memory&amp;nbsp;instead of inconsistent read, deadlock and starvation. It&#39;s assumed that everyone knows about the basics.&lt;br /&gt;
&lt;br /&gt;
But fundamentals are the most important thing, even for a super engineer like &lt;a href=&quot;https://www.reddit.com/r/IAmA/comments/2rgsan/i_am_elon_musk_ceocto_of_a_rocket_company_ama/cnfre0a&quot;&gt;Elon Musk&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
One bit of advice: it is important to view knowledge as sort of a semantic tree -- make sure you understand the fundamental principles, ie the trunk and big branches, before you get into the leaves/details or there is nothing for them to hang on to.&lt;/blockquote&gt;
So if you&#39;re new into programming or feel that you&#39;re missing the fundamentals, do brush up on those. I highly recommend that you start with &lt;a href=&quot;http://www.amazon.com/Code-Complete-Practical-Handbook-Construction/dp/0735619670&quot;&gt;Code Complete&lt;/a&gt;.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/3915961290039081428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/3915961290039081428' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/3915961290039081428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/3915961290039081428'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2015/01/learning-fundamentals.html' title='Learning the fundamentals'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-5206405588804178401</id><published>2014-12-31T10:26:00.002-08:00</published><updated>2014-12-31T10:37:08.648-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="management"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="psychology"/><title type='text'>Don&#39;t make members of your team compete among themselves</title><content type='html'>I couldn&#39;t believe myself when I read that Marissa Meyer, who I used to greatly admire (until today), &lt;a href=&quot;http://www.nytimes.com/2014/12/21/magazine/what-happened-when-marissa-mayer-tried-to-be-steve-jobs.html&quot;&gt;implemented a competitive performance review system at Yahoo&lt;/a&gt;:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Mayer also favored a system of quarterly performance reviews, or Q.P.R.s, that required every Yahoo employee, on every team, be ranked from 1 to 5. The system was meant to encourage hard work and weed out underperformers, but it soon produced the exact opposite. Because only so many 4s and 5s could be allotted, talented people no longer wanted to work together; strategic goals were sacrificed, as employees did not want to change projects and leave themselves open to a lower score.&amp;nbsp;&lt;/blockquote&gt;
That is exactly the &lt;a href=&quot;http://www.vanityfair.com/business/2012/08/microsoft-lost-mojo-steve-ballmer.print&quot;&gt;stack ranking used by Microsoft&lt;/a&gt;, which worked so badly they had to drop it:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
At the center of the cultural problems was a management system called “stack ranking.” Every current and former Microsoft employee I interviewed—every one—cited stack ranking as the most destructive process inside of Microsoft, something that drove out untold numbers of employees. The system—also referred to as “the performance model,” “the bell curve,” or just “the employee review”—has, with certain variations over the years, worked like this: every unit was forced to declare a certain percentage of employees as top performers, then good performers, then average, then below average, then poor.&lt;/blockquote&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
“If you were on a team of 10 people, you walked in the first day knowing that, no matter how good everyone was, two people were going to get a great review, seven were going to get mediocre reviews, and one was going to get a terrible review,” said a former software developer. “It leads to employees focusing on competing with each other rather than competing with other companies.”&lt;/blockquote&gt;
And chapter 25 of &lt;a href=&quot;http://www.amazon.com/Peopleware-Productive-Projects-Teams-Edition/dp/0321934113&quot;&gt;Peopleware&lt;/a&gt;, the classic management book, is dedicated to it:&lt;br /&gt;
&lt;blockquote class=&quot;tr_bq&quot;&gt;
Internal competition has the direct effect of making coaching difficult or&amp;nbsp;impossible. Since coaching is essential to the workings of a healthy team,&amp;nbsp;anything the manager does to increase competition within a team has to be&amp;nbsp;viewed as teamicidal.&lt;/blockquote&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/5206405588804178401/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/5206405588804178401' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/5206405588804178401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/5206405588804178401'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2014/12/dont-make-members-of-your-team-compete.html' title='Don&#39;t make members of your team compete among themselves'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-1227493524255005294</id><published>2014-06-02T11:46:00.000-07:00</published><updated>2015-01-08T09:30:13.490-08:00</updated><title type='text'>Always use tmux on SSH with Bash completion</title><content type='html'>Why use tmux on SSH? Because sometimes you get disconnected and if you&#39;re running something, that process would get killed. tmux also seems to come already installed with Ubuntu servers, so there&#39;s no need to do anything on the server.&lt;br /&gt;
&lt;br /&gt;
Why make this into a command? Because unless it&#39;s easy to use, it&#39;s hard to turn it into a habit.&lt;br /&gt;
&lt;br /&gt;
Here is how&amp;nbsp;you can create a command to always start tmux on SSH. Just add the following to &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;~/.bashrc&lt;/span&gt;.&lt;br /&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;function tsh() {&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; local SESSION_NAME=$(whoami)&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&amp;nbsp; ssh $* -t &#39;tmux a -t &#39;$SESSION_NAME&#39; || tmux new-session -s &#39;$SESSION_NAME&#39; || /bin/bash --login&#39;&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;}&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
It will always attach to existing tmux session with the same name as your local username&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;or create it if not available&lt;/span&gt;. The reason for using the same session name as your local username is so that you don&#39;t end up in someone else&#39;s tmux session. Of course this is assuming that your username is unique. Otherwise, just modify the &lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;SESSION_NAME&lt;/span&gt; variable to make it unique for you. For example:&lt;/div&gt;
&lt;div&gt;
&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;local SESSION_NAME=$(whoami)MyUniqueString&lt;/span&gt;&lt;br /&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div&gt;
I&#39;m also used to use Bash completion instead of typing my server&#39;s host information. For that to work, the info has to be added to&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;a href=&quot;http://nerderati.com/2011/03/simplify-your-life-with-an-ssh-config-file/&quot;&gt;~/.ssh/config&lt;/a&gt;&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;. For example:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;Host example.com&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;HostName example.com&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: &#39;Courier New&#39;, Courier, monospace;&quot;&gt;User foobar&lt;/span&gt;&lt;br /&gt;
&lt;div&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;You&#39;d also need to have bash-completion package installed. Here&#39;s how:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# Ubuntu&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;sudo apt-get install bash-completion&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;# Mac with Homebrew&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;brew install bash-completion&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
Now we need to allow&amp;nbsp;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tsh&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;&amp;nbsp;to be auto-completed. Just add this line to &lt;/span&gt;&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;.bashrc&lt;/span&gt;&lt;span style=&quot;font-family: inherit;&quot;&gt;:&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;complete -F _ssh tsh&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;And there you go! All you need to do now is just type&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tsh ex⇥&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;and you&#39;d get:&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: Courier New, Courier, monospace;&quot;&gt;tsh example.com&lt;/span&gt;&lt;br /&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;&lt;br /&gt;&lt;/span&gt;
&lt;span style=&quot;font-family: inherit;&quot;&gt;Credit to this post for the inspiration:&amp;nbsp;&lt;/span&gt;&lt;a href=&quot;https://coderwall.com/p/powgbg&quot;&gt;https://coderwall.com/p/powgbg&lt;/a&gt;.&lt;/div&gt;
</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/1227493524255005294/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/1227493524255005294' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1227493524255005294'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1227493524255005294'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2014/06/always-use-tmux-on-ssh-with-bash.html' title='Always use tmux on SSH with Bash completion'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-3309610100996604375</id><published>2013-08-06T12:53:00.001-07:00</published><updated>2013-08-06T12:54:33.407-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="productivity"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><title type='text'>No more slow key repeat on Mac</title><content type='html'>As someone coming from Ubuntu, Mac has a slow keyboard repeat rate that makes moving your cursor to somewhere else more time consuming. It&#39;s not a big problem in Vim and you can use Vi-mode in your terminal, but sometimes it&#39;s faster to just move the cursor like a caveman.&lt;br /&gt;
&lt;br /&gt;
Well, that&#39;s until I discover the Key Repeat option in KeyRemap4MacBook:&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBFrj448xVhcjl6dT0TQG_mYxmosGbdbkL1mUMieUDsqy1osbIwE1iM4DGkK5comcmzTwDkx3P8M-iEIYvgieQrcKUvuLNh1sujzWTVmQI3bXcrioUkUNKQFTMBR9EGwD_71wg6X1TS7jJ/s1600/Screen+Shot+2013-08-06+at+12.50.07+PM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;617&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBFrj448xVhcjl6dT0TQG_mYxmosGbdbkL1mUMieUDsqy1osbIwE1iM4DGkK5comcmzTwDkx3P8M-iEIYvgieQrcKUvuLNh1sujzWTVmQI3bXcrioUkUNKQFTMBR9EGwD_71wg6X1TS7jJ/s640/Screen+Shot+2013-08-06+at+12.50.07+PM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/3309610100996604375/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/3309610100996604375' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/3309610100996604375'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/3309610100996604375'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2013/08/no-more-slow-key-repeat-on-mac.html' title='No more slow key repeat on Mac'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgBFrj448xVhcjl6dT0TQG_mYxmosGbdbkL1mUMieUDsqy1osbIwE1iM4DGkK5comcmzTwDkx3P8M-iEIYvgieQrcKUvuLNh1sujzWTVmQI3bXcrioUkUNKQFTMBR9EGwD_71wg6X1TS7jJ/s72-c/Screen+Shot+2013-08-06+at+12.50.07+PM.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-1928278483913486357</id><published>2013-07-11T20:00:00.000-07:00</published><updated>2013-10-22T21:50:56.539-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="mac"/><category scheme="http://www.blogger.com/atom/ns#" term="recipe"/><category scheme="http://www.blogger.com/atom/ns#" term="vim"/><title type='text'>Viewing image from Vim&#39;s NERD Tree on Mac</title><content type='html'>While in our text editing glory, wanting to see an image in our project can break our flow since that means we get out of our editor and use other application to see the image.&lt;br /&gt;
&lt;br /&gt;
That&#39;s not a problem if you are using NERD Tree on Mac. Follow these steps.&lt;br /&gt;
&lt;br /&gt;
1. Navigate to the image on NERD Tree.&lt;br /&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCMn86ThLAcAQuE5g_1OI05aO4fBlNLqkGnQNOZTWOYCRu7bXiRxsnjWPVW4UoOcUpyMOiEJHo7kwwfLO29jQ37oBg8oN2bRYMvbHygg7NDNrF9OSYhnoTdKuw6PiW_YX_LVJoMZPzvxht/s1600/1.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCMn86ThLAcAQuE5g_1OI05aO4fBlNLqkGnQNOZTWOYCRu7bXiRxsnjWPVW4UoOcUpyMOiEJHo7kwwfLO29jQ37oBg8oN2bRYMvbHygg7NDNrF9OSYhnoTdKuw6PiW_YX_LVJoMZPzvxht/s1600/1.png&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
2. Press &lt;kbd&gt;m&lt;/kbd&gt; and then &lt;kbd&gt;q&lt;/kbd&gt;.&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh-_EOD6kadUn8mjQrkdcECb8MDlvH_SVwaO5F9OshIy0KCbu5OX5thzNP-zyWrZKUm_LPqhQf8fdiSje8kN7rzJN8OUb7kGM-kX8AFhQZ2SEQozpdZvAZk-ZDvOQ_-a-4KZCMgp1WmPDU/s1600/2.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;166&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgh-_EOD6kadUn8mjQrkdcECb8MDlvH_SVwaO5F9OshIy0KCbu5OX5thzNP-zyWrZKUm_LPqhQf8fdiSje8kN7rzJN8OUb7kGM-kX8AFhQZ2SEQozpdZvAZk-ZDvOQ_-a-4KZCMgp1WmPDU/s320/2.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;
&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEir_l3SrXSR2FPxrggzqQuVD4b2LEljgolGyKLjGXmM1yLnLHqReQjvkE2GCLiXXNE1rOvlxj3-TvbfpiF_gXdKAdHL-gQPa9ItQLIixvY5i5THoMvki8zndyTwVT569eqDP8m1BT5eEcwP/s1600/3.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; height=&quot;154&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEir_l3SrXSR2FPxrggzqQuVD4b2LEljgolGyKLjGXmM1yLnLHqReQjvkE2GCLiXXNE1rOvlxj3-TvbfpiF_gXdKAdHL-gQPa9ItQLIixvY5i5THoMvki8zndyTwVT569eqDP8m1BT5eEcwP/s320/3.png&quot; width=&quot;320&quot; /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
&lt;br /&gt;&lt;/div&gt;
&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: left;&quot;&gt;
3. Press Command-W to close the preview.&lt;/div&gt;
&lt;br /&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/1928278483913486357/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/1928278483913486357' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1928278483913486357'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1928278483913486357'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2013/07/viewing-image-from-nerd-tree-on-mac.html' title='Viewing image from Vim&#39;s NERD Tree on Mac'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgCMn86ThLAcAQuE5g_1OI05aO4fBlNLqkGnQNOZTWOYCRu7bXiRxsnjWPVW4UoOcUpyMOiEJHo7kwwfLO29jQ37oBg8oN2bRYMvbHygg7NDNrF9OSYhnoTdKuw6PiW_YX_LVJoMZPzvxht/s72-c/1.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-2514680547314132668</id><published>2012-05-02T03:22:00.000-07:00</published><updated>2012-05-02T03:27:06.143-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="bash"/><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="recipe"/><category scheme="http://www.blogger.com/atom/ns#" term="sysadmin"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>Recipe: rename long filename in *nix</title><content type='html'>&lt;p&gt;Want to rename a file with long path?&lt;p&gt;
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;mv /super/long/path/to/filex /super/long/path/to/file_x
mv /super/long/path/to/filex /super/long/path/to/filey&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;
&lt;p&gt;Why? &lt;a href=&quot;http://www.gnu.org/software/bash/manual/bashref.html#Brace-Expansion&quot;&gt;Brace expansion&lt;/a&gt; to the rescue.
&lt;blockquote&gt;&lt;pre&gt;&lt;code&gt;mv /super/long/path/to/file{,_}x
mv /super/long/path/to/file{x,y}&lt;/code&gt;&lt;/pre&gt;&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/2514680547314132668/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/2514680547314132668' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/2514680547314132668'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/2514680547314132668'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2012/05/recipe-rename-long-filename-in-nix.html' title='Recipe: rename long filename in *nix'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-6149687363767782793</id><published>2012-04-18T08:15:00.001-07:00</published><updated>2012-04-18T08:15:51.840-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="linux"/><category scheme="http://www.blogger.com/atom/ns#" term="recipe"/><category scheme="http://www.blogger.com/atom/ns#" term="regex"/><category scheme="http://www.blogger.com/atom/ns#" term="sysadmin"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>Recipe: rename file extension in a directory recursively in *nix</title><content type='html'>&lt;p&gt;Rename file extension in a directory recursively, for example, from *.rhtml to *.html.erb:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;find . -name &quot;*.rhtml&quot; -exec rename &#39;s/(.*)\.rhtml/$1\.html.erb/&#39; {} \;&amp;nbsp;&lt;/code&gt;&lt;/pre&gt;
I&#39;ve just learned more about find. It leveled up my Unix ninja skill quite tremendously.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/6149687363767782793/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/6149687363767782793' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6149687363767782793'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6149687363767782793'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2012/04/recipe-rename-file-extension-in.html' title='Recipe: rename file extension in a directory recursively in *nix'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-3564841830680053772</id><published>2012-04-09T09:47:00.000-07:00</published><updated>2013-06-27T12:22:33.403-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="creativity"/><category scheme="http://www.blogger.com/atom/ns#" term="design"/><category scheme="http://www.blogger.com/atom/ns#" term="inspiration"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>A deeply felt but undefined goal in mind</title><content type='html'>&lt;blockquote&gt;
Whereas a conventional artist starts painting a canvas knowing what she wants to paint, and holds to her original intention until the work is finished, an original artist with equal technical training commences with a deeply felt but undefined goal in mind, keeps modifying the picture in response to the unexpected colors and shapes emerging on the canvas, and ends up with a finished work that is responsive to her inner feelings, knows what she likes and does not like, and pays attention to what is happening on the canvas, a good painting is bound to emerge. On the other hand, if she holds on to a preconceived notion of what the painting should look like, without responding to the possibilities suggested by the forms developing before her, the painting is likely to be trite. (Mihaly Csikszentmihalyi - Flow)&lt;/blockquote&gt;
&lt;br /&gt;
For problems with a lot of unknowns, sometimes it&#39;s good to just start writing the code. You&#39;ll then see the patterns of what are always the same and what are different. You can then extract the parts that are the same into methods or classes, essentially refactoring it.&lt;br /&gt;
&lt;br /&gt;
This is to be contrasted with a problem where upfront design is almost a necessity for good design. I think database schema and model design are a good example. If you have a lot of unknowns in designing those, either your requirement spec is not detailed enough or you don&#39;t know what you&#39;re doing.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/3564841830680053772/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/3564841830680053772' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/3564841830680053772'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/3564841830680053772'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2012/04/deeply-felt-but-undefined-goal-in-mind.html' title='A deeply felt but undefined goal in mind'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-340484433129104405</id><published>2011-12-03T16:58:00.001-08:00</published><updated>2012-04-21T10:51:39.718-07:00</updated><title type='text'>Capistrano: Host key verification failed</title><content type='html'>If you ever encountered the error message below when deploying using Capistrano, here&#39;s a solution for you.&lt;br /&gt;
&lt;br /&gt;

&lt;pre&gt; ** [12.12.12.12 :: err] Host key verification failed.
 ** [12.12.12.12 :: err] fatal: The remote end hung up unexpectedly
 ** [12.12.12.12 :: err] fetch-pack from &#39;git@github.com:abc/xyz.git&#39; failed.&lt;/pre&gt;
&lt;br /&gt;

This seems to mean that the RSA key fingerprint needs to be verified (I&#39;m not 100% sure on this). My solution was to do &lt;code&gt;git clone&lt;/code&gt; on the server and confirm the fingerprint prompt, but there is a better approach. You can also do &lt;code&gt;ssh git@github.com&lt;/code&gt; and confirm the prompt.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/340484433129104405/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/340484433129104405' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/340484433129104405'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/340484433129104405'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2011/12/capistrano-host-key-verification-failed.html' title='Capistrano: Host key verification failed'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-1929046099084222080</id><published>2011-08-25T04:14:00.000-07:00</published><updated>2011-12-30T00:02:47.572-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="rubyonrails"/><title type='text'>Creating Rails project from a local checkout of Rails repository</title><content type='html'>For my forgetful brain:&lt;br /&gt;
&lt;br /&gt;
&lt;tt&gt;ruby /rails_repo/bin/rails new projectname --dev&lt;/tt&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/1929046099084222080/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/1929046099084222080' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1929046099084222080'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1929046099084222080'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2011/08/running-rails-project-from-local.html' title='Creating Rails project from a local checkout of Rails repository'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-7977722337528314049</id><published>2011-08-15T06:43:00.001-07:00</published><updated>2011-12-30T00:24:00.679-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>Superstitious programming</title><content type='html'>Some programmers tend to think that something causes a problem without examining it further and confirming it. Then they just &quot;fix&quot; it or work around it, blaming it on the suspected cause.&lt;br /&gt;
&lt;br /&gt;
For example, you&#39;re using an external library and you found that things went haywire. There are possible causes to this. First, the library causes it. How likely is it? You can look at the number of users (in other word, popularity) of the library. The more users, the less likely that it is the library&#39;s problem. Of course there&#39;s a remote possibility of you discovering a rare bug. But more likely, perhaps you&#39;re just not using the library right.&lt;br /&gt;
&lt;br /&gt;
Here&#39;s a way of thinking that is also applicable in real life. Always check your assumption. Ensure that when you think something is causing the other, that it really is the case. Remove or change the cause and see if the effect changes or disappears. Only when you have that correlation that you can confidently say, &quot;Yes, that&#39;s really the cause.&quot;&lt;br /&gt;
&lt;br /&gt;
Having a knowledge of the &lt;a href=&quot;http://www.youtube.com/watch?v=zcavPAFiG14&quot;&gt;scientific method&lt;/a&gt; will help greatly when doing this, and as a bonus, also when navigating life generally.&lt;br /&gt;
&lt;br /&gt;
&lt;blockquote&gt;&quot;Assumptions that aren&#39;t based on well-established facts are the bane of all projects.&quot; (from &lt;a href=&quot;http://pragprog.com/the-pragmatic-programmer/extracts/coincidence&quot;&gt;The Pragmatic Programmer&lt;/a&gt; by Andrew Hunt and David Thomas)&lt;/blockquote&gt;
&lt;blockquote&gt;&quot;One of the biggest differences between hobbyists and professional programmers is the difference that grows out of superstition into understanding.&quot; (from &lt;a href=&quot;http://cc2e.com/&quot;&gt;Code Complete, Second Edition&lt;/a&gt; by Steve McConnell)&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/7977722337528314049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/7977722337528314049' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/7977722337528314049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/7977722337528314049'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2011/08/superstitious-programming.html' title='Superstitious programming'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-2931775083307911199</id><published>2010-09-24T08:08:00.000-07:00</published><updated>2010-09-24T08:08:24.198-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="sysadmin"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>The promise of chef, fulfilled</title><content type='html'>After using &lt;a href=&quot;http://www.opscode.com/chef/&quot;&gt;chef&lt;/a&gt; (a system configuration management) for more than a year, it is finally a working solution for me. The first time it ran from scratch without a hitch, it was quite a strange experience. Wait a second, everything works? It&#39;s magic!&lt;br /&gt;
&lt;br /&gt;
It probably came about because it was run on &lt;a href=&quot;http://ubuntuguide.org/wiki/Ubuntu:Lucid&quot;&gt;Ubuntu Lucid&lt;/a&gt;, which is an LTS release and probably better supported by the &lt;a href=&quot;http://github.com/opscode/cookbooks&quot;&gt;cookbooks&lt;/a&gt;. Turned out the old cookbooks I was using were not up to task to deal with Lucid. So I might as well update it to the latest version and deal with many &lt;a href=&quot;http://wiki.opscode.com/display/chef/Breaking+Changes+from+0.7.x+to+0.8.x&quot;&gt;broken&lt;/a&gt; things, which required a lot of head scratching and whatever else needed scratching.&lt;br /&gt;
&lt;br /&gt;
I still don&#39;t get the hang of the whole thing about the similar but different variables usage like &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;node&lt;/span&gt;, &lt;span style=&quot;font-family: &amp;quot;Courier New&amp;quot;,Courier,monospace;&quot;&gt;params&lt;/span&gt;, and others (nor do I really care, it&#39;s not that important), but it works beautifully and that&#39;s good enough.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/2931775083307911199/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/2931775083307911199' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/2931775083307911199'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/2931775083307911199'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2010/09/promise-of-chef-fulfilled.html' title='The promise of chef, fulfilled'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-6916777836814951662</id><published>2010-03-20T21:13:00.005-07:00</published><updated>2010-03-20T21:49:33.023-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="business"/><category scheme="http://www.blogger.com/atom/ns#" term="management"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>It&#39;s critical but please get it done as cheap as IMpossible</title><content type='html'>A nice &lt;a href=&quot;http://www.reddit.com/r/programming/comments/bg12b/what_did_i_do_wrong_or_how_are_you_supposed_to/c0mlbmj&quot;&gt;quote&lt;/a&gt; to &lt;del&gt;shove&lt;/del&gt; show to people that want softwares to be cheaply done:&lt;br /&gt;&lt;blockquote&gt;What always amazes me is the companies who consider such a piece of software to be &quot;critical&quot; to their company -- but then try to get it done as cheaply as possible. (Chances are that more money was spent on the bathroom facilities in your office than you want to spend developing this program... yet your business success/failure hinges on whether this program is done correctly. Does that sound insane or what? I mean you have 5 employees, and EACH of those employees will cost you MULTIPLE TIMES MORE in a single year than you want/expect to spend developing this critical application -- an application that once completed, could easily make your employees much more efficient &amp; your firm more productive, OR which alternately could cause needless frustration and even reduce their efficiency and productivity.)&lt;/blockquote&gt;The answer is it doesn&#39;t work. Those who offer low price are just bidding for any jobs, even the impossible (a very hard and so far &lt;a href=&quot;http://news.ycombinator.com/item?id=376238&quot;&gt;unsolved problem quoted for $300-$1000&lt;/a&gt;) or ridiculous ones (&lt;a href=&quot;http://www.examiner.com/x-1652-Gadgets-Examiner~y2008m11d14-oDesk-Guru-Elance-and-RentACoder--Are-they-worth-it&quot;&gt;a clone of eBay for under $500&lt;/a&gt;). The old adage still stands, price is a good indicator of goods.&lt;br /&gt;&lt;br /&gt;Now, how do you find the excellent companies or programmers? That&#39;s a different ball game. Maybe on the next article, maybe.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/6916777836814951662/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/6916777836814951662' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6916777836814951662'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6916777836814951662'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2010/03/its-critical-but-please-get-it-done-as.html' title='It&#39;s critical but please get it done as cheap as IMpossible'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-6041973231397739743</id><published>2010-03-17T07:51:00.003-07:00</published><updated>2010-09-24T08:10:05.083-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="usability"/><title type='text'>How people use Google Maps</title><content type='html'>Watching people press the arrow buttons on Google Maps is painful, but that&#39;s the state of most Internet users. Watch around 15:30.&lt;br /&gt;
&lt;br /&gt;
&lt;object height=&quot;385&quot; width=&quot;480&quot;&gt;&lt;param name=&quot;movie&quot; value=&quot;http://www.youtube.com/v/QckIzHC99Xc&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;rel=0&amp;amp;start=930&quot;&gt;&lt;param name=&quot;allowFullScreen&quot; value=&quot;true&quot;&gt;&lt;param name=&quot;allowscriptaccess&quot; value=&quot;always&quot;&gt;&lt;embed src=&quot;http://www.youtube.com/v/QckIzHC99Xc&amp;amp;hl=en_US&amp;amp;fs=1&amp;amp;rel=0&amp;amp;start=930&quot; type=&quot;application/x-shockwave-flash&quot; allowscriptaccess=&quot;always&quot; allowfullscreen=&quot;true&quot; height=&quot;385&quot; width=&quot;480&quot;&gt;&lt;/embed&gt;&lt;/object&gt;&lt;br /&gt;
&lt;br /&gt;
The funny thing is that the usability advices given in this video are not applied on the &lt;a href=&quot;http://www.zipcar.com/sf/check-rates&quot;&gt;site&lt;/a&gt; itself.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/6041973231397739743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/6041973231397739743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6041973231397739743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6041973231397739743'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2010/03/how-people-use-google-maps.html' title='How people use Google Maps'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-1519864390558023346</id><published>2010-01-27T19:40:00.004-08:00</published><updated>2010-01-27T19:45:41.544-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="inspiration"/><title type='text'>Tomorrow would be better</title><content type='html'>A quote from Sergey Brin taken from Seth Godin&#39;s The Dip:&lt;br /&gt;&lt;blockquote&gt;We knew that Google was going to get better every single day as we worked on it, and we knew that sooner or later, everyone was going to try it. So our feeling was that the later you tried it, the better it was for us because we&#39;d make a better impression with better technology. So we were never in a big hurry to get you to use it today. Tomorrow would be better.&lt;/blockquote&gt;Doesn&#39;t mean that you&#39;ll never ship it!</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/1519864390558023346/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/1519864390558023346' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1519864390558023346'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1519864390558023346'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2010/01/tomorrow-would-be-better.html' title='Tomorrow would be better'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-6569118084794019891</id><published>2010-01-15T03:12:00.003-08:00</published><updated>2010-01-15T03:23:31.753-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="rubyonrails"/><title type='text'>Auto reload Rails plugin</title><content type='html'>One day we all need to quickly get that plugin to work our way. But plugin development can be painful with restarting the server all the time.&lt;br /&gt;&lt;br /&gt;Here is how to reload Rails plugin on every request on Rails 2.3.&lt;br /&gt;&lt;br /&gt;&lt;ol&gt;&lt;li&gt;Add &quot;config.reload_plugins = true&quot; on config/environment.rb. It has to be there, you can&#39;t put it on config/environments/development.rb due to the Rails start up steps. You may add &quot;if RAILS_ENV = &#39;development&#39;&quot; instead.&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;&lt;br /&gt;  # config/environment.rb&lt;br /&gt;  config.reload_plugins = true&lt;br /&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li&gt;On the plugin&#39;s init.rb, add the following line:&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;&lt;br /&gt;  # init.rb&lt;br /&gt;  ActiveSupport::Dependencies.explicitly_unloadable_constants = &#39;YourPluginModuleName&#39;&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;That&#39;s all. Don&#39;t forget to remove it when you&#39;re done.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/6569118084794019891/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/6569118084794019891' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6569118084794019891'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6569118084794019891'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2010/01/auto-reload-rails-plugin.html' title='Auto reload Rails plugin'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-1026452810814201743</id><published>2010-01-04T07:07:00.004-08:00</published><updated>2010-01-04T07:15:30.895-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="management"/><category scheme="http://www.blogger.com/atom/ns#" term="programming"/><title type='text'>Defining milestones</title><content type='html'>Apparently my brain can remember the gist quite well while forgetting the source. Before I forget again:&lt;br /&gt;&lt;blockquote&gt;For picking the milestones there is only one relevant rule. Milestones must be concrete, specific, measurable events, defined with knife-edge sharpness. Coding, for a counterexample, is &quot;90 percent finished&quot; for half of the total coding time. Debugging is &quot;99 percent complete&quot; most of the time. &quot;Planning complete&quot; is an event one can proclaim almost at will.&lt;br /&gt;&lt;br /&gt;Concrete milestones on the other hand, are 100-percent events. &quot;Specifications signed by architects and implementers,&quot; &quot;source coding 100 percent complete, keypunched, entered into disk library&quot;, &quot;debugged version passes all test cases&quot;. These concrete milestones demark the vague phases of planning, coding, debugging. (Fred Brooks - The Mythical Man-Month: Essays on Software Engineering)&lt;/blockquote&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/1026452810814201743/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/1026452810814201743' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1026452810814201743'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1026452810814201743'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2010/01/defining-milestones.html' title='Defining milestones'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-4387797411442147995</id><published>2009-12-31T00:16:00.004-08:00</published><updated>2009-12-31T00:31:36.228-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="rubyonrails"/><title type='text'>Uploadify &quot;406 Not Acceptable&quot; error with Rails</title><content type='html'>To some poor souls out there, if you encounter &quot;406 Not Acceptable&quot; error when uploading file with Uploadify on IE, Firefox, or Chrome on Windows, you may want to remove or replace the respond_to block, if you can.&lt;br /&gt;&lt;br /&gt;From what I can figure out, those Windows browsers send text/* as the HTTP_ACCEPT header, while on Linux, it sends */*. I suspect this is caused by different behavior of Flash on different OS and the header from Windows is considered invalid by Rails.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/4387797411442147995/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/4387797411442147995' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/4387797411442147995'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/4387797411442147995'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2009/12/uploadify-406-not-acceptable-error-with.html' title='Uploadify &quot;406 Not Acceptable&quot; error with Rails'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-1604358158639393117</id><published>2009-12-28T19:32:00.003-08:00</published><updated>2014-03-02T20:17:24.914-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="creativity"/><category scheme="http://www.blogger.com/atom/ns#" term="thought"/><title type='text'>Reading obscure texts</title><content type='html'>I&#39;ve just read Zed Shaw&#39;s &lt;a href=&quot;http://zedshaw.com/essays/master_and_expert.html&quot;&gt;The Master, The Expert, The Programmer&lt;/a&gt;. Talk about the obscure &lt;a href=&quot;http://www.amazon.com/gp/product/1590309847/ref=as_li_ss_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=1590309847&amp;amp;linkCode=as2&amp;amp;tag=cf0d75-20&quot;&gt;Go Rin No Sho (The Book of Five Rings)&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=cf0d75-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=1590309847&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt; by Miyamoto Musashi, I&#39;m thinking that maybe it&#39;s good to read those obscure texts like &lt;a href=&quot;http://www.amazon.com/gp/product/B00C1T79DE/ref=as_li_ss_tl?ie=UTF8&amp;amp;camp=1789&amp;amp;creative=390957&amp;amp;creativeASIN=B00C1T79DE&amp;amp;linkCode=as2&amp;amp;tag=cf0d75-20&quot;&gt;The Art of War&lt;/a&gt;&lt;img alt=&quot;&quot; border=&quot;0&quot; src=&quot;http://ir-na.amazon-adsystem.com/e/ir?t=cf0d75-20&amp;amp;l=as2&amp;amp;o=1&amp;amp;a=B00C1T79DE&quot; height=&quot;1&quot; style=&quot;border: none !important; margin: 0px !important;&quot; width=&quot;1&quot; /&gt;
 or Zen &lt;a href=&quot;http://en.wikipedia.org/wiki/Koan&quot;&gt;koans&lt;/a&gt;. They&#39;re supposedly full of wisdom, but we don&#39;t understand them. We simply don&#39;t because we&#39;ve lost the context (in the case of Go Rin No Sho and The Art of War) or it&#39;s intentionally created to be non rational like the Zen koans.&lt;br /&gt;
&lt;br /&gt;
It may be able to train your creativity, flexing those neuron connections, making you think outside of your daily thoughts and peering deep into yourself. And since it&#39;s obscure, the answer you get is most likely something inside you which you probably have never known.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/1604358158639393117/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/1604358158639393117' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1604358158639393117'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1604358158639393117'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2009/12/reading-obscure-texts.html' title='Reading obscure texts'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-6799645164973521962</id><published>2009-07-01T23:42:00.008-07:00</published><updated>2014-09-04T12:16:08.761-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="firefox"/><category scheme="http://www.blogger.com/atom/ns#" term="tech"/><title type='text'>How to find character encoding of a text file</title><content type='html'>Is it UTF8, ISO-8859-1, or UTF16-LE? How do you know which encoding a text file uses?&lt;br /&gt;
&lt;br /&gt;
Unfortunately, it&#39;s not so easy to find out. Unicode has been around for more than 15 years and there is one program called Excel that still exports CSV files in its own fancy &lt;a href=&quot;http://en.wikipedia.org/wiki/ISO/IEC_8859-1&quot;&gt;ISO-8859-1 (Latin-1)&lt;/a&gt; encoding that is bound to mess up pretty much anything if you have some characters not in the US keyboard. But of course you didn&#39;t know what encoding the CSV file is in, even after almost pulling your hairs off googling for answer.&lt;br /&gt;
&lt;br /&gt;
So, why bother about encoding? It&#39;s because my program can&#39;t read it if it&#39;s not converted to UTF-8. After trying many text editors hoping that it has a feature to show the current encoding, it finally dawned on me that there is this thing called Firefox which seems to recognize a file&#39;s character encoding.&lt;br /&gt;
&lt;br /&gt;
Here&#39;s how to do it. Open the file in Firefox by selecting &lt;b&gt;File&lt;/b&gt; on the menu bar, the choose &lt;b&gt;Open File…&lt;/b&gt;&amp;nbsp;and choose the file you want to open. Once the file is opened,&amp;nbsp;go to &lt;b&gt;View&lt;/b&gt;&amp;nbsp;on the menu bar, and&amp;nbsp;then choose &lt;b&gt;Character Encoding&lt;/b&gt;. The selected one &lt;span style=&quot;font-style: italic;&quot;&gt;should&lt;/span&gt; be the encoding of the text file.&lt;br /&gt;
&lt;br /&gt;
&lt;img alt=&quot;Firefox character encoding screenshot&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEzpNS4B059JQvMRp3013e_Qg-7fZj9qL9-SXxE-ioiyQAR6WdSsB1pazmWy4tQ0HQk_b40PPbbGJZlhiUKigEVUCjUDi9TCsPmfuAsZ1FutpCTdXrU54kt8-7OX88OBk8n00JhAy_sCh8/s400/ff_encoding.png&quot; /&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/6799645164973521962/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/6799645164973521962' title='19 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6799645164973521962'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6799645164973521962'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2009/07/how-to-find-character-encoding-of-text.html' title='How to find character encoding of a text file'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgEzpNS4B059JQvMRp3013e_Qg-7fZj9qL9-SXxE-ioiyQAR6WdSsB1pazmWy4tQ0HQk_b40PPbbGJZlhiUKigEVUCjUDi9TCsPmfuAsZ1FutpCTdXrU54kt8-7OX88OBk8n00JhAy_sCh8/s72-c/ff_encoding.png" height="72" width="72"/><thr:total>19</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-1850545836812703516</id><published>2009-04-18T05:35:00.013-07:00</published><updated>2009-04-18T06:39:08.550-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="ruby"/><category scheme="http://www.blogger.com/atom/ns#" term="testing"/><category scheme="http://www.blogger.com/atom/ns#" term="ubuntu"/><title type='text'>Standalone autotest with Rspec 1.2.0</title><content type='html'>If you&#39;re looking for how to do autotest with Rspec for standalone project, you might end up with &lt;a href=&quot;http://blog.nicksieger.com/articles/2007/01/30/rspec-autotest-for-standalone-projects&quot;&gt;this old article from 2007&lt;/a&gt;. But sadly, it doesn&#39;t work anymore with the latest Rspec (1.2.0).&lt;br /&gt;&lt;br /&gt;After angrily scratching your head for why it doesn&#39;t work, you might dive into the source code and eventually solved the problem by writing some code. Then you found out that it&#39;s already supported by Rspec, no extra code required and you wondered why you didn&#39;t think of that. After all, if the problem seems common enough, somebody must have solved it. (Replace you with I)&lt;br /&gt;&lt;br /&gt;And how do you do it? Let&#39;s dive in.&lt;br /&gt;&lt;ol&gt;&lt;br /&gt;  &lt;li&gt;Install Rspec and ZenTest.&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;sh&quot;&gt;&lt;br /&gt;  gem install rspec&lt;br /&gt;  gem install ZenTest&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;  &lt;/li&gt;&lt;li&gt;Set up Rspec.&lt;p&gt;Create &lt;code&gt;spec&lt;/code&gt; folder at your project root and put your spec files inside.&lt;/p&gt;&lt;/li&gt;&lt;li&gt;Run autospec.&lt;p&gt;Type &lt;code&gt;autospec&lt;/code&gt; at your project root and it&#39;s done. I thought it&#39;s &lt;code&gt;autotest&lt;/code&gt; and ended up wasting time figuring out why it doesn&#39;t work.&lt;/p&gt;&lt;/li&gt;&lt;/ol&gt;&lt;br /&gt;That&#39;s basically all, but there is more.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Adding color and other spec options&lt;/h4&gt;&lt;br /&gt;Just create &lt;code&gt;spec.opts&lt;/code&gt; file inside &lt;code&gt;spec&lt;/code&gt; directory. Fill it with some options, for example:&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;--color&lt;br /&gt;--reverse&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;You can see the list of options available by executing &lt;code&gt;spec --help&lt;/code&gt;.&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Scan spec files within subdirectories&lt;/h4&gt;&lt;br /&gt;For one, the default behavior only scans spec files inside spec directory non-recursively. So if you like to organize your spec better, you&#39;re out of luck. But here is how to do it. In &lt;code&gt;.autotest&lt;/code&gt; file in your project root, add the following code:&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;&lt;br /&gt;module Autotest::RspecMod&lt;br /&gt;  Autotest.add_hook :initialize do |autotest|&lt;br /&gt;    # Map to all &quot;*_spec.rb&quot; files inside spec and its sub directory.&lt;br /&gt;    regexp = %r%^lib/(.*)\.rb$%&lt;br /&gt;&lt;br /&gt;    autotest.remove_mapping(regexp)&lt;br /&gt;    autotest.add_mapping(regexp) do |filename, m|&lt;br /&gt;      autotest.files_matching(%r%^spec/.*#{m[1]}_spec.rb$%)&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;h4&gt;Pop up notification on Ubuntu&lt;/h4&gt;&lt;br /&gt;If you&#39;re on Ubuntu, you can follow these steps to have pop up notification when the test is finished. First, make sure you have &lt;code&gt;libnotify-bin&lt;/code&gt; by running:&lt;br /&gt;&lt;pre&gt;sudo apt-get install libnotify-bin&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;Then add the code below in &lt;code&gt;.autotest&lt;/code&gt;.&lt;br /&gt;&lt;pre name=&quot;code&quot; class=&quot;ruby&quot;&gt;&lt;br /&gt;require &#39;autotest/redgreen&#39;&lt;br /&gt;&lt;br /&gt;module Autotest::GnomeNotify&lt;br /&gt;  # Time notification will be displayed before disappearing automatically.&lt;br /&gt;  EXPIRATION_IN_SECONDS = 3&lt;br /&gt;  ERROR_ICON = &#39;gtk-dialog-error&#39;&lt;br /&gt;  PENDING_ICON = &#39;gtk-dialog-warning&#39;&lt;br /&gt;  SUCCESS_ICON = &#39;gtk-dialog-info&#39;&lt;br /&gt;&lt;br /&gt;  # Convenience method to send an error notification message&lt;br /&gt;  #&lt;br /&gt;  # [title]         Notification message title.&lt;br /&gt;  # [message]       Core message for the notification.&lt;br /&gt;  # [icon]          An icon filename or stock icon to display.&lt;br /&gt;  # [urgency]       The urgency level (low, normal, critical).&lt;br /&gt;  # [time]          The timeout in milliseconds at which to expire the notification.&lt;br /&gt;  def self.notify(title, message, icon, urgency=&#39;low&#39;, time=(EXPIRATION_IN_SECONDS * 1000))&lt;br /&gt;    `notify-send -i #{icon} -u #{urgency} -t #{time} &#39;#{title}&#39; &#39;#{message}&#39;`&lt;br /&gt;  end&lt;br /&gt;&lt;br /&gt;  Autotest.add_hook :ran_command do |autotest|&lt;br /&gt;    results = [autotest.results].flatten.join(&quot;\n&quot;)&lt;br /&gt;    output = results.slice(/(\d+)\s+examples?,\s*(\d+)\s+failures?(,\s*(\d+)\s+pending)?/)&lt;br /&gt;&lt;br /&gt;    if output  =~ /[1-9]\d*\spending?/&lt;br /&gt;      notify &#39;PENDING:&#39;, &quot;#{output}&quot;, PENDING_ICON, &#39;normal&#39;, 5000&lt;br /&gt;    elsif output =~ /0 failures/&lt;br /&gt;      notify &#39;PASS:&#39;, &quot;#{output}&quot;, SUCCESS_ICON&lt;br /&gt;    else&lt;br /&gt;      notify &#39;FAIL:&#39;, &quot;#{output}&quot;, ERROR_ICON, &#39;critical&#39;, 10000&lt;br /&gt;    end&lt;br /&gt;  end&lt;br /&gt;end&lt;br /&gt;&lt;/pre&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/1850545836812703516/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/1850545836812703516' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1850545836812703516'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1850545836812703516'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2009/04/standalone-autotest-with-rspec-120.html' title='Standalone autotest with Rspec 1.2.0'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-6996159028451740107</id><published>2009-03-29T21:02:00.006-07:00</published><updated>2009-04-07T01:50:21.957-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="design"/><category scheme="http://www.blogger.com/atom/ns#" term="think"/><title type='text'>The Genius of SMRT</title><content type='html'>Here is an example of why you need to think.&lt;br /&gt;&lt;br /&gt;Long time ago, there used to be a drawing that showed how long it took to travel from one station to another by Singapore&#39;s MRT.&lt;br /&gt;&lt;br /&gt;This is how it looks like:&lt;br /&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVjcklWlbpfI3L1B9TVlgoa6uLlqK0bv9B05x2ztHBiQjq4ord5mKuovfMiSYcCQLmlVYeWO9cpeRqRhU2W_dT00-Rn1z_t0uXALUNYVMLkkuXbJ2U4-HpYnUG_YwF4LOoiYu7pbiBpB9x/s400/mrt_travel_good.png&quot; border=&quot;0&quot; id=&quot;BLOGGER_PHOTO_ID_5321863979652333106&quot; /&gt;&lt;br /&gt;&lt;br /&gt;And there is a newer version, which looks like this one below:&lt;br /&gt;&lt;a href=&quot;http://www.smrt.com.sg/trains/images/timing_average_big.gif&quot;&gt;&lt;img src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzJW-h4tFm7NuYMYcnCUe3oRjsMyTmF3d3RK9Kbvy5nT_lQY0QJEfOGSwRq0fqDoves_jIblz9-Anm4EF_qUOjijbIgaLNA1b0P-jH0ar9oWrIzjXoNLCN0b8LQE7rYjIUHQ0UGBY_BfQg/s400/mrt_travel_bad.png&quot; id=&quot;BLOGGER_PHOTO_ID_5321864316062419762&quot; /&gt;&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Using both maps, tell me how long do I need to go from Bukit Gombak to Woodlands? Now you know that the newer version simply serves no purpose whatsoever to help people other than the fact that the timing seems to be updated and more current.&lt;br /&gt;&lt;br /&gt;That, is the genius of non thinking.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;The original document is still available on &lt;a href=&quot;http://www.smrt.com.sg/trains/documents/RailTravelTimes61.pdf&quot;&gt;here&lt;/a&gt; though I can&#39;t find it linked from anywhere in the site. And there is a fancier, overkill one from &lt;a href=&quot;http://www.transitlink.com.sg/images/eguide/MRT_Journey_Time.jpg&quot;&gt;TransitLink&lt;/a&gt;.&lt;/em&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/6996159028451740107/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/6996159028451740107' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6996159028451740107'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/6996159028451740107'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2009/03/genius-of-smrt.html' title='The Genius of SMRT'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgVjcklWlbpfI3L1B9TVlgoa6uLlqK0bv9B05x2ztHBiQjq4ord5mKuovfMiSYcCQLmlVYeWO9cpeRqRhU2W_dT00-Rn1z_t0uXALUNYVMLkkuXbJ2U4-HpYnUG_YwF4LOoiYu7pbiBpB9x/s72-c/mrt_travel_good.png" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-2201635573543512894</id><published>2009-03-25T20:19:00.004-07:00</published><updated>2009-04-01T20:16:38.192-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="tech"/><title type='text'>Delicious screws it up, again</title><content type='html'>So one &lt;a href=&quot;http://codeftw.blogspot.com/2008/06/delicious-20-extension-messing-up-my.html&quot;&gt;mistake&lt;/a&gt; in the past is not enough.&lt;br /&gt;&lt;br /&gt;Now the Delicious toolbar is as clean as toilet water, annoying, but still can live with it. And guess what, the Awesome Bar is screwed too.&lt;br /&gt;&lt;br /&gt;And the worst thing is, I can&#39;t downgrade! It kept coming up with &quot;Invalid file hash&quot; error. Great!&lt;br /&gt;&lt;br /&gt;I&#39;m talking about the Firefox add-on, version 2.1.032.&lt;br /&gt;&lt;br /&gt;&lt;em&gt;Update: Managed to downgrade to 2.1.018 and it works perfectly.&lt;/em&gt;</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/2201635573543512894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/2201635573543512894' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/2201635573543512894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/2201635573543512894'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2009/03/delicious-screws-it-up-again.html' title='Delicious screws it up, again'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-7396374313002634273.post-1986739160251500633</id><published>2009-03-06T05:01:00.004-08:00</published><updated>2009-03-06T05:17:06.327-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="management"/><title type='text'>Why bureaucracy</title><content type='html'>&lt;blockquote&gt;... the purpose of bureaucracy is to compensate for incompetence and lack of discipline — a problem that largely goes away if you have the right people in the first place. (&lt;a href=&quot;http://www.amazon.com/Good-Great-Companies-Leap-Others/dp/0066620996&quot;&gt;GOOD TO GREAT - Jim Collins&lt;/a&gt;)&lt;/blockquote&gt;&lt;br /&gt;I&#39;ve never thought of it that way but it makes a lot of sense. Bureaucracy seemed to me like something that naturally evolves to manage people, especially many people. And now I know the why.</content><link rel='replies' type='application/atom+xml' href='http://codeftw.blogspot.com/feeds/1986739160251500633/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment/fullpage/post/7396374313002634273/1986739160251500633' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1986739160251500633'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/7396374313002634273/posts/default/1986739160251500633'/><link rel='alternate' type='text/html' href='http://codeftw.blogspot.com/2009/03/why-bureaucracy.html' title='Why bureaucracy'/><author><name>Unknown</name><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>