Category Archives: Programming
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 :
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 […]
Netfilter

If I can understand this graph, i will say i am a firewall beginner, otherwise i am still outside the door. http://upload.wikimedia.org/wikipedia/commons/3/37/Netfilter-packet-flow.svg
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 http://www.lazylab.org/197/eclipse/eclipse-hanging-on-startup-repair-corrupt-workspace/ 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
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 websockify.py to route the websocket to java socket. html 5 player
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 […]
Enable core dump in mac

enable core dump in mac, you need these commands The core dump files are in /cores by default
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: this.is = new DataInputStream(new BufferedInputStream(is)); In Reader.java constructor, it is called twice. You can see that if you […]
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/wsgi.py, change it to
error in manage.py createsuperuser

error in manage.py createsuperuser To solve the above issues, type in
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/stdio.in.h  
compile 64 bits newlib on 64 bits linux host

If you compile newlib in x86-64 host and want to have 64-bits newlib, you have to add “–disable-multilib“, otherwise you will get the following error:
newlib compile error in Fedora 18 64 bits

when you meet the following error, add “.code32” can fix it. ../../../../../../newlib-1.19.0/newlib/libc/machine/i386/memcmp.S: Assembler messages: ../../../../../../newlib-1.19.0/newlib/libc/machine/i386/memcmp.S:18: Error: invalid instruction suffix for `push’ ../../../../../../newlib-1.19.0/newlib/libc/machine/i386/memcmp.S:21: Error: invalid instruction suffix for `push’ ../../../../../../newlib-1.19.0/newlib/libc/machine/i386/memcmp.S:22: Error: invalid instruction suffix for `push’ ../../../../../../newlib-1.19.0/newlib/libc/machine/i386/memcmp.S:23: Error: invalid instruction suffix for `push’ ../../../../../../newlib-1.19.0/newlib/libc/machine/i386/memcmp.S:72: Error: invalid instruction suffix for `pop’ ../../../../../../newlib-1.19.0/newlib/libc/machine/i386/memcmp.S:73: Error: invalid instruction suffix for […]
10 places where anyone can learn to code

Teens, tweens and kids are often referred to as “digital natives.” Having grown up with the Internet, smartphones and tablets, they’re often extraordinarily adept at interacting with digital technology. But Mitch Resnick, who spoke at TEDxBeaconStreet in November, is skeptical of this descriptor. Sure, young people can text and chat and play games, he says, “but that […]
A x86 java disassembler from Maxine Project

I have been asking for a java x86 disassembler library for a long time, i finally found “Maxine” project from oracle, it is a VM project with built-in a x86 assembler written Java. I git-ed the source and compile them in eclipse, it works!, here is the source and screenshot. source : maxine_disassembler