Sunday, September 22, 2013

Unity Game Engine first touch

For the past few weeks, I'm not working on the programming whereas I'm spending my time learning Unity Game Engine. The first game I made was a rather simple game where there is a space ship at the bottom of the screen shooting the asteroid coming from the top of the screen. I am quite satisfied with the engine especially on particle system, it makes my life easier when creating the explosion effect. This is not my intention to bring the game to the world since I'm still studying on the game engine, but to get myself familiar with the user interface.

Next I am going to learn to make a Load Runner game, I miss this game when I was still in young. The game development on this time is slightly advance where I am using Orthello, a 2D game framework. Below is my progress for this week, where I have the level design setup.

load_runner_20130922

Sunday, September 1, 2013

'for' attribute is not defined in JSF

Great finding from my colleague. When retrieve systemout.log from WebSphere Application Server, noticed that the following warning seem to be flooding in the log.

Attribute 'for' of label component with id xxxxxxxxxxxxxxxxxxxxxx is not defined 

This warning is due to the missing of attribute 'for' in a component being called. For example,


The purpose is to let the outputlable know which component to label. For suppressing the excessive non-informational logging line, always practise to use the 'for' attribute.

Retrieve IP address from JSF

One of my requirement in audit trail module is to capture the IP address of the user accessing the web application. My web application was developed using JSF, may I know could this be done? Such an easy job, below is the code for this mission:
 HttpServletRequest request = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
 String ipAddress = request.getHeader("X-FORWARDED-FOR");
 if( ipAddress == null ) {
  ipAddress = request.getRemoteAddr();
 }

web-app_3_0.xsd schema is reference from javaee



   ...
   ...
I was clueless when I first saw the above code causing an error in Deployment Descriptor. I was trying to retrieve web-app_3_0.xsd schema but I couldn’t spot the typo error in the above code. If you were me, can you spot the error? If you take a closer look, the error happened on j2ee. It was cause by my copy and paste habit.

http://java.sun.com/xml/ns/j2ee is no longer a valid URL to retrieve JAVA EE 5 (and above) schema, it is only valid for J2EE 1.4. For JAVA EE 5 (and above) schema, the URL has been update to http://java.sun.com/xml/ns/javaee.