Posts

Showing posts from January, 2011

javascript regular expressions

Image
Introductory Guide to regular expressions Credits: This tutorial is written by Karen Gayda. Modified by JavaScriptKit.com for structure and added additional content/ examples. Please see footnote for more information on author. Introduction Validating user input is the bane of every software developer’s existence. When you are developing cross- browser web applications (IE4+ and NS4+) this task becomes even less enjoyable due to the lack of useful intrinsic validation functions in JavaScript. Fortunately, JavaScript 1.2+ has incorporated regular expressions. In this article I will present a brief tutorial on the basics of regular expressions and then give some examples of how they can be used to simplify data validation. Regular Expressions and Patterns Regular expressions are very powerful tools for performing pattern matches. PERL programmers and UNIX shell programmers have enjoyed the benefits of regular expressions for years. Once you master the pattern language, m

javascript history methods usage

The JavaScript History object - property of the window object - contains an array / list of previously visited URLs. In this article, we will look at the history object properties and methods , length , current , next , previous properties, back() , forward() and go() methods along with syntax and examples. Mostly, JavaScript history object is used to simulate the browser's back button : <a href="javascript:history.go(-1)">Go back</a> window.history window.history property has the return value as an array which contains items with details of the URL's visited within that browser window/tab. The JavaScript history object is a JavaScript object and not a DOM object. The JavaScript runtime engine automatically creates this object. window.history Properties history.length The length property of the history object returns the number of elements in the history list. General syntax of length property of history Object: history.lengt

producer consumer in jms System

/*   * @(#)HelloWorldMessage.java  1.8 05/03/09   *    * Copyright (c) 2000-2002 Sun Microsystems, Inc. All Rights Reserved.   *    * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,   * modify and redistribute this software in source and binary code form,   * provided that i) this copyright notice and license appear on all copies of   * the software; and ii) Licensee does not utilize the software in a manner   * which is disparaging to Sun.   *   * This software is provided "AS IS," without a warranty of any kind. ALL   * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY   * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR   * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE   * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING   * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS   * LICENSORS

alter command in mysql how to use

MySQL ALTER command is very useful when you want to change a name of your table, any table field or if you want to add or delete an existing column in a table. Lets begin with creation of a table called testalter_tbl root@host# mysql -u root -p password; Enter password:******* mysql> use TUTORIALS; Database changed mysql> create table testalter_tbl     -> (     -> i INT,     -> c CHAR(1)     -> ); Query OK, 0 rows affected (0.05 sec) mysql> SHOW COLUMNS FROM testalter_tbl; +-------+---------+------+-----+---------+-------+ | Field | Type    | Null | Key | Default | Extra | +-------+---------+------+-----+---------+-------+ | i     | int(11) | YES  |     | NULL    |       | | c     | char(1) | YES  |     | NULL    |       | +-------+---------+------+-----+---------+-------+ 2 rows in set (0.00 sec) Dropping, Adding, or Repositioning a Column: Suppose you want to

how to forward and include one servlet request another servlet or jsp

If you are familiar with ASP 3.0 then you must be knowing about Server.Transfer and Server.Execute methods. Server.Transfer forwards the control to another ASP page while Server.Execute executes the given page and after that gives the control back to the caller page. Servlet API also provides us this functionality with the RequestDispatcher interface. This interface has just two methods, forward() and include which do pretty much what their names suggest. In this article we will learn how to pass control from one Servlet to another using RequestDispatcher.forward() method and how to include response from another Servlet within the caller Servlet using RequestDispatcher.include() method. RequestDispatcher Interface This interface is present in the javax.servlet package and contains only following two methods : forward(ServletRequest request, ServletResponse response) Forwards a request to another resource on the same server. That resource can be a Servle