Skip to main content

Posts

Showing posts from 2012

Read URL Page Content

How to Read PageContent by URL Below function is used to get the page content by the URL Import the name Spaces using System.Text; using System.Net; public string readPageContent( string sURL) { WebClient objWebClient = new WebClient (); System.Text. UTF8Encoding objUTF8 = new UTF8Encoding (); String strRequestState; Byte [] PageHTMLBytes; try { PageHTMLBytes = objWebClient.DownloadData(sURL); return strRequestState = objUTF8.GetString(PageHTMLBytes); } catch ( Exception ex) { return strRequestState = "No page found..." ; } }

Create Temporary Table

How to Create Temporary Table Step 1 : add the below function public DataTable CreateTable() { DataTable odtReviews = new DataTable (); odtReviews.Columns.Add( "ReviewDate" , typeof ( string )); odtReviews.Columns.Add( "PostedBy" , typeof ( string )); odtReviews.Columns.Add( "Content" , typeof ( string )); odtReviews.Columns.Add( "Rating" , typeof ( string )); return odtReviews; } step 2 : create object of above datatable DataTable odtReviews = CreateTable(); step 3 : create datarow DataRow odr; odr = odtReviews.NewRow(); (or) DataRow odr=odtReviews.NewRow(); Step 4 : assign the values odr[ "ReviewDate" ] = "11-Aug-2012" ; . . . step 5 : add datarow into datatable odtReviews.Rows.Add(odr);

Smooth Navigational Menu

Smooth Navigational Menu (v1.51) Updated:   Dec 17th, 10" (v1.5): Updated menu shadow to use CSS3 box shadows when the browser is FF3.5+, IE9+, Opera9.5+, or Safari3+/Chrome. Only .js file changed. Description:  Smooth Navigation Menu is a multi level, CSS list based menu powered using   jQuery   that makes website navigation a smooth affair. And that's a good thing given the important role of this element in any site. The menu's contents can either be from direct markup on the page, or   an external file and fetched via Ajax instead . And thanks to jQuery, a configurable, sleek "slide plus fade in" transition is applied during the unveiling of the sub menus. The menu supports both the   horizontal   and   vertical   (sidebar) orientation. Some noteworthy features- You can specify a delay before the sub menus appear and disappear when the mouse rolls over and out of them, respectively. The sub menus reposition themselves if too close to the window'

Popup form on Screen Center Javascript

Popup Form on Center  to popup the form on Screen Center use the below Script Example : <script language="javascript"> var popupWindow = null; function centeredPopup(url,winName,w,h,scroll){ LeftPosition = (screen.width) ? (screen.width-w)/2 : 0; TopPosition = (screen.height) ? (screen.height-h)/2 : 0; settings = 'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable' popupWindow = window.open(url,winName,settings) } </script> <p><a href="http://www.quackit.com/common/link_builder.cfm" onclick="centeredPopup(this.href,'myWindow','500','300','yes');return false">Centered Popup</a></p>

Using RNGCryptoServiceProvider and Character Masking

Uniquekey Generate Method Code : using System.Security.Cryptography; import the above class for using the code private string GetUniqueKey()   {   int maxSize  = 8 ;   int minSize = 5 ;   char[] chars = new char[62];   string a;   a = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890";   chars = a.ToCharArray();   int size  = maxSize ;   byte[] data = new byte[1];   RNGCryptoServiceProvider  crypto = new RNGCryptoServiceProvider();   crypto.GetNonZeroBytes(data) ;   size =  maxSize ;   data = new byte[size];   crypto.GetNonZeroBytes(data);   StringBuilder result = new StringBuilder(size) ;   foreach(byte b in data ) { result.Append(chars[b % (chars.Length - 1)]); }    return result.ToString();   } Generation Method Time Taken Number of Generated Keys Number of Duplicate Keys All Fixed Length Keys Using DateTime and HashCode 01.56 sec  10,00,000

Get Query String Values by Javascript

Get Query String Values by Javascript Script Function function GET () { var data = []; for ( x = 0 ; x < arguments . length ; ++ x ) data . push ( location . href . match ( new RegExp ( "/\?" . concat ( arguments [ x ], "=" , "([^\n&]*)" )))[ 1 ]) return data ; } Example : data = GET ( "id" , "name" , "foo" ); query string : ? id = 3 & name = jet & foo = b returns : data [ 0 ] // 13 data [ 1 ] // jet data [ 2 ] // b or alert ( GET ( "id" )[ 0 ]) // return 3