Tuesday, November 29, 2011

NETBEANS SHORTCUTS (Debugging)


Debugging
Ctrl-F5                        Start debugging main project

Ctrl-Shift-F5              Start debugging current file

Ctrl-Shift-F6              Start debugging test for file
(JUnit)
Shift-F5/F5                Stop/Continue debugging session

F4                               Run to cursor location in file

F7/F8                          Step into/over

Ctrl-F7                        Step out

Ctrl-Alt-Up                 Go to called method

Ctrl-Alt-Down            Go to calling method

Ctrl-F9                        Evaluate expression

Ctrl-F8                        Toggle breakpoint

Ctrl-Shift-F8              New breakpoint

Ctrl-Shift-F7              New watch

Enhanced by Zemanta

NETBEANS SHORTCUTS (JSP Editor Code Templates)


JSP Editor Code Templates
ag                    application.getAttribute("|")

ap                    application.putAttribute("|",)

ar                     application.removeAttribute("|")

cfgi                  config.getInitParameter("|")

jspf                 

jspg                 

jspi                  

jspp                 

jsps                 

jspu                 

oup                  out.print("|")

oupl                 out.println("|")


pcg                  pageContext.getAttribute("|")

pcgn                pageContext.getAttributeNamesInScope("|")

pcgs                pageContext.getAttributesScope("|")

pcr                   pageContext.removeAttribute("|")

pcs                  pageContext.setAttribute("|",)

pg                    <%@page |%>

pga                  <%@page autoFlush="false"%>

pgb                  <%@page buffer="|kb"%>

pgc                  <%@page contentType="|"%>

pgerr                <%@page errorPage="|"%>

pgex                <%@page extends="|"%>

pgie                 <%@page isErrorPage="true"%>

pgim                <%@page import="|"%>

pgin                 <%@page info="|"%>

pgit                  <%@page isThreadSafe="false"%>

pgl                   <%@page language="java"%>

pgs                  <%@page session="false"%>

rg                     request.getParameter("|")

sg                    session.getAttribute("|")

sp                    session.setAttribute("|", )

sr                     session.removeAttribute("|")

tglb                  <%@taglib uri="|"%>

Enhanced by Zemanta

NETBEANS SHORTCUTS (Coding in Java)


Coding in Java

Alt-Insert                    Generate code

Ctrl-Shift-I                  Fix all class imports

Alt-Shift-I                   Fix selected class's import

Alt-Shift-F                  Format selection

Alt-Shift Left/             Shift lines left/right/up/down
Right/Up/Down

Ctrl-Shift-Up/D          Copy lines up/down

Ctrl/Alt-F12                Inspect members/hierarchy

Ctrl-/                            Add/remove comment lines

Ctrl-E                          Delete current line


Ctrl-K/Ctrl-Shift K     Next/previous word match

Alt-Left/Alt-                Go backward/forward/to last

Right/Ctrl-Q               edit

Alt Up/Down              Next/previous marked occurrence

NETBEANS SHORTCUTS (Navigating through Source Code)


Navigating through Source Code

Ctrl-O/Alt-Shift-O       Go to type/file

Ctrl-Shift-T                  Go to JUnit test

Alt-O                           Go to source

Ctrl-B                          Go to declaration

Ctrl-G                          Go to line

Ctrl-Shift-M                 Toggle add/remove bookmark

Ctrl-Shift-Period/Comma    Next/previous bookmark

Ctrl-Period/Comma    Next/previous usage/compileerror

Ctrl-Shift-1/2/3           Select in Projects/Files/Favorites

Ctrl-[                          Move caret to matching bracket

Ctrl-K/Ctrl-Shift K     Next/previous word match

Alt-Left/Alt-                Go backward/forward/to last

Right/Ctrl-Q               edit

Alt Up/Down             Next/previous marked occurrence

NETBEANS SHORTCUTS (Finding, Searching, and Replacing)



Finding, Searching, and Replacing

Ctrl-F3                      Search word at insert point

F3/Shift-F3                Find next/previous in file

Ctrl-F/H                    Find/Replace in file

Alt-F7                       Find usages

Ctrl-Shift-F/H            Find/replace in projects

Alt-Shift-U                 Find usages results

Alt-Shift-H                 Turn off search result highlights

Ctrl-R                        Rename

Ctrl-U,                       then U Convert selection to uppercase

Ctrl-U,                       then L Convert selection to lowercase

Ctrl-U,                      then S Toggle case of selection

Ctrl-Shift-V               Paste formatted

Ctrl-I J                       ump to quick search field


Wednesday, November 16, 2011

WHAT IS UTF-8 ?



UTF-8 :   UCS Transformation Format — 8-bit
Unicode is a character set supported across many commonly used software applications and operating systems.
Operating systems that support Unicode include Solaris Operating Environment, Linux, Microsoft Windows 2000, and Apple’s Mac OS X.
Applications that support Unicode are often capable of displaying multiple languages and scripts within the same document.
In a multilingual office or business setting, Unicode’s importance as a universal character set cannot be overlooked.
Unicode is the only practical character set option for applications that support multilingual documents.
An encoding is the mapping of Unicode code points to a stream of storable code units or octets.

Enhanced by Zemanta

JAVA CODE FOR VARIOUS DIALOG BOXES



import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.HeadlessException;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

import javax.swing.JButton;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

public class TestDialogue extends JFrame implements ActionListener {
    JButton button1 =null;
    JButton button2 =null;
    JButton button3 =null;

  public TestDialogue() throws HeadlessException {
    setSize(200, 200);
    setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    button1 = new JButton("Simple Message dialog");
    button2 = new JButton("Dialog with InputBox");
    button3 = new JButton("Yes/No dialog");

    setLayout(new FlowLayout(FlowLayout.CENTER));
    getContentPane().add(button1);
    getContentPane().add(button2);
    getContentPane().add(button3);

    button1.addActionListener(this);
    button2.addActionListener(this);
    button3.addActionListener(this);
  }

  public static void main(String[] rk) {
        try
 {
  UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
 }catch(Exception e)
        {}
        new TestDialogue().setVisible(true);
  }

    @Override
    public void actionPerformed(ActionEvent e) {
    String Action;
    Action = e.getActionCommand ();

        if(Action.equals("Simple Message dialog")){
            JOptionPane.showMessageDialog((Component) e.getSource(), "Hello ! Thank you!");

        }else if(Action.equals("Dialog with InputBox")){
            String name = JOptionPane.showInputDialog((Component) e.getSource(), "Hello, please Input your name.");
            if (name != null && !name.equals("")) {
                JOptionPane.showMessageDialog((Component) e.getSource(), "Hi, " + name);
            }

        }else if(Action.equals("Yes/No dialog")){

            int result = JOptionPane.showConfirmDialog((Component) e.getSource(), "Close this application?");
            if (result == JOptionPane.YES_OPTION) {
            System.exit(0);
            } else if (result == JOptionPane.NO_OPTION) {
            System.out.println("No Action performed.");

        }
       }

    }
}

Enhanced by Zemanta

Thursday, November 10, 2011

What is URLEncoding in Java ?


Utility class for HTML form encoding. This class contains static methods for converting a String to the application/x-www-form-urlencoded MIME format. For more information about HTML form encoding, consult the HTML specification.
When encoding a String, the following rules apply:
  • The alphanumeric characters "a" through "z", "A" through "Z" and "0" through "9" remain the same.
  • The special characters ".", "-", "*", and "_" remain the same.
  • The space character " " is converted into a plus sign "+".
  • All other characters are unsafe and are first converted into one or more bytes using some encoding scheme. Then each byte is represented by the 3-character string "%xy", where xy is the two-digit hexadecimal representation of the byte. The recommended encoding scheme to use is UTF-8. However, for compatibility reasons, if an encoding is not specified, then the default encoding of the platform is used.

Tuesday, November 8, 2011

CSS CODE FOR MOUSE POINTERS

style="cursor: default;"
style="cursor: hand;"
style="cursor: pointer;"
style="cursor: pointer; cursor: hand;"
style="cursor: crosshair;"
style="cursor: text;"
style="cursor: wait;"
style="cursor: help;"
style="cursor: move;"
e-resize
style="cursor: e-resize;"
ne-resize
style="cursor: ne-resize;"
nw-resize
style="cursor: nw-resize;"
n-resize
style="cursor: n-resize;"
se-resize
style="cursor: se-resize;"
sw-resize
style="cursor: sw-resize;"
s-resize
style="cursor: s-resize;"
w-resize
style="cursor: w-resize;"
progress
style="cursor: progress;"
all-scroll
style="cursor: all-scroll;"
col-resize
style="cursor: col-resize;"
no-drop
style="cursor: no-drop;"
not-allowed
style="cursor: not-allowed;"
row-resize
style="cursor: row-resize;"
url(uri)
style="cursor: url(mycursor.cur);"
IE6vertical-text
style="cursor: vertical-text;"

Monday, November 7, 2011

jQuery function , Selectors, Fade effect.

jQuery function

  • You use this to select elements from an HTML page to manipulate.
  • The $ shortcut means you don't have to type “jQuery" over and over.
  • The jQuery function can handle selectors, straight HTML, and even JavaScript objects.

Selectors

  • jQuery selects elements the same way CSS does: with selectors.
  • Just about any kind of HTML element is fair game for a jQuery selector.

Fade effect
  • Once you've selected an element, you can fade it in a variety of ways, using FadeIn, FadeOut, FadeTo, and FadeToggle.
  • You can fade in all kinds of elements, from text to images and more.
  • Control the speed of your fade effect by putting a time (in milliseconds) value inside the parentheses at the end of the statement.

Tuesday, November 1, 2011

Convert JAVA DATE to MS SQL datetime format


SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");

Date javaDate=new Date();

System.out.println("Java Date : "+javaDate);

String msSqlDate=sdf.format(javaDate).trim();

System.out.println("Ms Sql Date : "+msSqlDate.replace(" ","T"));

insert into DATA (CREATED) values (convert(datetime,'"+msSqlDate+"'));