For Developers

Search a website or blog without search box

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.

setInterval Method in Javascript

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

JSON Data types and Example

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"
]
}

What is JSON?

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.

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

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