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

<channel>
	<title>Null Disquisition</title>
	<atom:link href="http://mumrah.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://mumrah.net</link>
	<description>In Mother Russia, Thesis writes You!</description>
	<pubDate>Fri, 10 Oct 2008 04:50:41 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.5.1</generator>
	<language>en</language>
			<item>
		<title>1d Fokker-Plank equation</title>
		<link>http://mumrah.net/2008/10/1d-fokker-plank-equation/</link>
		<comments>http://mumrah.net/2008/10/1d-fokker-plank-equation/#comments</comments>
		<pubDate>Fri, 10 Oct 2008 04:45:51 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[School]]></category>

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

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

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

		<guid isPermaLink="false">http://mumrah.net/?p=29</guid>
		<description><![CDATA[As promised, I bring pretty pictures. The past few days I&#8217;ve been working on a solution to the 1d diffusion equation with a drift term, better known as the Fokker-Planck equation.

Sexy, I know. Anyhow, I finally worked out the Python code to get it rolling (literally!). The test system I did has periodic boundary conditions [...]]]></description>
			<content:encoded><![CDATA[<p>As promised, I bring pretty pictures. The past few days I&#8217;ve been working on a solution to the 1d diffusion equation with a drift term, better known as the Fokker-Planck equation.</p>
<p style="text-align: center;"><img class="alignnone size-medium wp-image-30 aligncenter" title="fokker-planck-1d" src="http://mumrah.net/wp-content/uploads/2008/10/latex-image-1-300x58.png" alt="The 1d Fokker-Planck equation" width="300" height="58" /></p>
<p style="text-align: left;">Sexy, I know. Anyhow, I finally worked out the Python code to get it rolling (literally!). The test system I did has periodic boundary conditions and an initial condition of a sharply-peaked Gaussian (a = 20). I&#8217;ll spare the details and jump to the fun part.</p>
<p style="text-align:center;">
<embed id="VideoPlayback" src="http://video.google.com/googleplayer.swf?docid=8670238611717151756&#038;hl=en&#038;fs=true" style="width:400px;height:326px" allowFullScreen="true" allowScriptAccess="always" type="application/x-shockwave-flash"> </embed></p>
<p style="text-align: left;">Here&#8217;s the <a title="Python code for 1d Fokker-Planck" href="http://mumrah.net/wp-content/uploads/fokker-planck.py.txt"  target="_self">Python code</a> that made it happen (scipy and matplotlib required).</p>
<p style="text-align: left;">-David</p>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/10/1d-fokker-plank-equation/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Naruto easy player</title>
		<link>http://mumrah.net/2008/10/naruto-easy-player/</link>
		<comments>http://mumrah.net/2008/10/naruto-easy-player/#comments</comments>
		<pubDate>Thu, 09 Oct 2008 03:59:32 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[General]]></category>

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

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

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

		<guid isPermaLink="false">http://mumrah.net/?p=28</guid>
		<description><![CDATA[While I was supposed to be doing research for my thesis, I whipped up a handy little Naruto player.]]></description>
			<content:encoded><![CDATA[<p>Well. Damn. Not much to update about my thesis. Been working on a 1d solution to the diffusion equation with a drift potential (see <a title="Fokker-Planck equation" href="http://en.wikipedia.org/wiki/Fokker-Planck_equation" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');" target="_blank">Fokker-Planck</a>). When I get some pretty pictures for that I&#8217;ll post them.</p>
<p>In the mean time, I made an awesome time-saving app for watching Naruto. Took me about 5 mins (granted I&#8217;ve been doing a lot of PHP programming lately). Goes like this:</p>
<ul>
<li>cURL request to MySpaceTV for &#8220;Naruto Episode ###&#8221;</li>
<li>uses preg_match to find the first result</li>
<li>strips out the video id and pastes it into a flash embed</li>
</ul>
<p>Check out the <a title="Source Code" href="http://mumrah.net/wp-content/uploads/naruto.txt"  target="_self">source</a> or <a title="Watch Naruto Epiode 136" href="http://mumrah.net/wp-content/uploads/naruto.php"  target="_self">watch an episode</a> yourself!</p>
<p>-David</p>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/10/naruto-easy-player/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Afternoon decafe</title>
		<link>http://mumrah.net/2008/09/afternoon-decafe/</link>
		<comments>http://mumrah.net/2008/09/afternoon-decafe/#comments</comments>
		<pubDate>Sun, 07 Sep 2008 14:26:50 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[School]]></category>

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

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

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

		<guid isPermaLink="false">http://mumrah.net/?p=25</guid>
		<description><![CDATA[I can&#8217;t believe I&#8217;m actually doing work this afternoon instead of playing Spore. Oh well, I&#8217;m already up to Civilization Phase (only took 12 hours). The wife is at Starbucks off campus studying with her cohorts (with shitty T-Mobile wifi), so I went to the Starbucks on campus (with awesome free campus Wifi).
Earlier this week, [...]]]></description>
			<content:encoded><![CDATA[<p>I can&#8217;t believe I&#8217;m actually doing work this afternoon instead of playing <a href="http://picasaweb.google.com/mumrah/Spore?authkey=SySzMPLkWCg#" onclick="javascript:pageTracker._trackPageview('/outbound/article/picasaweb.google.com');">Spore</a>. Oh well, I&#8217;m already up to Civilization Phase (only took 12 hours). The wife is at Starbucks off campus studying with her cohorts (with shitty T-Mobile wifi), so I went to the Starbucks on campus (with awesome free campus Wifi).</p>
<p>Earlier this week, I promised that I was going to keep everyone updated with how my research is going and what I&#8217;m doing. So, here we are.</p>
<p>As previously mentioned, this first paper I&#8217;m writing is a &#8220;Why and When&#8221; sort of paper. We talk about three popular methods for doing MCMC simulations and which is best under what circumstances. The three methods are traditional Molecular Dynamics, Multiensemble, and Hamiltonian Replica Exchange Molecular Dynamics. The method I&#8217;m researching is the last one, hREMD (love the title). You can tell it&#8217;s a recent method cause the name is really long and convoluted. I&#8217;m pretty sure all the good names in MCMC were taken by the mid 90s. I won&#8217;t go into full detail on each method here (trying not to lose anyone&#8217;s interest), just know they exist.</p>
<p>The basic jist of the paper follows. You can break down the computation resources of a simulation into two parts: equilibration phase, and production phase. When doing MCMC, you must let your system fully equilibrate before you can start sampling data. An example of why this is would be, in 2D suppose you stick a particle in a box and let the particle move around a tiny bit each iteration. For the next several iterations, the position of the particle is going to be correlated to the starting point. This is called configuration bias (or startup bias, et al.). The following figure is the <a href="http://en.wikipedia.org/wiki/Autocorrelation" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">Autocorrelation</a> of some MC time series data (the thickness is from the error bars).</p>
<p style="text-align: center;"><img class="alignnone size-medium wp-image-27 aligncenter" title="autocorrelation" src="http://mumrah.net/wp-content/uploads/2008/09/autocorrelation-300x210.png" alt="" width="300" height="210" /></p>
<p style="text-align: left;">A visual analogy follows: Suppose you take a thatch of color, magenta. If you break it down into 3 color channels (red, green, blue) the corresponding hex code would be something around #A03. Call this our starting point.</p>
<p style="text-align: left;"><span style="color: #aa0033;">Iteration 1 (#AA0033)<br />
</span></p>
<p style="text-align: left;">Now let&#8217;s make up an update rule for our Markov chain. Each iteration, we pick a color channel and shift it by some amount x where x is a random integer between [-1,1]. After 100 iterations, we have moved around in the 3d color-space (where each channel is a dimension), and have ended up at #953.</p>
<p style="text-align: left;"><span style="color: #995533;">Iteration 100 (#995533)<br />
</span></p>
<p style="text-align: left;">Hmm. Not much has changed. Lets look at 10000 iterations.</p>
<p style="text-align: left;"><span style="color: #222255;">Iteration 10000 (#222255)<br />
</span></p>
<p style="text-align: left;">Ok, that&#8217;s better. What I&#8217;m trying to demonstrate is that when you do a stochastic simulation like this, the starting point is going to bias what the system does for the first several iterations. You need to let the system run for a very long time in order for your current state to have no &#8220;history&#8221; of the first state. The plot above shows the correlation of the system as it goes through time. Notice, at the beginning, the correlation is very high (in fact at time 0 it is infinite). The reasoning for this is the same as for why Iteration 1 and Iteration 100 of our color simulation are very similar.</p>
<p style="text-align: left;">That said, my paper talks about how long it takes each of the 3 different methods to reach equilibrium - when the current state has lost all memory of the original state. I think I&#8217;ll make a little demo of the color thing.</p>
<p style="text-align: left;">-David</p>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/09/afternoon-decafe/feed/</wfw:commentRss>
		</item>
		<item>
		<title>So much for this weekend</title>
		<link>http://mumrah.net/2008/09/so-much-for-this-weekend/</link>
		<comments>http://mumrah.net/2008/09/so-much-for-this-weekend/#comments</comments>
		<pubDate>Sat, 06 Sep 2008 21:42:58 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[General]]></category>

		<category><![CDATA[jealous?]]></category>

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

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

		<guid isPermaLink="false">http://mumrah.net/?p=17</guid>
		<description><![CDATA[Spore a day early, screenshots included.]]></description>
			<content:encoded><![CDATA[<p>I consented to a verbal NDA at the game store, so I can&#8217;t give any details, but I got Spore a day early. Native OS X support&#8230; *drool*. Consequently, this will be the first time I&#8217;ll have used my dvd drive on my new laptop. Lulz.</p>
<p>I literally jumped in the air when they guy handed my the bag and prompted me to vacate the premesis. Screenshots after the break.</p>
<p>-Break-</p>
<p><a href="http://mumrah.net/wp-content/uploads/2008/09/picture-1.png" ><img class="alignnone size-medium wp-image-18" title="Installing" src="http://mumrah.net/wp-content/uploads/2008/09/picture-1-300x187.png" alt="" width="300" height="187" /></a></p>
<p><a href="http://mumrah.net/wp-content/uploads/2008/09/picture-9.png" ><img class="alignnone size-medium wp-image-19" title="picture-9" src="http://mumrah.net/wp-content/uploads/2008/09/picture-9-300x187.png" alt="Intro Movie" width="300" height="187" /></a></p>
<p><a href="http://mumrah.net/wp-content/uploads/2008/09/picture-11.png" ><img class="alignnone size-medium wp-image-20" title="picture-11" src="http://mumrah.net/wp-content/uploads/2008/09/picture-11-300x187.png" alt="My Creature" width="300" height="187" /></a></p>
<p><a href="http://mumrah.net/wp-content/uploads/2008/09/picture-13.png" ><img class="alignnone size-medium wp-image-21" title="picture-13" src="http://mumrah.net/wp-content/uploads/2008/09/picture-13-300x187.png" alt="Run!!" width="300" height="187" /></a></p>
<p><a href="http://mumrah.net/wp-content/uploads/2008/09/picture-17.png" ><img class="alignnone size-medium wp-image-22" title="picture-17" src="http://mumrah.net/wp-content/uploads/2008/09/picture-17-300x187.png" alt="Yum, algae" width="300" height="187" /></a></p>
<p><a href="http://mumrah.net/wp-content/uploads/2008/09/picture-22.png" ><img class="alignnone size-medium wp-image-23" title="picture-22" src="http://mumrah.net/wp-content/uploads/2008/09/picture-22-300x187.png" alt="On land" width="300" height="187" /></a></p>
<p><a href="http://mumrah.net/wp-content/uploads/2008/09/picture-27.png" ><img class="alignnone size-medium wp-image-24" title="picture-27" src="http://mumrah.net/wp-content/uploads/2008/09/picture-27-300x187.png" alt="Making babies" width="300" height="187" /></a></p>
<p>-David</p>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/09/so-much-for-this-weekend/feed/</wfw:commentRss>
		</item>
		<item>
		<title>My first real paper</title>
		<link>http://mumrah.net/2008/09/my-first-real-paper/</link>
		<comments>http://mumrah.net/2008/09/my-first-real-paper/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 21:33:03 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[School]]></category>

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

		<guid isPermaLink="false">http://mumrah.net/?p=16</guid>
		<description><![CDATA[My prof is putting me down as primary author on a paper we&#8217;re working on. Or rather, I&#8217;m putting my professor down as a corresponding author on a paper I&#8217;m writing. heh. The topic is testing the efficieny/effectivness of Replica Exchange Molecular Dynamics to Multiensemeble methods (obligitory wiki links), and when it&#8217;s best to use [...]]]></description>
			<content:encoded><![CDATA[<p>My prof is putting me down as primary author on a paper we&#8217;re working on. Or rather, I&#8217;m putting my professor down as a corresponding author on a paper <em>I&#8217;m</em> writing. heh. The topic is testing the efficieny/effectivness of Replica Exchange Molecular Dynamics to Multiensemeble methods (<a href="http://en.wikipedia.org/wiki/Molecular_dynamics#Generalized_ensembles" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">obligitory</a> <a href="http://en.wikipedia.org/wiki/Monte_Carlo_method" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">wiki</a> <a href="http://en.wikipedia.org/wiki/Markov_chain_Monte_Carlo" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">links</a>), and when it&#8217;s best to use each method. The funny thing about statistical mechanics (and a lot of science in general) is that the concepts are fundamentally simple, but the literature is so far obfuscated with jargon and assumptions that hardly anyone can understand them. I mean, shit, I hardly follow half of what I read - and now I&#8217;m supposed to be writing it.</p>
<p>My generation of grad student is coming from the first batch of kids who grew up with the internet, and really the first generation of Wikipedia. As such, I&#8217;m going to try a new type of research dogma that attempts to make my research available (and accessable) to anyone. This type of transparent research is become more common, and I hope to see more of it.</p>
<p>Here&#8217;s a quick run down of my goals for this experiment</p>
<ul>
<li>Provide all of my publications and projects freely (source too)</li>
<li>Keep the language deflated, no jargon</li>
<li>Document my methods, keep the research process transparent</li>
<li>Contribute info (not necessarily new research) back into Wikipedia</li>
<li>Not get caught by my committee for giving away research ^_^</li>
</ul>
<p>Hopefully, by the time I finish my thesis I will have enough content here for anyone (idiots excluded) to somewhat understand what it&#8217;s all about. Hope you&#8217;re all ready - hope I&#8217;m ready.</p>
<p>Edit: <em>Loving</em> my macbook.</p>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/09/my-first-real-paper/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thesis and First iMpressions</title>
		<link>http://mumrah.net/2008/09/thesis-and-first-impressions/</link>
		<comments>http://mumrah.net/2008/09/thesis-and-first-impressions/#comments</comments>
		<pubDate>Thu, 04 Sep 2008 14:17:02 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[School]]></category>

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

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

		<guid isPermaLink="false">http://mumrah.net/?p=14</guid>
		<description><![CDATA[This semester is all about writing. My professor wants to get two papers out this fall. Luckily, however, these papers will be chapters 2 and 3 of my thesis. Huzzah.
I got a Macbook Pro last week (from an undisclosed source), so now I fit in with the other grad students. The adjustment to OS X [...]]]></description>
			<content:encoded><![CDATA[<p>This semester is all about writing. My professor wants to get two papers out this fall. Luckily, however, these papers will be chapters 2 and 3 of my thesis. Huzzah.</p>
<p>I got a Macbook Pro last week (from an undisclosed source), so now I fit in with the other grad students. The adjustment to OS X has been relatively painless (coming from Ubuntu). My first inclination was to ditch OS X completely and load Linux, but I&#8217;ve been persuaded by the Apple Demons (evil and benine) to give Mac a chance. I&#8217;ve had to do a lot of customization to get the terminal anywhere near the functionality of gnome-terminal. In fact, I ditched the default terminal for a project call <a title="iTerm" href="http://iterm.sourceforge.net/" onclick="javascript:pageTracker._trackPageview('/outbound/article/iterm.sourceforge.net');" target="_blank">iTerm</a>. Indeed, I will miss gnome-terminal.</p>
<p>The multi touch is incredible. The hardware is incredible.</p>
<p>I&#8217;ve quit my crappy job (see <a title="Make it stop" href="http://mumrah.net/topics/access/" >Access Nightmares</a>), and taken an awesome job (see <a href="http://mumrah.net/wp-content/uploads/2008/09/photo-9.jpg" >How Happy</a>). This is going to be a busy few months. Here we go.</p>
<p>-David</p>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/09/thesis-and-first-impressions/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Old posts</title>
		<link>http://mumrah.net/2008/07/old-posts/</link>
		<comments>http://mumrah.net/2008/07/old-posts/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 00:25:02 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[General]]></category>

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

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

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

		<guid isPermaLink="false">http://mumrah.net/?p=12</guid>
		<description><![CDATA[In a tragic episode of miscommunication and server migration, I have managed to loose my once beloved Wordpress Blog (http://enja.org/david). I did, however, by the magic of the Wayback Machine uncover an archive from 2007. All of the important posts are there (the AJAX articles) and the other diatribe remains as well.
http://web.archive.org/web/20070105031325rn_1/www.enja.org/david/
Mad props to Archive.org.
-David
]]></description>
			<content:encoded><![CDATA[<p>In a tragic episode of miscommunication and server migration, I have managed to loose my once beloved Wordpress Blog (http://enja.org/david). I did, however, by the magic of the <em>Wayback Machine</em> uncover an archive from 2007. All of the important posts are there (the AJAX articles) and the other diatribe remains as well.</p>
<p>http://web.archive.org/web/20070105031325rn_1/www.enja.org/david/</p>
<p>Mad props to Archive.org.</p>
<p>-David</p>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/07/old-posts/feed/</wfw:commentRss>
		</item>
		<item>
		<title>From the Archives: Ajax IE Caching Issue - Recap</title>
		<link>http://mumrah.net/2008/07/from-the-archives-ajax-ie-caching-issue-recap/</link>
		<comments>http://mumrah.net/2008/07/from-the-archives-ajax-ie-caching-issue-recap/#comments</comments>
		<pubDate>Wed, 02 Jul 2008 00:12:05 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[archives]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://mumrah.net/?p=11</guid>
		<description><![CDATA[Author&#8217;s Note:
Here is another article from my long lost blog. Ajaxian still links in here, as well as many other personal blogs. See my previous post for background.
-David
Post:
In light of the comments on the original post, i thought it would be nice to reiterate some other people’s workarounds.
This was the first one brought to my [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Author&#8217;s Note:</strong><br />
Here is another article from my long lost blog. Ajaxian still links in here, as well as many other personal blogs. See my <a href="http://mumrah.net/2008/07/from-the-archives-ajax-ie-caching-issues/" >previous post</a> for background.</p>
<p>-David</p>
<p><strong>Post:</strong><br />
In light of the comments on the original post, i thought it would be nice to reiterate some other people’s workarounds.</p>
<p>This was the first one brought to my attention, and actually is how i work around the caching these days. Basically, you add a superfluous variable to your string of GET vars that is unique - timestamp works fine. I actually go a little bit further and use milliseconds since the app i’m working on makes several requests per second.</p>
<blockquote><p>    <code>servlet/imagemaker.jsp?foo=bar&#038;goo=car<br />
    Change to:<br />
    servlet/imagemaker.jsp?foo=bar&#038;goo=car&#038;time=111111111</code></p>
</blockquote>
<p>    Here is function to uncache the url:   </p>
<blockquote><p><code>function uncache(url){<br />
    var d = new Date();<br />
    var time = d.getTime();<br />
    return url + ‘&#038;time=’+time;<br />
    } </code></p>
</blockquote>
<p>This workaround looks like as close to a valid solution as there is. It simply adds an arbitrary variable to the POST vars (sent in the <code>send</code> method).</p>
<blockquote><p>  <code> http.open(’post’, ‘myfile.php’);<br />
    http.setRequestHeader(’Content-Type’, ‘application/x-www-form-urlencoded’);<br />
    http.onreadystatechange = handleResponse;<br />
    http.send(’var=1′); </code>
</p>
</blockquote>
<p>A null or empty string for the send method will cause IE to cache.</p>
<p>My only recommendation for that second solution would be to change the POST var to <code>send(’ie=teh_suck’);</code></p>
<p>Kudos to contributors.<br />
<strong><br />
Comment Thread:</strong></p>
<dl>
<dt>Sujai Said&#8230;</dt>
<dd>
<p>What about xml files. I am trying to call xml using ajax. I tried POST its not working
</p>
<ul class="commentsdate">
<li>September 14th, 2006 at 11:57 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Steve Said&#8230;</dt>
<dd>
<p>Thanks for this, I had already spent far too long trying to work out why ie was caching the records (thought it may have been a bug in ie7).  For those that are interested below is a script i used the above suggestion with, it uses a php loop to change the field which it will output the fetched data to.<br />
cheers</p>
<p>function getContent(){<br />
  var page=’./query.php’;<br />
  var selected=document.getElementById(’selected’).value;</p>
<p>  if (selected==&#8217;’){selected=’none’;}</p>
<p>  //params has to have following format<br />
  //i.e.: c=1&#038;id=3….</p>
<p>  //Clear our fetching variable</p>
<p>  var xmlhttp=false;</p>
<p>  //Try to create active x object<br />
  try {<br />
    xmlhttp = new ActiveXObject(’Msxml2.XMLHTTP’);<br />
  } catch (e) {</p>
<p>    try {<br />
      xmlhttp = new ActiveXObject(’Microsoft.XMLHTTP’);<br />
    } catch (E) {<br />
      xmlhttp = false;<br />
    }</p>
<p>  }</p>
<p>  if (!xmlhttp &#038;&#038; typeof XMLHttpRequest!=’undefined’) {<br />
    alert(’Error’);<br />
  }</p>
<p>  var rowNum=&#8217;’;</p>
<p>  xmlhttp.onreadystatechange = function(){<br />
    if(xmlhttp.readyState==4 &#038;&#038; xmlhttp.status== 200) {<br />
      document.getElementById(’qty’).innerHTML = xmlhttp.responseText;</p>
<p>    }<br />
  }</p>
<p>  params=’selected=’+ selected +’&#038;rownum=’+ rowNum +’&#038;rnd=’+ Math.random()*99999;</p>
<p>  xmlhttp.open(’POST’, ‘./query.php’, false);</p>
<p>  xmlhttp.setRequestHeader(’Content-type’, ‘application/x-www-form-urlencoded’);</p>
<p>  xmlhttp.send(params);</p>
<p>}
</p>
<ul class="commentsdate">
<li>October 25th, 2006 at 6:56 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a href='http://None' rel='external nofollow'>Chris</a> Said&#8230;</dt>
<dd>
<p>Glad I have found this article, bookmarking for work =D</p>
<p>We plan on doing an entirely new website (hopefully I can get them to separate html/css/back-end) this time around as well as get some ajax in there to make life a bit easier!
</p>
<ul class="commentsdate">
<li>November 14th, 2006 at 7:41 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a href='http://markharrison.wordpress.com' rel='external nofollow'>Mark</a> Said&#8230;</dt>
<dd>
<p>Excellent. Thanks for this. </p>
<p>Been banging our heads against the proverbial Brick 2.0 Walls trying to work out why our Ajax looping updates don’t update in IE7.
</p>
<ul class="commentsdate">
<li>December 13th, 2006 at 1:42 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a href='http://www.ibas.org.uk/blog/' rel='external nofollow'>Gareth</a> Said&#8230;</dt>
<dd>
<p>That worked a treat.  </p>
<p>I’m still a bit annoyed that I have to do this for every request.  Such is the life we lead.
</p>
<ul class="commentsdate">
<li>December 18th, 2006 at 3:43 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a href='http://antiboredom.net' rel='external nofollow'>Gene</a> Said&#8230;</dt>
<dd>
<p>Wow, thank you VERY much. I’ve been having this problem for some time now. This little line “req.send(’var=1′);” really helped me out. Thanks VERY VERY much.
</p>
<ul class="commentsdate">
<li>December 20th, 2006 at 6:56 pm</li>
</ul>
</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/07/from-the-archives-ajax-ie-caching-issue-recap/feed/</wfw:commentRss>
		</item>
		<item>
		<title>From the Archives: Ajax IE Caching Issues</title>
		<link>http://mumrah.net/2008/07/from-the-archives-ajax-ie-caching-issues/</link>
		<comments>http://mumrah.net/2008/07/from-the-archives-ajax-ie-caching-issues/#comments</comments>
		<pubDate>Tue, 01 Jul 2008 22:59:56 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[archives]]></category>

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

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

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

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

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

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

		<guid isPermaLink="false">http://mumrah.net/?p=10</guid>
		<description><![CDATA[Author&#8217;s Note:
I wrote this article on January 13th, 2006. Clearly, a lot has been accomplished and discovered on the AJAX front. We now have &#8220;wonderful&#8221; frameworks and libraries that handle all of the connection stuff automatically, totally cross-browser. I&#8217;m reposting this for my own personal nostalgia, as well as to keep the link alive from [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Author&#8217;s Note:</strong><br />
I wrote this article on January 13th, 2006. Clearly, a lot has been accomplished and discovered on the AJAX front. We now have &#8220;wonderful&#8221; frameworks and libraries that handle all of the connection stuff automatically, totally cross-browser. I&#8217;m reposting this for my own personal nostalgia, as well as to keep the link alive from Ajaxian as well as other people&#8217;s blogs. Here is the <a href="http://ajaxian.com/archives/ajax-ie-caching-issue" onclick="javascript:pageTracker._trackPageview('/outbound/article/ajaxian.com');">Ajaxian article</a>. Feel free to continue giving me props in the comment thread.</p>
<p>-David</p>
<p><strong>Post:</strong><br />
If you’ve been working with the Ajax framework long enough, I’m sure you’ve run into at least a few speed bumps thanks to Internet Explorer. Not a day goes by that i don’t have to rewrite a line of code, or tweak my css in order for IE to render what i think it should. But alas, this is the nature of software that comes from a company that views Standard Compliances as recommendations.</p>
<p>So my latest headache arose while working a project at work. To avoid mudding up this article with frivolous details, i’ll just say that I was requesting a new image via xmlhttprequest given some user defined parameters. My problem was that if the url for the java servlet (e.g. ’servlet/imagemaker.jsp?foo=bar&amp;goo=car’) had been requested recently, IE presumed that it didn’t need to ask the server for that url again.</p>
<p>I tried setting the Last-Modified, Date, Cache-Control headers so that it shouldn’t cache anything. As expected, that didn’t fix it. I tried setting the If-Modified-Since header so it would think that the cache it had was outdated - no good. Finally, in an act of desperation, i disabled asynchronity in my xmlhttprequest, and to my dismay - it worked. I say that because i dont want to disable the most attractive part of the Ajax request - now none of my nice “loading…” animations would happen, as a matter of fact, anything i had put into the onReadyStateChange listener was merely executed after the transfer was complete. Ouch.</p>
<p>So i lived with it for a day. This morning i seeing if there was another way to initialize some funtions at the beginning of my transfer so i could re-enable my loading screen (and other background things). In doing so, i came across the Wikipedia article on Ajax (which i’d never read). So i scan through it, click a few links deep, and end up at the <a href="http://en.wikipedia.org/wiki/XMLHttpRequest" onclick="javascript:pageTracker._trackPageview('/outbound/article/en.wikipedia.org');">XMLHTTP</a> Wiki. While scanning this particular entry, i saw something that stopped my in my tracks - like an ADD kid seeing something shiny - the first thing in the “Known Issues” section:</p>
<blockquote><p>Microsoft Internet Explorer Cache issues</p></blockquote>
<p>Oh hotness. Within seconds i learn that IE thinks that GET requests are supposed to all be cached (for whatever asinine reason), and a simple fix is to change your request to the POST method. Giddy as a school girl, i rush into my code and update literally 2 lines, and viola! All better.</p>
<p>Moral of the story: Use the POST method in your Ajax transfer unless you need to use GET for some particular reason. Oh, and always read the Wiki first.</p>
<p><strong>Comment Thread:</strong></p>
<h3>61 People had this to say&#8230;</h3>
<dl>
<dt>Marc Said&#8230;</dt>
<dd>Just put and additional variable at the end of the querystring in the GET<br />
For example:<br />
servlet/imagemaker.jsp?foo=bar&amp;goo=car</p>
<p>Change to:<br />
’servlet/imagemaker.jsp?foo=bar&amp;goo=car&amp;time=111111111</p>
<p>Here is function to uncache the url:<br />
function uncache(url){<br />
var d = new Date();<br />
var time = d.getTime();</p>
<p>return url + ‘&amp;time=’+time;<br />
}</p>
<ul class="commentsdate">
<li>January 15th, 2006 at 12:59 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Rob Cluett Said&#8230;</dt>
<dd>You saved me 4 hours of banging my head against a wall and trashing prototype.js.   Thanks for posting this.  It was VERY helpful to me.</p>
<ul class="commentsdate">
<li>January 27th, 2006 at 5:20 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://yodayid.blogspot.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/yodayid.blogspot.com');">YodaYid</a> Said&#8230;</dt>
<dd>You saved my butt as well!  I was pretty much going to do exactly what you did - Cache-Control headers, etc.  And I doubt I would have ever thought of POST on my own.</p>
<p>Thanks!</p>
<p>–YY</p>
<ul class="commentsdate">
<li>February 10th, 2006 at 3:20 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Gailo Said&#8230;</dt>
<dd>Thannks a lot that saved me a lot of pain in the ass too !</p>
<p>Gailo</p>
<ul class="commentsdate">
<li>February 20th, 2006 at 3:53 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://weblog.patmullin.com/?p=46" onclick="javascript:pageTracker._trackPageview('/outbound/article/weblog.patmullin.com');">tricklin » Blog Archive » My First AJAX Experience</a> Said&#8230;</dt>
<dd>[…] What To Watch Out For Internet Explorer loves to cache everything. This is particularly a problem when you are using AJAX. What works well in Firefox, may not seem like it’s working in IE. I learned this the hard way. The application I implemented AJAX on is my personal online checkbook register. So the idea was to allow a user to stay on one page, add a new transaction, submit it, and have the list show the latest transaction while also changing the account balance all without refreshing the window. This worked great in Firefox, yet nothing seemed to be happening in IE. When in actuality, the database inserts were definitely happening, yet the list refresh was not happening. It took me a while to figure out what and why this was happening, but finally figured it out when I came across this article “Ajax IE caching issue“. It seems as though IE believes that GET requests (method=”get”) need to be cached, while POST requests are not. This meant changing all my requests from GETs to POSTs. Finding out how to do this took a bit of research as well, so I’m going to just give this to you here (if you already know how to do this, then feel free to ignore the following). The solution, as you’ll see is extremely simple (changes are marked in bold &amp; italic): Example GET request: […]</p>
<ul class="commentsdate">
<li>February 21st, 2006 at 4:12 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Allan Said&#8230;</dt>
<dd>Oh my Word!  This was such a headache for me.  This should be enblazend everywhere and pretyy much upfront at the prototype site.</p>
<p>geezus, what an incredible impact on time this issue must have in total for all those this impacts.</p>
<ul class="commentsdate">
<li>April 26th, 2006 at 7:37 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.markmaunder.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.markmaunder.com');">Mark M</a> Said&#8230;</dt>
<dd>Thanks - this just bit me and it’s 11:42pm so I’m totally not in the mood for IE’s cr*p.</p>
<ul class="commentsdate">
<li>May 4th, 2006 at 1:44 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://winportal.net" onclick="javascript:pageTracker._trackPageview('/outbound/article/winportal.net');">gLes</a> Said&#8230;</dt>
<dd>To my greatest dismay, even POST didn’t help me <img class="wp-smiley" src="http://www.enja.org/david/wp-images/smilies/icon_sad.gif" alt=":(" /></p>
<p>I’m using POST mixed with GET variables, so like I send a POST request with one POST variable and a couple of others in the URL…</p>
<p>I tried the response headers - no use…<br />
I tried random POST variables - nothing<br />
I tried random variables in the URL - like it wasn’t there</p>
<p>I tried setting If-Modified-Since request header - didn’t help</p>
<p>I’ve seemed to run out of ideas <img class="wp-smiley" src="http://www.enja.org/david/wp-images/smilies/icon_sad.gif" alt=":(" /></p>
<p>(I always cleared cache before trying)</p>
<p>Anyone?</p>
<ul class="commentsdate">
<li>May 16th, 2006 at 4:33 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.voxclara.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.voxclara.com');">Matthew</a> Said&#8230;</dt>
<dd>Thank you! Exacly what my headache was about.</p>
<ul class="commentsdate">
<li>May 19th, 2006 at 4:13 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Fozzy Said&#8230;</dt>
<dd>I tried this… as it turns out, you need to include a variable with the POST method for IE to actually not used a cached version.</p>
<p>http.open(’post’, ‘myfile.php’);<br />
http.setRequestHeader(’Content-Type’, ‘application/x-www-form-urlencoded’);</p>
<p>http.onreadystatechange = handleResponse;<br />
http.send(’var=1′); // a NULL or empty string value (&#8217;’) will cause IE to use a cache</p>
<ul class="commentsdate">
<li>May 21st, 2006 at 3:29 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.enja.org/david/?p=44" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.enja.org');">david » Blog Archive » Ajax IE caching issue - recap</a> Said&#8230;</dt>
<dd>[…] In light of the comments on the original post, i thought it would be nice to reiterate some other people’s workarounds. […]</p>
<ul class="commentsdate">
<li>May 22nd, 2006 at 7:50 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://winportal.net" onclick="javascript:pageTracker._trackPageview('/outbound/article/winportal.net');">gLes</a> Said&#8230;</dt>
<dd>No, this doesn’t work either, now mine looks something like this:</p>
<p>xmlhttp.open(”POST”, url + “&amp;random=” + Math.random(), true);<br />
xmlhttp.onreadystatechange = trigger;<br />
xmlhttp.setRequestHeader(”Content-Type”, “application/x-www-form-urlencoded;charset=iso-8859-2″);</p>
<p>xmlhttp.send(”ajax=1″);</p>
<p>But still no use in IE <img class="wp-smiley" src="http://www.enja.org/david/wp-images/smilies/icon_sad.gif" alt=":(" /></p>
<ul class="commentsdate">
<li>May 22nd, 2006 at 4:22 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://enja.org/david" onclick="javascript:pageTracker._trackPageview('/outbound/article/enja.org');">Administrator</a> Said&#8230;</dt>
<dd>gLes: try not setting the request header, also your problem could be on the server side. what are the specifics of your issue?</p>
<ul class="commentsdate">
<li>May 23rd, 2006 at 8:56 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://winportal.net" onclick="javascript:pageTracker._trackPageview('/outbound/article/winportal.net');">gLes</a> Said&#8230;</dt>
<dd>The request header has to be set, otherwise the POST variable is lost.</p>
<p>Meanwhile it began working, though I don’t remember doing anything quite different.</p>
<p>On the serverside I send these headers:</p>
<p>header(’Content-Type: text/html; charset=iso-8859-2′);</p>
<p>header(’Last-Modified: ‘.gmdate(’D, d M Y H:i:s’).’ GMT’);<br />
header(’Expires: Thu, 19 Nov 1981 08:52:00 GMT’);<br />
header(’Cache-Control: no-store, no-cache, must-revalidate’);</p>
<p>header(’Cache-Control: post-check=0, pre-check=0′, false);<br />
header(’Pragma: no-cache’);</p>
<p>(I wanted to make sure it goes well)</p>
<p>And as I wrote before I put a random variable in the URL.</p>
<p>Now I don’t know which one of these worked, but I don’t want to mess around with it anymore, as long as it works <img class="wp-smiley" src="http://www.enja.org/david/wp-images/smilies/icon_smile.gif" alt=":)" /></p>
<ul class="commentsdate">
<li>May 24th, 2006 at 11:13 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>Dan Said&#8230;</dt>
<dd>Holy crap… thanks you! I just spent two hours questioning my sanity as packet captures showed no request data at all, yet the status on every call was 200.  Who knows much more time I wouldn’t spent had I not come across this post.</p>
<p>F’n IE…</p>
<ul class="commentsdate">
<li>May 25th, 2006 at 9:15 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>franc Said&#8230;</dt>
<dd>but:</p>
<p><a rel="nofollow" href="http://www.cs.tut.fi/~jkorpela/forms/methods.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.cs.tut.fi');">http://www.cs.tut.fi/~jkorpela/forms/methods.html</a><br />
isnt it right though to cash the GETs?<br />
with GET you get things which never change?<br />
hm.</p>
<ul class="commentsdate">
<li>May 28th, 2006 at 6:23 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://enja.org/david" onclick="javascript:pageTracker._trackPageview('/outbound/article/enja.org');">Administrator</a> Said&#8230;</dt>
<dd>Franc: yes, traditionally browsers would be inclined to cache GET requests and not POSTS (http://www.cs.tut.fi/~jkorpela/forms/methods.html#why) But it is not inherit in the nature of a GET request to be cached.</p>
<ul class="commentsdate">
<li>May 28th, 2006 at 10:14 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.fiddlertool.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.fiddlertool.com');">EricLaw [MSFT]</a> Said&#8230;</dt>
<dd>Anyone got a repro page handy?  We’d like to fix this if it still repros in IE7.</p>
<ul class="commentsdate">
<li>June 2nd, 2006 at 1:45 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>Santhosh Said&#8230;</dt>
<dd>Thank you David &amp; Mark . I spend a couple of hours to reproduce this issue and finally figured out IE was caching my get request.  You made my day with the workaround</p>
<ul class="commentsdate">
<li>June 7th, 2006 at 6:49 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Candi González Said&#8230;</dt>
<dd>Thanks very much for the solution to that problem! Last week I had to suffer this problem and could not solve it until this morning, when I entered this blog! What a great week starting!!</p>
<ul class="commentsdate">
<li>June 12th, 2006 at 2:47 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>Dave Said&#8230;</dt>
<dd>I tried changing to “POST” from “GET” and it fixed my IE problem and at the same time broke it for FF.  I’m trying to get some XML via JavaScript.  Any ideas anyone?</p>
<ul class="commentsdate">
<li>June 19th, 2006 at 4:50 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>steve Said&#8230;</dt>
<dd>thanks mate for that… saved us loads of time!!!</p>
<ul class="commentsdate">
<li>June 20th, 2006 at 5:01 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>yulinxp Said&#8230;</dt>
<dd>Here is the solution for GET method.</p>
<p><a rel="nofollow" href="http://weblogs.asp.net/pleloup/archive/2006/06/08/451583.aspx?CommentPosted=true#commentmessage" onclick="javascript:pageTracker._trackPageview('/outbound/article/weblogs.asp.net');">http://weblogs.asp.net/pleloup/archive/2006/06/08/451583.aspx?CommentPosted=true#commentmessage</a></p>
<ul class="commentsdate">
<li>June 23rd, 2006 at 10:18 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://enja.org/david" onclick="javascript:pageTracker._trackPageview('/outbound/article/enja.org');">Administrator</a> Said&#8230;</dt>
<dd>yulinxp-</p>
<p>dually noted, however that solution has been covered.</p>
<p>see Mark’s comment above, which is also highlighted in the recap of this post: <a rel="nofollow" href="http://www.enja.org/david/?p=44" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.enja.org');">http://www.enja.org/david/?p=44</a></p>
<p>I should say that this is the workaround i use. I construct a timestamp string with the seconds and milliseconds.</p>
<ul class="commentsdate">
<li>June 23rd, 2006 at 10:27 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>Anonymous Said&#8230;</dt>
<dd>I used this and it works</p>
<p>function zlapSend(req) {<br />
//IE Cache work around<br />
var d = new Date();</p>
<p>var time = d.getTime();</p>
<p>if(req.indexOf(’?&#8217;)&gt;=0) {<br />
ser.open(’get’, req+’&amp;’+time+’=&#8217;+time);<br />
} else {</p>
<p>ser.open(’get’, req+’?&#8217;+time+’=&#8217;+time);<br />
}<br />
ser.onreadystatechange = zlapResponse;<br />
ser.send(null);<br />
}</p>
<ul class="commentsdate">
<li>June 24th, 2006 at 9:03 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.ferserious.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.ferserious.com');">Josh</a> Said&#8230;</dt>
<dd>I’ve been struggling with this all morning, this post was a God send.  Thanks!</p>
<ul class="commentsdate">
<li>June 29th, 2006 at 8:10 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www,rigadon.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www,rigadon.com');">Jay</a> Said&#8230;</dt>
<dd>Nice one - I’ve be banging my head on the desk over that one for some time!! Cheers for the heads-up…</p>
<ul class="commentsdate">
<li>July 5th, 2006 at 11:31 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>PWilly Said&#8230;</dt>
<dd>Oh god, you’ve satisfied my curiosity.  I found ways around with the currTime thing, but always NEEDED to know why.  Now I’m always using POST for the requests.<br />
ThankYouThankYouThankYouThankYou</p>
<ul class="commentsdate">
<li>July 19th, 2006 at 10:22 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>divi Said&#8230;</dt>
<dd>i love you thanks :*</p>
<ul class="commentsdate">
<li>July 23rd, 2006 at 2:42 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.johnlai.ca" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.johnlai.ca');">I am John</a> Said&#8230;</dt>
<dd>I found this article both humorous and helpful.  Thanks!</p>
<ul class="commentsdate">
<li>July 23rd, 2006 at 7:34 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Mark Said&#8230;</dt>
<dd>Dude, thanks for this. was looking for this ’simple’ fix and read though so many ’so called fixes’. your solution not only fixed my issue but made me smile!!</p>
<ul class="commentsdate">
<li>August 9th, 2006 at 2:25 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.jjcomputerconsulting.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.jjcomputerconsulting.com');">Warren</a> Said&#8230;</dt>
<dd>thank you very much!  this post was the first one I found in google after struggling with this issue for hours.  a witty and effective post.</p>
<ul class="commentsdate">
<li>August 17th, 2006 at 9:13 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.ulbricht.biz/blog/?p=6" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.ulbricht.biz');">Frank’s Blog » Blog Archive » Ajax: Internet Explorer Cache Problem</a> Said&#8230;</dt>
<dd>[…]  http://www.enja.org/david/?p=25 […]</p>
<ul class="commentsdate">
<li>September 5th, 2006 at 9:33 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.fallenrogue.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.fallenrogue.com');">fallenrogue</a> Said&#8230;</dt>
<dd>thank you. You just saved me reading the documentation. damn you IE!!!!</p>
<ul class="commentsdate">
<li>September 7th, 2006 at 9:35 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://ajaxian.com/archives/ajax-ie-caching-issue" onclick="javascript:pageTracker._trackPageview('/outbound/article/ajaxian.com');">Ajaxian » Ajax IE Caching Issue</a> Said&#8230;</dt>
<dd>[…] David Arthur, like many, has had problems with the caching issue that Internet Explorer seems to have with Ajax connections:   If you’ve been working with the Ajax framework long enough, i’m sure you’ve run into at least a few speed bumps thanks to Internet Explorer. Not a day goes by that i don’t have to rewrite a line of code, or tweak my css in order for IE to render what i think it should. But alas, this is the nature of software that comes from a company that views Standard Compliances as recommendations. […]</p>
<ul class="commentsdate">
<li>September 13th, 2006 at 8:25 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://mdm-adph.blogspot.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/mdm-adph.blogspot.com');">mdm-adph</a> Said&#8230;</dt>
<dd>Wow — nice to know that someone else other than me was having these same problems.  (Was pulling my hair out for weeks trying to figure out why IE was doing this lame-brained behavior.  Luckily, it wasn’t a big bug in my program, so I was able to space out my debugging.)</p>
<p>Weirdly enough, I only had this bug appear with <em>some</em> XML strings — I’ve never figured out the difference, though I think it has something to do with the platform I’m programming on (Lotus Domino).</p>
<p>Oh yeah — never thought about doing a POST instead of a GET — what worked for me was attaching a random variable to the end of the calling URL.</p>
<ul class="commentsdate">
<li>September 13th, 2006 at 8:32 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.jslibrary.org" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.jslibrary.org');">Mark Kahn</a> Said&#8230;</dt>
<dd>Just add a random querystring:</p>
<p>…(’somefile.php?a=5&amp;b=10&amp;r=’+Math.random())</p>
<p>IE no longer sees it as the same page.</p>
<ul class="commentsdate">
<li>September 13th, 2006 at 9:39 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://markos.gaivo.net/blog/" onclick="javascript:pageTracker._trackPageview('/outbound/article/markos.gaivo.net');">Marko</a> Said&#8230;</dt>
<dd>The asinine reason for caching is HTTP RFC, which clearly states that GET requests can be cached.</p>
<p>They don’t have to be, but browser is performing per spec if it does the caching.</p>
<ul class="commentsdate">
<li>September 13th, 2006 at 9:39 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://markus.fischer.name/" onclick="javascript:pageTracker._trackPageview('/outbound/article/markus.fischer.name');">Markus</a> Said&#8230;</dt>
<dd>Funny how I saved myself from the problem. From the first day I never ever considered using GET. Why? Simply, as we all know, GET requests are limited to, whatever I don’t know it exactly, amounts of characters. So since for Ajax I didn’t wanted to care about this I’ve always used post. And when I sent GET requests, which I almost only did for updating img src attributes (ok, this has nothing to do with ajax) I’m always using the “random file name”-principle: I request the file as <a rel="nofollow" href="http://server/controller/action/parameter/.png" onclick="javascript:pageTracker._trackPageview('/outbound/article/server');">http://server/controller/action/parameter/.png</a>. Always works.</p>
<ul class="commentsdate">
<li>September 13th, 2006 at 11:55 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>Mario Said&#8230;</dt>
<dd>This problem has nothing to do with Prototype.</p>
<ul class="commentsdate">
<li>September 13th, 2006 at 1:13 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.thesamet.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.thesamet.com');">Nadav</a> Said&#8230;</dt>
<dd>I prefer to set the headers right. It works nice both with GET and POST request and it is tested with IE and Firefox.</p>
<p>I explained once <a rel="nofollow" href="http://www.thesamet.com/blog/2006/07/14/making-ie-cache-less/"><br />
in my blog</a> how to do set the headers correctly using CherryPy/TurboGears.</p>
<p>The basic thing is to set the headers right:</p>
<p>Expires: Sun, 19 Nov 1978 05:00:00 GMT<br />
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0<br />
Pragma: no-cache</p>
<ul class="commentsdate">
<li>September 13th, 2006 at 1:28 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.nitinpai.wordpress.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.nitinpai.wordpress.com');">NitinPai</a> Said&#8230;</dt>
<dd>Wow! That was an amazing experience David and its even more pleasure that your have shared it with all the developers.</p>
<p>It never crossed my mind about that GET or POST could cook up such an issue. But its very nice to known that complex problems can have the simplest of solutions</p>
<ul class="commentsdate">
<li>September 14th, 2006 at 12:26 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>Daniel Chacón Sánchez Said&#8230;</dt>
<dd>In my case the solution was include this on my jsp:</p>
<p>Hope it helps, java programmers. Regards</p>
<ul class="commentsdate">
<li>September 21st, 2006 at 7:54 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Zeev Halevi Said&#8230;</dt>
<dd>Thanks, I almost gave up using prototype because of different behavior with FF and IE.<br />
Added to Ajax.Updater :</p>
<p>var d = new Date();<br />
var time = d.getTime();<br />
if (url.indexOf(’?&#8217;) &gt; 0)<br />
url = url+’&amp;prevent_cache=’+time;</p>
<p>else<br />
url = url+’?prevent_cache=’+time;</p>
<p>just before: this.request(url);</p>
<p>And now I am happy…</p>
<ul class="commentsdate">
<li>September 25th, 2006 at 1:37 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.track-issue.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.track-issue.com');">Raman</a> Said&#8230;</dt>
<dd>thanks Zeev Halevi. Its all nice that you have been able to do it. But can you explain how to use prevent_cache and what to do with that</p>
<p><strong>url = url+’&amp;prevent_cache=’+time; </strong></p>
<p>Any idea?</p>
<ul class="commentsdate">
<li>September 30th, 2006 at 10:08 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>linhph Said&#8230;</dt>
<dd>oops, thanks so much, I met that goddamned problem for the whole morning <img class="wp-smiley" src="http://www.enja.org/david/wp-images/smilies/icon_neutral.gif" alt=":|" /> , thankss</p>
<ul class="commentsdate">
<li>October 7th, 2006 at 11:29 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.motorpics.co.za" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.motorpics.co.za');">fortran rules</a> Said&#8230;</dt>
<dd>The single most useful tip I have encountered … ever.</p>
<ul class="commentsdate">
<li>October 12th, 2006 at 4:41 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>joren Said&#8230;</dt>
<dd>yes i am as most of you, having the problem that IE caching the data, now using the POST solves my problem, and headache of couple of weeks <img class="wp-smiley" src="http://www.enja.org/david/wp-images/smilies/icon_smile.gif" alt=":)" /></p>
<p>gracias</p>
<ul class="commentsdate">
<li>October 22nd, 2006 at 3:49 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>mike whn Said&#8230;</dt>
<dd>I am an ajax beginner,<br />
do you guys ever had problem like me?</p>
<p>I changed from POST to GET, but the Request still consider as POST.</p>
<p>I already refreshed the browser and restart the server, still give me the same problem.</p>
<p>This is what I changed:<br />
xmlHttpReq.open(’GET’, strURL, true);</p>
<p>This is the HTTP header:</p>
<p>POST /springapp/AjaxService HTTP/1.1<br />
Accept: */*<br />
Accept-Language: en-us<br />
Referer: <a rel="nofollow" href="http://localhost:9080/springapp/ajax1.html" onclick="javascript:pageTracker._trackPageview('/outbound/article/localhost:9080');">http://localhost:9080/springapp/ajax1.html</a><br />
Content-Type: application/x-www-form-urlencoded<br />
Accept-Encoding: gzip, deflate</p>
<p>User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)<br />
Host: localhost:9080<br />
Content-Length: 45419<br />
Connection: Keep-Alive<br />
Cache-Control: no-cache<br />
Cookie: CP=null*</p>
<p>a=1112&amp;w=hello</p>
<ul class="commentsdate">
<li>October 27th, 2006 at 1:05 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Ian Said&#8230;</dt>
<dd>Marko said:</p>
<blockquote><p>The asinine reason for caching is HTTP RFC, which clearly states that GET requests can be cached.</p></blockquote>
<p>Hmmm, here is what HTTP/1.1 RFC2616 says:</p>
<blockquote><p>Unless the origin server explicitly prohibits the caching of their responses, the application of GET and HEAD methods to any resources SHOULD NOT have side effects that would lead to erroneous behavior if these responses are taken from a cache. They MAY still have side effects, but a cache is not required to consider such side effects in its caching decisions. Caches are always expected to observe an origin server’s explicit restrictions on caching.</p>
<p>We note one exception to this rule: since some applications have traditionally used GETs and HEADs with query URLs (those containing a “?” in the rel_path part) to perform operations with significant side effects, caches MUST NOT treat responses to such URIs as fresh unless the server provides an explicit expiration time. This specifically means that responses from HTTP/1.0 servers for such URIs SHOULD NOT be taken from a cache. See section 9.1.1 for related information.”</p></blockquote>
<p>As I understand that, GETs with QUERY URLs, unless exlicity cacheable, must not be cached…</p>
<p><a rel="nofollow" href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec13.html#sec13.9" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.w3.org');">RFC 2616 Sec 13.9</a></p>
<ul class="commentsdate">
<li>October 30th, 2006 at 11:29 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.vedsa.com.br" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.vedsa.com.br');">Fábio Vedovelli</a> Said&#8230;</dt>
<dd>PORTUGUESE</p>
<p>Encontrei uma solução inserindo o código</p>
<p>req.setRequestHeader(’Content-Type’, ‘application/x-www-form-urlencoded’);</p>
<p>inclusive quando usando o método GET. Funcionou para me livrar do cache do Internet Explorer. O método descrito, usando getTime() não funcionou para mim.</p>
<p>ENGLISH</p>
<p>Found a solution inserting</p>
<p>req.setRequestHeader(’Content-Type’, ‘application/x-www-form-urlencoded’);</p>
<p>even when using GET method. Worked fine to workaround with the IR cache problem. The method described in this post did not work for me.</p>
<p>Thanks!</p>
<ul class="commentsdate">
<li>November 11th, 2006 at 4:31 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Westy Said&#8230;</dt>
<dd>Thank you for saving me so much pain!  I ran into the issues, suspected a caching issue and found this article straight away!  Entire process took 10 minutes thanks to you… otherwise it would have been hell.</p>
<p>Thanks!</p>
<ul class="commentsdate">
<li>November 14th, 2006 at 2:23 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.in4matrix.co.uk" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.in4matrix.co.uk');">Sanjay</a> Said&#8230;</dt>
<dd>Awesome find dude, have saved me a whole bunch of time, nice one!!!</p>
<ul class="commentsdate">
<li>November 15th, 2006 at 4:41 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>benimaur Said&#8230;</dt>
<dd>Much thanks! I was almost going to give up AJAX in my application…</p>
<ul class="commentsdate">
<li>November 28th, 2006 at 5:42 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://hebiryu.wordpress.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/hebiryu.wordpress.com');">hebiryu</a> Said&#8230;</dt>
<dd>thank you  sooooo much david.<br />
you saved my life.</p>
<p>may I use your tips in my blog. i will translate it into indonesian.</p>
<p>thanx again.</p>
<ul class="commentsdate">
<li>January 5th, 2007 at 9:52 am</li>
</ul>
</dd>
</dl>
<dl>
<dt>Anonymous Said&#8230;</dt>
<dd>thank you!<br />
it works nicely now!!!!!!!!</p>
<p>really thanks a lot!!!</p>
<ul class="commentsdate">
<li>January 10th, 2007 at 12:18 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://internetmarketingagents.com" onclick="javascript:pageTracker._trackPageview('/outbound/article/internetmarketingagents.com');">Kartik</a> Said&#8230;</dt>
<dd>THX THX THX…. lots of thx man…. !!! <img class="wp-smiley" src="http://www.enja.org/david/wp-images/smilies/icon_smile.gif" alt=":)" /></p>
<ul class="commentsdate">
<li>January 20th, 2007 at 7:57 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.fortrel.net/blog/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.fortrel.net');">Alexandre Lemieux</a> Said&#8230;</dt>
<dd>You saved my life! Thanks!</p>
<ul class="commentsdate">
<li>January 26th, 2007 at 11:11 am</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.serein.co.uk" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.serein.co.uk');">Huw</a> Said&#8230;</dt>
<dd>*punches the air with joy*</p>
<ul class="commentsdate">
<li>January 29th, 2007 at 1:32 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt><a rel="external nofollow" href="http://www.rentageekme.com/" onclick="javascript:pageTracker._trackPageview('/outbound/article/www.rentageekme.com');">Mike</a> Said&#8230;</dt>
<dd>Thank you!!</p>
<ul class="commentsdate">
<li>February 14th, 2007 at 1:52 pm</li>
</ul>
</dd>
</dl>
<dl>
<dt>Graham Said&#8230;</dt>
<dd>You are da man. Massive props for this.</p>
<ul class="commentsdate">
<li>February 27th, 2007 at 5:21 am</li>
</ul>
</dd>
</dl>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/07/from-the-archives-ajax-ie-caching-issues/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Export an ADO Recordset as CSV or XML</title>
		<link>http://mumrah.net/2008/06/export-an-ado-recordset-as-csv-or-xml/</link>
		<comments>http://mumrah.net/2008/06/export-an-ado-recordset-as-csv-or-xml/#comments</comments>
		<pubDate>Fri, 27 Jun 2008 13:27:23 +0000</pubDate>
		<dc:creator>david</dc:creator>
		
		<category><![CDATA[Access Nightmares]]></category>

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

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

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

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

		<guid isPermaLink="false">http://mumrah.net/?p=9</guid>
		<description><![CDATA[In lieu of my typical witty banter I&#8217;m just going to post some code. Way too tired to put any effort forth.
Tried for days to get Access to export my ADO Recordset as something, anything. I tired:

Loading it into a table - nope
Making a temporary table on the database server and linking to it - [...]]]></description>
			<content:encoded><![CDATA[<p>In lieu of my typical witty banter I&#8217;m just going to post some code. Way too tired to put any effort forth.</p>
<p>Tried for days to get Access to export my ADO Recordset as something, <em>anything</em>. I tired:</p>
<ul>
<li>Loading it into a table - nope</li>
<li>Making a temporary table on the database server and linking to it - nope</li>
<li>Tried using getRows and manually creating a CSV - nope</li>
<li>Conjured up the ancient spirits of BASIC - nope</li>
</ul>
<p>I mean really. And the internet was of course no help. Turns out there&#8217;s a few built-ins that do the trick - go figure.</p>
<p><strong>Problem:</strong> Need to export the data&#8230; why oh, why can&#8217;t I export the data</p>
<p><strong>XML Solution:</strong></p>
<blockquote><p><code>Dim ADOrs As ADODB.Recordset<br />
Set ADOrs = Me.RecordsetClone<br />
ADOrs.Save "export.xml", adPersistXML<br />
ADOrs.Close</code></p></blockquote>
<p>Shoot me in the face that was easy.</p>
<p><strong>CSV Solution:</strong></p>
<blockquote><p><code>Dim ADOrs As ADODB.Recordset<br />
Set ADOrs = Me.RecordsetClone</code></p>
<p><code>Dim csv As String<br />
csv = ADOrs.GetString(, , """,""", """" _<br />
&nbsp;&nbsp;&amp; vbCrLf &amp; """", "")<br />
csv = Left$(csv , Len(csv) - 1)</code></p>
<p><code>Dim h As String ' Header row<br />
For X = 1 To ADOrs.fields.Count - 1<br />
&nbsp;&nbsp;h = h &amp; """" &amp; ADOrs.fields(X).Name &amp; """"<br />
&nbsp;&nbsp;If X &lt; ADOrs.fields.Count - 1 Then<br />
&nbsp;&nbsp;&nbsp;&nbsp;h = h &amp; ","<br />
&nbsp;&nbsp;End If<br />
Next X<br />
Open "export.csv" For Output As #1<br />
Print #1, h<br />
Print #1, """", csv<br />
Close 1</code></p></blockquote>
<p>Edit: An interesting note about the ADO Recordset XML export. It uses a special namespace (actually a few). It&#8217;s readable enough, and just as easily parsible as any other XML document. A nice feature about this XML spec is that you can load it back into Access as an ADO recordset - so in theory this could be used for long-term caching of large chunks of data.</p>
]]></content:encoded>
			<wfw:commentRss>http://mumrah.net/2008/06/export-an-ado-recordset-as-csv-or-xml/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
