Saturday, June 10, 2006

Ultimate weight-loss activity

I bought a little drawer set made of wooden frames and cardboard boxes this morning, in an effort to combat mess. When I came back tonight from the Choice reflection day, I sat down to assemble its parts together.

Being the eldest daughter in a family with no sons, I grew up as my dad's assistant handyman. I guess I'm out of practice, because I'm totally drained and my arms are still shaking after taming the imperfect holes with wooden plugs and screwdrivers and L-wrench. Some pictures to entertain the idle visitor: (Sorry, no picture of the parts before assembly!)

This is the trickiest part: putting together the drawer handles!
 

For anyone who wants to burn serious calories to lose weight: purchase a small furniture from IKEA, assemble it yourself, feel the hunger in your rumbling tummy and enjoy! My thumbs are now bright-red. Hope this little baby brings order to my room. Have a good weekend.

Friday, June 09, 2006

J2ME Polish: obfuscator bug

This bug has been the bane of my life for the past few weeks. To a non-IT person (that's a lot of you and I, before my company started), it might have seemed strange to want to obfuscate anything!

The American Heritage® Dictionary defines obfuscate as:
1. To make so confused or opaque as to be difficult to perceive or understand
2. To render indistinct or dim; darken

For people who gets irked when their code gets lifted, obfuscation can be done on their codebase. In J2ME, obfuscation helps to reduce the final JAR size by eliminating classes which have been declared but never referenced, at the same time renaming classes to one-letter or two-letter names, thus 'obfuscating' it for the code thief. It is a nearly standard practice, and I would like to document my little tête-à-tête (or a wrestle?) for others whose search take them here.

Description: J2ME Polish v1.2.4 seems to have a problem obfuscating code which contains the javax.microedition.media.Manager class.

Should we abandon Polish? What if your codebase has grown dependent on Polish? What if, worse, you've fallen in love with Polish' elegant UI? Both were true for me. So here's what I did:

1. Don't obfuscate
No go. I absolutely need two library JARs, one for floating-point-decoding operation (33KB), the other for xml parsing (kxml2-min.jar—18KB). Total JAR size was 295KB. Costs a bomb to download OTA. How can we ever hope anyone would download it to their phone?

2. Manually prune my code & optimize images
Eclipse helps me to see what methods and variables are not being used. I also renamed packages, methods, variables and packages to use shorter names while trying to remember their mnemonics! Basically, all the 'good programming practices' taught in school have to be thrown out of the window when it comes to making lean codes for mobile phones. I only have two 1-KB image files. My effort reduced the JAR size to 188KB.

3. Attempt to implement my UI using Canvas
This took me two days: euphoria and dypshoria took turns when it worked smoothly on Nokia 6230i and then I realized I might have to provision customization for every single phone model!

4. Attempt to fix it
I suspected this bug might be due to two JAR files used by J2ME Polish containing the Manager class in the same package javax.microedition.media. So I bravely combined the two JAR files and replaced the Manager class in Polish' JAR files with the original Sun Wireless Toolkit's. Didn't work.

5. Use Proguard's parameters in J2ME Polish
I tried introducing some parameters "-dontskipnonpubliclibraryclasses", "-dontusemixedcaseclassnames" and "-keep" on the Manager class, in the obfuscator element of the build.xml file. Didn't get past step one, because it requires me to overwrite a Polish obfuscator class.

6. Upgrade to J2ME Polish v1.3-beta4
Not only this version doesn't solve the problem, it introduces new bugs for the function Display.setCurrent(Alert, Displayable)

7. Use alternative obfuscators
Jode, or Retroguard both didn't work with v1.2.4 and v1.3-beta4.

8. Upgrade to ProGuard v3.4 or v3.6
Didn't work. These two versions are not backward-compatible with the calls that Polish v1.2.4 make.

9. Finally, (THIS WORKED!) Obfuscate outside J2ME Polish
I compiled the JARs in Polish for some fifty phone models without obfuscation. Open them using other Wireless Toolkits (Sun's, Siemens' or Sony Ericssons'), attach the source and the library JARs independently, rebuild with obfuscation (Proguard v3.2—same version as what Polish uses)! Smooth as butter. Extra patience required.

RESULT: Final JAR sizes are between 95KB to 106KB (depending on device models).

Talk about dismantling the whole building just to fix a little plumbing problem. What one wouldn't do for something one loves... Hope this helps, folks!

Thursday, June 08, 2006

Pentecost & Holy Trinity

As Trinity Sunday approaches, the Church reflects on unity of the 'visible'—aspiring after the ultimate unity of the Holy Trinity. In last night's prayer meeting we discussed how sometimes it is hard to see unity, harder still to promote it! Today I found the Pope's homily at Vespers, on the eve of Pentecost. What a wonderful teacher we have in him! Read it for yourself, and may you grow in the love of our Triune God!

Wednesday, June 07, 2006

J2ME: Golden bug

I have exactly 13 days to release my company's app (and the other company's app too). After playing around with the look-n-feel, and running it hard to slim down the JAR file size, I finally got to look at the part that reads from the mobile phone's filesystem. At first, the bug's behavior is hardly noticeable underneath all those J2ME midlet permission pop-ups (one for every file listed).

Description:
On most Java MIDP2.0 phones supporting JSR-75 (FileConnection API), the following call should return the directory names requested:
System.getProperty("fileconn.dir.photos")
should return
"file:///c:/pictures/"(or something equivalent applicable to the handset make).
Similarly other getProperty calls to "fileconn.dir.tones", "fileconn.dir.videos", should return ringtones' and videos' respective folders.

On Sony Ericsson's models K750, W800 series and possibly its entire Java Platform 6 family, this call fails—returns nothing basically. The root cause of this was simple:

Cause
“fileconn.dir.xxx” has accidentally been misspelled as “filconn.dir.xxx” in those phones' Java API implementation.

Link here

Many programmers, especially those new to J2ME, spent countless hours of near despair wondering what on earth happened, or did not happen, on that tiny machine. Despair no more!

Tuesday, June 06, 2006

Elsewhere on the blogosphere...

1. 06-06-06: Back to work—good day for me—all tests clear! Evening spent at my company's new office. Not seen anything unusual this day. Besides, in a hundred years, we will get 06-06-06 again!

2. Roundup on Pentecost celebrations
Reflecting on the Holy Spirit's gifts
Some crazy rainbow sashers denied communion: someone distributed the Host to them illegally.

This brings to the point of liturgical practices: I haven't been in the Church long enough to know what proper liturgies should be. My experience of being denied Communion on the tongue (the excuse being to curb the spread of Hand-Foot-Mouth disease—which doesn't happen in Singapore where no cattle grazes) was the furthest extent of my disturbance. Bad taste in music is next, but I will even say sometimes it can be tolerated with a thought to charity.

Some of the hardcore traditionalists like Gerard have either really experienced banal liturgies or are just plain cranky :) One of them suggested that in a traditional Novus Ordo mass or Tridentine Mass everyone would take the Lord reverently (while kneeling, on the tongue) no one would take the Host and break it and give it to those who protest the Church's teachings (and by definition, not in Communion).

Without going into 'liturgy' and definitions, my take on the Mass is that it should be carried out as reverently as possible. Certainly there are times when the Spirit infuse some of our parish members to express themselves more 'joyfully' than others, but Fear of the Lord should always guide liturgists. After all, they do not celebrate liturgies to showcase their 'talents' but also for their fellow parishioners. More often than not, unnecessary embellishment to the Mass (in the name of local culture) rather lessens than magnifies the solemnity given to the occasion.

Our pope BXVI, while a Cardinal, wrote ever so eloquently:

"I am convinced that the crisis in the Church that we are experiencing today is to a large extent due to the disintegration of the liturgy, which at times has even come to be a matter of indifference whether or not God exists and whether or not He speaks to us and hears us. But when the community of faith, the worldwide unity of the living Christ are no longer visible in the liturgy, where else then, is the Church to become visible on her spiritual essence? Then the community is celebrating only itself, an activity that is utterly fruitless."

Sunday, June 04, 2006

Feast of Pentecost

Veni Sanctus Spiritus!
Sine tuo numine,
nihil est in homine,
nihil est innoxium.

After nine days of praying the Novena to the Holy Spirit, Pentecost is finally here! Rejoice!

Mens sana in corpore sano: I'm not fit to write anything this weekend. Wishing all of you a blessed Pentecost and a renewed spirit!

Friday, June 02, 2006

J2ME references

This week I've been grappling at low-level firefighting on the J2ME mobile platform. One of the most frustrating things I encountered is finding similar problem being reported in the various forums, but not the followup!

So here are some reference for those who stumble here through late-night Google search:

For newbies who get frustrated by JSR-135 non-compliant implementation in Nokia phones: theory vs. practice
Mobile Media API Support In Nokia Devices

For those who find their JARs too big / want to 'hide' their code so that codelifters have to work a little harder:
Obfuscators: Proguard, Retroguard, Jode, etc.

For those who want to 'polish' up their clunky app:
J2ME Polish—be warned, there may be some problem using J2ME Polish with Obfuscators!

Update: Will post more on my wrestling match with J2ME-Polish and Proguard later. Down and out for the week.

Wednesday, May 31, 2006

Abuses by priests: Facts and Trends

I found this interesting summary of figures and trends of the sex abuses committed by priests, posted by Gerard of The cafeteria is closed.

Definitely not an apologia for abusing priests, but a great defense of our late Pope JPII-the-Great whenever you meet someone who claims that he "let them happened."

Monday, May 29, 2006

A little slice of love

Disclaimer: a lot of these thoughts are private & personal, I only put some of them here because they are background of a story I think I'd like to give witness to. You have been warned.

These past few weeks in the Easter season, I felt such dry-ness that was never before so apparent. Each day was as bad as the one before: my grandmother came to visit the whole of last week; I still went for masses & confessions. But only part of me seemed to live. Fast forward to Monday (today): another long day of bug-fixing, constantly interrupted with mundane requests to perform yet more fixes that should not come to me because I'm running a tight schedule on another product. It was 21:45, time to go home; I had lost my temper a few times that day and productivity was going down. Another day of half-consciously-lived life.

On the way home I thought, how on earth did this happen? How did I suddenly find myself unable to see, feel, taste, hear or touch the love of God? How was it possible that I can not feel much compassion for pretty much anything? How much longer must You hide Your face? I found myself asking. How much longer must I walk in this shadow? I was afraid my faith would wither and die due to lack of light. (I confess I have said more things more embarrassing than those!)

When I received in my inbox today's commentary of the daily Gospel reading, I was astounded to read this:

“That you may find peace in me”

“Lord, since the days of my youth my mind has sought an I-don’t-know-what with impatient thirst. So what was it, Lord? I still haven’t understood it entirely. It is many years now that I have ardently desired it, and I have not yet been able to grasp it… And yet that is what draws my heart and my soul and without which I cannot settle down in true peace.

Lord, I wanted to find happiness in the creatures of this world, as I saw so many people doing all around me. But the more I sought, the less I found; the closer I got, the further away I was. For everything told me: “I am not what you are seeking.” So is it you, Lord, whom I have sought for so long? Has the attraction of my heart always and constantly been struggling to reach you? Then why did you not show yourself to me? How could you put off this meeting for so long? On how many exhausting paths have I got bogged down? For the person whom you anticipate with so much love, is truly happy, the person whom you do not let rest until he seeks his rest in you alone.
—Blessed Henry Suso (around 1295 – 1366), Dominican
The Book of Eternal Wisdom

Is this walk in the shadow a part of His answer as well? Blessed Henry Suso certainly believed so!

As I arrived home, too tired and preoccupied to prepare dinner, I saw a little box of lapis surabaya (three-layered sponge cake: yellow, brown and yellow) that my mom gave to my grandma to pass to me. Although I don't have a sweet tooth, I recall with some sadness that I would normally refuse to carry lots of food my mom prepared for me whenever I am leaving home. Today this little slice of my mom's love tasted so smooth and sweet, as if it was God's own gracious answer to my plea: indeed, I had a taste of the love of God tonight. Deo gratias!

Saturday, May 27, 2006

Earthquake in Yogyakarta

More than 2,700 people have been reported dead after an earthquake struck Yogyakarta, a densely populated capital of Yogyakarta province, at dawn today. The earthquake's epicenter is close the tumultous volcano Mt. Merapi which has been pouring lava and spouting smokes and debris. One town near Yogyakarta, Bantul, has been flattened. It is feared that this earthquake may increase the activity of the volcano and thus worsen the situation.

News here and here

My friends in Yogyakarta are safe, although there is chaos everywhere because the electricity supply has been cut off. The airport is closed because the runway is cracked. Prayers and help needed. Will post more details on how we can help soon.

UPDATE: links to donate below

Catholic Relief Services is already there; they've been stationed to anticipate the volcanic eruption.

(For those who can read Bahasa) Dana Kemanusiaan Kompas

UPDATE 2:

IDEP Foundation