Tuesday, May 14, 2013

仕事の日々#2: C# byte & Java byte

Although C# could be said a rip off from Java, I would understand why Microsoft made the choice to be different from Sun – because it’s downright confusing when doing low level processing if it’s done the Java way.

Aside from String/string, boolean/bool, endianness etc. beginner coders migrating from C# to Java or vice versa would most definitely make this mistake – C# byte and Java byte

In C#, a byte is an 8-bit unsigned integer (unsigned char for you C/C++ dinosaurs out there), while a byte in Java is an 8-bit signed integer (signed char).

What does that mean?

Well, it meant you’ll screw up your code if you ignore this difference.

C#

for(byte i = 10; --i >= 0; )
   Console.WriteLine("foo");

Java

for(byte i = 10; --i >= 0; )
   System.out.println("foo");

For a more hidden problem:

C#

short i = 0xFF;
byte j = (byte) 0xFF; // (byte) is optional
if(i == j) Console.WriteLine("Yay!");
else Console.WriteLine("Nay!");

Java

short i = 0xFF;
byte j = (byte) 0xFF; // (byte) is mandatory
if(i == j) System.out.println("Yay!");
else System.out.println("Nay!");

If you’re not aware of this problem, your program will most probably compile, probably pass all your tests but randomly fails after live deployment.

Captain Obvious says:
“The samples above behave differently for C# and Java.”

Oh, to make things worse, there’s no “unsigned” keyword in Java. Great. Static casting like a magus.

仕事の日々#1: OIC & ORACLE_HOME

Here’s the scenario: I’m writing a setup deployment (installer wizard) project that uses Oracle on a 64-bit system.

Naturally, the installed Oracle Client on the target system is 64-bit. Because Microsoft Installer Executive (MSIEXEC) by default runs in 32-bit mode, and building a dedicated 64-bit project is rather tedious, I’ve resorted to including the Oracle Instant Client into my setup project file.

During setup the wizard will invoke sqlplus to run various database installation scripts. When testing my freshly baked project on the test bed, sqlplus execution ended with code 1.

Well, the problem is: my scripts are configured to exit with code -1 if errors occur during execution. Out of sheer programmer instinct I inspected my setup logs and extracted the specific failed command line out to run it on the console.

The command worked fine.

For a few hours I’ve tried to find out the culprit – changing PATH, altering the script to use “connect”, changing executing user… It just wouldn’t work.

Then I tried redirecting the standard output and error streams (which are originally hidden) from the process into my log file as well.

Sqlplus said:

Error 6 initializing SQL*Plus
Message file sp1<lang>.msb not found
SP2-0750: You may need to set ORACLE_HOME to your Oracle software directory

The error message was very helpful, thank you.

I then checked my default environment variables using “echo %ORACLE_HOME%” – the values looked okay.

So what went wrong?

Apparently some bloody smart component written by a bloody smarty pants changed the ORACLE_HOME environment variable to the current execution directory, which is obviously not ORACLE_HOME.

I did not touch environment variables in my code – so that leaves Oracle Instant Client as the culprit.

Once I changed ORACLE_HOME to the values I find in registry right before launching sqlplus, everything worked like a charm. Bloody Oracle developers.

Yes, this affects imp.exe too.

Sunday, May 12, 2013

24歳まで

It is the time again, though this time around it is slightly earlier, before I get overwhelmed by other things.

This is the time I list down small milestones for the past biological-year.

I have to admit, it is quite difficult for me to recall…

 

November 2012: Distant Worlds Live in Malaysia

A very memorable orchestral concert, streams of memories filled with emotions gushing into your head. Distant Worlds is a definite must for Final Fantasy fans.

 

December 2012: Surviving the “Apocalypse”

Apparently we survived the so-called “apocalypse”. Yay.

 

2013

I couldn’t recall much about the events this year.

For this period of time, up until now, I am occupied by my career. Apart from sleeping and resting, most of my time is spent on work.

Most of my explorations this year are in fact circled around my field of work – virtualization, Java card, smart card OS reverse engineering, TWAIN, UX, MVC, ORM (Entity Framework), web services, web security, image processing, setup and deployment projects…

Though, I really hoped I could spend some time on other skills such as cooking, music instrument, language studies, electronics, interpersonal relationships…

I’m still struggling to squeeze them in, but my available time resources are frequently occupied by ad-hoc tasks until I somehow feel like a virtual resource pool that could be dynamically provisioned at any time.

To tell the truth, I would love to meet up with friends and listen to them talking about their lives, stroll around in malls, or watch the latest blockbuster in theatres, but what’s left of me is fatigue – social interaction became a stress to me (unless I’m only required to listen and don’t talk) and I rather coop inside my room to recharge myself, until the beginning of next business week arrives.

 

April 2013: Passing of Grandma

Witnessing the passing of grandma, whom has lived with us for the past 4 years, up to her final moments in life, had left an impression into my mind. The experience was as close as death itself.

It is not death (that scares me), it is the thought of death. It is probably not my death that I am afraid of, but the passing of people I care for, people that occupies the large part of my memories, people I depend on.

In the end our proof of existence is only the fragments of memories left in the living. If the memories are gone, so does the existence of the departed individual…

 

May 2013: Change

Putting Malaysian politics aside (don’t boo me please =w=), it is time for me to change my core principles.

I want to put emphasis on what I could do for people, and not what people should do, or could do. Death is a promise made to me from the moment I was born – my purpose of living is what I could do with the limited time given to me.

The world does not revolve around myself – I am a part of the world, I am a part of a whole, I am not the world, I am not everything.

I want to eliminate my inability to translate thoughts into actions; I want to wipe out shadows casted by my past that is preventing me from making a change.

 

May 2013: First Nendoroid

Seriously, it was a very huge surprise indeed :D

Sunday, March 24, 2013

とある物語 III

Last week I met up with a product engineer for lunch. His company is producing Android phones, and somehow their latest product is suffering from the lack of public interest.

“People seem to prefer the sleeker iPhone over our product. How could we compete with the likes of iPhone with this product design? It’ll never get bought in stores,” he ranted.

Well, I’m not a fan of Apple products (my apologies Apple fanboys/fangirls), they may have good looks, but they just lack the features I’m looking for. To me, Apple over engineered the looks, in expense of features.

He then showed me a sample of their latest product. In all my honesty, indeed, the product designers could have done a better job. His concerns about the marketability of this product is real.

The phone’s firmware though, felt remarkably snappy; hardware is reasonably well equipped – NFC, dual-core SoC, 802.11n, SiRF III, 2GB RAM etc. He agreed, if not for the physical design, the product would sell very well in the market.

“Why not improve the product design?” I suggested.

The enclosure injection molds were already bought, changing the molds would be extremely costly to be practical. While the engineering team is currently trying to trim down the thickness of the phone, although it is definitely helpful, in my opinion is perhaps not enough to capture the hearts of consumers.

“We did a lot. We’ve fixed the occasional lock-ups in the kernel, zip-aligned the executables to conserve memory, and improved the UI architecture. But no, the response is still disappointing. Is this product not good enough? In the end consumers are all after the looks,” he replied.

In other words, they fixed the bugs and glitches.

“I’m pretty sure the situation will be worse if the lock-ups were not fixed. Have you tried adding magnesium finishing and companion accessories to make the phone look good? Man, even old cars could look good with the right body-kit and paint job.”

“It’s no use. Once they remove the accessories, they’ll be turned-off by the design. Even you are all about the looks, this phone will never sell,” he argued, as if the world, including me, had turned against him.

What he have yet to understand is the fact that in the market full of competitors, what does the product has to offer to stand out from the rest? I agree, the product indeed have competitive features – but to find a consumer that only looks for features is pretty rare; if the company plans to only sell their products to niche markets, that’s fine – but if they wanted to sell to the mass market, they have to change their strategy.

Little did he think about users bringing out their product and comparing with other products – will they be confident enough to state their phone is better than others? Is it worth an investment to buy a product from a company with no intention of putting all possible effort in improving the physical design of the product?

As a user, if he is given a chance to choose between a bunch of sleek phones, and his product as it is, will he choose his product? Reality is people almost definitely go for the looks first, with accessories or not, then understand the features; even if the phone doesn’t look anything special at all without the accessories, it has the potential to look good, as well as the features to keep the attention – it’s a keeper.

Perhaps not all consumers think this way, especially Apple fanboys (whoops!). But there are Android fans out there, this product has potential.

Wednesday, February 20, 2013

パンドラ箱の中には…

Many things going across the mind, and emotions beyond my linguistic capabilities to describe flooding the heart.

Disgust, hatred, disappointment, anger… The harsh reality thrown at me is too difficult to comprehend, with my thought process going into and endless limbo.

I am at loss of words trying to contain the explosion inside myself.

箱の中には…絶望

Sunday, November 18, 2012

印象:遠い世界2012マレーシア

It all started when Yuki told me Distant Worlds is coming to Malaysia a couple of months back. WOW! Distant Worlds is coming to Malaysia? Hell yeah I'm going!

For those whom are in the dark, Distant Worlds is an orchestra concert series conducted by Arnie Roth, based on arrangements of music from Square-Enix's Final Fantasy series (mostly composed by the legendary Nobuo Uematsu). The concerts' music arrangement mostly follow the 20020220 concert held in Japan (that was conducted by Taizou Takemoto, performed by Tokyo Philharmonic Orchestra).

In a nutshell, the current concert is a mix of arrangements from Distant Worlds I, II and Returning Home, performed by Malaysian Philharmonic Orchestra, Az Samad as guitar solo, Dithyrambic Singers for the choir, Stephanie van Driesen for the solo vocals (soprano), Ho Chi Mei, James Long and Mak Chi Hoe as the soprano, tenor, bass opera solos respectively.

The musical journey kicks of with the all-important Prelude (a variation of "The Final Fantasy Song") you usually hear in most of the title background music in the FF series. Listening to the brief harp solo entrance really gives me the goosebumps - the experience is nowhere comparable to listening to FLAC recordings (or maybe just my DAC sucks).

This is immediately followed by FF8's overture - Liberi Fatali, accompanied by a variation of the FF8 overture FMV, with the choir performing remarkably, though voice texture a bit thinner than recording. The arrangement is exactly the same as the previous Distant Worlds concerts, except with a very slight variation in tempo and attack (performed by humans after all).

After a brief introduction by the composer, "the most important song" must be played - the classic Victory Theme 9 seconds short (not in any particular FF variation).

After that came the Final Fantasy 2010 Medley, a collection of music from the classic series (FF1, 2 and 3). This is very similar to the Final Fantasy 2002 Medley, with a few song replacements, notably the removal of Chocobo tune and introduction of more music from FF3, and the others which I couldn't recall with just a single pass of listening in the live concert. 

To Zanarkand from FF10 was very beautifully performed. You could witness how well it was performed by the wet eyes of my friend sitting beside me. =w=d

Epic Memoro de la Stono - Distant Worlds from FF11 was epic, the entrance by the choir was superb, though I have no idea what Latin gibberish they were singing. The first movement of this piece is one of my favourites of the entire concert. Stephanie's voice is slightly different from the recording (of course, they're different people; recording is sung by Susan Calloway, silly me)

No Distant Worlds concert is complete without Mr Desperado - Laguna Loir's battle theme - Man with the Machine Gun. No surprises here - it sounds very similar to the recording I listened N-times, except a bit of variation in placement of instruments and difference of timbre in the jazz drums (first music with jazz drums in this concert by the way).

Another classic from FF5, used in the NDS remake as the introduction music - Theme of Love, slowing the excitement down with a bit of romance, with FMVs from the NDS remake as the final icing on the cake, portraying Cecil's path as a Dark Knight towards Warrior of Light.

An unusual appearance of You're not Alone, a piece never before performed on previously, in place of the usual A Place Called Home (which I prefer more), both from FF9, caught me completely off guard.

Roth said we seemed to have missed something before the interval - Chocobos (!) and gave us Chocobo Medley 2010 (a mix of Chocobo theme from FF14 and Swing de Chocobo, said to be both Roth and Uematsu's favorite), with a cute and amusing animation of chocobos across the entire FF series.

After the 20 minute interval, the original opening of FF7, along with live performance of Opening: Bombing Mission is performed. To be honest, the percussions and brass did slack a little bit in this one. If you like this piece, I recommend listening to the recordings.

Dear Friends from FF5 came right after a brief introduction to the solo guitarist, letting the audience catch some breaths. Unfortunately the usual guitar timbre you get from recordings goes unnoticed with the hall's set-up (naturally). Az Samad played it safe by following the recording's style of playing faithfully.

The real deal is finally here - Vamo alla Flamenco from FF9, whereby Zidane played a mock sword fight on stage in attempt to please the queen. There was a bit of confusion between the solo and the rest of the orchestra, leading to a bit of dissonance due to going out of synchronization. Az Samad yet again, played it safe by following faithfully to the previous Distant World's recording, too faithfully, which in my opinion, was an inferior one compared to 20020220 concert - a few technical bars of the piece was mysteriously slowed down for no apparent reason, which in my opinion, sticks out like a sore thumb.

The only non-Uematsu piece in this concert, Lightning's battle theme - Blinded by Light from FF13, composed by Masashi Hamauzu was greeted by a roar of applause. To a usually infinite-loop battle theme, he orchestra arrangement gave it a twist in the ending,

I'm surprised by the sudden silence, with Roth staring at the screen and sudden audio output from the usually-mute video. An excerpt from FF8 in Deling, during the evacuation, followed by a battle sequence... and the orchestra came into life with the de-facto battle theme - Don't be Afraid took the audience into a high trance. I would've yelled "YEAAAHHHH" if I was allowed to do so. There was one thing missing in the orchestra though... A bag of rice or something that was in the recording.

We were greeted by another battle theme - Clash on the Big Bridge of FF6. Personally I don't quite like this piece, maybe it's just me.

Things then slowed down with Aerith's Theme from FF7, with summary of how Cloud met Aerith, up to her final moments in the shrine praying for the ultimate white magic. Don't worry, the "bad" scene was somehow censored. The piano was a bit too bright for this piece though.

Initially I thought Opera: Maria and Darco from FF6 was boring. The vocalists trio exceed my expectations - they were many times better than the dull and old sounding voices in the recordings. Kudos! Now I feel like playing FF6 (using an SNES emulator of course) =P

El-classico credits (similar to the original FF6 introduction credits) rolled as Terra's Theme (Tina's Theme in Japanese version) played in the background - a very nice touch to the usually boring credits indeed. This final piece marked the end of the concert... or not.

Roth hinted us with an encore piece of Sephiroth, but he played us (one of my favourites in Distant Worlds) Suteki Da Ne from FF10 instead. If you've listened to the vocal entrance sung by Susan in the recordings before, you wouldn't settle for anything less. Though Stephanie's rendition was very good, Susan still has my vote for this one.

What could be a more epic finale than One Winged Angel from FF7? Roth even invited the audience to sing (more like yell) "Sephiroth"! HELLL YEAHHHHHHH! It was so epic some girl sitting behind me start chanting the entire lyrics of this piece loud enough for me to experience surround sound. =w=d

So that pretty much wraps up Distant Worlds 2012 Malaysia folks! RM122 well spent, but I'll get a seat 5 rows or so behind next time (next year maybe?). 

Final note:
Don't trust public transportation in Malaysia - they close earlier than what they've published. If it weren't for munchkin, I'll be camping in KLCC for the night =w=d