*** browser\other version ***
Ref: http://www.webdeveloper.com/forum/archive/index.php/t-127667.html
*** OS version ***
// This script sets OSName variable as follows:
// "Windows" for all versions of Windows
// "MacOS" for all versions of Macintosh OS
// "Linux" for all versions of Linux
// "UNIX" for all other UNIX flavors
// "Unknown OS" indicates failure to detect the OS
var OSName="Unknown OS";
if (navigator.appVersion.indexOf("Win")!=-1) OSName="Windows";
if (navigator.appVersion.indexOf("Mac")!=-1) OSName="MacOS";
if (navigator.appVersion.indexOf("X11")!=-1) OSName="UNIX";
if (navigator.appVersion.indexOf("Linux")!=-1) OSName="Linux";
document.write('Your OS: '+OSName);
Ref: http://www.javascripter.net/faq/operatin.htm
Others: https://developer.mozilla.org/En/Browser_Detection_and_Cross_Browser_Support
Thursday, April 14, 2011
Sunday, January 23, 2011
Setting Java System Properties in JBoss
I like using JVM system properties as a way to access non hard coded resources. Typing System.getProperty("myPropertyName") is convenient and clean. The best part is that these properties have JVM scope, so you don't have to worry about class loaders.
For convenience let me define a couple of variables:
%JBOSS_HOME= directory where JBoss is installed
%JBOSS_SERVER= server instance name
There are 2 ways to define system properties in JBoss:
a) By specifying them in %JBOSS_HOME/bin/run.conf
You use run.conf, don't you? Don't change run.sh or run.bat directly. That makes your application less portable. The file run.conf is used by run.sh or run.bat to setup a number of properties. To setup system properties you need modify the JAVA_OPTS variable. Find this section in run.conf and modify it accordingly:
#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms500m -Xmx500m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -DyourPropertyName=yourPropertyValue"
fi
As you can see I added the property yourPropertyName to the System Properties. So, once you restart the server, you will able to simply call System.getProperty("yourPropertyName") and get the value of it in any application running in JBoss.
The problem with this approach is that to change the values of the properties, or add values, you need to restart the server.
b) Use properties-service.xml
This is my favorite method. In $JBOSS_HOME/server/$JBOSS_SERVER/deploy you will find the file properties-service.xml . In this file you can specify new system properties, modify existing ones and even remove old ones. All you need to do is uncomment the following block in properties-service.xml:
yourPropertyName=yourPropertyValue
You don't need to restart the server for defined properties or changed in properties-service.xml to take effect. Placing properties with links to web services endpoints, LDAP servers and other resources in properties-service.xml makes an application EAR or WAR more portable and easier to move from a development environment to a production environment since the properties are outside of the deployment instruments.
Reference from: http://www.hugotroche.com/my_weblog/2008/07/setting-java-sy.html
For convenience let me define a couple of variables:
%JBOSS_HOME= directory where JBoss is installed
%JBOSS_SERVER= server instance name
There are 2 ways to define system properties in JBoss:
a) By specifying them in %JBOSS_HOME/bin/run.conf
You use run.conf, don't you? Don't change run.sh or run.bat directly. That makes your application less portable. The file run.conf is used by run.sh or run.bat to setup a number of properties. To setup system properties you need modify the JAVA_OPTS variable. Find this section in run.conf and modify it accordingly:
#
# Specify options to pass to the Java VM.
#
if [ "x$JAVA_OPTS" = "x" ]; then
JAVA_OPTS="-Xms500m -Xmx500m -Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000 -DyourPropertyName=yourPropertyValue"
fi
As you can see I added the property yourPropertyName to the System Properties. So, once you restart the server, you will able to simply call System.getProperty("yourPropertyName") and get the value of it in any application running in JBoss.
The problem with this approach is that to change the values of the properties, or add values, you need to restart the server.
b) Use properties-service.xml
This is my favorite method. In $JBOSS_HOME/server/$JBOSS_SERVER/deploy you will find the file properties-service.xml . In this file you can specify new system properties, modify existing ones and even remove old ones. All you need to do is uncomment the following block in properties-service.xml:
yourPropertyName=yourPropertyValue
You don't need to restart the server for defined properties or changed in properties-service.xml to take effect. Placing properties with links to web services endpoints, LDAP servers and other resources in properties-service.xml makes an application EAR or WAR more portable and easier to move from a development environment to a production environment since the properties are outside of the deployment instruments.
Reference from: http://www.hugotroche.com/my_weblog/2008/07/setting-java-sy.html
Wednesday, January 12, 2011
JBOSS 5 on Java 5 Unsupported Operation...Set ....
from 5.0.0.GA
JBossAS 5.0.0.GA can be compiled with both Java5 & Java6. The Java5 compiled binary is our primary/recommended binary distribution. It has undergone rigorous testing and can run under both a Java 5 and a Java 6 runtime. When running under Java 6 you need to manually copy the following libraries from the JBOSS_HOME/common/lib directory to the JBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported by JBossWS are used:
* jbossws-native-saaj.jar
* jbossws-native-jaxrpc.jar
* jbossws-native-jaxws.jar
* jbossws-native-jaxws-ext.jar
JBossAS 5.0.0.GA can be compiled with both Java5 & Java6. The Java5 compiled binary is our primary/recommended binary distribution. It has undergone rigorous testing and can run under both a Java 5 and a Java 6 runtime. When running under Java 6 you need to manually copy the following libraries from the JBOSS_HOME/common/lib directory to the JBOSS_HOME/lib/endorsed directory, so that the JAX-WS 2.0 apis supported by JBossWS are used:
* jbossws-native-saaj.jar
* jbossws-native-jaxrpc.jar
* jbossws-native-jaxws.jar
* jbossws-native-jaxws-ext.jar
Thursday, January 6, 2011
Linux change hostname
Display Hostname
Type the following command:
hostnameSample ouputs:
server.nixcraft.net.inStep # 1: Change Hostname
You need to update two files:
Linux Distribution specific file. Edit appropriate file as per your distribution as follows.
/etc/hosts
Redhat / CentOS / Fedora: Change Hostname
Edit /etc/sysconfig/network, enter:
vi /etc/sysconfig/networkSet HOSTNAME=newhost.example.com, enter:
HOSTNAME=server2.nixcraft.comSave and close the file. Type the following command:
hostname server2.nixcraft.com
hostname
Step #2: Update /etc/hosts
Now, you need to edit /etc/hosts file, enteR:
vi /etc/hostsChange all old hostname with newer one.
Type the following command:
hostnameSample ouputs:
server.nixcraft.net.inStep # 1: Change Hostname
You need to update two files:
Linux Distribution specific file. Edit appropriate file as per your distribution as follows.
/etc/hosts
Redhat / CentOS / Fedora: Change Hostname
Edit /etc/sysconfig/network, enter:
vi /etc/sysconfig/networkSet HOSTNAME=newhost.example.com, enter:
HOSTNAME=server2.nixcraft.comSave and close the file. Type the following command:
hostname server2.nixcraft.com
hostname
Step #2: Update /etc/hosts
Now, you need to edit /etc/hosts file, enteR:
vi /etc/hostsChange all old hostname with newer one.
Monday, July 26, 2010
Android System properties
Reference:
http://android-er.blogspot.com/2009/09/read-android-system-info-using.html
http://android-er.blogspot.com/2009/09/read-android-cpu-info.html
http://android-er.blogspot.com/2009/09/read-android-os-version.html
http://d.hatena.ne.jp/Kazzz/20100113/p1
http://strazzere.com/blog/?p=116
http://www.androidsoftwaredeveloper.com/2009/04/02/how-to-get-the-phone-imei/
http://android-er.blogspot.com/2009/09/read-android-system-info-using.html
http://android-er.blogspot.com/2009/09/read-android-cpu-info.html
http://android-er.blogspot.com/2009/09/read-android-os-version.html
http://d.hatena.ne.jp/Kazzz/20100113/p1
http://strazzere.com/blog/?p=116
http://www.androidsoftwaredeveloper.com/2009/04/02/how-to-get-the-phone-imei/
Monday, July 5, 2010
Unix mail commands
Extracted from: http://www.cyberciti.biz/faq/linux-send-email-from-console/
To send an email from console you need to use mail command, which is an intelligent mail processing system which has a command syntax reminiscent of ed with lines replaced by messages. To send an email to somewhere@domain.com you need to type following command:
$ mail somewhere@domain.comOutput:
Subject: Hello
Hai,
How are you? Hope so you are fine :)
Take care
Babai
Vivek
.
Cc:
You need to type . (dot) to send an email. To send contains of file (such as /tmp/message) as mail body then use following command:
$ mail -s 'Hai' somewhere@domain.com < /tmp/messagePlease note that above command will NOT route an email if you do not have properly configured MTA/mail server.
*** Read mail ***
>>mail -f /var/spool/mail/ e.g., mail -f /var/spool/mail/root //root email
>>mbox //list all mails
Reference: http://www.computerhope.com/unix/umail.htm
To send an email from console you need to use mail command, which is an intelligent mail processing system which has a command syntax reminiscent of ed with lines replaced by messages. To send an email to somewhere@domain.com you need to type following command:
$ mail somewhere@domain.comOutput:
Subject: Hello
Hai,
How are you? Hope so you are fine :)
Take care
Babai
Vivek
.
Cc:
You need to type . (dot) to send an email. To send contains of file (such as /tmp/message) as mail body then use following command:
$ mail -s 'Hai' somewhere@domain.com < /tmp/messagePlease note that above command will NOT route an email if you do not have properly configured MTA/mail server.
*** Read mail ***
>>mail -f /var/spool/mail/
>>mbox //list all mails
Reference: http://www.computerhope.com/unix/umail.htm
Forward root email to external email
Extracted from: http://dettox.blogspot.com/2008/01/automatic-forward-to-another-email.html
Root account
editing the file /etc/aliases we can add an email alias for every account on the server
...
ftp-adm: ftp
ftp-admin: ftp
www: webmaster
webmaster: root
noc: root
security: root
hostmaster: root
info: postmaster
marketing: postmaster
sales: postmaster
support: postmaster
# Person who should get root's mail
root: root
...
so in this case we can write:
...
root: root, example@domain.com
...
running the command newaliases the change will take effect:
[root@localhost ~]# newaliases
/etc/aliases: 77 aliases, longest 22 bytes, 791 bytes total
[root@localhost ~]#
every mail to root@localhost will be forwarded to example@domain.com leaving a copy on the server.
User account
to forward user address without root privileges, just create the file .forward in the home directory with inside the name of the mail address:
[dettox@localhost ~]$ pwd
/home/dettox
[dettox@localhost ~]$ echo "example@domain.com" > .forward
[dettox@localhost ~]$ chmod 644 .forward
[dettox@localhost ~]$
every mail to dettox@localhost will be forwarded to example@domain.com without leaving a copy on the server.
Root account
editing the file /etc/aliases we can add an email alias for every account on the server
...
ftp-adm: ftp
ftp-admin: ftp
www: webmaster
webmaster: root
noc: root
security: root
hostmaster: root
info: postmaster
marketing: postmaster
sales: postmaster
support: postmaster
# Person who should get root's mail
root: root
...
so in this case we can write:
...
root: root, example@domain.com
...
running the command newaliases the change will take effect:
[root@localhost ~]# newaliases
/etc/aliases: 77 aliases, longest 22 bytes, 791 bytes total
[root@localhost ~]#
every mail to root@localhost will be forwarded to example@domain.com leaving a copy on the server.
User account
to forward user address without root privileges, just create the file .forward in the home directory with inside the name of the mail address:
[dettox@localhost ~]$ pwd
/home/dettox
[dettox@localhost ~]$ echo "example@domain.com" > .forward
[dettox@localhost ~]$ chmod 644 .forward
[dettox@localhost ~]$
every mail to dettox@localhost will be forwarded to example@domain.com without leaving a copy on the server.
Subscribe to:
Posts (Atom)