Category: Programming

Java has bug again

Java has bug again. After you installed idk 1.8u25 in your mac, open Eclipse.app/Contents/MacOS/eclipse.ini, you will see: -vm /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home But actually this line has no effect, when you run eclipse with -console -debug, you still see it is running use idk 1.6 “-vm /System/Library/Frameworks/JavaVM.framework”. To fix it, change that line to -vm /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/bin/java Peter.


2014/12/22 0

volatile keyword is not everything to prevent compiler optimization

When you add the keyword “volatile” in front of variable declaration, it prevents compiler to optimize the line that are using that variable. But if the line is completely useless, compiler will still optimized it out, prevent to generate any byte code for it.


2014/12/10 0

${new} will cause error in old tomcat 7

Below code has error, because the ${new} will crash old tomcat 7. JSTL has bug.


2014/11/14 0

libelf.h has bug, it includes a missing header file

I cross compile the libel 0.8.13 on my ubuntu 12.04lts. I used the below command to configure it. The compile process is success and installed it correct. But inside the include/libelf/sys_elf.h, it includes a missing header file (elf.h). Just comment it out, and it will works.


2014/08/23 0

Mac has no mkfs.vfat

I have to package my kernel into a fat partition and load it up using grub, but mac doesn’t has a mkfs.vfat and “mount loopback” command. So I am creating a small programing using https://github.com/waldheinz/fat32-lib/ to manipulate the fat image by myself. So far these two small program can read & write a fat image: Read…
Read more


2014/08/17 0

A little bit better – Showing the MBR

A little bit better – Showing the MBR Here is the java code to read MBR out:


2014/07/28 0

tightvnc java is very slow on Retina

Take a look line 170 from https://code.google.com/p/tightvncpanel/source/browse/trunk/src/main/java/com/glavsoft/viewer/swing/Surface.java This ((Graphics2D) g).setRenderingHint(RenderingHints.KEY_RENDERING, RenderingHints.VALUE_RENDER_QUALITY); make g.drawImage(offscreenImage,0,0,null); runs very slow on Mac Retina. Solve: set the value to “VALUE_RENDER_SPEED” instead of  VALUE_RENDER_QUALITY  


2014/07/01 0

Optimize java startup speed

I spent lot of time to optimize the startup speed of my Java app from 10 seconds down to 6 seconds in my 2012 Mac air. I changed to MacBook 13″, the startup time become <=3. That proves the hard disk speed is the key to optimize the startup time. I am facing a new…
Read more


2014/06/29 0

Connect Peter-file-system to linux or mac

After spent 3 days to play the FUSE and macFUSE, i finally connected Peter-file-system (https://code.google.com/p/pfsbuilder) to my mac/linux machine. It is quite simple and straightforward, I write a FUSE program that create a JVM and load my PFS stub (writhed in Java), every FUSE function calls will route to the stub and manipulates the PFS…
Read more


2014/06/23 0

How to trace IIS error 500

The best way to trace IIS error 500 is to enable all log detail on screen, edit your web.config to


2014/06/19 0

newlib’s reentrant system calls will map to non-reentrant by default

newlib’s reentrant system calls will map to non-reentrant by default. The reentrant version of open() can be found in newlib-2.1.0/newlib/libc/reent/openr.c As you can see, it will call _open which is defined in newlib-2.1.0/newlib/libgloss/libnosys/open.c . So if you don’t write your reentrant functions, it will jump to non-reentrant by default. For OS developer want to implement…
Read more


2014/05/04 0

gcc, binutils and newlib can all be compiled at once.

gcc, binutils and newlib can all be compiled at once. This article http://www.embecosm.com/appnotes/ean9/ean9-howto-newlib-1.0.pdf said gcc, binutils and newlib are from the same source tree. Using the following script can linkup all files into a single directory and compile all of them at once. Just put the directories (binutils-2.24 , gcc-4.9.0 , newlib-2.1.0) and the above script in the…
Read more


2014/05/03 1

Miglayout has bug? JPanel doens’t grow

Miglayout has bug? JPanel doens’t grow, but for JButton or JTextField, they can.


2014/04/26 1

Found a bug in ndisasm

Type this command, ndisasm will hang (I guess it eat up all 4GB address space, disassemble offset starts at 0xfffffff0, which is very high address). My version is “NDISASM version 2.11.02 compiled on Apr 9 2014”, running on mac mavericks. temp file : temp.bin The bug is filed here https://sourceforge.net/p/nasm/bugs/557/


2014/04/21 1

dot in mac and linux produce different kind of ortho edge

dot in mac and linux produce different kind of ortho edge. I think the dot version affected it. Here is dot version in linux: Here is dot version in mac:


2014/04/06 1

a java example to record from microphone and save it to wav file and playback

This is a very simple java program to record from microphone and save it to wav file and playback


2014/03/23 0

a good html 5 video streaming tutorial http://phoboslab.org/log/2013/09/html5-live-video-streaming-via-websockets


2014/02/24 0

Jetty require servlet-api 2.5 to fix “java.lang.NoSuchMethodError

Jetty require servlet-api 2.5 to fix “java.lang.NoSuchMethodError: javax.servlet.ServletContext.getContextPath()Ljava/lang/String”, don’t add “org.mortbay.jetty servlet-api”, you need :


2013/12/26 0

The Costs of Versioning an API

http://www.infoq.com/news/2013/12/api-versioning Contract versioning and API/Service versioning has always been a consideration for SOA based systems. Whether because of the impact it has on composability, or client-service governance, it is still something of an art rather than a science. There are many examples of groups giving the benefit of their experiences (e.g., around REST is extremely popular). However, recently Jean-Jacques Dubray…
Read more


2013/12/23 0