<?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/"
	>

<channel>
	<title>robinthomas.in</title>
	<atom:link href="http://www.robinthomas.in/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.robinthomas.in</link>
	<description>Miscellaneous ramblings of a programmer..</description>
	<pubDate>Sun, 21 Feb 2010 08:45:05 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.7.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Loop through all controls in a user control</title>
		<link>http://www.robinthomas.in/dotnet/loop-through-all-controls-in-a-user-control/</link>
		<comments>http://www.robinthomas.in/dotnet/loop-through-all-controls-in-a-user-control/#comments</comments>
		<pubDate>Sun, 21 Feb 2010 08:35:02 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[.Net]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=89</guid>
		<description><![CDATA[Task : 
You have a user control. And you want to loop through all the controls in that user control.
You write the following code
foreach (Control ctrl in control.Controls)
{
//Do your task.
}
And you are wrong.  
Reason :
As you know, all the forms/Usercontrols have a control collection. A control collection may be a nested collection of controls.
That [...]]]></description>
			<content:encoded><![CDATA[<h3><strong>Task : </strong></h3>
<p>You have a user control. And you want to loop through all the controls in that user control.<br />
You write the following code</p>
<p>foreach (Control ctrl in control.Controls)<br />
{<br />
//Do your task.<br />
}</p>
<p><strong><span style="color: #ff0000;">And you are wrong. <img src='http://www.robinthomas.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </span></strong></p>
<h3><strong>Reason :</strong></h3>
<p>As you know, all the forms/Usercontrols have a control collection. A control collection may be a nested collection of controls.<br />
That means a control in a collection (Eg a panel) can contain its child controls(Eg : a label).</p>
<p>So if you loop like this  &#8220;foreach (Control ctrl in  control.Controls)&#8221; ,<br />
then only the top level controls will be included in the loop.<br />
and you will miss the controls nested inside controls.</p>
<h3>Solution : Recursion</h3>
<blockquote><p>Since each controls contain child controls,  recursion is the best method to loop through all the controls.</p>
<p>Following is a method which can  be used to loop through all the controls  and disable all the  Textboxes, Dropdownlists and radio buttons.</p>
<p>/// &lt;summary&gt;<br />
/// This method will loop through the child controls inside the control and disable the controls.<br />
/// &lt;/summary&gt;<br />
/// &lt;param name=&#8221;control&#8221;&gt;&lt;/param&gt;<br />
private void DisableControls(Control control)<br />
{<br />
foreach (Control ctrl in control.Controls)<br />
{<br />
if (ctrl.GetType().Name == &#8220;TextBox&#8221;)<br />
{<br />
((TextBox)(ctrl)).Enabled = false;<br />
}<br />
else if (ctrl.GetType().Name == &#8220;DropDownList&#8221;)<br />
{<br />
((DropDownList)(ctrl)).Enabled = false;</p>
<p>}<br />
else if (ctrl.GetType().Name == &#8220;RadioButton&#8221;)<br />
{<br />
((RadioButton)(ctrl)).Enabled = false;<br />
}<br />
if (ctrl.Controls.Count &gt; 0)<br />
{<br />
DisableControls(ctrl);<br />
}<br />
}<br />
}</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/dotnet/loop-through-all-controls-in-a-user-control/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Dynamically Loading a model in Cake PHP</title>
		<link>http://www.robinthomas.in/php/dynamically-loading-a-model-in-cake-php/</link>
		<comments>http://www.robinthomas.in/php/dynamically-loading-a-model-in-cake-php/#comments</comments>
		<pubDate>Mon, 02 Nov 2009 15:54:44 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[CakePHP]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=83</guid>
		<description><![CDATA[You may need to access a different model in a controller that it actually belongs to. For example you may have to access the model &#8216;comment &#8216;  in a controller  &#8216;Post&#8221;.
Or you may have to access the rating model inside you video Controller.
Following are  three methods for using a different model in your controller.
1. Controller::loadModel();
This [...]]]></description>
			<content:encoded><![CDATA[<p>You may need to access a different model in a controller that it actually belongs to. For example you may have to access the model &#8216;<em>comment</em> &#8216;  in a controller  &#8216;<em>Post</em>&#8221;.<br />
Or you may have to access the <em>rating</em> model inside you <em>video</em> Controller.<br />
Following are  three methods for using a different model in your controller.</p>
<h3>1. Controller::loadModel();</h3>
<p>This method actually calls ClassRegistry::init() and saves the instance of the model as a parameter in the controller.</p>
<p><strong>Example:</strong></p>
<p>Inside the controller class</p>
<p>$this-&gt;loadModel(&#8217;Comment&#8217;) ;<br />
$this-&gt;Comment-&gt;delete(1);</p>
<p>Or</p>
<p>Controller::loadModel(&#8217;Comment&#8217;);<br />
$comments = $this-&gt;Comment-&gt;find(&#8217;all&#8217;);</p>
<p>http://api.cakephp.org/class/controller#method-ControllerloadModel</p>
<h3>2. ClassRegistry::init()</h3>
<p>This method creates an instance of the Model and returns it for use.</p>
<p><strong>Example:</strong></p>
<p>$comment = ClassRegistry::init(&#8217;Comment&#8217;);<br />
$comments = $comment-&gt;find(&#8217;all&#8217;);</p>
<p>http://api.cakephp.org/class/class-registry#method-ClassRegistryinit</p>
<h3>3. App:import()</h3>
<p>Calling App::import is equivalent to <em>requiring</em> the file.You need to create an instance of the class each time after you import the file.</p>
<p>http://book.cakephp.org/view/531/Importing-Controllers-Models-Components-Behaviors-</p>
<p><strong>Example:</strong></p>
<p>App::import(&#8217;Comment&#8217;);<br />
$comment = new Comment();<br />
$comments = $comment-&gt;find(&#8217;all&#8217;);</p>
<p><strong>Which one is Best ?</strong></p>
<p>The first method is prefereble over the latter two.</p>
<p>This is actually a basic thing in Cake PHP. But I am posting it for newbie like me.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/php/dynamically-loading-a-model-in-cake-php/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Integrating CKEditor in CakePHP</title>
		<link>http://www.robinthomas.in/php/ckeditor-cakephp/</link>
		<comments>http://www.robinthomas.in/php/ckeditor-cakephp/#comments</comments>
		<pubDate>Sun, 25 Oct 2009 07:47:49 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[PHP]]></category>

		<category><![CDATA[CakePHP]]></category>

		<category><![CDATA[CKEditor]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=77</guid>
		<description><![CDATA[CKeditor/FCK Editor is one of the world's best WYSIWYG editor. Simple steps to integrate CKEditor in CakePHP.]]></description>
			<content:encoded><![CDATA[<p>CKeditor/FCK Editor is  one of the world&#8217;s best WYSIWYG editor. CKEditor provides built-in file management functions.</p>
<p>(If you need a simple Rich Text Editor, I suggest you to use TinyMCE instead of  CKEditor)</p>
<p>If you want to integrate CKEditor to your CakePHP page, then follow the below steps.</p>
<h2>Integrating CKEditor with CakePHP.</h2>
<p><strong>Step 1 : </strong></p>
<p>Download CK Editor</p>
<p>http://ckeditor.com/download</p>
<p><strong>Step 2 :</strong></p>
<p>Unzip it and save the ckeditor directory in app\webroot\js folder.</p>
<p><strong>Step 3 :</strong></p>
<p>Open your controller class and Add &#8216;Javascript&#8217; to $helpers array.</p>
<p>So your helper variable may look something like this.</p>
<p>var $helpers = array(&#8217;Html&#8217;, &#8216;Form&#8217;, &#8216;Javascript&#8217;);</p>
<p><strong>Step 4 : </strong></p>
<p>Include the ckeditor js file in your view.</p>
<p>&lt;?php $javascript-&gt;link(&#8217;/js/ckeditor/ckeditor&#8217;, false);?&gt;</p>
<p><strong>Step 5 :</strong></p>
<p>Add a text area to your view and add the  style class &#8216;ckeditor&#8217; to text area.</p>
<p>echo $form-&gt;textarea(&#8217;txtEditor&#8217;, array(&#8217;class&#8217;=&gt;&#8217;ckeditor&#8217;));</p>
<p>Done&#8230; Load the page&#8230;</p>
<p>Now you can see your FCK editor in your page.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/php/ckeditor-cakephp/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Installing IIS and apache in same server.</title>
		<link>http://www.robinthomas.in/general/installing-iis-and-apache-in-same-machine/</link>
		<comments>http://www.robinthomas.in/general/installing-iis-and-apache-in-same-machine/#comments</comments>
		<pubDate>Sun, 24 May 2009 16:43:36 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[Apache]]></category>

		<category><![CDATA[IIS]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=61</guid>
		<description><![CDATA[
Situation:  Not able to access http://localhost/ after installing WAMP.
Here is the story.

 You Install WAMP server.
 WAMP installation successful. You are happy.
 Trying to access the localhost from the wamp menu.
 You are redirected to a URL similar to this.

http://localhost/localstart.asp
Scratching your head and saying WTF  
Reason: Some other application is listening to the default [...]]]></description>
			<content:encoded><![CDATA[<h3 style="text-align: center;"><img class="alignnone size-full wp-image-69" title="apache" src="http://www.robinthomas.in/wp-content/uploads/2009/05/apache.jpeg" alt="apache" width="89" height="91" /></h3>
<h3>Situation:  Not able to access http://localhost/ after installing WAMP.</h3>
<p>Here is the story.</p>
<ul>
<li> You Install WAMP server.</li>
<li> WAMP installation successful. You are happy.</li>
<li> Trying to access the localhost from the wamp menu.</li>
<li> You are redirected to a URL similar to this.</li>
</ul>
<p>http://localhost/localstart.asp<br />
Scratching your head and saying WTF <img src='http://www.robinthomas.in/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>Reason: Some other application is listening to the default port 80.</h3>
<p>You have already installed IIS or some other application which<br />
listens to port 80. Port 80 is the default port Apache is listening. But already<br />
IIS is bound to that port and only one server can bind to a port at a time.</p>
<h3>Solution :</h3>
<p><strong>Solution #1: </strong> Simple, but not feasible for most of you. Uninstall IIS .</p>
<p><strong>Solution #2:</strong> Change the Port in which Apache is listening.</p>
<ol>
<li>Go to bin directory in the installation folder.</li>
<li> Search for a file with name &#8220;httpd.conf&#8221;</li>
<li>Open the file.</li>
<li> Search for &#8220;Listen 80&#8243;</li>
<li> Replace it with &#8220;Listen 8080&#8243;</li>
<li> Restart Apache</li>
<li> Now type &#8220;http://localhost:8080/&#8221; in your browser.</li>
</ol>
<p><em>Note :	If you are using WAMP, you can directly access the httpd.conf file from  WAMP menu. Refer the following picture.</em></p>
<p><em><img class="alignnone size-full wp-image-62" title="apache-wamp" src="http://www.robinthomas.in/wp-content/uploads/2009/05/apache-wamp.png" alt="apache-wamp" width="328" height="283" /></em></p>
<p><em><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/general/installing-iis-and-apache-in-same-machine/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Reliance wimax.. what the f~~~~~ ?</title>
		<link>http://www.robinthomas.in/internet/reliance-wimax-chennai/</link>
		<comments>http://www.robinthomas.in/internet/reliance-wimax-chennai/#comments</comments>
		<pubDate>Thu, 14 May 2009 20:46:07 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[Internet]]></category>

		<category><![CDATA[Broadband]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=55</guid>
		<description><![CDATA[
I have been using reliance wimax broadband for the last 8 months  .. I think 8 months are more than enough to write a review about a product/service.
So here it goes&#8230;
In a single sentence let me describe Reliance Wimax broadband service .. &#8220;Worst Broadband service in Chennai&#8221;.
First let us look at the
Reliance wimax plans
150 [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><img class="size-full wp-image-73 aligncenter" title="reliance wimax" src="http://www.robinthomas.in/wp-content/uploads/2009/05/reliance.jpeg" alt="reliance wimax" width="88" height="88" /></p>
<p>I have been using reliance wimax broadband for the last 8 months  .. I think 8 months are more than enough to write a review about a product/service.</p>
<p>So here it goes&#8230;</p>
<p>In a single sentence let me describe Reliance Wimax broadband service .. &#8220;Worst Broadband service in Chennai&#8221;.</p>
<p>First let us look at the</p>
<h2>Reliance wimax plans</h2>
<p>150 Kbps  - Rs.750/- Per month (+12 % tax)<br />
400 Kbps  - Rs.999/- Per month (1122 including tax)<br />
600 Kbps  - Rs.1399/- Per Month  (+12 % tax)<br />
1000 Kbps - Rs.2199/- Per Month  (+12 % tax)</p>
<p>Is there any plan in the above list which is suitable for an average home user ?</p>
<h2>Other Unique Features of reliance wimax :</h2>
<p>1) More than 15 minutes to connect !!!</p>
<p>2) The probability of getting it connected is 50 % or less !!!!!</p>
<p>If you ask any of the wimax service persons, they will tell you to keep your modem on 24 Hours, because they know that it will be very tough to get the connection back. But keeping modem always switched on is not possible for many people because of the voltage fluctuations and climate problems.</p>
<h2>About Reliance wimax customer care.</h2>
<p>Calling customer care is just a waste of money without any use.</p>
<p>It will take atleast 20 minutes for all their **#@$&amp; like  IP checking , Physical address checking, DNS flushall ..blah blah..<br />
(at your own calling cost- You have to call an STD number if you don&#8217;t have ) . And you have to pay for their f**** waiting reliance tune.</p>
<p>You have to spend a minimum of 150 Rs/ month for calling the customer care..</p>
<h2>But still i like some features of Reliance Wimax.</h2>
<ul>
<li>The service persons are very nice (atleast in my area)</li>
<li>The installation charge is only 500 Rupees. No deposit<br />
(<em>For shifting its again 500 Rs. So better take a new connection than shifting your old connection</em>)</li>
<li>It is available in most of the places in chennai.</li>
</ul>
<h2>Final Word :</h2>
<p>If any other Broadband provider is available in your area, never go for Reliance wimax. It just SUCKS..</p>
<p>Here is my perference list</p>
<p>1) Airtel (If airtel is available don&#8217;t even think about another connection)</p>
<p>2) Tata Indicom</p>
<p>3) BSNL -Their customer service(is there something like that?) is very bad.</p>
<p>I applied and got BSNL broadband connection after <strong>40</strong> days(in 2007). Also they asked me for extra 500 Rupees.<br />
When there was a problem, i registered complaints three times but no use.</p>
<p>4) Reliance.</p>
<p>[<em>Tonight i switched on the modem around 10 PM and it got connected just now (2 PM)</em>]<br />
<a rel="me" href="http://technorati.com/claim/x9sia9pha7">Technorati Profile</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/internet/reliance-wimax-chennai/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My old room mates!!!!!!!</title>
		<link>http://www.robinthomas.in/personal/my-old-room-mates/</link>
		<comments>http://www.robinthomas.in/personal/my-old-room-mates/#comments</comments>
		<pubDate>Fri, 08 May 2009 19:05:06 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Robin]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=49</guid>
		<description><![CDATA[I got very serious memory loss. Started forgetting everything.
So i just listed the names of my old room mates with whom i stayed atleast for one month.
Taliparamba - Kerala  +2 Hostel Room mates
&#8212;&#8212;&#8212;
Melvin
Renjith
Bangalore - Degree - Diary Circle
&#8212;&#8212;&#8212;
Mathew
Roney
Jose
Bangalore - SG Palaya
&#8212;&#8212;&#8212;
Jinoy
Aju
Bangalore - Maruthi Nagar
&#8212;&#8212;&#8212;
Kiran
Bidhu
Francis
Joesh
Dileep
Timmy
Rufus
Jijo
Vinay
Manu
Mathayi
Safvan
Rahul
Bangalore - 2 months during MCA
&#8212;&#8212;&#8212;
Sujith
James
Prince
Jinoy
Binu sir
Jijo
Joseph
Pune (2 Months) during MCA
&#8212;&#8212;&#8212;
Sijo
Jinoy
Jimmy
Erode - [...]]]></description>
			<content:encoded><![CDATA[<p>I got very serious memory loss. Started forgetting everything.<br />
So i just listed the names of my old room mates with whom i stayed atleast for one month.</p>
<p><strong><span style="color: #008000;">Taliparamba - Kerala  +2 Hostel Room mates</span></strong><br />
&#8212;&#8212;&#8212;<br />
Melvin<br />
Renjith</p>
<p><strong><span style="color: #008000;">Bangalore - Degree - Diary Circle</span></strong><br />
&#8212;&#8212;&#8212;<br />
Mathew<br />
Roney<br />
Jose</p>
<p><strong><span style="color: #008000;">Bangalore - SG Palaya</span></strong><br />
&#8212;&#8212;&#8212;<br />
Jinoy<br />
Aju</p>
<p><strong><span style="color: #008000;">Bangalore - Maruthi Nagar</span></strong><br />
&#8212;&#8212;&#8212;<br />
Kiran<br />
Bidhu<br />
Francis<br />
Joesh<br />
Dileep<br />
Timmy<br />
Rufus<br />
Jijo<br />
Vinay<br />
Manu</p>
<p>Mathayi<br />
Safvan<br />
Rahul</p>
<p><strong><span style="color: #008000;">Bangalore - 2 months during MCA</span></strong><br />
&#8212;&#8212;&#8212;<br />
Sujith<br />
James<br />
Prince<br />
Jinoy<br />
Binu sir<br />
Jijo<br />
Joseph</p>
<p><strong><span style="color: #008000;">Pune (2 Months) during MCA</span></strong><br />
&#8212;&#8212;&#8212;<br />
Sijo<br />
Jinoy<br />
Jimmy</p>
<p><strong><span style="color: #008000;">Erode - MCA - White House.</span></strong><br />
&#8212;&#8212;&#8212;<br />
Sinu<br />
Jibu (He stayed with me for the longest period - More than 3 Years)<br />
Naju<br />
Jijo<br />
OV (Non Paying guest)<br />
Renu</p>
<p><strong><span style="color: #008000;">Chennai - Mugalivakom</span></strong><br />
&#8212;&#8212;&#8212;<br />
Renu<br />
Jibu<br />
OV<br />
Naju<br />
Amjath<br />
Shijo<br />
Vipin<br />
Sijin<br />
Sarath<br />
Aji<br />
Binu<br />
Aejaz</p>
<p><strong><span style="color: #008000;">Chennai - Shakthi Nagar</span></strong><br />
&#8212;&#8212;&#8212;<br />
Sreenivasan<br />
Selvaganesan<br />
Muhammed Hussain<br />
Binu</p>
<p><strong><span style="color: #008000;">Chennai - Ayyapanthangal</span></strong><br />
&#8212;&#8212;&#8212;<br />
Binu</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/personal/my-old-room-mates/feed/</wfw:commentRss>
		</item>
		<item>
		<title>How to change default installation directory in windows</title>
		<link>http://www.robinthomas.in/general/change-default-installation-directory-in-windows/</link>
		<comments>http://www.robinthomas.in/general/change-default-installation-directory-in-windows/#comments</comments>
		<pubDate>Thu, 07 May 2009 19:17:57 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[Microsoft]]></category>

		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=44</guid>
		<description><![CDATA[Many of the Windows users don&#8217;t like to install the applications in the windows installation Drive.Usually people keep their Windows Operating System in C drive and the Softwares in D:\Program Files.
But whenever a new application is installed, the default path is C:\Program Files. And you usually change the path manually to D:\Program Files
But you can [...]]]></description>
			<content:encoded><![CDATA[<p>Many of the Windows users don&#8217;t like to install the applications in the windows installation Drive.Usually people keep their Windows Operating System in C drive and the Softwares in D:\Program Files.<br />
But whenever a new application is installed, the default path is C:\Program Files. And you usually change the path manually to D:\Program Files<br />
But you can change the registry and can set your default installation path to your desired path (Eg D:\Program Files&#8221;)permanently within few seconds. And whenever a new application is installed, you don&#8217;t need to manually select your favorite path.</p>
<h4><strong>Follow these steps to change your default installation directory</strong></h4>
<p><strong></strong>1) Click on start button.  Select Run.  Type regedit. Click Ok.</p>
<p>2) Now you can see the registry Editor.</p>
<p>3).In the left panel Navigate to the following key <strong>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion</strong><br />
4) In the right panel, select ProgramFilesDir.</p>
<p>5) Double click(or right click and select modify) on that and change the value to your desired path(Eg:D:\Program Files).    Click OK.</p>
<p>You are done!! I hope this post will save you some time in the future.</p>
<p><em>Note:The changes will take effect only after rebooting</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/general/change-default-installation-directory-in-windows/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Access client side files using browser</title>
		<link>http://www.robinthomas.in/javascript/access-client-side-files-in-browser/</link>
		<comments>http://www.robinthomas.in/javascript/access-client-side-files-in-browser/#comments</comments>
		<pubDate>Fri, 24 Apr 2009 18:56:41 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=38</guid>
		<description><![CDATA[Is it possible to access files in the client side using a web application/browser ?
Answer :
Yes. It is possible. But only on certain conditions.
Download sample Code here
1) The below code works only in IE.
2) You need to change your security settings in IE to Low.
Select Tools -&#62; Internet Options in IE menu Bar
Select Security  tab. [...]]]></description>
			<content:encoded><![CDATA[<p>Is it possible to access files in the client side using a web application/browser ?</p>
<p>Answer :</p>
<p><strong>Yes. It is possible.</strong> <strong>But only on certain conditions.</strong></p>
<p>Download sample Code <a href="http://www.robinthomas.in/wp-content/uploads/codes/AccessFiles.zip">here</a></p>
<p>1)<span style="color: #ff0000;"> The below code works only in IE.</span></p>
<p>2) You need to change your security settings in IE to Low.</p>
<p>Select Tools -&gt; Internet Options in IE menu Bar</p>
<p>Select Security  tab. Select Internet and click Custom Level</p>
<p>Reset custom settings to  &#8220;Low&#8221;</p>
<p><img class="alignnone size-full wp-image-39" title="security-settings-ie" src="http://www.robinthomas.in/wp-content/uploads/2009/04/security-settings-ie.png" alt="security-settings-ie" width="609" height="448" /></p>
<h3>How you can Open/Create/Write files in client system using browser ?</h3>
<p>For doing this task, you can use <strong>Scripting.FileSystemObject<br />
</strong><br />
To create a file in the client side, you can use the following code</p>
<blockquote><p>var fso = new ActiveXObject(&#8221;Scripting.FileSystemObject&#8221;);<br />
var fileName = &#8220;C:\\robin.txt&#8221;;<br />
function createFile()<br />
{</p>
<p>var fileObj = fso.CreateTextFile(fileName, true)<br />
fileObj.close();</p>
<p>alert(&#8221;A file is created in client side. &#8220;+ fileName);</p>
<p>}</p></blockquote>
<p>Following is set of methods which is supported by FileSystem Object</p>
<p>BuildPath()<br />
CopyFile()<br />
CopyFolder()<br />
CreateFolder()<br />
CreateTextFile()<br />
DeleteFile()<br />
DeleteFolder()<br />
DriveExists()<br />
FileExists()<br />
FolderExists()<br />
GetAbsolutePathName()<br />
GetBaseName()<br />
GetDrive()<br />
GetDriveName()<br />
GetExtensionName()<br />
GetFile()<br />
GetFileName()<br />
GetFolder()<br />
GetParentFolderName()<br />
GetSpecialFolder()<br />
GetTempName()<br />
MoveFile()<br />
MoveFolder()<br />
OpenTextFile()</p>
<p><span style="color: #ff0000;">You can view a demo</span> <a href="http://www.robinthomas.in/wp-content/uploads/codes/AccessFiles.html" target="_blank">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/javascript/access-client-side-files-in-browser/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Restrict user go back to previous page after signout</title>
		<link>http://www.robinthomas.in/dotnet/restrict-user-go-back-to-previous-page-after-signout/</link>
		<comments>http://www.robinthomas.in/dotnet/restrict-user-go-back-to-previous-page-after-signout/#comments</comments>
		<pubDate>Wed, 22 Apr 2009 19:51:35 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[.Net]]></category>

		<category><![CDATA[ASP.NET]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[Javascript]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=31</guid>
		<description><![CDATA[Problem:
User Logs out. 
User is redirected to signout page
User click back button. The previous page is displayed.
How is it possible to prevent the user from visiting the previous pages after logout ?
Reason:
The previous pages are cached in Browser. When u click the back button the pages are served directly from your browser cache instead of getting [...]]]></description>
			<content:encoded><![CDATA[<h2>Problem:</h2>
<p>User Logs out. </p>
<p>User is redirected to signout page</p>
<p>User click back button. The previous page is displayed.</p>
<p>How is it possible to prevent the user from visiting the previous pages after logout ?</p>
<h2>Reason:</h2>
<p>The previous pages are cached in Browser. When u click the back button the pages are served directly from your browser cache instead of getting it from server.</p>
<h2>Solutions:</h2>
<p>Basically there are two different methods to solve this. </p>
<p>1)<span> </span>Disable the cache. (More reliable and browser independent)</p>
<p>2)<span> </span>Javascript methods. (Browser dependent and javascript should be enabled)</p>
<h2>Solution 1 : Disable the cache.</h2>
<p><span> </span>The foolproof solution is to prevent the page from being cached. This can be done with the following server-side script:</p>
<blockquote><p>      Response.Cache.SetCacheability(HttpCacheability.NoCache);</p>
<p>      <span> </span>Response.Cache.SetNoStore(); </p></blockquote>
<p><span> </span>Put the above code in the page load event of all the pages, which u need to prevent accessing after logout.</p>
<p><span> </span>Note: If you want to disable the cache for your entire application, you can put the above code in Global.asax instead of putting it in all the pages. see the Global.asax code below.</p>
<p>Application_BeginRequest(object sender, EventArgs e)</p>
<p>    {</p>
<p>     Response.Cache.SetCacheability(HttpCacheability.NoCache);</p>
<p>      Response.Cache.SetNoStore();</p>
<p>    }</p>
<p><strong>Advantage:</strong>  Works in all the browsers and in all the situations.</p>
<p><strong>Disadvantage :</strong>  The page(including the resources like javascript files, images etc) has to be loaded each time a page is requested.  </p>
<p><strong>When to use : </strong></p>
<p>1)<span> </span>If the application is in an intranet environment</p>
<p>2)<span> </span>If the data should be very secure. (Eg: Banking applications)</p>
<p>You can download a sample code  from <a title="here" href="http://www.robinthomas.in/wp-content/uploads/PreventBackButton.zip">here</a></p>
<h2>Solution 2 :Using Javascript:</h2>
<p>Using javascript methods, you cannot completely restrict the user from  going back to the previous location(but  you can make it harder) </p>
<h3>Method 1:</h3>
<p>You can add code to the secure pages(the pages which the user should not be viewed after logged out) to force the browser to go forwards again: </p>
<p>Place the below code in the head section of the pages which u need to prevent the user from accessing after logout.</p>
<blockquote><p><span> </span>&lt;script language=&#8221;JavaScript&#8221;&gt;</p>
<p>  window.history.forward(1);</p>
<p>&lt;/script&gt;</p></blockquote>
<p>Eg:</p>
<p>&lt;head runat=&#8221;server&#8221;&gt;</p>
<p> &lt;title&gt;User Page&lt;/title&gt;   </p>
<p>&lt;script language=&#8221;JavaScript&#8221;&gt;</p>
<p>  <span> </span>window.history.forward(1);</p>
<p>&lt;/script&gt;</p>
<p>&lt;/head&gt;</p>
<p>Note: The above method does not work in chrome.</p>
<h3>Method 2 :</h3>
<p>Place the following code in the head section of the page where you don’t want the user to revisit using the back button. </p>
<blockquote><p>&lt;script type = &#8220;text/javascript&#8221; &gt; </p>
<p>   function preventBack(){window.history.forward();} </p>
<p>    setTimeout(&#8221;preventBack()&#8221;, 0); </p>
<p>    window.onunload=function(){null}; </p>
<p>&lt;/script&gt;</p></blockquote>
<p> </p>
<p>This code is based on the following article.</p>
<p>http://www.aspsnippets.com/post/2009/03/24/Disable-Browser-Back-Button-Functionality-using-JavaScript.aspx</p>
<h3>Method 3: (Not recommended)</h3>
<p>You can use the <strong> location replace method <span style="font-weight: normal;">when changing the location. This replaces the current history location with the new location. Some older browsers do not support this method, so test for document.images to check if  the browser support this propery.</span></strong></p>
<blockquote><p>&lt;script language=&#8221;JavaScript&#8221;&gt;</p>
<p>if (document.images) </p>
<p>location.replace(&#8217;http://www.yoursite.com/yourpage.html&#8217;); </p>
<p>else </p>
<p>location.href = &#8216; yourpage.html&#8217;; </p>
<p>&lt;/script&gt;</p></blockquote>
<p><em>Note:</em></p>
<p><em>If you have any suggestions, please comment it below. I will be constantly updating this post based on your comments.</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/dotnet/restrict-user-go-back-to-previous-page-after-signout/feed/</wfw:commentRss>
		</item>
		<item>
		<title>StringBuilder Vs String Concatenations</title>
		<link>http://www.robinthomas.in/dotnet/stringbuilder-vs-string-concatenations/</link>
		<comments>http://www.robinthomas.in/dotnet/stringbuilder-vs-string-concatenations/#comments</comments>
		<pubDate>Sat, 18 Apr 2009 10:50:23 +0000</pubDate>
		<dc:creator>Robin</dc:creator>
		
		<category><![CDATA[.Net]]></category>

		<category><![CDATA[C#]]></category>

		<guid isPermaLink="false">http://www.robinthomas.in/?p=23</guid>
		<description><![CDATA[StringBuilder or String Concatenation..  Is there any real performance issue in string concatenation ? When should I use StringBuilder ? To answer these questions, first lets examine the difference between String and StringBuilder classes.
What is the difference between String and
StringBuilder?
String is immutable while StringBuilder is mutable.
After a string object is created its value cannot [...]]]></description>
			<content:encoded><![CDATA[<p>StringBuilder or String Concatenation..  Is there any real performance issue in string concatenation ? When should I use StringBuilder ? To answer these questions, first lets examine the difference between String and StringBuilder classes.</p>
<h2>What is the difference between String and</h2>
<h2>StringBuilder?</h2>
<p>String is immutable while StringBuilder is mutable.</p>
<p>After a string object is created its value cannot be changed. Then how the following  is possible ?</p>
<p>String name = “Mr. “;</p>
<p>name = name + “First Name” + “Last Name”;</p>
<p>When the concatenation operation is performed the actual string object is discarded and a new string object is created.</p>
<p>But StringBuilder is mutable. StringBuilder class provides methods to change its contents at anytime. StringBuilder class has a very useful method “append” to add new strings to the end of the existing string value. StringBuilder internally reserves a certain amount of memory(Buffer). When a new string is added to the StringBuilder object, the new string is copied to the existing buffer. If the buffer is not enough to fit the new string , then a new buffer is created to fit the new string.</p>
<h2>A Performance Test ( StringBuilder VS Concatenation):</h2>
<p>Here is a simple performance test which demonstrates the power of StringBuilder over string concatenation.</p>
<blockquote><p>DateTime start;</p>
<p>StringBuilder strBuilder = new StringBuilder();<br />
string str = string.Empty;</p>
<p>TimeSpan strBuilderExTime = new TimeSpan();</p>
<p>start = DateTime.Now;<br />
for (int i = 0; i &lt; 80000; i++)<br />
{<br />
str = str + “Test string”;<br />
}<br />
strBuilderExTime = DateTime.Now - start;<br />
Console.WriteLine(”Exection Time for string concatenation =” + strBuilderExTime.ToString());</p>
<p>start = DateTime.Now;<br />
for (int i = 0; i &lt; 80000; i++)<br />
{<br />
strBuilder.Append(”Test string”);<br />
}<br />
strBuilderExTime = DateTime.Now - start;<br />
Console.WriteLine(”Exection Time for string builder oncatenation =” + strBuilderExTime.ToString());</p></blockquote>
<p>Output :</p>
<p>Exection Time for string concatenation          = <span style="color: #ff0000;">00:02:37.9687500</span><br />
Exection Time for string builder oncatenation = <span style="color: #339966;">00:00:00.0156250</span></p>
<p>You can see a very huge time difference between the above two.</p>
<h2>When should i use StringBuilder ?</h2>
<p>Is StringBuilder always a better Option than concatenation? No… If there are only few concatenations (say less than 5 apprx.) , then no need to go for StringBuilder.</p>
<h2>Conclusion:</h2>
<p>If the number of concatenations is more, then use StringBuilder. But if the number of concatenations is very few then go for ordinary “+” concatenations.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.robinthomas.in/dotnet/stringbuilder-vs-string-concatenations/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
