Sunday, May 29, 2011

Firefox 4 change: input type image only submits x and y, not name when clicked. Keyboard as before

Firefox 4.0 beta — as well as IE and Opera — do not send name/value for input type=”image”; only .x and .y coordinates are sent.

Note, this is when clicking the input image with a mouse. When navigating using keyboard, focusing on it, and pressing enter, then the name does get submitted.

If you need to use an image button as a submit button in a form then you have to pass a hidden value to process the form.

EX:





then in test.php page

isset($_post['passvalue'])

{

process the request

}



?>







Firefox 4 change: input type image only submits x and y, not name when clicked. Keyboard as before

Firefox 4.0 beta — as well as IE and Opera — do not send name/value for input type=”image”; only .x and .y coordinates are sent.

Note, this is when clicking the input image with a mouse. When navigating using keyboard, focusing on it, and pressing enter, then the name does get submitted.

If you need to use an image button as a submit button



Firefox 4 change: input type image only submits x and y, not name when clicked. Keyboard as before

Firefox 4.0 beta — as well as IE and Opera — do not send name/value for input type=”image”; only .x and .y coordinates are sent.

Note, this is when clicking the input image with a mouse. When navigating using keyboard, focusing on it, and pressing enter, then the name does get submitted.

If you need to use an image button as a submit button in a form then you have to pass hidden value



Sunday, May 15, 2011

How to set windows look and feel in JFrame GUI in java

public static void main(String[] args) {
try
{

UIManager.setLookAndFeel(
"com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
}
catch (Exception e) { }

new SwingApplication(); //Create and show the GUI.
}

Monday, May 2, 2011

Linux Commands

tar Commands

1. Creating an uncompressed tar achieve.

tar cvf filename.tar filename/foldername


In the above command:
  • c – create a new archive
  • v – verbosely list files which are processed.
  • f – following is the archive file name
ex:

tar cvf abc.tar myfile.txt
tar cvf pqr.tar myfolder

2.
Creating a tar gzipped archieve using option cvzf


To use gzip compression on the tar archive, use the z option as follows.

tar cvzf filename.tar.gz dirname/

tar cvzf filename.tar.gz filename

In the above command

  • c – create a new archive
  • v – verbosely list files which are processed.
  • f – following is the archive file name
  • z– filter the archive through gzip
ex:

tar cvzf filename.tar.gz filename.txt

3. Extracting (untar) a file using tar command

tar xvf filename.tar

In the above command

  • x – extract files from archive.
  • v – verbosely list files which are processed.
  • f – following is the archive file name

ex:

tar xvf filename.tar

4. Extracting a gziped tar achieve.

tar xvfz filename.tar.gz

In the above command
  • x – extract files from archive.
  • v – verbosely list files which are processed.
  • f – following is the archive file name
  • z- uncompressing a gzipped tar achieve.

tail Command

Example 1:

tail mytextfile.txt
-  The above command list the last 10 lines of the file "mytextfile.txt"

tail mytextfile.txt -n 100

- The above command list last 100 lines of the file "mytextfile.txt"

tail -f mytextfile.txt 
- The above command displays the last 10 lines and then update the file as new lines are being added
- This is a very useful command to watch log files in realtime

tail -f access.log | grep 127.0.0.2

- The above command can use to filter the output of the file