Export Eclipse Plugin, Assert Errors

July 23rd, 2008

Here is my scenario:
I import Eclipse RSE( Remote System Explorer) plug-ins into my workspace and I want to build and test it myself. There are no errors in the workspace and running and debugging is all OK. And I want to export these plug-ins out: Export->Plug-in Development->Deployable plug-ins and fragements -> … An error dialog tells me that “Error occurred during the operation. A zip file containing the build logs has been generated and placed at …”. And exact that *.zip file and there is a @dot.bin.log, saying something like:
4. WARNING in D:\eclipse\workspace\org.eclipse.rse.core\src\org\eclipse\rse\core\SystemTypeMatcher.java (at line 31)
assert pattern != null;
^^^^^^
'assert' should not be used as an identifier, since it is a reserved keyword from source level 1.4 on
----------
5. ERROR in D:\eclipse\workspace\org.eclipse.rse.core\src\org\eclipse\rse\core\SystemTypeMatcher.java (at line 31)
assert pattern != null;
^^
Syntax error on token "!=", = expected

I know this error. But I already set the Compiler Compliance Level to 1.5 already, and in the workspace there is no errors complaining about this.

Googling all over the net and there is no clear solution to solve this problem. Someone says that modifying ANT script build.xml by adding source=”1.4″ will solve this problem. But the problem is that using Export->… the build.xml will always be regenerated.

After reading the source of plug-in org.eclipse.pde.build, I found that there is an option for the script generator to specify javacSource in build.xml. You can just add two lines in build.properties file like the following:
javacSource = 1.4
javacTarget = 1.4

And exporting plug-ins won’t have errors any more.

It feels great to have sources in hand when solving problems. :D

Enable Line-In to Speaker for Vista

July 7th, 2008

Here is the hack for my Dell Inspiron 1520:

A lot of people have been reporting various versions of this issue. In short you are not able to hear line-in audio from the computers speaker even though the meter shows an audio signal. It seems that simply adding a registry key to enable the input monitor will fix the problem, at least it did on my Dell Dimension 9100. Once you add this key and reboot, you will need to enable the input monitor by going to “Control Panel” –> “Sound” –> “speakers/headphones” click on properties, then click on the “Levels” tab and enable the input monitor button.

That should do it, it did for me.

Here is the contents of the reg file I imported to fix the problem:
——————
Windows Registry Editor Version 5.00
[HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318}\0000\Settings\filter\SpeakerHp]
“EnableInputMonitor”=hex:01
————————

You can either create a reg file with this text, or go there yourself and create the binary value.

Here is my standard Microsoft type warning that you should never edit the registry unless you really know what you are doing!

Thanks snashbar very much for his/her post “Possible fix for LIne-in issue with SigmaTel driver in Vista

P.S. After I solved the Line-in problem, I found that the Line-In is really noisy. I finally found a solution: change the level of Microphone/Line In and Microphone Boost to 0:

P.S.2 For Mac OS X user, there is an application called “LineIn” for you to put through line-in to speaker.

VMWare Player, Ubuntu and Mac OSX

June 19th, 2008

So you want to play some other operating systems for some new features, or test your applications on other OSs? Take a try on VMWare Player. It is free.

Along with downloading and installing VMWare, you should also download OS images ( also called as Virtual Applicances). I think you should not miss Ubuntu 8.04 Desktop image (512M). I found that Ubuntu 8.04 running quite smoothly inside VMWare on my laptop with duo-core 2.2Ghz CPU and 2G memory. And I am lazy to install GIMP on my Vista, so running GIMP for some graphic manipulations may be one of Ubuntu jobs. And developing C++ or Java applications inside Ubuntu may be another job for me. And lots of other testing jobs. So owning an Ubuntu desktop is necessary.

(But I find a big inconvenience in my Ubuntu. I can input anything but having great difficulties in inputting 5 characters: “, ‘, ~, `, ^. I need to press that key and follow a space key to input these characters. I struggled hours to fix it but failed. So if you need a solution, please be kind to inform me.)

By the way, why not taking a try on Mac OSX Leopard. Download its 3.3G (expanded to 8G) Mac OSX Leopard x86 image (You should know that it is a pirate copy), following its instructions to install and patch. As using VMWare Player, you have to modify *.vmx directly to load *.iso patch into Leopard:

ide1:0.fileName = “D:\Downloads\Maxxuss-AMDPCNET-v1.0_1043.iso”
ide1:0.deviceType = “cdrom-image”

And you may also change

guestOS = “freebsd-64″

to

guestOS = “freebsd”

So no 64-bit CPU warning in starting this x86 Mac copy.

Well, I feel little excitement to Leopard as it is too slow. So maybe it is just for feature peeking or some small tests. It is not ready for daily work. Hope you have enough patience for the 2-3 days’ image download time and 12G hard disk spaces wasting.

Vista Media Player Cannot Play mms:// Stream

June 5th, 2008

OK. Windows Media Player 11.0 (WMP 11) does not support mms:// protocol any more. So your Vista will never play mms:// stream. Stop wasting your time on searching for a solution.

If you are using XP, you may reinstall Windows Media Player 10.0. But you won’t have chance to downgrade Vista’s WMP 11 to WMP 10.

If the mms:// stream seems to be working for your Vista, it’s not. In fact, the stream media server supports rstp:// protocol stream, and WMP try to rollover mms:// to rtsp:// or http://.

That is my conclusion after reading tons of web pages about Vista’s Media Player on mms. If my conclusion is wrong, please correct me.

True Color Remote Desktop Connection

May 21st, 2008

If you use Windows’ Remote Desktop Connection a lot, you will find that the UI is a little ugly. In fact by default, the Remote Desktop Connection is in 16 bit color mode. In order to have a better experience, it would better setup a true color remote desktop connection. Here are instructions for you.

For Windows Vista users, you already have the latest remote desktop clients, so you can make sure that your connection’s “Options” is using “High Quality (32 bit)” color in “Display” tab, and using “LAN (10Mbps or higher)” in “Experience” tab.

If you are using Windows Vista Professional or Windows Vista Premium, you may following similar instructions of “Enhance Terminal Services’ Color Depth by MMC” to make your connection become true color (24 bit) connection. If you are using Windows Vista Home Edition, you can use registry editor to add a key as following:

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Terminal Services]
“ColorDepth”=dword:00000004

Or you can download the registry file VistaTerminal24bitColor.reg and merge it into your system.

If you are using Windows XP or 2003, you need to upgrade your Terminal Services Client to 6.0. And then following the above MMC enhancement instructions or add a new key in registry:

[HKEY_CURRENT_USER\Software\Policies\Microsoft\WindowsNT\Terminal Services]
“ColorDepth”=dword:00000004

Or you can download the registry file XPTerminal24bitColor.reg and merge it into your system.

References:
http://www.j79zlr.com/gphome.php

Implementing Web AIM Client

May 6th, 2008

Here are some notes when I was struggling to develop a web AIM client:

1. Download AIM SDK, both Windows and Linux
In Linux environment, you may already have NSS/NSPR libraries installed, if not following instructions to install it. You only need to run:

cd dist/release/
ln -s /usr/lib/libnspr4.so .
ln -s /usr/lib/libnss3.so .
ln -s /usr/lib/libnssckbi.so .
ln -s /usr/lib/libplc4.so .
ln -s /usr/lib/libplds4.so .
ln -s /usr/lib/libsmime3.so .
ln -s /usr/lib/libsoftokn3.so .
ln -s /usr/lib/libssl3.so .
ln -s /usr/lib/libfreebl3.so .
export LD_LIBRARY_PATH=/usr/local/tomcat/lib/

2. Get a developer key to use AIM SDK. The developer web site does not accept external email account, so create a new one. In fact, more new AIM screen names are needed, as testing AIM requires it.

3. Try to compile and run samples/accjsample:

cd samples/accjsample
javac -cp ../../dist/release/accjwrap.jar AccJSample.java Prefs.java
java -cp ../../dist/release/accjwrap.jar:./ AccJSample username password developerkey

But you may get error messasge like:

UNKNOWNVALUE
com.aol.acc.AccException: IAccSession_SignOn
at com.aol.acc.AccSession.SignOn(Native Method)
at com.aol.acc.AccSession.signOn(AccSession.java:113)
at AccJSample.(AccJSample.java:47)
at AccJSample.main(AccJSample.java:22)

But if you go into dist/release/ directory, where *.so are located, and run:

/usr/local/java/bin/java -cp ../../dist/release/accjwrap.jar:../../samples/accjsample/ AccJSample username password developerkey

You may get things running correctly:

[5/5/08 8:34 AM]: OnStateChange: Connecting, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Validating, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Transferring, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Negotiating, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Starting, ACC_S_OK
[5/5/08 8:34 AM]: OnStateChange: Online, ACC_S_OK
[5/5/08 8:34 AM]: OnUserChange: ACC_S_OK

That is because *.so may not be loaded correctly if they are not in the current working directory.

Someone says that inaccurate time may cause problems, so run:

/etc/init.d/ntpd start

to synchronize your server’s time.

4. following, it comes to the time that developing AIM desktop client, and then converting it into Java Servlet based AIM client. So, tutorial “Creating AIM-Enabled Application in Java” series are recommended.

5. And time to deploy your web AIM client to tomcat servlet container.

If your Tomcat 6 server is on Windows, you may need to copy all dist/release/*.dll into your %CATALINA_HOME%/bin/ folder, copy dist/release/accjwrap.jar into %CATALINA_HOME%/lib and restart Tomcat services to get things done. Deploy accjwrap.jar directly into webapps folder is not recommended, because you may want to restart your servlet application frequently while loading and unloading *.dll modules may cause “already loaded in another classloader UnsatisfiedLinkError” problems for Tomcat, which may result that you need to restart your Tomcat server.

If your Tomcat 6 server is on Linux, you also need to copy all dist/release/*.so into your $CATALINA_HOME/bin/ folder, copy dist/release/accjwrap.jar into $CATALINA_HOME/lib. And you need to modify your catalina.sh and add two lines:

LD_LIBRARY_PATH=$CATALINA_HOME/bin
cd $CATALINA_HOME/bin

And then restart Tomcat server.

Related links:

JavaCC

April 23rd, 2008

I learned to use JavaCC these days. And I found that JavaCC is a great toolkit.

What is JavaCC?

JavaCC is short for Java Compiler Compiler. It is a parser or scanner generator for Java.

Java Compiler Compiler [tm] (JavaCC [tm]) is the most popular parser generator for use with Java [tm] applications. A parser generator is a tool that reads a grammar specification and converts it to a Java program that can recognize matches to the grammar. In addition to the parser generator itself, JavaCC provides other standard capabilities related to parser generation such as tree building (via a tool called JJTree included with JavaCC), actions, debugging, etc.

You can find a lot of language grammar and AST on its site too. I see that C++ and Java 1.5 grammar are there. JavaScript isn’t there. But I find out that Dojo toolkit’s JSLinker provides an ECMAScript 262 one. That is to say, you can create parser and parse C++, Java or JavaScript sources into your AST for any uses. Lots of great features can be imagined.

I spent about a week learning and using JavaCC. I completed a parser for an IDL language named CAR. I also built an Eclipse editor using the generated AST parser. Bang, all things seems working well: keyword hight-lighting, outline view, error probing, … Great toolkit!

Using JavaCC is quite simple, just download javacc-4.0.zip and unzip it, then following its examples tutorial. I sugguest you to start with JavaGrammars and VTransformer examples, as they are about Java grammar.

I think, later, given opportunity, I will try JavaCC out on other projects. Maybe my Java2Script compiler would be benefited from JavaCC.

P.S. Update:
There is a JavaCC Eclipse Plugin project, you can download the plugin to help you writing your syntax file.

Moving Server Lesson

April 22nd, 2008

1. Moving server from IP to another IP may have a lot of problems. DNS may not be totally updated to all of visitor. So keep the old server running as possible.
2. Old content should not be removed immediately. Some visitors may visit your page directly and get cached *.html, which will try to visit old resources. Lots of 404 responses will occur.
3. Every page should be tested. Or bugs will fly all over.
4. All operations should be record so the next time, you can follow last time’s steps to save time.

Java Puzzlers

November 8th, 2007

They are really very puzzling. Please check them out:
Advanced Topics in Programming Languages: Java Puzzlers, Episode VI

Eclipse Freezing on Start

November 7th, 2007

After an incorrect shutdown, Eclipse can not start, freezing on splash window.

I opened file
workspace\.metadata\.log
there was a line saying:

The workspace exited with unsaved changes in the previous session; refreshing workspace to recover changes

After taking many tries, I found a solution for this bug. Just remove folder
workspace\.metadata\.plugins\org.eclipse.core.resources\.root\.indexes
and restart Eclipse. Everything will be fine again.