Author Archive

What is Delegate?

A delegate is a type that references a method.Once a delegate is assigned a method, it behaves exactly like that method. The delegate method can be used like any other method,with parameters and a return value.

Any method that matches the delegate’s signature,which consists of the return type and parameters,can be assigned to the delegate.

Delegates allow methods to be passed as parameters.It can be used to define callback methods.

Popularity: 1% [?]

Data Source Object

What is Data Source Object?

A data source object (DSO) is a Microsoft ActiveX object embedded within a Web page. It employs a process called data binding, in which an ActiveXControl communicates directly with another Web page, or with an external XML source.

In order to take advantage of DSOs, it is necessary to have Internet Explorer version 4.0 or later. Web developers commonly create their own DSOs. For example, an animated weather radar image from the National Hurricane Center can be displayed continuously on the home page of a municipal civil defense department, without the need for clicking on a link to get to the National Hurricane Center site.

Data source objects are sometimes used for the purpose of implementing This type of intrusion shows up on spyware detection programs as a DSO exploit. Such spyware can be difficult to eradicate, and if it is successfully removed, it often returns.

Popularity: 1% [?]

What is ViewState ?

ASP.NET view state is the technique used by an ASP.NET Web page to persist
changes to the state of a Web Form across postbacks.That is when a form is submitted in ASP .NET, the form reappears in the browser window together with all form values.

The ViewState indicates the status of the page when submitted to the server. The status is defined through a hidden field placed on each page with a <form runat=”server”> control.

Hidden field placed on each page would be something as this
< input type=”hidden” name=”__VIEWSTATE” value=”CEbzzzEnmmz+Bc8IDFlnpgCLJ/HB00.” >
Maintaining the ViewState is the default setting for ASP.NET Web Forms. If you want to NOT maintain the ViewState, include the directive l%@ Page EnableViewState=”false” %> at the top of an .aspx page or add the attribute EnableViewState=”false” to any control.

Popularity: 1% [?]

Java with Sql Server

How to Connect Java with Sql Server :

1.import sql package

2.Give all the Supporting class in class.forName

3.Give Ipaddress or Computer Name in dburl or in getConnection

4.Use 1433 port Number as Default Port.

5.Give Username and Password in getConnection

6.Open the Connection using createStatement

7.Execute the query String using executeQuery Statement

8.Fetch the Record one by one Using ResultSet

9.Close the Connection

import java.io.*;
import java.sql.*;
public class sqlserverConnection
{
public static String dburl=”jdbc:mysql://localhost:1433”;
public static String username=”admin”;
public static String pwd=”pass”;
public static Connection con=null;
public static Statement stmt=null;
public static ResultSet rs=null;

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

Class.forName( “com.microsoft.jdbc.sqlserver.SQLServerDriver” );
con=DriverManager.getConnection(dburl,username,pwd);
stmt=con.createStatement();
rs=stmt.executeQuery(”SELECT * FROM demo”);
while(rs.next())
{
String name=rs.getString(1);
}
}
catch(SQLException sqlExcp)
{
sqlExcp.printStackTrace();
}
}
}

Popularity: 1% [?]

Java with Mysql

How to Connect Java with Mysql:

1.import sql package

2.Give all the Supporting class in class.forName

3.Give Ipaddress or Computer Name in dburl or in getConnection

4.Give Username and Password in getConnection

5.Open the Connection using createStatement

6.Execute the query String using executeQuery Statement

7.Fetch the Record one by one Using ResultSet

8..mysqldemo is a schema name

9.Close the Connection

import java.io.*;
import java.sql.*;
public class MysqlConnection
{
public static String dburl=”jdbc:mysql://localhost/mysqldemo”;
public static String username=”root”;
public static String pwd=”root”;
public static Connection con=null;
public static Statement stmt=null;
public static ResultSet rs=null;

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

Class.forName(”org.gjt.mm.mysql.Driver”);
(or)
Class.forName(”com.mysql.jdbc.Driver”);//use this

con=DriverManager.getConnection(dburl,username,pwd);
stmt=con.createStatement();
rs=stmt.executeQuery(”SELECT * FROM demo”);
while(rs.next())
{
String name=rs.getString(1);
}
}
catch(SQLException sqlExcp)
{
sqlExcp.printStackTrace();
}
}
}

Popularity: 1% [?]

Database Configuration in CakePHP

Step 1: Open the directory “/root/app/config/”
Step 2: Rename the “database.php.default” into “database.php”
Step 3: Open the file, that contain the default variable as shown below. Change the array variable values

var $default = array(‘driver’ => ‘mysql’,
‘connect’ => ‘mysql_connect’,
‘host’ => ‘localhost’,
‘login’ => ‘user’,
‘password’ => ‘password’,
‘database’ => ‘project_name’,
‘prefix’ => ”);

driver : This can be mysql, postgres, sqlite, adodb or pear-drivername
connect : should use persistent database connections. For mysql this options are ‘mysql_pconnect’ or ‘mysql_connect’
host : name of your database server, such as localhost / mysql.domainname.com
login : user name for your database login
password : password for your database login
database : name of the database
prefix : The string that prefixes every table name in the database. If your tables don’t have prefixes, this to an empty string.
Step 4: Save and close the file.

Popularity: 1% [?]

Add a Row Dynamically using JavaScript

How to Add a Row Dynamically Using JavaScript:

  • We can see how button,textbox,textarea can be added Dynamically
  • All the tag which can be given in the input tag has to be given in setAttribute as shown in below coding
  • if u call a function then call as but1.onclick = function () {show(this)};
  • If u delete the Row,then reorder all the other row

1.If u Add a Button to a Table,then use this

var cell1 = row.insertCell(0);
but1 = document.createElement('input');
but1.setAttribute('type', 'button');
but1.setAttribute('className', 'button');
but1.setAttribute('value', '');
but1.onclick = function () {show(this)};
cell1.appendChild(but1);

2.If u Add a Textbox to a Table,then use this

 
var cell2 = row.insertCell(1);
var txt = document.createElement('input');
txt.setAttribute('type', 'text');
txt.setAttribute('name', 'firsttextbox');
txt.setAttribute('className', 'text_box');
txt.setAttribute('id', 'firsttextbox' + iteration);
txt.setAttribute('size', '21');
cell2.appendChild(txt);

3.If u Add a Textarea to a Table,then use this

cell1 = row.insertCell(1);
var e1 = document.createElement('textarea');
e1.name = 'text2' + iteration;
e1.id = 'text2' + iteration;
e1.column= '50';
cell1.appendChild(e1);

4.Row can be Re-Order by using

var tbl = delRow.parentNode.parentNode;
tbl.tBodies[0].rows[i].myRow.two.id = 'firsttextbox' + count;

If u Delete 3 Row the Reorder as
4th Row as—-3th Row
5th Row as—-4th Row
6th Row as—-5th Row

5.If u want to Delete the Third Row,then use this coding

 
var delRow = obj.parentNode.parentNode;
var rowArray = new Array(delRow);
for (var i=0; i&lt;rowObjArray.length; i++)</div>
{
  var rIndex = rowObjArray[i].sectionRowIndex;
  rowObjArray[i].parentNode.deleteRow(rIndex);
}
  • We have to pass all the id in the row as deleterow(this)
  • this can be get in the obj variable
  • Using the For Loop we have to Delete the Particular Row

Demo Link

Popularity: 1% [?]

Taglibs in JSP

Different Taglibs and its Usuage in JSP:

1.Core:http://java.sun.com/jsp/jstl/core
This Taglibs is used for Looping,Variable Support,Flow control,URL Management and miscellaneous

<%@taglib uri=”http://java.sun.com/jsp/jstl/core” prefix=”c”%>

2.XML:http://java.sun.com/jsp/jstl/xml
This Taglibs is Used for Core,Flow Control and Transformation

<%@taglib uri=”http://java.sun.com/jsp/jstl/xml” prefix=”xl”%>

3.Internationalization:http://java.sun.com/jsp/jstl/fmt
This Taglibs is Used For Locale, Message formatting and Number & date formatting

<%@taglib uri=”http://java.sun.com/jsp/jstl/fmt” prefix=”fmt”%>

4.SQL:http://java.sun.com/jsp/jstl/sql
This Taglibs is Used For Sql Query Purpose

<%@ taglib uri=”http://java.sun.com/jsp/jstl/sql” prefix=”sql”%>

5.Functions:http://java.sun.com/jsp/jstl/functions
This Taglibs is Used For Collection length and String manipulation

<%@ taglib uri=”http://java.sun.com/jsp/jstl/functions” prefix=”fn”%>

Popularity: 2% [?]

Javascript compare two numbers

How to compare two Value in JavaScipts:

1.Get the Value From Html Page using getElementById

2.Compare by Using parseInt For Interger Value and parseFloat For Float Value

3.compare two value as

var first=document.getElementById('first').value;
var second=document.getElementById('second').value; 
 
if(parseInt(first)&lt;parseInt(second))
alert('Second Value is Greater than first');
 
else if(parseInt(first)&gt;parseInt(second))
alert('First Value is Greater than second');
 
else if(parseInt(first)==parseInt(second))
alert('First Value and second value is equal');

4.Include the code in Html Page For TextBox

First Value:<input type="text" value="0" onkeyup="compare();" name="first" id="first">
Second Value:<input type="text" value="0" onkeyup="compare();" name="second" id="second">

Demo Link

Popularity: 51% [?]

CakePHP Files and Folder Structure

When you unpack Cake on your server you will find four folders – app, cake, tmp and vendors. The cake folder is where the core libraries for Cake lay and you generally won’t ever need to touch them unless you want to do some customization to Cake itself.


The app
is where your application specific folders and files will go. The separation between the cake folder with the core libraries and the app folder make it possible for you to have many app folders sharing a single set of Cake libraries. This also makes it easy to update CakePHP: you just download the latest version of Cake and overwrite you current core libraries; No need to worry about overwriting something you wrote for your app.

The tmp directory is used for various Cake operations, such as baking (automatically creating new php files), caching, and logging.

You can use the vendors directory to keep third-party libraries in. You’ll learn more about vendors later.

The folders structure and their basic purposes:

— root (the root directory)

— — app (here’s where your application logic will go)

— — — config (application specific configurations)

— — — controllers (controllers go here)

— — — — components

— — — index.php

— — — models (models go here)

— — — plugins (third party apps – go here)

— — — views (view related files go here)

— — — — elements (small repeated layout items go here)

— — — — errors (error pages go here)

— — — — helpers (your home-based helpers go here)

— — — — layouts (page layouts go here)

— — — — pages (static content managed by PagesController go here)

— — — webroot (this directory as your webroot, and stick your public files in here)

— — — — css

— — — — files

— — — — img

— — — — js

— — cake (this is where the libraries are placed: Note: it’s best not to touch)

— — index.php

— — tmp (used for logs, baking, etc.)

— — vendors (stick your third party libraries here)


Popularity: 1% [?]

Designed by: Business Web Hosting | Thanks to Buy Icons, travel tips and Used Cars