<?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-324225979025405257</id><updated>2011-11-28T05:35:02.608+06:00</updated><category term='logging'/><category term='Visual Studio'/><category term='WebService'/><category term='control'/><category term='NMock'/><category term='SQL'/><category term='IoC'/><category term='Load balancing'/><category term='UML'/><category term='Test'/><category term='Ninject'/><category term='file streaming'/><category term='ASP.NET'/><category term='DI'/><category term='C#'/><category term='Overloading'/><category term='PHP'/><category term='repeater'/><category term='TDD'/><category term='Agile'/><category term='WCF'/><category term='Scrum'/><category term='OOP'/><category term='Design Pattern'/><category term='log4net'/><category term='link'/><category term='Event'/><title type='text'>Simple .NET Tips.</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>35</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-5914048072731207844</id><published>2010-12-16T20:29:00.000+06:00</published><updated>2011-03-27T20:29:48.766+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Load balancing'/><title type='text'>Load balancing</title><content type='html'>&lt;p&gt;From past few days I was spending time on network load balancing for web servers and found some basic concept about it.  &lt;p&gt;First come what is load balancing (in a non-bookish manner J ). Well load balancing is some sort of technology where multiple systems are used to reduce the load of a single system.  &lt;p&gt;Suppose a server serves per request within 20ms for 10 users for a certain web application but somehow that application get popular with in few days and user get increased 10 to 10,000!! Do you still believe that server with same configuration and same application can serves per request within 20ms? Umm …. I’m sure your answer is now. So people resolve these things? Well there are many solutions, among them network load balancing is a common solution.  &lt;p&gt;The main reasons of load balancing are minimize response time, maximize user of resource utilization, maximize throughput and so on.  &lt;p&gt;&lt;b&gt;&lt;u&gt;Load balancing solutions :&lt;/u&gt;&lt;/b&gt; Nowadays load balancing is perform through different type of technologies such as hardware load balancing device , load balancing software , gateway with built in load balancing features, Round robin DNS etc.  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_NL2fAc4la4o/TY9J1tB82YI/AAAAAAAABGY/TVd1Ca0pJYA/s1600-h/Image%5B3%5D.png"&gt;&lt;img style="background-image: none; border-right-width: 0px; padding-left: 0px; padding-right: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px; padding-top: 0px" title="Image" border="0" alt="Image" src="http://lh5.ggpht.com/_NL2fAc4la4o/TY9J25MeY9I/AAAAAAAABGc/t5nTTMSg8g4/Image_thumb.png?imgmax=800" width="244" height="76"&gt;&lt;/a&gt;  &lt;p&gt;&lt;b&gt;&lt;u&gt;&lt;br&gt;&lt;/u&gt;&lt;/b&gt; &lt;p&gt;&lt;b&gt;&lt;u&gt;Persistence problem:&lt;/u&gt;&lt;/b&gt; Better to mention it “sticky session” problem. Suppose we are using two web servers (Server A and Server B) which are load balanced now a user login into a web application which runs on Server A and stars purchasing items suddenly load balances device identified that the load is full for Server A and auto failover to Server B, in this condition the session state is going to be lost as the session state was hold by the Server A. Isn’t it a crap! Of course it is. This issue can be resolved by storing the session data in client side through cookie but for security reason it’s not possible to for highly secured site, another solution is storing session data in database though it creates performance issue but increase the scalability.  &lt;p&gt;Most of the hardware load balancer work at Transport layer (OSI layer 4) and Application layer (OSI layer 7). Intelligent load balancer checks the server’s health through communication with server and distribute load as per need, it also manages sticky session problem and distribute the load accordingly so that users can there sessions at same server.  &lt;p&gt;That’s all for now .  &lt;p&gt;Bye    &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-5914048072731207844?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/5914048072731207844/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/12/load-balancing.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5914048072731207844'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5914048072731207844'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/12/load-balancing.html' title='Load balancing'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/_NL2fAc4la4o/TY9J25MeY9I/AAAAAAAABGc/t5nTTMSg8g4/s72-c/Image_thumb.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-1402086650463326059</id><published>2010-09-07T15:17:00.000+06:00</published><updated>2010-09-07T15:18:30.277+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Design Pattern'/><category scheme='http://www.blogger.com/atom/ns#' term='UML'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='OOP'/><title type='text'>Observer Pattern - implementation and application with C#.NET</title><content type='html'>&lt;p&gt;Hello All  &lt;p&gt;Today I will go through with “Observer Patter”, where I will try to explain a simple example of this pattern as well as implementation and use.  &lt;p&gt;First come to what is Observer Patter, as per Wikipedia the general definition of Observer pattern is as bellow:  &lt;p&gt;“&lt;i&gt;The observer pattern (a subset of the publish/subscribe pattern) is a software design pattern in which an object, called the subject, maintains a list of its dependents, called observers, and notifies them automatically of any state changes, usually by calling one of their methods. It is mainly used to implement distributed event handling systems.&lt;/i&gt;”  &lt;p&gt;The UML diagram of basic observer pattern is as bellow:  &lt;p&gt;&lt;a href="http://lh6.ggpht.com/_NL2fAc4la4o/TIYDWdIKBMI/AAAAAAAABEo/6xH9aOrGirE/s1600-h/clip_image0024.gif"&gt;&lt;img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 0px" title="clip_image002" border="0" alt="clip_image002" src="http://lh3.ggpht.com/_NL2fAc4la4o/TIYDXNxkQBI/AAAAAAAABEs/qyYMIHIN8mc/clip_image002_thumb1.gif?imgmax=800" width="308" height="137"&gt;&lt;/a&gt;  &lt;p&gt;How actually this pattern works?  &lt;p&gt;Well as per the above definition we have 2 types of objects one is Subject and other one is Observer. A Subject maintain a list of Observe objects and notify those when property of subject changes.  &lt;p&gt;Example:  &lt;p&gt;Suppose we are maintaining stock exchanges data and we have number of securities agencies. Those securities consume our stock’s data as per there need. When they what to consume data, they register in our system and unsubscribe when they are needed. Here the catch is, they are always updated for each stock’s data change.  &lt;p&gt;In the following C# code example I will try to pull out the gist of Observer pattern as per our above description.  &lt;p&gt;In the code example I have taken 2 interfaces and 3 concrete classes of which 1 interface and 2 concrete classes are of Observer’s &amp;amp; 1 interface and 1 concrete class of Subject’s.  &lt;p&gt;&lt;strong&gt;&lt;u&gt;IObserver Interface: &lt;/u&gt;&lt;/strong&gt; &lt;p&gt;This interface contains 2 method signatures. One is Update and another is ShowData.  &lt;p&gt;&amp;nbsp; &lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; ObserverPatter&lt;br&gt;{&lt;br&gt;    &lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; IObserver&lt;br&gt;    {&lt;br&gt;         &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Update(Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt; stocks);&lt;br&gt;&lt;br&gt;         &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ShowData();&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;FirstObserver concrete class:&lt;/u&gt;&lt;/strong&gt; &lt;/p&gt;
&lt;p&gt;This class implements the IObserver interface. The Update method changes the property of stocks information with the new stocks information and ShowData makes the new stock information visible.&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;br&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; ObserverPatter&lt;br&gt;{&lt;br&gt;    &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; FirstObserver : IObserver&lt;br&gt;    {&lt;br&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt; _stocks;&lt;br&gt;&lt;br&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Update(Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt; newData)&lt;br&gt;        {&lt;br&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._stocks = newData;&lt;br&gt;&lt;br&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ShowData();&lt;br&gt;        }&lt;br&gt;&lt;br&gt;&lt;br&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ShowData()&lt;br&gt;        {&lt;br&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;"First Securities LTD"&lt;/span&gt;);&lt;br&gt;           &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt;( KeyValuePair&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;,&lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt; data &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; _stocks)&lt;br&gt;           {&lt;br&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;"Current price of {0} is now {1}"&lt;/span&gt;,data.Key,data.Value);&lt;br&gt;           }&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;&lt;u&gt;&lt;strong&gt;SecondObserver concrete class:&lt;/strong&gt;&lt;/u&gt;&lt;/p&gt;
&lt;p&gt;This class is also act as previous one. We are taking this class just to show as second observer which will be a subscriber of the server and will&amp;nbsp; be unsubscribe latter.&lt;/p&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;br&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; ObserverPatter&lt;br&gt;{&lt;br&gt;    &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; SecondObserver : IObserver&lt;br&gt;    {&lt;br&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt; _stocks;&lt;br&gt;&lt;br&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Update(Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt; newData)&lt;br&gt;        {&lt;br&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._stocks = newData;&lt;br&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.ShowData();&lt;br&gt;        }&lt;br&gt;&lt;br&gt;&lt;br&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; ShowData()&lt;br&gt;        {&lt;br&gt;            Console.WriteLine(&lt;span style="color: #006080"&gt;"Second Securities LTD"&lt;/span&gt;);&lt;br&gt;            &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt; (KeyValuePair&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt; data &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; _stocks)&lt;br&gt;            {&lt;br&gt;                Console.WriteLine(&lt;span style="color: #006080"&gt;"Current price of {0} is now {1}"&lt;/span&gt;, data.Key, data.Value);&lt;br&gt;            }&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&lt;u&gt;ISubject Interface:&lt;/u&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;This interface contains 3 main method's&amp;nbsp; signature 1.RegisterObserver 2.RemoveObserver 3.NotifyObservers&lt;/p&gt;
&lt;p&gt;RegisterObserver method register an observe in subject’s observer list.&lt;/p&gt;
&lt;p&gt; RemoveObserver method unregister an observer from the subject’s observer list.&lt;/p&gt;
&lt;p&gt;NotifyObservers method is responsible to notify all objects which are subscribed to the server .&lt;/p&gt;
&lt;div&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; ObserverPatter&lt;br&gt;{&lt;br&gt;    &lt;span style="color: #0000ff"&gt;interface&lt;/span&gt; ISubject&lt;br&gt;    {&lt;br&gt;         &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RegisterObserver(IObserver o);&lt;br&gt;         &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RemoveObserver(IObserver o);&lt;br&gt;         &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; NotifyObservers();&lt;br&gt;&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;div&gt;StockSubject concrete class:&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;We have implemented ISubject interface in this class and proceeded accordingly.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; ObserverPatter&lt;br&gt;{&lt;br&gt;    &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; StockSubject : ISubject&lt;br&gt;    {&lt;br&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; List&amp;lt;IObserver&amp;gt; _observers = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; List&amp;lt;IObserver&amp;gt;();&lt;br&gt;        &lt;span style="color: #0000ff"&gt;private&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;, &lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt; _stocks;&lt;br&gt;&lt;br&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RegisterObserver(IObserver o)&lt;br&gt;        {&lt;br&gt;            _observers.Add(o);&lt;br&gt;        }&lt;br&gt;&lt;br&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; RemoveObserver(IObserver o)&lt;br&gt;        {&lt;br&gt;            _observers.Remove(o);&lt;br&gt;        }&lt;br&gt;&lt;br&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; NotifyObservers()&lt;br&gt;        {&lt;br&gt;            &lt;span style="color: #0000ff"&gt;foreach&lt;/span&gt;(IObserver observer &lt;span style="color: #0000ff"&gt;in&lt;/span&gt; _observers)&lt;br&gt;            {&lt;br&gt;                observer.Update(_stocks);&lt;br&gt;            }&lt;br&gt;        }&lt;br&gt;&lt;br&gt;        &lt;span style="color: #0000ff"&gt;public&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; setStockPriceInformation(Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;,&lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt; newData)&lt;br&gt;        {&lt;br&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;._stocks = newData;&lt;br&gt;            &lt;span style="color: #0000ff"&gt;this&lt;/span&gt;.NotifyObservers();&lt;br&gt;        }&lt;br&gt;&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;Now in the runner class “Program” we have implemented our application where we have added two observers and letter removed one observer at runtime. &lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div id="codeSnippetWrapper"&gt;&lt;pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; border-right-style: none; background-color: #f4f4f4; margin: 0em; padding-left: 0px; width: 100%; padding-right: 0px; font-family: 'Courier New', courier, monospace; direction: ltr; border-top-style: none; color: black; font-size: 8pt; border-left-style: none; overflow: visible; padding-top: 0px" id="codeSnippet"&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System;&lt;br&gt;&lt;span style="color: #0000ff"&gt;using&lt;/span&gt; System.Collections.Generic;&lt;br&gt;&lt;br&gt;&lt;span style="color: #0000ff"&gt;namespace&lt;/span&gt; ObserverPatter&lt;br&gt;{&lt;br&gt;    &lt;span style="color: #0000ff"&gt;class&lt;/span&gt; Program&lt;br&gt;    {&lt;br&gt;        &lt;span style="color: #0000ff"&gt;static&lt;/span&gt; &lt;span style="color: #0000ff"&gt;void&lt;/span&gt; Main(&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;[] args)&lt;br&gt;        {&lt;br&gt;&lt;br&gt;            StockSubject stockSubject = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; StockSubject();&lt;br&gt;&lt;br&gt;            var firstObserver = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; FirstObserver();&lt;br&gt;            var secondObserver = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; SecondObserver();&lt;br&gt;&lt;br&gt;            stockSubject.RegisterObserver(firstObserver);&lt;br&gt;            stockSubject.RegisterObserver(secondObserver);&lt;br&gt;&lt;br&gt;&lt;br&gt;            var dataSet = &lt;span style="color: #0000ff"&gt;new&lt;/span&gt; Dictionary&amp;lt;&lt;span style="color: #0000ff"&gt;string&lt;/span&gt;,&lt;span style="color: #0000ff"&gt;float&lt;/span&gt;&amp;gt;();&lt;br&gt;            dataSet.Add(&lt;span style="color: #006080"&gt;"Google Inc"&lt;/span&gt;, 500.25f);&lt;br&gt;            dataSet.Add(&lt;span style="color: #006080"&gt;"Micorsoft"&lt;/span&gt;,400.15f);&lt;br&gt;&lt;br&gt;            stockSubject.setStockPriceInformation(dataSet);&lt;br&gt;&lt;br&gt;            dataSet.Clear();&lt;br&gt;            dataSet.Add(&lt;span style="color: #006080"&gt;"Google Inc"&lt;/span&gt;, 330.25f);&lt;br&gt;            dataSet.Add(&lt;span style="color: #006080"&gt;"Micorsoft"&lt;/span&gt;, 550.15f);&lt;br&gt;&lt;br&gt;            stockSubject.RemoveObserver(secondObserver);&lt;br&gt;&lt;br&gt;            stockSubject.setStockPriceInformation(dataSet);&lt;br&gt;&lt;br&gt;            Console.ReadKey();&lt;br&gt;        }&lt;br&gt;    }&lt;br&gt;}&lt;br&gt;&lt;/pre&gt;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;&lt;strong&gt;&lt;u&gt;Output :&lt;/u&gt;&lt;/strong&gt;&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/TIYDYHq67WI/AAAAAAAABEw/TjPuVfGNyk0/s1600-h/output%5B5%5D.gif"&gt;&lt;img style="border-bottom: 0px; border-left: 0px; display: inline; border-top: 0px; border-right: 0px" title="output" border="0" alt="output" src="http://lh5.ggpht.com/_NL2fAc4la4o/TIYDYwjTVoI/AAAAAAAABE0/vFI2cdR8mws/output_thumb%5B3%5D.gif?imgmax=800" width="658" height="211"&gt;&lt;/a&gt;&amp;nbsp;&lt;br&gt;&lt;/div&gt;
&lt;div&gt;Ok that’s it for today . Let me know if you have any concern regarding this pattern or code.&lt;/div&gt;
&lt;div&gt;&amp;nbsp;&lt;/div&gt;
&lt;div&gt;Take care&lt;/div&gt;
&lt;div&gt;Bye &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-1402086650463326059?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/1402086650463326059/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/09/observer-pattern-implementation-and.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1402086650463326059'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1402086650463326059'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/09/observer-pattern-implementation-and.html' title='Observer Pattern - implementation and application with C#.NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_NL2fAc4la4o/TIYDXNxkQBI/AAAAAAAABEs/qyYMIHIN8mc/s72-c/clip_image002_thumb1.gif?imgmax=800' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-1612035123098711858</id><published>2010-06-06T12:57:00.000+06:00</published><updated>2010-06-07T00:16:47.765+06:00</updated><title type='text'>Git in Windows with TortoiseGIT client &amp; ProjectLocker free Git Hosting</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt; &lt;p&gt;Hope you all are fine. Today I will show how to work with Git in windows environment with TortoiseGIT client &amp;amp; ProjectLocker Git Hosting. ProjectLocker is a good Git hosting provider for startup a private project, you may check there pricing plan to let know more about the features of different plan. &lt;/p&gt; &lt;p&gt;Now first do signup from &lt;a title="https://www.projectlocker.com/signup/startup" href="https://www.projectlocker.com/signup/startup"&gt;https://www.projectlocker.com/signup/startup&lt;/a&gt; ( I will show through a free plan) , After signing up verify your account and login through &lt;a title="https://portal.projectlocker.com/" href="https://portal.projectlocker.com/"&gt;https://portal.projectlocker.com/&lt;/a&gt; . You will find “&lt;strong&gt;Account Links &lt;/strong&gt;&amp;gt; Add Project” from the left menu panel, select “Add Project”. Now give a project name, description and select Git as Repository type.I’m giving the name “DemoGit” for my project.Click “Create Project”.&lt;/p&gt; &lt;p&gt;In the next step you have to create user account from “&lt;strong&gt;Account Links &lt;/strong&gt;&amp;gt; Add User”. Now you have to create a Public Key for your repository.&lt;/p&gt; &lt;p&gt;First download PuttyGen from the [ &lt;a href="http://the.earth.li/~sgtatham/putty/0.60/x86/puttygen.exe"&gt;link&lt;/a&gt; ] or anywhere you found through googling and create a public and private key pair through the software as bellow by clicking Generate button and moving mouse pointer arbitrary.&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:cc2ada81-2a54-45ce-8365-74375f253e5f" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh4.ggpht.com/_NL2fAc4la4o/TAvkD3qho5I/AAAAAAAABCY/Srm3CRXw4PE/18x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/TAvkHD9wjbI/AAAAAAAABCc/RDAHnrc2cxk/11.png?imgmax=800" width="420" height="379" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;Now give a passphrase and confirm it.After that save the private key by clicking “Save private key” , I have saved my with the name demokey.ppk . You have to copy the public key (the top red marked block in the following pictuer)&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:3be912fc-c738-45b5-8d4a-05580075aa2b" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkLY28rlI/AAAAAAAABCg/pW3zmvwSrIw/28x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkSYo8MBI/AAAAAAAABCk/8PpNXhDT_uQ/21.png?imgmax=800" width="420" height="382" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;Its time to get back in ProjectLocker :) .&amp;nbsp; Click manage public key from “&lt;strong&gt;User Links&lt;/strong&gt; &amp;gt; Manage Public Keys” and click “New Key”. Then pest&amp;nbsp; the public key in Key section ,User name (which you have created in user section, I’m putting my email here) and a name to identify the key in Name section and save it as bellow by clicking “Save Public Key”:&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:2cbe09ce-d728-4813-bb85-50a99c4cb109" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkWWwYdxI/AAAAAAAABCo/uNCUvBTLjH0/38x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkaEv1eDI/AAAAAAAABCs/1-paqXbzORQ/34.png?imgmax=800" width="580" height="405" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;Open list projects from “Account Links &amp;gt; List Projects” and select your desired project from the Name column (I’m selecting DemoGit for the demonstration purpose.) as bellow: &lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:6a55b4da-ca75-4036-8c6a-f00f0a04ba57" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvkbu-RbcI/AAAAAAAABCw/6ULPAdzaOJc/48x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvkfNNaq3I/AAAAAAAABC0/mB2ZJmNh938/41.png?imgmax=800" width="580" height="229" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;Now assign the user to the project from the user list bellow by clicking “Add To Project” corresponding user.&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:ceb09ab1-0466-4863-b27c-1b5d9afb5bdd" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvkhz7oWmI/AAAAAAAABC4/8H4BtxYDkNI/68x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/TAvkmf3rFEI/AAAAAAAABC8/jZVOqimkSEg/61.png?imgmax=800" width="420" height="400" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;It’s the time to play with Git client software. For this, first we have to install&amp;nbsp; msysgit from &lt;a title="http://code.google.com/p/msysgit/downloads/list" href="http://code.google.com/p/msysgit/downloads/list"&gt;http://code.google.com/p/msysgit/downloads/list&lt;/a&gt; after that TortoisGIT from &lt;a title="http://code.google.com/p/tortoisegit/downloads/list" href="http://code.google.com/p/tortoisegit/downloads/list"&gt;http://code.google.com/p/tortoisegit/downloads/list&lt;/a&gt; accordingly with next,next flow (I mean default settings, you don’t have to change any settings over there ) and reboot your machine.&lt;/p&gt; &lt;p&gt;Now open a folder where you want to put your files to sink with Git repository (I’m opening a folder named “DemoGit”). After that right click on the the folder and click “Gil Clone..” as bellow:&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:f96ea070-a38e-4694-8dc0-17b19dc5db93" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvkq_h4LZI/AAAAAAAABDA/g8iDQGFMPdY/78x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvkw5cLeNI/AAAAAAAABDE/2tQ51JiTows/76.png?imgmax=800" width="580" height="374" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;Now in the next panel you have to pest the Url (git repository location , you will get it from “&lt;strong&gt;User Links&lt;/strong&gt; &amp;gt; User Home” like the image bellow ) and locate the private key which we have generated earlier (for me its demokey.ppk) &lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:31a4b83b-f91a-4698-8c21-18fb623d997a" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkyF8pjhI/AAAAAAAABDI/TJw1Cetlrog/98x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvkzxY37xI/AAAAAAAABDM/F-592iim0kI/91.png?imgmax=800" width="420" height="153" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:5ec5b52f-b5d7-467e-88be-dc366d32a1f9" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvk2qJFmEI/AAAAAAAABDQ/nDHxvIznSD0/88x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/TAvk7CGDKoI/AAAAAAAABDU/gl4sa_QPQYA/81.png?imgmax=800" width="420" height="330" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;Now you have to enter passphrase which you have set during key generation.&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:e48509ca-b63e-4671-a58a-93b1ac0a7a16" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh6.ggpht.com/_NL2fAc4la4o/TAvk8yYLiiI/AAAAAAAABDY/ycVlYEOqE7Q/108x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh5.ggpht.com/_NL2fAc4la4o/TAvk_mFfnkI/AAAAAAAABDc/ZGz6pxYiv48/10.png?imgmax=800" width="335" height="208" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;That’s it , we have successfully configured our repository with TortoiseGIT client.&lt;/p&gt; &lt;p&gt;Now we will add a file named “demo_text_file.txt” and it to our repository.To that we have to right click the folder again and do as per image bellow.&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:2bf31625-79be-483e-9036-23074c6c4d3d" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh4.ggpht.com/_NL2fAc4la4o/TAvlCAXsCjI/AAAAAAAABDg/Hm4mhwKWBls/118x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/TAvlGKFrAXI/AAAAAAAABDk/JkL_Cw5qBWU/111.png?imgmax=800" width="580" height="529" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;Then confirm the add operation :&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:82d08035-5fcf-4939-8809-78b0a57501b8" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh4.ggpht.com/_NL2fAc4la4o/TAvlKDMwFgI/AAAAAAAABDo/gJ5vkD11PRQ/128x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvlNBoWONI/AAAAAAAABDs/GSmdjxWwYGs/12.png?imgmax=800" width="335" height="272" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;Now you have to do as per following image sequence to push the fine into server.&lt;/p&gt; &lt;p&gt;We are going to change some text in our file and give Git Commite as per image bellow:&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:66a7921d-66d9-40d9-990c-7f7d44d4cda5" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvlOxjWsvI/AAAAAAAABDw/m5-5LCU88kA/158x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/TAvlSimhcXI/AAAAAAAABD0/Thbo9tPQ-38/15.png?imgmax=800" width="335" height="243" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;We have to put a message before committing something into our brunch in Message section, We also can put signed off signature as bellow: &lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:c1906da0-70e1-4d59-90ce-dbb87ecb85b2" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvlX8xI7II/AAAAAAAABD4/ippkeF7Rc-c/168x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvlm3Hb_fI/AAAAAAAABD8/MTT8WRQ2evo/161.png?imgmax=800" width="385" height="420" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;To finally push the file into server we have to click push :&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:4fd19616-db9e-4781-bd50-1e56092017b1" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvlr3XSCtI/AAAAAAAABEA/PZAgrO36e_g/138x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvluD4KLiI/AAAAAAAABEE/XP1n6AyHJ-I/131.png?imgmax=800" width="420" height="317" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;And the we have to select in which brunch we should to push in server and click ok.&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:e2752f44-517d-471e-a61c-c59bbe841a32" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh6.ggpht.com/_NL2fAc4la4o/TAvlwiTQxtI/AAAAAAAABEI/xEWUPuKTBmg/148x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/TAvly7k9bzI/AAAAAAAABEM/XUTsLIVE8Ec/142.png?imgmax=800" width="420" height="350" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;No to sink with others commit we have to update the code base as bellow.&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:d4081888-ca56-41ec-acdd-0ebc3ebbfeba" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvl0XMA46I/AAAAAAAABEQ/3200K1hcuSo/178x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/TAvl5dm3gFI/AAAAAAAABEU/vTXqTnjqvCE/17.png?imgmax=800" width="335" height="222" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;Then select “Pull” as bellow:&lt;/p&gt; &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:4c3cfc7c-73a6-4ca6-9077-e2a7a28181e2" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvl_ZFGkQI/AAAAAAAABEY/GGL3hfb879w/188x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh5.ggpht.com/_NL2fAc4la4o/TAvmCyS2API/AAAAAAAABEc/P09_wI7APJg/182.png?imgmax=800" width="580" height="504" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;There are lots more Git operation we can perform through TortoiseGIT but in this tutorial I just have shown how to do the basic operation. Hope in future I will post more advance feature &amp;amp; operation of GIT.&amp;nbsp; &lt;/p&gt; &lt;p&gt;Thanks&lt;/p&gt; &lt;p&gt;That’s all for today .&lt;/p&gt; &lt;p&gt;To know more visit to my blog [ &lt;a title="http://blog.actcode.com/" href="http://blog.actcode.com/"&gt;http://blog.actcode.com/&lt;/a&gt; ]&lt;/p&gt; &lt;p&gt;Bye&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-1612035123098711858?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/1612035123098711858/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/06/git-in-windows-with-tortoisegit-client.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1612035123098711858'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1612035123098711858'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/06/git-in-windows-with-tortoisegit-client.html' title='Git in Windows with TortoiseGIT client &amp;amp; ProjectLocker free Git Hosting'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_NL2fAc4la4o/TAvkHD9wjbI/AAAAAAAABCc/RDAHnrc2cxk/s72-c/11.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-8679684139356040965</id><published>2010-05-16T00:35:00.000+06:00</published><updated>2010-05-16T00:37:53.653+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='PHP'/><category scheme='http://www.blogger.com/atom/ns#' term='OOP'/><category scheme='http://www.blogger.com/atom/ns#' term='Overloading'/><title type='text'>PHP overloading ( method overloading and property overloading)</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt; &lt;p&gt;Today I will focus on overloading method and property in PHP. Unlike other language Java/C# overloading is working in a little bit different way for PHP. &lt;/p&gt; &lt;p&gt;Normally we can overload a method by providing different/varying argument(s) ,but in PHP it should have to create through some magic methods.&lt;/p&gt; &lt;p&gt;These magic methods are as bellow:&lt;/p&gt; &lt;p&gt;(&lt;em&gt;For overloading property&lt;/em&gt;) &lt;/p&gt; &lt;p&gt;void &lt;b&gt;__set&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; , &lt;a href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt; &lt;tt&gt;$value&lt;/tt&gt; ) &lt;/p&gt; &lt;p&gt;&lt;a href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt; &lt;b&gt;__get&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; ) &lt;/p&gt; &lt;p&gt;bool &lt;b&gt;__isset&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; ) &lt;/p&gt; &lt;p&gt;void &lt;b&gt;__unset&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; ) &lt;/p&gt; &lt;p&gt;(&lt;em&gt;For overloading method&lt;/em&gt;)&lt;/p&gt; &lt;p&gt;&lt;a href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt; &lt;b&gt;__call&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; , array &lt;tt&gt;$arguments&lt;/tt&gt; )&lt;/p&gt; &lt;p&gt;&lt;a href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt; &lt;b&gt;__callStatic&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; , array &lt;tt&gt;$arguments&lt;/tt&gt; )&lt;/p&gt; &lt;p&gt;It will be better to describe the operation inside code comment rather that bookish thing hear. Please go through the code comment to get know what is gonging over there to perform overloading .&lt;/p&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 900px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;php
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/class"&gt;class&lt;/a&gt; PhpOverloading {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #008000"&gt;/* Property overloading -start- */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  private $_data = &lt;a style="color: #ffa500" href="http://www.php.net/array"&gt;array&lt;/a&gt; ();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __set($name, $value) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * set the key value in the $_data private
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * variable.
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    $this-&amp;gt;_data [$name] = $value;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __get($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * Retrieve the value of key which we have
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * set through __set method.
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #0000ff" href="http://www.php.net/return"&gt;return&lt;/a&gt; $this-&amp;gt;_data [$name];
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __isset($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * Check wheather the key exist or not. 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #0000ff" href="http://www.php.net/return"&gt;return&lt;/a&gt; isset ( $this-&amp;gt;_data [$name] );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __unset($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * Unset the value of key.
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #ffa500" href="http://www.php.net/unset"&gt;unset&lt;/a&gt; ( $this-&amp;gt;_data [$name] );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #008000"&gt;/* Property overloading -end- */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #008000"&gt;/* Method overloading -start- */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __call($name, $argument) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * perform your operation as needed,
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * I just used a switch case to show how 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * we can set the dynamic method with parameters.
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #0000ff" href="http://www.php.net/switch"&gt;switch&lt;/a&gt; ($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/case"&gt;case&lt;/a&gt; ('&lt;span style="color: #8b0000"&gt;First&lt;/span&gt;') :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;This is the first dyanamic method and arguments are &lt;/span&gt;" . &lt;a style="color: #ffa500" href="http://www.php.net/implode"&gt;implode&lt;/a&gt; ( '&lt;span style="color: #8b0000"&gt;,&lt;/span&gt;', $argument );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/break"&gt;break&lt;/a&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/case"&gt;case&lt;/a&gt; ('&lt;span style="color: #8b0000"&gt;Second&lt;/span&gt;') :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;2nd method and the arguments are {$argument[1]} and {$argument[2]}&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/break"&gt;break&lt;/a&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/default"&gt;default&lt;/a&gt; :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;Method unhandled with the name {$name} and arguments are &lt;/span&gt;" . &lt;a style="color: #ffa500" href="http://www.php.net/implode"&gt;implode&lt;/a&gt; ( '&lt;span style="color: #8b0000"&gt;,&lt;/span&gt;', $argument );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public static &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __callstatic($name, $argument) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * It's similar as __call but works as static method
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * call. 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #0000ff" href="http://www.php.net/switch"&gt;switch&lt;/a&gt; ($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/case"&gt;case&lt;/a&gt; ('&lt;span style="color: #8b0000"&gt;FirstStatic&lt;/span&gt;') :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;Static first dyanamic method and arguments are &lt;/span&gt;" . &lt;a style="color: #ffa500" href="http://www.php.net/implode"&gt;implode&lt;/a&gt; ( '&lt;span style="color: #8b0000"&gt;,&lt;/span&gt;', $argument );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/break"&gt;break&lt;/a&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/case"&gt;case&lt;/a&gt; ('&lt;span style="color: #8b0000"&gt;SecondStatic&lt;/span&gt;') :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;Static 2nd method and the arguments are {$argument[1]} and {$argument[2]}&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/break"&gt;break&lt;/a&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/default"&gt;default&lt;/a&gt; :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;Static method unhandled with the name {$name} and arguments are &lt;/span&gt;" . &lt;a style="color: #ffa500" href="http://www.php.net/implode"&gt;implode&lt;/a&gt; ( '&lt;span style="color: #8b0000"&gt;,&lt;/span&gt;', $argument );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #008000"&gt;/* Method overloading -end- */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading = new PhpOverloading ();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;Property overloading output -start-&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #ffa500" href="http://www.php.net/var_dump"&gt;var_dump&lt;/a&gt; ( isset ( $phpOverloading-&amp;gt;dynamicProperty ) );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading-&amp;gt;dynamicProperty = "&lt;span style="color: #8b0000"&gt;new property injected&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; $phpOverloading-&amp;gt;dynamicProperty;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #ffa500" href="http://www.php.net/var_dump"&gt;var_dump&lt;/a&gt; ( isset ( $phpOverloading-&amp;gt;dynamicProperty ) );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #ffa500" href="http://www.php.net/unset"&gt;unset&lt;/a&gt; ( $phpOverloading-&amp;gt;dynamicProperty );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #ffa500" href="http://www.php.net/var_dump"&gt;var_dump&lt;/a&gt; ( isset ( $phpOverloading-&amp;gt;dynamicProperty ) );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;Property overloading output -end-&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;Method overloading output -start-&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading-&amp;gt;First ( '&lt;span style="color: #8b0000"&gt;one&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;two&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;three&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading-&amp;gt;Second ( '&lt;span style="color: #8b0000"&gt;1&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;2&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading-&amp;gt;UnHandledMethod ( '&lt;span style="color: #8b0000"&gt;1&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;2&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;staic method overloading&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;PhpOverloading::FirstStatic ( '&lt;span style="color: #8b0000"&gt;one&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;two&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;three&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;PhpOverloading::SecondStatic ( '&lt;span style="color: #8b0000"&gt;1&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;2&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;PhpOverloading::UnHandledStaticMethod ( '&lt;span style="color: #8b0000"&gt;1&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;2&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;Method overloading output -end-&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; * final output is as bellow:
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Property overloading output -start-
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;bool(false) 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;new property injected
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;bool(true) 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;bool(false) 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Property overloading output -end-
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Method overloading output -start-
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;This is the first dyanamic method and arguments are one,two,three
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;2nd method and the arguments are 2 and 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Method unhandled with the name UnHandledMethod and arguments are 1,2
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;staic method overloading
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Static first dyanamic method and arguments are one,two,three
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Static 2nd method and the arguments are 2 and 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Static method unhandled with the name UnHandledStaticMethod and arguments are 1,2
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Method overloading output -end-
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; * 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;
&lt;p&gt;You may check my other posts from my [ &lt;a href="http://blog.actcode.com/"&gt;Blog&lt;/a&gt; ] .&lt;/p&gt;
&lt;p&gt;Please provide your feedback. &lt;/p&gt;
&lt;p&gt;Thanks&lt;/p&gt;
&lt;p&gt;That's all for today. &lt;/p&gt;
&lt;p&gt;BYE&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-8679684139356040965?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/8679684139356040965/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/05/php-overloading-method-overloading-and_16.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/8679684139356040965'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/8679684139356040965'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/05/php-overloading-method-overloading-and_16.html' title='PHP overloading ( method overloading and property overloading)'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-5097443376611546598</id><published>2010-05-16T00:24:00.001+06:00</published><updated>2010-05-16T00:29:43.774+06:00</updated><title type='text'>PHP overloading ( method overloading and property overloading)</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt; &lt;p&gt;Today I will focus on overloading method and property in PHP. Unlike other language Java/C# overloading is working in a little bit different way for PHP. &lt;/p&gt; &lt;p&gt;Normally we can overload a method by providing different/varying argument(s) ,but in PHP it should have to create through some magic methods.&lt;/p&gt; &lt;p&gt;These magic methods are as bellow:&lt;/p&gt; &lt;p&gt;(&lt;em&gt;For overloading property&lt;/em&gt;)  &lt;p&gt;void &lt;b&gt;__set&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; , &lt;a href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt; &lt;tt&gt;$value&lt;/tt&gt; )  &lt;p&gt;&lt;a href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt; &lt;b&gt;__get&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; )  &lt;p&gt;bool &lt;b&gt;__isset&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; )  &lt;p&gt;void &lt;b&gt;__unset&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; )  &lt;p&gt; (&lt;em&gt;For overloading method&lt;/em&gt;)&lt;/p&gt; &lt;p&gt;&lt;a href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt; &lt;b&gt;__call&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; , array &lt;tt&gt;$arguments&lt;/tt&gt; ) &lt;p&gt;&lt;a href="language.pseudo-types.html#language.types.mixed"&gt;mixed&lt;/a&gt; &lt;b&gt;__callStatic&lt;/b&gt; ( string &lt;tt&gt;$name&lt;/tt&gt; , array &lt;tt&gt;$arguments&lt;/tt&gt; ) &lt;p&gt;It will be better to describe the operation inside code comment rather that bookish thing hear. Please go through the code comment to get know what is gonging over there to perform overloading .&lt;/p&gt;&lt;pre style="border-bottom: #cecece 1px solid; border-left: #cecece 1px solid; padding-bottom: 5px; background-color: #fbfbfb; min-height: 40px; padding-left: 5px; width: 900px; padding-right: 5px; overflow: auto; border-top: #cecece 1px solid; border-right: #cecece 1px solid; padding-top: 5px"&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #0000ff"&gt;&amp;lt;?&lt;/span&gt;php
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/class"&gt;class&lt;/a&gt; PhpOverloading {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #008000"&gt;/* Property overloading -start- */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  private $_data = &lt;a style="color: #ffa500" href="http://www.php.net/array"&gt;array&lt;/a&gt; ();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __set($name, $value) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * set the key value in the $_data private
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * variable.
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    $this-&amp;gt;_data [$name] = $value;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __get($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * Retrieve the value of key which we have
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * set through __set method.
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #0000ff" href="http://www.php.net/return"&gt;return&lt;/a&gt; $this-&amp;gt;_data [$name];
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __isset($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * Check wheather the key exist or not. 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #0000ff" href="http://www.php.net/return"&gt;return&lt;/a&gt; isset ( $this-&amp;gt;_data [$name] );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __unset($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * Unset the value of key.
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #ffa500" href="http://www.php.net/unset"&gt;unset&lt;/a&gt; ( $this-&amp;gt;_data [$name] );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #008000"&gt;/* Property overloading -end- */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  &lt;span style="color: #008000"&gt;/* Method overloading -start- */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __call($name, $argument) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * perform your operation as needed,
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * I just used a switch case to show how 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * we can set the dynamic method with parameters.
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #0000ff" href="http://www.php.net/switch"&gt;switch&lt;/a&gt; ($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/case"&gt;case&lt;/a&gt; ('&lt;span style="color: #8b0000"&gt;First&lt;/span&gt;') :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;This is the first dyanamic method and arguments are &lt;/span&gt;" . &lt;a style="color: #ffa500" href="http://www.php.net/implode"&gt;implode&lt;/a&gt; ( '&lt;span style="color: #8b0000"&gt;,&lt;/span&gt;', $argument );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/break"&gt;break&lt;/a&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/case"&gt;case&lt;/a&gt; ('&lt;span style="color: #8b0000"&gt;Second&lt;/span&gt;') :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;2nd method and the arguments are {$argument[1]} and {$argument[2]}&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/break"&gt;break&lt;/a&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/default"&gt;default&lt;/a&gt; :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;Method unhandled with the name {$name} and arguments are &lt;/span&gt;" . &lt;a style="color: #ffa500" href="http://www.php.net/implode"&gt;implode&lt;/a&gt; ( '&lt;span style="color: #8b0000"&gt;,&lt;/span&gt;', $argument );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  public static &lt;a style="color: #0000ff" href="http://www.php.net/function"&gt;function&lt;/a&gt; __callstatic($name, $argument) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * It's similar as __call but works as static method
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * call. 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;     * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    &lt;a style="color: #0000ff" href="http://www.php.net/switch"&gt;switch&lt;/a&gt; ($name) {
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/case"&gt;case&lt;/a&gt; ('&lt;span style="color: #8b0000"&gt;FirstStatic&lt;/span&gt;') :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;Static first dyanamic method and arguments are &lt;/span&gt;" . &lt;a style="color: #ffa500" href="http://www.php.net/implode"&gt;implode&lt;/a&gt; ( '&lt;span style="color: #8b0000"&gt;,&lt;/span&gt;', $argument );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/break"&gt;break&lt;/a&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/case"&gt;case&lt;/a&gt; ('&lt;span style="color: #8b0000"&gt;SecondStatic&lt;/span&gt;') :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;Static 2nd method and the arguments are {$argument[1]} and {$argument[2]}&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/break"&gt;break&lt;/a&gt;;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;      &lt;a style="color: #0000ff" href="http://www.php.net/default"&gt;default&lt;/a&gt; :
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;        &lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;Static method unhandled with the name {$name} and arguments are &lt;/span&gt;" . &lt;a style="color: #ffa500" href="http://www.php.net/implode"&gt;implode&lt;/a&gt; ( '&lt;span style="color: #8b0000"&gt;,&lt;/span&gt;', $argument );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;    }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  }
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;  
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #008000"&gt;/* Method overloading -end- */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;}
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading = new PhpOverloading ();
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;Property overloading output -start-&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #ffa500" href="http://www.php.net/var_dump"&gt;var_dump&lt;/a&gt; ( isset ( $phpOverloading-&amp;gt;dynamicProperty ) );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading-&amp;gt;dynamicProperty = "&lt;span style="color: #8b0000"&gt;new property injected&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; $phpOverloading-&amp;gt;dynamicProperty;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #ffa500" href="http://www.php.net/var_dump"&gt;var_dump&lt;/a&gt; ( isset ( $phpOverloading-&amp;gt;dynamicProperty ) );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #ffa500" href="http://www.php.net/unset"&gt;unset&lt;/a&gt; ( $phpOverloading-&amp;gt;dynamicProperty );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #ffa500" href="http://www.php.net/var_dump"&gt;var_dump&lt;/a&gt; ( isset ( $phpOverloading-&amp;gt;dynamicProperty ) );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;Property overloading output -end-&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;Method overloading output -start-&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading-&amp;gt;First ( '&lt;span style="color: #8b0000"&gt;one&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;two&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;three&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading-&amp;gt;Second ( '&lt;span style="color: #8b0000"&gt;1&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;2&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;$phpOverloading-&amp;gt;UnHandledMethod ( '&lt;span style="color: #8b0000"&gt;1&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;2&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;staic method overloading&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;PhpOverloading::FirstStatic ( '&lt;span style="color: #8b0000"&gt;one&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;two&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;three&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;PhpOverloading::SecondStatic ( '&lt;span style="color: #8b0000"&gt;1&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;2&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;PhpOverloading::UnHandledStaticMethod ( '&lt;span style="color: #8b0000"&gt;1&lt;/span&gt;', '&lt;span style="color: #8b0000"&gt;2&lt;/span&gt;' );
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; "&lt;span style="color: #8b0000"&gt;&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/span&gt;";
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;a style="color: #0000ff" href="http://www.php.net/echo"&gt;echo&lt;/a&gt; '&lt;span style="color: #8b0000"&gt;Method overloading output -end-&lt;/span&gt;';
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;span style="color: #008000"&gt;/*
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; * final output is as bellow:
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Property overloading output -start-
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;bool(false) 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;new property injected
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;bool(true) 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;bool(false) 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Property overloading output -end-
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Method overloading output -start-
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;This is the first dyanamic method and arguments are one,two,three
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;2nd method and the arguments are 2 and 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Method unhandled with the name UnHandledMethod and arguments are 1,2
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;staic method overloading
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Static first dyanamic method and arguments are one,two,three
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Static 2nd method and the arguments are 2 and 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Static method unhandled with the name UnHandledStaticMethod and arguments are 1,2
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;Method overloading output -end-
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; * 
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt; * */&lt;/span&gt;
&lt;/pre&gt;&lt;pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"&gt;&lt;/pre&gt;&lt;/pre&gt;
&lt;p&gt;You may check my other posts from my [ &lt;a href="http://blog.actcode.com/"&gt;Blog&lt;/a&gt; ] 
&lt;p&gt;Please provide your feedback. 
&lt;p&gt;Thanks
&lt;p&gt;That's all for today. 
&lt;p&gt;BYE&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-5097443376611546598?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/5097443376611546598/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/05/php-overloading-method-overloading-and.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5097443376611546598'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5097443376611546598'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/05/php-overloading-method-overloading-and.html' title='PHP overloading ( method overloading and property overloading)'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-5728415229181895873</id><published>2010-02-28T14:05:00.000+06:00</published><updated>2010-03-02T14:07:38.684+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='control'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='repeater'/><title type='text'>Control inside repeater row ASP.NET</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt;  &lt;p&gt;Few days back I was struggling with a repeater problem , where I have to get a value of dropdown list on a button click event which is inside repeater. Eventually I come up with a solution through googling. What I have faced was get the value of appropriate dropdown list while clicking the button of a particular repeater’s row.&lt;/p&gt;  &lt;p&gt;It’s being hard to describe rather that visualize :) isn’t it ! ( proposed solution should be as image bellow)&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:aad723dd-8ee3-4972-9904-af9b422748b1" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh6.ggpht.com/_NL2fAc4la4o/S4zHKqmLrfI/AAAAAAAAA90/UMJKft6Otao/18x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/S4zHQDH9ngI/AAAAAAAAA94/cd7k1cNj_SY/13.png?imgmax=800" width="580" height="494" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; My aspx markup is as bellow :&lt;/p&gt;  &lt;pre class="code"&gt; &lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Repeater &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptTeamInfo&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;OnItemDataBound&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptTeamInfo_ItemDataBound&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;OnItemCommand&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptTeamInfo_ItemCommand&amp;quot;&amp;gt;
               &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;side2&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;form&amp;quot;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;a &lt;/span&gt;&lt;span style="color: red"&gt;href&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;#&amp;quot;&amp;gt;&lt;/span&gt;delete&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;a&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;a &lt;/span&gt;&lt;span style="color: red"&gt;href&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;#&amp;quot;&amp;gt;&lt;/span&gt;edit /&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;a&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ul &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;p2&amp;quot;&amp;gt;           
                      &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;style1&amp;quot;&amp;gt;&lt;/span&gt;[ &lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;#&lt;/span&gt;Eval(&lt;span style="color: #a31515"&gt;&amp;quot;team_name&amp;quot;&lt;/span&gt;)&lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt; ]&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt; &lt;/span&gt;- [ &lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;#&lt;/span&gt;Eval(&lt;span style="color: #a31515"&gt;&amp;quot;creation_date&amp;quot;&lt;/span&gt;)&lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;]&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;br &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
                      &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;span &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;style2&amp;quot;&amp;gt;&lt;/span&gt;[&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ADMIN bla bla bla&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;] - [ &lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;#&lt;/span&gt;Eval(&lt;span style="color: #a31515"&gt;&amp;quot;team_leader&amp;quot;&lt;/span&gt;)&lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;]&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;span&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt; &lt;/span&gt;- [ &lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;#&lt;/span&gt;Eval(&lt;span style="color: #a31515"&gt;&amp;quot;description&amp;quot;&lt;/span&gt;)&lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;]
                     &lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ul&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;                                                                        
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;form2&amp;quot;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ImageButton &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;imgAddToTeam&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;CommandName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;select&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CommandArgument&lt;/span&gt;&lt;span style="color: blue"&gt;='&lt;/span&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;# &lt;/span&gt;Eval(&amp;quot;team_id&amp;quot;) &lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;'  &lt;/span&gt;&lt;span style="color: red"&gt;ImageUrl&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;images/Add_to_team.png&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;margin&lt;/span&gt;&lt;span style="color: blue"&gt;:10px;&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;align&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;right&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ImageButton&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;DropDownList &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ddlUserList&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
                
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;DropDownList&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;row1&amp;quot;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ul &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;column&amp;quot;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;img &lt;/span&gt;&lt;span style="color: red"&gt;src&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;images/name.png&amp;quot; /&amp;gt; &lt;/span&gt;Name&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ul&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ul &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;column2&amp;quot;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;img &lt;/span&gt;&lt;span style="color: red"&gt;src&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;images/username.png&amp;quot; /&amp;gt; &lt;/span&gt;Username&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ul&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ul &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;column3&amp;quot;&amp;gt;
                            &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;img &lt;/span&gt;&lt;span style="color: red"&gt;src&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;images/username.png&amp;quot; /&amp;gt; &lt;/span&gt;Access&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ul&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;div &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;row2&amp;quot;&amp;gt;                
                 &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Repeater &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptUserInfo&amp;quot;  &lt;/span&gt;&lt;span style="color: red"&gt;OnItemDataBound&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptUserInfo_ItemDataBound&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
                       &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;LinkButton &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lnkUserDelete&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;onclick&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lnkUserDelete_Click&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;delete&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;LinkButton&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ul &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;column&amp;quot;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lblFirstNameIn&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lblLastNameIn&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ul&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ul &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;column2&amp;quot;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt; &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lblUserIDIn&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ul&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ul &lt;/span&gt;&lt;span style="color: red"&gt;class&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;column3&amp;quot;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lblUserTypeIn&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;p&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ul&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;                             
                 &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Repeater&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;                
                &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
               &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
               &amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Repeater&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;And my code behind file is as bellow :&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.UI.WebControls;
&lt;span style="color: blue"&gt;using &lt;/span&gt;ClassLibrary1.UTILITY;

&lt;span style="color: blue"&gt;namespace &lt;font color="#666666"&gt;WebDoc&lt;/font&gt;&lt;/span&gt;
{
    &lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManageTeam &lt;/span&gt;: System.Web.UI.&lt;span style="color: #2b91af"&gt;Page
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;public int &lt;/span&gt;CurrentTeamID { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }

        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;Page_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
            lblUserId.Text = &lt;span style="color: #2b91af"&gt;BUSessionUtility&lt;/span&gt;.BUSessionContainer.UserName;
            &lt;span style="color: #2b91af"&gt;ManageTeamDAL &lt;/span&gt;manageTeamDAL = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManageTeamDAL&lt;/span&gt;();
            rptTeamInfo.DataSource = manageTeamDAL.GetGroupsByManagerID(&lt;span style="color: #2b91af"&gt;BUSessionUtility&lt;/span&gt;.BUSessionContainer.UserName);

            rptTeamInfo.DataBind();

        }
        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;btnLogOut_Click(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: #2b91af"&gt;BUSessionUtility&lt;/span&gt;.BUSessionContainer.UserName = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty;
            &lt;span style="color: #2b91af"&gt;BUSessionUtility&lt;/span&gt;.BUSessionContainer.UserType = &lt;span style="color: blue"&gt;string&lt;/span&gt;.Empty;
            Response.Redirect(&lt;span style="color: #a31515"&gt;&amp;quot;~/LoginUI.aspx&amp;quot;&lt;/span&gt;);
        }

        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;rptTeamInfo_ItemDataBound(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RepeaterItemEventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: #2b91af"&gt;DropDownList &lt;/span&gt;ddlUserList = (&lt;span style="color: #2b91af"&gt;DropDownList&lt;/span&gt;)(e.Item.FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;ddlUserList&amp;quot;&lt;/span&gt;));

            &lt;span style="color: #2b91af"&gt;ManageTeamDAL &lt;/span&gt;manageTeamDAL = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManageTeamDAL&lt;/span&gt;();
            ddlUserList.DataSource = manageTeamDAL.GetUsersByManagerID(&lt;span style="color: #2b91af"&gt;BUSessionUtility&lt;/span&gt;.BUSessionContainer.UserName);
            ddlUserList.DataTextField = &lt;span style="color: #a31515"&gt;&amp;quot;id&amp;quot;&lt;/span&gt;;
            ddlUserList.DataValueField = &lt;span style="color: #a31515"&gt;&amp;quot;id&amp;quot;&lt;/span&gt;;
            ddlUserList.DataBind();

            &lt;span style="color: #2b91af"&gt;Repeater &lt;/span&gt;rptUserInfo = (&lt;span style="color: #2b91af"&gt;Repeater&lt;/span&gt;)(e.Item.FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;rptUserInfo&amp;quot;&lt;/span&gt;));

            &lt;span style="color: blue"&gt;var &lt;/span&gt;row = e.Item.DataItem;
            rptUserInfo.DataSource = manageTeamDAL.GetUsersByAssignedTeamID(((&lt;span style="color: #2b91af"&gt;team_info&lt;/span&gt;)(row)).team_id);
            rptUserInfo.DataBind();


        }

        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;rptTeamInfo_ItemCommand(&lt;span style="color: blue"&gt;object &lt;/span&gt;source, &lt;span style="color: #2b91af"&gt;RepeaterCommandEventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(e.CommandName == &lt;span style="color: #a31515"&gt;&amp;quot;select&amp;quot;&lt;/span&gt;)
            {
                &lt;span style="color: #2b91af"&gt;ImageButton &lt;/span&gt;imgAddToTeam = (&lt;span style="color: #2b91af"&gt;ImageButton&lt;/span&gt;)e.CommandSource;

                &lt;span style="color: #2b91af"&gt;DropDownList &lt;/span&gt;ddlUserList = (&lt;span style="color: #2b91af"&gt;DropDownList&lt;/span&gt;)rptTeamInfo.Items[e.Item.ItemIndex].FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;ddlUserList&amp;quot;&lt;/span&gt;);

                &lt;span style="color: #2b91af"&gt;ManageTeamDAL &lt;/span&gt;manageTeamDAL = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManageTeamDAL&lt;/span&gt;();

                manageTeamDAL.AssignUserInTeam(&lt;span style="color: blue"&gt;int&lt;/span&gt;.Parse(imgAddToTeam.CommandArgument), ddlUserList.SelectedValue.ToString());

                rptTeamInfo.DataSource = manageTeamDAL.GetGroupsByManagerID(&lt;span style="color: #2b91af"&gt;BUSessionUtility&lt;/span&gt;.BUSessionContainer.UserName);

                rptTeamInfo.DataBind();
            }
        }

        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;rptUserInfo_ItemDataBound(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RepeaterItemEventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: #2b91af"&gt;Label &lt;/span&gt;lblFirstName = (&lt;span style="color: #2b91af"&gt;Label&lt;/span&gt;)(e.Item.FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;lblFirstNameIn&amp;quot;&lt;/span&gt;));
            &lt;span style="color: #2b91af"&gt;Label &lt;/span&gt;lblLastName = (&lt;span style="color: #2b91af"&gt;Label&lt;/span&gt;)(e.Item.FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;lblLastNameIn&amp;quot;&lt;/span&gt;));
            &lt;span style="color: #2b91af"&gt;Label &lt;/span&gt;lblUserID = (&lt;span style="color: #2b91af"&gt;Label&lt;/span&gt;)(e.Item.FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;lblUserIDIn&amp;quot;&lt;/span&gt;));
            &lt;span style="color: #2b91af"&gt;Label &lt;/span&gt;lblUserType = (&lt;span style="color: #2b91af"&gt;Label&lt;/span&gt;)(e.Item.FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;lblUserTypeIn&amp;quot;&lt;/span&gt;));
            &lt;span style="color: #2b91af"&gt;LinkButton &lt;/span&gt;lnkUserDelete = (&lt;span style="color: #2b91af"&gt;LinkButton&lt;/span&gt;)(e.Item.FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;lnkUserDelete&amp;quot;&lt;/span&gt;));

            &lt;span style="color: blue"&gt;var &lt;/span&gt;row = e.Item.DataItem;

            lblFirstName.Text = ((&lt;span style="color: #2b91af"&gt;user_info&lt;/span&gt;)(row)).f_name;
            lblLastName.Text = ((&lt;span style="color: #2b91af"&gt;user_info&lt;/span&gt;)(row)).l_name;
            lblUserID.Text = ((&lt;span style="color: #2b91af"&gt;user_info&lt;/span&gt;)(row)).id;
            lblUserType.Text = ((&lt;span style="color: #2b91af"&gt;user_info&lt;/span&gt;)(row)).user_type;
            lnkUserDelete.CommandArgument = ((&lt;span style="color: #2b91af"&gt;user_info&lt;/span&gt;)(row)).id;


        }

        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;lnkUserDelete_Click(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: #2b91af"&gt;ManageTeamDAL &lt;/span&gt;manageTeamDAL = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManageTeamDAL&lt;/span&gt;();

            manageTeamDAL.DeleteUserformTeam(((&lt;span style="color: #2b91af"&gt;LinkButton&lt;/span&gt;)(sender)).CommandArgument);

            rptTeamInfo.DataSource = manageTeamDAL.GetGroupsByManagerID(&lt;span style="color: #2b91af"&gt;BUSessionUtility&lt;/span&gt;.BUSessionContainer.UserName);

            rptTeamInfo.DataBind();
        }

    }
}&lt;/pre&gt;

&lt;p&gt;Not all codes are important here and &lt;em&gt;I will escape the data binding part as its not the focus of today’s topic&lt;/em&gt;. Now I will focus what we should do to perform our basic task.&lt;/p&gt;

&lt;p&gt;first of all we have to do one most important&amp;#160; thing *** MAKE&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: red"&gt;EnableViewState&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;false&amp;quot; &lt;/span&gt;*** If ViewState is in true condition your are not going to handle&amp;#160; &lt;span style="color: red"&gt;OnItemCommand&lt;/span&gt; event which will significantly react for your particular row’s activity.&lt;/p&gt;

&lt;p&gt;&amp;#160;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Repeater &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptTeamInfo&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;OnItemDataBound&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptTeamInfo_ItemDataBound&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;OnItemCommand&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptTeamInfo_ItemCommand&amp;quot;&amp;gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ImageButton &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;imgAddToTeam&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CommandName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;select&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CommandArgument&lt;/span&gt;&lt;span style="color: blue"&gt;='&lt;/span&gt;&lt;span style="background: yellow"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;# &lt;/span&gt;Eval(&amp;quot;team_id&amp;quot;) &lt;span style="background: yellow"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;' &lt;/span&gt;&lt;span style="color: red"&gt;ImageUrl&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;images/Add_to_team.png&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;style&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&lt;/span&gt;&lt;span style="color: red"&gt;margin&lt;/span&gt;&lt;span style="color: blue"&gt;:10px;&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;align&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;right&amp;quot;&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;ImageButton&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;span style="background: yellow"&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;DropDownList &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;ddlUserList&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;DropDownList&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt; &lt;/span&gt;&lt;/p&gt;

&lt;p&gt;&lt;span style="color: blue"&gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: maroon"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: maroon"&gt;Repeater&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/p&gt;

&lt;p&gt;The event handler “rptTeamInfo_ItemCommand” for the the event “&lt;span style="color: red"&gt;OnItemCommand&lt;/span&gt;” is as bellow.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;protected void &lt;/span&gt;rptTeamInfo_ItemCommand(&lt;span style="color: blue"&gt;object &lt;/span&gt;source, &lt;span style="color: #2b91af"&gt;RepeaterCommandEventArgs &lt;/span&gt;e)
{
    &lt;span style="color: blue"&gt;if &lt;/span&gt;(e.CommandName == &lt;span style="color: #a31515"&gt;&amp;quot;select&amp;quot;&lt;/span&gt;)
    {
        &lt;span style="color: #2b91af"&gt;ImageButton &lt;/span&gt;imgAddToTeam = (&lt;span style="color: #2b91af"&gt;ImageButton&lt;/span&gt;)e.CommandSource;
        
        &lt;span style="color: #2b91af"&gt;DropDownList &lt;/span&gt;ddlUserList = (&lt;span style="color: #2b91af"&gt;DropDownList&lt;/span&gt;)rptTeamInfo.Items[e.Item.ItemIndex].FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;ddlUserList&amp;quot;&lt;/span&gt;);
    
        &lt;span style="color: #2b91af"&gt;ManageTeamDAL &lt;/span&gt;manageTeamDAL = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ManageTeamDAL&lt;/span&gt;();

        manageTeamDAL.AssignUserInTeam( &lt;span style="color: blue"&gt;int&lt;/span&gt;.Parse(imgAddToTeam.CommandArgument),ddlUserList.SelectedValue.ToString() );

        rptTeamInfo.DataSource = manageTeamDAL.GetGroupsByManagerID(&lt;span style="color: #2b91af"&gt;BUSessionUtility&lt;/span&gt;.BUSessionContainer.UserName);

        rptTeamInfo.DataBind();
    }
}&lt;/pre&gt;
We are passing the “&lt;span style="color: red"&gt;CommandName&lt;/span&gt;” and “&lt;span style="color: red"&gt;CommandArgument&lt;/span&gt;” through our image button which will check the command name in code behind and act with the command argument parameter. 

&lt;p&gt;We can get our ImageButton and DropdownList is as bellow from our code behind.&lt;/p&gt;

&lt;pre class="code"&gt;&lt;span style="color: #2b91af"&gt;ImageButton &lt;/span&gt;imgAddToTeam = (&lt;span style="color: #2b91af"&gt;ImageButton&lt;/span&gt;)e.CommandSource;

&lt;span style="color: #2b91af"&gt;DropDownList &lt;/span&gt;ddlUserList = (&lt;span style="color: #2b91af"&gt;DropDownList&lt;/span&gt;)rptTeamInfo.Items[e.Item.ItemIndex].FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;ddlUserList&amp;quot;&lt;/span&gt;);&lt;/pre&gt;

&lt;p&gt;And selet the value of dropdown as bellow.&lt;/p&gt;

&lt;pre class="code"&gt;ddlUserList.SelectedValue&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;In this way we can accomplish our task regarding the repeater row’s control manipulation.&lt;/p&gt;

&lt;p&gt;Thats all for today.&lt;/p&gt;

&lt;p&gt;BYE&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-5728415229181895873?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/5728415229181895873/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/02/control-inside-repeater-row-aspnet.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5728415229181895873'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5728415229181895873'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2010/02/control-inside-repeater-row-aspnet.html' title='Control inside repeater row ASP.NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_NL2fAc4la4o/S4zHQDH9ngI/AAAAAAAAA94/cd7k1cNj_SY/s72-c/13.png?imgmax=800' height='72' width='72'/><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-1936564450630876428</id><published>2009-12-23T23:32:00.000+07:00</published><updated>2009-12-23T23:40:38.672+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='IoC'/><category scheme='http://www.blogger.com/atom/ns#' term='DI'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Ninject'/><title type='text'>Dependency Injection with Ninject in .NET</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt;  &lt;p&gt;From last few months I was not working on .NET platform so haven’t get enough time to write something fruitful on .NET technology. But from last few few days I was thinking to do something with IoC . There are many DI tools to perform DI in .NET but I found Ninject useful as well as light waited and easily implementable. So lets start to make our hand dirty with the Ninject (there are many advanced level use of Ninject library but in this article I will simply show how to do DI with Ninject framework).&lt;/p&gt;  &lt;p&gt;My project structure is as following .&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:186b4b60-6aef-410c-af9e-960b65848a12" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh4.ggpht.com/_NL2fAc4la4o/SzJF42x6MSI/AAAAAAAAA8Y/j4hUHUrUC6E/Untitled8x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/SzJF7_bAGhI/AAAAAAAAA8c/PPYSYbtt9Z8/Untitled.png?imgmax=800" width="281" height="335" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;In this example I’m taking 2 types of engine and 2 types of set and through Ninject DI I’ll inject one of each for a car. Fore the sake of simplicity I will place the code file accordingly and describe through code comment. &lt;/p&gt;  &lt;p&gt;In my “DependencyInjection.Core” project I took 2 interfaces: 1.IEngine&amp;#160; 2.ISeat&lt;/p&gt;  &lt;p&gt;IEngine.cs is as following :&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DependencyInjection.Core
{
   &lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEngine
    &lt;/span&gt;{
       &lt;span style="color: blue"&gt;string &lt;/span&gt;EngineType(&lt;span style="color: blue"&gt;string &lt;/span&gt;carName);
    }
}&lt;/pre&gt;&lt;br /&gt;I’m also taking 2 other classes 1.DieselEngine and 2.PetrolEngine&amp;#160; . Both of the classes implements IEngine interface.&lt;br /&gt;DieselEngine.cs is as following :&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DependencyInjection.Core
{
   &lt;span style="color: blue"&gt;public  class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DieselEngine &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IEngine
    &lt;/span&gt;{
       &lt;span style="color: blue"&gt;public string &lt;/span&gt;EngineType(&lt;span style="color: blue"&gt;string &lt;/span&gt;carName)
       {
           &lt;span style="color: blue"&gt;return string&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;This {0} runs on diesel.&amp;quot;&lt;/span&gt;, carName);
       }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;PetrolEngine.cs is as following :&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DependencyInjection.Core
{
  &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PetrolEngine &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IEngine
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;EngineType(&lt;span style="color: blue"&gt;string &lt;/span&gt;carName)
        {
            &lt;span style="color: blue"&gt;return string&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;This {0} runs on petrol.&amp;quot;&lt;/span&gt;, carName);
        }
    }
}&lt;/pre&gt;&lt;br /&gt;Now start for another type of interface implementation ISeat . This part also is as above.&lt;br /&gt;ISeat.cs is as following :&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DependencyInjection.Core
{
   &lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ISeat
    &lt;/span&gt;{
       &lt;span style="color: blue"&gt;string &lt;/span&gt;SeatType(&lt;span style="color: blue"&gt;string &lt;/span&gt;carName);
    }
}&lt;/pre&gt;&lt;br /&gt;Two other classes 1.LeatherSeat and 2.PlasticSeat&amp;#160; . Both of the classes implements ISeat interface.&lt;br /&gt;LeatherSeat.cs is as follwong:&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DependencyInjection.Core
{
   &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;LeatherSeat &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;ISeat
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;#region &lt;/span&gt;ISeat Members

        &lt;span style="color: blue"&gt;public string &lt;/span&gt;SeatType(&lt;span style="color: blue"&gt;string &lt;/span&gt;carName)
        {
          &lt;span style="color: blue"&gt;return string&lt;/span&gt;.Format( &lt;span style="color: #a31515"&gt;&amp;quot;This {0}'s seats are of leather.&amp;quot;&lt;/span&gt;,carName);
        }

        &lt;span style="color: blue"&gt;#endregion       
    &lt;/span&gt;}
}&lt;/pre&gt;&lt;br /&gt;PlasticSeat.cs is as following :&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DependencyInjection.Core
{
   &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;PlasticSeat &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;ISeat
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;#region &lt;/span&gt;ISeat Members

        &lt;span style="color: blue"&gt;public string &lt;/span&gt;SeatType(&lt;span style="color: blue"&gt;string &lt;/span&gt;carName)
        {
            &lt;span style="color: blue"&gt;return string&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;This {0}'s seats are of plastic.&amp;quot;&lt;/span&gt;, carName);
        }

        &lt;span style="color: blue"&gt;#endregion
    &lt;/span&gt;}
}&lt;/pre&gt;&lt;br /&gt;In this point I’m adding reference of “Ninject.Core.dll” with my&amp;#160; “DependencyInjection.Core” project which I have downloaded from Ninject’s site. Now in my main class “Car” I’m going to inject one type of engine and another type of seat which I have mapped (DI mapping) through “IocMapper” class as bellow.&lt;br /&gt;Car.cs is as bellow :&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;Ninject.Core;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DependencyInjection.Core
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Car
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEngine &lt;/span&gt;CarEngine { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;;}
        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ISeat   &lt;/span&gt;CarSeat   { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;;}

        [&lt;span style="color: #2b91af"&gt;Inject&lt;/span&gt;]
        &lt;span style="color: blue"&gt;public &lt;/span&gt;Car(&lt;span style="color: #2b91af"&gt;IEngine &lt;/span&gt;engine , &lt;span style="color: #2b91af"&gt;ISeat &lt;/span&gt;seat)
        {
            CarEngine   = engine;
            CarSeat     = seat;
        }

        
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;GetEngineInformation(&lt;span style="color: blue"&gt;string &lt;/span&gt;carName)
        {
           &lt;span style="color: blue"&gt;return &lt;/span&gt;CarEngine.EngineType(carName);
        }


        &lt;span style="color: blue"&gt;public string &lt;/span&gt;GetSeatInformation(&lt;span style="color: blue"&gt;string &lt;/span&gt;carName)
        {
            &lt;span style="color: blue"&gt;return &lt;/span&gt;CarSeat.SeatType(carName);
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;In the above file&amp;#160; “ [&lt;span style="color: #2b91af"&gt;Inject&lt;/span&gt;] “ attribute is place above the Car constructer to make it definable to Ninject so that Ninject can inject mapped object as described in “IocMapper” class.&lt;br /&gt;I have taken another console application project named “DependencyInjection” in which I placed my “IocMapper” class. &lt;br /&gt;IocMapper.cs is as following :&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;Ninject.Core;

&lt;span style="color: blue"&gt;using &lt;/span&gt;DependencyInjection.Core;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DependencyInjection
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IocMapper &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;StandardModule
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;public override void &lt;/span&gt;Load()
        {
            Bind&amp;lt;&lt;span style="color: #2b91af"&gt;IEngine&lt;/span&gt;&amp;gt;().To&amp;lt;&lt;span style="color: #2b91af"&gt;DieselEngine&lt;/span&gt;&amp;gt;();
         
            Bind&amp;lt;&lt;span style="color: #2b91af"&gt;ISeat&lt;/span&gt;&amp;gt;().To&amp;lt;&lt;span style="color: #2b91af"&gt;LeatherSeat&lt;/span&gt;&amp;gt;();
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;br /&gt;Now in program class I defined the kernel constructer and and initialize my car object.&lt;br /&gt;Program.cs file is as bellow :&lt;br /&gt;

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Ninject.Core;
&lt;span style="color: blue"&gt;using &lt;/span&gt;DependencyInjection.Core;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;DependencyInjection
{
    &lt;span style="color: blue"&gt;class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Program
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;static void &lt;/span&gt;Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args)
        {
            &lt;span style="color: #2b91af"&gt;IKernel &lt;/span&gt;kernel = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;StandardKernel&lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IocMapper&lt;/span&gt;());

            &lt;span style="color: #2b91af"&gt;Car &lt;/span&gt;car = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Car&lt;/span&gt;(kernel.Get&amp;lt;&lt;span style="color: #2b91af"&gt;IEngine&lt;/span&gt;&amp;gt;(), kernel.Get&amp;lt;&lt;span style="color: #2b91af"&gt;ISeat&lt;/span&gt;&amp;gt;());

            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(car.GetEngineInformation(&lt;span style="color: #a31515"&gt;&amp;quot;Toyota&amp;quot;&lt;/span&gt;));
           
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.WriteLine(car.GetSeatInformation(&lt;span style="color: #a31515"&gt;&amp;quot;BMW&amp;quot;&lt;/span&gt;));
            
            &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ReadKey();

        }
    }
}&lt;/pre&gt;&lt;br /&gt;We can do more advance level of conditional binding with Ninject. Hope in near future I will throw a post on advance use of Ninject.

&lt;br /&gt;That’s all for today.&lt;br /&gt;BYE  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-1936564450630876428?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/1936564450630876428/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/12/dependency-injection-with-ninject-in.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1936564450630876428'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1936564450630876428'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/12/dependency-injection-with-ninject-in.html' title='Dependency Injection with Ninject in .NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_NL2fAc4la4o/SzJF7_bAGhI/AAAAAAAAA8c/PPYSYbtt9Z8/s72-c/Untitled.png?imgmax=800' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-2831796804285157497</id><published>2009-11-13T17:44:00.000+07:00</published><updated>2009-11-13T17:52:59.053+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='logging'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><category scheme='http://www.blogger.com/atom/ns#' term='log4net'/><title type='text'>.NET application logging with Log4net in Console , File &amp; Database</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt;  &lt;p&gt;Today I will go through logging with Log4net. Log4Net is a logging framework ( a rich library) for .NET. Log4Net is popular for its simplicity and robustness. We can write log in various way though we generally write log only in file we we can also mail log, show in console,save in datatbase as well as write in file in different ways.&lt;/p&gt;  &lt;p&gt;First we have to download the Log4Net and add the log4net.dll in our implementation project. In the example I have take 2 projects named LogWriter and LogRunner accordingly, In one project I have implemented the logging and in another I execute that logging method.&lt;/p&gt;  &lt;p&gt;My project structure is as image bellow :&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:1d4043c4-784b-44b9-b225-9393c5540345" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh6.ggpht.com/_NL2fAc4la4o/Sv05b7w5HeI/AAAAAAAAA8M/Oes0H6HT_kk/18x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/Sv05eqiuiZI/AAAAAAAAA8Q/-LoDlfekKSQ/1.png?imgmax=800" width="212" height="335" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;In the LogWriter I have take two class as bellow :&lt;/p&gt;  &lt;p&gt;LogLevel.cs: In this class I simply define a enum which basically helps to define my log level in my LogUtil class.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;LogWriter
{
    &lt;span style="color: blue"&gt;public enum &lt;/span&gt;&lt;span style="color: #2b91af"&gt;LogLevel
    &lt;/span&gt;{ 
        DEBUG,
        ERROR,
        FATAL,
        INFO,
        WARN    
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;LogUtil.cs: In this class I have a static method named WriteLog which take 2 parameters one define log level and another take log message as string.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;log4net;
&lt;span style="color: blue"&gt;using &lt;/span&gt;log4net.Config;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;LogWriter
{
    &lt;span style="color: blue"&gt;public static class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;LogUtil
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;private static &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ILog &lt;/span&gt;logger = &lt;span style="color: #2b91af"&gt;LogManager&lt;/span&gt;.GetLogger(&lt;span style="color: blue"&gt;typeof&lt;/span&gt;(&lt;span style="color: #2b91af"&gt;LogUtil&lt;/span&gt;));

        &lt;span style="color: blue"&gt;static &lt;/span&gt;LogUtil()
        {
            &lt;span style="color: #2b91af"&gt;XmlConfigurator&lt;/span&gt;.Configure();
        }

        &lt;span style="color: blue"&gt;public static void &lt;/span&gt;WriteLog(&lt;span style="color: #2b91af"&gt;LogLevel &lt;/span&gt;logLevel,&lt;span style="color: blue"&gt;string &lt;/span&gt;log)
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(logLevel.Equals(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.DEBUG))
            {
                logger.Debug(log);
            }
            &lt;span style="color: blue"&gt;else if &lt;/span&gt;(logLevel.Equals(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.ERROR))
            {
                logger.Error(log);
            } 
            &lt;span style="color: blue"&gt;else if &lt;/span&gt;(logLevel.Equals(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.FATAL))
            {
                logger.Fatal(log);
            } 
            &lt;span style="color: blue"&gt;else if &lt;/span&gt;(logLevel.Equals(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.INFO))
            {
                logger.Info(log);
            } 
            &lt;span style="color: blue"&gt;else if &lt;/span&gt;(logLevel.Equals(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.WARN))
            {
                logger.Warn(log);
            }             
        
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;As I am writing a&amp;#160; console application so my mail runner file is Program.cs which is as bellow but you can follow the same procedure in different place as per you requirement.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;LogWriter;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;LogRunner
{
    &lt;span style="color: blue"&gt;class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Program
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;static void &lt;/span&gt;Main(&lt;span style="color: blue"&gt;string&lt;/span&gt;[] args)
        {
            &lt;span style="color: blue"&gt;try &lt;/span&gt;{
                &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Exception&lt;/span&gt;();
            }

            &lt;span style="color: blue"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Exception &lt;/span&gt;exc)
            {
                    &lt;span style="color: #2b91af"&gt;LogUtil&lt;/span&gt;.WriteLog(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.DEBUG, &lt;span style="color: #a31515"&gt;&amp;quot;Debug mode logging&amp;quot;&lt;/span&gt;);
                    &lt;span style="color: #2b91af"&gt;LogUtil&lt;/span&gt;.WriteLog(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.ERROR, &lt;span style="color: #a31515"&gt;&amp;quot;Error mode logging&amp;quot;&lt;/span&gt;);
                    &lt;span style="color: #2b91af"&gt;LogUtil&lt;/span&gt;.WriteLog(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.FATAL, &lt;span style="color: #a31515"&gt;&amp;quot;Fatal mode logging&amp;quot;&lt;/span&gt;);
                    &lt;span style="color: #2b91af"&gt;LogUtil&lt;/span&gt;.WriteLog(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.INFO, &lt;span style="color: #a31515"&gt;&amp;quot;Info mode logging&amp;quot;&lt;/span&gt;);
                    &lt;span style="color: #2b91af"&gt;LogUtil&lt;/span&gt;.WriteLog(&lt;span style="color: #2b91af"&gt;LogLevel&lt;/span&gt;.WARN, &lt;span style="color: #a31515"&gt;&amp;quot;Warn mode logging&amp;quot;&lt;/span&gt;);
    
                    &lt;span style="color: #2b91af"&gt;Console&lt;/span&gt;.ReadKey();
            }
        }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;Now one of the most important thing I will focus is log4net configuration. We can configure it from web.config or app.config . In my example I have configured it app.config file in my LogRunner project. In the app.config file follow the commented section. &lt;/p&gt;My configuration file is as bellow , please go through the commented line to get know in detail such as&lt;em&gt;&lt;strong&gt; log file rolling, max log file number &amp;amp; size, Log level&lt;/strong&gt;&lt;/em&gt; etc.&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;?&lt;/span&gt;&lt;span style="color: #a31515"&gt;xml &lt;/span&gt;&lt;span style="color: red"&gt;version&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;1.0&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;encoding&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;utf-8&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;?&amp;gt;

&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;configuration&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;configSections&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;section &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Config.Log4NetConfigurationSectionHandler, log4net&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;configSections&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;


    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;log4net&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;appender &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;LogFileAppender&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Appender.RollingFileAppender&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;

            &amp;lt;!-- &lt;/span&gt;&lt;span style="color: green"&gt;Log file locaation &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
            &lt;/span&gt;&lt;span style="color: blue"&gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;File&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;C:\Users\sanzeeb\Documents\Visual Studio 2008\Projects\Solution1\LogWriter\Log\&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;AppendToFile&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;true&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;!-- &lt;/span&gt;&lt;span style="color: green"&gt;Maximum size of a log file &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;maximumFileSize &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2KB&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt;Maximum number of log file &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;maxSizeRollBackups &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;8&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt;Set rolling style of log file &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;RollingStyle&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Composite&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;StaticLogFileName&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;false&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DatePattern&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;.yyyy-MM-dd.lo\g&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Layout.PatternLayout&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;

                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ConversionPattern&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;%d [%t] %-5p  %m%n&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;appender&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;!-- &lt;/span&gt;&lt;span style="color: green"&gt;Appender layout fix to view in console&lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;appender &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ConsoleAppender&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Appender.ConsoleAppender&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;&amp;gt;

            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Layout.PatternLayout&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;

                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Header&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;[Header]\r\n&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Footer&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;[Footer]\r\n&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;param &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ConversionPattern&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;%d [%t] %-5p  %m%n&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;appender&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

      &lt;/span&gt;&lt;span style="color: blue"&gt;
        &amp;lt;!-- &lt;/span&gt;&lt;span style="color: green"&gt;Database appender &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;

        &amp;lt;!--
        &lt;/span&gt;&lt;span style="color: green"&gt;You need to create a table as bellow to insert log in database for MSSQL server.
        
        CREATE TABLE [dbo].[Log] (
        [Id] [int] IDENTITY (1, 1) NOT NULL,
        [Date] [datetime] NOT NULL,
        [Thread] [varchar] (255) NOT NULL,
        [Level] [varchar] (50) NOT NULL,
        [Logger] [varchar] (255) NOT NULL,
        [Message] [varchar] (4000) NOT NULL,
        [Exception] [varchar] (2000) NULL
        )
        &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;appender &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;AdoNetAppender&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Appender.AdoNetAppender&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;bufferSize &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;100&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;connectionType &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;connectionString &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;Data Source=SANZEEB-PC\SQLEXPRESS;Initial Catalog=AppTesterDB;Integrated Security=True&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;commandText &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;INSERT INTO Log ([Date],[Thread],[Level],[Logger],[Message],[Exception]) VALUES (@log_date, @thread, @log_level, @logger, @message, @exception)&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameterName &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;@log_date&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dbType &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DateTime&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Layout.RawTimeStampLayout&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameterName &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;@thread&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dbType &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;String&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;size &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;255&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Layout.PatternLayout&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;conversionPattern &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;%thread&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameterName &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;@log_level&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dbType &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;String&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;size &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;50&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Layout.PatternLayout&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;conversionPattern &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;%level&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameterName &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;@logger&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dbType &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;String&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;size &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;255&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Layout.PatternLayout&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;conversionPattern &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;%logger&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameterName &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;@message&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dbType &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;String&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;size &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;4000&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Layout.PatternLayout&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;conversionPattern &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;%message&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameterName &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;@exception&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dbType &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;String&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;size &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;2000&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;layout &lt;/span&gt;&lt;span style="color: red"&gt;type&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;log4net.Layout.ExceptionLayout&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;parameter&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;appender&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;root&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;level &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;DEBUG&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;!--
            &lt;/span&gt;&lt;span style="color: green"&gt;Log level priority in descending order:
            
            FATAL = 1 show  log -&amp;gt; FATAL 
            ERROR = 2 show  log -&amp;gt; FATAL ERROR 
            WARN =  3 show  log -&amp;gt; FATAL ERROR WARN 
            INFO =  4 show  log -&amp;gt; FATAL ERROR WARN INFO 
            DEBUG = 5 show  log -&amp;gt; FATAL ERROR WARN INFO DEBUG
            &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;

            &amp;lt;!—&lt;/span&gt;&lt;span style="color: green"&gt;To write log in file &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;appender-ref &lt;/span&gt;&lt;span style="color: red"&gt;ref&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;LogFileAppender&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

            &amp;lt;!--&lt;/span&gt;&lt;span style="color: green"&gt;To view log in console &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;appender-ref &lt;/span&gt;&lt;span style="color: red"&gt;ref&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;ConsoleAppender&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;
            &lt;/span&gt;&lt;span style="color: blue"&gt;
            &amp;lt;!--&lt;span style="color: green"&gt;To write log in file batabase&lt;/span&gt;&lt;/span&gt;&lt;span style="color: green"&gt; &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;appender-ref &lt;/span&gt;&lt;span style="color: red"&gt;ref&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;AdoNetAppender&lt;/span&gt;&amp;quot; &lt;span style="color: blue"&gt;/&amp;gt;

        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;root&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;log4net&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;

&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;configuration&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;Hope this will help to improve your logging in your .NET application. &lt;/p&gt;Thanks&lt;p&gt;That’s all for today.&lt;/p&gt;BYE  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-2831796804285157497?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/2831796804285157497/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/11/net-application-logging-with-log4net-in.html#comment-form' title='5 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/2831796804285157497'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/2831796804285157497'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/11/net-application-logging-with-log4net-in.html' title='.NET application logging with Log4net in Console , File &amp;amp; Database'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_NL2fAc4la4o/Sv05eqiuiZI/AAAAAAAAA8Q/-LoDlfekKSQ/s72-c/1.png?imgmax=800' height='72' width='72'/><thr:total>5</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-1063888358556894452</id><published>2009-08-21T22:12:00.000+07:00</published><updated>2009-08-21T22:17:12.437+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='UML'/><title type='text'>ULM Class Diagram</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt;  &lt;p&gt;Today I will go through with UML class diagram. It’s like old wine in old bottle ;) . We all know that these are very basic but now a days people just stat to do coding without making any class or activity diagram, so eventually they fall in a design related issue if the system becomes huge.&lt;/p&gt;  &lt;p&gt;Again UML is more impotent to understand any complex system which is properly documented in UML diagram.UML makes our life simple through notifying us the design fault.&lt;/p&gt;  &lt;p&gt;So let’s start the old song again.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Class:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt; Generally there are 3 components in the class icon as following.&lt;/p&gt;  &lt;p&gt;1. Class Name&lt;/p&gt;  &lt;p&gt;2. Attributes &lt;/p&gt;  &lt;p&gt;3. Functions / Methods &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:440de38b-4089-45a2-9c93-a75242684f93" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh6.ggpht.com/_NL2fAc4la4o/So66E2pc0PI/AAAAAAAAA7U/l9XhHAx52co/class-8x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/So66HHyYZXI/AAAAAAAAA7Y/O39FxFwHVuw/class%5B19%5D.png?imgmax=800" width="250" height="179" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;strong&gt;Visibility:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Visibility of class diagram represents the accessibility of the class members. Visibility notations are as bellow .&lt;/p&gt;  &lt;p&gt;   &lt;table border="1" cellspacing="0" cellpadding="0" width="232"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="91"&gt;           &lt;p&gt;&lt;strong&gt;Notations &lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="139"&gt;           &lt;p&gt;&lt;strong&gt;Access type&lt;/strong&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="91"&gt;           &lt;p&gt;-&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="139"&gt;           &lt;p&gt;Private&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="91"&gt;           &lt;p&gt;+&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="139"&gt;           &lt;p&gt;Public&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="91"&gt;           &lt;p&gt;~&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="139"&gt;           &lt;p&gt;Protected&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Association:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When two objects are connected with each other then it can be represent as association. For students and seminar we can use association notation where students are attending in seminar.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:ca011a9e-02dd-406c-baa1-74ad0ba2e73c" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh6.ggpht.com/_NL2fAc4la4o/So66I8YsTAI/AAAAAAAAA7c/Ifc5RPG3gLg/associasion-8x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/So66LFlf9wI/AAAAAAAAA7g/ZQZJFWNUkWo/associasion.png?imgmax=800" width="335" height="143" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;a name="Table1MultiplicityIndicators"&gt;&lt;strong&gt;Multiplicity Indicators&lt;/strong&gt;&lt;/a&gt;&lt;strong&gt;:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Multiplicity indicates the countable objects relation with other objects.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:3a6776d0-cb05-4194-892b-60674ecba95d" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh3.ggpht.com/_NL2fAc4la4o/So66MzGFkHI/AAAAAAAAA7k/Tjsh9mc2OqI/associasion%20mul-8x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/So66O8Qe7eI/AAAAAAAAA7o/33svI-vYtuw/associasion%20mul.png?imgmax=800" width="335" height="143" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;   &lt;table border="0" cellspacing="0" cellpadding="0"&gt;&lt;tbody&gt;       &lt;tr&gt;         &lt;td valign="top" width="85"&gt;           &lt;p&gt;&lt;b&gt;Indicator&lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="168"&gt;           &lt;p&gt;&lt;b&gt;Meaning&lt;/b&gt;&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="85"&gt;           &lt;p&gt;0..1&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="168"&gt;           &lt;p&gt;Zero or one&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="85"&gt;           &lt;p&gt;1&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="168"&gt;           &lt;p&gt;One only&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="85"&gt;           &lt;p&gt;0..*&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="168"&gt;           &lt;p&gt;Zero or more&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="85"&gt;           &lt;p&gt;1..*&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="168"&gt;           &lt;p&gt;One or more&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="85"&gt;           &lt;p&gt;n&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="168"&gt;           &lt;p&gt;Only &lt;i&gt;n&lt;/i&gt; (where &lt;i&gt;n&lt;/i&gt; &amp;gt; 1)&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="85"&gt;           &lt;p&gt;0..n&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="168"&gt;           &lt;p&gt;Zero to &lt;i&gt;n&lt;/i&gt; (where &lt;i&gt;n&lt;/i&gt; &amp;gt; 1)&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;        &lt;tr&gt;         &lt;td valign="top" width="85"&gt;           &lt;p&gt;1..n&lt;/p&gt;         &lt;/td&gt;          &lt;td valign="top" width="168"&gt;           &lt;p&gt;One to &lt;i&gt;n&lt;/i&gt; (where &lt;i&gt;n &lt;/i&gt;&amp;gt; 1)&lt;/p&gt;         &lt;/td&gt;       &lt;/tr&gt;     &lt;/tbody&gt;&lt;/table&gt; &lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Composition:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;Composition represents with a black diamond. It represents that a component strongly depends on another component. Suppose we have two objects one is circle and another is point. In that case a circle consists of many points. &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:2f3658f5-859b-417e-bef5-043d120da916" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh4.ggpht.com/_NL2fAc4la4o/So66Q1aCjJI/AAAAAAAAA7s/-qMa-nXNGxw/comp-8x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/So66Tb8yBfI/AAAAAAAAA7w/LrwzNWeoSS0/comp.png?imgmax=800" width="335" height="146" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;strong&gt;Aggregation:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When an object form with another object(s) but not mandatory to form the main object then its denoted by a diamond. Suppose student and school object can represent with aggregation relationship.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:dcb31695-87d9-4962-8552-17d53fb11027" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh4.ggpht.com/_NL2fAc4la4o/So66VJrFVDI/AAAAAAAAA70/ZFlNzmMRqWI/agree-8x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/So66XYYfIyI/AAAAAAAAA74/YvRIMwmbxhY/agree.png?imgmax=800" width="335" height="145" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;strong&gt;Inheritance:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;When one object inherits property from any parent object then the sign denoted with a triangle shape arrow. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:6c6c9f09-8b8d-467a-8f68-5cbaf19fa270" class="wlWriterEditableSmartContent"&gt;&lt;a href="http://lh3.ggpht.com/_NL2fAc4la4o/So66Zj-i7KI/AAAAAAAAA78/QZWausNpG8A/inher-8x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/So66c2IWsQI/AAAAAAAAA8A/pqTdJwWWmsY/inher.png?imgmax=800" width="335" height="290" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;Thanks &lt;/p&gt;  &lt;p&gt;That's all for the day.    &lt;br /&gt;BYE&lt;/p&gt;  &lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-1063888358556894452?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/1063888358556894452/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/08/ulm-class-diagram.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1063888358556894452'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1063888358556894452'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/08/ulm-class-diagram.html' title='ULM Class Diagram'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/_NL2fAc4la4o/So66HHyYZXI/AAAAAAAAA7Y/O39FxFwHVuw/s72-c/class%5B19%5D.png?imgmax=800' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-7908050282111392197</id><published>2009-07-25T12:55:00.000+07:00</published><updated>2009-07-25T13:09:34.814+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Scrum'/><category scheme='http://www.blogger.com/atom/ns#' term='Agile'/><title type='text'>Agile Scrum and traditional software development ( SDLC ) terms.</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt;  &lt;p&gt;Few days back our boss focused on how to map the traditional software development term with Agile development term as a result I think it will be a good topic to discus and share our thoughts. We Agile practitioner always use some terms such as sprint, product backlog, burn-down chart etc. But people who are not used to Agile can hardly understand these terms where as these things are similar as traditional SDLC terms. &lt;/p&gt;  &lt;p&gt;Today I will try to focus some of this Agile terms and try to make a equivalent SDLC terms, so that people can adopt the Agile practice easily.&lt;/p&gt;  &lt;p&gt;In this post I will follow Scrum framework for the Agile development. There are some other Agile framework such as AUP,XP,FDD etc.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Agile Development Process:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;In the following picture (it&amp;#8217;s an Agile development process) we can see some agile terms such as Product backlog, Sprint Backlog, sprint and there are also some other terms like product owner, scrum master, daily scrum meeting, velocity, retrospective etc.&lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:e24c9816-5565-462d-a1c5-5fc98dc4f14b" class="wlWriterSmartContent"&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/SmqebYzd1oI/AAAAAAAAA5Y/UAnUyd-QlQs/400px-Scrum_process.svg-8x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/Smqed8ZI4hI/AAAAAAAAA5c/9Bf5hTIZU9g/400px-Scrum_process.svg.png?imgmax=800" width="335" height="197" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;strong&gt;Roles:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Product Owner:&lt;/strong&gt; Product owner is the client. According to their order the software will develop and they will clarify the requirement for the developers so that developers can develop the exact efficient software for the customer.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Scrum Master:&lt;/strong&gt; Scrum master plays a similar type of role as project manager. But as the Agile team is self organized so scrum master doesn&amp;#8217;t involve deeply in a project as traditional project manager. Scrum master takes initiative on the impediments and managing the process working perfectly so that the goal meets in the desired time frame (sprint).&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Teams:&lt;/strong&gt; In general a team means group of self organized developers who will develop the software.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Projects Terms:&lt;/strong&gt;&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Product backlog:&lt;/strong&gt; Product backlog is the collection of requirements of a system. This requirements are placed according to the development priority, so that the high priority requirements are develop in the early phases.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Sprint:&lt;/strong&gt; Sprint is like the time frame of an incremental development process. In a sprint the team fixes what to do in this cycle and deployment. Developers develop a deliverable product in a sprint and deploy it in client end. Once the tasks are fixed for a sprint the developer should not be interrupt with additional requirement and mass requirement change. If it&amp;#8217;s necessary, the tasks will add in product backlog with high priority so that they can add in next sprint&amp;#8217;s planning.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Sprint backlog:&lt;/strong&gt; Sprint backlog is the set of high priority tasks taken from the set of product backlog which will develop in the current sprint and deploy in client end.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Scrum meeting:&lt;/strong&gt; Scrum meeting is a daily short standing meeting where each team member will express what problem(s) s/he has faced last day and what s/he will do today. This meeting is extremely focused.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Retrospective:&lt;/strong&gt; At the last day the team will discussed what went good what went band and what are the opportunity so that in the next sprint they can take initiative according to the retrospective.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;Burndown chart:&lt;/strong&gt; There are different types of burndown charts. Which represents the development process through graph, so that an Agile team member can get to know what project&amp;#8217;s condition in a simple view. &lt;/p&gt;  &lt;div style="padding-bottom: 0px; margin: 0px; padding-left: 0px; padding-right: 0px; display: inline; float: none; padding-top: 0px" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:1de0aa44-9119-4c42-8ad6-e134caf76491" class="wlWriterSmartContent"&gt;&lt;a href="http://lh6.ggpht.com/_NL2fAc4la4o/SmqegR-qENI/AAAAAAAAA5g/8fjt77JyHOA/sprint_burndown_chart-8x6.png?imgmax=800" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/SmqeiUQOJiI/AAAAAAAAA5k/VWGOW7EUDbQ/sprint_burndown_chart%5B1%5D.png?imgmax=800" width="420" height="173" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;strong&gt;Velocity:&lt;/strong&gt; An agile team can estimate how much effort they can put in product backlog for one sprint. This velocity is determined from previous sprint&amp;#8217;s average data. This velocity can be used to predict the project effort planning and team's productivity .&lt;/p&gt; Thanks  &lt;p&gt;That's all for the day.    &lt;br /&gt;BYE&lt;/p&gt;  &lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-7908050282111392197?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/7908050282111392197/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/07/agile-scrum-and-traditional-software.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/7908050282111392197'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/7908050282111392197'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/07/agile-scrum-and-traditional-software.html' title='Agile Scrum and traditional software development ( SDLC ) terms.'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_NL2fAc4la4o/Smqed8ZI4hI/AAAAAAAAA5c/9Bf5hTIZU9g/s72-c/400px-Scrum_process.svg.png?imgmax=800' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-7107280151462163859</id><published>2009-06-13T01:26:00.000+06:00</published><updated>2009-06-13T01:34:54.768+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Event'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>LinkButton ,Label inside Repeater - ASP.NET</title><content type='html'>&lt;p&gt;Hello All &lt;/p&gt;  &lt;p&gt;Today I will show you how to fire&amp;#160; Link Button's event with argument and initialize a label inside of a repeater. To do that first we have to take &lt;strong&gt;LinkButton&lt;/strong&gt; and a &lt;strong&gt;Label&lt;/strong&gt; control inside the &lt;strong&gt;ItemTemplate&lt;/strong&gt; of the repeater. Then we have to initialize the the Label from &lt;strong&gt;OnItemDataBound&lt;/strong&gt; event of the repeater. In the following code blocks its shown how to perform the job.&lt;/p&gt;  &lt;p&gt;Following is my Default.aspx file:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@ &lt;/span&gt;&lt;span style="color: #a31515"&gt;Page &lt;/span&gt;&lt;span style="color: red"&gt;Language&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;C#&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CodeBehind&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Default.aspx.cs&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Inherits&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TestProject._Default&amp;quot; &lt;/span&gt;&lt;span style="background: #ffee62"&gt;%&amp;gt;

&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="color: #a31515"&gt;DOCTYPE &lt;/span&gt;&lt;span style="color: red"&gt;html PUBLIC &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;html &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;head &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;head&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;form &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;form1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &lt;/span&gt;Selected ID:&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Label &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lblSelectedID&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;br &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Repeater &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptContent&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;OnItemDataBound&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;rptContent_ItemDataBound&amp;quot;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Label &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lblName&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinkButton &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lnkShowData&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;OnCommand&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;LinkButton_Command&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CommandArgument&lt;/span&gt;&lt;span style="color: blue"&gt;='&lt;/span&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;# Eval(&amp;quot;key&amp;quot;) &lt;span style="background: #ffee62"&gt;%&amp;gt;&lt;/span&gt;&lt;span style="color: blue"&gt;'
                    &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;[Show]&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CommandName&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Show&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;LinkButton&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;br &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;ItemTemplate&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Repeater&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;form&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;html&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&lt;/span&gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;In the above code I have bind the &amp;quot;key&amp;quot; as CommandArgument in LinkButton which will be initialize form the code behind file.&lt;/p&gt;&lt;p&gt;My code behind is as following:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.UI;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.UI.WebControls;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;TestProject
{
    &lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;_Default &lt;/span&gt;: System.Web.UI.&lt;span style="color: #2b91af"&gt;Page
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;Page_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
            rptContent.DataSource = &lt;span style="color: blue"&gt;this&lt;/span&gt;.userInformation();
            rptContent.DataBind();
        }

       &lt;span style="color: green"&gt;// Fire the link button event from inside repeater.
       &lt;/span&gt;&lt;span style="color: blue"&gt;protected void &lt;/span&gt;LinkButton_Command(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;CommandEventArgs &lt;/span&gt;e)
        {
           lblSelectedID.Text = e.CommandArgument.ToString();
        }

        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;rptContent_ItemDataBound(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;RepeaterItemEventArgs &lt;/span&gt;e)
        {
            &lt;span style="color: green"&gt;// find the label control by id
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Label &lt;/span&gt;lblDynaLabel = (&lt;span style="color: #2b91af"&gt;Label&lt;/span&gt;)(e.Item.FindControl(&lt;span style="color: #a31515"&gt;&amp;quot;lblName&amp;quot;&lt;/span&gt;));


            &lt;span style="color: green"&gt;// bind the data from repeater data source (value from the dictionary)with the label control.
            &lt;/span&gt;lblDynaLabel.Text = &lt;span style="color: #2b91af"&gt;DataBinder&lt;/span&gt;.Eval(e.Item.DataItem,&lt;span style="color: #a31515"&gt;&amp;quot;value&amp;quot;&lt;/span&gt;).ToString();
        }

        &lt;span style="color: blue"&gt;#region &lt;/span&gt;Private method

        &lt;span style="color: blue"&gt;private &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;int&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; userInformation()
        {
            &lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;int&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; userData = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Dictionary&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;int&lt;/span&gt;, &lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;();

            userData.Add(1, &lt;span style="color: #a31515"&gt;&amp;quot;Max&amp;quot;&lt;/span&gt;);
            userData.Add(2, &lt;span style="color: #a31515"&gt;&amp;quot;Top&amp;quot;&lt;/span&gt;);
            userData.Add(3, &lt;span style="color: #a31515"&gt;&amp;quot;Avg&amp;quot;&lt;/span&gt;);

            &lt;span style="color: blue"&gt;return &lt;/span&gt;userData;
        }
        &lt;span style="color: blue"&gt;#endregion
    &lt;/span&gt;}
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;The output will be as bellow:&lt;/p&gt;&lt;p&gt;Selected ID:1&lt;br /&gt;Max &lt;a href="http://localhost:53933/"&gt;[Show]&lt;/a&gt;&lt;br /&gt;Top &lt;a href="http://localhost:53933/"&gt;[Show]&lt;/a&gt;&lt;br /&gt;Avg &lt;a href="http://localhost:53933/"&gt;[Show]&lt;/a&gt;&lt;/p&gt;&lt;p&gt;In the private method section I have created a simple mathod named &lt;strong&gt;userInformation,&lt;/strong&gt; which contains dictionary data collection to bind it with repeater.Hope that above code blocks will help.&lt;/p&gt;&lt;p&gt;Thanks &lt;/p&gt;&lt;p&gt;That's all for the day. 
&lt;br /&gt;BYE&lt;/p&gt;&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-7107280151462163859?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/7107280151462163859/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/06/linkbutton-label-inside-repeater-aspnet.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/7107280151462163859'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/7107280151462163859'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/06/linkbutton-label-inside-repeater-aspnet.html' title='LinkButton ,Label inside Repeater - ASP.NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-400069710197855961</id><published>2009-05-28T14:43:00.000+06:00</published><updated>2009-05-28T14:45:45.612+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Print C# properties in aspx,ascx page from code behind file.</title><content type='html'>Hello all   &lt;p&gt;Today I will show you how to print something in aspx or ascx page from code behind file.In this example I have taken a “Web User Control” named “WebUserControl.ascx”. What I wanted to do was, print a value of a variable in “.ascx” page where the variable has been initialize from “.ascx.cs” better to say code behind file.&lt;/p&gt;  &lt;p&gt;To do that we have taken a property in “WebUserControl.ascx.cs” code behind file named “PrintValue” and make it a &lt;strong&gt;&lt;em&gt;&lt;u&gt;public&lt;/u&gt;&lt;/em&gt; &lt;/strong&gt;property and assign a string value on PageLoad event as bellow :&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;

&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WebUserControl &lt;/span&gt;: System.Web.UI.&lt;span style="color: #2b91af"&gt;UserControl
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;public string &lt;/span&gt;PrintValue { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }
    
    &lt;span style="color: blue"&gt;protected void &lt;/span&gt;Page_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
    {
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(IsPostBack)
            PrintValue = &lt;span style="color: #a31515"&gt;&amp;quot;Postback&amp;quot;&lt;/span&gt;;
        &lt;span style="color: blue"&gt;else
            &lt;/span&gt;PrintValue = &lt;span style="color: #a31515"&gt;&amp;quot;Not postback&amp;quot;&lt;/span&gt;;
    }
}&lt;/pre&gt;&lt;br /&gt;Now I have printed the value of the property in my “WebUserControl.ascx” page as bellow.One thing we have to remember that the script tag should be like : &amp;lt;%= %&amp;gt; to print something in it.&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@ &lt;/span&gt;&lt;span style="color: #a31515"&gt;Control &lt;/span&gt;&lt;span style="color: red"&gt;Language&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;C#&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CodeFile&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;WebUserControl.ascx.cs&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Inherits&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;WebUserControl&amp;quot; &lt;/span&gt;&lt;span style="background: #ffee62"&gt;%&amp;gt;

&lt;/span&gt;The page has - &lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;= &lt;/span&gt;PrintValue &lt;span style="background: #ffee62"&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;br /&gt;Now we can use the control in our page to show the state of the page.&lt;br /&gt;Thats all for today.&lt;br /&gt;Bye&lt;br /&gt;&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-400069710197855961?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/400069710197855961/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/05/print-c-properties-in-aspxascx-page.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/400069710197855961'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/400069710197855961'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/05/print-c-properties-in-aspxascx-page.html' title='Print C# properties in aspx,ascx page from code behind file.'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-1600032027536270089</id><published>2009-05-04T12:28:00.000+06:00</published><updated>2009-05-04T12:29:05.377+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='file streaming'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>File streaming in .NET</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt;  &lt;p&gt;Today i will focus on simple file steaming in .NET which I have to implement it in one of my project.Though it’s not optimize but its OK for serve small purpose.&lt;/p&gt;  &lt;p&gt;In the project I have to read a PDF file from the server and with FileStream and Flash it with Response to the client side.&lt;/p&gt;  &lt;p&gt;the code is as bellow.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;private void &lt;/span&gt;generateRequestedPDF()
{
    &lt;span style="color: blue"&gt;try
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;string &lt;/span&gt;file = &lt;span style="color: #2b91af"&gt;Path&lt;/span&gt;.GetFileName(Request.QueryString[&lt;span style="color: #a31515"&gt;&amp;quot;RefID&amp;quot;&lt;/span&gt;]);&lt;span style="color: green"&gt;// get file name from query string.use your custom method.&amp;quot; &lt;/span&gt;

        &lt;span style="color: #2b91af"&gt;FileStream &lt;/span&gt;fileStream = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;FileStream&lt;/span&gt;(Server.MapPath(&lt;span style="color: #a31515"&gt;@&amp;quot;~\uploadedFiles\&amp;quot; &lt;/span&gt;+ file), &lt;span style="color: #2b91af"&gt;FileMode&lt;/span&gt;.Open);
        &lt;span style="color: blue"&gt;long &lt;/span&gt;fileSize = fileStream.Length;

        &lt;span style="color: blue"&gt;byte&lt;/span&gt;[] buffer = &lt;span style="color: blue"&gt;new byte&lt;/span&gt;[(&lt;span style="color: blue"&gt;int&lt;/span&gt;)fileSize];
        fileStream.Read(buffer, 0, (&lt;span style="color: blue"&gt;int&lt;/span&gt;)fileSize);
        fileStream.Close();

        Response.Clear();

        Response.ContentType = &lt;span style="color: #a31515"&gt;&amp;quot;Application/pdf&amp;quot;&lt;/span&gt;;&lt;span style="color: green"&gt;// use your custom type&amp;quot;
        &lt;/span&gt;Response.AddHeader(&lt;span style="color: #a31515"&gt;&amp;quot;Content-Disposition&amp;quot;&lt;/span&gt;, &lt;span style="color: #a31515"&gt;&amp;quot;inline; filename=&amp;quot; &lt;/span&gt;+ file);

        Response.OutputStream.Write(buffer, 0, (&lt;span style="color: blue"&gt;int&lt;/span&gt;)fileSize);
        Response.Flush();
        Response.Close();
    }
    &lt;span style="color: blue"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Exception &lt;/span&gt;exc)
    {
    &lt;span style="color: green"&gt;//  throw exc;
        &lt;/span&gt;&lt;span style="color: blue"&gt;this&lt;/span&gt;.writeLogWarn(exc);
        Response.Redirect(&lt;span style="color: #a31515"&gt;&amp;quot;~/Pages/Content/TechCorner.aspx&amp;quot;&lt;/span&gt;);
    }
   
}&lt;/pre&gt;thats all for today.&lt;br /&gt;BYE &lt;/p&gt;&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-1600032027536270089?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/1600032027536270089/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/05/file-streaming-in-net.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1600032027536270089'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1600032027536270089'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/05/file-streaming-in-net.html' title='File streaming in .NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-4821159380450985426</id><published>2009-04-11T19:06:00.000+06:00</published><updated>2009-04-11T19:09:00.329+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='WebService'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>Consume WCF Service</title><content type='html'>&lt;p&gt;Hello all&lt;/p&gt;  &lt;p&gt;Today I will show how to consume a WCF service. To go through this before, I have created a WCF service [ &lt;a href="http://tanvirdotnet.blogspot.com/2009/03/creating-wcf-service.html" target="_blank"&gt;Creating WCF Service&lt;/a&gt; ] , which I will consume for my project in this article. Consuming WCF Service is as simple as consuming a simple webservice through Visual Studio 2008.&lt;/p&gt;  &lt;p&gt;First I am taking an empty Web project named ConsumedWCF. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:19dc729e-d6c4-419f-b235-9d717d1dafef" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/_NL2fAc4la4o/SeCV_m15HPI/AAAAAAAAANM/54zgT7JCeWg/18x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/SeCWB_9aQVI/AAAAAAAAANQ/avdoYdxxMIM/1.png" width="335" height="254" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Now I will add a service reference which I have created before [ &lt;a href="http://tanvirdotnet.blogspot.com/2009/03/creating-wcf-service.html" target="_blank"&gt;Creating WCF Service&lt;/a&gt; ] in this ConsumedWCF project as bellow:&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:c60f3a51-285c-4cd1-b5d2-e8741a66117e" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/SeCWDnla9pI/AAAAAAAAANU/42wT7NRCcHQ/28x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh5.ggpht.com/_NL2fAc4la4o/SeCWG7PZouI/AAAAAAAAANY/aOvyeXK56bg/2.png" width="214" height="335" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;In my previously created WCF service I have got a URL for my service &amp;quot;http://localhost:49530/DataService.svc?wsdl&amp;quot;, I have pasted the URL in the Address box. One thing we should have to remember that,to consume the service we have to run that service during development. &lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:1e346a67-d90c-4c35-8f50-f26c7f20eadc" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh5.ggpht.com/_NL2fAc4la4o/SeCWI3G9PNI/AAAAAAAAANc/IWaeCG2eOcc/38x61.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/SeCWLEU7mVI/AAAAAAAAANg/GXaLRMw0dRA/31.png" width="335" height="280" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;Now I will consume the service from my Default.aspx&amp;#160; . My Default.aspx.cs content is as bellow:&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;ConsumeWCF.ServiceReference1;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;ConsumeWCF
{
    &lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;_Default &lt;/span&gt;: System.Web.UI.&lt;span style="color: #2b91af"&gt;Page
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;protected void &lt;/span&gt;Page_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
        {
           &lt;span style="color: #2b91af"&gt;DataServiceClient &lt;/span&gt;cl = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataServiceClient&lt;/span&gt;();
           Response.Write( cl.GetUserDataFromService().UserName);
           Response.Write(&lt;span style="color: #a31515"&gt;&amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;/span&gt;);
           Response.Write(cl.GetUserDataFromService().UserLocation);
           Response.Write(&lt;span style="color: #a31515"&gt;&amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;/span&gt;);
           Response.Write(  cl.GetUserRestrictionFromService(&lt;span style="color: #a31515"&gt;&amp;quot;1&amp;quot;&lt;/span&gt;));
           Response.Write(&lt;span style="color: #a31515"&gt;&amp;quot;&amp;lt;br /&amp;gt;&amp;quot;&lt;/span&gt;);
           Response.Write(cl.GetUserRestrictionFromService(&lt;span style="color: #a31515"&gt;&amp;quot;23&amp;quot;&lt;/span&gt;));
           
        }
    }
}&lt;/pre&gt;&lt;p&gt;The above code will print the values which we have consumed form the WCF service.&lt;/p&gt;&lt;p&gt;Thanks &lt;/p&gt;&lt;p&gt;That's all for the day. 
  &lt;br /&gt;BYE&lt;/p&gt;&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-4821159380450985426?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/4821159380450985426/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/04/consume-wcf-service.html#comment-form' title='3 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/4821159380450985426'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/4821159380450985426'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/04/consume-wcf-service.html' title='Consume WCF Service'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/_NL2fAc4la4o/SeCWB_9aQVI/AAAAAAAAANQ/avdoYdxxMIM/s72-c/1.png' height='72' width='72'/><thr:total>3</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-7862239993439434128</id><published>2009-03-31T16:21:00.000+06:00</published><updated>2009-04-10T17:04:38.250+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='WebService'/><category scheme='http://www.blogger.com/atom/ns#' term='WCF'/><title type='text'>Creating WCF Service</title><content type='html'>&lt;p&gt;Hello all&lt;/p&gt;  &lt;p&gt;Today I will try to demonstrate how to create simple web service through WCF. To get into WCF first we have to know some basic principal of WCF and its &amp;quot;ABC&amp;quot;.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;A&lt;/strong&gt;ddress : the location of the service.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;B&lt;/strong&gt;ind: how to get service.&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;C&lt;/strong&gt;ontract: service action.&lt;/p&gt;  &lt;p&gt;In this tutorial I will not describe details about WCF.My basic focus will be on creating a WCF service through Visual Studio 2008&lt;/p&gt;  &lt;p&gt;First open a new WCF project:&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:2cefd821-7619-48f5-92ad-9e036cc09ed0" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/_NL2fAc4la4o/Sd8jjlJKdBI/AAAAAAAAAMA/qkK7Lju31_Y/2-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/Sd8jngyWN8I/AAAAAAAAAME/UiDxuOR_8lg/2.png" width="335" height="255" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;In my sample project I have named &amp;quot;TestWCFService&amp;quot; for creating the service.&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:b3b2198d-dd74-4a7a-991c-b49b1b92451f" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/_NL2fAc4la4o/Sd8jqcNr_4I/AAAAAAAAAMI/ou3DjvduzGY/1-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/Sd8jukGqmyI/AAAAAAAAAMM/TbvdHpg9GMU/1%5B11%5D.png" width="250" height="247" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;In the solution explorer you will found IService1.cs interface , Service1.svc file and a code behind file Service1.svc.cs &lt;/p&gt;  &lt;p&gt;In my project I have renamed those as IDataService.cs, DataService.svc and DataService.svc.cs accordingly. To change the markup file of DataService.svc right click on the DataService.svc file in solution explorer and press &amp;quot;View Markup&amp;quot; as bellow&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;  &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:eb6ecc00-88ac-4fc6-926f-bf8472080786" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh3.ggpht.com/_NL2fAc4la4o/Sd8jxDwfycI/AAAAAAAAAMQ/QXTe6EVYDgw/3-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/Sd8j1HdW-AI/AAAAAAAAAMU/oVWxVMmuhC8/3%5B1%5D.png" width="187" height="250" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;p&gt;&lt;/p&gt;  &lt;p&gt;and change the Service according to you code as bellow.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@ &lt;/span&gt;&lt;span style="color: #a31515"&gt;ServiceHost &lt;/span&gt;&lt;span style="color: red"&gt;Language&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;C#&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Debug&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Service&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;TestWCFService.DataService&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CodeBehind&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;DataService.svc.cs&amp;quot; &lt;/span&gt;&lt;span style="background: #ffee62"&gt;%&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;In the solution my IDataSevice.cs is as bellow:&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Runtime.Serialization;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.ServiceModel;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;TestWCFService
{
    
    [&lt;span style="color: #2b91af"&gt;ServiceContract&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IDataService
    &lt;/span&gt;{

        [&lt;span style="color: #2b91af"&gt;OperationContract&lt;/span&gt;]
        &lt;span style="color: #2b91af"&gt;UserInformation &lt;/span&gt;GetUserDataFromService();

        [&lt;span style="color: #2b91af"&gt;OperationContract&lt;/span&gt;]
        &lt;span style="color: blue"&gt;string &lt;/span&gt;GetUserRestrictionFromService(&lt;span style="color: blue"&gt;string &lt;/span&gt;userID);
        
        &lt;span style="color: green"&gt;// TODO: Add your service operations here
    &lt;/span&gt;}


    &lt;span style="color: green"&gt;// Use a data contract as illustrated in the sample below to add composite types to service operations.
    &lt;/span&gt;[&lt;span style="color: #2b91af"&gt;DataContract&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UserInformation
    &lt;/span&gt;{

        [&lt;span style="color: #2b91af"&gt;DataMember&lt;/span&gt;]
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;UserName { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }

        [&lt;span style="color: #2b91af"&gt;DataMember&lt;/span&gt;]
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;UserLocation { &lt;span style="color: blue"&gt;get&lt;/span&gt;; &lt;span style="color: blue"&gt;set&lt;/span&gt;; }

      
        &lt;span style="color: blue"&gt;public string &lt;/span&gt;UserRestriction(&lt;span style="color: blue"&gt;int &lt;/span&gt;userID)
        {
            &lt;span style="color: blue"&gt;if &lt;/span&gt;(userID.Equals(1))
                &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #a31515"&gt;&amp;quot;approve&amp;quot;&lt;/span&gt;;
            &lt;span style="color: blue"&gt;else
                return &lt;/span&gt;&lt;span style="color: #a31515"&gt;&amp;quot;rejected&amp;quot;&lt;/span&gt;;
        }
       
    }
}&lt;/pre&gt;&lt;p&gt;My DataService.svc.cs file is as bellow :&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;TestWCFService
{
    &lt;span style="color: green"&gt;// NOTE: If you change the class name &amp;quot;Service1&amp;quot; here, you must also update the reference to &amp;quot;Service1&amp;quot; in Web.config and in the associated .svc file.
    &lt;/span&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataService &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IDataService
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;#region &lt;/span&gt;IDataService Members

        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UserInformation &lt;/span&gt;GetUserDataFromService()
        {
            &lt;span style="color: blue"&gt;return new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UserInformation&lt;/span&gt;() { UserName = &lt;span style="color: #a31515"&gt;&amp;quot;Tanvir&amp;quot;&lt;/span&gt;, UserLocation = &lt;span style="color: #a31515"&gt;&amp;quot;Dhaka&amp;quot; &lt;/span&gt;};
        }

        &lt;span style="color: blue"&gt;public string &lt;/span&gt;GetUserRestrictionFromService(&lt;span style="color: blue"&gt;string &lt;/span&gt;userID)
        {

            &lt;span style="color: #2b91af"&gt;UserInformation &lt;/span&gt;userInformation = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;UserInformation&lt;/span&gt;();

            &lt;span style="color: blue"&gt;if &lt;/span&gt;(userInformation.UserRestriction(&lt;span style="color: #2b91af"&gt;Int32&lt;/span&gt;.Parse(userID)).Equals(&lt;span style="color: #a31515"&gt;&amp;quot;approve&amp;quot;&lt;/span&gt;))
                &lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;your user id is {0} and you are approved&amp;quot;&lt;/span&gt;, userID);
            &lt;span style="color: blue"&gt;else
                return &lt;/span&gt;&lt;span style="color: #2b91af"&gt;String&lt;/span&gt;.Format(&lt;span style="color: #a31515"&gt;&amp;quot;your user id is {0} and you are not approved&amp;quot;&lt;/span&gt;, userID);

        }

        &lt;span style="color: blue"&gt;#endregion
    &lt;/span&gt;}
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;And the most important thing is to change in system.servieModel section in Web.config file as bellow :&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;services&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;service &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&lt;strong&gt;&lt;u&gt;TestWCFService&lt;/u&gt;&lt;/strong&gt;.DataService&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;behaviorConfiguration&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;TestWCFService.Service1Behavior&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;!-- &lt;/span&gt;&lt;span style="color: green"&gt;Service Endpoints &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;endpoint &lt;/span&gt;&lt;span style="color: red"&gt;address&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&amp;quot; &lt;span style="color: red"&gt;binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;wsHttpBinding&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;contract&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;TestWCFService.&lt;strong&gt;&lt;u&gt;IDataService&lt;/u&gt;&lt;/strong&gt;&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;!-- 
              &lt;/span&gt;&lt;span style="color: green"&gt;Upon deployment, the following identity element should be removed or replaced to reflect the 
              identity under which the deployed service runs.  If removed, WCF will infer an appropriate identity 
              automatically.
          &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;identity&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;dns &lt;/span&gt;&lt;span style="color: red"&gt;value&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;localhost&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;
                    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;identity&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;endpoint&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;endpoint &lt;/span&gt;&lt;span style="color: red"&gt;address&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;mex&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;binding&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;mexHttpBinding&lt;/span&gt;&amp;quot; &lt;span style="color: red"&gt;contract&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;IMetadataExchange&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;service&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;services&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;behaviors&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;serviceBehaviors&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
                &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;behavior &lt;/span&gt;&lt;span style="color: red"&gt;name&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;TestWCFService.Service1Behavior&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;&amp;gt;
                    &amp;lt;!-- &lt;/span&gt;&lt;span style="color: green"&gt;To avoid disclosing metadata information, set the value below to false and remove the metadata endpoint above before deployment &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;serviceMetadata &lt;/span&gt;&lt;span style="color: red"&gt;httpGetEnabled&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;true&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;
                    &amp;lt;!-- &lt;/span&gt;&lt;span style="color: green"&gt;To receive exception details in faults for debugging purposes, set the value below to true.  Set to false before deployment to avoid disclosing exception information &lt;/span&gt;&lt;span style="color: blue"&gt;--&amp;gt;
                    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;serviceDebug &lt;/span&gt;&lt;span style="color: red"&gt;includeExceptionDetailInFaults&lt;/span&gt;&lt;span style="color: blue"&gt;=&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;false&lt;/span&gt;&amp;quot;&lt;span style="color: blue"&gt;/&amp;gt;
                &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;behavior&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
            &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;serviceBehaviors&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;behaviors&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;system.serviceModel&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;We have to change the underline and bold section up above according to you code and naming in our solution.&lt;/p&gt;&lt;p&gt;Thanks &lt;/p&gt;&lt;p&gt;That's all for the day. 
  &lt;br /&gt;BYE&lt;/p&gt;&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-7862239993439434128?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/7862239993439434128/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/03/creating-wcf-service.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/7862239993439434128'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/7862239993439434128'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/03/creating-wcf-service.html' title='Creating WCF Service'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh4.ggpht.com/_NL2fAc4la4o/Sd8jngyWN8I/AAAAAAAAAME/UiDxuOR_8lg/s72-c/2.png' height='72' width='72'/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-2210083073916263466</id><published>2009-02-25T16:14:00.000+06:00</published><updated>2009-02-25T16:21:23.182+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Event'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Custom Event in .NET</title><content type='html'>&lt;p&gt;Hello All,&lt;/p&gt;  &lt;p&gt;Today I will try to deliberate my experience on custom event creation in .NET , Actually I was trying to find something like &lt;em&gt;hands on&lt;/em&gt; for event creation in .NET application, suddenly I got a quick help from one of my brother &lt;a href="http://sadique-sadiqulislam.blogspot.com/" target="_blank"&gt;Sadique&lt;/a&gt;, who helped me out to resolve the thirst.&lt;/p&gt;  &lt;p&gt;We are going to create a custom control where we will define our event class and event handler.To do that first take a&amp;#160; user control named InputControl.ascx&amp;#160; . The ascx page is as bellow.&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@ &lt;/span&gt;&lt;span style="color: #a31515"&gt;Control &lt;/span&gt;&lt;span style="color: red"&gt;Language&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;C#&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CodeFile&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;InputControl.ascx.cs&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Inherits&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;InputControl&amp;quot; &lt;/span&gt;&lt;span style="background: #ffee62"&gt;%&amp;gt;
&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Label &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;lblLabel&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Label&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;br &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;txtTextBox&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;TextBox&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;br &lt;/span&gt;&lt;span style="color: blue"&gt;/&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;asp&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;Button &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;btnSubmit&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Text&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Submit&amp;quot; 
    &lt;/span&gt;&lt;span style="color: red"&gt;onclick&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;btnSubmit_Click&amp;quot; /&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;p&gt;In that page I put a textbox control to take input , a button control to fire our custom event handler and a label to show our input result through our custom event.&lt;/p&gt;The InputControl.ascx.cs code behind file is as bellow :&lt;br /&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;

&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;InputControl &lt;/span&gt;: System.Web.UI.&lt;span style="color: #2b91af"&gt;UserControl
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;protected void &lt;/span&gt;Page_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
    {

    }

    &lt;span style="color: blue"&gt;public string &lt;/span&gt;EventInputBox
    {
        &lt;span style="color: blue"&gt;get &lt;/span&gt;{
                &lt;span style="color: blue"&gt;return this&lt;/span&gt;.txtTextBox.Text;
            }
        &lt;span style="color: blue"&gt;set &lt;/span&gt;{
                &lt;span style="color: blue"&gt;this&lt;/span&gt;.txtTextBox.Text = &lt;span style="color: blue"&gt;value&lt;/span&gt;;
            }
    }

    &lt;span style="color: blue"&gt;public string &lt;/span&gt;EventLabel {
        &lt;span style="color: blue"&gt;get &lt;/span&gt;{
                 &lt;span style="color: blue"&gt;return this&lt;/span&gt;.lblLabel.Text;
            }
        &lt;span style="color: blue"&gt;set &lt;/span&gt;{
                 &lt;span style="color: blue"&gt;this&lt;/span&gt;.lblLabel.Text = &lt;span style="color: blue"&gt;value&lt;/span&gt;;
            }
    }

    &lt;span style="color: blue"&gt;public event &lt;/span&gt;&lt;span style="color: #2b91af"&gt;EventHandler&lt;/span&gt;&amp;lt;&lt;span style="color: #2b91af"&gt;CustomEventArgs&lt;/span&gt;&amp;gt; CustomEventSubmit;
    &lt;span style="color: blue"&gt;protected void &lt;/span&gt;btnSubmit_Click(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
    {
        &lt;span style="color: blue"&gt;if &lt;/span&gt;(&lt;span style="color: blue"&gt;this&lt;/span&gt;.CustomEventSubmit != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
            &lt;span style="color: blue"&gt;this&lt;/span&gt;.CustomEventSubmit(&lt;span style="color: blue"&gt;this&lt;/span&gt;, &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CustomEventArgs&lt;/span&gt;(&lt;span style="color: #a31515"&gt;&amp;quot;your text is:&amp;quot; &lt;/span&gt;+ EventInputBox));
    }

}

&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CustomEventArgs &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;EventArgs
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;public string &lt;/span&gt;EventText { &lt;span style="color: blue"&gt;set&lt;/span&gt;; &lt;span style="color: blue"&gt;get&lt;/span&gt;; }

    &lt;span style="color: blue"&gt;public &lt;/span&gt;CustomEventArgs(&lt;span style="color: blue"&gt;string &lt;/span&gt;eventTextData)
    {
        EventText = eventTextData;

       
        &lt;span style="color: green"&gt;/*
         Perform other event tasks.
         
         */
    &lt;/span&gt;}
}&lt;/pre&gt;&lt;p&gt;Now I register the control in my Default.aspx page as bellow .&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="background: #ffee62"&gt;&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@ &lt;/span&gt;&lt;span style="color: #a31515"&gt;Page &lt;/span&gt;&lt;span style="color: red"&gt;Language&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;C#&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;AutoEventWireup&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;true&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;CodeFile&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;Default.aspx.cs&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;Inherits&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;_Default&amp;quot; &lt;/span&gt;&lt;span style="background: #ffee62"&gt;%&amp;gt;

&amp;lt;%&lt;/span&gt;&lt;span style="color: blue"&gt;@ &lt;/span&gt;&lt;span style="color: #a31515"&gt;Register &lt;/span&gt;&lt;span style="color: red"&gt;src&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;InputControl.ascx&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;tagname&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;InputControl&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;tagprefix&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;uc1&amp;quot; &lt;/span&gt;&lt;span style="background: #ffee62"&gt;%&amp;gt;

&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;lt;!&lt;/span&gt;&lt;span style="color: #a31515"&gt;DOCTYPE &lt;/span&gt;&lt;span style="color: red"&gt;html PUBLIC &lt;/span&gt;&lt;span style="color: blue"&gt;&amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&amp;gt;

&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;html &lt;/span&gt;&lt;span style="color: red"&gt;xmlns&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;http://www.w3.org/1999/xhtml&amp;quot;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;head &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;title&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;head&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;form &lt;/span&gt;&lt;span style="color: red"&gt;id&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;form1&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot;&amp;gt;
    &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
        &amp;lt;&lt;/span&gt;&lt;span style="color: #a31515"&gt;uc1&lt;/span&gt;&lt;span style="color: blue"&gt;:&lt;/span&gt;&lt;span style="color: #a31515"&gt;InputControl &lt;/span&gt;&lt;span style="color: red"&gt;ID&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;icEventBox&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;runat&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;server&amp;quot; &lt;/span&gt;&lt;span style="color: red"&gt;OnCustomEventSubmit&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;icEventBox_CustomEventSubmit&amp;quot;  /&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;div&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
    &amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;form&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;body&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;
&amp;lt;/&lt;/span&gt;&lt;span style="color: #a31515"&gt;html&lt;/span&gt;&lt;span style="color: blue"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;&lt;p&gt;In the file above we have to focus on &lt;span style="color: red"&gt;OnCustomEventSubmit&lt;/span&gt;&lt;span style="color: blue"&gt;=&amp;quot;icEventBox_CustomEventSubmit&amp;quot; &lt;/span&gt;which is pointing our custom event.&lt;/p&gt;&lt;p&gt;The code behind file Default.aspx.cs is as bellow.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;

&lt;span style="color: blue"&gt;public partial class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;_Default &lt;/span&gt;: System.Web.UI.&lt;span style="color: #2b91af"&gt;Page
&lt;/span&gt;{
    &lt;span style="color: blue"&gt;protected void &lt;/span&gt;Page_Load(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;EventArgs &lt;/span&gt;e)
    {

    }

    &lt;span style="color: blue"&gt;protected void &lt;/span&gt;icEventBox_CustomEventSubmit(&lt;span style="color: blue"&gt;object &lt;/span&gt;sender, &lt;span style="color: #2b91af"&gt;CustomEventArgs &lt;/span&gt;e)
    {
        icEventBox.EventLabel = e.EventText;
    }
}&lt;/pre&gt;&lt;p&gt;In the above article I didn't go for much brief discussion , I think the code is sufficient to describe a custom event itself.&lt;/p&gt;&lt;p&gt;That's all for the day. 
  &lt;br /&gt;BYE&lt;/p&gt;&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-2210083073916263466?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/2210083073916263466/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/02/custom-event-in-net.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/2210083073916263466'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/2210083073916263466'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/02/custom-event-in-net.html' title='Custom Event in .NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-4801551283106650019</id><published>2008-12-29T12:26:00.001+06:00</published><updated>2008-12-29T12:26:39.049+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Namespace in ASP.NET</title><content type='html'>&lt;p&gt;Commonly Used Types and Namespaces in ASP.NET&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web     &lt;br /&gt;&lt;/strong&gt;HttpApplication    &lt;br /&gt;HttpCookie    &lt;br /&gt;HttpRequest    &lt;br /&gt;HttpResponse    &lt;br /&gt;HttpRuntime    &lt;br /&gt;HttpServerUtility&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.ApplicationServices&lt;/strong&gt; *NEW    &lt;br /&gt;AuthenticationService NEW    &lt;br /&gt;ProfileService NEW    &lt;br /&gt;RoleService NEW&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.Caching     &lt;br /&gt;&lt;/strong&gt;Cache&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.ClientServices&lt;/strong&gt; *NEW    &lt;br /&gt;ClientFormsIdentity NEW    &lt;br /&gt;ClientRolePrincipal NEW    &lt;br /&gt;ConnectivityStatus NEW&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.ClientServices.Providers&lt;/strong&gt; *NEW    &lt;br /&gt;ClientFormsAuthenticationMembershipProvider NEW    &lt;br /&gt;ClientRoleProvider NEW&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.Compilation     &lt;br /&gt;&lt;/strong&gt;BuildProvider&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.Configuration     &lt;br /&gt;&lt;/strong&gt;WebConfigurationManager *NEW&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.Hosting     &lt;br /&gt;&lt;/strong&gt;ApplicationManager&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.Management     &lt;br /&gt;&lt;/strong&gt;WebBasedEvent&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.Security     &lt;br /&gt;&lt;/strong&gt;FormsAuthentication    &lt;br /&gt;FormsIdentity    &lt;br /&gt;Membership    &lt;br /&gt;Roles&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.SessionState     &lt;br /&gt;&lt;/strong&gt;HttpSessionState&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.UI     &lt;br /&gt;&lt;/strong&gt;Control    &lt;br /&gt;MasterPage    &lt;br /&gt;Page    &lt;br /&gt;ScriptManager NEW    &lt;br /&gt;System.Web.UI    &lt;br /&gt;UpdatePanel NEW    &lt;br /&gt;UpdateProgress NEW    &lt;br /&gt;UserControl&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.UI.HtmlControls     &lt;br /&gt;&lt;/strong&gt;HtmlButton    &lt;br /&gt;HtmlControl    &lt;br /&gt;HtmlForm    &lt;br /&gt;HtmlInputControl&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.UI.WebControls     &lt;br /&gt;&lt;/strong&gt;Content    &lt;br /&gt;DetailsView    &lt;br /&gt;FormView    &lt;br /&gt;GridView    &lt;br /&gt;LinqDataSource    &lt;br /&gt;ListView    &lt;br /&gt;LogIn    &lt;br /&gt;Menu    &lt;br /&gt;ObjectDataSources    &lt;br /&gt;TreeView    &lt;br /&gt;Wizard&lt;/p&gt;  &lt;p&gt;&lt;strong&gt;System.Web.UI.WebControls.WebParts     &lt;br /&gt;&lt;/strong&gt;WebPart&lt;/p&gt;  &lt;p&gt;*New - New namespaces in .NET framework 3.5&lt;/p&gt;  &lt;p&gt;[&lt;a href="http://blog.maheshm.net/2007/12/asp-net-35-namespaces.html" target="_blank"&gt;Source&lt;/a&gt;]&lt;/p&gt;  &lt;p&gt;That's all for the day.   &lt;br /&gt;BYE&lt;/p&gt;  &lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-4801551283106650019?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/4801551283106650019/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/12/namespace-in-aspnet.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/4801551283106650019'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/4801551283106650019'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/12/namespace-in-aspnet.html' title='Namespace in ASP.NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-1792603898525162028</id><published>2008-12-05T15:15:00.000+06:00</published><updated>2008-12-05T20:21:49.185+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>MySQL multiple table update &amp; Regular Expression</title><content type='html'>&lt;p&gt;Hello all&lt;/p&gt;  &lt;p&gt;Though its a very simple process but we usually don't do this stuff too much unless we are bound to do that.In this article I will show how to update a table data with another table depending on another table &amp;amp; another will be a simple regular expression in MySQL query.&lt;/p&gt;  &lt;p&gt;In the example I have &lt;strong&gt;'new_users'&lt;/strong&gt; table to update with the data of &lt;strong&gt;'listings' &lt;/strong&gt;table depending on the condition or &lt;strong&gt;'users'&lt;/strong&gt; table. and the table structure is as bellow.&lt;/p&gt; &lt;strong&gt;'new_users'&lt;/strong&gt; :   &lt;br /&gt;&lt;strong&gt;userID&lt;/strong&gt;,phone,user_state   &lt;br /&gt;&lt;strong&gt;'listings' &lt;/strong&gt;:   &lt;br /&gt;&lt;strong&gt;listID&lt;/strong&gt;,&lt;em&gt;userID&lt;/em&gt;,phone   &lt;br /&gt;&lt;strong&gt;'users'&lt;/strong&gt;:   &lt;br /&gt;&lt;strong&gt;countID&lt;/strong&gt;&lt;em&gt;,userID&lt;/em&gt;,category   &lt;br /&gt;  &lt;p&gt;Now the scenario is I have to update the phone of &lt;strong&gt;new_users&lt;/strong&gt; from the &lt;strong&gt;listings &lt;/strong&gt;tables phone of same userID but only who are only 'Admin' which we may found in &lt;strong&gt;users &lt;/strong&gt;table's&amp;#160; category field. So the query will be as following&lt;/p&gt;  &lt;div&gt;   &lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;-- Update from listings for 'Admin'&lt;/span&gt;
&lt;span class="kwrd"&gt;update&lt;/span&gt; listings, new_users, users
&lt;span class="kwrd"&gt;set&lt;/span&gt;
new_users.phone = listings.phone 
&lt;span class="kwrd"&gt;where&lt;/span&gt;
users.category = &lt;span class="str"&gt;'Admin'&lt;/span&gt; &amp;amp;&amp;amp;
listings.userID = users.userID &amp;amp;&amp;amp;
users.userID = new_users.userID&lt;/pre&gt;
&lt;/div&gt;
Now come to the second part, we can apply regular expression in our MySQL query as follow:&lt;br /&gt;&lt;div&gt;&lt;pre class="csharpcode"&gt;&lt;span class="rem"&gt;-- Update all user_state to null which contains invalid character&lt;/span&gt;
&lt;span class="kwrd"&gt;update&lt;/span&gt; new_users
&lt;span class="kwrd"&gt;set&lt;/span&gt;
new_users.user_state = &lt;span class="kwrd"&gt;null&lt;/span&gt;
&lt;span class="kwrd"&gt;where&lt;/span&gt;
new_users.user_state REGEXP &lt;span class="str"&gt;'[1234567890~!@#$%^&amp;amp;*()_+|}{&amp;quot;:?&amp;gt;&amp;lt;,./;]'&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;p&gt;The query will set null to user_state field if user_state field contains none but a-z &amp;amp; A-Z previously.&lt;/p&gt;&lt;p&gt;&lt;u&gt;I have also some collection or regular expression for MySQL which i have collected from different site.&lt;/u&gt;&lt;/p&gt;&lt;p&gt;A very simple example illustrating this is to select all the records from MyTable for which MyField starts with &amp;quot;A&amp;quot; &lt;/p&gt;&lt;p&gt;SELECT * FROM&amp;#160; MyTable WHERE MyField REGEXP '^a'; 
  &lt;br /&gt;Please take a look to the list below in order to find more information for the available options MySQL Regular Expressions&lt;br /&gt;*&amp;#160; &lt;br /&gt;Matches zero or more instances of the string preceding it&lt;br /&gt;+&amp;#160; &lt;br /&gt;Matches one or more instances of the string preceding it&lt;br /&gt;?&amp;#160; &lt;br /&gt;Matches zero or one instances of the string preceding it&lt;br /&gt;.&amp;#160; &lt;br /&gt;Matches any single character&lt;br /&gt;[xyz]&amp;#160; &lt;br /&gt;Matches any of x, y, or z (the characters within the brackets)&lt;br /&gt;[A-Z]&amp;#160; &lt;br /&gt;Matches any uppercase letter&lt;br /&gt;[a-z]&amp;#160; &lt;br /&gt;Matches any lowercase letter&lt;br /&gt;[0-9]&amp;#160; &lt;br /&gt;Matches any digit&amp;#160; &lt;br /&gt;^&amp;#160; &lt;br /&gt;Anchors the match from the beginning&amp;#160; &lt;br /&gt;$&amp;#160; &lt;br /&gt;Anchors the match to the end&lt;br /&gt;|&amp;#160; &lt;br /&gt;Separates strings in the regular expression&lt;br /&gt;{n,m}&amp;#160; &lt;br /&gt;String must occur at least n times, but no more than n&amp;#160;&amp;#160; &lt;br /&gt;{n}&amp;#160; &lt;br /&gt;String must occur exactly n times&lt;br /&gt;{n,|&amp;#160; &lt;br /&gt;String must occur at least n times&lt;/p&gt;&lt;p&gt;[&lt;a href="http://zamov.online.fr/EXHTML/Databases/Databases1.html" target="_blank"&gt;Source&lt;/a&gt;]&lt;/p&gt;&lt;p&gt;&amp;#160;&lt;/p&gt;That's all for the day.&lt;br /&gt;BYE&lt;br /&gt;&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-1792603898525162028?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/1792603898525162028/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/12/mysql-multiple-table-update-regular.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1792603898525162028'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1792603898525162028'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/12/mysql-multiple-table-update-regular.html' title='MySQL multiple table update &amp;amp; Regular Expression'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-3159350739737827967</id><published>2008-11-28T12:35:00.001+06:00</published><updated>2008-11-28T12:42:22.744+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='NMock'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='TDD'/><title type='text'>Isolated Unit Test of Business Logic With NMock in TDD</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt;  &lt;p&gt;In test driven development its always needed to test a particular project tested with make it isolate ( test with removing dependency from other projects ), In this scenario we virtually create the input set which will be produced from other projects(class,methods etc) and test whether our testable methods are functioning with that input set or not.&lt;/p&gt;  &lt;p&gt;To do that we have to make mock of the dependent objects. In the example bellow I have shown how to test a business logic layer with isolating it from data access layer.I have created three projects Web.Data , Web.Core &amp;amp; BL.Test .&lt;/p&gt;  &lt;p&gt;The Web.Data project contains the Data Access Layer which will be responsible for pulling data from the data source,but as we are isolating our business logic layer from this project so in the example I will not completely&amp;#160; implement our desired method( as it will not be executed).&lt;/p&gt;  &lt;p&gt;To do that we need some tools such as &lt;a href="http://www.nmock.org/download.html" target="_blank"&gt;NMock&lt;/a&gt; and &lt;a href="http://tanvirdotnet.blogspot.com/2008/09/simple-unit-test-with-nunit.html" target="_blank"&gt;NUnit&lt;/a&gt; . We will found the NMock.dll , nunit.core &amp;amp; nunit.framework in both of its bin folder where we extract or install those.&lt;/p&gt;  &lt;p&gt;our Web.Data contains only two files one is IMockDAL.cs interface and MockDAL.cs class.&lt;/p&gt;  &lt;p&gt;IMockDAL.cs interface :&lt;/p&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;Web.Data
{
   &lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IMockDAL
    &lt;/span&gt;{
       &lt;span style="color: green"&gt;/* The method will return a string list of
        * active member's name from data source .
        */
        &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; GetNameListDAL(&lt;span style="color: blue"&gt;bool &lt;/span&gt;active);
    }
} &lt;/pre&gt;
MockDAL.cs Class : 

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;Web.Data
{
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MockDAL&lt;/span&gt;:&lt;span style="color: #2b91af"&gt;IMockDAL
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;#region &lt;/span&gt;IMockDAL Members

        &lt;span style="color: green"&gt;/* This method will not be executed during the test,
         * as we will do mock of this method.         
         */
       &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; GetNameListDAL(&lt;span style="color: blue"&gt;bool &lt;/span&gt;active)
        {
            &lt;span style="color: blue"&gt;throw new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;NotImplementedException&lt;/span&gt;();
        }

        &lt;span style="color: blue"&gt;#endregion
    &lt;/span&gt;}
}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;In our Web.Core there are also two files , one is IEmployeeService.cs interface &amp;amp; EmployeeService.cs the class file. in this project we have to &lt;a href="http://tanvirdotnet.blogspot.com/2008/07/simple-multiple-project-add-to-visual.html" target="_blank"&gt;add reference&lt;/a&gt; of Web.Data project as it has a dependency over that.&lt;br /&gt;IEmployeeService.cs&amp;#160; interface :&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Web.Data;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;Web.Core
{
   &lt;span style="color: blue"&gt;public interface &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEmployeeService
    &lt;/span&gt;{
        &lt;span style="color: #2b91af"&gt;IMockDAL &lt;/span&gt;MockDAL { &lt;span style="color: blue"&gt;set&lt;/span&gt;; &lt;span style="color: blue"&gt;get&lt;/span&gt;; }
        &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; GetAllEmployee();
    }
}&lt;/pre&gt;EmployeeService.cs Class :&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Web.Data;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;Web.Core
{
   &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;EmployeeService &lt;/span&gt;: &lt;span style="color: #2b91af"&gt;IEmployeeService
    &lt;/span&gt;{
        &lt;span style="color: green"&gt;/* The MockDAL property will be used to assign
         * DAL through our mock object.
         */
        &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IMockDAL &lt;/span&gt;MockDAL { &lt;span style="color: blue"&gt;set&lt;/span&gt;; &lt;span style="color: blue"&gt;get&lt;/span&gt;; }

        &lt;span style="color: blue"&gt;public &lt;/span&gt;EmployeeService()
        {
            MockDAL = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MockDAL&lt;/span&gt;();        
        }

        &lt;span style="color: blue"&gt;#region &lt;/span&gt;IEmployeeService Members

        &lt;span style="color: green"&gt;/* The &amp;quot;GetAllEmploye&amp;quot; will call the &amp;quot;GetNameListDAL&amp;quot;
         * from the mock object. For the sake of simplicity 
         * I just call the DAL,not did any other operation.
        */

        &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; GetAllEmployee()
        {
            &lt;span style="color: blue"&gt;return &lt;/span&gt;MockDAL.GetNameListDAL(&lt;span style="color: blue"&gt;true&lt;/span&gt;);
        }

        &lt;span style="color: blue"&gt;#endregion
    &lt;/span&gt;}
} &lt;/pre&gt;In BL.Test project we have to add some reference as it have dependency over&amp;#160; couple of projects and DLLs . We have to add reference of Web.Data &amp;amp; Web.Core and we also have to add NMock.dll , nunit.core &amp;amp; nunit.framework .In this project we have a class file named MockTest.cs&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections.Generic;
&lt;span style="color: blue"&gt;using &lt;/span&gt;NMock2;
&lt;span style="color: blue"&gt;using &lt;/span&gt;NUnit.Framework;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Web.Data;
&lt;span style="color: blue"&gt;using &lt;/span&gt;Web.Core;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;BL.Test
{
    [&lt;span style="color: #2b91af"&gt;TestFixture&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;MockTest
    &lt;/span&gt;{
        &lt;span style="color: green"&gt;/* Assign property of our object that will be executed.
         */
        &lt;/span&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Mockery &lt;/span&gt;_mock;
        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IMockDAL &lt;/span&gt;_mockDAL;
        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;IEmployeeService &lt;/span&gt;_employeeService; 

        [&lt;span style="color: #2b91af"&gt;SetUp&lt;/span&gt;]
        &lt;span style="color: blue"&gt;public void &lt;/span&gt;init()
        {
            &lt;span style="color: green"&gt;/* initializing our objects.
             */
            &lt;/span&gt;_mock = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Mockery&lt;/span&gt;();
            _mockDAL = _mock.NewMock&amp;lt;&lt;span style="color: #2b91af"&gt;IMockDAL&lt;/span&gt;&amp;gt;();
            _employeeService = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;EmployeeService&lt;/span&gt;();
            _employeeService.MockDAL = _mockDAL;

        }

        [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
        &lt;span style="color: blue"&gt;public void &lt;/span&gt;TestEmployeeCount()
        {
            &lt;span style="color: green"&gt;/* In the list bellow we are creating our virtual list of
             * string, which we are expecting after calling the DAL
             * this list will be returned.
             */
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; employeeList = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt;();
            &lt;span style="color: blue"&gt;string &lt;/span&gt;emp = &lt;span style="color: #a31515"&gt;&amp;quot;Maix&amp;quot;&lt;/span&gt;;
            &lt;span style="color: blue"&gt;string &lt;/span&gt;emp2 = &lt;span style="color: #a31515"&gt;&amp;quot;Pain&amp;quot;&lt;/span&gt;;
            employeeList.Add(emp);
            employeeList.Add(emp2);


            &lt;span style="color: green"&gt;/* _mockDAL -&amp;gt; is our mocked DAL object.
             * GetNameListDAL -&amp;gt; is one of the method name of the _mockDAL object.
             * With(true) -&amp;gt; the single boolean parameter of the GetNameListDAL method.
             * employeeList -&amp;gt; The expecter return value from the GetNameListDAL method.
             */
            &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Expect&lt;/span&gt;.Once.On(_mockDAL).Method(&lt;span style="color: #a31515"&gt;&amp;quot;GetNameListDAL&amp;quot;&lt;/span&gt;).With(&lt;span style="color: blue"&gt;true&lt;/span&gt;).Will( &lt;span style="color: #2b91af"&gt;Return&lt;/span&gt;.Value(employeeList));

            &lt;span style="color: #2b91af"&gt;List&lt;/span&gt;&amp;lt;&lt;span style="color: blue"&gt;string&lt;/span&gt;&amp;gt; employeeListResult = _employeeService.GetAllEmployee();

            &lt;span style="color: green"&gt;/* Verify the mock object is executed successfully with its expectation.
             */
            &lt;/span&gt;_mock.VerifyAllExpectationsHaveBeenMet();

            &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.AreNotEqual(&lt;span style="color: blue"&gt;null&lt;/span&gt;, employeeListResult);
        }
    }
}&lt;/pre&gt;To make it run we can set the project as our startup project and &lt;a href="http://tanvirdotnet.blogspot.com/2008/09/simple-unit-test-with-nunit.html" target="_blank"&gt;configure the NUnit&lt;/a&gt; .&lt;p&gt;That's all for the day.&lt;/p&gt;BYE&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&amp;#160;&lt;/h6&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&amp;#160;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-3159350739737827967?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/3159350739737827967/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/11/isolated-unit-test-of-business-logic.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/3159350739737827967'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/3159350739737827967'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/11/isolated-unit-test-of-business-logic.html' title='Isolated Unit Test of Business Logic With NMock in TDD'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-3180598034666879817</id><published>2008-11-21T16:06:00.000+06:00</published><updated>2008-11-21T17:48:04.707+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Test'/><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='TDD'/><title type='text'>UI test with WatiN for TDD in .NET</title><content type='html'>&lt;p&gt;Hello all&lt;/p&gt;  &lt;p&gt;Today I will show how to test UI ( User Interfaces ) in .NET with &lt;a href="http://watin.sourceforge.net/" target="_blank"&gt;WatiN&lt;/a&gt; . WatiN is UI test framework. Though its a very simple but i have felt the documentation is not rich enough with example. So i have taken an initiative to make it more userfriendly for the developers. &lt;/p&gt;  &lt;p&gt;I will not emphasize on how to configure WatiN as its already well documented in the following links. What i will try to do is make familiar with HTML controls that's needed to be validated .&lt;/p&gt;  &lt;p&gt;Follow accordingly to configure WatiN :&lt;/p&gt;  &lt;ol&gt;   &lt;li&gt;Add reference as the &lt;a href="http://watin.sourceforge.net/gettingstarted.html" target="_blank"&gt;documentation&lt;/a&gt; of WatiN, you dont have to follow the example which is documented there just add the reference. &lt;/li&gt;    &lt;li&gt;If you don't know how to add reference please see &lt;a href="http://tanvirdotnet.blogspot.com/2008/07/easy-dll-using-in-visual-studio.html" target="_blank"&gt;&lt;u&gt;&lt;em&gt;this&lt;/em&gt;&lt;/u&gt;&lt;/a&gt; and for NUnit see &lt;a href="http://tanvirdotnet.blogspot.com/2008/09/simple-unit-test-with-nunit.html" target="_blank"&gt;&lt;u&gt;&lt;em&gt;this&lt;/em&gt;&lt;/u&gt;&lt;/a&gt;.&amp;#160; &lt;/li&gt;    &lt;li&gt;Visit &lt;a href="http://www.codeproject.com/KB/aspnet/WatiN.aspx  " target="_blank"&gt;&lt;u&gt;&lt;em&gt;this link&lt;/em&gt;&lt;/u&gt;&lt;/a&gt; for a good CodeProject's example. &lt;/li&gt; &lt;/ol&gt;  &lt;p&gt;One of the common mistake we do is, open a class file in our website project and start the writing the test code in it, but what we have to do is make a new Class Project ,add reference in that project &amp;amp; select as startup project for NUnit test.&lt;/p&gt;  &lt;div&gt;   &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;WatiN.Core;
&lt;span style="color: blue"&gt;using &lt;/span&gt;NUnit.Framework;
&lt;span style="color: blue"&gt;using &lt;/span&gt;WatiN.Core.DialogHandlers;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;TestStie
{
  [TestFixture]
  &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;AddArticleTest
    &lt;/span&gt;{

      [TestFixtureSetUpAttribute]
        &lt;span style="color: blue"&gt;public void &lt;/span&gt;SetUp()
        { 
        }

       [Test]
        &lt;span style="color: blue"&gt;public void &lt;/span&gt;TestAddArticle()
        {
            &lt;span style="color: blue"&gt;using &lt;/span&gt;(IE ie = &lt;span style="color: blue"&gt;new &lt;/span&gt;IE(&lt;span style="color: #a31515"&gt;&amp;quot;http://localhost:2456/testsite/login.aspx&amp;quot;&lt;/span&gt;))
            {

                &lt;span style="color: green"&gt;/*
                 * For textbox and textarea we have to use TextField() method and to search by 
                 * id of the control we have to use Find.ById() method &amp;amp; to fill the textbox 
                 * we have to use TypeText() method as following.                 
                 */

                &lt;/span&gt;ie.TextField(Find.ById(&lt;span style="color: #a31515"&gt;&amp;quot;ctl00_UserName&amp;quot;&lt;/span&gt;)).TypeText(&lt;span style="color: #a31515"&gt;&amp;quot;maxpain&amp;quot;&lt;/span&gt;);
                ie.TextField(Find.ById(&lt;span style="color: #a31515"&gt;&amp;quot;ctl00_Password&amp;quot;&lt;/span&gt;)).TypeText(&lt;span style="color: #a31515"&gt;&amp;quot;c0de71~123&amp;quot;&lt;/span&gt;);
               
                &lt;span style="color: green"&gt;/*
                 * For make a check box cheked we have to do as following.                 
                 */
                &lt;/span&gt;ie.CheckBox(Find.ById(&lt;span style="color: #a31515"&gt;&amp;quot;ctl00_chkActive&amp;quot;&lt;/span&gt;)).Checked = &lt;span style="color: blue"&gt;true&lt;/span&gt;;
                
                &lt;span style="color: green"&gt;/*
                 * To upload a file we have to do as bellow.
                 */
                &lt;/span&gt;ie.FileUpload(Find.ById(&lt;span style="color: #a31515"&gt;&amp;quot;ctl00_LogoFile&amp;quot;&lt;/span&gt;)).Set(&lt;span style="color: #a31515"&gt;@&amp;quot;C:\calligraphy.jpg&amp;quot;&lt;/span&gt;);

                &lt;span style="color: green"&gt;/*
                 * To selct a value form a dropdown list we have to follow as bellow.
                 * In the exmaple &amp;quot;Software Engineer&amp;quot; is selected item's value.
                 */
                &lt;/span&gt;ie.SelectList(&lt;span style="color: #a31515"&gt;&amp;quot;ctl00_BodyPlaceHolder_ddlSkillCategory&amp;quot;&lt;/span&gt;).Select(&lt;span style="color: #a31515"&gt;&amp;quot;Software Engineer&amp;quot;&lt;/span&gt;);

                &lt;span style="color: green"&gt;/*
                 * For make a radio button cheked we have to do as following.                 
                 */
                &lt;/span&gt;ie.RadioButton(Find.ByName(&lt;span style="color: #a31515"&gt;&amp;quot;ctl00$BodyPlaceHolder$rbPublish&amp;quot;&lt;/span&gt;)).Checked = &lt;span style="color: blue"&gt;true&lt;/span&gt;;

                &lt;span style="color: green"&gt;/*
                 * To click a link we have to do as bello
                 */
                &lt;/span&gt;ie.Link(Find.ByUrl(&lt;span style="color: #a31515"&gt;&amp;quot;http://localhost:2456/testsite/AddArticle.aspx?id=3&amp;quot;&lt;/span&gt;)).Click();

                &lt;span style="color: green"&gt;/*
                 * To click a button we have to do as bellow.
                 */
                &lt;/span&gt;ie.Button(Find.ById(&lt;span style="color: #a31515"&gt;&amp;quot;ctl00_LoginButton&amp;quot;&lt;/span&gt;)).Click();

                &lt;span style="color: green"&gt;/*
                 * Suppose we have to make confirm a delect action through JS confirmation box when we click 
                 * a link, then we have to do as follow.
                 */
                &lt;/span&gt;AlertDialogHandler alertDialogHandler = &lt;span style="color: blue"&gt;new &lt;/span&gt;AlertDialogHandler();
                ConfirmDialogHandler confirm = &lt;span style="color: blue"&gt;new &lt;/span&gt;ConfirmDialogHandler();
                &lt;span style="color: blue"&gt;using &lt;/span&gt;(&lt;span style="color: blue"&gt;new &lt;/span&gt;UseDialogOnce(ie.DialogWatcher, confirm))
                {
                    Link link = ie.Link(Find.ByUrl(&lt;span style="color: #a31515"&gt;&amp;quot;http://localhost:2456/testsite/AllCaseStudy.aspx?id=5&amp;quot;&lt;/span&gt;));

                    link.ClickNoWait();
                    confirm.WaitUntilExists();
                    confirm.OKButton.Click();
                }
                ie.WaitForComplete();

                &lt;span style="color: green"&gt;/*
                 * Now to check whether our operatin is successful or not we have to do assert test 
                 * as we do in unit test. Here ContainsText(&amp;quot;xxxx&amp;quot;) method returns true when it found
                 * the &amp;quot;xxxx&amp;quot; string in the page appear after any event perform.(generally we show
                 * a confirmation message after any successful event performed.) 
                 */
                &lt;/span&gt;Assert.IsTrue(ie.ContainsText(&lt;span style="color: #a31515"&gt;&amp;quot;News Deleted successfuly&amp;quot;&lt;/span&gt;), &lt;span style="color: #a31515"&gt;&amp;quot;Deleted id not found.&amp;quot;&lt;/span&gt;);
            }         
        }

        [TestFixtureTearDownAttribute]
        &lt;span style="color: blue"&gt;public void &lt;/span&gt;TearDown()
        {
        }
    }
}&lt;/pre&gt;
&lt;p&gt;Thats all for today.&lt;/p&gt;&lt;p&gt; BYE&lt;/p&gt;&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;
&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-3180598034666879817?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/3180598034666879817/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/11/ui-test-with-watin-for-tdd-in-net.html#comment-form' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/3180598034666879817'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/3180598034666879817'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/11/ui-test-with-watin-for-tdd-in-net.html' title='UI test with WatiN for TDD in .NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-3124226849679950916</id><published>2008-11-05T00:02:00.000+06:00</published><updated>2008-11-05T23:16:57.713+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>ASP.NET Form Authentication</title><content type='html'>&lt;p&gt;Hello All &lt;/p&gt;  &lt;p&gt;Today I will demonstrate how to do Form based authentication manually.Though it can be maintained through login controls which is provided by Visual Studio but sometime we need to do the task without using those controls and the required database.&lt;/p&gt;  &lt;p&gt;First we have to perform validation for the user, then we needed to authenticate the user for different type of task according to the role of the user ( I will do role based authentication.) In my example I have a folder named &amp;quot;Secure&amp;quot; which can be access only by the Admin user. (in the following code I assume that U have done the validation for a user.) &lt;/p&gt;&amp;#160; &lt;span style="color: green"&gt;/* we are taking expire time duration form application settings file you may also hard coded this value.*/&lt;/span&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;double &lt;/span&gt;EXPIRETIMELIMIT = Convert.ToDouble(ConfigurationManager.AppSettings[&lt;span style="color: #a31515"&gt;&amp;quot;EXPIRETIMELIMIT&amp;quot;&lt;/span&gt;]);

  FormsAuthentication.Initialize();
  FormsAuthentication.HashPasswordForStoringInConfigFile(&amp;quot;password&amp;quot;, &lt;span style="color: #a31515"&gt;&amp;quot;md5&amp;quot;&lt;/span&gt;);
            
  StringBuilder roles = newStringBuilder();
  &lt;span style="color: green"&gt;/* bellow i have added 2 roles , you may add roles according to your logic.*/
  &lt;/span&gt;roles.Append(&lt;span style="color: #a31515"&gt;&amp;quot;Admin&amp;quot;&lt;/span&gt;);
  roles.Append(&lt;span style="color: #a31515"&gt;&amp;quot;Manager&amp;quot;&lt;/span&gt;);
               
  FormsAuthenticationTicket ticket = &lt;span style="color: blue"&gt;new &lt;/span&gt;FormsAuthenticationTicket(1, &lt;span style="color: #a31515"&gt;&amp;quot;User Name&amp;quot;&lt;/span&gt;, DateTime.Now, DateTime.Now.AddMinutes(EXPIRETIMELIMIT), &lt;span style="color: blue"&gt;true&lt;/span&gt;, roles.ToString(), FormsAuthentication.FormsCookiePath);         
  &lt;span style="color: blue"&gt;string &lt;/span&gt;hash = FormsAuthentication.Encrypt(ticket);      
  HttpCookie cookie = &lt;span style="color: blue"&gt;new &lt;/span&gt;HttpCookie(FormsAuthentication.FormsCookieName, hash);
&lt;span style="color: green"&gt;/*We have to set the cookie expire time manually,its not working which we set in the parameter  of the FormsAuthenticationTicket's constructor .*/
 &lt;/span&gt;cookie.Expires = DateTime.Now.AddMinutes(EXPIRETIMELIMIT); 

 &lt;span style="color: blue"&gt;if&lt;/span&gt;(ticket.IsPersistent)
    cookie.Expires = ticket.Expiration;

 Response.Cookies.Add(cookie);

 Response.Redirect(&lt;span style="color: #a31515"&gt;&amp;quot;Admin/Home.aspx&amp;quot;&lt;/span&gt;);&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Now open the the Global.asax file,if its not exist in your current solution add it as a new item. Then add the following code block as bellow,which will chek the authentication in each page request. 

&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;protected void &lt;/span&gt;Application_AuthenticateRequest(Object sender, EventArgs e)
   {
       &lt;span style="color: blue"&gt;if &lt;/span&gt;(HttpContext.Current.User != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
       {
           &lt;span style="color: blue"&gt;if &lt;/span&gt;(HttpContext.Current.User.Identity.IsAuthenticated)
           {
               &lt;span style="color: blue"&gt;if &lt;/span&gt;(HttpContext.Current.User.Identity &lt;span style="color: blue"&gt;is &lt;/span&gt;FormsIdentity)
               {
                   FormsIdentity identity = (FormsIdentity)HttpContext.Current.User.Identity;

                   FormsAuthenticationTicket ticket = identity.Ticket;&lt;/pre&gt;&lt;blockquote&gt;&lt;pre class="code"&gt;&lt;span style="color: green"&gt;//         UserData is the roles which we have assigned before.&lt;/span&gt;
                   &lt;span style="color: blue"&gt;string&lt;/span&gt;[] roles = ticket.UserData.Split(&lt;span style="color: blue"&gt;new &lt;/span&gt;Char[] {&lt;span style="color: #a31515"&gt;','&lt;/span&gt;});
                                     
                   HttpContext.Current.User = &lt;span style="color: blue"&gt;new &lt;/span&gt;System.Security.Principal.GenericPrincipal(identity, roles);
                   
               }            
           }        
       }    
   }&lt;/pre&gt;&lt;/blockquote&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;Now its the time to securing our folder from web.config&amp;#160; . When any Authorized user will try to access in the Admin folder then this will check the &amp;quot;Admin&amp;quot; role for the user.&lt;pre class="code"&gt;&amp;lt;authentication mode=&lt;span style="color: #a31515"&gt;&amp;quot;Forms&amp;quot;&lt;/span&gt;&amp;gt;
        &amp;lt;forms name=&lt;span style="color: #a31515"&gt;&amp;quot;MYWEBAPP.ASPXAUTH&amp;quot;  &lt;/span&gt;loginUrl=&lt;span style="color: #a31515"&gt;&amp;quot;TeleMarketerLogin.aspx&amp;quot; &lt;/span&gt;protection=&lt;span style="color: #a31515"&gt;&amp;quot;All&amp;quot; &lt;/span&gt;path=&lt;span style="color: #a31515"&gt;&amp;quot;/&amp;quot;&lt;/span&gt;/&amp;gt;  
    &amp;lt;/authentication&amp;gt;
    &amp;lt;authorization&amp;gt;
        &amp;lt;deny users=&lt;span style="color: #a31515"&gt;&amp;quot;?&amp;quot;&lt;/span&gt;/&amp;gt;
        &amp;lt;allow roles=&lt;span style="color: #a31515"&gt;&amp;quot;Manager,Admin&amp;quot;&lt;/span&gt;/&amp;gt;
        &amp;lt;deny users=&lt;span style="color: #a31515"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;/&amp;gt;
    &amp;lt;/authorization&amp;gt;

&amp;lt;location path=&lt;span style="color: #a31515"&gt;&amp;quot;Secure&amp;quot;&lt;/span&gt;&amp;gt;
    &amp;lt;system.web&amp;gt;
        &amp;lt;authorization&amp;gt;
        &amp;lt;deny users=&lt;span style="color: #a31515"&gt;&amp;quot;?&amp;quot;&lt;/span&gt;/&amp;gt;
        &amp;lt;allow roles=&lt;span style="color: #a31515"&gt;&amp;quot;Admin&amp;quot;&lt;/span&gt;/&amp;gt;
        &amp;lt;deny users=&lt;span style="color: #a31515"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;/&amp;gt;
        &amp;lt;/authorization&amp;gt;
    &amp;lt;/system.web&amp;gt;
&amp;lt;/location&amp;gt;

&amp;lt;location path=&lt;span style="color: #a31515"&gt;&amp;quot;App_Themes&amp;quot;&lt;/span&gt;&amp;gt;
    &amp;lt;system.web&amp;gt;
        &amp;lt;authorization&amp;gt;
            &amp;lt;allow users=&lt;span style="color: #a31515"&gt;&amp;quot;*&amp;quot;&lt;/span&gt;/&amp;gt;
        &amp;lt;/authorization&amp;gt;
    &amp;lt;/system.web&amp;gt;
&amp;lt;/location&amp;gt;&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;thats all for today.&lt;br /&gt;BYE&lt;h6&gt;&lt;em&gt;User &lt;/em&gt;&lt;a href="http://www.scrumpad.com" target="_blank"&gt;&lt;em&gt;ScrumPad&lt;/em&gt;&lt;/a&gt;&lt;em&gt; for your Agile based projects.&lt;/em&gt;&lt;/h6&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-3124226849679950916?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/3124226849679950916/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/11/aspnet-form-authentication.html#comment-form' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/3124226849679950916'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/3124226849679950916'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/11/aspnet-form-authentication.html' title='ASP.NET Form Authentication'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-2829624344175543960</id><published>2008-10-22T21:07:00.000+06:00</published><updated>2008-11-21T16:19:26.423+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><category scheme='http://www.blogger.com/atom/ns#' term='WebService'/><title type='text'>Web service creation &amp; consuming with ASP.NET</title><content type='html'>&lt;p&gt;Hello all&lt;/p&gt; Today I will show how to create web service with VS2008 and consume it in different application.   &lt;br /&gt;first I have opened a web service from File&amp;gt;New web site &amp;gt; web service named &amp;quot;DemoWebService&amp;quot;.   &lt;br /&gt;  &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:3a0ddedc-e3f2-494b-955d-a6ab9a6a3531" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a title="" href="http://lh4.ggpht.com/tanvir.net/SP88-z8d03I/AAAAAAAAAIM/5AjU60ZJSW8/1-8x6.jpg" rel="thumbnail"&gt;&lt;img src="http://lh5.ggpht.com/tanvir.net/SP89Bauw2dI/AAAAAAAAAIQ/XKCRAB2DeuU/1.png" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;  &lt;br /&gt;now in the solution explorer we can a Service.asmx file and the Service.cs file in App_Code . I have added another web service named WebServiceTest.asmx so a WebServiceTest.cs file also added in App_Code folder. &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:f5902270-ee45-44dc-a742-885159bff311" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a title="" href="http://lh5.ggpht.com/tanvir.net/SP89DO75ZrI/AAAAAAAAAIU/XHacMYNNxQ4/2-8x6.jpg" rel="thumbnail"&gt;&lt;img src="http://lh4.ggpht.com/tanvir.net/SP89Gku2yOI/AAAAAAAAAIY/F4G2riy3rfs/2.png" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;we will basically work with *.cs file to make the service.    &lt;br /&gt;I opened the WebServiceTest.cs file and there is a demo web method named Hello World. So I will create another method named &amp;quot;GetValue&amp;quot; which will also return a string.&lt;/p&gt; &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;&lt;br /&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections;&lt;br /&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Linq;&lt;br /&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web;&lt;br /&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.Services;&lt;br /&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Web.Services.Protocols;&lt;br /&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Xml.Linq;&lt;br /&gt;&lt;span style="color: gray"&gt;/// &amp;lt;summary&amp;gt;&lt;br /&gt;/// &lt;/span&gt;&lt;span style="color: green"&gt;Summary description for WebServiceTest&lt;br /&gt;&lt;/span&gt;&lt;span style="color: gray"&gt;/// &amp;lt;/summary&amp;gt;&lt;br /&gt;&lt;/span&gt;[&lt;span style="color: #2b91af"&gt;WebService&lt;/span&gt;(Namespace = &lt;span style="color: #a31515"&gt;&amp;quot;http://tempuri.org/&amp;quot;&lt;/span&gt;)]&lt;br /&gt;[&lt;span style="color: #2b91af"&gt;WebServiceBinding&lt;/span&gt;(ConformsTo = &lt;span style="color: #2b91af"&gt;WsiProfiles&lt;/span&gt;.BasicProfile1_1)]&lt;br /&gt;&lt;span style="color: green"&gt;// To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. &lt;br /&gt;// [System.Web.Script.Services.ScriptService]&lt;br /&gt;&lt;/span&gt;&lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;WebServiceTest &lt;/span&gt;: System.Web.Services.&lt;span style="color: #2b91af"&gt;WebService &lt;/span&gt;{&lt;br /&gt;&lt;span style="color: blue"&gt;public &lt;/span&gt;WebServiceTest () {&lt;br /&gt;&lt;span style="color: green"&gt;//Uncomment the following line if using designed components &lt;br /&gt;//InitializeComponent(); &lt;br /&gt; &lt;/span&gt;}&lt;br /&gt;[&lt;span style="color: #2b91af"&gt;WebMethod&lt;/span&gt;]&lt;br /&gt;&lt;span style="color: blue"&gt;public string &lt;/span&gt;HelloWorld() {&lt;br /&gt;&lt;span style="color: blue"&gt;return &lt;/span&gt;&lt;span style="color: #a31515"&gt;&amp;quot;Hello World&amp;quot;&lt;/span&gt;;&lt;br /&gt;    }&lt;br /&gt;[&lt;span style="color: #2b91af"&gt;WebMethod&lt;/span&gt;]&lt;br /&gt;    &lt;span style="color: blue"&gt;public string &lt;/span&gt;GetValue()&lt;br /&gt;{ &lt;br /&gt;&lt;span style="color: blue"&gt;string &lt;/span&gt;valueString = &lt;span style="color: #a31515"&gt;&amp;quot;the result of your logic.&amp;quot;&lt;/span&gt;;&lt;br /&gt;&lt;span style="color: blue"&gt;return &lt;/span&gt;valueString;&lt;br /&gt;}&lt;br /&gt;}&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;We have to add the [&lt;span style="color: #2b91af"&gt;WebMethod&lt;/span&gt;]&amp;#160; attribute before starting any method which will serve the web service.&lt;p&gt;Now i will add another web site named &amp;quot;ConsumeWebService&amp;quot; which will be used to consume the web service. and add web reference to the site as bellow.&lt;/p&gt;&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:683fe8e9-e42f-4da5-9a94-ceb95c43dab8" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a title="" href="http://lh6.ggpht.com/tanvir.net/SP89Ih4QN-I/AAAAAAAAAIc/AAOSa-YVXvs/Untitled-8x6%5B1%5D.jpg" rel="thumbnail"&gt;&lt;img src="http://lh5.ggpht.com/tanvir.net/SP89LYBYZgI/AAAAAAAAAIg/L-INjgUWTJc/Untitled%5B2%5D.png" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:a5d72496-67d2-4fcf-82fe-7b7c09782cbb" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a title="" href="http://lh5.ggpht.com/tanvir.net/SP89NFOBk0I/AAAAAAAAAIk/dfh3OTqWElU/Untitled-8x6%5B2%5D.jpg" rel="thumbnail"&gt;&lt;img src="http://lh3.ggpht.com/tanvir.net/SP89P92AB2I/AAAAAAAAAIo/sU4Djmo6BT4/Untitled%5B4%5D.png" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:fef150a1-2551-4c32-80b0-ce94559df1ea" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a title="" href="http://lh6.ggpht.com/tanvir.net/SP89SBAK4bI/AAAAAAAAAIs/zmOT0I6KlrI/Untitled-8x6%5B3%5D.jpg" rel="thumbnail"&gt;&lt;img src="http://lh3.ggpht.com/tanvir.net/SP89VoshBeI/AAAAAAAAAIw/-5XTtDlEdCo/Untitled%5B5%5D.png" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;for the simplicity I have chosen the Web service in this solution( you can choose you own type as you needed for the further use).&lt;br /&gt;now we will see&amp;#160; our Class file which we have created in our web service, I have select the WebServiceTest for the implementing.&amp;#160;&amp;#160; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:0c54da34-865d-4dd4-b04b-21743e840e71" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a title="" href="http://lh4.ggpht.com/tanvir.net/SP89X4OxvsI/AAAAAAAAAI0/L1EOeBlkiAk/Untitled-8x6%5B4%5D.jpg" rel="thumbnail"&gt;&lt;img src="http://lh4.ggpht.com/tanvir.net/SP89aQ7HvoI/AAAAAAAAAI4/y_0Kd9vA6Ak/Untitled%5B6%5D.png" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;br /&gt;Now we will sell our methods in the next window, now I have selected the web reference name as &amp;quot;WebserviceTest&amp;quot; and add the reference .
&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:87d41dac-5a26-4966-8390-6e07cb09085e" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a title="" href="http://lh4.ggpht.com/tanvir.net/SP89dH04tlI/AAAAAAAAAI8/YXKqXYb7_sk/Untitled-8x6%5B5%5D.jpg" rel="thumbnail"&gt;&lt;img src="http://lh3.ggpht.com/tanvir.net/SP89fQhK5uI/AAAAAAAAAJA/B4SyIeowXKk/Untitled%5B7%5D.png" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;for the simplicity I will skip the&amp;#160; discussion of&amp;#160; *.disco &amp;amp; *.wsdl file,this file are basically needed for communication between our application and web service.&lt;br /&gt;&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:a2a2805e-9ce7-475b-873e-ab1b448380ea" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a title="" href="http://lh5.ggpht.com/tanvir.net/SP89hR3IxkI/AAAAAAAAAJE/D2vMyMBzzXQ/Untitled-8x6%5B6%5D.jpg" rel="thumbnail"&gt;&lt;img src="http://lh5.ggpht.com/tanvir.net/SP89kErxRXI/AAAAAAAAAJI/1_sxxSfa7wg/Untitled%5B9%5D.png" border="0" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;br /&gt;now I open the Default.aspx.cs file and add the WebServiceTest namespace and call the Method of web service as following.&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:d11bcdf5-2929-4f0d-b1fa-e043adca97fe" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a title="" href="http://lh3.ggpht.com/tanvir.net/SP89mX2aXYI/AAAAAAAAAJM/VYPY53RNPj4/Untitled-8x6%5B7%5D.jpg" rel="thumbnail"&gt;&lt;img src="http://lh6.ggpht.com/tanvir.net/SP89o-FTN5I/AAAAAAAAAJQ/ngKo8ZxBUaA/Untitled%5B14%5D.png" border="0" /&gt;&lt;/a&gt;&lt;br /&gt;&lt;/div&gt;no compile the web site and and enjoy the service.

&lt;p&gt;BYE&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-2829624344175543960?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/2829624344175543960/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/10/web-service-creation-consuming-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/2829624344175543960'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/2829624344175543960'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/10/web-service-creation-consuming-with.html' title='Web service creation &amp;amp; consuming with ASP.NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh5.ggpht.com/tanvir.net/SP89Bauw2dI/AAAAAAAAAIQ/XKCRAB2DeuU/s72-c/1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-895040902629292854</id><published>2008-10-21T22:42:00.000+06:00</published><updated>2008-10-21T22:47:13.256+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Captcha generate with ASP.NET &amp; C#</title><content type='html'>&lt;p&gt;Hello all &lt;/p&gt;  &lt;p&gt;Today I will demonstrate how to generate captcha with asp.net &amp;amp; C# . though there are many .NET plugin and controls to serve the purpose but my focus is to generate the a random image and its manipulation with the help of .NET framework.&lt;/p&gt;  &lt;p&gt;First open a web project and add a &amp;quot;Web user control&amp;quot; , in the example the name of my control is &amp;quot;ImageGeneratorControl.ascx&amp;quot; . the purpose of the control is to generate a image according to the random character.&lt;/p&gt;  &lt;p&gt;Now open the&amp;#160; &amp;quot;ImageGeneratorControl.ascx.cs&amp;quot; file (i used the code behind method for the example.) , to generate image we have to use System.Drawing base class.&lt;/p&gt;  &lt;p&gt;firstly we have to make a Bitmap type object where the image will generate, then for the texture we have to take a Graphics type object and manipulate the our random string there, after that we will sat the content type and save the Bitmap object stream so that it may&amp;#160; generate a image file, finally we have to dispose our objects.&lt;/p&gt;  &lt;p&gt;there is a method named &amp;quot;RandomString&amp;quot; which will take the length of sting to be generate as parameter, in the method i have generate a random number and convert the number into string.In an addition the string will be save in Session.&lt;/p&gt;  &lt;p&gt;The code of the&amp;#160; &amp;quot;ImageGeneratorControl.ascx.cs&amp;quot; is as bellow :&lt;/p&gt;  &lt;p&gt;using System;    &lt;br /&gt;using System.Drawing; &lt;/p&gt;  &lt;p&gt;public partial class ImageGeneratorControl : System.Web.UI.UserControl    &lt;br /&gt;{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; protected void Page_Load(object sender, EventArgs e)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Bitmap objBmp = new Bitmap(100, 30);     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Graphics objGraphics ;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Font objFont = new Font(&amp;quot;Arial&amp;quot;, 16, FontStyle.Bold); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; objGraphics = Graphics.FromImage(objBmp);    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; objGraphics.Clear(Color.WhiteSmoke); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; objGraphics.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; objGraphics.DrawString(this.RandomString(6), objFont, Brushes.Gray, 3, 3); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Response.ContentType = &amp;quot;image/GIF&amp;quot;;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; objBmp.Save(Response.OutputStream, System.Drawing.Imaging.ImageFormat.Gif); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; objBmp.Dispose();    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; objGraphics.Dispose();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; objFont.Dispose();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; } &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160; private string RandomString(int length)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Random rand = new Random();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; char ch; &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; System.Text.StringBuilder randString = new System.Text.StringBuilder(); &lt;/p&gt;  &lt;p&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; for(int i = 0 ; i&amp;lt;length; i++)    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; ch = Convert.ToChar(Convert.ToInt32((Math.Floor(rand.NextDouble() * 26) + 65)));     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; randString.Append(ch);     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; Session[&amp;quot;CaptchaString&amp;quot;] = randString.ToString().ToLower();     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; return randString.ToString().ToLower();&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;now we have to place that control in a aspx page (we also can handle it with HTTPHandler but for the simplicity i have used a aspx page which will act as a &amp;quot;GIF&amp;quot; image)&lt;/p&gt;  &lt;p&gt;so i have taken a Image.aspx file and register the Control as following:&lt;/p&gt;  &lt;p&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot;&amp;#160; CodeFile=&amp;quot;Image.aspx.cs&amp;quot; Inherits=&amp;quot;_Image&amp;quot; %&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;%@ Register src=&amp;quot;ImageGeneratorControl.ascx&amp;quot; tagname=&amp;quot;ImageGeneratorControl&amp;quot; tagprefix=&amp;quot;uc1&amp;quot; %&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;&lt;a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ?="?"&gt;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&lt;/a&gt;&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;head runat=&amp;quot;server&amp;quot;&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;/head&amp;gt;    &lt;br /&gt;&amp;lt;body&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &amp;lt;uc1:ImageGeneratorControl ID=&amp;quot;ImageGeneratorControl1&amp;quot; runat=&amp;quot;server&amp;quot; /&amp;gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/form&amp;gt;     &lt;br /&gt;&amp;lt;/body&amp;gt;&lt;/p&gt;  &lt;p&gt;Now this Image.aspx file will act as a Image . What we have to do now is include the Image.aspx page in our main aspx file where the image will be visible. i have used Container.aspx file to generate the captcha as following:&lt;/p&gt;  &lt;p&gt;&amp;lt;%@ Page Language=&amp;quot;C#&amp;quot; AutoEventWireup=&amp;quot;true&amp;quot; CodeFile=&amp;quot;Container.aspx.cs&amp;quot; Inherits=&amp;quot;Container&amp;quot; %&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;!DOCTYPE html PUBLIC &amp;quot;-//W3C//DTD XHTML 1.0 Transitional//EN&amp;quot; &amp;quot;&lt;a href="http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd" ?="?"&gt;http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd&amp;quot;&lt;/a&gt;&amp;gt; &lt;/p&gt;  &lt;p&gt;&amp;lt;html xmlns=&amp;quot;&lt;a href="http://www.w3.org/1999/xhtml" ?="?"&gt;http://www.w3.org/1999/xhtml&amp;quot;&lt;/a&gt;&amp;gt;     &lt;br /&gt;&amp;lt;head runat=&amp;quot;server&amp;quot;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;title&amp;gt;Captcha Page&amp;lt;/title&amp;gt;     &lt;br /&gt;&amp;lt;/head&amp;gt;     &lt;br /&gt;&amp;lt;body&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;form id=&amp;quot;form1&amp;quot; runat=&amp;quot;server&amp;quot;&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;div&amp;gt;&amp;lt;img src=&amp;quot;Image.aspx&amp;quot; /&amp;gt;&amp;lt;/div&amp;gt;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &amp;lt;/form&amp;gt;     &lt;br /&gt;&amp;lt;/body&amp;gt;     &lt;br /&gt;&amp;lt;/html&amp;gt; &lt;/p&gt;  &lt;p&gt;now you can protect the form from spamming according to your logic,session and image data.&amp;#160; &lt;/p&gt;  &lt;p&gt;BYE&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-895040902629292854?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/895040902629292854/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/10/captcha-generate-with-aspnet-c.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/895040902629292854'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/895040902629292854'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/10/captcha-generate-with-aspnet-c.html' title='Captcha generate with ASP.NET &amp;amp; C#'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-1410278533320445652</id><published>2008-09-19T23:03:00.000+06:00</published><updated>2008-09-19T23:39:00.377+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Test'/><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Simple unit test with NUnit</title><content type='html'>&lt;p&gt;Hello all&lt;/p&gt;  &lt;p&gt;Today I will show you how to do unit test of a .NET project with NUnit. NUnit is a great tool to do unit test of any .NET project.As its a third party tool so you have to download it from &lt;a href="http://nunit.org/index.php?p=download" target="_blank"&gt;here&lt;/a&gt; . I assume that you all are familiar with unit test.For the simplicity I will show you a simple example,Once when you are habituated with this took you will find yourself in many complex test script.&lt;/p&gt;  &lt;p&gt;first I opened an new class project named Calculation.Core.&lt;/p&gt;  &lt;p&gt;then I added two method which will be tested through NUnit. &lt;/p&gt;  &lt;p&gt;The class file's is &amp;quot;Calculation&amp;quot; and those two methods are DoAdd &amp;amp; DoSub which will add two numbers and subtract two numbers.Both's return type and parameters type are integer .&lt;/p&gt;  &lt;p&gt;&lt;span style="color: blue"&gt;namespace &lt;/span&gt;Calculation.Core     &lt;br /&gt;{     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;Calculation      &lt;br /&gt;&amp;#160;&amp;#160; &lt;/span&gt;{     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public int &lt;/span&gt;DoAdd(&lt;span style="color: blue"&gt;int &lt;/span&gt;firstNumber, &lt;span style="color: blue"&gt;int &lt;/span&gt;secondNumber)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return &lt;/span&gt;firstNumber + secondNumber;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;    &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;public int &lt;/span&gt;DoSub(&lt;span style="color: blue"&gt;int &lt;/span&gt;firstNumber, &lt;span style="color: blue"&gt;int &lt;/span&gt;secondNumber)     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; {     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; &lt;span style="color: blue"&gt;return &lt;/span&gt;firstNumber - secondNumber;     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;&amp;#160;&amp;#160;&amp;#160; }     &lt;br /&gt;}&lt;/p&gt;  &lt;p&gt;now I added another class project named Calculation.Test and &lt;a href="http://tanvirdotnet.blogspot.com/2008/07/simple-multiple-project-add-to-visual.html" target="_blank"&gt;Add Reference&lt;/a&gt; of the Calculation.Core project. and also make &lt;a href="http://tanvirdotnet.blogspot.com/2008/07/easy-dll-using-in-visual-studio.html" target="_blank"&gt;Add DLL Reference&lt;/a&gt; of&amp;#160; NUnit's &amp;quot;nunit.framework.dll&amp;quot; from my NUnit's installed location &amp;quot;C:\Program Files (x86)\NUnit 2.4.8\bin\nunit.framework.dll&amp;quot; .This will vary according to your installation of NUnit.&lt;/p&gt;  &lt;p&gt;now I have to include namespace in the file by typing :&lt;/p&gt;  &lt;blockquote&gt;   &lt;p&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;NUnit.Framework;&lt;/p&gt;    &lt;p&gt;now we have to add the &amp;quot;[&lt;span style="color: #2b91af"&gt;TestFixture]&lt;/span&gt;&amp;quot; attribute to the CalculationTest class and &amp;quot;[&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]&amp;quot; attribute to the DoAddTest ,DoFailTest &amp;amp; DoSubTest methods.&lt;/p&gt; &lt;/blockquote&gt; &lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;NUnit.Framework;
&lt;span style="color: blue"&gt;namespace &lt;/span&gt;Calculation.Test
{
   [&lt;span style="color: #2b91af"&gt;TestFixture&lt;/span&gt;]
    &lt;span style="color: blue"&gt;public class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;CalculationTest
    &lt;/span&gt;{
       [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
       &lt;span style="color: blue"&gt;public void &lt;/span&gt;DoAddTest()
       {
           
           Calculation.Core.&lt;span style="color: #2b91af"&gt;Calculation &lt;/span&gt;sub = &lt;span style="color: blue"&gt;new  &lt;/span&gt;Calculation.Core.&lt;span style="color: #2b91af"&gt;Calculation&lt;/span&gt;();
           &lt;span style="color: blue"&gt;int &lt;/span&gt;result = sub.DoSub(3,1);
           &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.Greater(3, result);
       }

       [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
       &lt;span style="color: blue"&gt;public void &lt;/span&gt;DoSubTest()
       {
           Calculation.Core.&lt;span style="color: #2b91af"&gt;Calculation &lt;/span&gt;sub = &lt;span style="color: blue"&gt;new &lt;/span&gt;Calculation.Core.&lt;span style="color: #2b91af"&gt;Calculation&lt;/span&gt;();
           &lt;span style="color: blue"&gt;int &lt;/span&gt;result = sub.DoSub(3, 1);
           &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.Greater(3, result);
       }

       [&lt;span style="color: #2b91af"&gt;Test&lt;/span&gt;]
       &lt;span style="color: blue"&gt;public void &lt;/span&gt;DoFailTest()
       {
           Calculation.Core.&lt;span style="color: #2b91af"&gt;Calculation &lt;/span&gt;sub = &lt;span style="color: blue"&gt;new &lt;/span&gt;Calculation.Core.&lt;span style="color: #2b91af"&gt;Calculation&lt;/span&gt;();
           &lt;span style="color: blue"&gt;int &lt;/span&gt;result = sub.DoSub(3, 1);
           &lt;span style="color: #2b91af"&gt;Assert&lt;/span&gt;.Greater(1, result);
       }
    }
}&lt;/pre&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;

&lt;p&gt;Now we have to select the Calculation.Test project as Starup project and select the &amp;quot;Properties&amp;quot; from the Solution Explorer .&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:fbdf8409-bee5-4b48-ac23-359bf3b66ed1" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/tanvir.net/SNPcSF4gi4I/AAAAAAAAAG8/wkCIXFsghig/1-8x6%5B1%5D.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/tanvir.net/SNPcV9lXjXI/AAAAAAAAAHA/sRJUGbq2eq0/1%5B1%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;Now form the Calculation.Test tab we have to select Debug then select&amp;#160; Start External Program and set the location of NUnit.exe then select Command line argument and write the dll name of the test project .&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:df741dc5-f0ae-407b-b784-1fb7ed57fc48" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh5.ggpht.com/tanvir.net/SNPcdCnRtjI/AAAAAAAAAHE/4Jy9d_SUV7U/1-8x6%5B2%5D.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/tanvir.net/SNPch5_7aGI/AAAAAAAAAHI/ZVbv0Y8CSx4/1%5B2%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;now when we will run the application then NUnit will automatically start and we have to press run button to show the unit test result.&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:bad0cd43-31b9-4aad-bf0e-d95ebd41e718" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh3.ggpht.com/tanvir.net/SNPck8DYaXI/AAAAAAAAAHM/SC9R38b4QUc/1-8x6%5B3%5D.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/tanvir.net/SNPcnYPlHEI/AAAAAAAAAHQ/4Qez7q37f6M/1%5B3%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;In the result we will see that the two method of our test script has passed but one fail as I didn't give the proper assert method .&lt;/p&gt;

&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:0c92c829-5344-4bf5-8847-2d9d944ad5bc" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh3.ggpht.com/tanvir.net/SNPcqk89MXI/AAAAAAAAAHU/ZYfFbgW_om0/1-8x6%5B5%5D.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/tanvir.net/SNPcuMOw4xI/AAAAAAAAAHY/gH0eu86yhPM/1%5B5%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt;

&lt;p&gt;in this way we can do unit test with NUnit. There are also many useful method of NUnit's to test the script. 
  &lt;br /&gt;BYE &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-1410278533320445652?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/1410278533320445652/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/09/simple-unit-test-with-nunit.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1410278533320445652'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1410278533320445652'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/09/simple-unit-test-with-nunit.html' title='Simple unit test with NUnit'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/tanvir.net/SNPcV9lXjXI/AAAAAAAAAHA/sRJUGbq2eq0/s72-c/1%5B1%5D.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-7984152364557577501</id><published>2008-08-27T07:56:00.001+06:00</published><updated>2008-08-27T07:56:26.750+06:00</updated><title type='text'>Simple C# coding standard</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt; &lt;p&gt;To day I will go through about coding standard which we must have to follow during development .&lt;/p&gt; &lt;p&gt;1.Pascal casing&amp;nbsp; should have to follow in Class &amp;amp; Method naming &lt;/p&gt; &lt;p&gt;example : public class TestClass{}; public void TestMethod(){};&lt;/p&gt; &lt;p&gt;2.Camel casing should have to follow in writing and local variable and parameter.&lt;/p&gt; &lt;p&gt;example : int localCounter;public void TestMethod(int counter){};&lt;/p&gt; &lt;p&gt;3. "_" should have to given while starting a private variable&lt;/p&gt; &lt;p&gt;example : private string _localAddress;&lt;/p&gt; &lt;p&gt;4. "I" character should have to place before the name of any interface.&lt;/p&gt; &lt;p&gt;example: interface IDataCollection{}; &lt;/p&gt; &lt;p&gt;there are some vital information about coding standard &lt;a href="http://www.dotnetspider.com/tutorials/CodingStandards.doc" target="_blank"&gt;here&lt;/a&gt; .&lt;/p&gt; &lt;p&gt;Bye&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-7984152364557577501?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/7984152364557577501/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/08/simple-c-coding-standard.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/7984152364557577501'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/7984152364557577501'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/08/simple-c-coding-standard.html' title='Simple C# coding standard'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-4210821496088743110</id><published>2008-08-22T23:19:00.000+06:00</published><updated>2008-08-22T23:23:27.495+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='ASP.NET'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Simple Web Application Installer with VS2008</title><content type='html'>&lt;p&gt;Hello all.&lt;/p&gt; &lt;p&gt;Today I will show how simple it is to make a web application installer with Visual Studio.&lt;/p&gt; &lt;p&gt;I have assumed that you have a project already open and now you want to make a installer for it.&lt;/p&gt; &lt;p&gt;First we have to add a new project from File-&amp;gt;Add-&amp;gt;New Project &lt;/p&gt; &lt;p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:342034c2-2669-4f75-9242-c94fcf559256" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh6.ggpht.com/tanvir.net/SK71piXZ1OI/AAAAAAAAAFg/bgPRMlNEGOM/1-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/tanvir.net/SK71uWe2omI/AAAAAAAAAFk/quxqIjoTERc/1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;Then we have to select &lt;/p&gt; &lt;p&gt;Other Project Type-&amp;gt;Setup &amp;amp; Deploy -&amp;gt; web setup project&lt;/p&gt; &lt;p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:1ce37da3-f8a4-4afa-a6bf-f564023c31d8" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh5.ggpht.com/tanvir.net/SK71wQ9FoWI/AAAAAAAAAFo/_KHErVVN-GI/2-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/tanvir.net/SK71z1966RI/AAAAAAAAAFs/MB1pYDA6mU0/2%5B1%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;I name it "WebSetupProject" . In Solution Explorer we will found that installer project.&lt;/p&gt; &lt;p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:fabd0732-f071-40e7-a264-d7a289dcc822" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/tanvir.net/SK7111raPDI/AAAAAAAAAFw/xE-mnWdibzY/3-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh5.ggpht.com/tanvir.net/SK714Zt9NiI/AAAAAAAAAF0/onNoWUw3qU0/3%5B7%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;Now we have to right click over the "WebSetupProject" and click on Bulild.&lt;/p&gt; &lt;p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:ebb3f642-338f-4d32-bef4-c2c5baf76679" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/tanvir.net/SK717A3tS1I/AAAAAAAAAF4/X0EdPWU_ygU/4-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/tanvir.net/SK71-Iex06I/AAAAAAAAAF8/Ht-2WCpvPAo/4%5B7%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;Our basic task is complete now we will get the installer in a the project's debug folder as bellow.&lt;/p&gt; &lt;p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:df05e3ba-b98d-4fa6-b701-49c3fca5c340" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh5.ggpht.com/tanvir.net/SK72AcNZXzI/AAAAAAAAAGA/zvMBxwpaCOE/5-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/tanvir.net/SK72C_9YzgI/AAAAAAAAAGE/jek5Je6ES78/5%5B1%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;Bye.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-4210821496088743110?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/4210821496088743110/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/08/simple-web-application-installer-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/4210821496088743110'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/4210821496088743110'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/08/simple-web-application-installer-with.html' title='Simple Web Application Installer with VS2008'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/tanvir.net/SK71uWe2omI/AAAAAAAAAFk/quxqIjoTERc/s72-c/1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-9185637519964559274</id><published>2008-08-09T12:22:00.000+06:00</published><updated>2008-08-09T12:23:34.927+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><title type='text'>Simple Excel Data read and save with C#.NET</title><content type='html'>&lt;p&gt;Hello All&lt;/p&gt; &lt;p&gt;Today i will demonstrate the process of Excel data read with both DataReader &amp;amp; DataSet . Though the Code is not optimize but its very simple to read a excel file in OLEDB.&lt;/p&gt; &lt;p&gt;In the example i have hard-coded the Excel file location named "&lt;strong&gt;&lt;em&gt;Book1.xls&lt;/em&gt;&lt;/strong&gt;", and the selected sheet is "&lt;strong&gt;&lt;em&gt;Sheet1&lt;/em&gt;&lt;/strong&gt;". We also have a database and a table in it named "&lt;strong&gt;&lt;em&gt;TableInfo&lt;/em&gt;&lt;/strong&gt;" where we will insert data after reading from excel file.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: blue"&gt;using &lt;/span&gt;System;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Data;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Data.SqlClient;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Data.OleDb;
&lt;span style="color: blue"&gt;using &lt;/span&gt;System.Collections;

&lt;span style="color: blue"&gt;namespace &lt;/span&gt;ExcelExport
{
    &lt;span style="color: blue"&gt;class &lt;/span&gt;&lt;span style="color: #2b91af"&gt;GenerateExcel
    &lt;/span&gt;{
        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;ArrayList &lt;/span&gt;ColumnNames;

        &lt;span style="color: blue"&gt;public &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataSet &lt;/span&gt;ReadExcell()
        {
            &lt;span style="color: #2b91af"&gt;String &lt;/span&gt;conStr = &lt;span style="color: #a31515"&gt;"Provider=Microsoft.Jet.OLEDB.4.0;" &lt;/span&gt;+ &lt;span style="color: #a31515"&gt;@"Data Source=C:\Documents and Settings\tanowar\Desktop\Excel\WinApp\ExcelExport\ExcelExport\Book1.xls;" &lt;/span&gt;+ &lt;span style="color: #a31515"&gt;"Extended Properties=Excel 8.0;"&lt;/span&gt;;
            &lt;span style="color: blue"&gt;string &lt;/span&gt;sqlConString = &lt;span style="color: #a31515"&gt;"Data Source=DtaBase;Initial Catalog=GPXPO;User ID=User;Password=XXX "&lt;/span&gt;;

            &lt;span style="color: #2b91af"&gt;SqlConnection &lt;/span&gt;sqlCon = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SqlConnection&lt;/span&gt;(sqlConString);          

            &lt;span style="color: #2b91af"&gt;OleDbConnection &lt;/span&gt;oleCon = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OleDbConnection&lt;/span&gt;(conStr);
            &lt;span style="color: #2b91af"&gt;DataSet &lt;/span&gt;ds = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;DataSet&lt;/span&gt;();

            &lt;span style="color: blue"&gt;try
            &lt;/span&gt;{
                &lt;span style="color: blue"&gt;#region &lt;/span&gt;DataSet

                oleCon.Open();                
                &lt;span style="color: #2b91af"&gt;OleDbCommand &lt;/span&gt;oleCmd = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OleDbCommand&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"select * from [Sheet1$]"&lt;/span&gt;, oleCon);

                &lt;span style="color: #2b91af"&gt;OleDbDataAdapter &lt;/span&gt;oleAd = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;OleDbDataAdapter&lt;/span&gt;();
                oleAd.SelectCommand = oleCmd;
                oleAd.Fill(ds);
                oleCon.Close();

                &lt;span style="color: blue"&gt;#endregion


                #region &lt;/span&gt;DataReader

                &lt;span style="color: #2b91af"&gt;OleDbDataReader &lt;/span&gt;reader = oleCmd.ExecuteReader();
                &lt;span style="color: blue"&gt;while &lt;/span&gt;(reader.Read())
                {
                    sqlCon.Open();                    
                    &lt;span style="color: #2b91af"&gt;SqlCommand &lt;/span&gt;sqlCmd = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;SqlCommand&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"insert into TableInfo (AllotNo,BankCode,LotteryNo,BONo,Name,Shares)values('"&lt;/span&gt;+reader[0].ToString() +&lt;span style="color: #a31515"&gt;"','"&lt;/span&gt;+reader[1].ToString() +&lt;span style="color: #a31515"&gt;"','"&lt;/span&gt;+reader[2].ToString() +&lt;span style="color: #a31515"&gt;"','"&lt;/span&gt;+reader[3].ToString() +&lt;span style="color: #a31515"&gt;"','"&lt;/span&gt;+reader[4].ToString() +&lt;span style="color: #a31515"&gt;"',"&lt;/span&gt;+reader[5].ToString() +&lt;span style="color: #a31515"&gt;")"&lt;/span&gt;,sqlCon);
                    sqlCmd.ExecuteNonQuery();
                    sqlCon.Close();
                }
               &lt;span style="color: blue"&gt;#endregion

            &lt;/span&gt;}
            &lt;span style="color: blue"&gt;catch &lt;/span&gt;(&lt;span style="color: #2b91af"&gt;Exception &lt;/span&gt;exc)
            {
                exc.ToString();                
            }
            &lt;span style="color: blue"&gt;return &lt;/span&gt;ds;
        }
    }
}
&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-9185637519964559274?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/9185637519964559274/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/08/simple-excel-data-read-and-save-with.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/9185637519964559274'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/9185637519964559274'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/08/simple-excel-data-read-and-save-with.html' title='Simple Excel Data read and save with C#.NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-5746001849992351544</id><published>2008-07-24T22:18:00.000+06:00</published><updated>2008-07-24T22:19:16.928+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Simple .NET Cookie Management</title><content type='html'>&lt;p&gt;Hello all&lt;/p&gt; &lt;p&gt;Today I will give a short description about using Cookie with .NET , Cookie is one of the most impotent thing to maintain scalability of server as well as manipulation user's information easier. Generally a Cookie enabled browser can store about 20 cookies for a single domain , so what's happen ;when you try to keep more cookie in a browser for a particular domain it discard the oldest cookie. If you don't set the expiration of a Cooke it will remain in memory till the browser session , when you close browser then the cookie is also expire , but when the expiration is set the the cookie is saved in hard drive.&lt;/p&gt; &lt;p&gt;We can manipulate the cookie in two ways as bellow.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: green"&gt;// First Example
 &lt;/span&gt;Response.Cookies[&lt;span style="color: #a31515"&gt;"index"&lt;/span&gt;].Value = &lt;span style="color: #a31515"&gt;"test value first"&lt;/span&gt;;
 Response.Cookies[&lt;span style="color: #a31515"&gt;"index"&lt;/span&gt;].Expires = &lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;.Now.AddDays(1);&lt;/pre&gt;&lt;pre class="code"&gt;&lt;span style="color: green"&gt;// Second example
&lt;/span&gt;&lt;span style="color: #2b91af"&gt;HttpCookie &lt;/span&gt;httpCookie = &lt;span style="color: blue"&gt;new &lt;/span&gt;&lt;span style="color: #2b91af"&gt;HttpCookie&lt;/span&gt;(&lt;span style="color: #a31515"&gt;"NewCookie"&lt;/span&gt;);
httpCookie.Value = &lt;span style="color: #a31515"&gt;"tast value second"&lt;/span&gt;;
httpCookie.Expires = &lt;span style="color: #2b91af"&gt;DateTime&lt;/span&gt;.Now.AddDays(1);
Response.Cookies.Add(httpCookie);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;To retrieve the Cookies information we have to do as following . But one thing we all should have to remember that each and ever time when we try to retrieve data from cookie we have to check that the cookie is no "&lt;strong&gt;&lt;em&gt;null". &lt;/em&gt;&lt;/strong&gt;If the cookie is null and we want to retrieve data from that cookie it will through an exception.&lt;/p&gt;&lt;pre class="code"&gt;&lt;span style="color: green"&gt;// First Example
&lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(Request.Cookies[&lt;span style="color: #a31515"&gt;"index"&lt;/span&gt;] != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    Response.Write(Request.Cookies[&lt;span style="color: #a31515"&gt;"index"&lt;/span&gt;].Value.ToString());
&lt;span style="color: blue"&gt;else
    &lt;/span&gt;Response.Write(&lt;span style="color: #a31515"&gt;"Cookie not set."&lt;/span&gt;);

&lt;span style="color: green"&gt;// Second example
&lt;/span&gt;&lt;span style="color: blue"&gt;if &lt;/span&gt;(Request.Cookies[&lt;span style="color: #a31515"&gt;"NewCookie"&lt;/span&gt;] != &lt;span style="color: blue"&gt;null&lt;/span&gt;)
    Response.Write(Request.Cookies[&lt;span style="color: #a31515"&gt;"NewCookie"&lt;/span&gt;].Value.ToString());
&lt;span style="color: blue"&gt;else
    &lt;/span&gt;Response.Write(&lt;span style="color: #a31515"&gt;"Second Cookie not set."&lt;/span&gt;);&lt;/pre&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;
&lt;p&gt;That's all for today .&lt;/p&gt;
&lt;p&gt;BYE&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-5746001849992351544?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/5746001849992351544/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/simple-net-cookie-management.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5746001849992351544'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5746001849992351544'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/simple-net-cookie-management.html' title='Simple .NET Cookie Management'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-1861540628337135845</id><published>2008-07-18T00:04:00.001+06:00</published><updated>2008-07-18T00:04:43.226+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='C#'/><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Easy dll using in Visual Studio</title><content type='html'>&lt;p&gt;Hello again&lt;/p&gt; &lt;p&gt;Today I will show how to use a .dll&amp;nbsp; file using Visual Studio. dll is nothing but the a complied managed code by .NET CLR (at least for this tutorial).&lt;/p&gt; &lt;p&gt;what I did is just wrote a simple class "Employee" in a new project named "EmployeeInformation". It has one property and a method jest to show that how to build a dll of a class and use it in another project.&lt;/p&gt; &lt;p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:ca712af4-064d-4437-a6cf-8df725e08f64" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh3.ggpht.com/tanvir.net/SH-JYO4f8HI/AAAAAAAAAEo/xwXoxk0TsR0/1-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/tanvir.net/SH-JbmLIOMI/AAAAAAAAAEs/QxOwCuuMMbI/1.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;Now i have build the class by right clicking over the project named "EmployeeInformation" and pressing build, For me a dll has been generated in "C:\Users\MD.Tanvir Anowar\Documents\Visual Studio 2008\Projects\RefTest\EmployeeInformation\bin\Debug\" directory named "EmployeeInformation.dll" you may found it in your Output panel at the bellow of VS after build the project.&lt;/p&gt; &lt;p&gt;Now I have to let the dll know by my main project "RefTest", to do this i have to right click on my "RefTest" project and Click over Add Reference .&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:d594a4e6-4b51-4a37-b61c-14cfc7f3de6a" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/tanvir.net/SH-Jd0JFlHI/AAAAAAAAAEw/zmnp5pEAoZ0/2-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/tanvir.net/SH-JhAtMEJI/AAAAAAAAAE0/Qdch0HrU10k/2.png" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;Now i have to browse and select the "EmployeeInformation.dll" &lt;/p&gt; &lt;p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:d6536e89-ad54-40da-9145-d7b5cafe127e" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/tanvir.net/SH-JkAFgyyI/AAAAAAAAAE4/mZ-x9YaYNXA/3-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/tanvir.net/SH-JoEbmdWI/AAAAAAAAAE8/d3Ob8y9TdEo/3.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;/p&gt; &lt;p&gt;to user the dll now we have to instantiate the class in our main porject's class by typing:&lt;/p&gt;&lt;pre class="code"&gt;EmployeeInformation.&lt;span style="color: #2b91af"&gt;Employee &lt;/span&gt;employee = &lt;span style="color: blue"&gt;new &lt;/span&gt;EmployeeInformation.&lt;span style="color: #2b91af"&gt;Employee&lt;/span&gt;();&lt;/pre&gt;
&lt;p&gt;&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;now in employee object we will get the our desire property of the class as following&lt;/p&gt;
&lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:418ac0db-68eb-488c-bf2d-50bc72e84543" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh5.ggpht.com/tanvir.net/SH-JqCe1qvI/AAAAAAAAAFA/iwkWQV3kGT8/4-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh5.ggpht.com/tanvir.net/SH-JtRXAkbI/AAAAAAAAAFE/mylwzq2PlY8/4.png" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;p&gt;Thank you.&lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-1861540628337135845?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/1861540628337135845/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/easy-dll-using-in-visual-studio.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1861540628337135845'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/1861540628337135845'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/easy-dll-using-in-visual-studio.html' title='Easy dll using in Visual Studio'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh6.ggpht.com/tanvir.net/SH-JbmLIOMI/AAAAAAAAAEs/QxOwCuuMMbI/s72-c/1.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-4234849884822291093</id><published>2008-07-13T18:14:00.000+06:00</published><updated>2008-07-13T18:15:30.995+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='Visual Studio'/><title type='text'>Simple multiple projects add to Visual Studio</title><content type='html'>&lt;p&gt;Hello all&lt;/p&gt; &lt;p&gt;Today I will explain how to add multiple project in Visual Studio .(That could be use for n-tier architecture or for other purpose). In .NET or in any language its wanted to fragment individual module of a system should have to be separated. In .NET we do this by adding multiple project in a single solution. &lt;/p&gt; &lt;p&gt;First open a new project ( in the example I have used new website named Emp ).&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:32729a62-643b-4113-9844-982f2fe7d91c" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/tanvir.net/SHnvzXKFJaI/AAAAAAAAADw/oh0UBCpFxec/1-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh3.ggpht.com/tanvir.net/SHnv2M61k8I/AAAAAAAAAD0/y7N5Fx87FcY/1%5B39%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;now add a new project from File &amp;gt; Add &amp;gt; New Project ( which will be a layer of Emp Website) &lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:81a0646d-6065-41a5-8362-5fdb711dcccc" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh6.ggpht.com/tanvir.net/SHnv4QnntwI/AAAAAAAAAD4/mvKciVtJNd4/2-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh4.ggpht.com/tanvir.net/SHnv7TihPGI/AAAAAAAAAD8/-4GJPVaqOlA/2%5B5%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;and then select Windows &amp;gt; &amp;gt; Class Library and give a name in the example I have named "DataAccessLayer".&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:30d3bce7-5927-4ca4-8d73-c10760a261a8" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh5.ggpht.com/tanvir.net/SHnv9pFtAwI/AAAAAAAAAEA/GK7ZqlJD95k/3-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh6.ggpht.com/tanvir.net/SHnwAii-ktI/AAAAAAAAAEE/UCPM33NXIwM/3%5B1%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;The initial task has been completed. Now in you solution explorer you will find new project named&amp;nbsp; "DataAccessLayer" and a default class named Class1.cs which you can rename according to your naming convention.&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:589d829d-f8af-4e46-af31-7b2933c1df18" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh6.ggpht.com/tanvir.net/SHnwCR5DmII/AAAAAAAAAEI/9N0_olUxJp4/4-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh3.ggpht.com/tanvir.net/SHnwEuBrn-I/AAAAAAAAAEM/BnUfnwXW2fc/4%5B7%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;Now the most vital thing to do is let our main website "Emp" be referenced with the "DataAccessLayer" project ,otherwise we will not be able to use the resource of "DataAccessLayer" in "Emp"&amp;nbsp; ! &lt;/p&gt; &lt;p&gt;To do that we have to select out website "Emp" and right click on it after that we have to select Add Reference .&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:4b5f2e08-9c72-4575-93d1-077a856ad924" style="padding-right: 0px; display: inline; padding-left: 0px; float: none; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/tanvir.net/SHnwGVI16qI/AAAAAAAAAEQ/qTtmgo1PMkI/5-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh5.ggpht.com/tanvir.net/SHnwKKq_JlI/AAAAAAAAAEU/obUIyAElga0/5%5B1%5D.png" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;After a short time a window will came named Add Reference, from there we have to select the Project tab and let select the desired project for us its "DataAccessLayer" then click ok.&lt;/p&gt; &lt;p&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:57a6ad8e-87ab-4691-a129-4c39001f154f" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh3.ggpht.com/tanvir.net/SHnwMvNvpSI/AAAAAAAAAEY/phz5snTCeQY/6-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh5.ggpht.com/tanvir.net/SHnwPjgxz0I/AAAAAAAAAEc/8ibwg1oPzZ0/6.png" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;the task is done now we will be able to use the "DataAccessLayer" project's resource from our "Emp" website .&lt;/p&gt; &lt;p&gt;There is little additional task to do ..&lt;/p&gt; &lt;blockquote&gt; &lt;p&gt;We have to define the name of the project&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/p&gt; &lt;p&gt;"&lt;span style="color: blue"&gt;using &lt;/span&gt;DataAccessLayer;"&amp;nbsp; at the top of the classes which will use the resource of the "DataAccessLayer" as following.&lt;/p&gt;&lt;/blockquote&gt; &lt;p&gt;&lt;/p&gt; &lt;div class="wlWriterSmartContent" id="scid:8747F07C-CDE8-481f-B0DF-C6CFD074BF67:83ea6c19-5b67-4fab-8a73-08467022e062" style="padding-right: 0px; display: inline; padding-left: 0px; padding-bottom: 0px; margin: 0px; padding-top: 0px"&gt;&lt;a href="http://lh4.ggpht.com/tanvir.net/SHnwTiokbgI/AAAAAAAAAEg/BkAZocs3Dkw/7-8x6.jpg" title="" rel="thumbnail"&gt;&lt;img border="0" src="http://lh3.ggpht.com/tanvir.net/SHnwWv6_N6I/AAAAAAAAAEk/RD8jMGofZIE/7.png" /&gt;&lt;/a&gt;&lt;/div&gt; &lt;p&gt;&lt;/p&gt; &lt;p&gt;that's all for today &lt;/p&gt; &lt;p&gt;Bye&amp;nbsp; &lt;/p&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-4234849884822291093?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/4234849884822291093/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/simple-multiple-project-add-to-visual.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/4234849884822291093'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/4234849884822291093'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/simple-multiple-project-add-to-visual.html' title='Simple multiple projects add to Visual Studio'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://lh3.ggpht.com/tanvir.net/SHnv2M61k8I/AAAAAAAAAD0/y7N5Fx87FcY/s72-c/1%5B39%5D.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-5498039182750003721</id><published>2008-07-12T17:27:00.002+06:00</published><updated>2010-01-05T09:57:12.490+06:00</updated><title type='text'>Simple XML parsing with XPath</title><content type='html'>&lt;h5&gt;Hello again. Today i will talk about how to purse XML simply with .NET's XPath features.We know XML now days gets very important thing for transferring or what ever. I will show how simply we can Purse a XML file.
Suppose we have a XML file named "Sample.xml" and the structure of that XML file is as bellow:&lt;/h5&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;?&lt;/span&gt;&lt;span class="html"&gt;xml&lt;/span&gt; &lt;span class="attr"&gt;version&lt;/span&gt;&lt;span class="kwrd"&gt;="1.0"&lt;/span&gt; &lt;span class="attr"&gt;encoding&lt;/span&gt;&lt;span class="kwrd"&gt;="utf-8"&lt;/span&gt; ?&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;items&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   3:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;item&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   4:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Tanvir&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   5:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;03-04304-3&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   6:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;item&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   7:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;item&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   8:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;Anowar&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;name&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   9:  &lt;/span&gt;    &lt;span class="kwrd"&gt;&amp;lt;&lt;/span&gt;&lt;span class="html"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;04-04304-2&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;id&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;  10:  &lt;/span&gt;  &lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;item&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;  11:  &lt;/span&gt;&lt;span class="kwrd"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="html"&gt;items&lt;/span&gt;&lt;span class="kwrd"&gt;&amp;gt;&lt;/span&gt;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;
&lt;pre class="code"&gt;&lt;span style="color:blue;"&gt;&lt;/span&gt;now open a Default.aspx page and import the sub class Xml,and Xml.XPath by writing as bellow:&lt;/pre&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="lnum"&gt;   1:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml;&lt;/pre&gt;&lt;pre&gt;&lt;span class="lnum"&gt;   2:  &lt;/span&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Xml.XPath;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;
&lt;pre class="code"&gt;Now making a XPathDocument document we can iterate our queries as given in nav.Select("/items/item/name") . here /items/item/name is our query ,where Items is the root node . item is the child node and name is our desired node which is going to be explored.
The following code is in C#.NET for exploring XML node with XPath.&lt;/pre&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt; XPathDocument xmlDoc = &lt;span class="kwrd"&gt;new&lt;/span&gt; XPathDocument(MapPath(&lt;span class="str"&gt;"Sample.xml"&lt;/span&gt;));&lt;/pre&gt;&lt;pre&gt; XPathNavigator nav = xmlDoc.CreateNavigator();&lt;/pre&gt;&lt;pre class="alt"&gt; XPathNodeIterator iterate = nav.Select(&lt;span class="str"&gt;"/items/item/name"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt; &lt;span class="kwrd"&gt;while&lt;/span&gt;(iterate.MoveNext())&lt;/pre&gt;&lt;pre class="alt"&gt; { &lt;/pre&gt;&lt;pre&gt;    Response.Write(iterate.Current.Name); &lt;span class="rem"&gt;// print the node name&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    Response.Write(&lt;span class="str"&gt;"&amp;amp;nbsp"&lt;/span&gt;);&lt;/pre&gt;&lt;pre&gt;    Response.Write(iterate.Current.Value); &lt;span class="rem"&gt;// print the value&lt;/span&gt;&lt;/pre&gt;&lt;pre class="alt"&gt;    Response.Write(&lt;span class="str"&gt;"&amp;lt;br /&amp;gt;"&lt;/span&gt;); &lt;/pre&gt;&lt;pre&gt;  }&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre&lt;br /&gt;{&lt;br /&gt; font-size: small;&lt;br /&gt; color: black;&lt;br /&gt; font-family: consolas, "Courier New", courier, monospace;&lt;br /&gt; background-color: #ffffff;&lt;br /&gt; /*white-space: pre;*/&lt;br /&gt;}&lt;br /&gt;.csharpcode pre { margin: 0em; }&lt;br /&gt;.csharpcode .rem { color: #008000; }&lt;br /&gt;.csharpcode .kwrd { color: #0000ff; }&lt;br /&gt;.csharpcode .str { color: #006080; }&lt;br /&gt;.csharpcode .op { color: #0000c0; }&lt;br /&gt;.csharpcode .preproc { color: #cc6633; }&lt;br /&gt;.csharpcode .asp { background-color: #ffff00; }&lt;br /&gt;.csharpcode .html { color: #800000; }&lt;br /&gt;.csharpcode .attr { color: #ff0000; }&lt;br /&gt;.csharpcode .alt &lt;br /&gt;{&lt;br /&gt; background-color: #f4f4f4;&lt;br /&gt; width: 100%;&lt;br /&gt; margin: 0em;&lt;br /&gt;}&lt;br /&gt;.csharpcode .lnum { color: #606060; }&lt;br /&gt;&lt;/style&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-5498039182750003721?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/5498039182750003721/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/simple-xml-pursing-with-xpath_12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5498039182750003721'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5498039182750003721'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/simple-xml-pursing-with-xpath_12.html' title='Simple XML parsing with XPath'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-6787139834758321134</id><published>2008-07-12T17:17:00.001+06:00</published><updated>2008-07-12T17:55:34.832+06:00</updated><title type='text'>Simple Mail send Through .NET</title><content type='html'>&lt;p&gt;Hello all ,&lt;br&gt;Today i will describe how to send mail through .NET&lt;br&gt;First we have to configure the SMTP mail server . In this context i have assumed you mail server has been configured (including web.config ).&lt;br&gt;Now we have to import&lt;/p&gt; &lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Net;&lt;/pre&gt;&lt;pre&gt;&lt;span class="kwrd"&gt;using&lt;/span&gt; System.Net.Mail;&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;

&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;pre class="code"&gt;And through the following code we will able to send mail with attachment.&lt;/pre&gt;
&lt;div class="csharpcode"&gt;&lt;pre class="alt"&gt;MailMessage msg = &lt;span class="kwrd"&gt;new&lt;/span&gt; MailMessage();&lt;/pre&gt;&lt;pre&gt;msg.From = &lt;span class="kwrd"&gt;new&lt;/span&gt; MailAddress(&lt;span class="str"&gt;"mail@test.com"&lt;/span&gt;);&lt;/pre&gt;&lt;pre class="alt"&gt;msg.To.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; MailAddress(&lt;span class="str"&gt;"mail_1@test.com"&lt;/span&gt;));&lt;/pre&gt;&lt;pre&gt;msg.To.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; MailAddress(&lt;span class="str"&gt;"mail_2@test.com"&lt;/span&gt;));&lt;/pre&gt;&lt;pre class="alt"&gt;msg.CC.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; MailAddress(&lt;span class="str"&gt;"mail_3@test.com"&lt;/span&gt;));&lt;/pre&gt;&lt;pre&gt;msg.Bcc.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; MailAddress(&lt;span class="str"&gt;"mail_4@test.com"&lt;/span&gt;));&lt;/pre&gt;&lt;pre class="alt"&gt;msg.Attachments.Add(&lt;span class="kwrd"&gt;new&lt;/span&gt; Attachment(&lt;span class="str"&gt;@"c:\file.txt"&lt;/span&gt;));&lt;/pre&gt;&lt;pre&gt;msg.Subject = &lt;span class="str"&gt;"This is a test mail"&lt;/span&gt;;&lt;/pre&gt;&lt;pre class="alt"&gt;msg.Body = &lt;span class="str"&gt;"This is the body of the mail"&lt;/span&gt;;&lt;/pre&gt;&lt;pre&gt;SmtpClient client = &lt;span class="kwrd"&gt;new&lt;/span&gt; SmtpClient();&lt;/pre&gt;&lt;pre class="alt"&gt;client.Send(msg);&lt;/pre&gt;&lt;/div&gt;
&lt;style type="text/css"&gt;.csharpcode, .csharpcode pre
{
	font-size: small;
	color: black;
	font-family: consolas, "Courier New", courier, monospace;
	background-color: #ffffff;
	/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt 
{
	background-color: #f4f4f4;
	width: 100%;
	margin: 0em;
}
.csharpcode .lnum { color: #606060; }
&lt;/style&gt;
&lt;a href="http://11011.net/software/vspaste"&gt;&lt;/a&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-6787139834758321134?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/6787139834758321134/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/simple-mail-send-through-net_12.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/6787139834758321134'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/6787139834758321134'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/simple-mail-send-through-net_12.html' title='Simple Mail send Through .NET'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-5960168345713529247</id><published>2008-07-05T20:23:00.001+06:00</published><updated>2008-07-05T20:26:58.384+06:00</updated><title type='text'>Event fire at certain time.</title><content type='html'>(This article is taken from one of my other blog.)

from few days one thing is clicking in my head very simple but not initiated before.so i have posted the problem in phpfreaks forum and got some useful solutions :

&lt;span style="color: rgb(102, 102, 204);"&gt;#1 :

&lt;/span&gt;&lt;span style="color: rgb(102, 102, 204);"&gt;hi&lt;/span&gt;

&lt;span style="color: rgb(102, 102, 204);"&gt;i want to know how to run continuous service which is written in php? for example : i want to inform through email to my clients in a particular time automatically , how to do it ? &lt;/span&gt;

&lt;span style="color: rgb(102, 102, 204);"&gt;Thanking you&lt;/span&gt;
&lt;span style="color: rgb(102, 102, 204);"&gt;Tanvir.

&lt;/span&gt;&lt;div class="quote"&gt;=&gt; Cron job.
&lt;/div&gt;

&lt;span style="color: rgb(102, 102, 204);"&gt;# 2 :&lt;/span&gt;

&lt;span style="color: rgb(102, 51, 255);"&gt;but there is one question more, if i use corn job then i must have access to modify the etc/corntab in any linux server, generally when we hosting a site then we dont have the permission to modify any server scripts like corntab unless its a dedicated server. is there any other solution to do the job avoiding this problem?&lt;/span&gt;

=&gt;If you don't have access to the crontab, then you most certainly won't have access to the init scripts required to run a service.

=&gt; ot entirely true. On many 'shared' hosting plans that use stuff like cpanel, they will allow you to set up your own cron jobs. Fairly easily too.

=&gt;if not many people provide external crontab access so that you can have a psedo cron tab by having another server ping your cron job page. they might cost you a monthly fee, but it be better than switching hosting companies&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-5960168345713529247?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/5960168345713529247/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/event-fire-at-certain-time.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5960168345713529247'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5960168345713529247'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/event-fire-at-certain-time.html' title='Event fire at certain time.'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-5181519265148940642</id><published>2008-07-05T18:09:00.000+06:00</published><updated>2008-07-05T18:47:41.028+06:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='SQL'/><title type='text'>Easy Northwind Database installation.</title><content type='html'>Its pretty much needed to work with a existing relational database to test any new features of a language,but its really tough to get it at the right moment. We can easily get one from Microsoft's Northwind database.First we have to install SQL Server Management Studio and then download the sample database form &lt;a href="http://www.microsoft.com/downloads/details.aspx?familyid=06616212-0356-46a0-8da2-eebc53a68034&amp;amp;displaylang=en"&gt;here&lt;/a&gt; . After installing the SampleDB, it will create a directory named "C:\SQL Server 2000 Sample Databases" . In this Database we will get some files including NORTHWND.MDF.To use it, first we have some inital tasks to do ...

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_NL2fAc4la4o/SG9qdZsk4aI/AAAAAAAAABw/VlbcqF1_dVs/s1600-h/nw1.jpg"&gt;&lt;img style="margin: 0pt 10px 10px 0pt; float: left; cursor: pointer; width: 339px; height: 224px;" src="http://bp2.blogger.com/_NL2fAc4la4o/SG9qdZsk4aI/AAAAAAAAABw/VlbcqF1_dVs/s320/nw1.jpg" alt="" id="BLOGGER_PHOTO_ID_5219507546492297634" border="0" /&gt;&lt;/a&gt;













1. In the first step we have to double click on "instnwnd.sql" which is in the  "C:\SQL Server 2000 Sample Databases" folder , after click SQL Server Management Studio will automaticly open then we have to press the "Execute" button.

&lt;a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_NL2fAc4la4o/SG9sollTWFI/AAAAAAAAAB4/SAMd3k8XqkQ/s1600-h/nw2.jpg"&gt;&lt;img style="cursor: pointer;" src="http://bp2.blogger.com/_NL2fAc4la4o/SG9sollTWFI/AAAAAAAAAB4/SAMd3k8XqkQ/s320/nw2.jpg" alt="" id="BLOGGER_PHOTO_ID_5219509937684830290" border="0" /&gt;&lt;/a&gt;

2. In the similar way we also wave to double click on "instpubs.sql" and do the same thing.

after that when we connect our SQL server we foud our desired NORTHWIND database .

in the above topic i have escaped many vital technical issues just to make the article simple any easy to read as well as easy to impliment. hope it will work.

have a nice day.&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-5181519265148940642?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/5181519265148940642/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/easy-northwind-database-installation.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5181519265148940642'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/5181519265148940642'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2008/07/easy-northwind-database-installation.html' title='Easy Northwind Database installation.'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://bp2.blogger.com/_NL2fAc4la4o/SG9qdZsk4aI/AAAAAAAAABw/VlbcqF1_dVs/s72-c/nw1.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-324225979025405257.post-3790320681023104130</id><published>2008-06-24T09:24:00.000+06:00</published><updated>2009-06-25T09:37:56.315+07:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='link'/><title type='text'>LINK Exchange</title><content type='html'>&lt;a href="http://www.crystal-co.com/" title="The Crystal Company" target="_blank"&gt;The Crystal Company&lt;/a&gt;&lt;br&gt;Retailer of crystal gifts. Link partner for home improvement, construction, online, jobs, legal, lawyer, blogs, jewelry, web design &amp; hosting, real estate, finance, financial, travel, business, shopping, gambling, insurance &amp;  mortgage, house sites. 		 &lt;br /&gt;  &lt;a href="http://www.linkmarket.net/" title="Link Market - Free Link Exchange, Link Swap and Link Trade Directory" target="_blank"&gt;Link Market - Free Link Exchange, Link Swap and Link Trade Directory&lt;/a&gt;&lt;br&gt;Have you ever tried to exchange links, swap links, or trade links? Was it hard? Use link market instead; - it is easy to use, free and very smart. It will save you hours of work. 		&lt;br /&gt; &lt;a href="http://www.homeoptionstrading.com/" title="Stock Option Trading" target="_blank"&gt;Stock Option Trading&lt;/a&gt;&lt;br&gt;55 hours of online options trading strategies, consistent profit with stock option trading for a living, how to trade options consistently for profit. 			    &lt;br /&gt; &lt;a href="http://www.wind-chime.biz/" title="The Wind Chime Company" target="_blank"&gt;The Wind Chime Company&lt;/a&gt;&lt;br&gt;Retailer of wind chimes. Link partner for home improvement, construction, online, jobs, legal, lawyer, blogs, jewelry, web design hosting, real estate, finance, financial, travel, business, shopping, gambling, insurance &amp;  mortgage, house site 			    &lt;br /&gt; &lt;a href="http://www.home-decorating-co.com/" title="The Home Decorating Company" target="_blank"&gt;The Home Decorating Company&lt;/a&gt;&lt;br&gt;Retailers of bedding &amp; home decor. Link partner for home improvement, construction, online, jobs, legal, lawyer, blogs, jewelry, web design &amp; hosting, real estate, finance, financial, travel, business, shopping, gambling, insurance &amp;  mortgage sites 			    &lt;br /&gt; &lt;a href="http://www.platformbedscompany.com/" title="The Platform Beds Company" target="_blank"&gt;The Platform Beds Company&lt;/a&gt;&lt;br&gt;Retailer of platform beds. Link partner for home improvement, construction, online, jobs, legal, lawyer, blogs, jewelry, web design &amp; hosting, real estate, finance, financial, travel, business, shopping, gambling, insurance &amp;  mortgage, house sites. 	 &lt;br /&gt; &lt;a href="http://www.vietnamcruisetours.com/" title="Mekong Delta Tours" target="_blank"&gt;Mekong Delta Tours&lt;/a&gt;&lt;br&gt;Vietnam cruise tours, halong bay cruises, mekong delta cruise, mekong delta tours, mekong river travel, halong bay tours  &lt;br /&gt; &lt;a href="http://www.baby-bedding-co.com/" title="The Baby Bedding Company" target="_blank"&gt;The Baby Bedding Company&lt;/a&gt;&lt;br&gt;Retailer of baby bedding. Link partner for home improvement, construction, online, jobs, legal, lawyer, blogs, jewelry, web design hosting, real estate, finance, financial, travel, business, shopping, gambling, insurance &amp;  mortgage, house site 	 &lt;br /&gt; &lt;a href="http://www.grandfatherclockscompany.com/" title="The Grandfather Clocks Company" target="_blank"&gt;The Grandfather Clocks Company&lt;/a&gt;&lt;br&gt;Retailer of grandfather clocks. Link partner for home improvement, construction, online, jobs, legal, lawyer, blogs, jewelry, web design hosting, real estate, finance, financial, travel, business, shopping, gambling, insurance &amp;  mortgage, house site 			    &lt;br /&gt; &lt;a href="http://www.thelucrativeinvestor.com/" title="Investing" target="_blank"&gt;Investing&lt;/a&gt;&lt;br&gt;Visit lucrative investing. Free investment picks, services, resources, and news for the average investor to help level the playing field. We help make every investment a lucrative one. ***webmasters we are a "do" follow blog. *** 	 &lt;br /&gt; &lt;a href="http://www.water-fountain.biz/" title="The Water Fountains Company" target="_blank"&gt;The Water Fountains Company&lt;/a&gt;&lt;br&gt;Retailer of water fountains &amp; ponds. Link partner for home improvement, construction, online, jobs, legal, lawyer, blogs, jewelry, web design &amp; hosting, real estate, finance, financial, travel, business, shopping, gambling, insurance &amp;  mortgage site  &lt;br /&gt; &lt;a href="http://www.actionprintinginc.com/" title="Promotional Items" target="_blank"&gt;Promotional Items&lt;/a&gt;&lt;br&gt;The super store for promotional items and promotional products. Over 950 000 custom promotional products and business promotional items for trade show giveaways, corporate gifts, school promotions and business advertising. 	 &lt;br /&gt; &lt;a href="http://www.sulubancliffbali.com/" title="Luxury Bali Villas" target="_blank"&gt;Luxury Bali Villas&lt;/a&gt;&lt;br&gt;Sulubancliffbali is the premium luxury villa located at the southwest tip of bali. 	   &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/324225979025405257-3790320681023104130?l=tanvirdotnet.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://tanvirdotnet.blogspot.com/feeds/3790320681023104130/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/06/link-exchange.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/3790320681023104130'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/324225979025405257/posts/default/3790320681023104130'/><link rel='alternate' type='text/html' href='http://tanvirdotnet.blogspot.com/2009/06/link-exchange.html' title='LINK Exchange'/><author><name>Tanvir Anowar</name><uri>http://www.blogger.com/profile/14468405737071617016</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry></feed>
