Thursday, February 14, 2008

java change keyboard layout

Visit the following article http://java.sun.com/products/jfc/tsc/articles/InputMethod/inputmethod.html
and read it carefully.

if you download and copy following jar file to /lib/ext you will have a menu item called "select input method" added to all swing applications.
http://java.sun.com/products/jfc/tsc/articles/InputMethod/InputMethodHotKey.jar

You can find full specification and api document here
http://java.sun.com/javase/6/docs/technotes/guides/imf/index.html

Finally the direct answer is here:
Any swing component which extends from java.awt.Window has a method called getInputContext(). You can change the input method like this, it will automatically change the keyboard layout when you focus the component.
for example"
yourMainJFrame.getInputContext().selectInputMethod(new Locale("fa", "IR"));

Sunday, December 16, 2007

linux common command

tcpdump -i eth1 -XX src host ip
ssh -L :localport:destinationIP:destinationPort username -pSSHPort -NnTv
sudo mount /dev/sdb1 /media/usbdisk/


iptables -t nat -D PREROUTING -s 192.168.0.140 -p tcp -m tcp --dport 3335 -j DNAT --to-destination 10.100.100.111:3068
ptables -t nat -A PREROUTING -s 192.168.0.140 -p tcp -m tcp --dport 3335 -j DNAT --to-destination 10.100.100.111:3068
sudo route add -net 10.100.0.0 mask 255.255.0.0 gw 192.168.0.24

du -h /home/engine/tomcat/ --max-depth=1
vim /etc/cron.daily/backup

sudo vim /etc/rc.local
netstat -a -n

sudo iptables-restore < /etc/iptables

tar -zxvf test.gz
tar -ztvf maskan.gz
tar -zcvf test test.gz

cut -d ' ' -f 6-6


install bin
chmod +x jre-1_5_0_14-linux-i586.rpm.bin
./jre-1_5_0_14-linux-i586.rpm.bin

sudo usermod -g admin peyman


sudo apt-get install -f
dpkg -i ymessenger.deb

install rpm
sudo rpm -Uvh jre-1_5_0_14-linux-i586.rpm

Wednesday, December 12, 2007

kannel url commands(kentBeck)

stopping smsc box: http://127.0.0.1:13000/cgi-bin/stop-smsc?password=&smsc=
starting smsc box: http://127.0.0.1:13000/cgi-bin/start-smsc?password=&smsc=
status: http://127.0.0.1:13000/cgi-bin/status?password=

Wednesday, November 14, 2007

j2me, Permissions

MIDlets must have permission to perform sensitive operations, like connecting to the network. Permissions have specific names, and MIDlet suites can indicate their need for certain kinds of permissions through attributes in the MIDlet suite descriptor.

In the J2ME Wireless Toolkit, you can add these permission attributes to a project by clicking on the Settings... button in KToolbar. Select the Permissions tab. The MIDlet-Permissions box shows permissions which the MIDlet must possess, while the MIDlet-Permissions-Opt box contains permissions that the MIDlet would like to have but does not need absolutley.

javax.microedition.io.PushRegistry,

javax.wireless.messaging.sms.receive,

javax.wireless.messaging.sms.send,

javax.microedition.io.Connector.sms,

javax.microedition.io.Connector.socket


j2me jad or jad

The following are required application attributes, some of which must be defined in the JAD file, and others in the JAR manifest:

  • MIDlet-Name: Mandatory in JAD, optional in manifest.
  • MIDlet-Version: Mandatory in JAD, optional in manifest. Format is Major.Minor[.Micro].
  • MIDlet-Vendor: Mandatory in JAD, optional in manifest.
  • MIDlet-Jar-URL: Mandatory in JAD.
  • MIDlet-Jar-Size: Mandatory in JAD.
  • MIDlet-: For each MIDlet. Optional in JAD, required in manifest.
  • MicroEdition-Profile: Optional in JAD, mandatory in manifest.
  • MicroEdition-Configuration: Optional in JAD, mandatory in manifest.

The following are optional attributes that can be defined in the JAD or manifest:

  • MIDlet-Description: application description.
  • MIDlet-Icon: application's icon.
  • MIDlet-Info-URL: URL for MIDlet suite information page.
  • MIDlet-Data-Size: Minimum required data space.
  • MIDlet-Permissions: Requested permissions.
  • MIDlet-Permissions-Opt: Requested optional permissions.
  • MIDlet-Push-: , , . Push static registration.
  • MIDlet-Install-Notify: URL for installation notifications..
  • MIDlet-Delete-Notify: URL for deletion notifications.
  • MIDlet-Delete-Confirm: User prompt for deletions.

The following two attributes are mandatory for trusted MIDlets, and must be defined in the JAD file:

  • MIDlet-Jar-RSA-SHA1: defines the JAR signature
  • MIDlet-Certificate--: defines the public key certificate