September 2005 - Posts

Saw this been displayed in cine leisure yesterday. Haha, not very creepy. The maid is better




The blood looks like paint. Well, it is paint . =X
with no comments
Filed under: ,
The below code is how to get querystring parameters using JSF:

 public static Object queryString(String key)
    {
        HttpServletRequest request = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
       
        return request.getParameter(key);
      
    }

There is no need to use custom components

with 1 comment(s)
Filed under:
[Intro] [Skip Intro]
All I want is to create a few rows with links according to the user's right in my J2EE project and it took me 6 hours to do so in JSF. Faint. Most probably due to my lack of experience in the framework, but I do believe seriously that there is a serious flaw in it. I choose it in the first place because it seems to be Java's answer to RAD in Web. I think is a headache.

Initially, I decided to use JSTL to loop through the collections of rights and display it. The code is simple, just a tag and done! Well, not so. After 2 hours, nothing is working. I check with dr google and judging from this article, I thought they will work well. Neither the examples or my application works.  Searching through the results from google again reveals this post and inside, reveals a contradictory posting:


Thanks for your interest in JavaServer Faces. There are a few areas
where it was impossible to get JSF and JSTL to cooperate.

1. c:forEach. You can't use it with JSF. use h:dataTable instead

2. c:if Any faces components embedded inside of this tag must have
manually defined IDs. You can't let Faces define the ID for you.

3. I18N. Faces has its own I18N and L10N mechanisms, it's best that you
use them instead of the JSTL ones.

 
My jaw drop when I saw (1.) and I realized I have wasted 2 hours for nothing. So I use datatable instead. I managed to get it working in another 2 hours time (Spend most of the time waiting for the war file to deploy). Below is the code. The other 2 hours is spended trying to apply CSS and style to it, which in the end we simply compromised the design to another cause the style is just not getting right (since I create it dynamically). Anyway the below is the code for adding datatable dynamically to a grouppanel.

Note : Another way is to use HtmlOutputLabel to write out the Html codes yourself. However, that will defeat the purpose of using faces and encapsulating the Html tags.

I miss my visible=false;
[/Intro]

[Code]
//This code is tested and can work =p

           UIData table = new UIData();
           UIColumn col = null;   
           HtmlOutputLink out = null;
           UIOutput txt = null;
        
           table.setVar("item");
         
           table.setId("table1");
         
           col = new UIColumn();
       
           UIOutput header = new UIOutput();
           header.setId("header1");
           header.setValue((String)names.get(i));
          
           col.setHeader(header);
           col.setId("column1");
          
           out = new  HtmlOutputLink();
           out.setId("out1");
           txt = new UIOutput();
           txt.setId("txt1");
            //Change item.page accordingly to your own object's property
           ValueBinding vb =
           FacesContext.getCurrentInstance().getApplication().createValueBinding("#{item.page}");
           out.setValueBinding("value", vb);
          
             //Change item.description accordingly to your own object's property
           ValueBinding cb =
           FacesContext.getCurrentInstance().getApplication().createValueBinding("#{item.description}");
           txt.setValueBinding("value", cb);
          
           out.getChildren().add(txt);
           col.getChildren().add(out);
           table.getChildren().add(col);
          
          //itemList is an ArrayList which I had populated
           table.setValue(this.itemList);
           this.groupPanel1.getChildren().add(table);
          //You need to create a CSS class .empty so that you can style the table inside the groupPanel
           this.groupPanel1.setStyleClass("empty");

[/Code]
with no comments
Filed under: , ,
One of my best friend informed me today that he has accidentally deposited $308 into someone's account. He is now trying to find who is the account owner. Well, so that explains my extra $. Sob. I transfer to him the $. Hope he can be more cautious in the future, lol


with no comments
Filed under: ,
For some unknown reason, someone deposited $308 into my account on the 12th Sept. This is getting funny. I know it is not me who do so as I get my pay cheque on the end of the month and will not be a funny amount like $308. Hmm, weird.
with no comments
Filed under: ,
For some unknown reason, my card got disabled. A call to the bank reveals that it is due to a 'transaction attempt for a gambling website resided in UK', amouting to 160USD . The bank(DBS) took the initiative to disable my card and currently in the process of sending me a new one. Thanks to them, any damage / loss are prevented.  I wonder how my card information got leak though. Time to keep $ in piggy bank instead..lol
with 2 comment(s)
Filed under: ,
Hmm, today is good day because Flash 8 is available for downloading now! Download it here:

http://www.macromedia.com/cfusion/tdrc/index.cfm?product=flashpro

as important is the documentation

http://www.macromedia.com/support/documentation/en/flash/


with no comments
Filed under: , ,
I was working with dynamic text in flash 8 when I realize how clear it has become. Although it is already a well known fact that text are now rendered much sharper in flash 8, I did not actually try to compare it myself. Therefore , I took a screen shot of the same font in flash 8 and 7. The below is the result :



To the right is Flash 8, left is Flash 7. The difference is pretty much obvious. =)
with no comments
Filed under: , ,
My sister brought this Movie 'Marebito' vcd home today and thus I decided to take a look at it. I dun mind watching japanese horror movies but usually they follow this sequence

1) Some curse is spreading through video/handphone/mind

2) One by one people die

3) There is 1-2 lucky folks who want to find the Truth

4) They sort of found it.

5) Ending - You thought its "Finally Over". But its not.

The last few I watched included Red Candy and Infection and it seems that after movies like The Others and Six Sense, ALL horror movies must have some sort of 'Truth' in order to surprise the audience. The worst movie Japanese horror movie i watched so far is Infection, as I got disgusted by the scenes rather than being scared by it. Until today. Marebito, no story , no climax, no horror, nothing at all. The movie don't even try to explain anything and trust me, you can locked yourself in your room, close all the light and on the volumn to the loudest. I think the loudest sound u will hear is the phone in the movie ringing. There is zero scene of horror in the movie. I watched the show with my sis and her boyfriend. When the show finished, I am the only one who are awake. At least they can put some effort in having some long hair pale face girl crawling around or something, its quite fashionable nowadays.

with 2 comment(s)
Filed under: ,
I guess most people already know this but since I am pretty new to J2EE, I decide to post it here for personal references:

import javax.faces.application.*;
import javax.faces.context.*;
import javax.servlet.http.*;
public static HttpSession currentContext()
{
ExternalContext G = FacesContext.getCurrentInstance().getExternalContext();
HttpSession session =
(HttpSession) G.getSession(true);
        return session;
}

another way is the way recommended by Jsfcentral

FacesContext facesContext = FacesContext.getCurrentInstance();
Application app = facesContext.getApplication();
MyObject myObject = (MyObject)app.createValueBinding("#{myObject}").
getValue(facesContext);

I prefer the first way, gives me more control.

The best is still HttpContext.current.Session["mySessionObject"]..short and sweet..but thats .NET
=.=


with no comments
Filed under: , ,
Coz I keep slamming it when I am working with j2ee. Maybe someone can tell what the below error is trying to say

with 2 comment(s)
Filed under: ,
[Updates 8th Sept 2005]
Thanks to those who like these pictures of my dog. I will take some shots with higher resolution once I got my camera. Those below are taken with my phone
[/Updates]

Just want to post some pics of my dog because he is very hilarious..haha


Hito blocking the door so I cannot go to work.


Hito reading newspaper. The heading is "Big Sales".


Hito waking me up in the morning. Today, I placed a spy cam to caught him in the act


Act cute


Still Acting cute
with no comments
Filed under: ,
I totally screw up my taskbar for the past month. Out of no reason (or some reason oblivious to me), my taskbar starts to act strangely. First of all, when I open a new program, it does not appear in the taskbar. Either that, or it will appear Twice inside it. My laptop has only a 12" screen and having the items appear twice will crop up everything very fast. Secondly, the quick launch is gone even if I enable it. It will appear if I shift the taskbar to the side of the screen. Problem is that once I place it back, my taskbar will become very 'thick' (double the normal size) and everything will get pretty screw up again. Long story short, I simply cannot use my taskbar (and use alt+tab exclusively). Finally, I decide to search for a solution and I find this simple tool Taskbar Repair Tool Plus

All I did is ask it to restart my taskbar and everything is solved. No more alt+tab for me. lol
with no comments
Filed under: ,
This is one problem we faced when creating JSP pages using JSF is that the pages does not render correctly when deployed. In Sun Studio Creator, the pages will render correctly. However, once deployed and view in browser, the page will go haywire and the page will render incorrectly. After 1 whole afternoon, patrick finally find the  solution.

The problem is this, when we add <script></script> tags into JSF pages inside Sun Studio Creator, the ide will automatically change to <script/>, causing pages to display incorrectly. Even if we manually change it back to <script></script>, it will render out as <script/> again. So in the end, we managed to solve the problem by using <script><!--Stop touching this--></script> instead.

Our pages runs perfect now =)

with 2 comment(s)
Filed under: , ,