<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-9030806299518147997</id><updated>2012-01-01T01:53:34.516-08:00</updated><title type='text'>Abhishek's Blog</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://abhishek-sur.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://abhishek-sur.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Abhishek Sur</name><uri>https://profiles.google.com/117353808377089262292</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-6COXfM91xyM/AAAAAAAAAAI/AAAAAAAAAAA/CW6fzIy03CM/s512-c/photo.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>7</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-9030806299518147997.post-7660854125524362734</id><published>2009-09-07T13:31:00.000-07:00</published><updated>2009-09-07T13:39:23.130-07:00</updated><title type='text'>Comparision between Response.Redirect, Response.RedirectParmanent and Server.Transfer</title><content type='html'>It is to be noted, .NET has lately introduced Response.RedirectParmanent() after a long time. The main motive is to have permanent response redirection to the Search Engines.&lt;br /&gt;&lt;br /&gt;Response.RedirectParmanent() is an extension function introduced in .NET 4.0.&lt;br /&gt;The main motive of it is to indicate the Response Code to the Search Engine that the page is moved permanently. The Response.Redirect generates Response code as 302 whereas RedirectParmanent returns 301.&lt;br /&gt;&lt;br /&gt;Thus say you have a page, and which is included to search engine for a long time, if you use Response.Redirect() it will not change this effect to the search engine(taking this a temporary change), while if you use Response.RedirectParmanent() it will take it as permanent.&lt;br /&gt;&lt;br /&gt;If you try to write Response.RedirectParmanent() the code will look like :&lt;br /&gt;&lt;br /&gt;&lt;code&gt;public static class Extensions&lt;br /&gt;{&lt;br /&gt;    public static void RedirectPermanent(this HttpResponse Response, string absoluteUri)&lt;br /&gt;    {&lt;br /&gt;        Response.Clear();&lt;br /&gt;        Response.Status = "301";&lt;br /&gt;        Response.RedirectLocation = absoluteUri;&lt;br /&gt;        Response.End();  &lt;br /&gt;    }&lt;br /&gt;}&lt;br /&gt;&lt;/code&gt;&lt;br /&gt;In case of Server.Transfer() the actual response is actually been updated. There is no effect to the search engine, and search engine will think the output is coming from the same page that is called upon. Let us give an example :&lt;br /&gt;&lt;br /&gt;Say you have 2 pages (Page 1 and Page 2) where Page1 redirects to Page2&lt;br /&gt;In case of&lt;br /&gt;&lt;br /&gt;1. &lt;span style="font-weight: bold;"&gt;Response.Redirect()&lt;/span&gt; : Search Engine will take this redirection as Temporary(Status 301) and always keep Page1 in its cache.&lt;br /&gt;2. &lt;span style="font-weight: bold;"&gt;Response.RedirectParmanent()&lt;/span&gt; : Search Engine will take this a permanent redirection(Status 302) and will remove Page1 from its database and include Page2 for better performance on search.&lt;br /&gt;3. &lt;span style="font-weight: bold;"&gt;Server.Transfer() &lt;/span&gt;: Search Engine will be unaware of any redirection been took place (Status 200) and will keep Page1 to its database. It will think Page1 is producing the output response of Page2.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;When to use:&lt;/span&gt;&lt;br /&gt;Response.Redirect is perfect when your page is temporarily changed and will be changed to original within a &lt;span style="font-weight: bold;"&gt;short span of time&lt;/span&gt;.&lt;br /&gt;Response.RedirectParmanent() when you are &lt;span style="font-weight: bold;"&gt;thinking of deleting&lt;/span&gt; the Page1 totally after the search engines changes its cache.&lt;br /&gt;Server.Transfer() when you are thinking of keeping the page for ever, and to &lt;span style="font-weight: bold;"&gt;let search engine unaware of this redirection&lt;/span&gt;.&lt;br /&gt;&lt;br /&gt;Thanks for reading and hope you like the discussion.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9030806299518147997-7660854125524362734?l=abhishek-sur.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://abhishek-sur.blogspot.com/feeds/7660854125524362734/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9030806299518147997&amp;postID=7660854125524362734' title='39 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/7660854125524362734'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/7660854125524362734'/><link rel='alternate' type='text/html' href='http://abhishek-sur.blogspot.com/2009/09/comparision-between-responseredirect.html' title='Comparision between Response.Redirect, Response.RedirectParmanent and Server.Transfer'/><author><name>Abhishek Sur</name><uri>https://profiles.google.com/117353808377089262292</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-6COXfM91xyM/AAAAAAAAAAI/AAAAAAAAAAA/CW6fzIy03CM/s512-c/photo.jpg'/></author><thr:total>39</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030806299518147997.post-5477581231068627293</id><published>2009-08-31T13:55:00.000-07:00</published><updated>2009-08-31T13:59:48.196-07:00</updated><title type='text'>New Features of C# 3.0</title><content type='html'>1. &lt;b&gt;Extension Methods&lt;/b&gt; : You can define extension methods to your namespace, so that if this is added, the class in which it is applied will act as instance variable. Example :&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;&lt;br /&gt;pubic void isDateTime(this string x)&lt;br /&gt;{&lt;br /&gt;     return DateTime.TryParse(x);&lt;br /&gt;}&lt;br /&gt;&lt;/pre&gt;&lt;br /&gt;The function will be added to the string object, and you can use it normally as with instance methods of String class.&lt;br /&gt;&lt;br /&gt;2. &lt;b&gt;Annonymous Types&lt;/b&gt; :  You can create unnamed objects that is not derived from a class, rather it is created on a fly. Annonymous types comes very handy when working with LINQ.&lt;br /&gt;Example :&lt;br /&gt;&lt;br /&gt;&lt;pre&gt;var x = new {x=20,y=40};&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;thus x will have 2 properties x and y.&lt;br /&gt;&lt;br /&gt;3. &lt;b&gt;Initialisers&lt;/b&gt; : While you create object of a class, ,we now dont need to call its constructors as all the public properties can be initialised easily.&lt;br /&gt;MyClass x = new MyClass {&lt;br /&gt;                             &lt;div id=":1x" class="ii gt"&gt;&lt;wbr&gt;  MyProperty1 = 20,&lt;br /&gt;                             &lt;wbr&gt;  MyProperty2 ="This is new Property "};&lt;br /&gt;&lt;br /&gt;thus we can set properties directly without calling the respective constructors. This feature also comes very handy when we dont want to have lots of constructors overloads or just say we have to create 2 constructors with same set of parameters but which will be assigned to 2 different properties . Accessing properties directly is very handy feature lately.&lt;br /&gt;&lt;br /&gt;Also there is collection initialisers like&lt;br /&gt;List&lt;string&gt; mycol = {"ss","gg"};&lt;br /&gt;You can do this without calling add method.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;4. &lt;b&gt;Implicitely Typed Variables&lt;/b&gt;  : C# introduces "var" which means when the object is assigned the type will be determined automatically. if you assing a string to x it will be of string type, or whatever you do.&lt;br /&gt;&lt;br /&gt;5. &lt;b&gt;Partial Methods&lt;/b&gt; : .NET 3.5 introduces partial methods, where the same methods can be declared more than once so that when called it will automatically add features to the existing method that is already defined.&lt;br /&gt;Note : Partial methods must not return anything, it should be defined as Void.&lt;br /&gt;&lt;br /&gt;6. &lt;b&gt;Property implementation is not required &lt;/b&gt;: Sometimes we just need to define properties to expose objects. In such case we dont need to implement a property, rather we can go with auto implementation feature introduced.&lt;br /&gt;&lt;br /&gt;public string myproperty {get;set;};&lt;br /&gt;&lt;br /&gt;The property will implicitly create a private variable and assign the values properly.&lt;br /&gt;&lt;br /&gt;7. &lt;b&gt;LINQ and Lambda Expression&lt;/b&gt; : You can query .net objects now using Linq. Lambda expressions are short - hand representation of LINQ queries. :)&lt;br /&gt;&lt;br /&gt;This is just basics of what introduced in C# 3.0. I will discuss more on each of them when I find time.&lt;br /&gt;&lt;br /&gt;Hope you like reading this.&lt;br /&gt;&lt;/string&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9030806299518147997-5477581231068627293?l=abhishek-sur.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://abhishek-sur.blogspot.com/feeds/5477581231068627293/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9030806299518147997&amp;postID=5477581231068627293' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/5477581231068627293'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/5477581231068627293'/><link rel='alternate' type='text/html' href='http://abhishek-sur.blogspot.com/2009/08/new-features-of-c-30.html' title='New Features of C# 3.0'/><author><name>Abhishek Sur</name><uri>https://profiles.google.com/117353808377089262292</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-6COXfM91xyM/AAAAAAAAAAI/AAAAAAAAAAA/CW6fzIy03CM/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030806299518147997.post-1221013023743803627</id><published>2009-05-10T08:39:00.000-07:00</published><updated>2009-05-10T08:46:00.199-07:00</updated><title type='text'>Javascript pure HTML Dialog Box</title><content type='html'>&lt;meta equiv="Content-Type" content="text/html; charset=utf-8"&gt;&lt;meta name="ProgId" content="Word.Document"&gt;&lt;meta name="Generator" content="Microsoft Word 11"&gt;&lt;meta name="Originator" content="Microsoft Word 11"&gt;&lt;link rel="File-List" href="file:///C:%5CDOCUME%7E1%5CAbhishek%5CLOCALS%7E1%5CTemp%5Cmsohtml1%5C01%5Cclip_filelist.xml"&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:worddocument&gt;   &lt;w:view&gt;Normal&lt;/w:View&gt;   &lt;w:zoom&gt;0&lt;/w:Zoom&gt;   &lt;w:punctuationkerning/&gt;   &lt;w:validateagainstschemas/&gt;   &lt;w:saveifxmlinvalid&gt;false&lt;/w:SaveIfXMLInvalid&gt;   &lt;w:ignoremixedcontent&gt;false&lt;/w:IgnoreMixedContent&gt;   &lt;w:alwaysshowplaceholdertext&gt;false&lt;/w:AlwaysShowPlaceholderText&gt;   &lt;w:compatibility&gt;    &lt;w:breakwrappedtables/&gt;    &lt;w:snaptogridincell/&gt;    &lt;w:wraptextwithpunct/&gt;    &lt;w:useasianbreakrules/&gt;    &lt;w:dontgrowautofit/&gt;   &lt;/w:Compatibility&gt;   &lt;w:browserlevel&gt;MicrosoftInternetExplorer4&lt;/w:BrowserLevel&gt;  &lt;/w:WordDocument&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;!--[if gte mso 9]&gt;&lt;xml&gt;  &lt;w:latentstyles deflockedstate="false" latentstylecount="156"&gt;  &lt;/w:LatentStyles&gt; &lt;/xml&gt;&lt;![endif]--&gt;&lt;style&gt; &lt;!--  /* Style Definitions */  p.MsoNormal, li.MsoNormal, div.MsoNormal 	{mso-style-parent:""; 	margin:0in; 	margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:12.0pt; 	font-family:"Times New Roman"; 	mso-fareast-font-family:"Times New Roman";} @page Section1 	{size:8.5in 11.0in; 	margin:1.0in 1.25in 1.0in 1.25in; 	mso-header-margin:.5in; 	mso-footer-margin:.5in; 	mso-paper-source:0;} div.Section1 	{page:Section1;} --&gt; &lt;/style&gt;&lt;!--[if gte mso 10]&gt; &lt;style&gt;  /* Style Definitions */  table.MsoNormalTable 	{mso-style-name:"Table Normal"; 	mso-tstyle-rowband-size:0; 	mso-tstyle-colband-size:0; 	mso-style-noshow:yes; 	mso-style-parent:""; 	mso-padding-alt:0in 5.4pt 0in 5.4pt; 	mso-para-margin:0in; 	mso-para-margin-bottom:.0001pt; 	mso-pagination:widow-orphan; 	font-size:10.0pt; 	font-family:"Times New Roman"; 	mso-ansi-language:#0400; 	mso-fareast-language:#0400; 	mso-bidi-language:#0400;} &lt;/style&gt; &lt;![endif]--&gt;  &lt;p class="MsoNormal"&gt;It is a very common scenario to make a dimmed effect in web when a javascript popup is opened. Lots of people wonder how those being made. Some people tile with a transparent png to the background while others use div with certain opacity to fill up the entire space. I choice is with divs as they are purely htmls, and you can easily create div dynamically and also remove them from dom.&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;To do this, First we need a semi – transparent div to cover the entire work area :&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal"&gt;var width = document.documentElement.offsetWidth + document.documentElement.scrollLeft;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;var height = document.documentElement.offsetHeight + document.documentElement.scrollHeight;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;var centerX,centerY;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;if(document.documentElement &amp;amp;&amp;amp; document.documentElement.clientHeight) // NON IE&lt;/p&gt;  &lt;p class="MsoNormal"&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;   &lt;/span&gt;centerX = document.documentElement.offsetWidth / 2;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;   &lt;/span&gt;centerY = document.documentElement.offsetHeight / 2;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;} &lt;/p&gt;  &lt;p class="MsoNormal"&gt;else if( document.body ) &lt;span style=""&gt; &lt;/span&gt;//IE&lt;/p&gt;  &lt;p class="MsoNormal"&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;   &lt;/span&gt;centerX = document.body.clientWidth / 2;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;   &lt;/span&gt;centerY = document.body.clientHeight / 2;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;}&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;var layer = document.createElement('div');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.style.zIndex = 2;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.id = 'backgroundlayer';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.style.position = 'absolute'; // Required to place layer in background&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.style.top = '0px';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.style.left = '0px';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.style.height = document.documentElement.scrollHeight + 'px';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.style.width = width + 'px';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.style.backgroundColor = 'black'; // Ideal for dim effect&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.style.opacity = '.6'; // Works only in Non IE browsers&lt;/p&gt;  &lt;p class="MsoNormal"&gt;layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)"); // IE little fix&lt;/p&gt;  &lt;p class="MsoNormal"&gt;document.body.appendChild(layer); // Append to DOM&lt;/p&gt;  &lt;p class="MsoNormal"&gt;document.body.style.overflow="hidden"; //To Hide extra scrollbar when dialog is visible.&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal"&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-weight: bold;" class="MsoNormal"&gt;Explanation : &lt;/p&gt;  &lt;p class="MsoNormal"&gt;In the above code we have created a div, set certain properties and append that to body. We need to have DXImageTransform to make opacity of a div in IE as style.opacity cannot work in IE. DX is directX transform, so if you don’t need your application to run over IE, you can remove this line, Otherwise this line will be ignored in Non-IE browsers. documentElement.scrollHeight gives you the actually height of the browser working area adding up the scrollPosition. Background of Div goes perfect with black, but you can change it to any other color according to your choice.&lt;br /&gt;&lt;/p&gt;&lt;p class="MsoNormal"&gt;Another little fix for IE is use of document.body to find the center screen position which shows the popup.&lt;br /&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;Next we add a div in the middle of the page on top of the semi-transparent layer.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal"&gt;var div = document.createElement('div');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.style.zIndex = 3; // It should be more than background DIV&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.id = 'popupbox';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.style.position = (navigator.userAgent.indexOf('MSIE 6') &gt; -1) ? 'absolute' : 'fixed';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.style.top = '200px';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.style.left = (width / 2) - 200+ 'px'; &lt;span style=""&gt; &lt;/span&gt;// Half its width&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.style.height = '50px';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.style.width = '400px';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.style.backgroundColor = 'white';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.style.border = '2px solid silver';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.style.padding = '20px';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;document.body.appendChild(div);&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal"&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p style="font-weight: bold;" class="MsoNormal"&gt;Explanation : &lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;This is the actual dialog box which is placed over the semi – transparent div. For IE we need to place its position to absolute, otherwise to fixed. (IE always bugs me with non-standard properties, Oh god).&lt;span style=""&gt;  &lt;/span&gt;Left position is set to its width/2 – 200 as actual width is 200. We also created a solid silver border to the popup.&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;And finally we put some text and a link that closes the popup when clicked:&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;/p&gt;&lt;blockquote&gt;&lt;p class="MsoNormal"&gt;var p = document.createElement('p');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;p.innerHTML = 'Some text';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;div.appendChild(p);&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;// Create a close link of popup&lt;/p&gt;  &lt;p class="MsoNormal"&gt;var a = document.createElement('a');&lt;/p&gt;  &lt;p class="MsoNormal"&gt;a.innerHTML = 'Close window';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;a.href = 'javascript:void(0)';&lt;/p&gt;  &lt;p class="MsoNormal"&gt;a.onclick = function()&lt;/p&gt;  &lt;p class="MsoNormal"&gt;{&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;  &lt;/span&gt;document.body.removeChild(document.getElementById(backgroundlayer));&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;  &lt;/span&gt;document.body.removeChild(document.getElementById('popupbox'));&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;span style=""&gt;  &lt;/span&gt;document.body.style.overflow="auto";&lt;/p&gt;  &lt;p class="MsoNormal"&gt;};&lt;/p&gt;&lt;/blockquote&gt;&lt;p class="MsoNormal"&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;&lt;o:p&gt; &lt;/o:p&gt;&lt;/p&gt;  &lt;p class="MsoNormal"&gt;So its done, you can try out the live demo if you need as well. &lt;a href="http://abhi2434.googlepages.com/lightboxdemo.html"&gt;Online Demo&lt;/a&gt;&lt;br /&gt;&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9030806299518147997-1221013023743803627?l=abhishek-sur.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://abhishek-sur.blogspot.com/feeds/1221013023743803627/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9030806299518147997&amp;postID=1221013023743803627' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/1221013023743803627'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/1221013023743803627'/><link rel='alternate' type='text/html' href='http://abhishek-sur.blogspot.com/2009/05/javascript-pure-html-dialog-box.html' title='Javascript pure HTML Dialog Box'/><author><name>Abhishek Sur</name><uri>https://profiles.google.com/117353808377089262292</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-6COXfM91xyM/AAAAAAAAAAI/AAAAAAAAAAA/CW6fzIy03CM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030806299518147997.post-8564618050937499641</id><published>2008-10-13T00:00:00.003-07:00</published><updated>2008-10-13T00:00:56.397-07:00</updated><title type='text'>Bit on .NET</title><content type='html'>Hi, To all the programmers who is working in .net should know some of the  facts. Well, .Net is not an Operating System. Its also not a general purpose  software package. Its just somewhat functionality for the programmers to build  their solution in the most constructive and intellegent way ever.&lt;br /&gt;Just to  tell you the truth, most of the codes in .Net environment resembles with the  JAVA coding as if some people coming from Java would find it as to their native  language.&lt;br /&gt;.NET is a Framework that loads into your operating system, which  you need not to load in the later virsions of windows like Windows 2003 server  or Just a new release of Windows Vista. As it is going to be added as a  component in the next generation of windows.&lt;br /&gt;Now, What is the .Net all  about??? Well, Its a framework that supports Common Language Runtime (CLR). As  the name suggests, Common Language Runtime will be something that will run a  native code for all the programming languages provided within the Architecture.  Just for example, I would rather say that integer of VB.NET and int of C# are  same, as they are both object of the Int32 class. And because of the generation  of Intermediate language (Byte code + metadata ) in assembly produced as output  during compilation is again compiled by JIT compiler( for those of you came from  JAVA must know this). This enables you to bind two assemblies during runtime.  Thats what is called basically interlanguage communication.&lt;br /&gt;Now then what is  language independence??&lt;br /&gt;Well, to tell you about language Independence, .Net  is not at all efficient in that. Just Microsoft built their own version of  languages like C++, J# (for Java), C#, VB etc that can communicate between each  other. Afterall J#, even if they resembles with JAVA is not purely Java.. Thus,  the word may look to you somewhat fake.&lt;br /&gt;Now what is the most prospective part  of .NET?&lt;br /&gt;Now, with the growing Internet, ASP.NET may be the most important  part of .NET technology.&lt;br /&gt;Well, ASP.NET has a new technology where the  controls reside server side. You dont bother to use traditional client side  controls. In .NET technology as there is a provision of runtime building of  machine codes, a web server can directly compile and transmit codes to the  browser during runtime. This is , I think the most approved and widely accepted  part of .NET.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;NEW things of  .NET?&lt;/span&gt;&lt;br /&gt;well, during the last two years , Microsoft is constantly  changing the .NET technology, that may not be good for a settled programer.  Well, first of all, in .NET 2003 Microsoft changed some features and also addes  some new things. Well, new things are good, but changing the existing in such a  quick succession is not at all good from programmers point of view. Again, in  2005, Microsoft publishes the new release of VISUAL STUDIO.NET 8 . This is a  completely new environment. It have new releases of controls, the IDE is also  different. Thats not what we all wanted as a programmer. What do you  say????&lt;br /&gt;Now, Microsoft is also increasing its scope.. One of the most  important feature that is just now introduced is AJAX. Well, the name is what  can be said as Asynchronous Java Script with XML.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;What is AJAX???&lt;/span&gt;&lt;br /&gt;Now, AJAX is not a  technology. Its a new technique that can be embeded in your existing ASP.NET  application to enable you partially update the web page without totally  refresing the page. The introduction of ATLAS controls are also a great  achievement. This is the latest trend of the ASP.NET programmers. Just you can  see some of the latest updates of yahoo, as in the home page after signing in  you can see the mails directly in the home page. Keep a watch. Also the most  important findings may be for gmail users. You all dont have to refresh the page  for an updation of the page.&lt;br /&gt;In gmail, a chatting environment is also created  with the use of ajax, may be...&lt;br /&gt;&lt;br /&gt;Now I request to add on comments to my  postings so that I can write more on this topic...&lt;br /&gt;Thanks in  advance......&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9030806299518147997-8564618050937499641?l=abhishek-sur.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://abhishek-sur.blogspot.com/feeds/8564618050937499641/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9030806299518147997&amp;postID=8564618050937499641' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/8564618050937499641'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/8564618050937499641'/><link rel='alternate' type='text/html' href='http://abhishek-sur.blogspot.com/2008/10/bit-on-net.html' title='Bit on .NET'/><author><name>Abhishek Sur</name><uri>https://profiles.google.com/117353808377089262292</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-6COXfM91xyM/AAAAAAAAAAI/AAAAAAAAAAA/CW6fzIy03CM/s512-c/photo.jpg'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030806299518147997.post-2129969165887278819</id><published>2008-10-13T00:00:00.001-07:00</published><updated>2008-10-13T00:00:28.055-07:00</updated><title type='text'>.NET Code Construct</title><content type='html'>Okey... Lets proceed our discussion a bit more.. In my previous topic posted,  I have gave you a brief Idea of the whole thing where the technology is  facing... Now I will go a bit indepth... and show you how to use the existing  technology of .NET to built the most beautiful and fully featured software  applications.&lt;br /&gt;&lt;br /&gt;To start with VB.NET, I must say, its far far better from  the previous version of VB. It is fully Object Oriented Programming Language  with all the functionalities of OOPS, so that all the programmers feel better in  this language. Also with the full support of .NET Framework, you will have to do  only a few codes in this environment.&lt;br /&gt;To work with VB.NET you need the Visual  Studio .NET in your machine. Lets start with that one. Go to  File-&gt;New-Project. Give Location of your application and choose windows  Application from the right hand side of the dialog box while choosing the  language VB in the left. After you click on open, it should open a new blank  form in front of you...&lt;br /&gt;&lt;br /&gt;Well, How does everything happened so fast  without writing not even a single line of code. Well, Microsoft did it for us  already. In case of JAVA you find a Frame class already built in the java.awt  package. Here also in case of microsoft's VB, it is just a class already built  in by microsoft called Form Class.&lt;br /&gt;Actually, Just similar to JAVA, microsoft  has made a hierarchy of classes and stored in a number of namespaces. Namespaces  means just a scope that holds classes and other namespaces. The concept is just  similar to our so called folder hierarchy... Suppose we think a namespace as a  folder and a class a file. So there is drives which we call roots, just  similarly here also there is a root namespace called System. Everything that  corresponds to system, will be stored within this package. Under this there are  other namespaces too.. like Data, Windows etc... Every namespace holds classes  or other namespaces. Just similar to the concept that every folder holds other  folders or files.&lt;br /&gt;Now coming to our point whenever I open the project, I saw  a new blank form in front of me... Its just inherited from a class  System.Windows.Forms.Form, so everything defined within the form will come to  this form. Well well, thats just a flick of a second, that all the associated  properties and functions in the class comes to your place. Isnt it  beautiful.&lt;br /&gt;So your form1 is inherited from the already created form with all  the listeners of events associated already. Now you can start adding other  controls.&lt;br /&gt;Microsoft had created a separate region and made everything within  that area... This is Windows Designer Generated Code. Here you will find Sub  new() which is nothing but a constructor of your class, so it gets automatically  called whenever you run your application, means when you create actual object.  The initializecomponent function will initialize the components just before the  object comes into work, and all the settings that you have modified with, will  be in place properly. Thus whenever you run, everything that you made in this  form gets displayed.&lt;br /&gt;&lt;br /&gt;Now lets work with some of the controls. In the left  hand side you will find a toolbox, where you get all the tools that you require  to place in your form. Those are called controls... So whenever you drag any  control in your form, a new object of that class is created and it gets  displayed over your form.... Is it that much simple... What do you think. ???  Its not.. It looks very simple, but it actually a bit more. I must say, in form  class, there is an array called controls array. Now this array is very helpful.  In VB.NET everything that you add in this array will be displayed on the form,  so within the class form there is something I am sure that draws the entire  thing in the form if you have added the same in Controls array.&lt;br /&gt;So whenever  you drag one control, say its a button It creates two lines, in  general,&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Friend  withevents button1 as button&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Controls.add(button1)&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now  withevents keyword is very helpful, in regards to event handling. Whenever we  create an object normally, it is not associated with any action listener of the  events. Now withevents will automatically add up all the listeners to the  control and everything will come under your way....&lt;br /&gt;Otherwise if you create  one button without withevents keyword, you need to manually add a listener to  the control&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Addhandler  button1.click, new EventHandler(Addressof button1_click)&lt;/span&gt;&lt;br /&gt;that is, we  are adding a listener and whenever it occurs, it will call an eventhandler  button1_click which is an eventhandler procudure. Otherwise withevents keyword  will automatically add up all the events with the button class and call a blank  event procedure.&lt;br /&gt;&lt;br /&gt;Now lets us look to the solution explorer. You will find  a solution explorer, a window, just if you dont see one, go to view and find  solution explorer there. After you get it, you will see a hirerchy there also,  the first line suggests the name of your solution, means a number of projects  can be added up for a single solution. This solution will be written in a file  with .SLN extension.&lt;br /&gt;Next, Line is the name of your project. Under this  project, the first thing you notice is some references, they are some locations  which you can call directly, they are references added automatically, like  System.Windows.Forms so to call Form class under this namespace without giving  the whole path you can use just Form and get the class name.&lt;br /&gt;After  references, there is a file called AssemblyInfo.VB.&lt;br /&gt;Now if you open this  file, you will get the metadata associated with your project, mainly class id of  your application and many more. The next option is your form, to create a form  Microsoft creates two files, one is for code with .VB extension and other is for  visual interface with .RESX extension. So if you delete .RESX file from the  location, your application looses visual interface. Ok.&lt;br /&gt;The property window  helps us to change the default properties of controls, so whenever I select a  control, the properties window will change its content dramatically and display  all the associated properties associated with that particular control.&lt;br /&gt;Now  let us create a button..&lt;br /&gt;In a blank form drag a button, and then double click  on the button placed in the form, the code window appears, Write the  following&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;private sub  button1_click(Byval sender as System.Object, ByVal e as System.EventArgs)Handles  Button1.click&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;MessageBox.Show("Hello Welcome to  the World of VB.NET")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;End  Sub&lt;/span&gt;&lt;br /&gt;&lt;strong&gt;[EXPLANATION]&lt;/strong&gt;&lt;br /&gt;Now if you run your application,  and click on the button, it will show a messagebox in front of you.&lt;br /&gt;Now to  understand an event procudure, its just like normal procedure, but with some  strict rules, Its signature is just similar to what I have shown, otherwise it  will not be treated as an event procedure one... So for every event procedure ,  you must write two arguments, The first one is Object type, now this argument  will take the actual object inside your event procedure which have generated the  event. So here button1 and sender is the same thing if you are writing within  the block.Now what for, just in the very next you have seen handles keyword, its  the list of events associated with the event procedure. So now here, one event  procedure can handle multiple events. The second argument will take event  related information. We will discuss them later on.&lt;br /&gt;Now lets take another  textbox in the form and add textbox1.click just after handles button1.click  after giving a comma... so that it looks like this&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;private sub button1_click(Byval  sender as System.Object, ByVal e as System.EventArgs)Handles  Button1.click,textbox1.click&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;if typeof(sender) is Button  then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;MessageBox.Show("Hello You clicked  a button")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;else if  typeof(sender) is TextBox then&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;MessageBox.Show("Hello You clicked  a Textbox")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;End  Sub&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Just in this case you can detect if the procedure is invoked  using textbox.click of button1.click. Isnt it look handy.&lt;br /&gt;Now if you look at  the messagebox class,there is a shared method show, when called with an argument  of string type will print the string in a messagebox...&lt;br /&gt;The return type of  show function is DialogResult...&lt;br /&gt;So if I want to trap the result of  Messagebox.show we can trap by creating an object of  DialogResult&lt;br /&gt;&lt;strong&gt;&lt;em&gt;Dim result as  DialogResult&lt;br /&gt;result=Messagebox.show("Message","Caption",MessageboxButtons.OKCANCEL)&lt;br /&gt;if  result=DialogResult.OK then&lt;br /&gt;Me.Text="OK Clicked"&lt;br /&gt;else&lt;br /&gt;Me.Text="CANCEL  Clicked"&lt;br /&gt;end if&lt;br /&gt;&lt;/em&gt;&lt;/strong&gt;&lt;br /&gt;Here me represents the Current class,  just like this pointer .... of C++ or C#. So the text of the title bar of your  form will get changed.&lt;br /&gt;&lt;br /&gt;Now Let us create another form, to create a form,  right click on the project icon of the solution explorer(Second line of Solution  explorer hierarchy) and add-&gt;new Item. From the dialog box choose form and  click open. A blank for comes in a new tab. Just drag a label here and Write  something in its text proerty of properties window.&lt;br /&gt;Nest go to the form1  again, drag another button Let it be button2 and write the code below in the  code window&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;public  sub button2_click(ByVal sender as Object, ByVal e as EventArgs) Handles  Button2.click&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Dim  f as new Form2&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;f.show()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;Me.hide()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;End Sub&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Now whenever  you run the application and click on button2, a new form will be displayed in  front of you.. So by this way you can navigate from one form to the other. The  first line creates a new object for form2 class, next line shows the form,  making Form2.Visible=true and Me means Form1.Visible=False. Just to make form2  as startup, you again right click on the project of the solution explorer and go  to properties. Change the startup object to form2 and start running.. The form2  will be now your startup form...&lt;br /&gt;Now I think you all can start working with  some codes with VB.NET, I will proceed with more discussions in my next posts,  so keep watching my posts...&lt;br /&gt;Thanks a lot&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9030806299518147997-2129969165887278819?l=abhishek-sur.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://abhishek-sur.blogspot.com/feeds/2129969165887278819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9030806299518147997&amp;postID=2129969165887278819' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/2129969165887278819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/2129969165887278819'/><link rel='alternate' type='text/html' href='http://abhishek-sur.blogspot.com/2008/10/net-code-construct.html' title='.NET Code Construct'/><author><name>Abhishek Sur</name><uri>https://profiles.google.com/117353808377089262292</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-6COXfM91xyM/AAAAAAAAAAI/AAAAAAAAAAA/CW6fzIy03CM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030806299518147997.post-7318831209198278097</id><published>2008-10-12T23:58:00.002-07:00</published><updated>2008-10-12T23:59:57.135-07:00</updated><title type='text'>Inheritence and Polymorphism</title><content type='html'>Well, now I would like to make some more clear ideas about what coding is  when you are working in VB.NET.&lt;br /&gt;&lt;br /&gt;As I have already told you, the first  line just after the class name, you will be getting the inherits part. This  inherits part making our task of getting a new form much easier. It would be  worthy enough to get a well designed form just with a click of mouse. Isnt it.  Its what we all know about the famous feature of any OOPS based language. In  case of JAVA we have to derive from Frame class whereas here it is Form class.  Both are the same thing.&lt;br /&gt;OOPS concept:&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;1. Inheritence:&lt;/span&gt; Inheritence is the process  of getting all the properties of the base class within the new class that you  are deriving from. Well, its just a shortcut of getting everything pre-defined  or created. So it just ensures reusability. Nothing else. Just once a class is  defined, it can be inherited instantly to another class and can be used with  their function whenever you require to use them. Only the exception if you  define a class as NOTINHERITABLE, that class cannot be inherited. So hey hey..  until you are hard enough to give your code to other programmers, you can surely  make your code Inheritable... Now lets look at the code below. &lt;span style="font-weight: bold; font-style: italic;"&gt;public class A&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;public void show()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;msgbox ("Hello") ' Messagebox  function defined already within your scope... &lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;&lt;br /&gt;end sub&lt;br /&gt;&lt;/span&gt;&lt;span style="font-weight: bold; font-style: italic;"&gt;end class&lt;br /&gt;&lt;br /&gt;public class  B&lt;br /&gt;inherits A&lt;br /&gt;end class&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;Now if you define an object of B, it  can definitely call the show function defined within A.&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;2. Polymorphism:&lt;/span&gt; The term signifies, that more  than one form. How in case of OOPS, polymorphism can exist. Well, the support of  this feature is because of OVERLOADING and OVERRIDING. The term overloading  means, existence of more than one function in the same scope with same name.  Well, just think, suppose we dont support overloading... just functions.. in  that case, you have to define functions individually differently. So there may  exist only one function say sum with some number of arguments. Now suppose you  have defined a function sum as&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;public  function sum(byval a as Integer, ByVal b as Integer) as Integer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;sum=a+b&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;end  Function&lt;/span&gt;&lt;br /&gt;in this case, the function sum takes two arguments and  returning the sum of both. Well, the condition is nice enough to sum up two  numbers. Well, after defining this function suppose some requirement comes,  where the function can sum up 3 numbers. Just now the problem begins. Now you  need to name the function which you are to create differently. That means  separate indentifier to separate functions.. You may think what will be the  problem with this. Now suppose you have named a function which is working almost  similarly but having different names and you need to remember all of their  names. Here comes the benefit of Overloading where similar functions can be  named identical but they should be having one common difference. The difference  lies on their Argument List. Eg.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;public  overloads function sum(byval a as Integer,ByVal b as Integer)as  Integer&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Return a+b&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;end Function&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;public overloads Function sum(Byval a as Single,ByVal  b as Single) as Single&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Return  a+b&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;End Function&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;Here  the two functions having the same name but difference in arguments can stay on  the same scope, i.e in a scope of a class. Mind that, overloading is a property  of a class, so it would not be working if you write it in a standard  module.&lt;br /&gt;&lt;br /&gt;Another feature of Polymorphism is Overriding... In case of  overriding, two functions are having exactly same signature ... but defined  differently.. well, this make your all confusion, isnt it.. Well, how could be  possible for a class to call the same two function with exactly the same  signature...&lt;br /&gt;Well the case is bit different. Well, the two function should  stay on different classes, one in the base class, and another in the derived  class... The base class will be overriding the derived class functions.. this is  overriding....&lt;br /&gt;Now look at the example&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Class A&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;public overridable function abc()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;msgbox ("Hii")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;end Function&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;end class&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Class B&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Inherits A&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Public overrides Function abc()&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;msgbox ("Hello")&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;end Function&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;End Class&lt;/span&gt;&lt;br /&gt;So here when we call abc with the  object of B, it will call the msgbox with hello, and when we create the object  of a and call abc, it will call hi...&lt;br /&gt;So we are modifying the definition of  already defined function. isn't it beautiful...&lt;br /&gt;&lt;br /&gt;I will continue my  posts... later on...&lt;br /&gt;Thanks for reading&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9030806299518147997-7318831209198278097?l=abhishek-sur.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://abhishek-sur.blogspot.com/feeds/7318831209198278097/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9030806299518147997&amp;postID=7318831209198278097' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/7318831209198278097'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/7318831209198278097'/><link rel='alternate' type='text/html' href='http://abhishek-sur.blogspot.com/2008/10/inheritence-and-polymorphism.html' title='Inheritence and Polymorphism'/><author><name>Abhishek Sur</name><uri>https://profiles.google.com/117353808377089262292</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-6COXfM91xyM/AAAAAAAAAAI/AAAAAAAAAAA/CW6fzIy03CM/s512-c/photo.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-9030806299518147997.post-4208509206429910941</id><published>2008-10-12T23:58:00.001-07:00</published><updated>2008-10-12T23:58:45.434-07:00</updated><title type='text'>Bit related about Interfaces and Abstract classes.</title><content type='html'>So friends, until now, I think you have got the basic idea about the Object  Oriented Programming paradigm. With changing atmosphere, it gets rather  difficult to make a project worthwhile. So It needs a structured way to maintain  the whole project. Every company before its very creation creates their own  framework to make data access for their own products much more easier. The  architecture what microsoft provides us is also structured. In talking about  structure, one thing that comes first in our mind is Interface.&lt;br /&gt;&lt;br /&gt;Lets  discuss Interfaces a bit further...&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Interface: &lt;/span&gt;An interface is a class that have  only abstract methods and final variables. An abstract method is just a  declaration of the signature without actual implementation of its body. Thus  when creating an abstract function we dont need to create the body of the  function. Its just the declaration of how a function looks line..&lt;br /&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;abstract Function sum(Byval x as Integer,ByVal y as  Integer) as Integer&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;In the previous declaration, the function body  is nothing, i.e, Its not defined yet. Just it would be defined or overridden to  its derived classes.&lt;br /&gt;If a class is having any function within it as abstract,  the class must also be declared as abstract. Means, whenever we write any of the  member function of a class as abstract, we are losing the propoerty of  instantiating the object of that class. So the class will also be called as  abstract.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;abstract Class A&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Function a() &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;End Class&lt;/span&gt;&lt;br /&gt;Now Coming to Inheritence, as I  mentioned in my earlier post, Inheritence is the process of making a class just  derived from another class. Well, this property ensures re usability of code.  Now In .NET environment, one class can have only one base, at most... So  Multiple Inheritence is not supported in .NET environment. But this can be  supported with the help of Interface.&lt;br /&gt;Interfaces are pure abstract classes..  Means in an Interface there may not be any defination of any of its methods so  that rather than inheriting from the class we use implementing from it. Just we  need to override all of the functions defined within the interface in our class.  This is the case of Multiple Inheritence where if you are implementing from  interfaces, a single class can have multiple base classes.&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Class A &lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Inherits BaseA 'Inherits can be only  one&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Implements Base IA,BaseIB  'Implements can be more than one&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Public Function Afun() as string Implements  BaseIA.Afun&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;end  Function&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Public Function Bfun() as  string Implements BaseIB.Bfun&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;end  Function&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;End class&lt;/span&gt;&lt;br /&gt;So here a  class A is having three base classes, One is which it is derived from and the  others are which it is implementing.&lt;br /&gt;Interface can point to the object of the  class which it implementing it. means&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;Dim ba  as BaseIA&lt;/span&gt;&lt;br /&gt;&lt;span style="font-weight: bold;"&gt;ba=new  A()&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;This is possible as if the base class can point to derived  class objects.&lt;span style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;So you will get  everything like the base classes in case of implementing and can enjoy the  flavour of Multiple Inheritence in VB.NET.....&lt;br /&gt;Isn't it Cool....&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/9030806299518147997-4208509206429910941?l=abhishek-sur.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://abhishek-sur.blogspot.com/feeds/4208509206429910941/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=9030806299518147997&amp;postID=4208509206429910941' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/4208509206429910941'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/9030806299518147997/posts/default/4208509206429910941'/><link rel='alternate' type='text/html' href='http://abhishek-sur.blogspot.com/2008/10/bit-related-about-interfaces-and.html' title='Bit related about Interfaces and Abstract classes.'/><author><name>Abhishek Sur</name><uri>https://profiles.google.com/117353808377089262292</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='32' src='//lh3.googleusercontent.com/-6COXfM91xyM/AAAAAAAAAAI/AAAAAAAAAAA/CW6fzIy03CM/s512-c/photo.jpg'/></author><thr:total>1</thr:total></entry></feed>
