Monday, January 7, 2008

Technical: Text3D/Font3D in Java3D

Upon advancing into the API (Java3D 1.4.0), we discovered a short and easy way to create 3D text from a text string. Initially we thought of having to draw out these 3D text in 3DStudio Max and export it as a compatible format which can be rendered onto screen by Java3D. Now we can save the trouble.

By importing 2 objects. Namely the 
- javax.media.j3d.Text3D
- javax.media.j3d.Font3D

Text3D generates the 3D text by accepting 2 arguments, a Font3D object and a string.

/**  Begin of sample code  */

Font3D arial = new Font3D(

new Font("Arial", Font.PLAIN, 1),

new FontExtrusion());


Text3D text = new Text3D(arial, "3DText");

/**  End of sample code  */


As you can see, arial is my Font3D object here. It describes the font style of the text string, such as the font family (Arial in this case), style (Italic, bold, etc.), and point size. The size of the resulting characters will be equal to the point size. Lastly, the extrusion creates the depth in the Z axis. 


Technical: Our First MIDlet



We get our hands on J2ME, where we create our first MIDlet program. Let's look at the following code and I'll explain some fundamentals of MIDlet. 

import javax.microedition.midlet.*;
import javax.microedition.lcdui.*;

public class HelloMIDlet extends MIDlet  {
public void startApp()  {
System.out.println("Hello World");
}
public void pauseApp()  {
}
public void destroyApp(boolean unconditional)  {
}
}

As u can see, A MIDlet's main class extends the javax.microedition.midlet.MIDlet. It defines three life-cycle notification methods: startApp(), pauseApp(), and destroyApp().

The stuff within the startApp() method will be executed when the application is launched by the user. Here, we have a simple println statement.
Now into the lifecycle of a MIDlet. When the MIDlet object is made by calling its constructor, the application is said to be in thePaused state. We move the application to Active state by calling the startApp() method. From the Active state, we can take the application back to Paused state by calling the pauseApp() method. The thing to remember here is that startApp() and pauseApp() can be called multiple times in an application's life time. Lastly when u want to terminate the application, u calls the destroyApp() method. destroyApp() accepts a boolean parameter and if it is true, the MIDlet quit, no matter what it is currently doing. However if this is false, the application can survive termination by throwing a MIDletStateChangeException. If any runtime exception occurs within the destroyApp() method, it is ignored and the application is terminated immediately.

Tutorial here.

Sunday, January 6, 2008

Meeting: 05 Jan 2008 (Msn)


Agenda: System Design and Implementation


The following were discussed:

  • System Implementation Progress
    - Developement server setup completed by ADRIAN. The following has installed :
    - Apache Tomcat Server
    - JAVA SDK
    - JAVA 3D
    - Computer web page registration form demo prototype completed by SEBASTIAN.
    - MIDLET registration form demo prototype completed by ADRIAN.

  • Captcha Design
    - Testing on basic 3D objects on M3D platform and Display in J2ME emulator. By LEXIS.
    - Testing on basic 3D objects on Java3D and display in Applet. By ALAN

    Conclusion : Effect achieved by both JAVA3D and M3D is different.

  • Question and problem raised by team
    It is not efficient to compute 2 different pieces of code(1 for normal computer web browsers and 1 for MIDLET).
    Reasons :
    1. Need to maintain 2 pieces of codes.
    2. Is not scaleble.
    3. Captcha design end result might be different.

    Suggestion : We will need to display the Captcha output as image format, for instant, JPEG or PNG which acceptable by both normal web browsers and MIDLET platform.


Attendence:
- SEAH CHOON YEE, SEBASTIAN

- CHEE SUEN SIANG, ALAN

- CHIA U-MENG, ADRIAN

- OW WAI LEONG, LEXIS

Friday, January 4, 2008

Technical: Our First Java3D

Following the Java3D tutorial at http://www.java3d.org/starting.htm, we compiled and executed our first Java3D program. This program is swee.. short and simple, and show you the basic steps needed to display 3D objects.

To compile: javac HelloJava3Da.java

To run: java HelloJava3Da

* Mac is good. All Java3D classes are already included in the Mac OS X Java Build. No worries on additional setup. Too bad for windows. 

import com.sun.j3d.utils.universe.SimpleUniverse;

import com.sun.j3d.utils.geometry.ColorCube;

import javax.media.j3d.BranchGroup;


public class HelloJava3Da

{

public HelloJava3Da()

{

// Create a virtual universe to contain your scene.

SimpleUniverse universe = new SimpleUniverse();

// Create a data structure to contain a group of objects

BranchGroup group = new BranchGroup();

// Add an object to the group   

group.addChild(new ColorCube(0.3));

// Position the viewer so that they are looking at the object

universe.getViewingPlatform().setNominalViewingTransform();

// Add the group of objects to the universe

universe.addBranchGraph(group);

}

public static void main( String[] args )

{

new HelloJava3Da();

    }

} 


l

At the Hello3d() constructor, you will see the five lines that perform each of the commented steps. The program displays a glowing cube, the viewer is looking directly at the red face of the cube, so what you actually see is a red square on a black background.

Thursday, January 3, 2008

Meeting: 02 Jan 2008 (Group)

Agenda: System Design and Implementation

The following were discussed:

  • Limitation by WAP browser issue.
    It is confirmed by Adrian Choo that we are allowed to choose the mobile application platform to develop the captcha system. Hence the team decided to change the development platform to JAVA as it supports more graphics features.

    Below is the new system implementation diagram.



  • System development task assigning

    Captcha design - in charge by ALAN and LEXIS
    System implementation(Web Page form) - in charge by SEBASTIAN
    System implementation(MIDLET form) - in charge by ADRIAN

  • CAPTCHA Design and Implementation

    - Team will start to develop the captcha according to the required design which will be able display in all the computer web browser and MIDLET.
    - Team will Java3D and M3D technology to develop.
    - Team target to show the prototype at session 1 presentation.


  • System Implementation
    - Team will start development on the system to demo the captcha.
    - Team require to develop a registration form in computer web page and MIDLET to allow the use of captcha design by ALAN and LEXIS.
    - The traffic flow of data must be secured at all the time.


  • Question and problem raised by team

    1. If end users keep requesting the web page and captcha challenge, will it result in DoS?
    Solution :Yes, it will as it needs resource to generate captcha challenge, hence we need to prevent end users from repeating request the web service. Few ideals suggested by team:
    - Use logging features (Apache Server logs?).
    - Use AJAX reduce the web request load.
    - Increase the Captcha challenge generation performance.
    Conclusion : We will do testing at the end of Session 1 prototype to decide which solution is the best to solve this problems.



    2. How do we prevent attackers from Eavesdropping the captcha answer?
    Solution : We will use encryption algorithm to hash the correct answer. Answer provided by end users will be hashed and validate with the correct hash answer.


Attendence:
- SEAH CHOON YEE, SEBASTIAN
- CHEE SUEN SIANG, ALAN
- CHIA U-MENG, ADRIAN
- OW WAI LEONG, LEXIS

Sunday, December 30, 2007

Development: MySQL Database

Open Source database MySQL is setup for use as the backend server of our project.

MySQL database can be downloaded from the internet via the following link:
http://dev.mysql.com/downloads/mysql/5.0.html

Saturday, December 29, 2007

Design Ideas: Using 4-D Fonts 2



We can colour the outline of the 4-dimensional font and using different font sizes in conjuction with different angles view to make the text more lively as well as creating confusion for the OCR scanner.