Wednesday, January 24, 2007

J2ME Applications to run on Sony's PSP




People at java4psp are porting J2ME Virtual Machine to the PSP which means we will see J2ME apps (and games) running on the PSP soon! The project's name is BLUEKVM. This also enable we programmers to program the PSP in Java language (which is easier to code/debug than those alien C/C++).

Welcome to PSP Java Development!

This is an experimental project on the Java technology for the PSP platform.

Current Subprojects
1. BLUEKVM - A port of the J2ME technology's Kilobyte Virtual Machine (KVM). The KVM core libraries, virtual machine

features, security, input/output, and networking is defined by the Connected Limited Device Configuration,

version 1.1.

Please visit http://java.sun.com/javame/index.jsp for more details of the J2ME technology.

Download the BLUEKVM demo version (bluekvm-psp-demo-version.zip)
to see a sample Java code running on your PSP!

2. PlayStation Device Profile (under research)


QPOINT Software Group
PHYSIKA, THe U.P. Applied Physics Society

Thursday, January 18, 2007

UTF-8 in Netbeans 5.5

I have Netbeans 5.5 with JDK 6.0 running on my Windows Vista RC1 for a month now. Problem arises when I need to use Thai language in my Java Applet project.


From the figure in the left, I try to draw a string, "สวัสดีครับ", but it was displayed as "??????????". By the way, If you enter your Thai texts via Netbeans' properties editor they will be displayed properly like the caption of JButton in my applet. (If you examined the designer generated sources, you would see escaped string instead of pure Thai text)

To fix the problem, right click on your java source file, click on properties, change the encoding to "utf-8".


After changed the file encoding, you have to close your file and reopen it. You can now edit your file and it will be saved as UTF-8.



But if you compile your file at this point, you will get something like "unmappable character for encoding XXX" error. There is one more little thing to change, Go to project properties window by right click on the project name in the project navigator and click on properties, Go to build->compile and add "-encoding utf-8" at the Additional Compiler Options.


This is my result,


This solution may apply to other foreign languages too.

Sunday, January 14, 2007

Just rescued my write-protected USB flash drive


I bought my Apacer Handy Steno HT202 256MB around 2 years ago. But in the last 2-3 days, I cannot make any modification to the file on it. Windows XP keeps telling me the same message about write-protected things. I am pretty sure that there is no thing such as write-protected switch or hold switch on my model.

After a long research over the internet, I found that many people experienced this same problem too. Some of them resurrect their devices by reformatting it in Linux. Some of them do a low-level format using a program named OnBelay. But neither of above methods work for me. Linux told me the same message as in Windows XP (the drive is write-protected blah blah). And OnBelay told me that my model does not support low-level formatting.

So I decided to go out and buy a new one. I bought Apacer Handy Steno HA202 1GB (Apacer again?). I just like its "never losing the cap" design :) USB flash drives are incredibly cheap these days.

When I arrived home, I decided to write to Apacer's tech support about my issue. Not really hope that they could fix my problem because I heard from many places before that tech supports in big companies are useless.

It takes not so long for them to answer my email (less than 10 hours). I am really impressed! And the support give me a link to download a program which can do a low-level format on my HT202. I hurriedly download and try it. My HT202's light flashes for a few minutes. All my data is erased. I try copying a file on to it and it works !!!!

Hope this can help people who is experiencing the same problem :)
Big thanks to Apacer's tech support team!!!

ps I am not sure if I can redistribute the low-level format program here so you, who have the same problem, should write to tech support team yourself. Apacer's web site address is http://www.apacer.com

Related Pages:

Wednesday, January 10, 2007

.NET Remoting Object in Action!

About .NET Remoting Object

I have started learning .NET nearly two years ago. One of the topics which is hard to understand and confused many newbies is .NET Remoting Object.

.NET Remoting Object is often compared to ASP.NET Web Service as an alternative for building distributed system. There are many tutorials on the internet that show how to consume web service or how to create a web service. So we can see clearly how and where web service would plug into our applications. But for .NET Remoting Object, there are less tutorial. And I really don't know how can I make use of it in my application.

The Situation
Here at my university, My friends and I (as a group of Microsoft Student Ambassadors) conduct a competition on AI programming. Competitors have to code his/her robot in C#. The robot can move in 4 directions and can place a bomb just like in the "Bomberman" game. 4 of these will be placed in the same map in each round and the last stand wins.

So what's the problem ?

The competitors have to code his/her robot as a derived class from "BaseAIBot" which is a class derived from "Thread". Then they have to compile their projects into DLLs. And have these DLLs run in our host application.

This is COMPLETE BLIND DEBUGGING !!

So the competitors must find someway debugging their programs. One approach is to have information dump into text file. This solution is OK but I really hate switching back and forth between the host application and the text file. So I decided to write a program which acts as a text terminal to receive text message from robot.

The root of problem

The problem is how can I send information across application domain or process ?

Yes, the answer is to use .NET Remoting Object.

I will have one object setup at my "Terminal" application and let the robot get this object and call "PushMessage(string)" method to add a message. After a message is pushed, the MessageReceived will be raised. And the UI will be updated.

This results as a program in the screen shot in the left.

Useful links

I studied how to implement .NET Remoting from the two web pages below :

http://www.developer.com/net/net/article.php/2201701 - This covers the basics of .NET Remoting Object. What is it ? And when to use it.

http://www.codeproject.com/csharp/RemotingChatSample.asp - This is the working sample for application using .NET Remoting Object.