Pages

Thursday, June 25, 2009

DOJO and DWR: Filtering Select

Allright, I was working with dojo in the past few months ago and looking back to the source code I think I should at least blog something about it just to remind me about what I have done for the previous project. Today, I am going to blog about how to retrieve data from the database and display in the "Dojo Filtering Select." and this is how it works. For me, I am using JSP, JAVA,DWR and javascripts as my development framework. First of all you may need to understand how to install the "Dojo Toolkit" and DWR in your machine. I am not going for detail on this and you may want to refer to the link for details: http://tinyurl.com/ndenr2 and http://tinyurl.com/6ouod9.

The following is the example of jsp page that show the filtering select in the page:



The piece of code is placed at a jsp file called "menu.jsp" and as you can see from the above code, there is a parameter called "id" and that is what it is gonna use to assign all your data that will retrieve from the database. Don't forget to import the javascript to the main jsp file. For example, I will call my javascripts as the filteringSelectLoad.js and this is how I import to the main jsp page:



The following is the javascripts that did the job or passing and getting data from the back end.



Well, as you can see from the code for MenuManager.getMenu(menu, populateMenu), the MenuManager is where you got to declare @ the dwr.xml. Once you got retrieve the data with dwr and pass back to the front end. Basically, that is all did the job of retrieving and display data in the filtering select. If you wish to know how to retrive data with dwr, you may want to check out :
http://tinyurl.com/n9ezrb

Hope this help!

-Kay Nny-

Move/Rename multiple file from the remote machine via FTP

I recently being assigned a task to FTP to a remote machine and move the files from a location to another location of the remote machine. Looking at the basic of FTP command, it seems like the only way that I can use is the "Rename" command. However, if I work it out directly via the FTP screen, I can only rename a file at a time. But now the issue is, how do I rename multiple file to a location? After googling for more that an hour, finally I got the solution and I feel that I should blog about it since there isn't much people who know about the solution.

Based on my solution, there are multiple way to do and the following are the workable solution:

  1. FTP (mget) those file from the remote machine to the local directory and ftp (mput) back those files to the new remote directory. Well, not a bad suggestion but it's tedious. Another withdraw way is once I have moved those file to the local directory, I will need to "DELETE" those in the remote directory,JUST TO AVOID DUPLICATION! And again, sounds nice but risky.
  2. Write a java program to do the job. I believe some libraries like com.jcraft.jsch which is an open source java code that able to do the workaround.
  3. Write a funky perl script but I guess not everyone knows about Perl Scripts and I am the first who come to the line.
  4. The last solution is what I am going to show below. Sounds tedious but it eventually work. A simple scripts will do all the job!
How does the scripts work is first I will retrieve all the filename from the remote server and place it to a dummy file. For example: filename.txt. If you look at the FTP basic command, there is a command called "mls" which you can list contents of multiple remote directories. For details, you can try FTP to the remote machine and type in the command of ?mls. For example: ftp>?mls

Well, this is what I used to put the listing directory the the local output file. However, if you wish to list out any specific file in the particular directory, you can always use the "*" wildcard to do the listing. The example will be shown later. Once I have listed out all the filename that I needed in the remote directory, I will use the "mls" to write to an output file to my local directory. The command will be something similar as the following: ftp> mls home/kaynny/*.dat /temp/kaynny/logs/filenameList.txt


Meaning that all files which match with the extension of *.dat will write to the filenameList.txt file in my local machine.
Ok, now I already have the list of the file name and I am ready to rename the file. Here is the trick, read the filenameList.txt line by line using the while loop and place the filename which is in the content in the loop so that the rename command will be executed. But of course, you need to FTP to the remote machine in order to execute the rename command. The following is the example of reading the filenameList.txt once I have FTP to the remote machine:



As you can see from the above portion of code, I actually read the file with the number of lines in the filenameList.txt and place the number of line with N. Then loop according to the number of N with the rename command. Once the rename has completed, I will remove the filenameList.txt so that when the next time the scripts is called, it will not append the new filename to the same file. This is also to avoid duplication when reading the file. The full scripts will look something as the following:



Although this is not the best solution, however I hope this help for some of you who have doubt on how to move file from the remote server to any location on the remoter server via the FTP method.


-Kay Nny-



Monday, June 22, 2009

The LEARNING barrier

Me and my bf was attended so called " The Pet Care" reunion @ the PJ Hilton last thursday. Of course it was happy to meet back some of the friends who we closed with and also the trainer Mr. Mark. On the reunion, Mark has mentioned a very interesting topic which is Learning and he told us the some ENERMY and FRIEND of Learning. The following are things that keep on flying around my head this morning:

The restriction or ENEMY of LEARNING:
* Inability to admit "I DON'T KNOW"
* Act as if I do/know
* Unaware of blindness
* I should already know
* Must be clear all the time
* Forgetting emotions
* Distrust
* Knowing is not equal to Opinions meaning that the "Confusion of Knowing"

Well, the following is are the FRIEND of LEARNING:
* Willingness to admit "I don't know"
* Listening
* Being open (Openess)
* Respect and Admiration
* Willingness to question my questions
* Mood perplexity and inquiry

I know that when you are reading on this, there will be a lot of questions mark on your head..... but me and my bf are able to identify the restriction and friend of Learning that we are practicing on. Well, people never stop learning and everyone learn with the different pattern. The earlier we know the barrier the earlier we can improve....


-Kay Nny-

Thursday, June 18, 2009

Things that I desperately wanted

I don't know why this week I felt that there are so much things that I wanted to buy and I couldn't due to $$$ issue. Well, instead of I keep thinking about it and now I would rather listing it out and kill the list one by one. I know some of the item might need a longer time or period to have it but at least it's in the list! Here we go:
  1. A new lens ideally a Canon 18-200mm F3.5-5.6 IS Lens or a Canon 50mm F1.4 USM
  2. New camera bag which can fit a laptop, lens and my camera body. Ideally a LowerPro brand camera bag. Beside this I am not sure which brand good and nice. Perhaps, if anyone who get to read this blog can give a better suggestion for a consideration
  3. A Canon Speedlite 430EX II
  4. A new E72 Nokia Phone
Erm...not sure how should I prioritize this list tho and maybe I should go for the cheapest one that could possibly cost me few hundred. But I think it's a good investment because the main reason kills all which is "I NEED IT DESPERATELY!"

Well, I will continue to look for a sponsorship and can't wait for my birthday! Wooohoo!!!

In the dreamland,
-Kay Nny-


Tuesday, June 9, 2009

Another new learning curve

I was having dinner with 2 of my friends yesterday night and we were talking about expectation from the different types of managers towards the employees. From there I realised that all this while I used to blog about "learning curve, improving skillsets, skillset issue" and so on. Eventually, everyone has the same thought about skillset topic. Well, now I understand that I am not alone!

I admit that I do not have a focus skills where I know something but not fully know about and I learnt something but I wasn't fully apply on it. Hence, like how chinese said "半通水“. Again, today I am blogging about skillset and learning curve again.

I started to joined the new project since February and things that I've learnt during that time was about 1/2 of Oracle AIA, 1/2 about Telco Business Process, 1/2 about Weblogic Integration and 1/2 about Data Mapping. The most thing that I have done and learn from the project are building some common helper class with Hibernate and Spring Framework. See? It's all half half here and half half there. Well, that actually bring me to another conversation for myself. Technical knowlege or Business knowledge? Which one is more valuable? I seriously do not know how to choose from there. However, the hierarchy always go down from Business Knowledge ---> Technical Knowledge.

So sometimes I asked myself, since I already know the fact about the actually flow then what can I gained if I continue to move towards the technology side? Usually, technology people work harder than the business people. Now sure if you agree with me. It just not an option to be choosen.

Sitting here for so many days and hours, I am still thinking what am I doing now and what do I really want.....

Very Lost de
-Kay Nny-


Monday, June 8, 2009

Joke that never bored to tell

07 June 2009 - Yesterday while I was driving back home, I noticed the Moon looked very different as usual. Then, it suddenly remind me about a joke that I learnt during my primary school time. I remembered last time there was a magazine that used to sell to the student every month which called "Kuntum". If I'm not mistaken, it used to sell RM0.50. The I noticed the following joke:

The was a boy asking his mum the following questions:

BOY: Mum, does the moon farther or Australia farther?
MUM: Of course, the Moon is farther...

Then without any hesitation, the boy answer to his mum...

BOY: Of course not! Australia is farther than the Moon.

Then his mum was stunned, and ask why do you said so? Then the boy said:

Boy: Because we can't see Australia but we see MOON!

Well, this was the story that I knew since my primary and I will never stop telling my mum about it when each time I saw a big rounded yellow Moon. How funny!

- Kay Nny -






Bukit Tinggi Le Chevalier + Japanese Tea Garden

06 June 2009, Saturday was the most enjoyable and relaxing weekend for me. Although it was a last minute plan but I was quite persist to go to this place. While having this plan, there was some hiccup happens however, I will not mention about the sad case in this blog.

Before going to the Bukit Tinggi, I was quite clear about what I am going to do when I reach to the Bukit Tinggi and yes, it's PHOTOSHOT!!! I managed to take few nice shots which I will be showing later. We started our journey around 1pm from KL to Bukit Tinggi Pahang. All of us doesn't know where exactly the place is and how to go there. But ahh..luckily my fiance has his GPS navigator and we manage to reach there without losing out way. Thanks Honey *Wink*

Well, basically the Bukit Tinggi is located not too far from the Genting Highland. If you know how to get to the Genting Highland, I am sure that you will know how to go to the Bukit Tinggi. It's just alittle bit farther from the Genting Highland route. Check out the googlemap below:


View Larger Map

I think from KL to Bukit Tinggi takes about more or less 1 and a half hour journey which I don't think it a long journey though. Once you have reach the main entrance of the Berjaya Bukit Tinggi entrance, you are required to buy the ticket in order to go to the resort. The ticket charges RM10 for an adult and RM8 for children. Besides, there is a notice board was stated that if you are planning to take a comercial picture or any photography event, you may need to appy a permit for those event. But of course I don't need that as I am there just to visit! Ha..ha!!

Now let's check out some photos which I have taken @ the Bukit Tinggi Le Chevalier. When I reach at this place, I was so impressed with the building architecture. It totally like the another place or country from Malaysia. Each of the single building was so colorful especially the roof. The building architecture are all with the France Style of building.Some are used as a restaurant and some are the hotels from Berjaya Holding.
























































































When you are on the way back to the entrance, there is a small part where it will direct you to the exit. From there, you will see a pair of white and black swan. I tell you what, I never seen a SWAN before and it really really impressed me! From there I managed to take a nice shot on one of the white swan.. check this out!






























Basically, the RM10 is cover 2 places which are the Le Chevalier (France Village) and The Japanese Green Tea
Village When you are @ the Le Chevalier, there have provided the buses which you can take to the Japanese Green Tea Village. I would advice you to take the bus instead of driving yourself to the Japanese Village as if you drive yourself, the road basically is very narrow and dangerous. That road could probably kills your brake as it's quite steep too. So, once you have reached the Japanese Tea Garden, it's either you walk up to the hill which is about 500m or you got to wait for the bus to take you up to the hill. However, those bus comes in every half and hour. Since the bus facility is free for all , then why not you just take from the France village ya?

For my personal point, I am not so keen into this Japanese Garden because it's just like a hill walk pattern.You seriously need to do alot of walking here. It's like walking around the garden. Inside the Japanese Tea Garden, they have the Botanique Garden too where you can see the monkeys near by the forest. Interesting! However, I didn't really take much of pictures here as it's just tree, flowers and water. Here, I have took some shots:


































For our one day trip, we probably took about 4 hours just to visit these 2 places. However,there is a Rabbit Park that located near by to the ticket entrance where we bought the ticket earlier. The entrance fee for the Rabbit Park is RM3. We didn't get to visit it as it was so crowded and some of us couldn't stand with the sucky smell. Hence, we gave up the visit to the Rabbit Park. After we had a nice dinner at the chinese village of Bukit Tinggi which took few hours just to wait for the dishes. Anyway, Overall, I am very happy and had spent a wonderful day with my family to this trip.

-Kay Nny-

Friday, June 5, 2009

Bad moody day

05 June 2009 - I had quite a bad days for this week. I found that I get easily frustrated and easily blast out everything. Don't know what to do, just want to release all out!

-Kay Nny-