Counting rows and modifying MySQL to work with Postgres or Heroku

Now I am moving on to Open Translation Project. I’ve done some translation work before, including one of Paul Graham’s essay – Why to not not start a startup. BTW, he finally made a link from the essay to my translation. I used Google Translate as base, but I couldn’t believe how bad the translation was. Yahoo’s Babel Fish was a little better, but not as much. That’s where I got the idea of creating this possibly massive project.

Anyhow, I wanted to find a way of selecting an article or blog that was translated the most. I had one model that stored basic information of original article/blog. Then its children are translations. So, I need to count rows of children with the same parent. In MySQL, I had the following statement in Rails.

@top_origs = OrigPost.find(:all,
                              :select => 'orig_posts.*, count(posts.id) as post_count',
                              :joins => 'left outer join posts on posts.orig_post_id = orig_posts.id',
                              :group => 'orig_posts.id',
                              :order => 'post_count DESC',
                              :limit => 5)

Continue reading

Post to Twitter

Duck Tape Programmer

I’ve first read Jamie’s response to Joel’s writing on him on Coders at Work. I didn’t think much of it, and then I had a chance to read Joel’s actual writing. It sort of coincided with another discussion I had with an aspiring entrepreneur I met yesterday. And I decided I like the term, duck tape programmer.

The aspiring entrepreneur I met had his opinion about certain Rails programmers, and that’s exactly who Joel described as “someone with a coffee mug”.  I don’t think it’s a matter of right or wrong, but about the whole approach towards programming. The entrepreneur said that he has met many smart programmers who can talk up the latest movement and fads in programming world, but when it’s time to deliver, they are stuck in their world, trying to come up with best looking code using the latest techniques. However, the kind of programmers most value to startups are those who just get things done.

Some of the cool things he said were,

Peter asked Zawinski, “Overengineering seems to be a pet peeve of yours.”

“Yeah,” he says, “At the end of the day, ship the fucking thing! It’s great to rewrite your code and make it cleaner and by the third time it’ll actually be pretty. But that’s not the point—you’re not here to write code; you’re here to ship products.”

My hero.

Duct tape programmers are pragmatic. Zawinski popularized Richard Gabriel’s precept of Worse is Better. A 50%-good solution that people actually have solves more problems and survives longer than a 99% solution that nobody has because it’s in your lab where you’re endlessly polishing the damn thing. Shipping is a feature. A really important feature. Your product must have it.

I think what Joel referred as duct tape programmers are hackers in Paul Graham’s definition. Just as I concur with Paul, I do with Joel on this. Hacker or duct tape programmer, I aspire to be the one who just gets things done.

I am going to buy that book, which has very similar cover as Founders at Work.

Sweet!

Post to Twitter

3D Printer for less than $2,000

My ingenious friend who has been building his own version of Segway finally got his own 3D printer working (based on open source project).

Best part? He is selling a complete printer (Not a kit!) for less than $2,000. If you want to build it yourself, you can always follow the open source project. But for rest of us who do not have enough spare time, this is the most cost effective way to getting hands on a 3D printer.

$1799 to be exact. Shipping is extra.

If you would like to order one, please send me an email at 3dprinter [at] yangtheman.com

Post to Twitter

How to integrate Clickpass (and OpenID) with a Rails app

I saw Clickpass in action at the Hacker News, and I thought it was another great way to reduce another login account. I wanted to implement it for my Open Translation project.

However, when I tried to find tutorials for using Clickpass with a Rails app, I couldn’t find any! How could it be! The pesudo code example Clickpass provided was for Java, I think, and thus it wasn’t any help to me. I was completely lost.

Then I realized that in the core underlying architecture of Clickpass is OpenID. Then it all made sense to me. I found a great tutorial on OpenID and Authlogic on a Railscasts episode (I am not using Authlogic for my site, though, but for the Open Translation project, I probably will.). So the following is a mixture of the Railscasts episode, ruby-openid gem, open_id_authentication plugin and Clickpass setup.

1. Install the gem and the plugin.

sudo gem install ruby-openid

Continue reading

Post to Twitter

Deploying a Rails app on Heroku (paperclip, gems, yml)

I just moved my PlaygroundsRUs site from AWS to Heroku, and I couldn’t be happier. My first full month bill from Amazon was about $75, and $74 of that (99% of the total cost) was for running an instance. Harlan told me about Heroku after he deployed his ForkThis demo on there.

Most of the transition was smooth, but there were a few hiccups on the way. One of them still hasn’t been resolved (one of the plugins is having conflict with PostgresSQL, which is used by Heroku). I will enumerate what I had to go through so that it might be easier for you.

1. Secret YAML files

I have a public GitHub account for deploying on AWS using ec2onrails. Since it’s public and anyone can see it, I had to omit sensitive .yml files in config directory that contained passwords and keys. It’s easily done by specifying those files in .gitignore and listing them in :nonvc_configs in config/deploy.rb used by ec2onrails.

I found out that for Heroku, the same can be achieved by creating another branch, including those files, merging with master, and pushing it to Heroku. So, the following lines should do the trick.

git checkout production
[remove those yml files from .gitignore]
git merge master
git push heroku production:master

Continue reading

Post to Twitter

SF Women 2.0 Startup Weekend Wrap-up

Last weekend, I attended SF Women 2.0 Startup Weekend. At first, I didn’t know what to expect, but I ended up having a blast. I wasn’t sure if I wanted to pitch my idea, but I decided to do it while taking a shower in the morning. No one ended up joining my team, and I think it was just wrong crowd to pitch an idea around solar industry. I ended up joining an eccentric geek, H@rlan Knighwood, and worked on his project, ForkThis.  He coined it “Massively Parallel Creative Collaboration Engine”, which sounded like a title of a Ph.D. thesis. We had four core members and two floaters, and one of the member and I came up with gentler, funnier explanation, Friendly Online Rapid Kollaboration. What he has is a really cool idea. Anyone can start an idea, and anyone else can take the idea and “fork” it. After many forks, original forker can see what the differences are (similar to diff in unix-like OS) and accept/reject them and update the original idea. The team talked about different business models, but my personal opinion was that first focus should be to make it free and get as many as users possible. A few obvious options would be charging for private collaboration (Github) or charge for packaged solution (Zimbra). Anyhow, over the weekend, I added external forking – scraping external site’s page and creating a new fork – and twitter integration – option to tweet a new fork. Harlan worked on creating javascript snippet for website owners to copy and paste to their sites and massaging format after scraping.

Overall, it was a really cool experience. About 170  people showed up and 38 people pitched their ideas. 100’s of people getting together in one place, some pitching ideas, forming instant teams, and creating product/service and basically starting a company in 54 hours!  It just can’t get any cooler than this. Startup Weekend takes a place in many other cities (not all of them simultaneously), but the turn-out in SF should top the list. There are just so many interested in starting a company.

The pitches were also quite interesting, too. Some outrageous, some out of this world, and some really useful. Those with familiar concept (web 2.0, social networking, and twitter) were able to form a team easily. On the last day was presentation and demo, and the one that looked coolest was Foodspotting. They came with something that was already in progress, and thus didn’t start from the scratch at the event. To be fair, Harlan already had working demo he came in, too. However, Foodspotting was probably the most stunning visually. All their graphics were all slick and looked very polished. Whoever there designer was, s/he was awesome. One of the judge panelists pledged $5,000 to Foodspotting in funding before he left.

My philosophy around web sites was functionality/simplicity first and looks second. Perhaps I should think differently about that?  Users are humans, and I think it’s something you can’t get away with. Humans are naturally drawn to beautiful things from building to opposite sex. Having an awesome designer is definitely an asset.

Anyhow, the whole 54-hours took me back to college years. Teams of people working on interesting stuff, friendly people willing to answer and help others – not just team members, and overall just aurora of creativity, drive and affinity. Again, I had a blast and I wish I can help host one in Korea as well.

The following is a slide of pictures I took at the Startup Weekend.

Team Members: Harlan Knight Wood, Yang Chung, Tee Chapple, Toya Thomas-Cruz, Olivier Minkowski, John Weiss

Johny and I are interviewed at 8:18 mark

Post to Twitter

왜 창업을 해야 하나? (Why to Not Not Start a Startup)

내 가 Silicon Valley에 온 이유는 high-tech회사를 창업을 하고 싶어한 이유였다. 거의 nothing에서 something을 만들어내고 부를 만들수 있다는 것이 참 묘한 매력이 있었다. 하지만 창업에는 marketing이나 영업에 경험이 필요하다 생각하여, 그쪽으로 career를 바꾸었으나, Paul Graham의 essay를 읽고, 그가 하는 Y-combinator라 하는 incubator의 한 leader이자 Paul의 아내인 Jessica Livingston이 지은 Founders at Work라 는 책을 읽고는 이제서야 다시 software developer로 다시 career를 바꾸려 한다. 거의 모든 성공적인 high-tech회사들은 engineer가 시작했다. 하지만 벌써 가족이 있는 난 너무 늦은것 같다. 하지만 다른 젊은 사람하나라도 이 글들을 읽고 성공할 수 있으면 하는 것이 나의 바람이다. 번역을 하면서 다시 essay를 읽었는데, 한국과 미국의 문화적 차이를 확실히 느끼게 하며, 왜 한국에 startup회사들이 많이 없는지 알수 있을것 같다. 참 안타까운 일이다. 하지만 이 essay를 쓰는 이유는 독자 중 1%만 창업을 하고 성공해서 한국의 startup 문화를 바꿀수 있으면 하는 바램이다.

이번 essay를 시작으로 Paul Graham의 많은 essay를 한글로 번역할 예정이다. 이미 Paul Graham에게는 허락을 받은 상태이다. Paul Graham은 Viaweb이라는 최초의 application service provider software을 lisp언어로 써 고객이 자신의 e-commerce site을 짓고 운영할 수 있게 했다. 나중에 Yahoo에 팔아 나중에 Yahoo! Store이 되었다. 그후 Y-Combinator라는 incubator회사를 만들어 많은 web 2.0회사를 투자헀고, 조언을 해 주었다. 내 개인적으로도 최고로 존경하는 사람이다.

왜 창업을 해야 하나?

2007년 3월

(이 에세이는 2007 년 Startup School과 버클리 CSUA에서 발표를 바탕으로 기고했습니다.)

지금은 Y-Comibator의 성공율을 측정 할 만큼 운영해 왔다고 생각한다. 2005 년 여름에는 8개의 회사가 있었다. 그 중 최소 4개는 성공적이었다. Reddit과 Infogami는 합병했고, 또다른 회사가 합병이 되었으나, 말 할수는 없다. 또 다른 회사는 너무나 잘 돼서 원하면 10분안에 인수될수 있는 Loopt이다.

그래서, 처음 여름에 시작했던 창업자들 중에 반정도가 그들의 기준으로 봐서는 부자가 되었다. (한가지 배운점은 부자의 종류가 여러가지 있다는 것이다).

그러나, 우리의 성공율이 항상 50%일 것이라고는 장담을 할 수 없다. 처음은 예외일 수가 있다. 하지만 우리는 항상 이야기하는 10%의 성공율 보다는 잘 할수 있을것이다. 한 25%정도는 안전한 숫자로 생각된다.

실패한 창업자들도 그렇게 나쁜 시간을 가졌다는 생각을 하지 않는 듯 한다. 8개 회사 중 3개는 죽었을 것이다. 그 중 두 개는 여름 끝에 다른 일을 찾았다. 그들이 큰 상처를 입었다고 생각하지는 않는다. 가장 상처를 많이 받았을 회사는 일년 동안 열심히 일했지만 Google Calendar에 밀린 Kiko이였다. 하지만 끝은 행복하게 되었다. eBay에 100만 달러에 팔았기 때문이다. Angel 투자자들에게 돈을 돌려준 이후 그들은 한 1년 동안의 연봉 만큼을 건졌다.[1] 그 이후 그들은 바로 새롭고 더 재미있는, Justin.TV라는 회사를 창업했다.

그래서 여기에 더욱 놀라운 통계가 있다: 처음 창업자들은 아무도 고통적인 경험을 하지 않았는 것이다. 여느 startup처럼 좋은 일과 나쁜 일이 있었지만, 아무도 직장에 다니는 일과 바꾸지는 않을 것이라고 생각한다. 이 통계는 예외가 아닐 것이다. 장기적인 성공율이 무엇이든지, 일반적인 직업을 갖고싶어하는 창업자는 아무도 없을 것이다.

그럼 나에게 가장 큰 미스테리는, 왜 더 많은 사람들이 창업을 않하는 것일까? 거의 모든 창업자들이 일반 직장을 싫어하고 높은 비율이 부자가 되는데, 왜 모든 사람이 창업을 하지 않을까? 많은 사람들이 자금신청을 수천개를 받을 것으로 생각하나, 사실은 수백개에 그친다. 왜 더 많이 신청하지 않을까? 창업되는 회사가 꾀 많은 것 같지만 창업에 필요한 기술을 가지고 있는 사람들에 비해 작다. Programmer의 대부분이 대학 졸업 후 평범한 직장을 찾아, 그 곳에 머물고 만다.

사람들은 자기 자신의 이익과 반대로 행동하는것 같다. 왜 그럴까? 답은 있는것 같다. Y-Combinator가 벤처 자금 지원 절차의 매우 시작에 있기 때문에, 창업에 대해 불확신이 있는 사람들의 심리에 대해서는 알수있는 이는, 우리만큼 좋은위치에 있는 회사는 없을 것이다.

불확신이 항상 나쁜것은 아니다. 당신이 창업을 생각하고 있는 hacker (Paul Graham의 hacker는 보통 사람이 생각하는 hacker가 아님. 그의 hacker는 어떤 수로든, 어떻게든 많들어 내는 programmer임) 라면, 불확신은 지극히 당연한것이다. Larry와 Sergey도 Google시작전에, Jerry와 Filo도 Yahoo시작전에 똑같이 불확신을 가지고 있었다. 사실은 성공적인 startup들의 거의가 너무 확실한 사업자들 보다는 불확실한 hacker가 시작하였다.

이것들을 증명하는 몇 가지 증거가있다. 우리가 투자하고 성공한 startup들 중에 많은 곳들이 거의 마지막순간에 자금신청을 하기로 결정했다고 했다. 일부는 마감일 몇 시간전에 결정 하기도했다.

불 확실성을 다루는 방법을 구성 요소로 분석하는 것이다. 누가 뭔가를 꺼려 대부분의 사람들은, 약 8 여러 가지 이유가 함께 머리를 혼합되어서 어떤것이 가장 큰이유인지 모른다. 어떤 것은 정당하고, 어떤 것은 가짜이지만, 상대적인 비율을 모른다면 전반적인 불확성이 정당한지, 가짜인지 모를 것이다.

그래서, 난 사람들의 창업을 꺼려하는 요소들을 나열하고 어떤 것들이 정당한 것인지 설명할 것이다. 그럼 창업을 생각하는 사람들이 자신의 감정을 점검할 수 있는 체크리스트로 쓸수 있을것이다.

내 목표는 당신의 자신감을 높이는 것이다. 하지만 이것은 보통 자신감을 높이는 것과는 두 가지 점이 다르다. 첫째, 나의 동기는 솔직함이다. 자신감을 높이는 사업을 하는 사람들은 사람들이 그들의 책을 사거나 당신이 얼마나 위대한가를 말해주는 세미나에 참석하면 벌써 목표를 달성한 것이다. 창업을 해야 되지 않은 사람을 장려하면, 내 인생은 더 피곤해진다. 너무 많은 사람들을 Y-Combinator에 신청하도록 권장 하면, 내 일은 더 많아지게 된다.

둘째는 나의 방법이다. 난 긍정적인 대신, 부정적일 것이다. 할수 있다고 말하는 대시, 난 당신이 창업을 하지 않고있는 이유를 보여주고, 왜 거의 모두가 무시되어야 하는지 말해주겠다.

그럼, 우리모두가 가지고 태어난 것부터 시작하겠다.

Continue reading

Post to Twitter

How to integrate Facebook Connect with a Rails app

Update: I have written up another post for using Devise and Omniauth, and you can find it here. Facebooker is no longer maintained.

Top of my to-do list was to integrate Facebook Connect with my Rails app, since 1) there are A LOT of people using Facebook and 2) having to register to post or edit could be an obstacle in getting more users to use my site.

I looked on the web for a while, and found a great example by Stuart Eccles at Made by Many. It’s an awesome tutorial, but it’s for restful_authentication. I don’t use it, so I had to modify it a little bit. Also, I added a step to ask a user to pick a username. So the following instruction is basically modification of Stuart’s.

Without further ado, let’s begin.

1. Setup Facebook Application page

1.1. Go to this page, and enter a name for your application. I named mine “Playgrounds_R_Us”.

1.2. Make a note of Application ID, API Key, and Secret. You need it for facebooker.yml later.

1.3. Next is Authentication section. Here what’s important is Post-Authroize and Post-Remove Callback URL. They refer to a web page a user will be taken to after logging into and logging out of Facebook account. While testing, I left it at “http://127.0.0.1:3000″.

1.4. I also used the same URL (http://127.0.0.1:3000) for Canvas Callback URL in Canvas section and Connect URL in Connect section.

1.5. Then you are pretty much set with configuration on Facebook side.

2. Get facebooker plugin and install it. From your rails app root directory,

ruby script/plugin install git://github.com/mmangino/facebooker.git

Continue reading

Post to Twitter

Why the tagline, Life hacker?

People often ask me, “what’s up with your tagline, life hacker?”

It has to do somewhat with my personal philosophy as well as Paul Graham‘s (my idol) definition.

Paul Graham said in his essay about Hackers and Painters,

What hackers and painters have in common is that they’re both makers. Along with composers, architects, and writers, what hackers and painters are trying to do is make good things. They’re not doing research per se, though if in the course of trying to make good things they discover some new technique, so much the better.

Over the course of my career, I have realized that I really enjoy building and tinkering with things. I should have realized this much earlier, but my desire to go back to programming and actually enjoying building web applications made me realize it. Ever since I was young, I really enjoyed building different things like AM/FM radio from a kit, model airplane, propeller-rubber airplane, etc.  I think that’s why I also enjoyed being a product manager, building a product someone actually finds useful. I think one of the highlights of my career was when we delivered a product as promised and more on time, the customer was actually surprised. It’s so prevalent in high tech industry for a product to be shipped late, being on time is a surprise.

I also have a sort of utilitarian approach to life, where I hate extra things that just get in the way of achieving a goal such as stupid, bureaucratic processes big companies put in place. This is why I love open source. If I need to get something done, the chances are I can find a tool to do it in open source. Like at my previous company, which was quite small, when we wanted a way to communicate with everyone and also have repository of information such as customer requirements and feedback, I just installed Drupal CMS on a unused PC and configured in a day or two. It actually came about because I wanted a simpler way of sharing training video with everyone. I certainly didn’t want to put it on share drive and have people download the huge file so that they could watch it. The best way was streaming, even internally, and converting to and uploading a flash version of the file on to Drupal seemed to be a good answer at the time. And we just started using it for internal communications portal. It is unthinkable at a company like Samsung or AT&T (I used to work at both companies).

My definition of hacking is not hacking in Hollywood‘s or security term, but just making things work and getting things done. I tell people I hack codes. I look at examples, see how they work, and make my own changes to fit my own needs. This is again why open source is so beautiful. I am not at the point of being able to contribute to open source world, but I hope I can some day. Internet is a wonderful place for hackers (this time it means for both my kind of hackers and also Hollywood’s hackers). My definition of hacking also aligns with utilitarian approach. Taken to extreme, it could mean that you can whatever you can, ethical or unethical, to reach a goal. But, I think majority of people including me have good sense of morals that prevent them from hurting or stealing from others. I think and I hope.

At any rate, I feel like I am going back to my root by hacking and building web applications that I think would be useful, not just to me but hopefully to many others, too.

Post to Twitter