Mr. Four Eyes

08/07/2009

It was in the early year of my undergrads study when I realized that I can’t do long distance reading. At those days, we got a course on a big hall with more than a hundred students in it, looking at small white boards at the front of the class. At closer range than this, my brain could still run text recognizer to determine what sentence is written. But at this big hall, I barely see nothing but a black curve in the white.

So then, I got ophthalmologist checked my eyes. The result: my right eye is -0.5 and my left is -0.25. Not too bad. It still small numbers compared to the others. Because of this, I rarely used my spectacles.  And it has been continued until just now.

Right now, almost five years after that. Actually I just feeling my eyes were still okay. I could still spend most of my time in front of computer with no problem. And there’re no classes yet. One that just bothered me is just that sometimes I must close my distance with monitor screens to read. So I decided to check my eyes again.

The result was quite surprising. My right is -0.5 and my left is -1.25. The person who tested my eyes said that the result wasn’t bad after all these five years. Yeah, not bad for a person who spend almost 15hrs a day in front of his computer. But because of this increase, I have decided to use my spectacles. Just using it make me feel 200% smarter than before, he3..

:cool:

Dang!

05/07/2009

I don’t know why, but I’m feeling lack in ideas lately. For your information, last month I only posted one article, and nothing more. I dunno what happened, but I hope I can overcome my laziness in writing then write a better post in the future.

Last, I hope this is not the last post of this month.

Why Generate Database Keys?

09/06/2009

Howdy.

Not so long ago, I created a GUI for data storage using Java and of course JDBC. I followed a tutorial about how to insert database records to the database table. The tutorial said that before we’re inserting new record to the database, we should generate unique key as record identity. The generation process handled by Java code. The tutorial use System.currentTimeMilis() function to create the key. So, the code will be look like this:

//set new id
Number time = System.currentTimeMillis();
Integer id = (time.intValue()/10000);

The generated key then being inserted to the database.

As you may realized, database systems usually have their own key generation technique. For example AUTO_INCREMENT attribute in MySQL. I followed the tutorial and sure it works. But, I tried database-generation key, and it works too. So, why we should bother generate our own keys?

The O’Reilly Java Author gave an explanation about that. They said:

However, using the supported key generation tools of your database of choice presents several problems:

  • Every database engine handles key generation differently. Thus, it is difficult to build a truly portable JDBC application that uses proprietary key generation schemes.
  • Until JDBC 3.0, a Java application had no clear way of finding out which keys were generated on an insert.
  • Automated key generation wreaks havoc with EJBs.

I got the point that the application should be portable. Who knows that someday we’ll migrating from one database systems to another? So the database generation key will be hard to control. 

Another detailed answer came from Scott Selikoff. He wrote a complete article about database key generation and gave an example:

Now, let’s say a user is in the process of creating a new record in your system. For each user record, you also have a set of postal addresses. For example, Bob may be purchasing items on NewEgg and have a home address and a work address. Furthermore, Bob enters his two addresses at the time he creates his account, so the application server receives the information to create all 3 records at once. In such a situation, you would normally have 3 records: 1 user record for Bob and 2 address records. You could add the address info in the user table, although then you have to restrict the number of addresses Bob can have and/or have a user table with a lot of extra columns.

Inserting Bob into the user table is straight forward enough, but there is a problem when you go to insert users into the address table, namely that you need Bob’s newly generated User Id in order to insert any records into the address table. After all, you can’t insert addresses without being connected to a specific user, lest chaos ensue in your data management system.

The problems will arise in complex database relationship. As we don’t know the generated key, we couldn’t set the foreign key of corresponding tables. I didn’t realize this because the GUI I made was using a simple database design. Maybe with no table relation at all.

So, I got my question answered. Do you have another answer for my question? Feel free to share.

Aggregator Adventures

27/05/2009

Howdy.

One day, when I surfed the web, I found an interesting site. This site has function like a normal blog, but the post written there was posted from various blog sources. Later, I knew that this blog is called aggregator. How this blog aggregator works? It works by collecting RSS Feeds from various blogs registered. The feeds then posted as normal posts in the aggregator. One of the differences is the article title linked to the “real” blog source.

Ilkomerz 41 Blog Aggregator

Ilkomerz 41 Blog Aggregator

When I knew that some of my friends also have their own blogs, I started to thinking about building this aggregator. The site that I found earlier is powered by Planet, a Phyton-based feed reader. I tried it, and ended up with failure. I just couldn’t configure and tested it properly. I didn’t have Internet connection and didn’t familiar with Phyton at that time. So, I tried to find alternative. I found WP-o-Matic plugins for WordPress. So I installed, asked my friends permission to grab their feeds, and hosted it. I called it Ilkomerz 41 Blog Aggregator.

Another problem arose. This plugin will automatically read and parse feeds from its registered blogs every amount of time. To make this fetching run automatically, it uses cron job. The WP-o-Matic has two options of cron job. The first one is UNIX cron job run by web hosting. Free hosting, like the one I use, doesn’t give cron job feature. So I go to the next option, web cron. It will automatically calling fetching script on the hosting.

I use the web cron option for some months until suddenly the aggregator was down. Well, it worked again when I send a support ticket to the hosting provider. I know that maybe it’s not because of the web cron spending too much resource. I suspected that because of the multi-user nature of the aggregator, the blog automatically sending email to the blog writer. The hosting may called it spam. So I killed the auto-email feature. I also shut down WP-o-Matic and switched it to manual fetching. I know that maybe it’s not because of the WP-o-Matic’s web cron, but I don’t wanna take the risk losing this blog for the second time.

Manual fetching was a pain. I must open my Google Reader, find if my friends have new post, and then login to the aggregator, fetching the post, and the post will showed up. I was thinking, there must be a better way to do this. Accidently, I found out that there are some webs that provide free cron job. One of them is SetCronJob. This site can calls the cron script url of the aggregator. So, I tried it yesterday. I registered the aggregator to the site. And now, my aggregator works well automatically. I don’t know what will come in the future, but I have a high hope for SetCronJob.

Do you have another opinions or experience? Feel free to share it.

Short Break

24/05/2009


Nobody likes you when you’re 23
And are still more amused by TV shows
What the hell is ADD?
My friends say I should act my age
What’s my age again?
What’s my age again?

(What’s My Age Again by Blink 182)

It has been a year since I paid for this domain. Hopefully with this new domain (at that time), I can improve my writing skills alongside with my own brand. I always wondering how it feels like if I had my own site. And now I have it, at least for the next two years (I’ve paid for the bill, Alhamdulillah..). I just can say that all the experiences I got from configuring this own site were totally awesome. I never imagine that there are so many new stuffs when I was digging deeper into this “blog development”. And there’ll be a lot more waiting for me.

I have my plan for the next year. I’ll strive to achieve it. Here they are:

Merchandise

I have a plan to give away merchandise to all of you, my readers. I always want to give a sticker with sidudun logo. Just like thedailywtf.com free sticker. I’m still looking the best place to print it. I have asked some of my friends, and they said that they love the idea. So just wait and see.

Going to college, Again?

Yap. I like to learn something new. By the time I wrote this, I have been registered as a post graduate student in one of university (in my country). I’m still waiting for the confirmation letter. And if it has confirmed, I will preparing the necessities and going to the college.

Looking for a job?

Yeah. As a matter of fact, right now, I’m unemployed. It’s not because of the global crisis. Nope. I just didn’t apply to anywhere, yet. I was on medication in this last six (or seven?) months. And I just spent my time blogging, babbling, and learning what I want to learn. Most of my friends have been enrolled as employee at various company (mostly in IT section). Here the jealousy comes to me. I want to get a job too. Maybe I’ll find it on my college time (Amien..). Or maybe you can help me? :)

Themes, themes, and more themes..

I really got into blog design. I started this blog theme creation about some months ago and I got addicted. I know that my theme maybe not the best theme in the world. But, I think they are good enough for me. Do you agree with me? I’ll still create new theme, just filling my 10,000 hours of experience points.

What else? One thing for sure, I’ll keep on blogging. My motives are clear: for fun and fame. So see you around the blogosphere…

P.S. 23 minutes before 23. I wanna be a better man.

Page 7 of 17« First...5678910...Last »