Thursday, May 29, 2008
Somthing about Set in Java
I was trying to add a few objects in a Set and set this Set. Then I found out from the database that there is always only ONE object added. I did a debug and found the size of the Set is always > 1 !!!
What happened? Here is my answer from torough checking:
Only the 1st object had been added to the Set. It is because the rest are actually "equal" to the first object so Set does not take them anymore! Bear in mind that each object differs from each other using their ID field. They do have their own ID yet when they are being added into the Set so they are rejected by the Set!
Thus, i have to save each object first before adding them into the Set. The reason is the ID will be generated by Hibernate for each object. The Set knows that they are NOT EQUAL right now then they will be added.
Busy and depressing week!
What makes me most frustrated is i always need to take some moments to perform a few steps to test my correction! I have already done my best to simplify the steps!
This process has resulted me to only have a very little hours of sleeping time for a few days continuously!
I hope it can quickly goes live asap!
So now, back to Work!!! back to Work!!!!
Friday, May 16, 2008
Finally stock market crossed 1300 points!
Despite the good news of KLSE, over the 4 counters i am holding, 3 of them actually dropped today including the prominent Public Bank! Well, the decline does not really matter to me because overall my portfolio still generates a book yield. I would like to express my gratitude to the Public Bank! It has been performing very very well since the day i bought its shares.
I think my mutual funds' price will rise further following by today's good performance of KLSE. Looks like i am going to do another time of switching in a few weeks time.
Good day!
Wednesday, May 14, 2008
Switched mutual fund to protect my profit!
The return rate of the fund is very impressive. It achieved a total return rate of around 39% which also means around 20% per year on average. Since the day i bought this fund i have been very confident of it as it has a handsome history. The statistics told me this fund is really worth to buy! Back then i really took a lot of time to actually study each funds and also compare each of them before i made my move.
Too bad i missed the golden moment last year. The fund raised so remarkably. At one time it even achieved an overall return rate of more than 40%! I damn regret now! I should have sold it off during that time! Well, one of my customer chose to sell his fund off last year. It so happened that he needed money during that time. Thus he managed to enjoy the 40%++ of return rate! Oh yes, he bought Public Ittikal too because i am the one who recommended this fund to him!
Luckily after the huge decline of the KLSE stock market due to the 'Political Tsunami' which took place on 8th of March 2008, Public Ittikal's price has been gradually restoring to the level which reflects its actual value.
The big drop of March really taught me a lesson. I decided not to be so greedy anymore. To me, 20% of return rate per year is considered a great achievement already. That's the standard practiced by Warren Buffet all this while!
After several days of serious thought, this noon i went to the nearest Public Mutual branch and did the switching. Anyway that was my first ever fund switching.
I switched the fund units to 2 different conservative profile funds.
Tuesday, May 13, 2008
Ali rustam had supper at Subaidah Cafe
Anyway, as he showed up, a group of customers from the table next to us quickly dashed forward to shake hand with him. Wow! Do they really need to do that?
Monday, May 12, 2008
Apache POI
The amount of these data is huge!
I used to hardcode all these data in my Java file. I organised them properly using data structure such as String array and so on. In my Java file i have a few functions that actually perform the data loading job.
The problem is, It's time consuming and error prone to hardcode each and every data in the Java file.
Therefore, today i decided to put all the data in Spreadsheet program. It is easier to maintain data at Spreadsheet rather than in the Java file itself.
Then i used Apache POI library to read me those data from the Spreadsheet (Microsoft Excel).
Just one time try and it worked fine!
So simple! I was really delighted!
Wednesday, May 7, 2008
One day effort for unknown vm crach of Eclipse during Subclipse installation
It took me one day to get the problem fixed. The solution is so simple!
I setup Eclipse at my new laptop. As usual, i also installed the Subclipse plugin. By right it should work properly. Well, when i tried to create a new remote source repository using Subclipse Perspective in Eclipse, Eclipse just quitted suddenly followed by a prompt saying that it is some kind of memory crash.
Also, there is an error log file generated each time Eclipse exited. However the message is so so not comprehensive.
Here's the message:
## An unexpected error has been detected by Java Runtime Environment:
## EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x3b397bfc,
pid=3824, id=5160
## Java VM: Java HotSpot(TM) Client VM (10.0-b22 mixed mode
windows-x86)
# Problematic frame:# C [libapr-1.dll+0x7bfc]
## If you would like to submit a bug report, please visit:
# http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
With this only clue, i kept Googling for the whole day and still did not get the problem fixed! How frustated was i!
Besides trying out the solutions found online, I also tried to tackle the problem by doing a few times of trial and error, which is actually install-uninstall this kind of stuff.
We really got to be patient enough when dealing with this kind of problem.
Yet, the problems stayed. All the tries did not bring positive outcome.
Office hour ended. Today i did nothing but just configuring stupid Subversion on Eclipse. Boss, please don't get mad.
I started over the puzzle solving game again at home after coming back from dinner.
With calm mind, and of course enough of rest, i found the answer within an hour!
I came across this article online:
http://subclipse.tigris.org/faq.html#win32-crash
Here's the excerpt:
As soon as I do something with Subclipse on Windows, Eclipse just
crashes. Why does this happen?
This is a fairly recent problem that is caused by a DLL incompatibility. Subversion uses a library called APR or the Apache Portable Runtime. This library has a component called APR-ICONV which is used for translating characters in path and file names to/from UTF8 and the local character set. The release of Apache 2.2 brought with it new releases of APR and APR-ICONV and these are not binary compatible with previous releases.
Subclipse ships with the Apache 2.0 version of these libraries. This crash
occurs if you install an application that installs the Apache 2.2 version of
these libraries AND ALSO sets the APR_ICONV_PATH environment variable to a path that contains the Apache 2.2 version of the APR-ICONV .so objects.
The fix is actually simple. Change the name of the environment variable to APR_ICONV1_PATH. The Apache 2.2 library will look for this environment variable name first, and only fallback to the older name if it is not found. You can safely have an APR_ICONV_PATH environment variable pointing to the Apache 2.0 version of these libraries and the APR_ICONV1_PATH environment variable pointing to the Apache 2.2 version. Subversion 1.5 has resolved this problem by discontinuing the use of APR-ICONV. Instead, Subversion will use translation routines that are provided by the Windows operating system.
So, i uninstalled the Subversion Server built against Apache 2.2 and replaced it with the one built against Apache 2.0.
Eclipse looks fine now.
Finally!