<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Mkansagarfa&#039;s Blog</title>
	<atom:link href="http://mkansagarfa.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://mkansagarfa.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Thu, 23 Dec 2010 13:11:50 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='mkansagarfa.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Mkansagarfa&#039;s Blog</title>
		<link>http://mkansagarfa.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://mkansagarfa.wordpress.com/osd.xml" title="Mkansagarfa&#039;s Blog" />
	<atom:link rel='hub' href='http://mkansagarfa.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Tower Of Hanoi</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/19/tower-of-hanoi/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/19/tower-of-hanoi/#comments</comments>
		<pubDate>Fri, 19 Nov 2010 13:33:23 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/2010/11/19/tower-of-hanoi/</guid>
		<description><![CDATA[[Code] #include&#60;stdio.h&#62; #include&#60;conio.h&#62; #include&#60;math.h&#62; void hanoi(int x, char from,char to,char aux) { if(x==1) { printf(&#8220;Move Disk From %c to %c\n&#8221;,from,to); } else { hanoi(x-1,from,aux,to); printf(&#8220;Move Disk From %c to %c\n&#8221;,from,to); hanoi(x-1,aux,to,from); } } void main() { int disk; int moves; clrscr(); printf(&#8220;Enter the number of disks you want to play with:&#8221;); scanf(&#8220;%d&#8221;,&#38;disk); moves=pow(2,disk)-1; printf(&#8220;\nThe No [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=115&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>[Code]<br />
#include&lt;stdio.h&gt;<br />
#include&lt;conio.h&gt;<br />
#include&lt;math.h&gt;</p>
<p>void hanoi(int x, char from,char to,char aux)<br />
{<br />
if(x==1)<br />
{<br />
printf(&#8220;Move Disk From %c to %c\n&#8221;,from,to);<br />
}<br />
else<br />
{<br />
hanoi(x-1,from,aux,to);<br />
printf(&#8220;Move Disk From %c to %c\n&#8221;,from,to);<br />
hanoi(x-1,aux,to,from);<br />
}<br />
}<br />
void main()<br />
{<br />
int disk;<br />
int moves;<br />
clrscr();<br />
printf(&#8220;Enter the number of disks you want to play with:&#8221;);<br />
scanf(&#8220;%d&#8221;,&amp;disk);<br />
moves=pow(2,disk)-1;<br />
printf(&#8220;\nThe No of moves required is=%d \n&#8221;,moves);<br />
hanoi(disk,&#8217;A',&#8217;C',&#8217;B');<br />
getch();<br />
}<br />
[/Code]</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/115/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/115/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/115/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=115&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/19/tower-of-hanoi/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>
	</item>
		<item>
		<title>Getting dig into SQL CLR</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/18/getting-dig-into-sql-clr/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/18/getting-dig-into-sql-clr/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 09:29:06 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/2010/11/18/getting-dig-into-sql-clr/</guid>
		<description><![CDATA[SQL CLR is a new SQL Server feature that allows you to embed logic written in C#, VB.Net, and other managed code into the body of T-SQL objects like stored procedures, functions, triggers, aggregates and types. Client applications interact with these resulting routines like they are written in native T-SQL. Internally, things like string manipulations [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=114&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>SQL CLR is a new SQL Server feature that allows you to embed logic written in C#, VB.Net, and other managed code into the body of T-SQL objects like stored procedures, functions, triggers, aggregates and types. Client applications interact with these resulting routines like they are written in native T-SQL. Internally, things like string manipulations and complex calculations become easier to program because you are no longer restricted to using T-SQL and now have access to structured .Net languages and the reuse of base class libraries. Externally, the logic you create is wrapped in T-SQL prototypes so that the client application is not aware of the implementation details. This is advantageous because you can employ SQL CLR where you need it without rearchitecting your existing client code.</p>
<p>With SQL CLR, you are also freed from the constraint of logic that applies only within the context of the database. You can with appropriate permissions write logic to read and write to file systems, use logic contained in external COM or .Net DLLs. These capabilities are exciting and concerning, especially in the historical context of new feature overuse. To help you use this new feature appropriately, we want to make sure that you understand how it integrates with SQL Server and where this feature may be heading. In this chapter, well give you this type of overview. Well spend the rest of the book explaining these concepts using real-world SQL CLR examples that you can use today.</p>
<p>Lets go through step by step for your first introduction on sql clr.</p>
<p>The first step in creating a stored procedure (or any database object) is to create a SQL Server project in Visual Studio:</p>
<ul>
<li>From the File menu, create a new project</li>
<li>In the New Project Dialog, select and expand a language node in the Project Types area</li>
<li>Select the Database node</li>
<li>Select the SQL Server Project template</li>
<li>Click OK and you are done</li>
</ul>
<p>Next you will be promted of of creating sql connection to connect to sql server. But wait, before that your datebase and server need to be configured to run/host SQL CLR.</p>
<p>If you dont know how to do that just run the following code in your query window</p>
<p>sp_configure clr enabled, 1</p>
<p>GO</p>
<p>RECONFIGURE</p>
<p>GO</p>
<p>Creating your first user defined CLR function</p>
<ul>
<li>Open an existing SQL Server Project, or create a new one. From the Project menu, select Add New Item.</li>
<li>Select User Defined Function</li>
<li>Type a Name for the new user defined function.</li>
<li>Add code to run when the function is executed.</li>
<li>In the following code snippet, i have written a custom user defined SQL CLR function which convert the european anccented characters into regular english character.</li>
</ul>
<p><code>[Code]public partial class UserDefinedFunctions </code></p>
<p><code>{ </code></p>
<p><code>[Microsoft.SqlServer.Server.SqlFunction(<br />
</CODE><CODE>DataAccess = DataAccessKind.None, Name =<br />
"fnReplaceAccentedCharacters", IsDeterministic = true)] public static SqlString fnReplaceAccentedCharacters(SqlString inputString) </code></p>
<p><code>{ </code></p>
<p><code>SqlString xReturnValue=""; </code></p>
<p><code>Int16 a; </code></p>
<p><code>String[,] xCharGroup ={{"à", "a"}, {"â", "a"}, {"ä", "a"}, {"é", "e"}, {"è", "e"}, {"ê", "e"}, {"ë", "e"}, {"î", "i"}, {"ï", "i"}, {"ô", "o"}, {"ö", "o"}, {"û", "u"}, {"ü", "u"}, {"ù", "u"}, {"ç", "c"}, {"", "oe"}, {"", "oe"}, {" ", "-"}}; </code></p>
<p><code>for (a = 0; a &lt; xCharGroup.GetLongLength(0); a++)</code></p>
<p><code>inputString = ((String)inputString).Replace(xCharGroup[a, 0], xCharGroup[a, 1]); </code></p>
<p><code>return (xReturnValue=inputString); </code></p>
<p><code>} </code></p>
<p><code>};[/code]</code></p>
<p>Once the code is ready, you can build and deploy the code to the database by pressing F5′.</p>
<p>To test the deployment, there is a file in your project called test.sql. In this file, you can add script calls to the obects you just created. For example, to call the function created above, enter: Select dbo.fnReplaceAccentedCharacters(des objets de très grande qualité, originaux, épurés,)</p>
<p>Thats it. If the stored procedure was written correctly, you will now see this item in list of functions in your management stuidio. However, youll see the object has a lock icon next to it, as shown below. This is because the object is not editable outside of the Visual Studio project.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/114/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/114/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/114/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=114&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/18/getting-dig-into-sql-clr/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>
	</item>
		<item>
		<title>guidelines for asp.net development</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/18/guidelines-for-asp-net-development/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/18/guidelines-for-asp-net-development/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 09:28:57 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/2010/11/18/guidelines-for-asp-net-development/</guid>
		<description><![CDATA[&#60;!– ASP.NET Development guidelines &#60;!&#8211;[if !supportLists]&#8211;&#62;· &#60;!&#8211;[endif]&#8211;&#62;Guidelines for ASP.NET AJAX Performance Improvement Among the 95% of the .NET developers that said they are using some flavor of Ajax either in production, development or prototype, the most used AJAX Framework is ASP.NET AJAX, with 73,7%, followed by the Ajax Control Toolkit which is used by almost [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=113&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>&lt;!–</p>
<p>ASP.NET Development<br />
guidelines</p>
<p>&lt;!&#8211;[if<br />
!supportLists]&#8211;&gt;·<br />
&lt;!&#8211;[endif]&#8211;&gt;<strong>Guidelines<br />
for ASP.NET AJAX<br />
Performance Improvement</strong></p>
<p>Among the 95% of the .NET developers that said they are<br />
using some flavor of Ajax either in production, development or prototype, the<br />
most used AJAX Framework is ASP.NET AJAX, with 73,7%, followed by the Ajax<br />
Control Toolkit which is used by almost half of the .NET developer that are<br />
using Ajax.</p>
<p>However ASP.NET AJAX model is showing performance problem.<br />
The web application developed in ASP.NET AJAX makes the site slow down.</p>
<p>So following are the few of guideline which will help you<br />
out to improve performance of ASP.NET AJAX application. This will basically<br />
apply to the ASP.NET AJAX version 1.0 final release.</p>
<ol>
<li>Use HttpWatch to check the network traffic.
<ol>
<li>This is one of important tool using which you can check the data returned by<br />
the server. There is dedicated tool available for this. Moreover to that<br />
you can also utilize Firebux extension of firefox to watch network<br />
traffic. The dedicated tool is available for the download from following<br />
URL: <a href="http://www.httpwatch.com/download/.">http://www.httpwatch.com/download/.</a> This is a limited feature version.</li>
</ol>
</li>
<li>Use “ScriptReferenceProfile” to show Javascript reference
<ol>
<li>ScriptReferenceProfiler is an open source tool on CodePlex, for analysis the JavaScript<br />
references of ASP.NET AJAX, we can simply add the following code to our<br />
page in order to show the JavaScript references imported by<br />
ScriptManager. &lt;microsoft:scriptreferenceprofiler runat=“server”&gt;</li>
</ol>
</li>
</ol>
<p>&lt;/microsoft:scriptreferenceprofiler&gt;</p>
<p>You can obtain it from the following URL</p>
<p>Reference: <a href="http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=13356">http://www.codeplex.com/aspnet/Release/ProjectReleases.aspx?ReleaseId=13356</a></p>
<ol>
<li>Web.Config Optimization
<ol>
<li>To have optimized web.config file our application, all we need to do is to<br />
have a compression and caching is enabled in web.config file for the<br />
ASP.NET AJAX Includes. You can use the following code in web.config file<br />
to enable compression &amp; caching for AJAX includes. &lt;system.web.extensions&gt;</p>
<p>&lt;scripting&gt;</p>
<p>&lt;scriptResourceHandler enableCompression=“true” enableCaching=“true”/&gt;</p>
<p>&lt;/scripting&gt;</p>
<p>&lt;/system.web.extensions&gt;</p>
<p>Also check before and after result of before and after of enabling<br />
caching &amp; compression in network traffic.</p>
<p>Now this is limited to the compression and caching for AJAX includes. In our site we also<br />
generally have many other script files included. There can also be no. of<br />
different CSS files, JS files etc. We can also compress them so that It make fewer request in bytes.</p>
<p>Basically there is no any method available in ASP.NET which allows the<br />
compression of JS &amp; CSS files. We need to do it manually and<br />
reference those compressed file in our application.</p>
<p>One very key important point to consider is related to change management<br />
of those files. Once you have compressed file in place and referenced in<br />
your different pages, If your JS file or CSS<br />
file need to have any modification, then you again have to recompress it<br />
from newer version.</p>
<p>So this method should be adopted for such scripts or CSS which are less<br />
frequently changed.</p>
<p>There are different tools available which allows your script and CSS file<br />
compression. Following are the different methods which can be used for<br />
this purpose.</p>
<p>1) Yahoo compresser (<a href="http://yui.2clics.net/">http://yui.2clics.net/</a>)</p>
<p>2) <a href="http://www.vlead.in/resources/tools/minify-javascript/index.php">http://www.vlead.in/resources/tools/minify-javascript/index.php</a><br />
(The best one which I utilized)</li>
</ol>
</li>
<li>Optimization of ScriptManager
<ol>
<li>The ScriptManager control manages client script for AJAX-enabled ASP.NET Web<br />
pages. By default, the ScriptManager control registers the script for the<br />
Microsoft AJAX Library with the page. This enables client script to use<br />
the type system extensions and to support features such as partial-page<br />
rendering and Web-service calls. Following, we need to setting<br />
the property of ScriptManager to optimize the performance of ASP.NET<br />
AJAX.</li>
</ol>
</li>
</ol>
<p>&lt;!&#8211;[if<br />
!supportLists]&#8211;&gt;·<br />
&lt;!&#8211;[endif]&#8211;&gt;Set “scriptMode” to Release.</p>
<p>for e.g.</p>
<p>&lt;asp:ScriptManager ID=”ScriptManager1″<br />
runat=”server” ScriptMode=”Release”&gt;</p>
<p>&lt;/asp:ScriptManager&gt;</p>
<p>Moreover to this set “debug” mode in “compilation” section of web.config file<br />
to <em>false</em>.</p>
<p>&lt;!&#8211;[if !supportLineBreakNewLine]&#8211;&gt;<br />
&lt;!&#8211;[endif]&#8211;&gt;</p>
<p>&lt;!&#8211;[if<br />
!supportLists]&#8211;&gt;·<br />
&lt;!&#8211;[endif]&#8211;&gt;Disable partial page rendering</p>
<p>If we using the UpdatePanel in the page, we must set this property to true,<br />
conversely, if the UpdatePanel is not using in our page, it would be better<br />
that we set the EnablePartialRendering to false.</p>
<p>For e.g.</p>
<p>&lt;asp:ScriptManager ID=”ScriptManager1″ runat=”server”<br />
EnablePartialRendering=”false”&gt;</p>
<p>&lt;/asp:ScriptManager&gt;</p>
<ol>
<li>Move All Script Tags After Body Content
<ol>
<li>ASP.NET ScriptManager control has a property “LoadScriptsBeforeUI”, when set to<br />
false, should load all AJAX<br />
framework scripts after the content of the page. But it does not<br />
effectively push down all scripts after the content. Some framework<br />
scripts, extender scripts and other scripts registered by Ajax Control<br />
Toolkit still load before the page content loads.</li>
</ol>
</li>
</ol>
<p>So these are the basic general guidelines which can be<br />
followed one by one to have an improved ASP.NET AJAX response.</p>
<p>&lt;!&#8211;[if<br />
!supportLists]&#8211;&gt;·<br />
&lt;!&#8211;[endif]&#8211;&gt;<strong>Guideline<br />
for ASP.NET Application Performance</strong></p>
<p>Following, I will demonstrate some of important guideline<br />
for the improvement of ASP.NET application. These guidelines should be<br />
implemented carefully by taking into consideration of development needs. It is<br />
not necessary to have all following steps followed.</p>
<ol>
<li>Removing unnecessary HTTP MODUES from site.
<ol>
<li>There are several ASP.NET default HttpModules which<br />
sit in the request pipeline and intercept each and every request. For example, if you aren’t using Membership and Profile provider, you<br />
don’t need “FormsAuthentication” module. If you aren’t using Windows<br />
Authentication for your users, you don’t need “WindowsAuthentication”.</p>
<p>We can remove those unnecessary references of HTTP modules from<br />
web.config using &lt;remove&gt; tag.</p>
<p>Generally following are the HTTP modules which are not generally used in<br />
our current development architecture.</p>
<p>&lt;remove name=”WindowsAuthentication” /&gt;</p>
<p>&lt;remove name=”PassportAuthentication” /&gt;</p>
<p>&lt;remove name=”AnonymousIdentification” /&gt;</p>
<p>&lt;remove name=”UrlAuthorization” /&gt;</p>
<p>&lt;remove name=”FileAuthorization” /&gt;</li>
</ol>
</li>
<li>Removing or compressing “VIEWSTATE” from page
<ol>
<li>We can override few of method of default System.Web.UI.Page class of .net<br />
framework. Use the following file and include it in your project’s APP_CODE.<br />
Inherits rest of all your pages from this page instead of regular System.Web.UI.Page<br />
class.</p>
<p>Ref: BasePage.vb<br />
&lt;!&#8211;[if<br />
!supportLineBreakNewLine]&#8211;&gt;<br />
&lt;!&#8211;[endif]&#8211;&gt;</li>
</ol>
</li>
<li>Use caching for pages which changes less frequently
<ol>
<li>There are several ways to use the cache; we’ll focus on the easiest tricks to<br />
get you started, then point you toward some resources that will help you<br />
tackle more advanced ways to utilize the cache. The simplest solution is to use the OutputCache directive on your pages<br />
or user controls.</li>
</ol>
</li>
<li>Disable VIEWSTATE for pages where no Grid related functionality.
<ol>
<li>One should set the VIEWSTATE disabled in those pages where there is no grid<br />
level manipulation. When we have a simple page with no complex logic, it<br />
should be disabled. Moreover to that set the following pages which are not security<br />
sensitive.</p>
<p>1) EnableViewStateMac=”false”</p>
<p>2) ViewStateEncryptionMode=”never”<br />
&lt;!&#8211;[if<br />
!supportLineBreakNewLine]&#8211;&gt;<br />
&lt;!&#8211;[endif]&#8211;&gt;</li>
</ol>
</li>
<li>Use classical ASP type of page for normal pages.
<ol>
<li>Another important point is to use a classical ASP type of pages which are simple.<br />
Those pages which do not have any complex display should be developed<br />
like normal ASP pages. Please check the following referenced page for<br />
this similar purpose. these are such files which do not have underlying code behind file<br />
attached to it.</p>
<p>We can also utilize the feature of “include” file method which is there<br />
in classical ASP.</li>
</ol>
</li>
</ol>
<p>&lt;!&#8211;[if<br />
!supportLists]&#8211;&gt;·<br />
&lt;!&#8211;[endif]&#8211;&gt;<strong>Guidelines<br />
for structuring ASP.NET Application</strong></p>
<p>In the following, I will demonstrate the basic guidelines<br />
for the structuring of any web application.</p>
<p>See these guidelines are generally be best suitable for SEO<br />
oriented sites. It can also be adopted for general site also keeping<br />
requirement in mind.</p>
<p>These guidelines are prepared keeping modularized<br />
development in mind. So there are no such tricks that by following them you<br />
will be able to better structure your site. One should do the do modularized<br />
development in their programming also to achieve this.</p>
<ol>
<li>Use dedicated folders for JS &amp; CSS files.In a site generally there are different JS &amp; CSS files for different<br />
functionality. These JS &amp; CSS files should be accordingly structure<br />
inside your website. Please take a look at the following example for the<br />
better illustration of this method. Say for e.g. in a site few pages have functionality to display a jQuery<br />
zoom light box when anyone click on the image of product.</p>
<p>So following should be the structure of JS &amp; CSS files.</p>
<p>In this example, assume there are also few global JS &amp; CSS. So I will<br />
also demonstrate the purpose of integrating them in site.</p>
<p><strong>Root</strong></p>
<p>|___<strong>js</strong></p>
<p>| |___<strong>lightbox</strong></p>
<p>| |___lightbox.js</p>
<p>|____|___<strong>global</strong></p>
<p>|____jquery-1.2.6.min.js</p>
<p>|____common.js</p>
<p>|___<strong>css</strong></p>
<p>|<strong> |___lighbox</strong></p>
<p>| <strong>|___ </strong>lighbox.css</p>
<p>|________<strong>global</strong></p>
<p>|____global.css</p>
<p>This modularization can also be used to<br />
differentiate CSS &amp; JS for each page of site.</p>
<p>Modularization is also not limited to the CSS &amp; JS files, one can<br />
follow same modularization concept across different type of files also<br />
like XML content, flash content, image folders etc.</p>
<p>&lt;!&#8211;[if<br />
!supportLineBreakNewLine]&#8211;&gt;<strong><br />
&lt;!&#8211;[endif]&#8211;&gt;</strong></li>
<li>Use proper naming conversion in CSS files.
<ol>
<li>Care full design of CSS classes and attributes provide better traceability. As<br />
you just shown above that the CSS &amp; JS can be modularized. We should<br />
also use proper naming convention in those CSS file. If you follow these<br />
conventions, you can easily identify respective class. Say for e.g.</p>
<p>you set naming abbreviation of respective CSS as per below.</p>
<p><strong>1) global.css<br />
= glb</strong></p>
<p><strong>2) lightbox.css = lg</strong></p>
<p>so now you can have following CSS class/section defined in respective css<br />
files.</p>
<p>like in global.css</p>
<p>glb-main</p>
<p>{</p>
<p>}</p>
<p>.glb-title</p>
<p>{</p>
<p>color: #7D3D0D;</p>
<p>font-family: Arial;</p>
<p>font-size: 20px;</p>
<p>font-weight: normal;</p>
<p>text-decoration: none;</p>
<p>clear: both;</p>
<p>}</p>
<p>in the same way, you can also different class in lighbox.css</p>
<p>.lg-dvtop</p>
<p>{</p>
<p>width: 100%;</p>
<p>margin: 20px 10px 10px 10px;</p>
<p>}</p>
<p>.lg-content</p>
<p>{</p>
<p>width: 700px;</p>
<p>height: 600px;</p>
<p>}</li>
</ol>
</li>
<li>Configure<br />
APP_CODE to have two sub directories. Each sub directory can be used for<br />
different language. It is generally like following. APP_CODE<br />
|___VB</p>
<p>|___CS</p>
<p>Respective programming files should be placed in respective folders. Also<br />
make sure to configure code sub directory in web.config also.</li>
</ol>
<p>&lt;!&#8211;[if<br />
!supportLists]&#8211;&gt;·<br />
&lt;!&#8211;[endif]&#8211;&gt;<strong>Guidelines<br />
before final release of site</strong></p>
<p>Following, there are some important and necessary checks<br />
that web-sites should be checked against before the official launch.</p>
<ol>
<li>Favicon
<ol>
<li>A favicon icon the tab or window in which your website is open in the<br />
user’s browser. It is also saved with the bookmark so that users can<br />
easily identify pages from your website. for e.g.</p>
<p>&lt;link href=”images/fav_icon.ico” rel=”icon”<br />
type=”image/Jpeg” /&gt;<br />
&lt;!&#8211;[if !supportLineBreakNewLine]&#8211;&gt;<br />
&lt;!&#8211;[endif]&#8211;&gt;</li>
</ol>
</li>
<li>Title &amp; Meta data
<ol>
<li>Your page title is the most important element for SEO and is also important so<br />
that users know what’s on the page. Make sure it changes on every page<br />
and relates to that page’s content. Also one should make sure that related meta data<br />
details are also get placed in every pages and are changes as it should<br />
be to different pages.</li>
</ol>
</li>
<li>Cross-Browser Check
<ol>
<li>The most popular browsers to check are Internet Explorer 6, 7 and 8, Firefox<br />
3, Safari 3. Following are the few methods used to do cross browser check 1) XecoCode (<a href="http://www.xenocode.com/browsers/">http://www.xenocode.com/browsers/</a>)</p>
<p>2) IETester (<a href="http://www.my-debugbar.com/wiki/IETester/HomePage">http://www.my-debugbar.com/wiki/IETester/HomePage</a>)</p>
<p>3) Browser shot (<a href="http://browsershots.org/">http://browsershots.org/</a>)</li>
</ol>
</li>
<li>Links
<ol>
<li>Don’t just assume all your links work. Click on them. You may often forget to<br />
add “<a href="http:">http://”</a> to links to external websites. There may be case when some<br />
URL rewriting related prefix or postfix would be forgotten.</li>
</ol>
</li>
</ol>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/113/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/113/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/113/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=113&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/18/guidelines-for-asp-net-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>
	</item>
		<item>
		<title>Law of simplicity</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/18/law-of-simplicity/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/18/law-of-simplicity/#comments</comments>
		<pubDate>Thu, 18 Nov 2010 09:28:19 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/2010/11/18/law-of-simplicity/</guid>
		<description><![CDATA[I came across an interesting set of principles that you might want to keep in mind the next time you set out to design an application, a website, or even improve your daily life. They are The Laws of Simplicity and were conceived by John Maeda, an artist and noted computer scientist from the MIT [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=112&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I came across an interesting set of principles that you might want to keep<br />
in mind the next time you set out to design an application, a website, or even<br />
improve your daily life. They are <strong><em>The Laws of Simplicity</em></strong><br />
and were conceived by John Maeda, an artist and noted computer scientist from<br />
the MIT Media Lab. He compiled them in a short, 100-page book (and posted them<br />
on his website as well). I found them in a back issue of Wired<br />
magazine, in an article that applied them in<br />
a critique some new gadget. I have since found that they increasingly<br />
influence my own analysis of UIs and websites, and occassionally<br />
use them as the basis for discussions with clients to keep a design<br />
session on track.</p>
<p>The Laws are:</p>
<p>1. Reduce The simplest way to achieve simplicity is through<br />
thoughtful reduction of functionality.</p>
<p>2. Organize Organization makes a system of many appear fewer.</p>
<p>3. Time Savings in time feel like simplicity.</p>
<p>4. Learn Knowledge makes everything simpler.</p>
<p>5. Differences Simplicity and complexity need each other.</p>
<p>6. Context What lies in the periphery of simplicity is de?nitely not peripheral.</p>
<p>7. Emotion More emotions are better than less.</p>
<p>8. Trust In simplicity we trust.</p>
<p>9. Failure Some things can never be made simple.</p>
<p>10. The One Simplicity is about subtracting the obvious, and adding the<br />
meaningful.</p>
<p>You can find a more detailed explanation of each law on his <a title="http://lawsofsimplicity.com/category/laws?order=ASC" href="http://lawsofsimplicity.com/category/laws?order=ASC"><strong>site</strong></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/112/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/112/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/112/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=112&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/18/law-of-simplicity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>
	</item>
		<item>
		<title>Communication &#8211; From developers point of view</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/15/communication-from-developers-point-of-view/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/15/communication-from-developers-point-of-view/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 05:30:51 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/?p=109</guid>
		<description><![CDATA[Introduction: By definition communication means: It is the process of passing information and understanding from one person to another. It is essentially a bridge of meaning between people. By using the bridge of meaning, a person can safely cross the river of misunderstanding that separates all the people. History of communication says that it comes [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=109&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>Introduction:<br />
</strong></p>
<ol>
<li>By definition communication means: <em>It is the process of passing information and understanding from one person to another. It is essentially a bridge of meaning between people. By using the bridge of meaning, a person can safely cross the river of misunderstanding that separates all the people.</em>
<p>History of communication says that it comes from a Latin word: communicare, which as three meaning imminent from it:</p>
<ol>
<li>To make common, which is probably can be derived from 2 or 3.</li>
<li>Cum + munus, its like having a gift to share in mutual donation.</li>
<li>Building together a defence.</li>
</ol>
<p>From the developer point of view (I hope reader is somewhere involved programming J ), communication is real important factor to improvise ones potentiality. A good leader has to be a good communicator. Its not so that communication skills means the way you talk, the way you present your idea to others. Communication skill involves many other areas. Like: Verbal communication, Non verbal communication, written communication, Gesture communication etc.</p>
<p>All these are nuts &amp; bolts for being a good communicator.</p>
<p>Communication makes you perfect in demonstrating your ideas to front end people. Lets take few examples that give you glimpse why communication skill is so important for a developer/leader.</p>
<ol>
<li>Think what if you are a technical leader and your client has given you a task. You are supposed to present him technical feasibility report or say you wanted to explain him/her flow of your system. If you are not have a good command over your English, collections vocabulary, you are not used to prepare &amp; utilize MS word, then?</li>
<li>In number of different occasions, we as developer/leader need to talk with different users. These users may be end users of system, stack holders, clients who have given as project to work on. Different people have different emotions and different style of communication. In these cases, you need to communicate in a balanced view.</li>
<li>When I was a fresher, digging into the word of programming. We were instructed that when any CRUD operation is performed, you need to show users a message that operation successfully completed. When in an application someone create a PO from their site, I say them operation successfully completed. But what operation? J</li>
</ol>
<p>Well, there are many many many other points that can be put here in list, but in that case you may avoid to read my article. And I dont want to make that happen J.</p>
<p>So lets take a took some important <strong>characteristics of a good communication</strong>.</p>
<ol>
<li><strong>Its a two way process</strong> Its quite understandable. In any communication system there are two parties involved. One is <em>Transmitter</em> another is <em>receiver</em>. Overall motto of communication is to delivery your message to other parties. It may be comprising of debate, discussion etc.</li>
<li><strong>Its continuous process<br />
</strong>Communication process continues to the extent that ideas and messages are communicated and received. Like for e.g. if we are at system analysis stage for any project. Continues discussion is very important. As a analyst, we have to be in contact with stack holder to understand their requirement. We have to identify end user who is going to use the software/application. </li>
<li>It can be in formal way or informal way, though it may be in different medium.</li>
</ol>
<p><strong>Elements of communication<br />
</strong></p>
<p><strong>Why communication is so important for us?<br />
</strong></p>
<p>It is important because.</p>
<ol>
<li>Making enterprise run smoothly.</li>
<li>Quick decision and implementation.</li>
<li>Project planning &amp; coordination.</li>
<li>Maximizing productivity.</li>
<li>Morale building/Motivation tool and developing your democratic leadership style.</li>
</ol>
<p>Properly recorded communication documents, system analysis docs., technical specification, ER diagrams, these are the documents that we generally prepare so that it make ease for any new comer in organization to get settle with his project. This makes organization to run smooth.</p>
<p>Moreover, properly maintained documents allow you to make quick discussion in hurry.</p>
<p>For proper co-ordination and maintenance, developer can utilize different project management tools. To name few here are some of them.</p>
<ol>
<li><a href="http://www.mantisbt.org/">www.mantisbt.org</a> MantisBT is a popular free web-based bug tracking system.</li>
<li><a title="BasecampHQ.com" href="http://tomuse.com/goto/Basecamp">Basecamp</a></li>
<li><a title="CentralDesktop.com" href="http://tomuse.com/goto/CentralDesktop">Central Desktop</a></li>
<li><a title="5pmweb.com" href="http://tomuse.com/goto/5pm">5pm</a></li>
</ol>
<p>You can get more information for such tools from this article.</p>
<p><a href="http://tomuse.com/top-10-best-free-online-project-management-application-services/">http://tomuse.com/top-10-best-free-online-project-management-application-services/</a></p>
<p>There are different kinds of communication methods. Like</li>
</ol>
<ul>
<li>Verbal or oral communication</li>
<li>Written communication</li>
<li>Formal communication, informal communication</li>
</ul>
<p>Developers are used to choose from these methods according to availability of resources and situation. Mostly verbal or written communication is widely popular among us. Formal communication has special delegation of authority, which means a project leader has given sufficient rights to make certain decision without asking to their superiors. Where in informal communication, there is no authority defined. It is conveyed by simple gesture, glance, smile, silence.</p>
<p><strong>Effective communication<br />
</strong></p>
<ol>
<li>While you are in presentation, instructing to group of developers, doing video conferencing with other peers on remote location, <strong>Clarity of Thoughts</strong><br />
is really important.</li>
<li>Something just cant be explained by words. You have to react with your body. It is important to <strong>attach importance to actions rather than words</strong>.</li>
<li><strong>Participation </strong> as said earlier, its a two way process which require involvement of all the parties. If you are not involved mentally in communication process, you are not going to perform your task well. Your presence is must. If your leader informed you about coding standard to be maintained, and if you dont remember those, you will in trouble.</li>
<li><strong>What to communicate?</strong> Prepare the agenda that you need to talk about before you initiate. Collect all the required documents, technical specifications, proof reports, different analysis report before you talk with your superior or clients.</li>
<li><strong>When to communicate?</strong> Mutually decide timing with your parties involved in. You can either initiate or let your parties to initiate and decide when to communicate. You can place meeting request in outlook, send them emails, take care of geographical difference in timing, ask for the availability and long will be the meeting etc.</li>
<li><strong>How to communicate?</strong> Choose the medium that you want to communicate through. If discussion matter to be explained to a technical person, chat or peer to peer method can be best suited. If talking with non technical person, you have to represent your ideas to your parties in such a way that he can understand your thoughts. You may explain them using different diagrams, preparing documents and go through documents while you discuss, giving them references about what are trying to demonstrate him. There are no. of collaboration tools are there in market which you can use for this purpose. Like we have google wave, Webex, Skype voice chat, video conferencing through different tools etc.</li>
<li><strong>How often to communicate? </strong>As I said that its a continuous process. You cant make sure that having discussion for 5-6 hours, you will come out with your objective. Its an iterative process. You should try to divide your agenda into groups. Discuss them at different time interval. Make all agenda clear step by step. Try to identify issues relating to each other and communicate them as well. </li>
<li><strong>What is the objective of communication? </strong>It is almost similar to identifying communication goal/agenda. But the objective of communication here is in the term of what is the outcome we are expecting to come from it. When project is running out of time, meeting by team leader is to motivate developers to encourage them to get it done at right time.</li>
<li><strong>Keep the channel alive<br />
</strong></li>
<li><strong>Cordial superior </strong>Once finished communication, it should be conveyed to your superior that what was the outcome? What where the agenda? What are clients new requirements? What do you suggest for different points to client? How was the response from client etc.</li>
<li><strong>Get the feedback </strong>Generally when you dial in to customer care of your cellular provider, right after you finish your talk with them, you receive message regarding feedback for the person you talked with. This is the process of evaluation. Its not to make garbage employees collection. Its about gathering customers response how they like customer care person to be behaved. So gathering those feedback we can evaluate and enhance process. </li>
</ol>
<p>To make such effective communication, what should you do? Or what should you have? Here is answer for you.</p>
<ul>
<li><strong>Develop a positive attitude</strong>.</li>
<li><strong>Bad feelings should not hamper discussion </strong>Human is social animal. Different people have different mentality. All have different approach to grow and perform tasks. When we are working in organization, we work in a team. It is sometime obvious that different group member have conflict with other peers. When working as team, it is must that team show their team effort rather than individuals. So your bad feeling with others should not hinder communication. </li>
<li><strong>Use logic to manage difficult situations<br />
</strong></li>
<li><strong>Develop Harmonious interpersonal relationships. It is secret of business relationship</strong>.</li>
</ul>
<p>And for effective oral communication, you should have..</p>
<ul>
<li><strong>Understanding and use of appropriate language.<br />
</strong></li>
<li><strong>Organize and sequence of thoughts properly.<br />
</strong></li>
<li><strong>Vocabulary power.<br />
</strong></li>
<li><strong>Command over illustrations, examples.<br />
</strong></li>
<li><strong>Proper pronunciation.<br />
</strong></li>
<li><strong>Proper use of sound system/equipments.<br />
</strong></li>
<li><strong>Listening ability.<br />
</strong></li>
<li><strong>Effective telephonic talk.<br />
</strong></li>
</ul>
<p>And for written communication.</p>
<ul>
<li><strong>Command over the language.<br />
</strong></li>
<li><strong>Word power and spelling.<br />
</strong></li>
<li><strong>Correct grammar.<br />
</strong></li>
<li><strong>Proper structuring of the written message<br />
</strong></li>
<li><strong>Use of appropriate channels like courier, e-mail, etc.<br />
</strong></li>
<li><strong>Attention to hand writing, typing, printing.<br />
</strong></li>
</ul>
<p>And for non verbal communication.</p>
<ul>
<li><strong>Observation skills.<br />
</strong></li>
<li><strong>Awareness about the body movement.<br />
</strong></li>
<li><strong>Proper interpretation of the non-verbal message.<br />
</strong></li>
</ul>
<p>Well no system is perfect in the world. There is always barrier in everything we do. Effective communication itself has its own. It is said that 30% communication the word are failed to success due to loss in transmission. Inaccurate translation, false impression, fear, noise etc. are the elements as barrier of communication. Though I am not going to tell you all here J.</p>
<p>So here I would like to conclude my article, hope I covered all skills of written communication in my article J. I also hope that I am able to convey to my message.</p>
<p>So see you next time till then happy communication &amp; happy programming</p>
<p>Cheers..</p>
<p><a href="http://mkansagarfa.files.wordpress.com/2010/11/071510_0732_1.png"><img src="http://mkansagarfa.files.wordpress.com/2010/11/071510_0732_1.png?w=460&#038;h=276" alt="" title="071510 0732 1" width="460" height="276" class="alignnone size-full wp-image-110" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/109/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/109/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/109/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=109&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/15/communication-from-developers-point-of-view/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>

		<media:content url="http://mkansagarfa.files.wordpress.com/2010/11/071510_0732_1.png" medium="image">
			<media:title type="html">071510 0732 1</media:title>
		</media:content>
	</item>
		<item>
		<title>How to call Google MAP Webservice API from asp.net, call Geocoding Map API Webservice from asp.net</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/15/how-to-call-google-map-webservice-api-from-asp-net-call-geocoding-map-api-webservice-from-asp-net/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/15/how-to-call-google-map-webservice-api-from-asp-net-call-geocoding-map-api-webservice-from-asp-net/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 05:30:31 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/2010/11/15/how-to-call-google-map-webservice-api-from-asp-net-call-geocoding-map-api-webservice-from-asp-net/</guid>
		<description><![CDATA[How the necessities arise? Necessity is mother of invention. I was assigned a task to develop a restaurant portal. The basic aim behind creation of this project is to have a marketplace for all restaurant owner or hotel business, and provide end user with integrative google map services so that they visualize realtime. If we [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=108&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><strong>How the necessities arise?<br />
</strong></p>
<p>Necessity is mother of invention.</p>
<p>I was assigned a task to develop a restaurant portal.</p>
<p>The basic aim behind creation of this project is to have a marketplace for all restaurant owner or hotel business, and provide end user with integrative google map services so that they visualize realtime.</p>
<p>If we are supposed to insert a simple google map, then we just have to insert a piece javascript code, and boom you are done.</p>
<p>But in my project, I have requirement where different restaurant/hotel owner register and give us their details and addresses.</p>
<p><strong>So, What is Google Map API?<br />
</strong></p>
<p>The Google Maps API lets you embed Google Maps in your own web pages with JavaScript. The API provides a number of utilities for manipulating maps and adding content to the map through a variety of services, allowing you to create robust maps applications on your website.</p>
<p>All map related functionalities can be achieved as seen on </p>
<p><strong>Then what was hurdle for me in using Map API?<br />
</strong></p>
<p>These are the pure JavaScript code..!! You can develop whatever rich Map application you wanted to develop by writing piece of JavaScript codes.</p>
<p>Actually to host a map on your page, you need to have two parameters, Latitude &amp; Longitude. But how do I get lat. and long. from server side scripting?</p>
<p>But I had no idea how to call Google Map API from C#/VB.NET.</p>
<p>So for my project, as usual, I start googling to find out my piece of sweet.</p>
<p>After searching for couple of hours, I come across this good article.</p>
<p><a href="http://webcodeblog.com/2010/04/24/obtain-latitude-and-longitude-co-ordinates-for-an-address-using-asp-net-and-the-google-maps-api/">http://webcodeblog.com/2010/04/24/obtain-latitude-and-longitude-co-ordinates-for-an-address-using-asp-net-and-the-google-maps-api/</a></p>
<p>Here the author explained the how to obtain the latitude and longitude co-ordinates for an address using the Google Maps API.</p>
<p>But again here, it is pure JavaScript that utilize Google Map API to get lat &amp; long of any address. But my problem is still there?</p>
<p><strong>Hurrray.. I found the solution<br />
</strong></p>
<p>Then accidently I come to across Google Maps API Web Services.</p>
<p>It is basically Maps API Web Services, a collection of HTTP interfaces to Google services providing geographic data for your maps applications.</p>
<p>In the documentation (<a href="http://code.google.com/apis/maps/documentation/webservices/">http://code.google.com/apis/maps/documentation/webservices/</a>),</p>
<p>I see that you can utilize Google Map API web service by making HTTP request to a specific URL, providing necessary parameters with URL. Which in return, gives a response in desired format.</p>
<p>You can get response inform of JSON or XML.</p>
<p>Say for e.g. it can be called like this URL</p>
<iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/geo?q=khandala, maharashtra&amp;output=embed&amp;key=xxxxxxxxxxxxxx&amp;s=AARTsJp56EajYksz3JXgNCwT3LJnGsqqAQ"></iframe><br /><small><a href="http://maps.google.com/maps/geo?q=khandala, maharashtra&amp;source=embed&amp;key=xxxxxxxxxxxxxx&amp;s=AARTsJp56EajYksz3JXgNCwT3LJnGsqqAQ" style="text-align:left">View Larger Map</a></small>
<p>Paste it into your browser and you will receive a XML response.</p>
<p>Immediately, I get one Mantos (<em>Dimag ki batti jala de</em>) and found a clue J</p>
<p>I thought why not to develop a library that make a call to this URL and parse the returned output to get lat &amp; long!!?</p>
<p>So for that purpose I write this library.</p>
<p>Obviously, before doing all these, you will need to register with Google Map API and get a key so that you can utilize their API.</p>
<p>Sign up and get a Google Maps API Key. You will need one for the domain name of where you will be hosting the map. You can get your API Key from here (<a title="http://code.google.com/apis/maps/signup.html" href="http://code.google.com/apis/maps/signup.html">http://code.google.com/apis/maps/signup.html</a>)</p>
<p>Following is the complete code that I used to call Google Map <a href="http://code.google.com/apis/maps/documentation/geocoding/">Geocoding API</a> from Asp.net.</p>
<p>All you have to do Is to just create a class file and paste the following code. And you are ready to call Google Map <a href="http://code.google.com/apis/maps/documentation/geocoding/">Geocoding API</a>.</p>
<p><strong>How to call Geocoding API from Asp.net?<br />
</strong></p>
<p><strong>Step 1<br />
</strong></p>
<p>/// Resolve addresses into latitude/longitude coordinates using Google MAP API webservices</p>
<p>public static class Geocoder{</p>
<p>private static string _GoogleMapsKey = Config.getAppSetting(GoogleMapsKey);</p>
<p>/// Google.com Geocoder</p>
<p>/// Url request to</p>
<p>/// <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/geo?q=your&amp;output=embed&amp;s=AARTsJp56EajYksz3JXgNCwT3LJnGsqqAQ"></iframe><br /><small><a href="http://maps.google.com/maps/geo?q=your&amp;source=embed&amp;s=AARTsJp56EajYksz3JXgNCwT3LJnGsqqAQ" style="text-align:left">View Larger Map</a></small></p>
<p>address&amp;output=xml&amp;key=xxxxxxxxxxxxxx</p>
<p>public static Geolocation? ResolveAddress(string query)</p>
<p>{</p>
<p>if (string.IsNullOrEmpty(_GoogleMapsKey))</p>
<p>_GoogleMapsKey = ConfigurationManager.AppSettings[<SPAN style="color:rgb(163,21,21);">"GoogleMapsKey"</SPAN>];</p>
<p>string url = <iframe width="425" height="350" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.com/maps/geo?q={0}&amp;output=embed&amp;key=&amp;s=AARTsJp56EajYksz3JXgNCwT3LJnGsqqAQ"></iframe><br /><small><a href="http://maps.google.com/maps/geo?q={0}&amp;source=embed&amp;key=&amp;s=AARTsJp56EajYksz3JXgNCwT3LJnGsqqAQ" style="text-align:left">View Larger Map</a></small></p>
<p>+ _GoogleMapsKey;</p>
<p>url = String.Format(url, query);</p>
<p>XmlNode coords = null;</p>
<p>try{</p>
<p>string xmlString = GetUrl(url);</p>
<p>XmlDocument xd = new XmlDocument();</p>
<p>xd.LoadXml(xmlString);</p>
<p>XmlNamespaceManager xnm = new XmlNamespaceManager(xd.NameTable);</p>
<p>coords = xd.GetElementsByTagName(coordinates)[0];</p>
<p>}</p>
<p>catch { }</p>
<p>Geolocation? gl = null;</p>
<p>if (coords != null){</p>
<p>string[] coordinateArray = coords.InnerText.Split(,);</p>
<p>if (coordinateArray.Length &gt;= 2)</p>
<p>{</p>
<p>gl = new Geolocation(Convert.ToDecimal(coordinateArray[1].ToString()), Convert.ToDecimal(coordinateArray[0].ToString()));</p>
<p>}</p>
<p>}</p>
<p>return gl;</p>
<p>}</p>
<p>public static Geolocation? ResolveAddress(string address, string city, string state, string postcode, string country)</p>
<p>{</p>
<p>return ResolveAddress(address + , + city + , + state + , + postcode + + country);</p>
<p>}</p>
<p>///<br />
&lt;summary&gt;</p>
<p>/// Retrieve a Url via WebClient</p>
<p>private static string GetUrl(string url)</p>
<p>{</p>
<p>string result = string.Empty;</p>
<p>System.Net.WebClient Client = new WebClient();</p>
<p>using (Stream strm = Client.OpenRead(url))</p>
<p>{</p>
<p>StreamReader sr = new StreamReader(strm);</p>
<p>result = sr.ReadToEnd();</p>
<p>}</p>
<p>return result;</p>
<p>}</p>
<p>}</p>
<p>public struct Geolocation</p>
<p>{</p>
<p>public decimal Lat;</p>
<p>public decimal Lon;</p>
<p>public Geolocation(decimal lat, decimal lon)</p>
<p>{</p>
<p>Lat = lat;</p>
<p>Lon = lon;</p>
<p>}</p>
<p>public override string ToString()</p>
<p>{</p>
<p>return Latitude: + Lat.ToString() + Longitude: + Lon.ToString();</p>
<p>}</p>
<p>public string ToQueryString()</p>
<p>{</p>
<p>return +to: + Lat + %2B + Lon;</p>
<p>}</p>
<p>}</p>
<p><strong>Step 2<br />
</strong></p>
<p>Now, you just need to put a key in AppSetting section that hold your Google Map API key.</p>
<p><strong>Step 3<br />
</strong></p>
<p>I have provided 2 overloaded methods to call Geocoding Map API Webservice, named ResolveAddress.</p>
<p>Say for e.g. you can call method like this.</p>
<p>Geocoder.ResolveAddress(University road,rajkot,gujarat,&#8221;,India)</p>
<p>I hope this will solve your purpose, those who wanted to develop Geocoding application, those who want to access Google Map Webservice API from c#/vb.net.</p>
<p>Happy programming</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/108/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/108/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/108/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=108&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/15/how-to-call-google-map-webservice-api-from-asp-net-call-geocoding-map-api-webservice-from-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>
	</item>
		<item>
		<title>How to convert value to Enum</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/15/how-to-convert-value-to-enum/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/15/how-to-convert-value-to-enum/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 05:30:17 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/2010/11/15/how-to-convert-value-to-enum/</guid>
		<description><![CDATA[How to convert a value into Enum? In project, we sometime come across a kind of situation where we need to convert some value to Enum and an Enum object into certain value. One solution to this is we can write chunk of switch-case statement and return the desired result. But is there any rationalize [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=107&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>How to convert a value into Enum?</p>
<p>In project, we sometime come across a kind of situation where we need to convert some value to Enum and an Enum object into certain value.</p>
<p>One solution to this is we can write chunk of switch-case statement and return the desired result.</p>
<p>But is there any rationalize method to achieve this? Yes here is the piece of code that you may find it useful. I have implemented it in many of my project and it really helps me reduce some overloaded work for me.</p>
<p>So here is that code for you in which I demonstrate how you can convert a value into Enum object.</p>
<p>using System;</p>
<p>using System.Collections.Generic;</p>
<p>using System.Linq;</p>
<p>public<br />
static<br />
class<br />
EnumsConverter</p>
<p>{</p>
<p>public<br />
static T ConvertValueToEnum&lt;T&gt;(object value, T defaultValue)</p>
<p>{</p>
<p>Type enumType = Reflection.ExtractEnumType(typeof(T));</p>
<p>if (enumType == null)</p>
<p>{</p>
<p>throw<br />
new<br />
ArgumentException(Type T is not an enumeration, T);</p>
<p>}</p>
<p>try</p>
<p>{</p>
<p>return (T)Enum.Parse(enumType, value.ToString());</p>
<p>}</p>
<p>catch (ArgumentException)</p>
<p>{</p>
<p>return defaultValue;</p>
<p>}</p>
<p>}</p>
<p>public<br />
static T ConvertValueToEnum&lt;T&gt;(object value)</p>
<p>{</p>
<p>Type enumType = Reflection.ExtractEnumType(typeof(T));</p>
<p>if (enumType == null)</p>
<p>{</p>
<p>throw<br />
new<br />
ArgumentException(Type T is not an enumeration, T);</p>
<p>}</p>
<p>return (T)Enum.Parse(enumType, value.ToString());</p>
<p>}</p>
<p>}</p>
<p>Here there are two overloaded methods. All you have to do is pass your desired enumeration object. The method itself will identify and return attached valued to that particular Enum object.</p>
<p>Happy programming</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/107/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/107/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/107/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=107&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/15/how-to-convert-value-to-enum/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>
	</item>
		<item>
		<title>Reading emails from POP server in asp.net</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/15/reading-emails-from-pop-server-in-asp-net/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/15/reading-emails-from-pop-server-in-asp-net/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 05:29:49 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/2010/11/15/reading-emails-from-pop-server-in-asp-net/</guid>
		<description><![CDATA[In this article, I will explain you how to read email from POP3 server or read emails from POP3 server which require SSL. Although I have not developed my own library, I prefer to utilize the available resource. Well, while being in the development, you have very limited time constraint to go and research on [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=106&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>In this article, I will explain you how to read email from POP3 server or read emails from POP3 server which require SSL. Although I have not developed my own library, I prefer to utilize the available resource.</p>
<p>Well, while being in the development, you have very limited time constraint to go and research on POP3 and then develop your own component.</p>
<p>It is sometime wise decision to go and do the <em>Googling</em> and find out your requirement.</p>
<p>After all we, as developer should do smart work, not hardwork J</p>
<p>Anyway, for those who have kind of requirement like reading emails from POP3 server from asp.net, reading email from email server in asp.net etc. Here is the article that you probably find it useful.</p>
<p>Well I had requirement in couple of project where I need to collect emails that are there in particular emails Inbox. Earlier I was used to with component Indy.Sockets component, which really help me to achieve my task.</p>
<p>You may find it from here.</p>
<p><a href="http://www.indyproject.org/">www.<strong>indy</strong>project.org/</a></p>
<p>It is an open source socket library. It supports may protocols like SMTP, POP3, NNTP, HTTP, and many more.</p>
<p>Then in one of the module that I come to develop, I need to read Inbox of a Gmail account!</p>
<p>Well as you know, Gmail requires SSL.</p>
<p>But the drawback with component is it does not support SSL.</p>
<p>So I discover <a href="http://www.agilecomponents.com/">Mailsystem.NET</a>.</p>
<p>MailSystem is a suite of .NET components that provide users with an extensive set of email tools.</p>
<p>I will not explain more in detail on this, rather I will rather just explain how to integrate it and use it.</p>
<p>You can find more information from here..</p>
<p><a href="http://www.agilecomponents.com/">http://www.agilecomponents.com/</a></p>
<p>Once you download it and extract it, you will require to do following steps..</p>
<ol>
<li>Navigate to Release folder in extracted folder.</li>
<li>Find these DLLs: ActiveUp.Net.Mail.dll, ActiveUp.Net.Common.dll, ActiveUp.Net.Dns.dll, ActiveUp.Net.Pop3.dll.</li>
<li>Add reference of these DLLs into your file.</li>
</ol>
<p>Hurray are almost done with you configuration.</p>
<p>Now, you only just need to develop your script that fetched and read emails from POP3 server.</p>
<p>So for that, here is the readymade script for you J.</p>
<p>public string[] GetDeliveryFailureEMailsAddress()</p>
<p>{</p>
<p>Pop3Client pop = new Pop3Client();</p>
<p>System.Collections.Generic.List&lt;string&gt; emails = new System.Collections.Generic.List&lt;string&gt;();</p>
<p>try {</p>
<p>// Connect to the pop3 client</p>
<p>pop.ConnectSsl(SMTPHost, Port, SMTPUserId, SMTPPass);</p>
<p>MessageCollection mc = new MessageCollection();</p>
<p>for (int n = 1; n &lt;= pop.MessageCount; n++) {</p>
<p>Message newMessage = pop.RetrieveMessageObject(n);</p>
<p>//do your stuffs here using newMessage object.</p>
<p>}</p>
<p>} catch (Pop3Exception pexp) {</p>
<p>} finally {</p>
<p>if (pop.IsConnected) {</p>
<p>pop.Disconnect();</p>
<p>}</p>
<p>}</p>
<p>return emails.ToArray();</p>
<p>}</p>
<p>One important part in this script is object initialization.</p>
<p>// Connect to the pop3 client</p>
<p>pop.ConnectSsl(SMTPHost, Port, SMTPUserId, SMTPPass);</p>
<p>As per Gmail, you need to set:</p>
<p>Host: pop.gmail.com</p>
<p>Port: 995</p>
<p>As I told earlier, I want to read email from POP3 server that requires SSL in asp.net.</p>
<p>There are different overloaded constructors that you can use to connect to POP3 server from asp.net.</p>
<p>The library itself is very rich. You can achieve following functionality with POP3 server.</p>
<ul>
<li>Read/Read email from POP3 server in asp.net with CRAM authentication.</li>
<li>Retrieve/Read email from POP3 server in asp.net asynchronously.</li>
<li>Retrieve/Read email from POP3 server in asp.net with secure connection, like SSL in Gmail.</li>
<li>Retrieve/Read only email count from POP3 server in asp.net.</li>
<li>Retrieve/Read only email header from POP3 server in asp.net.</li>
<li>Retrieve/Read full emails from POP3 server in asp.net.</li>
<li>Retrieve/Read full emails to a file from POP3 server in asp.net.</li>
</ul>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/106/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/106/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/106/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=106&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/15/reading-emails-from-pop-server-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>
	</item>
		<item>
		<title>jQuery pager-Flicker like jQuery pager</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/15/jquery-pager-flicker-like-jquery-pager/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/15/jquery-pager-flicker-like-jquery-pager/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 05:28:20 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/2010/11/15/jquery-pager-flicker-like-jquery-pager/</guid>
		<description><![CDATA[Intension for the development of this PlugIn is to develop a jQuery pagination which resembles Flicker like pagination. jPager is a jQuery pager plugin, similar to Flickrs paging interface. If you have ever visited Flicker photo sharing website, you would have noticed that it display a range of pages with current page in middle. It [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=105&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Intension for the development of this PlugIn is to develop a <strong>jQuery pagination</strong> which resembles <strong>Flicker like<br />
pagination</strong>.</p>
<p><strong>jPager</strong> is a jQuery pager plugin, similar to <strong>Flickrs paging</strong> interface.</p>
<p>If you have ever visited Flicker photo sharing website, you would have noticed that it display a range of pages with<br />
current page in middle. It also facilitates to have back and forth navigation. If you have very large data spread across<br />
range of pages, and then it leave outs page numbers, displaying an ellipsis instead, followed by the last page number.</p>
<p>It is very integrative <strong>jQuery pager Plugin</strong>.</p>
<p>Although pager is generally used along with some grid controls, but there may be sometime kind of requirement where<br />
you may require to use <strong>jQuery pager control</strong> alone itself. For e.g. you may use along with some image gallery,<br />
rotating content, carousel like section etc.</p>
<p>This <strong>jQuery pager/Flicker like jQuery pager</strong> allows you to creating pagination facility into you application<br />
with minimum effort.</p>
<p><strong>How to use? </strong></p>
<ol>
<li>Reference <strong>jPager.js &amp; jPager.css</strong> files in your page
<pre>&lt;script type="text/javascript" language="javascript" src="jquery-1.2.6.min.js" /&gt; &lt;script type="text/javascript" language="javascript" src="jPager.js" /&gt; &lt;link href="jPager.css" rel="stylesheet" type="text/css" /&gt;</pre>
</li>
<li>create a HTML container for pager. Put it where you wanted to display your pager require.<br />
&lt;div id=content&gt;&lt;/div&gt;</li>
<li>Put the following sript in your page.<br />
&lt;script type=text/javascript language=javascript&gt;<br />
<code><br />
$(document).ready(function() { $("#content").pager({ PageCount: 5, currentPage: 1 }); }); </code><br />
&lt;/script&gt;</li>
</ol>
<p><strong>Features</strong>:</p>
<ol>
<li>Very lighweight &amp; easy to use and easy to integrate. Just one line of code you need to build jQuery pager.</li>
<li>CSS driven so layout is fully costomizable with CSS.</li>
<li>Event driven facility make it easy to call any custom script whenever page get chaged.</li>
<li>Supports upto unlimited pages.</li>
<li>Display custom text for previous &amp; next buttons.</li>
<li>Hide displaying previous &amp; next buttons.</li>
</ol>
<p>You can download the demo &amp; source code from <a title="jQuery pager/Flicker like jQuery pager" href="http://code.google.com/p/jquerypager/">here</a>.</p>
<p>Cheers</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/105/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/105/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/105/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=105&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/15/jquery-pager-flicker-like-jquery-pager/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>
	</item>
		<item>
		<title>Combine/Compress/Minify JavaScript, CSS in Asp.net</title>
		<link>http://mkansagarfa.wordpress.com/2010/11/15/combinecompressminify-javascript-css-in-asp-net/</link>
		<comments>http://mkansagarfa.wordpress.com/2010/11/15/combinecompressminify-javascript-css-in-asp-net/#comments</comments>
		<pubDate>Mon, 15 Nov 2010 05:28:06 +0000</pubDate>
		<dc:creator>mkansagarfa</dc:creator>
		
		<guid isPermaLink="false">http://mkansagarfa.wordpress.com/2010/11/15/combinecompressminify-javascript-css-in-asp-net/</guid>
		<description><![CDATA[Combine/Compress/Minify JavaScript, CSS in Asp.net Introduction: When we design and develop the website, the performance is in the core of development. The system you are developing must produce the result with high speed. For the web development perspective, website load performance is very essential thing to take care of. You need good working layout, easy [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=104&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h1>Combine/Compress/Minify JavaScript, CSS in Asp.net</h1>
<p><strong>Introduction:<br />
</strong></p>
<p>When we design and develop the website, the performance is in the core of development. The system you are developing must produce the result with high speed. For the web development perspective, website load performance is very essential thing to take care of. You need good working layout, easy layout and easy navigation.</p>
<p>Here with this article I m not going to talk about of all the aspects of web application performance improvements. But I am specifically targeting the topic when it comes to the CSS and JavaScript faster loading in the client browser. In fact Google is also counting the speed of your website site when indexing to your website.</p>
<p>The goal was to improve overall performance on the client side. At the same time, it will show how we can force a client side script to be coached at the browser, so that in subsequent visit, it will take those scripts from the cache. This becomes increasingly important when using AJAX techniques within an application that introduce new features and functionality.</p>
<p>First of all I will outline the requirements and essential steps that this project is made of. So that if you want to implement the same in your development, it become easy for you to set up project.</p>
<p>To download complete project, <a href="http://www.esnips.com/doc/bb247398-9971-4fac-bb8e-02a8e8ebad7d/JS-CSS-Combiner-Minifier">click here</a></p>
<p><strong>Setup:<br />
</strong></p>
<p>To begin with, we will have following list of files to be created in the development studio.</p>
<ol>
<li>2 XML files, first one to hold source of JS files for each page and second to hold CSS files for each page.</li>
<li>A generic class that implement <em>IHttpHandler, </em>that will be used to delivery combined and compressed JavaScript/CSS at the client.</li>
<li>And at last your .ASPX file that will be used to serve combined and compressed Javascript/CSS at client side.</li>
</ol>
<p><strong>Step by Step Implementation:<br />
</strong></p>
<p>Now let&#8217;s get dig into the actual development. To summarize, let&#8217;s say we have a page default.aspx that has following no. of JavaScript files and CSS files. Think of these file that we wanted to combine them and deliver at one go at the client browser.</p>
<ol>
<li>jquery.js</li>
<li>script-file-1.js</li>
<li>style-1.css</li>
<li>style-2.css</li>
</ol>
<p>As you can see, we have 2 different JavaScript file &amp; 2 CSS files. So what basically we will do in the next is to create a utility which can combine given JavaScript and compress it, then send it to client browser. Next the same process will be done for the CSS. Both the CSS files will be combined and compressed and send to client browser.</p>
<p>Now it&#8217;s time to take a look at into actual stuff that does this underlying work.</p>
<p>First of all we will create a CS class file that will hold the programming stuffs.</p>
<p>So perform the following steps to create &amp; configure that CS class file.</p>
<ol>
<li>Create CS class file with the name <em>ScriptCombiner.cs</em> and put the following code in that.</li>
</ol>
<p>public<br />
class<br />
ScriptCombiner : IHttpHandler</p>
<p>{</p>
<p>private<br />
readonly<br />
static<br />
TimeSpan CACHE_DURATION = TimeSpan.FromDays(1);</p>
<p>private<br />
HttpContext context;</p>
<p>public<br />
void ProcessRequest(HttpContext context)</p>
<p>{</p>
<p>}</p>
<p>public<br />
bool IsReusable</p>
<p>{</p>
<p>get { return<br />
true; }</p>
<p>}</p>
<p>}</p>
<p>As you can see, we are implementing the IHttpHandler interface.</p>
<p>You can write custom HTTP handlers to process specific, predefined types of HTTP requests in any Common Language Specification (CLS) compliant language. Executable code defined in the HttpHandler classes, rather than conventional ASP or ASP.NET Web pages, responds to these specific requests. HTTP handlers give you a means of interacting with the low-level request and response services of the IIS Web server and provide functionality much like ISAPI extensions but with a simpler programming model.</p>
<p>We are also implementing IsReusable properly as it is compulsory to implement as a part of inheritance of IHttpHandler interface.</p>
<p>Now, let&#8217;s put the nuts &amp; bolts inside the ProcessRequest function. I will also explain you the step by step each execution that is inside this function.</p>
<ol>
<li>We will also create another CS class file that is used to compress JavaScript. That file is named as &#8220;JavaScriptMinifier.cs&#8221;. Please take a look at the attached project solution file. As it is contain long lines of code, I can&#8217;t put it here.</li>
<li>Complete your class file with following functions.</li>
</ol>
<p>public<br />
void ProcessRequest(HttpContext context)</p>
<p>{</p>
<p>string xStrType, xStrSet, xStrVer, xStrpagecode;</p>
<p>Boolean xBlnCanCompress;</p>
<p>this.context = context;</p>
<p>HttpRequest request = context.Request;</p>
<p>xStrType = (!String.IsNullOrEmpty(request[<SPAN style="color:rgb(163,21,21);">"type"</SPAN>])) ? request[<SPAN style="color:rgb(163,21,21);">"type"</SPAN>] : null;</p>
<p>xStrSet = (!String.IsNullOrEmpty(request[<SPAN style="color:rgb(163,21,21);">"s"</SPAN>])) ? request[<SPAN style="color:rgb(163,21,21);">"s"</SPAN>] : null;</p>
<p>xStrVer = (!String.IsNullOrEmpty(request[<SPAN style="color:rgb(163,21,21);">"v"</SPAN>])) ? request[<SPAN style="color:rgb(163,21,21);">"v"</SPAN>] : null;</p>
<p>xStrpagecode = (!String.IsNullOrEmpty(request[<SPAN style="color:rgb(163,21,21);">"pcode"</SPAN>])) ? request[<SPAN style="color:rgb(163,21,21);">"pcode"</SPAN>] : null;</p>
<p>//first check if client browser can support compressions</p>
<p>xBlnCanCompress = CanClientGZip(request);</p>
<p>using (MemoryStream memStream = new<br />
MemoryStream(8092))</p>
<p>{</p>
<p>Stream writer;</p>
<p>//if browser is supporing GZip compression then create a new object using ICSharpCode.SharpZipLib.GZip</p>
<p>//library which allow the compressed respose to send to client</p>
<p>if (xBlnCanCompress)</p>
<p>writer = (new ICSharpCode.SharpZipLib.GZip.GZipOutputStream(memStream));</p>
<p>else</p>
<p>writer = memStream;</p>
<p>using (writer)</p>
<p>{</p>
<p>//now its time to read all the script/css files into a StringBuilder object.</p>
<p>StringBuilder combinedSource = new<br />
StringBuilder();</p>
<p>foreach (string file in GetFileNames(xStrSet, xStrpagecode, xStrType))</p>
<p>combinedSource.Append(System.IO.File.ReadAllText(context.Server.MapPath(file), Encoding.UTF8));</p>
<p>//Upto now we have combined all css/javascript based on request.</p>
<p>//its now time to remove extra white spaces and other unwanted characters from respose.</p>
<p>//compression will take place now.</p>
<p>string minified;</p>
<p>//use the YUI Javascript/CSS minifier to compress all js files</p>
<p>if (xStrType == &#8220;js&#8221;)</p>
<p>minified = combinedSource.ToString();</p>
<p>else</p>
<p>minified = CompressCSS(combinedSource.ToString());</p>
<p>// Send minfied string to output stream</p>
<p>byte[] bt = Encoding.UTF8.GetBytes(minified);</p>
<p>writer.Write(bt, 0, bt.Length);</p>
<p>}</p>
<p>//cache the respose so that in next request it can be reused</p>
<p>byte[] responseBytes = memStream.ToArray();</p>
<p>//context.Cache.Insert(GetCacheKey(xStrSet, xStrType, xStrVer, xBlnCanCompress), responseBytes, null, System.Web.Caching.Cache.NoAbsoluteExpiration, CACHE_DURATION);</p>
<p>// Generate the response</p>
<p>this.WriteBytes(responseBytes, xBlnCanCompress, xStrType);</p>
<p>}</p>
<p>}</p>
<p>private<br />
bool CanClientGZip(HttpRequest request)</p>
<p>{</p>
<p>string acceptEncoding = request.Headers[<SPAN style="color:rgb(163,21,21);">"Accept-Encoding"</SPAN>];</p>
<p>if (!string.IsNullOrEmpty(acceptEncoding) &amp;&amp;</p>
<p>(acceptEncoding.Contains(&#8220;gzip&#8221;) || acceptEncoding.Contains(&#8220;deflate&#8221;)))</p>
<p>return<br />
true;</p>
<p>return<br />
false;</p>
<p>}</p>
<p>// helper method that return an array of file names inside the text file stored in App_Data folder</p>
<p>private<br />
static<br />
string[] GetFileNames(string setName, string pagecode, string type)</p>
<p>{</p>
<p>System.Xml.XPath.XPathDocument doc2;</p>
<p>System.Xml.XPath.XPathNavigator navigator;</p>
<p>System.Xml.XPath.XPathNodeIterator iterator;</p>
<p>System.Collections.Generic.List&lt;string&gt; scripts = new System.Collections.Generic.List&lt;string&gt;();</p>
<p>string key;</p>
<p>if (type == &#8220;js&#8221;)</p>
<p>key = &#8220;scriptfile&#8221;;</p>
<p>else</p>
<p>key = &#8220;cssfile&#8221;;</p>
<p>if (System.Web.HttpContext.Current.Cache[key] != null)</p>
<p>{</p>
<p>doc2 = (System.Xml.XPath.XPathDocument)System.Web.HttpContext.Current.Cache[key];</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>string filename;</p>
<p>filename = System.Web.HttpContext.Current.Server.MapPath(String.Format(&#8220;~/App_Data/{0}.xml&#8221;, setName));</p>
<p>doc2 = new System.Xml.XPath.XPathDocument(filename);</p>
<p>System.Web.HttpContext.Current.Cache.Insert(key, doc2, new System.Web.Caching.CacheDependency(filename), DateTime.Now.AddMinutes(60), TimeSpan.Zero);</p>
<p>}</p>
<p>navigator = doc2.CreateNavigator();</p>
<p>if (type == &#8220;js&#8221;)</p>
<p>iterator = navigator.Select(&#8220;/scripts/page[@pagecode='"</SPAN> + pagecode +<br />
<SPAN style="color:rgb(163,21,21);">"']/script&#8221;);</p>
<p>else</p>
<p>iterator = navigator.Select(&#8220;/styles/page[@pagecode='"</SPAN> + pagecode +<br />
<SPAN style="color:rgb(163,21,21);">"']/style&#8221;);</p>
<p>while (iterator.MoveNext())</p>
<p>scripts.Add(iterator.Current.InnerXml);</p>
<p>return scripts.ToArray();</p>
<p>}</p>
<p>private<br />
string GetCacheKey(string type, string setName, string version, bool cancompress)</p>
<p>{</p>
<p>return<br />
&#8220;HttpCombiner.&#8221; + setName + &#8220;.&#8221; + type + &#8220;.&#8221; + version + &#8220;.&#8221; + cancompress;</p>
<p>}</p>
<p>private<br />
void WriteBytes(byte[] bytes, bool isCompressed, string type)</p>
<p>{</p>
<p>HttpResponse response = context.Response;</p>
<p>response.AppendHeader(&#8220;Content-Length&#8221;, bytes.Length.ToString());</p>
<p>if (type == &#8220;js&#8221;)</p>
<p>response.ContentType = &#8220;application/x-javascript&#8221;;</p>
<p>else</p>
<p>response.ContentType = &#8220;text/css&#8221;;</p>
<p>if (isCompressed)</p>
<p>response.AppendHeader(&#8220;Content-Encoding&#8221;, &#8220;gzip&#8221;);</p>
<p>else</p>
<p>response.AppendHeader(&#8220;Content-Encoding&#8221;, &#8220;utf-8″);</p>
<p>context.Response.Cache.SetCacheability(HttpCacheability.Public);</p>
<p>context.Response.Cache.SetExpires(DateTime.Now.Add(CACHE_DURATION));</p>
<p>context.Response.Cache.SetMaxAge(CACHE_DURATION);</p>
<p>response.ContentEncoding = Encoding.Unicode;</p>
<p>response.OutputStream.Write(bytes, 0, bytes.Length);</p>
<p>response.Flush();</p>
<p>}</p>
<p>public<br />
static<br />
string GetScriptTag(string setname, string pageid, string type, string ver)</p>
<p>{</p>
<p>string result = &#8220;&#8221;;</p>
<p>if (type == &#8220;js&#8221;)</p>
<p>result += String.Format(&#8220;&lt;script type=\&#8221;text/javascript\&#8221; src=\&#8221;/&#8221; + Web.Utility.Functions.GetURLPrefix() + &#8220;ScriptCombiner.axd?s={0}&amp;v={1}&amp;type=js&amp;pcode={2}\&#8221;&gt;&lt;/script&gt;&#8221;, setname, ver, pageid);</p>
<p>else</p>
<p>result += String.Format(&#8220;&lt;link link href=\&#8221;ScriptCombiner.axd?s={0}&amp;v={1}&amp;type=css&amp;pcode={2}\&#8221; rel=\&#8221;stylesheet\&#8221; type=\&#8221;text/css\&#8221;/&gt;&#8221;, setname, ver, pageid);</p>
<p>return result;</p>
<p>}</p>
<p>public<br />
static<br />
string CompressCSS(string body)</p>
<p>{</p>
<p>body = Regex.Replace(body, &#8220;/\\*.+?\\*/&#8221;, &#8220;&#8221;, RegexOptions.Singleline);</p>
<p>body = body.Replace(&#8221; &#8220;, string.Empty);</p>
<p>body = body.Replace(Environment.NewLine + Environment.NewLine + Environment.NewLine, string.Empty);</p>
<p>body = body.Replace(Environment.NewLine + Environment.NewLine, Environment.NewLine);</p>
<p>body = body.Replace(Environment.NewLine, string.Empty);</p>
<p>body = body.Replace(&#8220;\\t&#8221;, string.Empty);</p>
<p>body = body.Replace(&#8221; {&#8220;, &#8220;{&#8220;);</p>
<p>body = body.Replace(&#8221; :&#8221;, &#8220;:&#8221;);</p>
<p>body = body.Replace(&#8220;: &#8220;, &#8220;:&#8221;);</p>
<p>body = body.Replace(&#8220;, &#8220;, &#8220;,&#8221;);</p>
<p>body = body.Replace(&#8220;; &#8220;, &#8220;;&#8221;);</p>
<p>body = body.Replace(&#8220;;}&#8221;, &#8220;}&#8221;);</p>
<p>body = Regex.Replace(body, &#8220;/\\*[^\\*]*\\*+([^/\\*]*\\*+)*/&#8221;, &#8220;$1″);</p>
<p>body = Regex.Replace(body, &#8220;(?&lt;=[&gt;])\\s{2,}(?=[&lt;])|(?&lt;=[&gt;])\\s{2,}(?=&amp;nbsp;)|(?&lt;=&amp;ndsp;)\\s{2,}(?=[&lt;])&#8221;, string.Empty);</p>
<p>return body;</p>
<p>}</p>
<p>You are now almost done with 50% of work for your project.</p>
<p>Now let&#8217;s take a look at the few of important execution steps that are in this function.</p>
<p>First of all we are declaring four different string variables:</p>
<p>string xStrType, xStrSet, xStrVer, xStrpagecode;</p>
<p>They will be used to get the Querystring passed in to this handler. This is utilized later on the code.</p>
<p>Moving next, you will find these function call:</p>
<p>//first check if client browser can support compressions</p>
<p>xBlnCanCompress = CanClientGZip(request);</p>
<p>This is basically to check does client browser support GZip compression.</p>
<p>Gzip compression, otherwise known as content encoding, is a publicly defined way to compress textual content transferred from web servers to browsers. HTTP compression uses public domain compression algorithms, like gzip and compress, to compress XHTML, JavaScript, CSS, and other text files at the server. This standards-based method of delivering compressed content is built into HTTP 1.1, and most modern browsers that support HTTP 1.1 support ZLIB inflation of deflated documents. In other words, they can decompress compressed files automatically, which saves time and bandwidth.</p>
<p>In the next step it is preparing the <em>stream</em> object used to hold the response output. We will not take dipper look into that code. As I expect that the a beginning developer even must be able know about next few line of code. J</p>
<p>Let&#8217;s move to the line of code:</p>
<p>//now its time to read all the script/css files into a StringBuilder object.</p>
<p>StringBuilder combinedSource = new<br />
StringBuilder();</p>
<p>foreach (string file in GetFileNames(xStrSet, xStrpagecode, xStrType))</p>
<p>combinedSource.Append(System.IO.File.ReadAllText(context.Server.MapPath(file), Encoding.UTF8));</p>
<p>As you can see in the foreach loop, it is calling to method GetFileNames, by passing 3 different parameters. Here this is also core and important part of this project. Let me outline you first what this function basically do. This function will read to the &#8220;script.xml&#8221; file that hold content of script file that we want to load. Please look inside the attached project solution to understand it better. The function will read xml file and return array of string object containing JavaScript files to read.</p>
<p>In the subsequent line of code, it iterate through each file name and read it. Each content of read file is placed inside a StringBuilder object.</p>
<p>Please take look at the code inside the GetFileNames function to understand what is actually happening inside it. It fetches the JavaScript/CSS based on the parameter passed. And return either the JavaScript file name array or CSS file name array.</p>
<p>So now we have a combined script/CSS with us. It&#8217;s a time to minify JavaScript/CSS now.</p>
<p>Following line of code will minify respective JavaScript/CSS based on type of client script requested.</p>
<p>//use the YUI Javascript/CSS minifier to compress all js files</p>
<p>if (xStrType == &#8220;js&#8221;)</p>
<p>{</p>
<p>JavaScriptMinifier minifier = new<br />
JavaScriptMinifier();</p>
<p>minified = minifier.Minify(combinedSource.ToString());</p>
<p>}</p>
<p>else</p>
<p>{</p>
<p>minified = CompressCSS(combinedSource.ToString());</p>
<p>}</p>
<p>The JavaScriptMinifier has been created in the 2nd step. Please refer to the attached solution project for more detail regarding this class file. I have adopted this class file from one of the article</p>
<p>You will also see function CompressCSS that is used to compress CSS file. The compressor of CSS file is done through just few regular expression. JavaScript compression has different algorithm.</p>
<p>After that it is calling to WriteBytes function that will prepare the combined &amp; compressed JavaScript &amp; CSS response and send it to the client.</p>
<p>Hurray� as part of implementation we are done.</p>
<p>Now it&#8217;s time to check that in action. You can run the project attached here with and check it In live action.</p>
<p>To download complete project, <a href="http://www.esnips.com/doc/bb247398-9971-4fac-bb8e-02a8e8ebad7d/JS-CSS-Combiner-Minifier">click here</a></p>
<p>Let&#8217;s compare the result of two different pages. The first one is with the compressed JavaScript &amp; CSS. The second one is with the normal JavaScript &amp; CSS. We will also see the difference in load time and size of content received.</p>
<p>Response time with compressed JavaScript &amp; CSS.</p>
<p><img src="83636EF40989416EA2D9FA2BA2E46AEF@ccc134" width="480" height="134" alt="0" /></p>
<p>Response time without compressed JavaScript &amp; CSS.</p>
<p><img src="A4A010A879FE40198507063F9A300F95@ccc134" width="480" height="163" alt="1" /></p>
<p>As you can see from given statistics</p>
<p>With Combined &amp; Compressed JavaScript and CSS ..</p>
<p>Total request: 3</p>
<p>Response size: 16.3 KB</p>
<p>Without Combined &amp; Compressed JavaScript and CSS ..</p>
<p>Total request: 5</p>
<p>Response size: 96 KB</p>
<p>You can clearly see the difference between these two request.</p>
<p>To get more idea open and run the project yourself. That will give you better idea.</p>
<p>Hope you will find it very useful.</p>
<p>Happy coding�. J</p>
<p>&#8211;<br />
Posted By MILIND KANSAGARA to <a href="http://milindkansagara1984.blogspot.com/2010/11/combinecompressminify-javascript-css-in.html">Milind K Kansagara</a> at 11/14/2010 09:14:00 PM</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/mkansagarfa.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/mkansagarfa.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/mkansagarfa.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/mkansagarfa.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/mkansagarfa.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/mkansagarfa.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/mkansagarfa.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/mkansagarfa.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/mkansagarfa.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/mkansagarfa.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/mkansagarfa.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/mkansagarfa.wordpress.com/104/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/mkansagarfa.wordpress.com/104/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/mkansagarfa.wordpress.com/104/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=mkansagarfa.wordpress.com&amp;blog=8739906&amp;post=104&amp;subd=mkansagarfa&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://mkansagarfa.wordpress.com/2010/11/15/combinecompressminify-javascript-css-in-asp-net/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/1907d1049a704b52fdf0c9e1af156d01?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">mkansagarfa</media:title>
		</media:content>
	</item>
	</channel>
</rss>
