About The Author

This is a sample info about the author. Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Quisque sed felis.

Get The Latest News

Sign up to receive latest news

Saturday 27 August 2011

jQuery.noConflict() → jQuery

This helps to make sure that jQuery doesn't conflict with the $ object of other libraries. By using this function, you will only be able to access jQuery using the 'jQuery' variable. For example, where you used to do $("div p"), you now must do jQuery("div p").

Example:
Maps the original object that was referenced by $ back to $.
jQuery.noConflict();
// Do something with jQuery
jQuery("div p").hide();
// Do something with another library's $()
$("content").style.display = 'none';
Example:
Reverts the $ alias and then creates and executes a function to provide the $ as a jQuery alias inside the functions scope. Inside the function the original $ object is not available. This works well for most plugins that don't rely on any other library.
jQuery.noConflict();
(function($) {
$(function() {
// more code using $ as alias to jQuery
});
})(jQuery);
// other code using $ as an alias to the other library
Example:
Creates a different alias instead of jQuery to use in the rest of the script.
var j = jQuery.noConflict();
// Do something with jQuery
j("div p").hide();
// Do something with another library's $()
$("content").style.display = 'none';
»»  read more

How to run .exe file in asp.net?

Steps to Access the .exe files using .net:

1). Import the below class in your file:
using System.Diagnostics;
2). Write this code on button_click event--
Process p = new Process();
p.StartInfo.FileName="c:\\windows\notepad.exe";
p.Start();
»»  read more

How To Install And Configure Wibiya Web Toolbar For WordPres

»»  read more

Friday 26 August 2011

MySQL Alter Table Add Column Command

Alter Table command is used for modifying the structure of the table. Means to add the new column, drop the column etc.

ADD COLUMN:
Syntax:
ALTER TABLE table_name ADD COLUMN column_name column-definition [ FIRST | AFTER col_name ]
Note: We can use both ADD COLUMN or ADD for adding the column.

Example 1:
ALTER TABLE student ADD COLUMN st_phone varchar(12) NOT NULL, st_gender varchar(5) NOT NULL;

Example 3:
ALTER TABLE student ADD COLUMN st_phone varchar(12) NOT NULL AFTER st_mobile,ADD COLUMN st_gender varchar(5) NOT NULL AFTER st_name,ADD COLUMN st_id int FIRST;

Example 4:
ALTER TABLE student ADD (st_phone varchar(100), st_email varchar(200),st_address varchar(200));

Example 5:
ALTER TABLE student ADD COLUMN st_phone varchar(12) DEFAULT NULL;

Example 6:
ALTER TABLE student ADD COLUMN st_id int NOT NULL AUTO_INCREMENT PRIMARY KEY;
»»  read more

MySQL Create Table Commands

Create Table command is used for creating tables in mysql.

Syntax 1:
CREATE TABLE [IF NOT EXISTS] table_name(
column_name1 type(size) constraints,
column_name2 type(size) constraints,
------------------------------------
------------------------------------
);

Constraints of tables: NOT NULL, AUTO_INCREMENT, PRIMARY KEY,UNIQUE
Note: The sequence of Constraints will be : NOT NULL, AUTO_INCREMENT, PRIMARY KEY,UNIQUE

Example:
CREATE TABLE student(
st_id int(11) NOT NULL AUTO_INCREMENT PRIMARY KEY,
st_name varchar(200),
st_father varchar(200) NOT NULL
);

Syntax 2:
CREATE TABLE table_name(
column_name1 type(size) constraints,
column_name2 type(size) constraints,
------------------------------------
------------------------------------
column_name2 type(size) constraints,
PRIMARY KEY(column_name)
);

Example:
CREATE TABLE student(
st_id int(11) NOT NULL AUTO_INCREMENT,
st_name varchar(200),
st_father varchar(200) NOT NULL, PRIMARY KEY(st_id)
);

Syntax 3:
CREATE TABLE table_name SELECT column1,column2,column3 FROM table_name WHERE condition;

Note 1: The above syntax will create the backup of existing table, with the data structure and contents.

Note 2: The above command will not copy auto incremented fields and the primary key constraints.

Example:
CREATE TABLE student_backup SELECT * FROM student;

Show the structure of the table:

Syntax 1: DESC table_name;
Example: DESC student;

Syntax 2: EXPLAIN table_name;
Example: EXPLAIN student;

Syntax 3: EXPLAIN table_name;
Example: EXPLAIN student;

Note: EXPLAIN, DESC, DESCRIBE works as same way.

Syntax 4: SHOW CREATE TABLE table_name;
Example: SHOW CREATE TABLE student;
»»  read more

How to connect MySQL with Java?

Steps to Connnect the MySQL with JDBC:
------------------------------------------
1). Download MySQL database.
2). Install it.
3). Download the mysql-connector-java-5.1.10, it depends on your JDBC version
4). It is a type 4 driver.
5). Extract the mysql-connector-java-5.1.10 and copy the "mysql-connector-java-[version]-bin-g.jar" into such location where you can find it easily.
6). Now set the "CLASSPATH" for that jar file.
7). Copy the code and paste it to your file:

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class MySQLCon {

public static void main(String args[]) {
Connection con = null;

try {
Class.forName("com.mysql.jdbc.Driver").newInstance();
con = DriverManager.getConnection("jdbc:mysql:///DATABASE NAME","root", "");

if(!con.isClosed())
System.out.println("Successfully connected to MySQL server using TCP/IP...");

} catch(Exception e) {
System.err.println("Exception: " + e.getMessage());
} finally {
try {
if(con != null)
con.close();
} catch(SQLException e) {}
}
}
}

8). Provide the Database Name and the credentials of the MySQL.
9). Compile it and run it.
»»  read more

How to Connect MySQL with Java?

»»  read more