Monday, June 28, 2010

Adding Social media Sharing icons into BlogSpot blog

Adding social media sharing button will help your readers to share useful and important posts among their followers.

To add Social media sharing icons into your blogspot blog, you need to click on design, and under Blog posts sections click on edit icon to add social media sharing option.

Sunday, June 27, 2010

Getting client and server sessionId in JSF

Code for Generating ClientSide SessionId:
var sesid = document.cookie;//this will give client sessionid and stores in sesid variable


Code for Generating ServerSide SessionId:
//this method will return the server side session id using getId() method
private String serverSessionid() {
HttpServletRequest hrq = (HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest();
HttpSession session = hrq.getSession();
rtnString = session.getId();
//System.out.println("SESSION ID"+rtnString);
return rtnString;
}

JSF Related topics: JCaptcha in JSF, Integrating Richfaces with JSF,Getting client and server sessionId in JSF,PopUp AlertMessagebox for JSF and more.....

Thursday, June 24, 2010

Accessing Javascript variable from the Java file(backenbean) in JSF

In JavaScript:
function clntCookie(){
var sesid = document.cookie;//this will give client sessionid and stores in sesid variable
document.getElementById("tf_CheckValue").value = sesid;//assigning sesid value to the tf_CheckValue which is inputhidden field
}
In JSP:
<h:outputText id="text" value=" ">
<h:inputHidden id="tf_CheckValue" value="#{pendingApplication.tf_CheckValue}"/>
</h:outputText>
place the above code under <h:form> tag

In java (backenbean) file:
private String tf_CheckValue = new String();//generate set and get methods
String sesval = getTf_CheckValue();//this will get the client session id from javascript and place in the sesval.

JSF Related topics: JCaptcha in JSF, Integrating Richfaces with JSF,Getting client and server sessionId in JSF,PopUp AlertMessagebox for JSF and more.....

How to find if the user is offline on Google Talk

Follow the steps to find if the user is offline on Google Talk
• Open the Chat window of the user, you want to check the status.
• Click on option and click on “Go Off the Record”







• Now ping a message to user
• If you get something in red that the user is offline and can’t receive messages that means the user is offline













• If you didn’t get any message in red that means user is online in invisible mode..:)

Tips for the components(inputtextfields,inputtextarea etc) in JSF

In jsp write the following javascript function under script tag
<script type="text/javascript">
function tipsMsg (val)
{
document.getElementById("msg").innerHTML = '';
if ( "tf_user_no1" == val )
{
document.getElementById("msg").innerHTML = 'User Number1 should be [a-z,A-Z,0-9]';
}
else if ( "tf_user_no2" == val )
{
document.getElementById("msg").innerHTML = 'User Number2 should be [0-9]';
}
}
</script>

call the above function in the following way
<h:inputText id="tf_USER_NO1" size="6" binding="#{printcheckdetails.tf_USER_NO1}" onkeyup="makeCaps('tf_USER_NO1')" onfocus="javascript:tipsMsg('tf_user_no1')" autocomplete="off" maxlength="6"/>

<h:inputText id="tf_USER_NO2" size="4" binding="#{printcheckdetails.tf_USER_NO2}" autocomplete="off" onfocus="javascript:tipsMsg('tf_user_no2')" onblur="formatNubmerPart(4)" maxlength="4"/>

if we put cursor in the userNumber text field it will give the message

JSF Related topics: JCaptcha in JSF, Integrating Richfaces with JSF,Getting client and server sessionId in JSF,PopUp AlertMessagebox for JSF and more.....

How to Display Tips messages from the properties files in JSF

Following tag should be included in jsp
<f:loadBundle basename="message" var="msg"/>
Note : here basename should be same as name of the properties file
following tag shows the Tips message in form
<h:outputText id="tips" styleClass="label" value="Tips :"/> <font size="1" id="msg" color="blue"></font>

calling the properties file values from the corresponding tags in jsp
<h:inputText id="tf_USER_PHONENO" binding="#{createuser.tf_USER_PHONENO}" maxlength="15" onkeypress="return onlyNumbers(event);" onblur="phoneNo(this)" onfocus="javascript:document.getElementById(\"msg\").innerHTML ='#{msg.tips_phoneno}'" autocomplete="off" >

message.properties
tips_phoneno = Enter only [0-9]

JSF Related topics: JCaptcha in JSF, Integrating Richfaces with JSF,Getting client and server sessionId in JSF,PopUp AlertMessagebox for JSF and more.....

Monday, June 21, 2010

Get Distance Between two ipaddress

Click on the below link to get distance between your ip and some another ip.

www.ip-adress.com/ipaddressdistance/

Test Your PC Net Speed

Click on the below link to test Your PC Net Speed.

www.ip-adress.com/speedtest/

Test Your PC Speed

Click on the below link to test Your PC Speed.

www.ip-adress.com/speedtest/

Get Your IP / IP / Proxy / System Information through Internet

Click on the below link to get IP Information,IP Location,Proxy,YourUserAgent,Plugin Support of your system.

http://www.ip-adress.com/what_is_my_ip/

Accessing a string variable which is in java file from javascript via jsp page

In java file:
Random random = new Random();
String ranLong = String.valueOf(random.nextLong());
session.setAttribute("hiddenvalue", ranLong);// this will sets the ranLong value in to the hiddenvalue
//ranLong variable contains some 10 digit number

In jsp file:
<%
String hiddenvalue1 = (String) session.getAttribute("hiddenvalue");
%>
now send this 'hiddenvalue1' to javascript
<body onload="setValue('<%= hiddenvalue%>')">

In javascript file:
function setValue(val){
document.getElementById("tf_CheckValue").value = val;
}

Sunday, June 20, 2010

Locate the mobile from which you got missed call

You often get a missed call and wonder who's calling !! Well, I can't tell you "who" but can help by telling "where" the call is from.

please click the below link to locate the mobile from which you got missed call
www1.way2sms.com//jsp/LocateMobile.jsp

Friday, June 18, 2010

Javascript function to Refresh the page every one minute

In jsp include the javascript file in the following way

<script type='text/javascript' src="<%=request.getContextPath()%>/user/javascript/refreshdetails.js"></script>
<script type="text/javascript">
window.setInterval("refresh()",60000);
</script>

In refreshdetails.js file write the following function

function refresh(){
location.reload(true);
}

This will refreshes the page for every 1 minute

Thursday, June 17, 2010

Giving Read,Write and Edit permission to a folder in linux

open the terminal
navigate to the particular folder to which we should give permission say validator folder

[subin@wipro-049cafd91 Desktop]$ chmod 777 validator

This will give read, write and edit permissions to validator folder, but the folders(sub folders) present inside the validator folder we don't have permission to access, again we have to do chmod for each and every subfolder

In-order to overcome this problem, we have to use following command

[subin@wipro-049cafd91 Desktop]$ chmod -R 777 validator

This will give read,write and edit permissions to entire folder, including subfolders and files

SCP Command in Linux

scp stands for secure copy, which is a remote file copy program

The scp command allows you to copy files over ssh connections. This is pretty useful if you want to transport files between computers, for example to backup something.

The scp command can be used in three ways:

1.To copy from a (remote) server to your computer

scp -r [login name@ip address] : [/path/filename] .

Ex: scp -r sravan@10.1.14.36:/home/sravan/Desktop/test /home/subin/Desktop

Ex: scp -r sravan@10.1.14.36:/home/sravan/Desktop/test .


Here are the meaning of scp command options:

* -r = recursively copy entire directory
* . = current directory

'/path/filename' is the complete directory path and name where the file resides.

'login name@ip address ' is the target/destination computer. You have to provide your login name and ip address and will be asked for user password.

Dot (.) at the end of the command means the files will be copied to the current directory. Of course you can change the destination to any directory you wish, just type the full path and directory name to replace the dot(.).

2.To copy from your computer to a (remote) server

scp -r [/path/filename] [login name@ip address] : .

Ex : scp -r /home/subin/Desktop/abc sravan@10.1.14.36:.

Ex : scp -r /home/subin/Desktop/abc sravan@10.1.14.36:/home/sravan/Desktop

3.To copy from a (remote) server to another (remote) server.

In the third case, the data is transferred directly between the servers; your own computer will only tell the servers what to do.

scp yourusername@yourserver:/home/yourusername/examplefile yourusername2@yourserver2:/home/yourusername2/

Ex : scp sravan@10.1.14.108:/home/sravan/xyz subin@10.1.14.109:/home/subin

Tuesday, June 15, 2010

How to Find the Process ID(PID) of Task and Killing the Task in Linux

open the terminal

switch to the root, by using following command
[subin@wipro-049cafd91 ~]$ su -
Password:
enter the root password and click on enter it will enter into the root
[root@wipro-049cafd91 subin]#

then enter the following command
[root@wipro-049cafd91 subin]# top

on clicking enter, it will show all the tasks which are currently in the host
by seeing the PID of the task, we can kill that particular task in the following way
before that you have to come out of the "top", for that press ctrl+c

now enter the following command
[root@wipro-049cafd91 subin]# kill 54789
on clicking enter this will kills the task in the host

Another way of finding the PID of task :
enter the following command in terminal
[root@wipro-049cafd91 subin]# ps aux | grep firefox

Note: here "firefox" is task name, it can be any task like netbeans, a folder, a file ........

by entering the above command it will gives the pid(process id) of the task

subin 27819 0.0 0.1 4436 1088 ? S 11:42 0:00 /bin/sh /usr/lib/firefox-1.5.0.9/firefox
subin 27842 0.0 0.1 4440 1096 ? S 11:42 0:00 /bin/sh /usr/lib/firefox-1.5.0.9/run-mozilla.sh /usr/lib/firefox-1.5.0.9/firefox-bin
subin 27847 7.7 2.6 94848 26840 ? Sl 11:42 0:00 /usr/lib/firefox-1.5.0.9/firefox-bin
root 27855 0.0 0.0 3884 692 pts/1 S+ 11:42 0:00 grep firefox

then enter the following command to kill the process

kill 27847

by this we can kill the firefox

How To Start, Stop and Restart Oracle Listener in Linux

open the terminal

switch to the root, by using following command

[subin@wipro-049cafd91 ~]$ su -
Password:

enter the root password and click on enter it will enter into the root

[root@wipro-049cafd91 subin]#

then enter the following command

[root@wipro-049cafd91 subin]# su - oracle

To Start Listener :

[root@wipro-049cafd91 subin]# lsnrctl start

To Stop Listener :

[root@wipro-049cafd91 subin]# lsnrctl stop

To Restart Listener :

[root@wipro-049cafd91 subin]# lsnrctl reload

Available Listener Commands :

lsnrctl help command will display all available listener commands. In Oracle 11g following are the available listener commands.

* start - Start the Oracle listener

* stop - Stop the Oracle listener

* status - Display the current status of the Oracle listener

* services - Retrieve the listener services information

* version - Display the oracle listener version information

* reload - This will reload the oracle listener SID and parameter files. This is equivalent to lsnrctl stop and lsnrctl start.

* save_config – This will save the current settings to the listener.ora file and also take a backup of the listener.ora file before overwriting it. If there are no changes, it will display the message “No changes to save for LISTENER”

* trace - Enable the tracing at the listener level. The available options are ‘trace OFF’, ‘trace USER’, ‘trace ADMIN’ or ‘trace SUPPORT’

* spawn - Spawns a new with the program with the spawn_alias mentioned in the listener.ora file

* change_password – Set the new password to the oracle listener (or) change the existing listener password.

* show - Display log files and other relevant listener information.

Monday, June 14, 2010

Command for Finding IPAddress of system in Windows

Enter the cmd in Run this will opens the command prompt

Enter the following command

ipconfig

by typing this command you can see the summary in the command prompt, in that summary you can find the IP Address of the host/system

Command for Finding IPAddress of system in Linux

open the terminal

Enter the following command

/sbin/ifconfig

by typing this command you can see the summary in the terminal, in that summary you can find the "inet addr"

inet addr is the ipaddress of the host/system

Saturday, June 12, 2010

Deleting Folders/Files from Trash in Linux

Sometimes we can't delete folders/files which are present in Trash, because of some permissions problem, in that case

Open the terminal

switch to the root, by using following command

[subin@wipro-049cafd91 ~]$ su -
Password:

Enter the root password and click on enter it will enter into the root

[root@wipro-049cafd91 subin]#

Navigate to the following folder

[root@wipro-049cafd91 subin]# cd /home/subin/.Trash

Note: In linux Hidden folders will start with "."

Now enter the following command to delete folders/files in trash folder

[root@wipro-049cafd91 subin]# rm -rf *

This will delete all folders/files in trash folder

Friday, June 11, 2010

Changing Adminstrator Password in System

C:\Documents and Settings\subin_s>net users Administrator subin123
The command completed successfully.

by this command Administrator password will be changed to subin123.

Installing Postgres Database Software in Linux

Open the terminal
switch to the root, by using following command
[subin@wipro-049cafd91 ~]$ su -
Password:
Enter the root password and click on enter it will enter into the root
[root@wipro-049cafd91 subin]#
then go to folder where postgresql software is present
[root@wipro-049cafd91 subin]# cd Softwares

press enter.....
[root@wipro-049cafd91 Softwares]#
then type the following command

[root@wipro-049cafd91 Softwares]# chmod +x postgresql-8.4.0-1-linux.bin
[root@wipro-049cafd91 Softwares]# ./postgresql-8.4.0-1-linux.bin

this will installs the postgressql software in your host/system.

Thursday, June 10, 2010

AlphaNumberandslash Validator using JavaScript

//for AlphaNumberandslash
function alphaNumberslash(evt) {
evt = (evt) ? evt : window.event
var charCode = (evt.which) ? evt.which : evt.keyCode
//alert(charCode)
if((charCode > 30 & charCode < 47)|charCode==32 |(charCode > 57 & charCode < 65) |(charCode > 90 & charCode < 97)|(charCode > 122 & charCode < 127) ){
status = "This field accepts AlphaNumberic and slash."
return false
}
status = ""
return true
}

Address Validator using Java Script

//for Address
function Address(evt) {

evt = (evt) ? evt : window.event
var charCode = (evt.which) ? evt.which : evt.keyCode
//alert(charCode)
if((charCode > 32 & charCode < 38)|(charCode > 38 & charCode < 44)|charCode==31 |(charCode > 57 & charCode < 65) |(charCode > 90 & charCode < 97)|(charCode > 122 & charCode < 127) ){

return false
}
status = ""
return true
}

Wednesday, June 9, 2010

Installing NetBeans Software in Linux

Open the terminal
switch to the root, by using following command
[subin@wipro-049cafd91 ~]$ su -
Password:
Enter the root password and click on enter it will enter into the root

[root@wipro-049cafd91 subin]#
go to folder where netbeans software is present in your host
[root@wipro-049cafd91 subin]# cd Softwares
press enter.....

[root@wipro-049cafd91 Softwares]#
then type the following command
[root@wipro-049cafd91 Softwares]# sh netbeans-6.5.1-ml-linux.sh
press enter.....

by this NetBeans Software will install in Linux

Installing Java Software in Linux

Open the terminal

switch to the root, by using following command
[subin@wipro-049cafd91 ~]$ su -
Password:
Enter the root password and click on enter it will enter into the root

[root@wipro-049cafd91 subin]#
then go to folder where java software is present in your host
[root@wipro-049cafd91 subin]# cd Softwares
press enter.....

[root@wipro-049cafd91 Softwares]#
then type the following commands
[root@wipro-049cafd91 subin]# chmod +x jdk-6u14-linux-i586-rpm.bin
[root@wipro-049cafd91 subin]# ./jdk-6u14-linux-i586-rpm.bin

go on clicking "more" and at last type "yes", by this java software will install in linux.

Shell in Linux

A shell is a command-line interpreter: it takes commands and executes them.Bash (Bourne-again shell) is the default shell for most current Linux distributions (and Mac OS X) and can be run on most Unix-like operating systems.To check what shell you are currently using, open the console, type echo $SHELL, and press Enter. It should return a pathname ending with /bash.

Editors in linux -   nano,vi,vim(vi improved),pico

Tuesday, June 8, 2010

Basic commands for vi editor

I   Insert text before the cursor
A   Insert text after the cursor
:   Switch to execute mode
$   Go to last place on the line
^   Go to first place on the line
W   Next word
B   Previous word
Y   Copy. (Note: Y3W = copy 3 words; Y3J = copy 4 lines.)
P   Paste
D   Cut
X   Delete character under the cursor
®   Move cursor one space right.
¬   Move cursor one space left.
-   Move cursor up one line.
_   Move cursor down one line.
$   Move cursor to end of line.
^   Move cursor to beginning of line.
:1   Move to first line of file
:$   Move to last line of file
/   Search for a character string.
?   Reverse search for a character string.
x   Delete the character at the cursor position.
dd   Delete the current line.
p   Paste data that was cut with x or dd commands.
u   Undo.
ctrl-F   Move forward one screen.
ctrl-B   Move backward one screen.
Shift-G    Last line of the file
20 Shift-G   Go to line 20
:/wordname   to search any word in file.
:set number   to give numbering in file.
:set autoindent   to give auto numbering in file.


Note: esc or Escape command will Switch from Input mode to Command mode.
For edit,save or quit the file we have to press esc before using below commands

:w   to save file.
:q!   to quit without saving.
:wq   to save and quit.

Monday, June 7, 2010

Basic Linux Commands

A shell is a command-line interpreter: it takes commands and executes them.Bash (Bourne-again shell) is the default shell for most current Linux distributions (and Mac OS X) and can be run on most Unix-like operating systems.To check what shell you are currently using, open the console, type echo $SHELL, and press Enter. It should return a pathname ending with /bash.

W - shows all users and what they are doing
finger - displays information about system users
who - show who is logged on
pwd - print working directory
history-shows previous used commands
uname - shows system information
ip addr - reports your IP address
ls - displays directory contents
ls -l - like ls,but in a more readable format
su - switch user/super user
nano - basic text editor
kwrite - gui text editor
free - display memory usage
df - displays free disk space(df -h - displays in more readable format)
man [command] - gives more information about command
ps - lists the current running processes on your Linux system
kill and killall commands - used to kill|terminate running processes

whoami - prints ur login name
last-Show listing of users last logged-in on your system.
history | more - Show the last (1000 or so) commands executed from the command line on the current account. The "| more" causes the display to stop after each screenful.
uptime - Show the amount of time since the last reboot.
top - Keep listing the currently running processes, sorted by cpu usage (top users first). In KDE, you can get GUI-based Ktop from "K"menu under "System"-"Task Manager" (or by executing "ktop" in an X-terminal).

vi editor in linux

The VI editor is a screen-based editor.
The VI editor allows a user to create new files or edit existing files. The command to start the VI editor is vi, followed by the filename.

For example open terminal and enter vim test.txt this will open a new file named test,if the file is not present it will create a new file, here to enter text in this file, press Insert button in keyboard, so that we can enter some text in the file and press Esc:wq for saving the file.

Tuesday, June 1, 2010

Making cursor focus on the first component in JSF form

<body onload="javascript:document.name.tf_NAME.focus();">
<h:form id="name"prependId="false">
<h:outputText id="lb_NAME"value="Name.:" />
<h:inputText id="tf_NAME" />
</h:form>
</body>

JSF Related topics: JCaptcha in JSF, Integrating Richfaces with JSF,Getting client and server sessionId in JSF,PopUp AlertMessagebox for JSF and more.....