<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Act Code</title>
	<atom:link href="http://actcode.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://actcode.com</link>
	<description></description>
	<lastBuildDate>Thu, 14 Apr 2011 09:11:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>Load balancing</title>
		<link>http://actcode.com/2010/12/load-balancing/</link>
		<comments>http://actcode.com/2010/12/load-balancing/#comments</comments>
		<pubDate>Thu, 16 Dec 2010 14:29:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[Load balancing]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=39</guid>
		<description><![CDATA[From past few days I was spending time on network load balancing for web servers and found some basic concept about it. 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. [...]]]></description>
			<content:encoded><![CDATA[<p>From past few days I was spending time on network load balancing for web servers and found some basic concept about it.
<p>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.
<p>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.
<p>The main reasons of load balancing are minimize response time, maximize user of resource utilization, maximize throughput and so on.
<p><b><u>Load balancing solutions :</u></b> 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.
<p><a href="http://lh6.ggpht.com/_NL2fAc4la4o/TY9J1tB82YI/AAAAAAAABGY/TVd1Ca0pJYA/s1600-h/Image%5B3%5D.png"><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"></a>
<p><b><u><br /></u></b>
<p><b><u>Persistence problem:</u></b> 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.
<p>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.
<p>That’s all for now .
<p>Bye</p>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2010/12/load-balancing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Observer Pattern &#8211; implementation and application with C#.NET</title>
		<link>http://actcode.com/2010/09/observer-pattern-implementation-and-application-with-c-net/</link>
		<comments>http://actcode.com/2010/09/observer-pattern-implementation-and-application-with-c-net/#comments</comments>
		<pubDate>Tue, 07 Sep 2010 09:17:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[C#]]></category>
		<category><![CDATA[Design Pattern]]></category>
		<category><![CDATA[OOP]]></category>
		<category><![CDATA[UML]]></category>
		<category><![CDATA[Observer Pattern]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=38</guid>
		<description><![CDATA[Hello All 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. First come to what is Observer Patter, as per Wikipedia the general definition of Observer pattern is as bellow: “The observer pattern (a subset of the publish/subscribe [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All</p>
<p>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.</p>
<p>First come to what is Observer Patter, as per Wikipedia the general definition of Observer pattern is as bellow:</p>
<p>“<i>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.</i>”</p>
<p>The UML diagram of basic observer pattern is as bellow:</p>
<p><a href="http://lh6.ggpht.com/_NL2fAc4la4o/TIYDWdIKBMI/AAAAAAAABEo/6xH9aOrGirE/s1600-h/clip_image0024.gif"><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" /></a></p>
<p>How actually this pattern works?</p>
<p>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.</p>
<p>Example:</p>
<p>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.</p>
<p>In the following C# code example I will try to pull out the gist of Observer pattern as per our above description.</p>
<p>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; 1 interface and 1 concrete class of Subject’s.</p>
<p><strong><u>IObserver Interface: </u></strong></p>
<p>This interface contains 2 method signatures. One is Update and another is ShowData.</p>
<pre class="csharpcode"><span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">namespace</span> ObserverPattern
{
 <span class="kwrd">interface</span> IObserver
  {
 <span class="kwrd">void</span> Update(Dictionary&lt;<span class="kwrd">string</span>, <span class="kwrd">float</span>&gt; stocks);
     <span class="kwrd">void</span> ShowData();
  }
}</pre>
<style type="text/css">
.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; }</style>
<div id="codeSnippetWrapper"><strong><u>FirstObserver concrete class:</u></strong></div>
<p>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.</p>
<pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">namespace</span> ObserverPattern{
  <span class="kwrd">class</span> FirstObserver : IObserver
   {
 <span class="kwrd">private</span> Dictionary&lt;<span class="kwrd">string</span>, <span class="kwrd">float</span>&gt; _stocks;
      <span class="kwrd">public</span> <span class="kwrd">void</span> Update(Dictionary&lt;<span class="kwrd">string</span>, <span class="kwrd">float</span>&gt; newData)
      {            <span class="kwrd">this</span>._stocks = newData;
       <span class="kwrd">this</span>.ShowData();
      }
  <span class="kwrd">public</span> <span class="kwrd">void</span> ShowData()
       {            Console.WriteLine(<span class="str">&quot;First Securities LTD&quot;</span>);
        <span class="kwrd">foreach</span>( KeyValuePair&lt;<span class="kwrd">string</span>,<span class="kwrd">float</span>&gt; data <span class="kwrd">in</span> _stocks)
        {
            Console.WriteLine(<span class="str">&quot;Current price of {0} is now {1}&quot;</span>,data.Key,data.Value);
        }
       }
   }
}</pre>
<style type="text/css">
.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; }</style>
<div id="codeSnippetWrapper"><u><strong>SecondObserver concrete class:</strong></u></div>
<p>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&#160; be unsubscribe latter.</p>
<div id="codeSnippetWrapper">
<pre style="border-bottom-style: none; text-align: left; padding-bottom: 0px; line-height: 12pt; background-color: #f4f4f4; margin: 0em; border-left-style: none; padding-left: 0px; width: 100%; padding-right: 0px; font-family: &#39;Courier New&#39;, courier, monospace; direction: ltr; border-top-style: none; color: black; border-right-style: none; font-size: 8pt; overflow: visible; padding-top: 0px" id="codeSnippet"><span style="color: #0000ff">
<pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">namespace</span> ObserverPattern
{
 <span class="kwrd">class</span> SecondObserver : IObserver
    {
      <span class="kwrd">private</span> Dictionary&lt;<span class="kwrd">string</span>, <span class="kwrd">float</span>&gt; _stocks;  

      <span class="kwrd">public</span> <span class="kwrd">void</span> Update(Dictionary&lt;<span class="kwrd">string</span>, <span class="kwrd">float</span>&gt; newData)
      {
       <span class="kwrd">this</span>._stocks = newData;
       <span class="kwrd">this</span>.ShowData();
     }

   <span class="kwrd">public</span> <span class="kwrd">void</span> ShowData()
    {
         Console.WriteLine(<span class="str">&quot;Second Securities LTD&quot;</span>);
         <span class="kwrd">foreach</span> (KeyValuePair&lt;<span class="kwrd">string</span>, <span class="kwrd">float</span>&gt; data <span class="kwrd">in</span> _stocks)
         {
           Console.WriteLine(<span class="str">&quot;Current price of {0} is now {1}&quot;</span>, data.Key, data.Value);
          }
     }
 }</pre>
<pre class="csharpcode">}
</span></pre>
</pre>
</div>
<p><strong><u>ISubject Interface:</u></strong></p>
<p>This interface contains 3 main method&#8217;s&#160; signature 1.RegisterObserver 2.RemoveObserver 3.NotifyObservers</p>
<p>RegisterObserver method register an observe in subject’s observer list.</p>
<p>RemoveObserver method unregister an observer from the subject’s observer list.</p>
<p>NotifyObservers method is responsible to notify all objects which are subscribed to the server .</p>
<pre class="csharpcode"><span class="kwrd">namespace</span> ObserverPattern
{
  <span class="kwrd">interface</span> ISubject
  {
     <span class="kwrd">void</span> RegisterObserver(IObserver o);
     <span class="kwrd">void</span> RemoveObserver(IObserver o);
     <span class="kwrd">void</span> NotifyObservers();
   }
}</pre>
<style type="text/css">
.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; }</style>
<p>StockSubject concrete class:</p>
<div>We have implemented ISubject interface in this class and proceeded accordingly.</div>
<pre class="csharpcode"><span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">namespace</span> ObserverPattern
{
<span class="kwrd">class</span> StockSubject : ISubject
   {
 <span class="kwrd">private</span> List&lt;IObserver&gt; _observers = <span class="kwrd">new</span> List&lt;IObserver&gt;();
 <span class="kwrd">private</span> Dictionary&lt;<span class="kwrd">string</span>, <span class="kwrd">float</span>&gt; _stocks;
<span class="kwrd">public</span> <span class="kwrd">void</span> RegisterObserver(IObserver o)
 {
 _observers.Add(o);
        }
<span class="kwrd">public</span> <span class="kwrd">void</span> RemoveObserver(IObserver o)
 {
_observers.Remove(o);
 }
 <span class="kwrd">public</span> <span class="kwrd">void</span> NotifyObservers()
{
<span class="kwrd">foreach</span>(IObserver observer <span class="kwrd">in</span> _observers)
 {
 observer.Update(_stocks);
 }
 }
 <span class="kwrd">public</span> <span class="kwrd">void</span> setStockPriceInformation(Dictionary&lt;<span class="kwrd">string</span>,<span class="kwrd">float</span>&gt; newData)
 {
 <span class="kwrd">this</span>._stocks = newData;
 <span class="kwrd">this</span>.NotifyObservers();
 }
}
}</pre>
<div>Now in the runner class “Program” we have implemented our application where we have added two observers and letter removed one observer at runtime. </div>
<pre class="csharpcode"><span class="kwrd">using</span> System;
<span class="kwrd">using</span> System.Collections.Generic;
<span class="kwrd">namespace</span> ObserverPattern{
 <span class="kwrd">class</span> Program
  {
<span class="kwrd">static</span> <span class="kwrd">void</span> Main(<span class="kwrd">string</span>[] args)
 {
StockSubject stockSubject = <span class="kwrd">new</span> StockSubject();
 var firstObserver = <span class="kwrd">new</span> FirstObserver();
 var secondObserver = <span class="kwrd">new</span> SecondObserver();
stockSubject.RegisterObserver(firstObserver);
 stockSubject.RegisterObserver(secondObserver);
            var dataSet = <span class="kwrd">new</span> Dictionary&lt;<span class="kwrd">string</span>,<span class="kwrd">float</span>&gt;();
  dataSet.Add(<span class="str">&quot;Google Inc&quot;</span>, 500.25f);
  dataSet.Add(<span class="str">&quot;Micorsoft&quot;</span>,400.15f);
 stockSubject.setStockPriceInformation(dataSet);
  dataSet.Clear();
dataSet.Add(<span class="str">&quot;Google Inc&quot;</span>, 330.25f);
 dataSet.Add(<span class="str">&quot;Micorsoft&quot;</span>, 550.15f);
 stockSubject.RemoveObserver(secondObserver);
 stockSubject.setStockPriceInformation(dataSet);
Console.ReadKey();
 }
 }
}</pre>
<div><strong><u>Output :</u></strong></div>
<div>&#160;</div>
<div><a href="http://lh5.ggpht.com/_NL2fAc4la4o/TIYDYHq67WI/AAAAAAAABEw/TjPuVfGNyk0/s1600-h/output%5B5%5D.gif"><img style="border-right-width: 0px; display: inline; border-top-width: 0px; border-bottom-width: 0px; border-left-width: 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" /></a>&#160; </div>
<div>Ok that’s it for today . Let me know if you have any concern regarding this pattern or code.</div>
<div>&#160;</div>
<div>Take care</div>
<div>Bye </div>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2010/09/observer-pattern-implementation-and-application-with-c-net/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Git in Windows with TortoiseGIT client &amp; ProjectLocker free Git Hosting</title>
		<link>http://actcode.com/2010/06/git-in-windows-with-tortoisegit-client-projectlocker-free-git-hosting/</link>
		<comments>http://actcode.com/2010/06/git-in-windows-with-tortoisegit-client-projectlocker-free-git-hosting/#comments</comments>
		<pubDate>Sun, 06 Jun 2010 06:57:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=37</guid>
		<description><![CDATA[Hello All Hope you all are fine. Today I will show how to work with Git in windows environment with TortoiseGIT client &#38; 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. Now [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All</p>
<p>Hope you all are fine. Today I will show how to work with Git in windows environment with TortoiseGIT client &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. </p>
<p>Now first do signup from <a title="https://www.projectlocker.com/signup/startup" href="https://www.projectlocker.com/signup/startup">https://www.projectlocker.com/signup/startup</a> ( I will show through a free plan) , After signing up verify your account and login through <a title="https://portal.projectlocker.com/" href="https://portal.projectlocker.com/">https://portal.projectlocker.com/</a> . You will find “<strong>Account Links </strong>&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”.</p>
<p>In the next step you have to create user account from “<strong>Account Links </strong>&gt; Add User”. Now you have to create a Public Key for your repository.</p>
<p>First download PuttyGen from the [ <a href="http://the.earth.li/~sgtatham/putty/0.60/x86/puttygen.exe">link</a> ] 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.</p>
<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"><a href="http://lh4.ggpht.com/_NL2fAc4la4o/TAvkD3qho5I/AAAAAAAABCY/Srm3CRXw4PE/18x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/TAvkHD9wjbI/AAAAAAAABCc/RDAHnrc2cxk/11.png?imgmax=800" width="420" height="379" /></a></div>
<p>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)</p>
<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"><a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkLY28rlI/AAAAAAAABCg/pW3zmvwSrIw/28x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkSYo8MBI/AAAAAAAABCk/8PpNXhDT_uQ/21.png?imgmax=800" width="420" height="382" /></a></div>
<p>Its time to get back in ProjectLocker <img src='http://actcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  .&nbsp; Click manage public key from “<strong>User Links</strong> &gt; Manage Public Keys” and click “New Key”. Then pest&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”:</p>
<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"><a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkWWwYdxI/AAAAAAAABCo/uNCUvBTLjH0/38x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkaEv1eDI/AAAAAAAABCs/1-paqXbzORQ/34.png?imgmax=800" width="580" height="405" /></a></div>
<p>Open list projects from “Account Links &gt; List Projects” and select your desired project from the Name column (I’m selecting DemoGit for the demonstration purpose.) as bellow: </p>
<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"><a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvkbu-RbcI/AAAAAAAABCw/6ULPAdzaOJc/48x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvkfNNaq3I/AAAAAAAABC0/mB2ZJmNh938/41.png?imgmax=800" width="580" height="229" /></a></div>
</p>
<p>Now assign the user to the project from the user list bellow by clicking “Add To Project” corresponding user.</p>
</p>
<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"><a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvkhz7oWmI/AAAAAAAABC4/8H4BtxYDkNI/68x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/TAvkmf3rFEI/AAAAAAAABC8/jZVOqimkSEg/61.png?imgmax=800" width="420" height="400" /></a></div>
<p>It’s the time to play with Git client software. For this, first we have to install&nbsp; msysgit from <a title="http://code.google.com/p/msysgit/downloads/list" href="http://code.google.com/p/msysgit/downloads/list">http://code.google.com/p/msysgit/downloads/list</a> after that TortoisGIT from <a title="http://code.google.com/p/tortoisegit/downloads/list" href="http://code.google.com/p/tortoisegit/downloads/list">http://code.google.com/p/tortoisegit/downloads/list</a> accordingly with next,next flow (I mean default settings, you don’t have to change any settings over there ) and reboot your machine.</p>
<p>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:</p>
<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"><a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvkq_h4LZI/AAAAAAAABDA/g8iDQGFMPdY/78x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvkw5cLeNI/AAAAAAAABDE/2tQ51JiTows/76.png?imgmax=800" width="580" height="374" /></a></div>
<p>Now in the next panel you have to pest the Url (git repository location , you will get it from “<strong>User Links</strong> &gt; User Home” like the image bellow ) and locate the private key which we have generated earlier (for me its demokey.ppk) </p>
<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"><a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvkyF8pjhI/AAAAAAAABDI/TJw1Cetlrog/98x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvkzxY37xI/AAAAAAAABDM/F-592iim0kI/91.png?imgmax=800" width="420" height="153" /></a></div>
</p>
<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"><a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvk2qJFmEI/AAAAAAAABDQ/nDHxvIznSD0/88x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/TAvk7CGDKoI/AAAAAAAABDU/gl4sa_QPQYA/81.png?imgmax=800" width="420" height="330" /></a></div>
<p>Now you have to enter passphrase which you have set during key generation.</p>
<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"><a href="http://lh6.ggpht.com/_NL2fAc4la4o/TAvk8yYLiiI/AAAAAAAABDY/ycVlYEOqE7Q/108x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh5.ggpht.com/_NL2fAc4la4o/TAvk_mFfnkI/AAAAAAAABDc/ZGz6pxYiv48/10.png?imgmax=800" width="335" height="208" /></a></div>
<p>That’s it , we have successfully configured our repository with TortoiseGIT client.</p>
<p>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.</p>
<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"><a href="http://lh4.ggpht.com/_NL2fAc4la4o/TAvlCAXsCjI/AAAAAAAABDg/Hm4mhwKWBls/118x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/TAvlGKFrAXI/AAAAAAAABDk/JkL_Cw5qBWU/111.png?imgmax=800" width="580" height="529" /></a></div>
<p>Then confirm the add operation :</p>
<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"><a href="http://lh4.ggpht.com/_NL2fAc4la4o/TAvlKDMwFgI/AAAAAAAABDo/gJ5vkD11PRQ/128x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvlNBoWONI/AAAAAAAABDs/GSmdjxWwYGs/12.png?imgmax=800" width="335" height="272" /></a></div>
</p>
<p>Now you have to do as per following image sequence to push the fine into server.</p>
<p>We are going to change some text in our file and give Git Commite as per image bellow:</p>
</p>
<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"><a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvlOxjWsvI/AAAAAAAABDw/m5-5LCU88kA/158x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/TAvlSimhcXI/AAAAAAAABD0/Thbo9tPQ-38/15.png?imgmax=800" width="335" height="243" /></a></div>
</p>
<p>We have to put a message before committing something into our brunch in Message section, We also can put signed off signature as bellow: </p>
</p>
<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"><a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvlX8xI7II/AAAAAAAABD4/ippkeF7Rc-c/168x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvlm3Hb_fI/AAAAAAAABD8/MTT8WRQ2evo/161.png?imgmax=800" width="385" height="420" /></a></div>
</p>
<p>To finally push the file into server we have to click push :</p>
<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"><a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvlr3XSCtI/AAAAAAAABEA/PZAgrO36e_g/138x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/TAvluD4KLiI/AAAAAAAABEE/XP1n6AyHJ-I/131.png?imgmax=800" width="420" height="317" /></a></div>
</p>
<p>And the we have to select in which brunch we should to push in server and click ok.</p>
</p>
<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"><a href="http://lh6.ggpht.com/_NL2fAc4la4o/TAvlwiTQxtI/AAAAAAAABEI/xEWUPuKTBmg/148x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/TAvly7k9bzI/AAAAAAAABEM/XUTsLIVE8Ec/142.png?imgmax=800" width="420" height="350" /></a></div>
</p>
<p>No to sink with others commit we have to update the code base as bellow.</p>
<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"><a href="http://lh5.ggpht.com/_NL2fAc4la4o/TAvl0XMA46I/AAAAAAAABEQ/3200K1hcuSo/178x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/TAvl5dm3gFI/AAAAAAAABEU/vTXqTnjqvCE/17.png?imgmax=800" width="335" height="222" /></a></div>
</p>
<p>Then select “Pull” as bellow:</p>
<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"><a href="http://lh3.ggpht.com/_NL2fAc4la4o/TAvl_ZFGkQI/AAAAAAAABEY/GGL3hfb879w/188x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh5.ggpht.com/_NL2fAc4la4o/TAvmCyS2API/AAAAAAAABEc/P09_wI7APJg/182.png?imgmax=800" width="580" height="504" /></a></div>
<p>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; operation of GIT.&nbsp; </p>
<p>Thanks</p>
<p>That’s all for today .</p>
<p>To know more visit to my blog [ <a title="http://blog.actcode.com/" href="http://blog.actcode.com/">http://blog.actcode.com/</a> ]</p>
<p>Bye</p>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2010/06/git-in-windows-with-tortoisegit-client-projectlocker-free-git-hosting/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>PHP overloading ( method overloading and property overloading)</title>
		<link>http://actcode.com/2010/05/php-overloading-method-overloading-and-property-overloading-2/</link>
		<comments>http://actcode.com/2010/05/php-overloading-method-overloading-and-property-overloading-2/#comments</comments>
		<pubDate>Sat, 15 May 2010 18:35:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[OOP]]></category>
		<category><![CDATA[Overloading]]></category>
		<category><![CDATA[PHP]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=36</guid>
		<description><![CDATA[Hello All 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. Normally we can overload a method by providing different/varying argument(s) ,but in PHP it should have to create through some magic methods. These magic methods are as [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All</p>
<p>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. </p>
<p>Normally we can overload a method by providing different/varying argument(s) ,but in PHP it should have to create through some magic methods.</p>
<p>These magic methods are as bellow:</p>
<p>(<em>For overloading property</em>) </p>
<p>void <b>__set</b> ( string <tt>$name</tt> , <a href="language.pseudo-types.html#language.types.mixed">mixed</a> <tt>$value</tt> ) </p>
<p><a href="language.pseudo-types.html#language.types.mixed">mixed</a> <b>__get</b> ( string <tt>$name</tt> ) </p>
<p>bool <b>__isset</b> ( string <tt>$name</tt> ) </p>
<p>void <b>__unset</b> ( string <tt>$name</tt> ) </p>
<p>(<em>For overloading method</em>)</p>
<p><a href="language.pseudo-types.html#language.types.mixed">mixed</a> <b>__call</b> ( string <tt>$name</tt> , array <tt>$arguments</tt> )</p>
<p><a href="language.pseudo-types.html#language.types.mixed">mixed</a> <b>__callStatic</b> ( string <tt>$name</tt> , array <tt>$arguments</tt> )</p>
<p>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 .</p>
<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">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;?</span>php
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/class">class</a> PhpOverloading {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  <span style="color: #008000">/* Property overloading -start- */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  private $_data = <a style="color: #ffa500" href="http://www.php.net/array">array</a> ();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __set($name, $value) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * set the key value in the $_data private
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * variable.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    $this-&gt;_data [$name] = $value;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __get($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * Retrieve the value of key which we have
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * set through __set method.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #0000ff" href="http://www.php.net/return">return</a> $this-&gt;_data [$name];
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __isset($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * Check wheather the key exist or not.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #0000ff" href="http://www.php.net/return">return</a> isset ( $this-&gt;_data [$name] );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __unset($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * Unset the value of key.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #ffa500" href="http://www.php.net/unset">unset</a> ( $this-&gt;_data [$name] );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  <span style="color: #008000">/* Property overloading -end- */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  <span style="color: #008000">/* Method overloading -start- */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __call($name, $argument) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * perform your operation as needed,
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * I just used a switch case to show how
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * we can set the dynamic method with parameters.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #0000ff" href="http://www.php.net/switch">switch</a> ($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/case">case</a> ('<span style="color: #8b0000">First</span>') :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">This is the first dyanamic method and arguments are </span>" . <a style="color: #ffa500" href="http://www.php.net/implode">implode</a> ( '<span style="color: #8b0000">,</span>', $argument );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/break">break</a>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/case">case</a> ('<span style="color: #8b0000">Second</span>') :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">2nd method and the arguments are {$argument[1]} and {$argument[2]}</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/break">break</a>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/default">default</a> :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">Method unhandled with the name {$name} and arguments are </span>" . <a style="color: #ffa500" href="http://www.php.net/implode">implode</a> ( '<span style="color: #8b0000">,</span>', $argument );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public static <a style="color: #0000ff" href="http://www.php.net/function">function</a> __callstatic($name, $argument) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * It's similar as __call but works as static method
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * call.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #0000ff" href="http://www.php.net/switch">switch</a> ($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/case">case</a> ('<span style="color: #8b0000">FirstStatic</span>') :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">Static first dyanamic method and arguments are </span>" . <a style="color: #ffa500" href="http://www.php.net/implode">implode</a> ( '<span style="color: #8b0000">,</span>', $argument );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/break">break</a>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/case">case</a> ('<span style="color: #8b0000">SecondStatic</span>') :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">Static 2nd method and the arguments are {$argument[1]} and {$argument[2]}</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/break">break</a>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/default">default</a> :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">Static method unhandled with the name {$name} and arguments are </span>" . <a style="color: #ffa500" href="http://www.php.net/implode">implode</a> ( '<span style="color: #8b0000">,</span>', $argument );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><span style="color: #008000">/* Method overloading -end- */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">}
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading = new PhpOverloading ();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">Property overloading output -start-</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #ffa500" href="http://www.php.net/var_dump">var_dump</a> ( isset ( $phpOverloading-&gt;dynamicProperty ) );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading-&gt;dynamicProperty = "<span style="color: #8b0000">new property injected</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> $phpOverloading-&gt;dynamicProperty;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #ffa500" href="http://www.php.net/var_dump">var_dump</a> ( isset ( $phpOverloading-&gt;dynamicProperty ) );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #ffa500" href="http://www.php.net/unset">unset</a> ( $phpOverloading-&gt;dynamicProperty );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #ffa500" href="http://www.php.net/var_dump">var_dump</a> ( isset ( $phpOverloading-&gt;dynamicProperty ) );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">Property overloading output -end-</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">Method overloading output -start-</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading-&gt;First ( '<span style="color: #8b0000">one</span>', '<span style="color: #8b0000">two</span>', '<span style="color: #8b0000">three</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading-&gt;Second ( '<span style="color: #8b0000">1</span>', '<span style="color: #8b0000">2</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading-&gt;UnHandledMethod ( '<span style="color: #8b0000">1</span>', '<span style="color: #8b0000">2</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">staic method overloading</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">PhpOverloading::FirstStatic ( '<span style="color: #8b0000">one</span>', '<span style="color: #8b0000">two</span>', '<span style="color: #8b0000">three</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">PhpOverloading::SecondStatic ( '<span style="color: #8b0000">1</span>', '<span style="color: #8b0000">2</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">PhpOverloading::UnHandledStaticMethod ( '<span style="color: #8b0000">1</span>', '<span style="color: #8b0000">2</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">Method overloading output -end-</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"> * final output is as bellow:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Property overloading output -start-
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">bool(false)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">new property injected
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">bool(true)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">bool(false)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Property overloading output -end-
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Method overloading output -start-
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">This is the first dyanamic method and arguments are one,two,three
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">2nd method and the arguments are 2 and
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Method unhandled with the name UnHandledMethod and arguments are 1,2
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">staic method overloading
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Static first dyanamic method and arguments are one,two,three
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Static 2nd method and the arguments are 2 and
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Static method unhandled with the name UnHandledStaticMethod and arguments are 1,2
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Method overloading output -end-
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"> *
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"> * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
</pre>
<p>You may check my other posts from my [ <a href="http://blog.actcode.com/">Blog</a> ] .</p>
<p>Please provide your feedback. </p>
<p>Thanks</p>
<p>That&#8217;s all for today. </p>
<p>BYE</p>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2010/05/php-overloading-method-overloading-and-property-overloading-2/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>PHP overloading ( method overloading and property overloading)</title>
		<link>http://actcode.com/2010/05/php-overloading-method-overloading-and-property-overloading/</link>
		<comments>http://actcode.com/2010/05/php-overloading-method-overloading-and-property-overloading/#comments</comments>
		<pubDate>Sat, 15 May 2010 18:24:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=35</guid>
		<description><![CDATA[Hello All 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. Normally we can overload a method by providing different/varying argument(s) ,but in PHP it should have to create through some magic methods. These magic methods are as [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All</p>
<p>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. </p>
<p>Normally we can overload a method by providing different/varying argument(s) ,but in PHP it should have to create through some magic methods.</p>
<p>These magic methods are as bellow:</p>
<p>(<em>For overloading property</em>)
<p>void <b>__set</b> ( string <tt>$name</tt> , <a href="language.pseudo-types.html#language.types.mixed">mixed</a> <tt>$value</tt> )
<p><a href="language.pseudo-types.html#language.types.mixed">mixed</a> <b>__get</b> ( string <tt>$name</tt> )
<p>bool <b>__isset</b> ( string <tt>$name</tt> )
<p>void <b>__unset</b> ( string <tt>$name</tt> )
<p> (<em>For overloading method</em>)</p>
<p><a href="language.pseudo-types.html#language.types.mixed">mixed</a> <b>__call</b> ( string <tt>$name</tt> , array <tt>$arguments</tt> )
<p><a href="language.pseudo-types.html#language.types.mixed">mixed</a> <b>__callStatic</b> ( string <tt>$name</tt> , array <tt>$arguments</tt> )
<p>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 .</p>
<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">
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><span style="color: #0000ff">&lt;?</span>php
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/class">class</a> PhpOverloading {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  <span style="color: #008000">/* Property overloading -start- */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  private $_data = <a style="color: #ffa500" href="http://www.php.net/array">array</a> ();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __set($name, $value) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * set the key value in the $_data private
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * variable.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    $this-&gt;_data [$name] = $value;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __get($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * Retrieve the value of key which we have
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * set through __set method.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #0000ff" href="http://www.php.net/return">return</a> $this-&gt;_data [$name];
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __isset($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * Check wheather the key exist or not.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #0000ff" href="http://www.php.net/return">return</a> isset ( $this-&gt;_data [$name] );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __unset($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * Unset the value of key.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #ffa500" href="http://www.php.net/unset">unset</a> ( $this-&gt;_data [$name] );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  <span style="color: #008000">/* Property overloading -end- */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  <span style="color: #008000">/* Method overloading -start- */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public <a style="color: #0000ff" href="http://www.php.net/function">function</a> __call($name, $argument) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * perform your operation as needed,
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * I just used a switch case to show how
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * we can set the dynamic method with parameters.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #0000ff" href="http://www.php.net/switch">switch</a> ($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/case">case</a> ('<span style="color: #8b0000">First</span>') :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">This is the first dyanamic method and arguments are </span>" . <a style="color: #ffa500" href="http://www.php.net/implode">implode</a> ( '<span style="color: #8b0000">,</span>', $argument );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/break">break</a>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/case">case</a> ('<span style="color: #8b0000">Second</span>') :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">2nd method and the arguments are {$argument[1]} and {$argument[2]}</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/break">break</a>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/default">default</a> :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">Method unhandled with the name {$name} and arguments are </span>" . <a style="color: #ffa500" href="http://www.php.net/implode">implode</a> ( '<span style="color: #8b0000">,</span>', $argument );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  public static <a style="color: #0000ff" href="http://www.php.net/function">function</a> __callstatic($name, $argument) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * It's similar as __call but works as static method
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * call.
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">     * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    <a style="color: #0000ff" href="http://www.php.net/switch">switch</a> ($name) {
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/case">case</a> ('<span style="color: #8b0000">FirstStatic</span>') :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">Static first dyanamic method and arguments are </span>" . <a style="color: #ffa500" href="http://www.php.net/implode">implode</a> ( '<span style="color: #8b0000">,</span>', $argument );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/break">break</a>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/case">case</a> ('<span style="color: #8b0000">SecondStatic</span>') :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">Static 2nd method and the arguments are {$argument[1]} and {$argument[2]}</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/break">break</a>;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">      <a style="color: #0000ff" href="http://www.php.net/default">default</a> :
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">        <a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">Static method unhandled with the name {$name} and arguments are </span>" . <a style="color: #ffa500" href="http://www.php.net/implode">implode</a> ( '<span style="color: #8b0000">,</span>', $argument );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">    }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">  }
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><span style="color: #008000">/* Method overloading -end- */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">}
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading = new PhpOverloading ();
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">Property overloading output -start-</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #ffa500" href="http://www.php.net/var_dump">var_dump</a> ( isset ( $phpOverloading-&gt;dynamicProperty ) );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading-&gt;dynamicProperty = "<span style="color: #8b0000">new property injected</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> $phpOverloading-&gt;dynamicProperty;
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #ffa500" href="http://www.php.net/var_dump">var_dump</a> ( isset ( $phpOverloading-&gt;dynamicProperty ) );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #ffa500" href="http://www.php.net/unset">unset</a> ( $phpOverloading-&gt;dynamicProperty );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #ffa500" href="http://www.php.net/var_dump">var_dump</a> ( isset ( $phpOverloading-&gt;dynamicProperty ) );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">Property overloading output -end-</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">Method overloading output -start-</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading-&gt;First ( '<span style="color: #8b0000">one</span>', '<span style="color: #8b0000">two</span>', '<span style="color: #8b0000">three</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading-&gt;Second ( '<span style="color: #8b0000">1</span>', '<span style="color: #8b0000">2</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">$phpOverloading-&gt;UnHandledMethod ( '<span style="color: #8b0000">1</span>', '<span style="color: #8b0000">2</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">staic method overloading</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">PhpOverloading::FirstStatic ( '<span style="color: #8b0000">one</span>', '<span style="color: #8b0000">two</span>', '<span style="color: #8b0000">three</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">PhpOverloading::SecondStatic ( '<span style="color: #8b0000">1</span>', '<span style="color: #8b0000">2</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">PhpOverloading::UnHandledStaticMethod ( '<span style="color: #8b0000">1</span>', '<span style="color: #8b0000">2</span>' );
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> "<span style="color: #8b0000">&lt;br /&gt;&lt;br /&gt;</span>";
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><a style="color: #0000ff" href="http://www.php.net/echo">echo</a> '<span style="color: #8b0000">Method overloading output -end-</span>';
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"><span style="color: #008000">/*
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"> * final output is as bellow:
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Property overloading output -start-
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">bool(false)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">new property injected
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">bool(true)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">bool(false)
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Property overloading output -end-
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Method overloading output -start-
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">This is the first dyanamic method and arguments are one,two,three
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">2nd method and the arguments are 2 and
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Method unhandled with the name UnHandledMethod and arguments are 1,2
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">staic method overloading
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Static first dyanamic method and arguments are one,two,three
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Static 2nd method and the arguments are 2 and
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Static method unhandled with the name UnHandledStaticMethod and arguments are 1,2
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px">Method overloading output -end-
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"> *
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"> * */</span>
</pre>
<pre style="background-color: #fbfbfb; margin: 0em; width: 100%; font-family: consolas,'Courier New',courier,monospace; font-size: 12px"></pre>
</pre>
<p>You may check my other posts from my [ <a href="http://blog.actcode.com/">Blog</a> ] </p>
<p>Please provide your feedback. </p>
<p>Thanks</p>
<p>That&#8217;s all for today. </p>
<p>BYE</p>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2010/05/php-overloading-method-overloading-and-property-overloading/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Control inside repeater row ASP.NET</title>
		<link>http://actcode.com/2010/02/control-inside-repeater-row-asp-net/</link>
		<comments>http://actcode.com/2010/02/control-inside-repeater-row-asp-net/#comments</comments>
		<pubDate>Sun, 28 Feb 2010 08:05:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[control]]></category>
		<category><![CDATA[repeater]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=34</guid>
		<description><![CDATA[Hello All 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 [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All</p>
<p>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.</p>
<p>It’s being hard to describe rather that visualize <img src='http://actcode.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  isn’t it ! ( proposed solution should be as image bellow)</p>
<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"><a href="http://lh6.ggpht.com/_NL2fAc4la4o/S4zHKqmLrfI/AAAAAAAAA90/UMJKft6Otao/18x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/S4zHQDH9ngI/AAAAAAAAA94/cd7k1cNj_SY/13.png?imgmax=800" width="580" height="494" /></a></div>
<p>&#160;&#160;&#160; My aspx markup is as bellow :</p>
<pre class="code"> <span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Repeater </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">ID</span><span style="color: blue">=&quot;rptTeamInfo&quot; </span><span style="color: red">OnItemDataBound</span><span style="color: blue">=&quot;rptTeamInfo_ItemDataBound&quot; </span><span style="color: red">OnItemCommand</span><span style="color: blue">=&quot;rptTeamInfo_ItemCommand&quot;&gt;
               &lt;</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
                &lt;</span><span style="color: maroon">div </span><span style="color: red">class</span><span style="color: blue">=&quot;side2&quot;&gt;
                &lt;</span><span style="color: maroon">div </span><span style="color: red">class</span><span style="color: blue">=&quot;form&quot;&gt;
                    &lt;</span><span style="color: maroon">a </span><span style="color: red">href</span><span style="color: blue">=&quot;#&quot;&gt;</span>delete<span style="color: blue">&lt;/</span><span style="color: maroon">a</span><span style="color: blue">&gt;&lt;</span><span style="color: maroon">a </span><span style="color: red">href</span><span style="color: blue">=&quot;#&quot;&gt;</span>edit /<span style="color: blue">&lt;/</span><span style="color: maroon">a</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: maroon">ul </span><span style="color: red">class</span><span style="color: blue">=&quot;p2&quot;&gt;
                      &lt;</span><span style="color: maroon">span </span><span style="color: red">class</span><span style="color: blue">=&quot;style1&quot;&gt;</span>[ <span style="background: yellow">&lt;%</span><span style="color: blue">#</span>Eval(<span style="color: #a31515">&quot;team_name&quot;</span>)<span style="background: yellow">%&gt;</span> ]<span style="color: blue">&lt;/</span><span style="color: maroon">span</span><span style="color: blue">&gt; </span>- [ <span style="background: yellow">&lt;%</span><span style="color: blue">#</span>Eval(<span style="color: #a31515">&quot;creation_date&quot;</span>)<span style="background: yellow">%&gt;</span>]<span style="color: blue">&lt;</span><span style="color: maroon">br </span><span style="color: blue">/&gt;
                      &lt;</span><span style="color: maroon">span </span><span style="color: red">class</span><span style="color: blue">=&quot;style2&quot;&gt;</span>[<span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">Text</span><span style="color: blue">=&quot;ADMIN bla bla bla&quot;&gt;&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label</span><span style="color: blue">&gt;</span>] - [ <span style="background: yellow">&lt;%</span><span style="color: blue">#</span>Eval(<span style="color: #a31515">&quot;team_leader&quot;</span>)<span style="background: yellow">%&gt;</span>]<span style="color: blue">&lt;/</span><span style="color: maroon">span</span><span style="color: blue">&gt; </span>- [ <span style="background: yellow">&lt;%</span><span style="color: blue">#</span>Eval(<span style="color: #a31515">&quot;description&quot;</span>)<span style="background: yellow">%&gt;</span>]
                     <span style="color: blue">&lt;/</span><span style="color: maroon">ul</span><span style="color: blue">&gt;
                &lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
                &lt;</span><span style="color: maroon">div </span><span style="color: red">class</span><span style="color: blue">=&quot;form2&quot;&gt;
                &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">ImageButton </span><span style="color: red">id</span><span style="color: blue">=&quot;imgAddToTeam&quot;  </span><span style="color: red">CommandName</span><span style="color: blue">=&quot;select&quot; </span><span style="color: red">CommandArgument</span><span style="color: blue">='</span><span style="background: yellow">&lt;%</span><span style="color: blue"># </span>Eval(&quot;team_id&quot;) <span style="background: yellow">%&gt;</span><span style="color: blue">'  </span><span style="color: red">ImageUrl</span><span style="color: blue">=&quot;images/Add_to_team.png&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">style</span><span style="color: blue">=&quot;</span><span style="color: red">margin</span><span style="color: blue">:10px;&quot; </span><span style="color: red">align</span><span style="color: blue">=&quot;right&quot;&gt;&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">ImageButton</span><span style="color: blue">&gt;
                </span><span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">DropDownList </span><span style="color: red">ID</span><span style="color: blue">=&quot;ddlUserList&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;&gt;

                &lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">DropDownList</span><span style="color: blue">&gt;

                &lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
                &lt;</span><span style="color: maroon">div </span><span style="color: red">class</span><span style="color: blue">=&quot;row1&quot;&gt;
                        &lt;</span><span style="color: maroon">ul </span><span style="color: red">class</span><span style="color: blue">=&quot;column&quot;&gt;
                            &lt;</span><span style="color: maroon">p</span><span style="color: blue">&gt;&lt;</span><span style="color: maroon">img </span><span style="color: red">src</span><span style="color: blue">=&quot;images/name.png&quot; /&gt; </span>Name<span style="color: blue">&lt;/</span><span style="color: maroon">p</span><span style="color: blue">&gt;
                        &lt;/</span><span style="color: maroon">ul</span><span style="color: blue">&gt;
                        &lt;</span><span style="color: maroon">ul </span><span style="color: red">class</span><span style="color: blue">=&quot;column2&quot;&gt;
                            &lt;</span><span style="color: maroon">p</span><span style="color: blue">&gt;&lt;</span><span style="color: maroon">img </span><span style="color: red">src</span><span style="color: blue">=&quot;images/username.png&quot; /&gt; </span>Username<span style="color: blue">&lt;/</span><span style="color: maroon">p</span><span style="color: blue">&gt;
                        &lt;/</span><span style="color: maroon">ul</span><span style="color: blue">&gt;
                        &lt;</span><span style="color: maroon">ul </span><span style="color: red">class</span><span style="color: blue">=&quot;column3&quot;&gt;
                            &lt;</span><span style="color: maroon">p</span><span style="color: blue">&gt;&lt;</span><span style="color: maroon">img </span><span style="color: red">src</span><span style="color: blue">=&quot;images/username.png&quot; /&gt; </span>Access<span style="color: blue">&lt;/</span><span style="color: maroon">p</span><span style="color: blue">&gt;
                        &lt;/</span><span style="color: maroon">ul</span><span style="color: blue">&gt;
                &lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
                &lt;</span><span style="color: maroon">div </span><span style="color: red">class</span><span style="color: blue">=&quot;row2&quot;&gt;
                 &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Repeater </span><span style="color: red">ID</span><span style="color: blue">=&quot;rptUserInfo&quot;  </span><span style="color: red">OnItemDataBound</span><span style="color: blue">=&quot;rptUserInfo_ItemDataBound&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;&gt;
                       &lt;</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">LinkButton </span><span style="color: red">id</span><span style="color: blue">=&quot;lnkUserDelete&quot; </span><span style="color: red">onclick</span><span style="color: blue">=&quot;lnkUserDelete_Click&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;&gt;</span>delete<span style="color: blue">&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">LinkButton</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: maroon">ul </span><span style="color: red">class</span><span style="color: blue">=&quot;column&quot;&gt;
                        &lt;</span><span style="color: maroon">p</span><span style="color: blue">&gt; &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">id</span><span style="color: blue">=&quot;lblFirstNameIn&quot;&gt;&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label</span><span style="color: blue">&gt; &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">id</span><span style="color: blue">=&quot;lblLastNameIn&quot;&gt;&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label</span><span style="color: blue">&gt;&lt;/</span><span style="color: maroon">p</span><span style="color: blue">&gt;
                    &lt;/</span><span style="color: maroon">ul</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: maroon">ul </span><span style="color: red">class</span><span style="color: blue">=&quot;column2&quot;&gt;
                        &lt;</span><span style="color: maroon">p</span><span style="color: blue">&gt; &lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">id</span><span style="color: blue">=&quot;lblUserIDIn&quot;&gt;&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label</span><span style="color: blue">&gt;&lt;/</span><span style="color: maroon">p</span><span style="color: blue">&gt;
                    &lt;/</span><span style="color: maroon">ul</span><span style="color: blue">&gt;
                    &lt;</span><span style="color: maroon">ul </span><span style="color: red">class</span><span style="color: blue">=&quot;column3&quot;&gt;
                        &lt;</span><span style="color: maroon">p</span><span style="color: blue">&gt;&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">id</span><span style="color: blue">=&quot;lblUserTypeIn&quot;&gt;&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Label</span><span style="color: blue">&gt;&lt;/</span><span style="color: maroon">p</span><span style="color: blue">&gt;
                    &lt;/</span><span style="color: maroon">ul</span><span style="color: blue">&gt;
                        &lt;/</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
                 &lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Repeater</span><span style="color: blue">&gt;
                &lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
            &lt;/</span><span style="color: maroon">div</span><span style="color: blue">&gt;
               &lt;/</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt;
               &lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Repeater</span><span style="color: blue">&gt;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>And my code behind file is as bellow :</p>
<pre class="code"><span style="color: blue">using </span>System;
<span style="color: blue">using </span>System.Web.UI.WebControls;
<span style="color: blue">using </span>ClassLibrary1.UTILITY;

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

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

            rptTeamInfo.DataBind();

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

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

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

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

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

        }

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

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

                <span style="color: #2b91af">ManageTeamDAL </span>manageTeamDAL = <span style="color: blue">new </span><span style="color: #2b91af">ManageTeamDAL</span>();

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

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

                rptTeamInfo.DataBind();
            }
        }

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

            <span style="color: blue">var </span>row = e.Item.DataItem;

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

        }

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

            manageTeamDAL.DeleteUserformTeam(((<span style="color: #2b91af">LinkButton</span>)(sender)).CommandArgument);

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

            rptTeamInfo.DataBind();
        }

    }
}</pre>
<p>Not all codes are important here and <em>I will escape the data binding part as its not the focus of today’s topic</em>. Now I will focus what we should do to perform our basic task.</p>
<p>first of all we have to do one most important&#160; thing *** MAKE&#160;&#160;&#160; <span style="color: red">EnableViewState</span><span style="color: blue">=&quot;false&quot; </span>*** If ViewState is in true condition your are not going to handle&#160; <span style="color: red">OnItemCommand</span> event which will significantly react for your particular row’s activity.</p>
<p>&#160;<span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Repeater </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">ID</span><span style="color: blue">=&quot;rptTeamInfo&quot; </span><span style="color: red">OnItemDataBound</span><span style="color: blue">=&quot;rptTeamInfo_ItemDataBound&quot; </span><span style="color: red">OnItemCommand</span><span style="color: blue">=&quot;rptTeamInfo_ItemCommand&quot;&gt; </span></p>
<p><span style="color: blue"></span><span style="color: blue">&lt;</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt; </span></p>
<p><span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">ImageButton </span><span style="color: red">id</span><span style="color: blue">=&quot;imgAddToTeam&quot; </span><span style="color: red">CommandName</span><span style="color: blue">=&quot;select&quot; </span><span style="color: red">CommandArgument</span><span style="color: blue">=&#8217;</span><span style="background: yellow">&lt;%</span><span style="color: blue"># </span>Eval(&quot;team_id&quot;) <span style="background: yellow">%&gt;</span><span style="color: blue">&#8216; </span><span style="color: red">ImageUrl</span><span style="color: blue">=&quot;images/Add_to_team.png&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot; </span><span style="color: red">style</span><span style="color: blue">=&quot;</span><span style="color: red">margin</span><span style="color: blue">:10px;&quot; </span><span style="color: red">align</span><span style="color: blue">=&quot;right&quot;&gt;</span><span style="color: blue">&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">ImageButton</span><span style="color: blue">&gt;</span><span style="background: yellow"> </span><span style="color: blue"></span></p>
<p><span style="color: blue">&lt;</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">DropDownList </span><span style="color: red">ID</span><span style="color: blue">=&quot;ddlUserList&quot; </span><span style="color: red">runat</span><span style="color: blue">=&quot;server&quot;&gt;</span></p>
<p><span style="color: blue">&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">DropDownList</span><span style="color: blue">&gt; </span></p>
<p><span style="color: blue">&lt;/</span><span style="color: maroon">ItemTemplate</span><span style="color: blue">&gt; </span></p>
<p><span style="color: blue">&lt;/</span><span style="color: maroon">asp</span><span style="color: blue">:</span><span style="color: maroon">Repeater</span><span style="color: blue">&gt;</span></p>
<p>The event handler “rptTeamInfo_ItemCommand” for the the event “<span style="color: red">OnItemCommand</span>” is as bellow.</p>
<pre class="code"><span style="color: blue">protected void </span>rptTeamInfo_ItemCommand(<span style="color: blue">object </span>source, <span style="color: #2b91af">RepeaterCommandEventArgs </span>e)
{
    <span style="color: blue">if </span>(e.CommandName == <span style="color: #a31515">&quot;select&quot;</span>)
    {
        <span style="color: #2b91af">ImageButton </span>imgAddToTeam = (<span style="color: #2b91af">ImageButton</span>)e.CommandSource;

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

        <span style="color: #2b91af">ManageTeamDAL </span>manageTeamDAL = <span style="color: blue">new </span><span style="color: #2b91af">ManageTeamDAL</span>();

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

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

        rptTeamInfo.DataBind();
    }
}</pre>
<p>We are passing the “<span style="color: red">CommandName</span>” and “<span style="color: red">CommandArgument</span>” through our image button which will check the command name in code behind and act with the command argument parameter. </p>
<p>We can get our ImageButton and DropdownList is as bellow from our code behind.</p>
<pre class="code"><span style="color: #2b91af">ImageButton </span>imgAddToTeam = (<span style="color: #2b91af">ImageButton</span>)e.CommandSource;

<span style="color: #2b91af">DropDownList </span>ddlUserList = (<span style="color: #2b91af">DropDownList</span>)rptTeamInfo.Items[e.Item.ItemIndex].FindControl(<span style="color: #a31515">&quot;ddlUserList&quot;</span>);</pre>
<p>And selet the value of dropdown as bellow.</p>
<pre class="code">ddlUserList.SelectedValue</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>In this way we can accomplish our task regarding the repeater row’s control manipulation.</p>
<p>Thats all for today.</p>
<p>BYE</p>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2010/02/control-inside-repeater-row-asp-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Dependency Injection with Ninject in .NET</title>
		<link>http://actcode.com/2009/12/dependency-injection-with-ninject-in-net/</link>
		<comments>http://actcode.com/2009/12/dependency-injection-with-ninject-in-net/#comments</comments>
		<pubDate>Wed, 23 Dec 2009 16:32:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[DI]]></category>
		<category><![CDATA[IoC]]></category>
		<category><![CDATA[Ninject]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=33</guid>
		<description><![CDATA[Hello All 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 [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All</p>
<p>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).</p>
<p>My project structure is as following .</p>
<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"><a href="http://lh4.ggpht.com/_NL2fAc4la4o/SzJF42x6MSI/AAAAAAAAA8Y/j4hUHUrUC6E/Untitled8x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/SzJF7_bAGhI/AAAAAAAAA8c/PPYSYbtt9Z8/Untitled.png?imgmax=800" width="281" height="335" /></a></div>
<p>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. </p>
<p>In my “DependencyInjection.Core” project I took 2 interfaces: 1.IEngine&#160; 2.ISeat</p>
<p>IEngine.cs is as following :</p>
<pre class="code"><span style="color: blue">namespace </span>DependencyInjection.Core
{
   <span style="color: blue">public interface </span><span style="color: #2b91af">IEngine
    </span>{
       <span style="color: blue">string </span>EngineType(<span style="color: blue">string </span>carName);
    }
}</pre>
<p>I’m also taking 2 other classes 1.DieselEngine and 2.PetrolEngine&#160; . Both of the classes implements IEngine interface.<br />DieselEngine.cs is as following :
<pre class="code"><span style="color: blue">namespace </span>DependencyInjection.Core
{
   <span style="color: blue">public  class </span><span style="color: #2b91af">DieselEngine </span>: <span style="color: #2b91af">IEngine
    </span>{
       <span style="color: blue">public string </span>EngineType(<span style="color: blue">string </span>carName)
       {
           <span style="color: blue">return string</span>.Format(<span style="color: #a31515">&quot;This {0} runs on diesel.&quot;</span>, carName);
       }
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a><br />PetrolEngine.cs is as following :
<pre class="code"><span style="color: blue">namespace </span>DependencyInjection.Core
{
  <span style="color: blue">public class </span><span style="color: #2b91af">PetrolEngine </span>: <span style="color: #2b91af">IEngine
    </span>{
        <span style="color: blue">public string </span>EngineType(<span style="color: blue">string </span>carName)
        {
            <span style="color: blue">return string</span>.Format(<span style="color: #a31515">&quot;This {0} runs on petrol.&quot;</span>, carName);
        }
    }
}</pre>
<p>Now start for another type of interface implementation ISeat . This part also is as above.<br />ISeat.cs is as following :
<pre class="code"><span style="color: blue">namespace </span>DependencyInjection.Core
{
   <span style="color: blue">public interface </span><span style="color: #2b91af">ISeat
    </span>{
       <span style="color: blue">string </span>SeatType(<span style="color: blue">string </span>carName);
    }
}</pre>
<p>Two other classes 1.LeatherSeat and 2.PlasticSeat&#160; . Both of the classes implements ISeat interface.<br />LeatherSeat.cs is as follwong:
<pre class="code"><span style="color: blue">namespace </span>DependencyInjection.Core
{
   <span style="color: blue">public class </span><span style="color: #2b91af">LeatherSeat </span>: <span style="color: #2b91af">ISeat
    </span>{
        <span style="color: blue">#region </span>ISeat Members

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

        <span style="color: blue">#endregion
    </span>}
}</pre>
<p>PlasticSeat.cs is as following :
<pre class="code"><span style="color: blue">namespace </span>DependencyInjection.Core
{
   <span style="color: blue">public class </span><span style="color: #2b91af">PlasticSeat </span>: <span style="color: #2b91af">ISeat
    </span>{
        <span style="color: blue">#region </span>ISeat Members

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

        <span style="color: blue">#endregion
    </span>}
}</pre>
<p>In this point I’m adding reference of “Ninject.Core.dll” with my&#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.<br />Car.cs is as bellow :
<pre class="code"><span style="color: blue">using </span>Ninject.Core;

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

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

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

        <span style="color: blue">public string </span>GetSeatInformation(<span style="color: blue">string </span>carName)
        {
            <span style="color: blue">return </span>CarSeat.SeatType(carName);
        }
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a><br />In the above file&#160; “ [<span style="color: #2b91af">Inject</span>] “ 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.<br />I have taken another console application project named “DependencyInjection” in which I placed my “IocMapper” class. <br />IocMapper.cs is as following :
<pre class="code"><span style="color: blue">using </span>Ninject.Core;

<span style="color: blue">using </span>DependencyInjection.Core;

<span style="color: blue">namespace </span>DependencyInjection
{
    <span style="color: blue">public class </span><span style="color: #2b91af">IocMapper </span>: <span style="color: #2b91af">StandardModule
    </span>{
        <span style="color: blue">public override void </span>Load()
        {
            Bind&lt;<span style="color: #2b91af">IEngine</span>&gt;().To&lt;<span style="color: #2b91af">DieselEngine</span>&gt;();

            Bind&lt;<span style="color: #2b91af">ISeat</span>&gt;().To&lt;<span style="color: #2b91af">LeatherSeat</span>&gt;();
        }
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a><br />Now in program class I defined the kernel constructer and and initialize my car object.<br />Program.cs file is as bellow :</p>
<pre class="code"><span style="color: blue">using </span>System;
<span style="color: blue">using </span>Ninject.Core;
<span style="color: blue">using </span>DependencyInjection.Core;

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

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

            <span style="color: #2b91af">Console</span>.WriteLine(car.GetEngineInformation(<span style="color: #a31515">&quot;Toyota&quot;</span>));

            <span style="color: #2b91af">Console</span>.WriteLine(car.GetSeatInformation(<span style="color: #a31515">&quot;BMW&quot;</span>));

            <span style="color: #2b91af">Console</span>.ReadKey();

        }
    }
}</pre>
<p>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.</p>
<p>That’s all for today.<br />BYE</p>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2009/12/dependency-injection-with-ninject-in-net/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>.NET application logging with Log4net in Console , File &amp; Database</title>
		<link>http://actcode.com/2009/11/net-application-logging-with-log4net-in-console-file-database/</link>
		<comments>http://actcode.com/2009/11/net-application-logging-with-log4net-in-console-file-database/#comments</comments>
		<pubDate>Fri, 13 Nov 2009 10:44:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[C#]]></category>
		<category><![CDATA[log4net]]></category>
		<category><![CDATA[logging]]></category>
		<category><![CDATA[SQL]]></category>
		<category><![CDATA[Visual Studio]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=32</guid>
		<description><![CDATA[Hello All 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 [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All</p>
<p>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.</p>
<p>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.</p>
<p>My project structure is as image bellow :</p>
<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"><a href="http://lh6.ggpht.com/_NL2fAc4la4o/Sv05b7w5HeI/AAAAAAAAA8M/Oes0H6HT_kk/18x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/Sv05eqiuiZI/AAAAAAAAA8Q/-LoDlfekKSQ/1.png?imgmax=800" width="212" height="335" /></a></div>
</p>
<p>In the LogWriter I have take two class as bellow :</p>
<p>LogLevel.cs: In this class I simply define a enum which basically helps to define my log level in my LogUtil class.</p>
<pre class="code"><span style="color: blue">namespace </span>LogWriter
{
    <span style="color: blue">public enum </span><span style="color: #2b91af">LogLevel
    </span>{
        DEBUG,
        ERROR,
        FATAL,
        INFO,
        WARN
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>
<p>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.</p>
<pre class="code"><span style="color: blue">using </span>log4net;
<span style="color: blue">using </span>log4net.Config;

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

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

        <span style="color: blue">public static void </span>WriteLog(<span style="color: #2b91af">LogLevel </span>logLevel,<span style="color: blue">string </span>log)
        {
            <span style="color: blue">if </span>(logLevel.Equals(<span style="color: #2b91af">LogLevel</span>.DEBUG))
            {
                logger.Debug(log);
            }
            <span style="color: blue">else if </span>(logLevel.Equals(<span style="color: #2b91af">LogLevel</span>.ERROR))
            {
                logger.Error(log);
            }
            <span style="color: blue">else if </span>(logLevel.Equals(<span style="color: #2b91af">LogLevel</span>.FATAL))
            {
                logger.Fatal(log);
            }
            <span style="color: blue">else if </span>(logLevel.Equals(<span style="color: #2b91af">LogLevel</span>.INFO))
            {
                logger.Info(log);
            }
            <span style="color: blue">else if </span>(logLevel.Equals(<span style="color: #2b91af">LogLevel</span>.WARN))
            {
                logger.Warn(log);
            }             

        }
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>
<p>As I am writing a&#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.</p>
<pre class="code"><span style="color: blue">using </span>System;
<span style="color: blue">using </span>LogWriter;

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

            <span style="color: blue">catch </span>(<span style="color: #2b91af">Exception </span>exc)
            {
                    <span style="color: #2b91af">LogUtil</span>.WriteLog(<span style="color: #2b91af">LogLevel</span>.DEBUG, <span style="color: #a31515">&quot;Debug mode logging&quot;</span>);
                    <span style="color: #2b91af">LogUtil</span>.WriteLog(<span style="color: #2b91af">LogLevel</span>.ERROR, <span style="color: #a31515">&quot;Error mode logging&quot;</span>);
                    <span style="color: #2b91af">LogUtil</span>.WriteLog(<span style="color: #2b91af">LogLevel</span>.FATAL, <span style="color: #a31515">&quot;Fatal mode logging&quot;</span>);
                    <span style="color: #2b91af">LogUtil</span>.WriteLog(<span style="color: #2b91af">LogLevel</span>.INFO, <span style="color: #a31515">&quot;Info mode logging&quot;</span>);
                    <span style="color: #2b91af">LogUtil</span>.WriteLog(<span style="color: #2b91af">LogLevel</span>.WARN, <span style="color: #a31515">&quot;Warn mode logging&quot;</span>);

                    <span style="color: #2b91af">Console</span>.ReadKey();
            }
        }
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>
<p>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. </p>
<p>My configuration file is as bellow , please go through the commented line to get know in detail such as<em><strong> log file rolling, max log file number &amp; size, Log level</strong></em> etc.
<pre class="code"><span style="color: blue">&lt;?</span><span style="color: #a31515">xml </span><span style="color: red">version</span><span style="color: blue">=</span>&quot;<span style="color: blue">1.0</span>&quot; <span style="color: red">encoding</span><span style="color: blue">=</span>&quot;<span style="color: blue">utf-8</span>&quot; <span style="color: blue">?&gt;

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        &lt;!--
        </span><span style="color: green">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
        )
        </span><span style="color: blue">--&gt;

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

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

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

            &lt;!--
            </span><span style="color: green">Log level priority in descending order:

            FATAL = 1 show  log -&gt; FATAL
            ERROR = 2 show  log -&gt; FATAL ERROR
            WARN =  3 show  log -&gt; FATAL ERROR WARN
            INFO =  4 show  log -&gt; FATAL ERROR WARN INFO
            DEBUG = 5 show  log -&gt; FATAL ERROR WARN INFO DEBUG
            </span><span style="color: blue">--&gt;

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

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

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

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

&lt;/</span><span style="color: #a31515">configuration</span><span style="color: blue">&gt;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>
<p>Hope this will help to improve your logging in your .NET application. </p>
<p>Thanks
<p>That’s all for today.</p>
<p>BYE</p>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2009/11/net-application-logging-with-log4net-in-console-file-database/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>ULM Class Diagram</title>
		<link>http://actcode.com/2009/08/ulm-class-diagram/</link>
		<comments>http://actcode.com/2009/08/ulm-class-diagram/#comments</comments>
		<pubDate>Fri, 21 Aug 2009 15:12:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[UML]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=31</guid>
		<description><![CDATA[Hello All 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 [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All</p>
<p>Today I will go through with UML class diagram. It’s like old wine in old bottle <img src='http://actcode.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  . 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.</p>
<p>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.</p>
<p>So let’s start the old song again.</p>
<p><strong>Class:</strong></p>
<p> Generally there are 3 components in the class icon as following.</p>
<p>1. Class Name</p>
<p>2. Attributes </p>
<p>3. Functions / Methods </p>
<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"><a href="http://lh6.ggpht.com/_NL2fAc4la4o/So66E2pc0PI/AAAAAAAAA7U/l9XhHAx52co/class-8x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/So66HHyYZXI/AAAAAAAAA7Y/O39FxFwHVuw/class%5B19%5D.png?imgmax=800" width="250" height="179" /></a></div>
<p><strong>Visibility:</strong></p>
<p>Visibility of class diagram represents the accessibility of the class members. Visibility notations are as bellow .</p>
<p>
<table border="1" cellspacing="0" cellpadding="0" width="232">
<tbody>
<tr>
<td valign="top" width="91">
<p><strong>Notations </strong></p>
</td>
<td valign="top" width="139">
<p><strong>Access type</strong></p>
</td>
</tr>
<tr>
<td valign="top" width="91">
<p>-</p>
</td>
<td valign="top" width="139">
<p>Private</p>
</td>
</tr>
<tr>
<td valign="top" width="91">
<p>+</p>
</td>
<td valign="top" width="139">
<p>Public</p>
</td>
</tr>
<tr>
<td valign="top" width="91">
<p>~</p>
</td>
<td valign="top" width="139">
<p>Protected</p>
</td>
</tr>
</tbody>
</table>
<p><strong>Association:</strong></p>
<p>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.</p>
<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"><a href="http://lh6.ggpht.com/_NL2fAc4la4o/So66I8YsTAI/AAAAAAAAA7c/Ifc5RPG3gLg/associasion-8x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/So66LFlf9wI/AAAAAAAAA7g/ZQZJFWNUkWo/associasion.png?imgmax=800" width="335" height="143" /></a></div>
<p><a name="Table1MultiplicityIndicators"><strong>Multiplicity Indicators</strong></a><strong>:</strong></p>
<p>Multiplicity indicates the countable objects relation with other objects.</p>
<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"><a href="http://lh3.ggpht.com/_NL2fAc4la4o/So66MzGFkHI/AAAAAAAAA7k/Tjsh9mc2OqI/associasion%20mul-8x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/So66O8Qe7eI/AAAAAAAAA7o/33svI-vYtuw/associasion%20mul.png?imgmax=800" width="335" height="143" /></a></div>
<p>
<table border="0" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td valign="top" width="85">
<p><b>Indicator</b></p>
</td>
<td valign="top" width="168">
<p><b>Meaning</b></p>
</td>
</tr>
<tr>
<td valign="top" width="85">
<p>0..1</p>
</td>
<td valign="top" width="168">
<p>Zero or one</p>
</td>
</tr>
<tr>
<td valign="top" width="85">
<p>1</p>
</td>
<td valign="top" width="168">
<p>One only</p>
</td>
</tr>
<tr>
<td valign="top" width="85">
<p>0..*</p>
</td>
<td valign="top" width="168">
<p>Zero or more</p>
</td>
</tr>
<tr>
<td valign="top" width="85">
<p>1..*</p>
</td>
<td valign="top" width="168">
<p>One or more</p>
</td>
</tr>
<tr>
<td valign="top" width="85">
<p>n</p>
</td>
<td valign="top" width="168">
<p>Only <i>n</i> (where <i>n</i> &gt; 1)</p>
</td>
</tr>
<tr>
<td valign="top" width="85">
<p>0..n</p>
</td>
<td valign="top" width="168">
<p>Zero to <i>n</i> (where <i>n</i> &gt; 1)</p>
</td>
</tr>
<tr>
<td valign="top" width="85">
<p>1..n</p>
</td>
<td valign="top" width="168">
<p>One to <i>n</i> (where <i>n </i>&gt; 1)</p>
</td>
</tr>
</tbody>
</table>
<p><strong>Composition:</strong></p>
<p>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. </p>
<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"><a href="http://lh4.ggpht.com/_NL2fAc4la4o/So66Q1aCjJI/AAAAAAAAA7s/-qMa-nXNGxw/comp-8x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/So66Tb8yBfI/AAAAAAAAA7w/LrwzNWeoSS0/comp.png?imgmax=800" width="335" height="146" /></a></div>
<p><strong>Aggregation:</strong></p>
<p>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.</p>
<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"><a href="http://lh4.ggpht.com/_NL2fAc4la4o/So66VJrFVDI/AAAAAAAAA70/ZFlNzmMRqWI/agree-8x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh3.ggpht.com/_NL2fAc4la4o/So66XYYfIyI/AAAAAAAAA74/YvRIMwmbxhY/agree.png?imgmax=800" width="335" height="145" /></a></div>
<p><strong>Inheritance:</strong></p>
<p>When one object inherits property from any parent object then the sign denoted with a triangle shape arrow. </p>
</p>
</p>
<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"><a href="http://lh3.ggpht.com/_NL2fAc4la4o/So66Zj-i7KI/AAAAAAAAA78/QZWausNpG8A/inher-8x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh4.ggpht.com/_NL2fAc4la4o/So66c2IWsQI/AAAAAAAAA8A/pqTdJwWWmsY/inher.png?imgmax=800" width="335" height="290" /></a></div>
<p>Thanks </p>
<p>That&#8217;s all for the day.    <br />BYE</p>
<h6><em>User </em><a href="http://www.scrumpad.com"><em>ScrumPad</em></a><em> for your Agile based projects.</em></h6>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2009/08/ulm-class-diagram/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Agile Scrum and traditional software development ( SDLC ) terms.</title>
		<link>http://actcode.com/2009/07/agile-scrum-and-traditional-software-development-sdlc-terms/</link>
		<comments>http://actcode.com/2009/07/agile-scrum-and-traditional-software-development-sdlc-terms/#comments</comments>
		<pubDate>Sat, 25 Jul 2009 05:55:00 +0000</pubDate>
		<dc:creator>Tanvir</dc:creator>
				<category><![CDATA[Agile]]></category>
		<category><![CDATA[Scrum]]></category>

		<guid isPermaLink="false">http://actcode.com/?p=30</guid>
		<description><![CDATA[Hello All 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 [...]]]></description>
			<content:encoded><![CDATA[<p>Hello All</p>
<p>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. </p>
<p>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.</p>
<p>In this post I will follow Scrum framework for the Agile development. There are some other Agile framework such as AUP,XP,FDD etc.</p>
<p><strong>Agile Development Process:</strong></p>
<p>In the following picture (it&#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.</p>
<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"><a href="http://lh5.ggpht.com/_NL2fAc4la4o/SmqebYzd1oI/AAAAAAAAA5Y/UAnUyd-QlQs/400px-Scrum_process.svg-8x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/Smqed8ZI4hI/AAAAAAAAA5c/9Bf5hTIZU9g/400px-Scrum_process.svg.png?imgmax=800" width="335" height="197" /></a></div>
<p><strong>Roles:</strong></p>
<p><strong>Product Owner:</strong> 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.</p>
<p><strong>Scrum Master:</strong> Scrum master plays a similar type of role as project manager. But as the Agile team is self organized so scrum master doesn&#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).</p>
<p><strong>Teams:</strong> In general a team means group of self organized developers who will develop the software.</p>
<p><strong>Projects Terms:</strong></p>
<p><strong>Product backlog:</strong> 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.</p>
<p><strong>Sprint:</strong> 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&#8217;s necessary, the tasks will add in product backlog with high priority so that they can add in next sprint&#8217;s planning.</p>
<p><strong>Sprint backlog:</strong> 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.</p>
<p><strong>Scrum meeting:</strong> 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.</p>
<p><strong>Retrospective:</strong> 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.</p>
<p><strong>Burndown chart:</strong> 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&#8217;s condition in a simple view. </p>
<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"><a href="http://lh6.ggpht.com/_NL2fAc4la4o/SmqegR-qENI/AAAAAAAAA5g/8fjt77JyHOA/sprint_burndown_chart-8x6.png?imgmax=800" title="" rel="thumbnail"><img border="0" src="http://lh6.ggpht.com/_NL2fAc4la4o/SmqeiUQOJiI/AAAAAAAAA5k/VWGOW7EUDbQ/sprint_burndown_chart%5B1%5D.png?imgmax=800" width="420" height="173" /></a></div>
<p><strong>Velocity:</strong> An agile team can estimate how much effort they can put in product backlog for one sprint. This velocity is determined from previous sprint&#8217;s average data. This velocity can be used to predict the project effort planning and team&#8217;s productivity .</p>
<p> Thanks
<p>That&#8217;s all for the day.    <br />BYE</p>
<h6><em>User </em><a href="http://www.scrumpad.com"><em>ScrumPad</em></a><em> for your Agile based projects.</em></h6>
]]></content:encoded>
			<wfw:commentRss>http://actcode.com/2009/07/agile-scrum-and-traditional-software-development-sdlc-terms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

