
November 18th, 2008

admin
We can have a function with return true and use it on window.onerror.Thus when the browser encounters a JavaScript error it returns true and block the error begin displayed.
function blkError()
{
return true;
}
window.onerror = blkError;
Popularity: 1% [?]

November 16th, 2008

admin
Open a File in Runtime in Java:
1.Create a Object For Process
2.exec is a method to open a File in Runtime
3.In the exec Method, we can give all the command which can be give in the Run Window
Process process=Runtime.getRuntime().exec(“notepad d:\demo.txt”);
4.If it cannot Work,Copy Exe File and Paste it in C:\Windows\System32
Popularity: 1% [?]

November 14th, 2008

admin
The if tag allows the conditional execution of its body according to the value of the test attribute
<c:if test=”${not empty details.add}”>
It is Not a Empty ArrayList
</c:if>
<c:if test=”${empty details.add}”>
It is a Empty ArrayList
</c:if>
The choose tag performs conditional block execution by the embedded when subtags. It renders the body of the first when tag whose test condition evaluates to true. If none of the test conditions of nested when tags evaluates to true, then the body of an otherwise tag is evaluated, if present.
<c:choose>
<c:when test=”${bank.account== ‘saving’}”>
Saving Account
</c:when>
<c:when test=”${bank.account == ‘RD’}”>
RD Account
</c:when>
<c:when test=”${bank.account == ‘salary’}”>
Salary Account
</c:when>
<c:otherwise>
…
</c:otherwise>
</c:choose>
Popularity: 3% [?]

November 14th, 2008

admin
usually you would send a random generated password while user does the registration process through your application.You can use the following code to achieve that.
public string Generate_Password()
{
string Password = “”;
byte Cnt, Idx;
string values = “0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ”;
Random rnd = new Random();
for (Cnt = 1; Cnt <= 6; Cnt++)
{
Idx = (byte)rnd.Next(0, values.Length);
Password += values.Substring(Idx, 1);
}
return Password.Trim().ToUpper();
}
To Generate Random Password we have used the Random Class(Namespace:-System).To learn more about Random Class have a look at this MSDN LINK.
Popularity: 4% [?]

November 14th, 2008

admin
When we are connecting sql server using windows authentication then we do not need to give the user name and pwd in the connection string. We have to provide the Integrated Security property to true.
SqlConnection con = new SqlConnection(“Server=servername;Integrated Security=true; Database=emp”);
Note : If your sql server is of windows authentication and if you dont provide Integrated Security you may get an error such as follows
Login failed for user ‘(null)’. Reason: Not associated with a trusted SQL Server connection.
Popularity: 1% [?]

November 10th, 2008

admin
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% [?]

November 10th, 2008

admin
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% [?]