Saturday, June 23, 2012

Telling the web server to show my error message

My research on error page has been done. It was just as simple as by adding following code into web.xml:

< error-code >
   < exception-type > java.lang.Throwable <  exception-type >
   < location > /jsp/MyErrorPage.html < /location >
< /error-code >

The above pieces is to tell the server that whatever shit throwing out, just show MyErrorPage.html, and hiding the meaningless stack trace from users.

The hardest post I had ever write.

I have been writing this post for few times. And it has been review and revise for few times due to the post is too technical and not enough nonsense.

I was thinking whether this will only happen in Informix. I was trying to construct a dynamic SQL that create a trigger which will attach to a table. This could be a very long string, there are 2 candidates taking up this challenge, the varchar, max size is 255 bytes, and lvarchar, max size is 32k bytes.

This text is reference from IBM Informix:

For variable-length strings longer than 255 bytes, you can use the LVARCHAR data type, whose upper limit is 32,739 bytes, instead of VARCHAR. Because LVARCHAR is implemented as a built-in opaque data type, however, you cannot access LVARCHAR columns in distributed queries of remote tables.

Guess what, both of them failed in the test. It is due to the table contain too much fields(columns) in it. It just too long. I think we need a data architecture in our team to take care of this.

To work around this issue, I have to chop the string into portion end up a very ugly SQL code. The most bad code I had ever wrote in my life. Below are the sample code:

execute immediate "CREATE TRIGGER " || trigger_name || " UPDATE OF " || field_name || " ON " || table_name || " REFERENCING OLD as post NEW as pre FOR EACH ROW ( INSERT INTO ( " || shadow_table_name || " ) VALUES ( " || the_value || " )) "

Too bad.

Sunday, June 17, 2012

I feel the great prosperity in 2012

Feeling so great now. Reviewing my pass, it has been a tough time for me. Back to 2010 and 2011, it was a challenging time for me to change my career to be a mobile developer or to be a JAVA developer. Looking at the future of C++, most of the job are mainly focus on mediation work, which is to me, could be a rather boring.

To quickest way to choose my career path is do it together. How? I first started off to get some freelance job on mobile work to test my ability while maintaining my day job. This was a real challenge to me because I got no coding experience on mobile development, yet, my time management is a real sucks.

In the mean time, I start to discover JAVA programming. This is for my next career advancement. Again, this is another tough time for me. Basically I need to focus on 3 things:
  1. Mobile programming
  2. Java programming.
  3. Day job task assignment. (as I required to study C++ Boost programming)
There was a crash time in 2011, when I was in the midst of transitioning my skill from C++ to JAVA, where I need to pick up my skills in Spring and Hibernate while tackling problems in mobile development. Anyhow, I manage to overcome every single issues, thanks to the support from forum on mobile development, and great helps from my architect, Mr. Kah Wai, in boosting up my JAVA skills.

A big thank you to him because he teach me everything on JAVA, and now I am able to work independently and execute every JAVA tasks assigned to me. Since I have joined this company, I have been proposing to adopt some new JAVA technology into the development. I would like to emphasize that I don't know all this thing, just that I knew what need to be done, but I don't know how. I know because my architect told me a lot of issues happened in JAVA development. I really appreciate on the help from him.

Reaching to age 30, it is a next checkpoint on my destination. I am very clear that my direction is on JAVA. Not only that, I am also contributing my work to open source during my free time, and enjoying my hobby in the weekend.

Work life balance. Cheers~

Why @Required not working?

In order for @Required to function properly, even though I have the code below in place, but it still doesn't guarantee the code is working fine.

public class MyClass {
   private MyObject theObject;
   public void setObject(MyObject theObject) {
      this.theObject = theObject;

I have to put in extra code in the Spring configuration file in order to get it work.

In Spring configuration, the header must have this:

< beans xmlns=""
xsi:schemaLocation="" />

After the header, put in this:

   < context:annotation-config />

Assuming code below exists in the Spring configuration file.

   < bean id="myClass" class="org.huahsin68.MyClass" >
      < !-- < property name="theObject" >
         < ref bean="theObject" /> -- >
      < /property >
   < /bean>

When the code is run, immediately the compiler will response this:

Caused by: org.springframework.beans.factory.BeanInitializationException: Property 'theObject' is required for bean 'sequenceGenerator'

Sunday, June 10, 2012

Where the hell is jawaws?

In Fedora, the javaws wasn't install inside /bin directory. When I was trying to run a jnlp file in the terminal, I get this error:

jawaws: command is not found...

Where the hell does this program sit? I dig into the JDK directory and found out that this program was hiding inside the /bin folder. Why this program wasn't install into the /bin by default?

Saturday, June 9, 2012

2 types of Spring Configuration

There are 2 types of specification you can put in the beginning of the XML in Bean configuration file.

One is using Spring 2.0 DTD to import the valid structure of a bean configuration. Here is the sample how it look like at the top of the configuration file:

"" >

< beans >
< /bean >

The other one is using XSD to define the valid structure of an XML bean configuration file.

< beans xmlns=""
              xsi:schemaLocation="" >
< /beans>

Take noted.

Sunday, June 3, 2012

Consider it done! Soldier!

Working in corporate company will having a well known issue, which is the ranking issues. Senior staff will have more privilege to get the very own knowledge whereas lower ranking staff will usually hiding themselves. Why this happen? This is because it has been a culture in the company.

Who say I am not allow to voice out my opinion even though you are more senior than me? Like what happen in my previous company, I challenge my development manager and even the project manager. I took up the challenge because I am ready for it, I will work very hard on it, and be ready to any subsequence impact that might happen in it. Any nonsense, especially those senior staff bluffing at me, I don't care, I just keep moving forward.

I am trying to encourage my team to voice out their opinion, any feedback and critics. Like for example if you found out Birt is much more better than Jasper, go ahead to prove it, make a POC, present to the team, time needed for the implementation, etc.

Just show everything, bring up everything because I know you can. Don't be shy because it just an excuse to hide the problem. You are a very brave soldier, I honour you and salute you. This is the beginning of innovation, creative thinking, not afraid of failure, the team will not growth without these group of soldiers.

I don't care whether there is a glass door shielding the manager's cubicle or they don't. This is a sick culture. I want to change, by moving my first step, bring in the change, growth the team.

Take one more example, I just have 1 year working experience in JAVA, but my team lead very trust on me because I never failed to him. Compare to previous company, I am a very experience C++ programmer, but I am never a senior staff, my opinion in the team are sucks, rubbish, and nonsense. Did you realize the difference? One with many years working experience in C++ and another one is just one year experience in JAVA.

The point is never failed any thing, any tasks that has been assigned to you. "Consider it done! Soldier!" I have this mind set since last year, which is my first year in JAVA. I work very hard to solve every problems, I work non-stop, I work on weekend and public holiday, long working hours. It is a tired process, I know. But I never give up. Now I am acquired the technology and experiences I learned, that's why I never failed anything to my team lead in my current position.

Now is your turn, you have far more working experience in JAVA. Show yourself, soldiers! Let me honour you.