Archive

Archive for January, 2009

Search a website or blog without search box

January 29th, 2009 admin 1 comment

I was looking for a tool to search a blog since it did not have a search box.
So i Searched google but did’nt find any but surprisingly while searching i
came across a article in yourshortestpath which gave the answer and was
very simple.

Use Google To Search A Website or Blog Without A Search Box.

Steps to search a website or blog without search box:

* Go to Google search
* type the word you want to search space site:+”url of the site”

Example : dotnet site:http://fordevs.com

This returns the result with the pages having the word dotnet.

And to note the search returns only the pages indexed by google for that website/blog.

Popularity: 2% [?]

Categories: Internet, Tips And Tricks Tags:

setInterval Method in Javascript

January 19th, 2009 admin No comments

The setInterval() method evaluates a function or an expression repeatedly for the specified number of milliseconds and it returns an interval reference.

Syntax:

variable = setInterval(expression, milliseconds)

or

variable = setInterval(function, milliseconds)

variable holds the interval reference returned by seInterval method.

Example:
Below example display the current time information using setInterval method call the date object.

<html>
<head>
<title> setInterval Method Example </title>
<script language="javascript">
  function startSetInt()
  {
    ref=setInterval("init()",100);
  } 
 
  function init()
  {
    dt = new Date();
    document.getElementById("lbl").innerText = "Timer : " + dt;
    document.getElementById("btnStart").disabled = true;
    document.getElementById("btnStop").disabled  = false;
  }
 
  function stopSetInt()
  {
    clearInterval(ref)
    document.getElementById("lbl").innerText = "Timer : ";
    document.getElementById("btnStart").disabled = false;
    document.getElementById("btnStop").disabled = true;
  }
</script>
</head>
 
<body onload="startSetInt()">
<label id="lbl" name="lbl"></label>
</br>
</br>
 
<input type="button" id="btnStart" value="Start" onclick="startSetInt()" />
<input type="button" id="btnStop" value="Stop" onclick="stopSetInt()" />
 
</body>
</html>

Demo : Click here

Popularity: 2% [?]

Categories: Javascript Tags: ,

JSON Data types and Example

January 12th, 2009 admin No comments

The following are the Basic JSON Data types,

  • Number : integer, real, or floating point
  • String : double-quoted Unicode with backslash escaping
  • Boolean : true and false
  • Array : an ordered sequence of values, comma-separated and enclosed in square brackets
  • Object : collection of key:value pairs, comma-separated and enclosed in curly braces
  • null

Example

{
"firstName": "Praveen",
"lastName": "C",
"address": {
"streetAddress": "KK Nagar",
"city": "Chennai",
"state": "TN",
"postalCode": 6310102
},
"phoneNumbers": [
"091 98943 37266"
]
}

Popularity: 1% [?]

Categories: Javascript Tags: ,

What is JSON?

January 12th, 2009 admin No comments

JSON (JavaScript Object Notation) is a lightweight data-interchange format. It is easy for humans to read and write. It is easy for machines to parse and generate. It is based on a subset of the JavaScript Programming Language, Standard ECMA-262 3rd Edition – December 1999. JSON is a text format that is completely language independent but uses conventions that are familiar to programmers of the C-family of languages, including C, C++, C#, Java, JavaScript, Perl, Python, and many others.

Popularity: 1% [?]

Categories: Javascript, What-is Tags: ,

Get available server names of Sql Server within the local network – SqlDataSourceEnumerator

January 7th, 2009 admin No comments

SqlDataSourceEnumerator is a class in .net framework that gets the available instances of SQL Server within the local network.

DataTable dt = SqlDataSourceEnumerator.Instance.GetDataSources();

SqlDataSourceEnumerator.Instance.GetDataSources() returns a datatable with the available servers in the current network.

The DataTable returned as 4 colunms such as :-

  • ServerName
  • InstanceName
  • IsClustered
  • Version

Popularity: 1% [?]

Categories: C# Tags:

Sorting Program using C#

January 2nd, 2009 admin No comments
namespace SortingNos
{
   class Program
   {
       static void Main(string[] args)
       {
           Console.WriteLine("Enter Numbers :");
           int[] arr = new int[5];
           string arr1 = "";
           for (int i = 0; i < 5; i++)
 {
 arr1 = Console.ReadLine();
 arr[i] = Convert.ToInt32(arr1);            
}
 
 int a, b, temp = 0;
 Console.WriteLine();
 for (a = 0; a < arr.Length; a++)
           {
                               for(b=a+1;b< arr.Length;b++)
               {
                   if (arr[a] > arr[b])
                   {
                       temp = arr[a];
                       arr[a] = arr[b];
                       arr[b] = temp;
                   }
               }             
               Console.WriteLine(arr[a]);              
           }          
          Console.ReadLine();
       }
   }
}

Download

Popularity: 2% [?]

Categories: C# Tags: