Phelio Gnomi

My words from my mind

Monthly Archives: May 2011

Soon, everybody will carry a tablet

I still can remember when mobile phones or cell phones started to be so popular. Nokia, Sony Ericsson, Samsung and many others. Model after model every few weeks or months keep popping up to the market. I can’t even afford one that time, and we actually share one Nokia 3210 for the whole family. But now, every one of us has at least one.

Now, people are crazy about tablets. It was probably started by the Apple iPad and the Samsung Galaxy Tab, now everybody is making tablets. Not to speak about touch screen phones, which is quite common already and almost everybody will carry one.

So, looking back at the history, soon enough, tablets will become one of the ‘must have’ along with your touch screen phone and a notebook.

What does it have to do with web development? Good question Fendy!

It was the battle of touch screen phones (and probably still ongoing) and now the tablets. They are quite similar, but tablets are normally bigger. It made a major swift for mobile websites since the appearance of iPhone. From the so limited version of websites (before iPhone) to some optimized for touch screen websites like one that Facebook and Twitter have. But this might not have the same impact with the birth of tablets era.

First of all, they are all mobile devices. Luckily enough that the tablets has web browser that support full-featured websites (support all the features that computer can display). But there are major changes in terms of user interaction. Just like touch screen phones, tablets’ main input is the touch screen. Features like sliding and multitouch are common. While in normal computer, you don’t normally use your mouse to slide the pages, or have multiple mouse pointer that can touch multiple places at one time. Tablets don’t normally have keyboard. It uses virtual keyboard which is not always available. It will only appear when you need it. So, keyboard shortcuts might not a good idea.

Some mobile web browsers doesn’t support certain features. For example for Safari in iOs (iPhone, iPad and iPod touch), it doesn’t support Flash. So, if you wan’t your websites to be viewed nicely on iPad, you better don’t put any flash content.

More devices means more thing to test. It was already quite frustrating to make a website that can be viewed nicely in all web browsers. With the trending of tablets computing, it means many more platforms to be tested on.

Some might prefer to maintain single design but optimzed for tablets, some keep many different versions, some may not even bother. For me, I don’t care much right now.


Rails Magic with Ajax

Without using any framework, it used to be a lot of lines (probably 50 lines) just to setup a AJAX connection. Adding the actual request, server handling and callback functions, it will end up another 10 or 20 lines per request. All added up to around 60 – 70 lines of codes at least for 1 request.

With jQuery, we can skip the connection setup part because it’s already included inside the framework. After that, you can construct the request just in 1 line of code together with the callback function. But the server handling is still up to you which is normally 5 – 20 lines depending on the language and the task. So, it’s about 20 lines in total.

Now, with rails, you can end up to less than 5 lines of codes. 1 (3 words to be exact) to AJAXify a request.

:remote => true

Just add these three words to your link_to or button_to methods and it will create the request already.

button_to 'add item', :item, :method => post ,:remote => true

Next, another 1 line to remind the server to treat it as an AJAX request by using


Add this into the corresponding controller action, in the response_to method call

respond_to do |format|
  format.html { redirect_to(store_url) }
  format.xml  { head :ok }

And lasty, you need to create the callback which is normally in javascript. First you need to create a js.rjs file in your views folder and name it as the action name. For example, if it’s for a create action, you will create a create.js.rjs file. Put the callback function in this file and you have a AJAX application running on your Rails.

Magic #2

We already saved up typing around 50 lines of codes for this. But Rails actually do more than our previous 60 lines of codes. It also handle the noscript for you. Which might end up creating another 10 or 20 lines of codes without Rails. noscript is codes or behaviors that happen when the user turn of javascript. So, if we don’t handle this situation, the whole application will just failed because AJAX is depending fully on Javascript.

So, just by writing around 5 lines of codes, we get :

1. Ajax request with callback and server handling.

2. noscript handling, which will works perfectly fine without javascript turned on.

Tracking Your Website Visitors

If you are running a website, and you want to know how many visitors are there, google/analytics is the answer. I use it even in my first blog I ever created 4 years ago and it’s really worth using it.

This tool will show you the numbers of visitors by days. It also tell you where are they coming from, how they ended up in your site, and how long they stay in your site. There are many more functions that you can explore yourself.

First, you kind of need a google account. Register one if you don’t have. Once you have a google account, you will have access to many other tools like gmail and adsense (which is one of the tools for your affiliate marketing).

After that, you will need to put a tracking codes in your website. Analytics will guide you how. You might need to wait for few hours or days before you can start seeing the tracking result. So, have fun and be patient.

Some blogging system might already provide you with its own tracking system. For example, it has its own site statistic that show you about the same information that analytics gives.

Falling in Love with Ruby on Rails

Ruby on Rails is clean, is beautiful, is fun, and all of all, she is magical. Wait a minute, am I committing adultery here? Gosh… I’m not married yet FYI. Don’t even have a girlfriend yet.

So here is the love story, if you read my previous post to Ruby from PHP, you will know that I’m currently on the journey of getting to know Ruby. I ended up meeting this girl called Rails, which is the Ruby framework for web development. By the way, her full name is Ruby on Rails. She is quite famous lately, so I believe you got to know her already.

This girl is very special, because in order to know her, you might need to read some guides first, which are specifically written to guides people out there, like me, to know her. Of course that is not the only way to know her. There are also many books written about her. Such a special girl. Therefore, I picked up one of the book that she recommended. Yes, she recommended herself on her website here. I forgot to mention that she’s also very kind.

The book is called Agile Web Development with Rails. It’s a great book, it guides you on creating a shopping site step by step. From product management page to catalog to the cart etc. This approach seems to works for me as I understand her a lot better now, though many times I still get confused with Ruby syntax.

Sometimes, I got scared. She’s so magical that I think she might be a witch. She can do many things so magically that I have no idea how she did it. Even though I sometimes describe myself as a wizard (which I think all programmers do, because we just types somethings and then something magical will happen on the computer), I feels that her magic is beyond magical. Probably I should describe her as the witch of the witches. Horrible description and she’s scary now.

Behind her magical power, there lies a truth. Once I understand the truth, I understand her. Therefor, I’m gonna finish the book first.

Affiliate Marketing? What the Heck is That?

My friend, who is an Internet Marketing victim, and also an enthusiastic person, recently introduced me to this phrase called the “Affiliate Marketing”. I’ve never heard of the word “Affiliate” nor how to spell it properly. But, I am actually one of the affiliates.

Affiliate Marketing (for me) simple means putting ads from other websites like Amazon, e-Bay or Google on your website. So, when your visitors click on the ads (from your website) and they happen to buy the product you are advertising, Amazon, e-Bay or Google will pay you commission.

So, this friend of mine started a website called It’s just recently published, so there is no much thing there yet. Just be patient and there will be things that will please your heart.

There are some tips on running this marketing. These tips are not from me. I read them somewhere and somehow will apply them in the future. And I am currently not an active Affiliates.

Draw visitor first

When I started a blog 4 years a go, I only have 3 or 4 posts by that time. I don’t have much things to post, so I only updates like once in a couple of months. But, there are google ads all over the blog. And my main visitor is myself and myself only. No one else.

So, don’t put any ads before you have visitors that really likes your website. Because, they will get irritated by the ads and feel like being spammed. They will probably never show up again.

Posts often

The mostly used methods in Affiliate Marketing is probably by creating a blog. There are plenty of free blogging services out there like and It’s very easy to start a blog, but it might be hard to keep it updated. Therefore, plan ahead on what you gonna do with your blog. See if you gonna have new things to share everyday. One of the example is to post pictures. You probably take pictures everyday. So, you gonna have plenty of resources to be posted. When you updates your website often, people will more likely to comeback to check for new things they haven’t read or see. So, this will create a returning visitors that will probably subscribe to your website as well. And hope that they will visit your blog everyday.

Linking and social networking

Search engines like Google, Bing and Yahoo!, they help you find what you needed. First, they will visits websites on the web, examine them, and put them on a ranking system. When you search on something, most probably you will find what you needed on the first page of the search (which are probably 20 results or the top 20 ranking). So, the higher your website ranking, the more likely people will find your website.

One of the criteria of search engine ranking is the amount of links from other websites that link to your website. If your website is good, people will put a link on their websites that link to your website. Therefore, the more links that link to websites, the higher your ranking will be.

One of the methods to create this linking network is though social networking. You probably have hundreds of facebook friends or twitter follower. By posting about your website/blog into facebook or twitter, you register a link on them as well. Your friends and follower might like your posts, and repost or retweet them, and therefore creating more links. In the other hands, you are also promoting your websites.

For more information, read more about SEO (Search Engine Optimization) and its various methods

Quality posts

A little market research might be required for this. Think about what are people looking for, what are their needs, and what are you capable of. Websites about “how to” are probably the most wanted one. People are looking for how to do this, and how to get rid of that. So, what is your field of expertise? apply them and see if you can share them with the world.

Don’t flood your websites with ads

You know that ads are annoying. I can’t stand of them. So, when I’m in a site, full of annoying and irritating ads, I will leave the site. So, even after you have a solid visitors group that visits your site everyday, they might just say good bye to you.

Be creative in putting the ads, keep the visitors as the priority, not the ads. There are many kinds of ads format you can choose from. There are vertical banner, horizontal, links only or flash ads etc. The most importantly, see how the ads fits on your site layout. Be careful not to irritate the visitors.

Sitting is Killing You

Why do you want to stand if you can just sit down. Standing is a punishment back in school. As a programmer, I might be sitting whole day. Probably the whole 24 – 8 hours of sleep – 1 hours of small walking. But people are claiming that it’s dangerous to be seated. Below is the nice illustration of the story.

Sitting is Killing You
Via: Medical Billing And Coding

Angry Bird Chrome? or Just Web Angry Bird?

AngrybirdsAngry Birds’ developer Rovio is really angry right because they just released its “Google Chrome” version few days ago. And it’s also Free. This news had made headlines in several places including Twiter and Yahoo.

The whole world is angry about it because they got to play it on a bigger screen (probably 21″ or bigger) and on their favourite web browser “Google Chrome”.

Well, I was one of the angry one that installed the app the moment I read about it. Amazing, I didn’t got the chance to play it. Wait a moment, I probably can load it on my iPod Touch. Why not? and that’s what I’m angry about right now.

First of all, I want to object that this currently angry-ing Angry Birds Chrome is not a Chrome App. It’s just a web application that is being marketed on Chrome Web Store.

Secondly, you can launch this Angry Birds in any web browser. Yes, I’m saying about Firefox, Internet Explorer and so on. And probably on iOS safari.

Apparently, there are two types of Chrome Applications. Hosted App and Packaged App. Angry Bird Chrome is a Hosted App. It means,

a regular web app, plus some meta data

while Packaged App is something you really need to download and install it on your chrome browser. One of the great example of Packaged App and my favourite Chrome App so far is The Fancy Pants Adventure.

edit iOS Safari can’t run this game because it’s a flash based. So sad..

to Ruby from PHP

I’ve been a PHP developer for years (well, around 3 years) and after reading so many bad comments on the web about PHP, I started to worry. I still love PHP though, but it’s not a crime to have another one to love. And by spreading love, we will learn more.

Picking up new languages doesn’t mean I will ditch PHP. I don’t think it will happen unless PHP die out. But probably will never happen as you still can see C around these days.

In my list is Java, Ruby, Python, and probably .Net especially C#. These are just a list, I don’t think I will be able to master all of them. But at least I will explore them all.

Let’s start from Java. I learned Java when I was doing my degree. So, it’s not a big deal for me to just pick it up again. Trying to do the similar thing I did perfectly well in PHP, I failed in Java. They are just different. Although I can still remember most of the syntax of Java, I have problem translating my PHP codes into Java. The problem is I can’t do associated array as easily as in PHP. It’s not hard, but I’m not familiar with it. So I gave up. Probably will come back next time.

Next is Ruby, browsing here and there, most of the talks are about Rails. But I want to start from Ruby. so I do.

Ruby is designed to be easily understood by human. The syntax is perfect just like spoken English. So cool that I can’t understand using my PHP mindset. Probably it was easier to learn C++ back then when I didn’t even know how to speak English well nor any holy languages called the programming language. Or am I too old to learn?

unless 10.is_a? Number
   put 10

The codes above is simple, isn’t it?. It is so easy to understand that I need to hit my head on the table several times to absorb it. Maybe I’m a fool, but this is the truth. When I read a code, I think in PHP language style, trying to get the TRUE and FALSE of the condition and then make decision. But when I first saw these lines, it took me to think for a while to apply my thinking style to this syntax. And this is just the beginning. I continue to read more about the syntax and I found this

def join( sep = $,, format = "%s" )
     collect do |item|
       sprintf( format, item )
     end.join( sep )

In my sense, this is a syntax error to have a double comma in a function declaration. End of story. But it’s not in Ruby… Game Over

Probably I should had given up, but Ruby’s uniqueness and differences from PHP that make me want to know more (not forget to mention that it’s also beautiful). It sounded like a love story now.

To learn Ruby, simple visit its website. You will find a lot of getting starter tutorials which are boring and some are fun. There is one that is ridiculous because it’s between telling a story and teaching Ruby. But it’s fun to read.