<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-2064093841669615216</id><updated>2011-11-27T15:19:41.004-08:00</updated><title type='text'>Ashok Dudhade</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://ashokdudhade.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2064093841669615216/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://ashokdudhade.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><author><name>Ashok Dudhade</name><uri>http://www.blogger.com/profile/09331624980263007800</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_p3XajEKoM3k/SUijIwLs6FI/AAAAAAAAAe8/J8nNgp1qjaY/S220/IMG0585A.jpg'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>2</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-2064093841669615216.post-7404700597954363839</id><published>2009-06-15T02:50:00.000-07:00</published><updated>2009-06-15T05:50:11.126-07:00</updated><title type='text'>ASP .Net Caching</title><content type='html'>&lt;div align="justify"&gt;&lt;span style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px"&gt;&lt;span style="font-size:85%;"&gt;Def&lt;sup&gt;n&lt;/sup&gt;: Caching means temporary storage of data in memory that is highly-demanding and frequently used in order to accelerate performance and for quick access to various essential information.&lt;br /&gt;Caching is an important concept in computing. When applied to ASP.NET, it can greatly enhance the performance of your Web applications/ website. In this article, I will discuss some of the techniques for caching ASP.NET pages on the server side. The ASP.NET framework provides three types of caching for web-based applications: &lt;/span&gt;&lt;br /&gt;&lt;/div&gt;&lt;div align="justify"&gt;&lt;ul style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"&gt;&lt;li style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"&gt;&lt;span style="font-size:85%;"&gt;Page Level Caching (Output Caching)&lt;/span&gt;&lt;/li&gt;&lt;li style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"&gt;&lt;span style="font-size:85%;"&gt;Page Fragment Caching (Partial-Page Output Caching)&lt;/span&gt;&lt;/li&gt;&lt;li style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"&gt;&lt;span style="font-size:85%;"&gt;Programmatic or Data Caching&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;p style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"&gt;&lt;span style="font-size:85%;"&gt;&lt;strong&gt;Page Level Caching (Output Caching)&lt;/strong&gt;&lt;/span&gt;&lt;/p&gt;&lt;p style="PADDING-RIGHT: 0px; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; PADDING-TOP: 0px"&gt;&lt;span style="font-size:85%;"&gt;Page Level caching caches the output of a page so that a page's content need not be generated every time it is loaded. In a typical ASP.NET page, every time the user views the page, the Web server will have to dynamically generate the content of the page. Considering the fact that the page does not change for a certain period of time, it is always a good idea to cache whatever is non-static so that the page can be loaded quickly. Following is the code syntax used for output caching. &lt;/span&gt;&lt;br /&gt;&amp;lt;%@ OutputCache Duration = "inseconds" Location = "Any Client Downstream Server None" VaryByControl = "controlname” VaryByCustom = "browser customstring" VaryByHeader = "headers”VaryByParam = "parametername" %&amp;gt;&lt;br /&gt;&lt;b&gt;Where&lt;/b&gt;&lt;br /&gt;&lt;b&gt;Duration:&lt;/b&gt; No. of seconds the page to be cached.&lt;br /&gt;&lt;strong&gt;Location&lt;/strong&gt;:&lt;br /&gt;&lt;ul&gt;&lt;br /&gt;&lt;li&gt;Any:The default is Any. This stores the output cache in the client's browser, on the proxy server (or any other server) that participates in the req&lt;br /&gt;uest, or on the server where the request is processed.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Client: This stores output cache in the client's browser.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Downstream: This stores the output cache in any cache-capable devices (other than the origin server) that participate in the request.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;Server: This stores the output cache on the Web server.&lt;/li&gt;&lt;br /&gt;&lt;li&gt;None: This turns off the output cache.&lt;/li&gt;&lt;br /&gt;&lt;/ul&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;VaryByControl:&lt;/b&gt; A semicolon-separated list of strings used to vary the output cache. These strings represent fully qualified names of properties on a user control. When this attribute is used for a user control, the user control output is varied to the cache for each specified user control property.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;VaryByCustom&lt;/b&gt;&lt;br /&gt;Any text that represents custom output caching requirements. If this attribute is given a value of browser, the cache is varied by browser name and major version information. If a custom string is entered, you must override the HttpApplication.GetVaryByCustomString method in your application's global.asax file.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;VaryByHeader:&lt;/b&gt; A semicolon-separated list of HTTP headers used to vary the output cache. When this attribute is set to multiple headers, the output cache contains a different version of the requested document for each specified header.&lt;br /&gt;&lt;/b&gt;&lt;br /&gt;&lt;b&gt;&lt;br /&gt;VaryByParam:&lt;/b&gt; A semicolon-separated list of strings used to vary the output cache. By default, these strings correspond to a query string value sent with GET or Post method. When this attribute is set to multiple parameters, the output cache contains a different version of the requested document for each specified parameter. Possible values include none, *, and any valid query string or POST parameter name.&lt;br /&gt;Add this directive to your .aspx page.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ OutputCache Duration="15" VaryByParam="None" %&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;This will cache the page for 15 seconds &amp;amp; means that if the page is loaded and within the next 15 seconds it is refreshed, the Web server will serve the same content without needing to dynamically regenerate the page. For time being I will skip the “VaryByParam”.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Page Fragment Caching (Partial-Page Output Caching) &lt;/b&gt;&lt;br /&gt;While Page Level Caching is useful when most of the content of the page doesn't change often, In case where only specific part or block of page content changes we don't need to cache entire page instead we can cache parts that are constant across each and every scenario.&lt;br /&gt;&lt;br /&gt;Page Fragment caching uses the same syntax as page level caching, but applied to a user control (.ascx file) instead of to a web form (.aspx file). All of the attributes that are supported by the OutputCache directive on a web form are also supported for user controls except that &lt;b&gt;Location attribute is not allowed at this type of caching&lt;/b&gt;. In User controls has one more OutputCache attribute called VaryByControl, which will vary the caching of the user control depending on the value of a member of that control (typically a control on the page, such as a DropDownList). Here important point that needs to be remembered is if VaryByControl is specified for a control then VaryByParam can be omitted.&lt;br /&gt;&lt;br /&gt;In ASP.NET each user control is cached separately and this is a default setting if not specified. However, if a user control does not vary between pages in an application and the control name is same across the pages then by specifying Shared="true" will allow the cached version of the user controls by all the pages instead of keeping a separate cache for each one of the same user control.&lt;br /&gt;User control caching can be done by following directive that needs to be added in .ascx.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&amp;lt;%@ OutputCache Duration="n Second" VaryByControl="ctrl1" %&amp;gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Programmatic or Data Caching &lt;/b&gt;&lt;br /&gt;Programmatic caching or data caching is the feature that is used to to store frequently used data in cache. API for data caching was introduced in ASP.Net 1.x and was very powerful. However the data dependancy was not supportted so it did not allow you to invalidate an item in the Cache based on a change of data. ASP.NET 2.0, the Cache supports the data dependancy in caching.&lt;br /&gt;The Cache class contains a numerous properties and methods. Of these, the Add, Insert, Remove methods and the Count property are the most frequently used. The Cache property of the Page.HttpContext class can be used to store and retrieve data in the cache.&lt;br /&gt;&lt;br /&gt;The following code snippet illustrates the way of storage and retrieval of data to and from the cache using the Cache class.&lt;br /&gt;&lt;br /&gt;//Storing data into the cache&lt;br /&gt;&lt;br /&gt;Cache ["cacheKey"] = objData;&lt;br /&gt;&lt;br /&gt;//Retrieving the data from cache&lt;br /&gt;&lt;br /&gt;object objData = Cache ["cacheKey "];&lt;br /&gt;&lt;br /&gt;But you can see this does not allow you any control over the amount of time the item will be stored. ASP.Net provides the Insert() method for inserting an object to the cache&lt;br /&gt;&lt;table&gt;&lt;tbody&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;Cache.Insert(key, value);&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Inserts an item into the cache with the key name and value with default priority and expiration&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;Cache.Insert(key, value, dependencies);&lt;/td&gt;&lt;br /&gt;&lt;td&gt;Inserts an item into the cache with key, value, default priority, expiration and a CacheDependency name that links to other files or items so that when these change the cache item remains no longer valid&lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;Cache.Insert(key, value, dependencies, absoluteExpiration,&lt;br /&gt;slidingExpiration);&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td&gt;This indicates an expiration policy along with the above issues. &lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;Cache.Insert(key, value, dependencies, absoluteExpiration,&lt;br /&gt;slidingExpiration, priority, onRemoveCallback);&lt;br /&gt;&lt;/td&gt;&lt;br /&gt;&lt;td&gt;This along with the parameters also allows you to set a priority for the cache item and a delegate that, points to a method to be invoked when the item is removed. &lt;/td&gt;&lt;br /&gt;&lt;/tr&gt;&lt;br /&gt;&lt;tr&gt;&lt;br /&gt;&lt;td&gt;Cache.Add(key, value, null, absoluteExpiration, slidingExpiration, priority, onRemoveCallback);&lt;/td&gt;&lt;br /&gt;&lt;td&gt;This is same as insert method the only difference is that, if the key is already exists in the cache it well throw an exception. So recommended thing is insert method.&lt;/td&gt;&lt;/tr&gt;&lt;br /&gt;&lt;/tbody&gt;&lt;/table&gt;&lt;br /&gt;//Inserts the data into the cache&lt;br /&gt;&lt;br /&gt;Cache.Insert("key", "value", null, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration, CacheItemPriority.High, onRemove);&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Adds data in cache if the key doesn’t exists in cache.&lt;br /&gt;&lt;br /&gt;if (Cache["key"] == null){&lt;br /&gt;&lt;br /&gt;Cache.Add("key", "value", null, DateTime.Now.AddSeconds(60), Cache.NoSlidingExpiration, CacheItemPriority.High, onRemove);&lt;br /&gt;&lt;br /&gt;}&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;// Removes the data from cache if it exists in cache&lt;br /&gt;&lt;br /&gt;if(Cache["key "] != null)&lt;br /&gt;&lt;br /&gt;Cache.Remove("key");&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2064093841669615216-7404700597954363839?l=ashokdudhade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ashokdudhade.blogspot.com/feeds/7404700597954363839/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ashokdudhade.blogspot.com/2009/06/asp-net-caching.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2064093841669615216/posts/default/7404700597954363839'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2064093841669615216/posts/default/7404700597954363839'/><link rel='alternate' type='text/html' href='http://ashokdudhade.blogspot.com/2009/06/asp-net-caching.html' title='ASP .Net Caching'/><author><name>Ashok Dudhade</name><uri>http://www.blogger.com/profile/09331624980263007800</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_p3XajEKoM3k/SUijIwLs6FI/AAAAAAAAAe8/J8nNgp1qjaY/S220/IMG0585A.jpg'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-2064093841669615216.post-6586673661472570707</id><published>2008-12-16T22:20:00.000-08:00</published><updated>2008-12-16T22:49:52.619-08:00</updated><title type='text'>How to learn PHP</title><content type='html'>&lt;span style="font-family:Courier New;"&gt;&lt;strong&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;what should you already know?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Before you continue you should have basic understanding of&lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;HTML&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;li&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;Scripting knowledge&lt;/span&gt;&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;/div&gt;&lt;span class="Apple-style-span"  style="font-family:georgia;"&gt;what is PHP?&lt;/span&gt;&lt;/strong&gt;&lt;/span&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;PHP stands for "Hypertext Preprocessor"&lt;/li&gt;&lt;li&gt;Its server side scripting language&lt;/li&gt;&lt;li&gt;Its free to download and open source&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;why PHP?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;ul&gt;&lt;li&gt;It runs on different platforms (like &lt;span&gt;Windows, Linux, Unix, etc&lt;/span&gt;)&lt;/li&gt;&lt;li&gt;It is compatible with all servers used today&lt;/li&gt;&lt;li&gt;It is downloadable from official resource &lt;span&gt;www.php.net&lt;/span&gt;&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;now what?&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-weight: bold;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;You could open up and text editor and start coding away or you could read some PHP tutorials that you’ll quickly forget and never use. Either way you’ll accomplish nothing and probably quit before you’ve done anything useful. Tutorials are only good if you have a problem. Don’t read them for fun under the false pretext you might learn something. You won’t. When you’re stuck, they can help you, but you won’t learn anything until you go get yourself stuck. That’s also why you shouldn’t just start coding. You don’t know anything yet, you can’t possibly make anything useful, and so you’ll end up reading tutorials for beginners, get discouraged by your own incompetence, and buy Visual Studio because you can drag and drop buttons onto the screen… wow!&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;p&gt;&lt;strong&gt;so what do I do then?&lt;/strong&gt;&lt;/p&gt; &lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;You do something useful right from the get-go. You install some free open source PHP software on your web server like &lt;a href="http://www.wordpress.org/"&gt;Wordpress&lt;/a&gt;, &lt;a href="http://www.phpbb.com/"&gt;phpBB&lt;/a&gt;, &lt;a href="http://www.joomla.org/"&gt;Joomla&lt;/a&gt;, &lt;a href="http://www.drupal.org/"&gt;Drupal&lt;/a&gt;, or &lt;a href="http://www.phpnuke.org/"&gt;php-Nuke&lt;/a&gt;. These are quality web applications and your key to learning PHP. Pick one you like. I suggest Wordpress because I like this site.&lt;/p&gt; &lt;p&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt; &lt;/span&gt;Once you have your PHP powered site up and running, start to modify it. Edit the theme to see how PHP is mixed with HTML. Make new plugins or modules to learn how to code with PHP. If you get stuck, these open source projects have forums where you can get support or find answers to common questions. There are usually experienced users who will be happy to help you and to test your code. Not only are you working on an application that is likely useful to you, but you are working on mods that can be useful to others. You can get feedback, suggestions and comments right away even as a beginner. Being part of a community as a beginner will give you the support you need to succeed. Working on something useful from the beginning will give you the motivation to continue.&lt;/p&gt;&lt;p&gt;But at last I suggest you just walk through the tutorial to have a basic idea.&lt;/p&gt;&lt;p&gt;Tutorials:&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;ul&gt;&lt;li&gt; &lt;a href="http://www.learningprocessing.com/tutorials/php/" onclick="javascript:urchinTracker('/outbound/www.learningprocessing.com/tutorials/php/?ref=http_//blogsearch.google.co.in/blogsearch?hl=en_oi=spell_ie=UTF-8_q=php+tutorial_btnG=Search+Blogs');"&gt;http://www.learningprocessing.com/tutorials/php/&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;li&gt;&lt;a href="http://www.w3schools.com/php/default.asp"&gt;http://www.w3schools.com/php/default.asp&lt;/a&gt;&lt;br /&gt;&lt;/li&gt;&lt;/ul&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;br /&gt;&lt;/p&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span"  style="font-family:'Courier New';"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/2064093841669615216-6586673661472570707?l=ashokdudhade.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://ashokdudhade.blogspot.com/feeds/6586673661472570707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://ashokdudhade.blogspot.com/2008/12/how-to-learn-php.html#comment-form' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/2064093841669615216/posts/default/6586673661472570707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/2064093841669615216/posts/default/6586673661472570707'/><link rel='alternate' type='text/html' href='http://ashokdudhade.blogspot.com/2008/12/how-to-learn-php.html' title='How to learn PHP'/><author><name>Ashok Dudhade</name><uri>http://www.blogger.com/profile/09331624980263007800</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='32' height='24' src='http://2.bp.blogspot.com/_p3XajEKoM3k/SUijIwLs6FI/AAAAAAAAAe8/J8nNgp1qjaY/S220/IMG0585A.jpg'/></author><thr:total>0</thr:total></entry></feed>
