Tuesday, 7 February 2012

few Free Wireframing and Mockup Tools


The Deadly #Linux #Commands

If you are new to Linux, chances are you will meet a stupid person perhaps in a forum or chat room that can trick you into using commands that will harm your files or even your entire operating system. To avoid this dangerous scenario from happening, I have here a list of deadly Linux commands that you should avoid.

1. Code:

rm -rf /




Monday, 27 June 2011

Atom v/s RSS

Hi friends,
  to follow's  our favorite blogs or websites, usually we subscribe Atom or RSS feed  provided by those blogs or  websites. so one should  know the difference  and similarity between them

Read more »

.: Forget '.com', are you ready for '.google', or '.b...

.: Forget '.com', are you ready for '.google', or '.b...: "Think of it as a cyberspace land rush, as companies and others try to stake claims to websites ending with names like '.bank' Come next yea..."

compile by
Divyang Panchasara
Sr. Programmer Analyst
Hitech OutSourcing

Sunday, 26 June 2011

GUIDs (Globally Unique Identifiers) in .NET




Hi Friends,

GUID is frequently used in .NET and  SQL database system to set uniqueness of record or object.  And my friend  Priyank has  describe GUID very nicely in his latest post on his blog so I have repost  it here. you may like it. and you can refere his blog by clicking his  name to read  full blog.

GUIDs (Globally Unique Identifiers) in .NET

.net

What is GUID ?

A GUID is a 128-bit integer that can be used to uniquely identify something. You may store as primary key in your database. A common approach is to create a auto incrementing integer, another way would be to create a GUID for your field.
GUIDs can be generated in a number of ways; most often a hash of several things that might be unique at any given point in time like the IP address plus the clock date/time etc are used to generate Unique Ids. Each system may have slightly different algorithm to generate the Unique Id.



How to create GUID in C#?

In C#, System.GUID class represents a GUID in .NET Framework. System.GUID has static method NewGuid() , which generates a new Guid.

Example

// This code example demonstrates the Guid.NewGuid() method.

using System;

class Sample
{
public static void Main()
{
Guid g;
// Create and display the value of two GUIDs.
g = Guid.NewGuid();
Console.WriteLine(g);
Console.WriteLine(Guid.NewGuid());
}
}

/*
This code example produces the following results:

0f8fad5b-d9cb-469f-a165-70867728950e
7c9e6679-7425-40de-944b-e07fc1f90ae7

*/

GUID.Empty

As the Guid structure cannot be set to null, a value must be used to represent an ID that is not set. For that, GUID.Empty is a read-only instance of the GUID class whose value is guaranteed to be all zeros( 00000000-0000-0000-0000-000000000000 ). This is the same value that is generated by the parameter-less constructor. In order that a new Guid structure is not created every time a value must be compared with the empty GUID, the structure provides the Empty property. This property is read-only and always returns an empty GUID.

Example

// This code example demonstrates the Guid.NewGuid() method.

using System;

class Sample
{
public static void Main()
{
Guid guidObj = new GUID();
 
// Compare with guidObj with GUID.Empty
    Console.WriteLine(guidObj == GUID.Empty); // Returns true 
// Assign New GUID to guidObj
guidObj = Guid.NewGuid();
// Again, compare with guidObj with GUID.Empty
Console.WriteLine(guidObj); // Returns false

}
}

GUID string formatting

As with all objects and structures, the GUID can be converted to a string using the ToString method. If the method is used without parameters, the GUID is formatted as a simple series of hexadecimal digits in the five groups described earlier.
The format of the converted string can be modified using a format specifier. This is passed as a string parameter to the ToString method.
The available format specifiers are listed in the table below.The format parameter can be "N", "D", "B", "P", or "X". If format is null or an empty string (""), "D" is used. The following table shows the accepted format specifiers for the format parameter. "0" represents a digit; hyphens ("-"), braces ("{", "}"), and parentheses ("(", ")") appear as shown.

Specifier Description Format of return value
N 32 digits 00000000000000000000000000000000
D 32 digits separated by hyphens 00000000-0000-0000-0000-000000000000
B 32 digits separated by hyphens, enclosed in braces {00000000-0000-0000-0000-000000000000}
P 32 digits separated by hyphens, enclosed in parentheses (00000000-0000-0000-0000-000000000000)
X Four hexadecimal values enclosed in braces, where the fourth value is a subset of eight hexadecimal values that is also enclosed in braces: {0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}

Example

Console.WriteLine(Guid.Empty.ToString("N")); //00000000000000000000000000000000
Console.WriteLine(Guid.Empty.ToString("D")); //00000000-0000-0000-0000-000000000000
Console.WriteLine(Guid.Empty.ToString("B")); //{00000000-0000-0000-0000-000000000000}
Console.WriteLine(Guid.Empty.ToString("P")); //(00000000-0000-0000-0000-000000000000)
Console.WriteLine(Guid.Empty.ToString("X")); //{0x00000000,0x0000,0x0000,{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00}}

How to use in Microsoft SQL Server

We can generate GUID in Sql Server with the help of NEWID() function.
For more detail : NEWID() - Generate Randomly Sort Records - TSQL


Saturday, 25 June 2011

Validation in HTML5 without JavaScript

Hi Friends,
any website or web page which  allowed to fill data,  should have  client side as well as server side validation  for those entered data. hence in any website  client side  validation is done by JavaScript only. but in  HTML 5  now we can do validation without JavaScript.

 
you can have required  filed  by providing  required  attribute to those input type as shown below.


 <input type="email" required/> where required will indicate that a value must be supplied
images/forms_validation_required.png


S
compile by
Divyang Panchasara
Sr. Programmer Analyst
Hitech OutSourcing

Thursday, 23 June 2011

EB algorithm for Azure Database connection

Hi Friends,
As cloud computing  buzzing now days, so I spend my spare time to do some hand-on code for Window Azure using trial pass and reading related blogs for that
  Then during  my hand-on , once I face the problem of frequent connection failure due to  my Azure db was unavailable for few seconds .
Read more »