Category: Programming

Peter-swing java look & feel

2015/08/03 0

grub is slow on bochs

if grub is running slowly on bochs, try to add “–no-rs-codes” to your grub-bios-setup command. It will be 0.5 sec versus 5 seconds different.

2015/08/02 0

binutils compile error

If you compiling binutils and have these error, just remove d-exp.c and try again. d-exp.c should be generated by d-exp.y but binutils makefile won’t delete it during “make distclean”

2015/05/03 0

compile dwarfdump in mac

CFLAGS=’-I /opt/local/include -L /opt/local/lib’ CXXFLAGS=’-I /opt/local/include -L /opt/local/lib’ ./configure –prefix=/peter-dwarfdump make make install Because mac gcc doesn’t search for the /opt/local, so need to specific the path manually.

2015/03/07 0

Thinkaholic open source event 2015/2/10

Thinkaholic open source event 2015/2/10

2015/02/15 0

Empty bochs instrument crash in linux, but not in mac

Empty bochs instrument crash in linux, but not in mac. My instrument code is nearly empty. core dump: configure: run by: bochsrcSDL.bxrc: instrument.h:

2014/12/25 0

Java has bug again

Java has bug again. After you installed idk 1.8u25 in your mac, open, 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

Sharepoint online bug

Sharepoint online bug – If you place an html-email-address to it and click “check” button, it crash. Even you delete all text and the check button can’t resume normal.

2014/11/11 0

sharepoint 2013 deploy app hang up

In visual studio, when you deploy your sharepoint app, if t hang up in “Installation is in progress”. Make sure your “SharePoint Timer Service” is running, this problem will be solved

2014/10/09 0

command to connect sharepoint 2013 to office web apps server

First, do these in office web apps server Second, do these in sharepoint server

2014/10/09 0

Kendo with MVC ScriptBundle issue

Kendo with MVC, need to be careful this link in your web.config You have to turn off debug=”true”, otherwise the ScriptBundle includes will not working.

2014/08/28 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 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 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 ( 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 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

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 1

a good html 5 video streaming tutorial

2014/02/24 0

rename computer name for sharepoint 2010

after rename computer name for sharepoint 2010, need this command:

2014/02/08 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 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


If I can understand this graph, i will say i am a firewall beginner, otherwise i am still outside the door.

2013/12/16 0

Eclipse always hang in Mac

I am using eclipse kelper in mac osx mavericks, it always hang. I finally got a work around solution from Removing .snap File Open \.metadata\.plugins\org.eclipse.core.resources directory Remove .snap file in the directory Restart Eclipse Remove .indexes Folder Remove the \.metadata\.plugins\org.eclipse.core.resources\.root\.indexes directory Restart Eclipse Move .project mv workspace/.metadata/.plugins/org.eclipse.core.resources/.projects workspace/.metadata/.plugins/org.eclipse.core.resources/old.projects My script

2013/11/28 0

web socket example to stream screen to html 5 player

Here is a working example using web socket to stream screen to html 5 player. The server is in java, I use to route the websocket to java socket. html 5 player

2013/10/22 0

SwingUtilities.updateComponentTreeUI(this); will reset all custom UI

SwingUtilities.updateComponentTreeUI(this); will reset your own UI, if you call setUI() in constructor. Example: PeterCustomeTabbedPane —– extend ——> MaryCustomTabbedPane —-  extend ->   JTabbedPane (swing component) Suppose PeterCustomeTabbedPane and MaryCustomTabbedPane have their own TabbedPaneUI, once you called SwingUtilities.updateComponentTreeUI(this); , PeterCustomeTabbedPane’s UI class will be reset to MaryCustomTabbedPane’s UI class. Workaround: !!! dont call setUI in PeterCustomeTabbedPane, override the setUI() method and set whatever…
Read more

2013/10/13 0

Enable core dump in mac

enable core dump in mac, you need these commands The core dump files are in /cores by default

2013/10/06 0

a bug in tightvnc java library

I found a bug for the tightvnc java library, if my setup like this tightvnc (java) -> java proxy server -> java proxy server -> vnc server IT doesn’t work, after I trace the code, this could caused by this line: = new DataInputStream(new BufferedInputStream(is)); In constructor, it is called twice. You can see that if you…
Read more

2013/05/28 3

put python+django to apache through virtualhost

to put python+django to apache through virtualhost 1) edit /etc/httpd/conf/httpd.conf 2) edit /root/workspace/MyDjangoProject/P1/, change it to

2013/03/26 0

error in createsuperuser

error in createsuperuser To solve the above issues, type in

2013/03/26 0

compile grub2 : error: ‘gets’ undeclared here

if you compile grub2 , you may get “error: ‘gets’ undeclared here yum”, to fix it, run the following command: sed -i -e ‘/gets is a security/d’ grub-core/gnulib/  

2013/02/09 0