Wednesday, July 22, 2009

 

STREET FIGHTER IV VIDEO APP


Wednesday, March 21, 2007

 

Ruby on Rails : Mongrel cannot start in production mode with plugins

This problem has been annoying me for a whole night, hope that i can share these with you guys and save others time in deploying their rails app.

Problem:

My problem occur while i was trying to deploy the apps on a Ubuntu 6.06 (X86_64) on a Xeon machine.

After deployed the apps to this server, my app run smoothly in development mode, but whenever i want to start the webrick/mongrel in production mode, it hits the segmentation fault. It was scary... it was the 1st time i saw "segmentation fault" after i graduated from my university....

Troubleshooting Details:
(** for those dont want to know the details and would like quick solution skip this part)

I tried to do the same on development server which was an i386 machine, it doesn't repro, so i conclude it only happen in x86_64 machine, as i got my dev machine in nearly the same setting except it is i386 machine, which i can get the webrick/mongrel started smoothly in production.

Then i tried to trace the code by the "segmentation fault" error, which pointed me to the Line 99 of :
/usr/local/lib/site_ruby/1.8/rubygems/custom_require.rb
I narrowed down the problem into the line of code:

Dir[glob].select { |f| File.file?(f) }.empty?


where i traced it hits error when:
glob = "/usr/lib/ruby/gems/1.8/gems/rails-1.1.6/{lib,bin}/rails/technoweenie{,.rb,.so,.bundle,.dll,.sl}"

i can repro this in "script/console", i feel puzzled, it seems like a simple search in directories.. i can't imagine whats going on there leading to segmentation fault...

Anyhow, i concoluded that it is somewhat related to my plugins from technoweenie, which is the "act_as_attachment" plugin, so i tried to remove plugins 1 by 1 and finally figured out there was 2 plugin which can both cause the problem individually, the other one is "calender_helper"

So i got frustrated again even i sorted out the source of problem... since my code somehow depends on these 2 plugin.. then, some more time are spent on Google, i finally tackled it without rewriting my code.

Solution:

Run a single line in the app directory:

rake rails:freeze:gems


It some how copied the rails code into the vender directory, and it seems that the problem has been solved, i can now start the mongrel in production mode smoothly.. Yeah~


Question:

Actually i am still puzzled why doing the "rake rails:freeze:gems" solved the problem, coz i am not quite sure what it does except copying the files.

On the other hand, the error seems to be thrown by a very primitive function of ruby
Dir[glob].select { |f| File.file?(f) }.empty?

I wonder if this is a ruby bug on x86_64 machine.... increased my fear in deploying the app on x86_64 ....


Server Config:
Xeon 3040
Ubuntu 6.06 (x86_64)

$>ruby -v
ruby 1.8.4 (2005-12-24) [x86_64-linux]
$>rails -v
Rails 1.1.6
$>gem -v
0.8.11

Friday, September 15, 2006

 

Google's Dev philosophy - a brief from Kaifu Lee's visit to CUHK

Today I went back to the CUHK (The Chinese University of Hong Kong) campus to attend several talks given by one of the hotest executive in China, Dr. Kaifu Lee from Google. While listening to his speech on googles dev philosphy, i was inspired and some confusion and questions arise out of my mind.

There is a term "20% time" in the Google R&D team, which means that engineers are authorized to spend 20% of their work time to work on stuffs they 'd like to, needless for their boss to issue any approval before they kick start, and that's an interesting policy which is new to those software company~ At least, i didn't regconize such policy in MS R&D...:P. And yes, they said that engineers are given the freedom to think and realize their thought which can improve the internet and in their broader term, to change the world. That sounds really amazing to engineers, isn't it?

And my picture of such scenario would be like, there are tons of idea floating on the Google's office, and amongst them, some of those good ideas become realized and now serving the ppls on the internet, or i 'd say serving the ppls in the world. So, my question is what is the vital characteristics for those ideas to succeed to become the one to be realized. I was really likely to ask such question today, but sadly i wasn't given such chance...and that is still a mist in my mind..

Another points that i am really agreed with them is "Don't monetize the idea too early", Yes, i know that, we should focus on the UI, robustness, stability, putting those software quality attribute in a higher priority then money, and yeah it sounds great!! But, what is meant by "too early" is the question i am or will be facing, i don't know, maybe it is a statement that can only be speak out from an executive from a gigantic company like Google. I can't imagine how i/we can survive without thinking monetization of the idea, and also i have to admit that thinking of money too early would kill the app. , but i think it is always hard to define what is meant by that "too early"

"Listen to the user", this is the most undoubted one amongst those, it is good to software dev., and i will be doing that on my project(s).

Wednesday, May 17, 2006

 

Adventure over the sausages and eggs

With the arrival of the digital world, the world starting to be filled with more and more sausages and eggs, peoples are getting more used to live with the internet, which deep into the core, are made up of the busy "1"s and "0"s travel around the world, that's how the name of this blog comes up.

As a web developer and user interface engineer,I will be digging into this sausages and eggs world, adventuring into what's so great and what's so bad. I will be using this blog to capture every moments of this journey, and I have a little wish that this blog can contribute some tiny parts of this sausages and eggs world.

Welcome abroad!
|O||O||O||O||O|

This page is powered by Blogger. Isn't yours?