Category: Uncategorized

Enable peter-swing theme in netbeans

Edit : /Applications/NetBeans/NetBeans 8.0.2.app/Contents/Resources/NetBeans/etc/netbeans.conf

Change the line to:


netbeans_default_options="-J-client -J-Xss2m -J-Xms32m -J-Dapple.laf.useScreenMenuBar=true -J-Dapple.awt.graphics.UseQuartz=true -J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true -J-Dsun.zip.disableMemoryMapping=true --laf com.peterswing.white.PeterSwingWhiteLookAndFeel -cp:p ~/peter-swing-20150709.jar"

read count : 84

ubuntu 12.04 vnc startup script for fallback mode

#!/bin/sh

DISPLAY=:1 xmodmap -e 'keysym Alt_L = Alt_L'
DISPLAY=:1  xmodmap -e 'keysym Alt_R = Alt_R'
DISPLAY=:1 xmodmap -e 'keycode 255 = Meta_L'
DISPLAY=:1  xmodmap -e 'keycode 254 = Meta_R'
DISPLAY=:1  xmodmap -e 'keycode 253 = Super_L'
DISPLAY=:1  xmodmap -e 'keycode 252 = Super_R'
DISPLAY=:1  xmodmap -e 'add mod3 = Super_L Super_R'
DISPLAY=:1  xmodmap -e 'add mod4 = Meta_L Meta_R'

export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &

read count : 198

Fixed ubuntu vnc keymap problem

ubuntu 12.04 vnc keymap has trouble, D become minimize all windows and S become start menu, run these to fix it.

DISPLAY=:1 xmodmap -e 'keysym Alt_L = Alt_L'
DISPLAY=:1  xmodmap -e 'keysym Alt_R = Alt_R'
DISPLAY=:1 xmodmap -e 'keycode 255 = Meta_L'
DISPLAY=:1  xmodmap -e 'keycode 254 = Meta_R'
DISPLAY=:1  xmodmap -e 'keycode 253 = Super_L'
DISPLAY=:1  xmodmap -e 'keycode 252 = Super_R'
DISPLAY=:1  xmodmap -e 'add mod3 = Super_L Super_R'
DISPLAY=:1  xmodmap -e 'add mod4 = Meta_L Meta_R'

read count : 217

tomcat auto startup script

just save this to /etc/init.d/tomcat and link to /etc/rc5.d/S99tomcat

#!/bin/bash
#
# tomcat        
#
# chkconfig: 
# description: 	Start up the Tomcat servlet engine.

# Source function library.
. /etc/init.d/functions


RETVAL=$?
CATALINA_HOME="/home/tomcat.kingofcoders.com/www/"

case "$1" in
 start)
        if [ -f $CATALINA_HOME/bin/startup.sh ];
          then
	    echo $"Starting Tomcat"
            /bin/su tomcat $CATALINA_HOME/bin/startup.sh
        fi
	;;
 stop)
        if [ -f $CATALINA_HOME/bin/shutdown.sh ];
          then
	    echo $"Stopping Tomcat"
            /bin/su tomcat $CATALINA_HOME/bin/shutdown.sh
        fi
 	;;
 *)
 	echo $"Usage: $0 {start|stop}"
	exit 1
	;;
esac

exit $RETVAL

read count : 315

why i receive zero in my socket

I have two programs, one written in c++, the other is in java. C++ keep sending bytes to java, overtime write out 400KB. Java keep receiving the data using the readBytes function, this function returns an integer which is the number of byte it actually read for the function call. For every send (400kb) in c++ and every read in java, I print out something, so I know c++ is 2 times faster than Java. That mean c++ is sending out the bytes in 2-times speed than java. After 10 seconds, on java side I read out zero from the byte array. But the return value of readBytes() function is still a positive number. Why behave like this? Java should return -1 if no packet or packet lost.

To fix this problem, for every 400kb read from java, I write out the string “end” to c++, c++ have to receive that “end” string before send out another 400kb. So c++ and java are doing handshaking, they align they send speed and write speed, preventing the c++ is sending faster than java. Now, I get all the bytes correctly. So in http, server side and client side *MUST* do handshake. (Correct me if I am wrong)

If the wget is doing handshake to apache server, even in a very slow network, we are very hard to have packet lost. Unless the bandwidth still can’t send out the bytes array in ONE single send() function. But in real case, we usually split the data into very small piece, let say 4KB. So we are very very hard to see packet lost. This explains why I can’t see packet lost/ECN, even I use wget to use up the whole bandwidth.

read count : 223