ARCHIVE: February, 2007

SG EntrepreneursI was just back from my hometown a couple of days ago, and in the midst of catching up with a project dateline after the no-working mood celebrating Chinese New Year (CNY) in Indonesia, I was fortunate enough to be interviewed by Bernard Leong, from SG Entrepreneurs.

For the rest of the interview please click here. Thanks to SG Entrepreneurs. And I know it’s a bit late, but still, Happy Chinese New Year to all!

I got a mail last night, a short email from a close friend in Indonesia. She started her line with, “[name]’s mum has just passed away. …”, and ended it soon with two lines of Buddhist chants, “Gathe gathe paragathe parasamgathe bodhiswaha….; sadhu….sadhu…sadhu.., which I did not understand; but I know they are usually said when someone has just passed away.

She said the same chants when her mum passed away some years ago. The years passed so fast; I lost count when I tried to recall how many years have passed.

[name] was our close friend too, she was my wife’s best friend, one of a few whom my wife can share her secrets with. She got married a few years ago, she met her husband in the university, and she has an adorable little daughter.

My last trip to Indonesia, I stayed a few nights at their house, they had just moved in to their new house.

One evening, we had a small reunion at their house, a few of us, friends from yester-years back in the high school, met. We had a simple steamboat meal; her mum dropped by to help out, she fried our favourite pandan fried chicken; we ate, we joked, we laughed, we had a good time together.

That evening, the house was rowdy, rowdy with laughters, rowdy for good, and good for the new house. They said the rowdiness would help to chase the evil spirits away and bring luck for the new house owners. But luck is not even close this time.

That was just last year when I went back to Indonesia to celebrate Chinese New Year (CNY).

Next week, my wife and I are going back home for the same reason. But this year and for the years to come, auntie will no longer be there for us, we all are going to miss her.

Life is indeed short. Sometimes, when we are working so hard, leaving us with no time for our family and ourselves, hearing news like this, makes us wonder why we are doing all these for; if all things are going to lead to the same path, death, and death can be so soon.

I remember there is a quote that I like very much. I found it nicely framed, and placed neatly in a drawer when we just moved in to a new place back in the college; as if the previous owner purposely left it there for us. I hanged it on the wall in our study room, and I always loved to read it every morning, because it reminded me that:

Today is the beginning of a new day.
God has given me this day to use as I will.
I can waste it … or use it for good.
But what I do today is important because
I am exchanging a day of my life for it.
When tomorrow comes,
This day will be gone forever.
Leaving in its place
Something that I have traded for it.
I want it to be gain and not loss,
Good and not evil,
Success and not failure,
In order that I shall not regret
The price that I have paid for it.

– Unkwown

So you heard of Ruby On Rails (RoR), watched a 15 minutes screencast. And you kind of liked it. You tried coding ‘Hello world’, and you said, “Hey, this is easy”. You thought you should push yourself and try out a more complicated stuff, stuff real developers do.

You wanted to create a few standard panels on your home page, because almost every site you visited lately have panels on their homepage. You wanted each panel to have its own header and footer, probably something like this:

  <div class="panel">
    <div class="header">Panel Name</div>
    <div class="body">Some content here....</div>
    <div class="footer">Panel Footer</div>
  </div>

And you did it real fast, you were done with 6 panels, 2 on each column for a 3-column layout in 2 minutes. But… hm… you did not like your codes, because you see a lot of repeated <div> elements.

You remembered Ruby programming language advocates Don’t repeat yourself. You are a smart guy, you found a solution in no time, “Why not create a helper ‘panel’ method?”“. Then you can do something like this in your RHTML template file.

  <% panel (:header => 'Panel header', :footer => 'Panel footer') do %>
       Some content here...
  <% end %>

That surely looks more beautiful than the codes above. You started to love RoR even more, but… when you tried to create the helper method, you bumped into some problems.

   class ControllerHelper
       def panel(options={}, &proc)
           # How to add panel header <div>s?
           
           # Generate content
           yield 

           # How to add panel footer <div>s?          
       end
   end

You were a Java web developer, your first instinct is to find the response outputstream. You found the closest match, 'response.out' but it did not return the template output, instead it passed you a standard output.

You read about render :text or render :inline, you tried them too, but they throwed an error saying that you should not call render statement more than once.

You asked uncle Google for ‘rails response outputstream’ and you tried other questions too, but you could not find an answer.

You were getting frustrated, but you thanked God that people still use Internet Relay Chat (IRC) these days, and you found #rubyonrails channel flooded with people. You asked your question, but no answer, you asked again, and again, no answer. Frustrated, tired, and dehydrated, you started to hallucinate that you probably was a ghost, you saw your own message, but others did not.

It got nasty this time, you started screaming words you did not want your mum to hear, ‘WTF’, @#%@$%^*!!!.

And your did not love RoR anymore.

By luck, fate, chance or whatever it was, you probably found this page, coz there was another guy like you, faced a similar issue, he found a solution, and he shared his solution. He said you probably want to do it this way:

class ControllerHelper
     def panel(options={}, &proc)
          # add panel header to current template IO stream
           concat("<div class='panel'><div class='header'>#{options[:header]}</div><div class='body'>", proc.binding)
           
           # Generate content
           yield 

          # add panel footer to current template IO stream
           concat("</div><div class='footer'>#{options[:footer]}</div></div>", proc.binding)
       end
end

And it worked like magic, you started to read more about ActionView::Helpers::TextHelper#concat, more about Binding, and you started to understand that RoR behaves differently in this aspect, coz the RHTML template file is compiled by ERB library, and concat method helps you to retrieve the RHTML output sting buffer through the ‘Binding’ object and the variable _erbout.

Shortly after, you understood more about Ruby and RoR, and your love for Ruby and RoR started to grow again. You called it a day, a happy man because you found a solution to your problem.

You promised yourself that you would want to share solutions to problems you are facing in the future, just like what that guy did. And you hoped for a better world, a world where less of us have to say words our mum would not like to hear.

I don’t usually design logos, other than for my own business and application logos.

Having been busy coding for the last couple of weeks, my brain yearns to do something creative. So I took a break yesterday and designed a new logo for Indonesian Professionals Association (IPA), a pro-bono work that I have promised to do some time ago.

These are the two drafts that I’ve come out with, one has a more fun and fresh feel, while the other is more traditional, formal and sleek. Hope they’ll like it, probably still need to touch up a bit here and there.

IPA Logo 1


IPA Logo 2