Monday, August 27, 2007

MERecorder

EDIT 20210416: the download files were lost when I moved the site from self-hosted machine to Blogger. Found the jar file from old backup though.

Repost. Lost this article when my HD crashed

The built-in voice recorder of my N80 phone is a bit crappy. Why do they limit the recording to just 1 minute?

Anyway, this is simple J2ME program that utilize the JSR 135: Mobile Media API to handle the recording part. The audio format is in AMR (change the source code if you want WAV). But too bad that I didn't sign the jar :P. So every time it starts to record, the system will prompt you for the permission of accessing user data and the multimedia devises etc.




Disclaimer: This application is for fun only. No guarantee whatsoever. Use at your own risk.


The application is available for download here. The source code is also available.

Saturday, August 25, 2007

the catcher in the rye

just finished the book... as expected, blue as hell... and found i really resemble the main character... yellow, childish, like to day-dream...

hope i won't end up in an institution eventually...

Anyway, I keep picturing all these little kids playing some game in this big field of rye and all. Thousands of little kids, and nobody's around - nobody big, I mean - except me. And I'm standing on the edge of some crazy cliff. What I have to do, I have to catch everybody if they start to go over the cliff - I mean if they're running and they don't look where they're going I have to come out from somewhere and catch them. That's all I do all day. I'd just be the catcher in the rye and all. I know it's crazy, but that's the only thing I'd really like to be.

~J.D. Salinger, The Catcher in the Rye

Wednesday, August 22, 2007

有時…

……做錯左,咪試下搵辦法去改囉。朋友,千其唔好俾自己再錯落去呀,唔係的話,就真係「一錯再錯」嫁喇。

互勉之~~

Tuesday, August 21, 2007

LCD Panel

Lost similar article when the server crashed. Just a quick recap before I forgot.

LCD panels are not created equal. Common panel types are TN, IPS, MVA, and PVA (reference: wiki). Generally speaking, if you want good color re-production, avoid TN panels as they usually have limited viewing angles and some can't even display full 24-bit colors. But they do have fast response time (meaning good for games and movies). IPS/MVA/PVA are a bit slower (some are much slower) but have better quality.

If you want to check the panel used in a specific monitor, go here. For instance, just type in "Eizo" and analyse the search result. You can see that the more expensive CG/CE models (that targeted the professional graphics market) used either the IPS or PVA panels.

You can also compare two particular 19" consumer grade models: the S1901 (6ms TN panel) cost around USD460 vs the S1921 (20 ms PVA panel) at around USD520 as of today. See the difference?

Sunday, August 19, 2007

Dance with my father - Luther Vandross





Back when I was a child
Before life removed all the innocence
My father would lift me high
And dance with my mother and me and then

Spin me around ‘til I fell asleep
Then up the stairs he would carry me
And I knew for sure I was loved

If I could get another chance
Another walk, another dance with him
I’d play a song that would never, ever end
How I’d love, love, love to dance with my father again

Ooh, ooh

When I and my mother would disagree
To get my way, I would run from her to him
He’d make me laugh just to comfort me
Then finally make me do just what my mama said

Later that night when I was asleep
He left a dollar under my sheet
Never dreamed that he would be gone from me

If I could steal one final glance
One final step, one final dance with him
I’d play a song that would never, ever end
‘Cause I’d love, love, love to dance with my father again

Sometimes I’d listen outside her door
And I’d hear how my mother cried for him
I pray for her even more than me
I pray for her even more than me

I know I’m praying for much too much
But could you send back the only man she loved
I know you don’t do it usually
But dear Lord, she’s dying to dance with my father again
Every night I fall asleep and this is all I ever dream


幾個月前在網上偶然聽到這首歌,但找了數間唱片店都找不到有這歌的CD。今天「出城」去買書送給朋友時,終於在書店附近的 HKR 找到了…

特別將這首歌送給我的爸爸

Thursday, August 16, 2007

super typhoon

As of Aug 16 evening... 有冇咁誇張... o_0











火息 車立

…大昏迷

Finally...

Shortly after moved to my new home, the HD on my ak47 machine went silent... and now finally it is back online again!!

Lessons learned:

- BACKUP! BACKUP! BACKUP!... Re-installing FreeBSD was fast... but configuring it back to the way it was really takes time. This machine serves as my web server, network router, mail server, firewall, VPN server etc. And the last backup I have is from a few months ago. The backup for the blog is even older... orz

- Upgrading Typo (my blog engine) is easy... Thanks to Postgresql and Ruby on Rails. I just needed to install the corresponding FreeBSD packages/ports. Followed by installing Gem and Typo. Then execute the blog's old DB backup script to recreate the DB structure. And finally execute

$ export RAILS_ENV=production
$ rake db:migrate


to upgrade the DB schema. 30 minutes later this blog is back to life (less the articles that were created in the last 6 months as I don't have the backup...@#$@#%#!$)

Saturday, February 10, 2007

Hyderabad Day 27 (Feb 10, 2007)

食啊食~





一路睇波一路食~



連蚊都一齊開餐... 好多蚊~~ 血啊~~


Hibernate + Derby

Stumbled across Derby today. A few years ago I used Cloudscape (now owned by IBM) for a toy project. Now with the open-source code maintained by Apache, I decided to try it out.

Downloaded and unpacked the Derby jar files. Then dug up a Hibernate "hello world" project that is on my hard disk. This project was created by following the Hibernate reference document. It is a simple program with HSQL as the database.

I made a copy of the project. Edited the Hibernate configuration file as follow:

<property name="connection.driver_class">
org.hsqldb.jdbcDriver
</property>
<property name="connection.url">
jdbc:hsqldb:hsql://localhost
</property>
<property name="connection.username">
sa
</property>
<property name="connection.password">
</property>
<property name="connection.driver_class">
org.apache.derby.jdbc.EmbeddedDriver
</property>
<property name="connection.url">
jdbc:derby:dbname;create=true
</property>

......

<property name="dialect">
org.hibernate.dialect.HSQLDialect
</property>
<property name="dialect">
org.hibernate.dialect.DerbyDialect
</property>

......

<property name="hbm2ddl.auto">
create
</property>

......



The text colored in red is to instruct Derby to create the database and for Hibernate to create the DDL. Only required for the first run. They can be commented thereafter.


Then went on to modify the class path to include the Derby jar file. And the Hibernate version that I have already has the Dialet for Derby. So no need to search around for the class.

Fired the program up. And without modifying any Java code, the whole program was now "ported" to another database. All it took was just about 15 minutes.