Author Archive

Encrypting string value using MD5 in PHP

The md5 method is used to convert the string value into md5 value.
The syntax is,

string md5 ( string $str [, bool $raw_output ] )

Parameters

str : The string.
raw_output : If the optional raw_output is set to TRUE, then the md5 digest is instead returned in raw binary format with a length of 16. Defaults to FALSE.

For Example,

echo “The MD5 value of ‘ForDevelopers’ is ” . md5(“ForDevelopers”);

Popularity: 1% [?]

Check Sql Server database is Case Sensitive or Insensitive (Collation)

If the collation property of a data base is

1.Latin1_General_BIN its case-sensitive
2.SQL_Latin1_General_CP1_CI_AS or Latin1_General_CI_AI its case-insensitive

There are two ways to find out the SQL Server Database Collation

1. Using DATABASEPROPERTYEX

DATABASEPROPERTYEX gets the current setting of the specified database option or property for the specified database.

Syntax :-
DATABASEPROPERTYEX ( database , property )

SELECT DATABASEPROPERTYEX(‘testdb’, ‘Collation’)

This returns the testdb Database Collation property value say if this testdb is a case-sensitive database then it returns

Latin1_General_BIN

2.Using Sql Server Management Studio

Step 1 : Open Sql Server Management Studio.

Step 2 : Right Click on database and click its properties


After clicking the properties you get a database properties modal box such as

The red box shows the collation property value of that database.

Popularity: 3% [?]

All in one search – Yahoo Glue

Yahoo! Glue is a new beta search engine which was initially launched in india as Yahoo Glue India and tested.Yahoo! Glue gets the best content around the web by a single search term in one page that is it displays web pages,news headlines,images,youtube videos,yahoo answer,blog search,flicker photos,wikipedia ect.. cool is’nt it.

Here i have made a search about barack obama which displays information about obama from various corners of the web.Yahoo! Glue home page diaplays top 10 pages from there system.The search keyword ‘barack obama’ is one of the top 10 pages in glue.

Glue does not give the web search result normally instead it provides the specialized information best on web. By this users will receive more relevant, visually appealing search results from across the Web in one page.

Yahoo! Glue now(Nov 19 2008) comes for US relevance and would be available world across soon.

Popularity: 1% [?]

Encrypting text value using MD5 in Dot Net

For example we will have two textboxes such as ‘TextBox1′ and ‘TextBox2′.Now we will encrypt ‘TextBox1′ value using MD5 in Dot Net and display the encrypted value in ‘TextBox2′.

string pwd = “”;
 
pwd = System.Web.Security.FormsAuthentication.HashPasswordForStoringInConfigFile(TextBox1.Text, “MD5″);
 
TextBox2.Text = pwd;

Popularity: 1% [?]

Disable Right Mouse Click Using JavaScript

Description:
This script will prevent the default right menu from popping up when the right mouse is clicked on the web page. Works well in IE4+ and NS4+.

To use this script, paste the following code in the <body> section of your HTML document.
 

Disable right click on mouse

 

Function to handle right click if the browser is IE

<script language="JavaScript">
var message=”Right Click is Disabled”;
function ExeForIE()
{
  if (event.button==2)
  {
     alert(message);
     return false;
  }
}
</script>

 

Function to handle right click if the browser is FireFox

<script language=JavaScript>
var message=”Right Click is Disabled”;
function ExeForFFox(evt)
{
  if (document.layersdocument.getElementById&&!document.all )
  {
    if (evt.which==2evt.which==3)
    {
      alert(message);
      return false;
    }
  }
}
 
if (document.layers)
{
  document.captureEvents(Event.MOUSEDOWN);
  document.onmousedown = ExeForFFox;
}
else if (document.all&amp;&amp;!document.getElementById)
{
  document.onmousedown = ExeForIE;
}
document.oncontextmenu=new Function(alert(message);return false)
</script>

Popularity: 1% [?]

Block JavaScript Errors

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

Open a File in Runtime in Java

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

Conditional Tags in JSP

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

SQL Server Connection Using Integrated Security

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

Function To Generate Random Password using C#

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 &lt;= 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: 3% [?]

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