<?xml version="1.0"?>
<rss version="2.0">
<channel>
  <title>waelchatila.com - Windows category</title>
  <link>http://waelchatila.com:80/categories/windows/</link>
  <description>Notes on Software, Engineering and Science</description>
  <language>en</language>
  <copyright>Wael Chatila</copyright>
  <lastBuildDate>Fri, 23 May 2008 05:27:00 GMT</lastBuildDate>
  <generator>Pebble (http://pebble.sourceforge.net)</generator>
  <docs>http://backend.userland.com/rss</docs>
  
  
  <item>
    <title>Internet Explorer 6 &amp; 7 document.domain bug</title>
    <link>http://waelchatila.com:80/2007/10/31/1193851500000.html</link>
    
      
        <description>
          &lt;b&gt;Disclaimer:&lt;/b&gt; Im not sure this a bug discovery...couldn&#039;t find anything that resembled it after a couple of minutes of googling, or a super silly security restriction.
&lt;p&gt;
I&#039;ve been coding some javascript ajax code that inserts an iframe, and into the created iframe, inserts a form and submits the form to a (cross domain) server. This is an old cross-domain ajax technique by now, but while implementing it I came across this ridiculously annoying bug in IE. The line in red below will result in an &#034;Access Denied&#034; exception being thrown...again, only in IE. Tried this with IE6 under WinXP Media Center Edition SP2, IE7 under WinXP Home Edition SP2, and IE7 Windows Vista Home. Needless to say...it works just fine in FireFox.

&lt;div class=&#034;codeSample&#034;&gt;
&amp;lt;script type=&#034;text/javascript&#034;&amp;gt;
  document.domain = &#039;waelchatila.com&#039;;
  var new_html = &#039;&amp;lt;iframe id=&#034;frm&#034; name=&#034;frm&#034; src=&#034;http://waelchatila.com&#034;&amp;gt;&amp;lt;/iframe&amp;gt;&#039;;
  document.body.innerHTML+=new_html;
  try {
    var iframe_doc = &lt;font color=&#034;red&#034;&gt;document.getElementById(&#034;frm&#034;).contentWindow.document;&lt;/font&gt;
  } catch (e) {
    alert(e);
  }
&amp;lt;/script&amp;gt;
&lt;/div&gt;
&lt;div id=&#034;frm1&#034;&gt;&lt;/div&gt;
&lt;script type=&#034;text/javascript&#034;&gt;
function insertIframe() {
        document.domain = &#039;waelchatila.com&#039;;
            var new_html = &#039;&lt;iframe id=&#034;frm&#034; name=&#034;frm&#034; src=&#034;http://waelchatila.com&#034;&gt;&lt;/iframe&gt;&#039;;
            document.getElementById(&#039;frm1&#039;).innerHTML+=new_html;
var bError = false;
try {
 var iframe_doc = document.getElementById(&#034;frm&#034;).contentWindow.document;
} catch (e) {
   bError = true;
}
alert(bError?&#034;Exception thrown&#034;:&#034;No exceptions thrown&#034;);
}
    &lt;/script&gt;


Try it by clicking the button below. &lt;p&gt;
&lt;button onclick=&#034;insertIframe();return false;&#034;&gt;Try it!&lt;/button&gt;
&lt;p&gt;
This page should be served off &lt;i&gt;http://waelchatila.com&lt;/i&gt;. As you can see, the document.domain is explicitly set to the domain the page was served from. The iframe src is also from the same server. I&#039;ve tried it with a whole variety of variations, none of the demonstrated here but tested for.
&lt;ul&gt;
&lt;li&gt;iframe&#039;s document.domain = &#039;waelchatila.com&#039;;&lt;/li&gt;
&lt;li&gt;iframe src is empty&lt;/li&gt;
&lt;li&gt;iframe src is &#034;javascript:false&#034;&lt;/li&gt;
&lt;/ul&gt;
There should be no problem accessing the iframe&#039;s content in either case. 
&lt;p&gt;Now, if the &lt;i&gt;document.domain = &#039;waelchatila.com&#039;;&lt;/i&gt; line is removed, it works. In order for this to work, you&#039;ll need to reload this page if you clicked the previous button since document.domain has now already been assigned.

&lt;p&gt;
&lt;div id=&#034;frm2&#034;&gt;&lt;/div&gt;
&lt;script type=&#034;text/javascript&#034;&gt;
function insertIframe2() {
            var new_html = &#039;&lt;iframe id=&#034;frm&#034; name=&#034;frm&#034; src=&#034;http://waelchatila.com&#034;&gt;&lt;/iframe&gt;&#039;;
            document.getElementById(&#039;frm2&#039;).innerHTML+=new_html;
var bError = false;
try {
 var iframe_doc = document.getElementById(&#034;frm&#034;).contentWindow.document;
} catch (e) {
   bError = true;
}
alert(bError?&#034;Exception thrown&#034;:&#034;No exceptions thrown&#034;);
}
    &lt;/script&gt;


&lt;button onclick=&#034;insertIframe2();return false;&#034;&gt;Try it!&lt;/button&gt;
&lt;p&gt;
The same results present itself if the iframe is created with &lt;i&gt;document.createElement(&#039;iframe&#039;)&lt;/i&gt; and &lt;i&gt;document.appendChild(...)&lt;/i&gt;
&lt;p&gt;
I&#039;ve yet to find a workaround for this issue. I&#039;ll be positing another entry if I found out how. Please let me know if you know of one!
        </description>
      
      
    
    
    
    <category>AJAX</category>
    
    <category>Windows</category>
    
    <category>Web</category>
    
    <comments>http://waelchatila.com:80/2007/10/31/1193851500000.html#comments</comments>
    <guid isPermaLink="true">http://waelchatila.com:80/2007/10/31/1193851500000.html</guid>
    <pubDate>Wed, 31 Oct 2007 17:25:00 GMT</pubDate>
  </item>
  
  <item>
    <title>How to move a subversion repository to another server</title>
    <link>http://waelchatila.com:80/2007/03/06/1173223980000.html</link>
    
      
        <description>
          My closet server died last night. No big deal it was over ten years old and was running at 233MHz...besides it was my wife&#039;s old computer hehe. My friend Imran gave me one of his old work machines and I&#039;ve been moving stuff over. Since I had a svn repository on the old machine the situation presented itself with a problem to move the whole repository. Luckily the good people behind svn have thought about this and provide out-of-the box commands to do this. &lt;p/&gt;On the old server machine do.
&lt;div class=&#034;codeSample&#034;&gt;
svnadmin dump &lt;i&gt;repositoryPath&lt;/i&gt; &amp;gt; repository.dumpfile&lt;br&gt;
&lt;/div&gt;

File transfer the &lt;i&gt;repository.dumpfile&lt;/i&gt; file to the new server machine and over there do

&lt;div class=&#034;codeSample&#034;&gt;
cd /path/to/new-repository-parent-directory&lt;br&gt;
svnadmin create &lt;i&gt;repository-name&lt;/i&gt;&lt;br&gt;
svnadmin load &lt;i&gt;repository-name&lt;/i&gt; &lt; repository.dumpfile&lt;br&gt;
&lt;/div&gt;

Then on your client type 
&lt;div class=&#034;codeSample&#034;&gt;
svn switch --relocate &lt;i&gt;oldurl&lt;/i&gt; &lt;i&gt;newurl&lt;/i&gt;
&lt;/div&gt;
        </description>
      
      
    
    
    
    <category>Unix/Linux</category>
    
    <category>Windows</category>
    
    <comments>http://waelchatila.com:80/2007/03/06/1173223980000.html#comments</comments>
    <guid isPermaLink="true">http://waelchatila.com:80/2007/03/06/1173223980000.html</guid>
    <pubDate>Tue, 06 Mar 2007 23:33:00 GMT</pubDate>
  </item>
  
  <item>
    <title>Browsing JAR and WAR files like ZIP files in Windows</title>
    <link>http://waelchatila.com:80/2005/08/04/1123191721537.html</link>
    
      
        <description>
          In Windows XP you can browse ZIP files as if they were folders. To do the same with JAR (or WAR) files simple:

&lt;ul&gt;
&lt;li&gt; Uninstall winzip if it&#039;s installed.
&lt;li&gt; In the Registry editor, copy the entire \\HKEY_CLASSES_ROOT\.zip registry entry to \\HKEY_CLASSES_ROOT\.jar. The easiest way to do this is to export the .zip key, edit the .reg file in notepad, and re-import.
&lt;/ul&gt;

        </description>
      
      
    
    
    
    <category>Java</category>
    
    <category>Windows</category>
    
    <comments>http://waelchatila.com:80/2005/08/04/1123191721537.html#comments</comments>
    <guid isPermaLink="true">http://waelchatila.com:80/2005/08/04/1123191721537.html</guid>
    <pubDate>Thu, 04 Aug 2005 21:42:01 GMT</pubDate>
  </item>
  
  </channel>
</rss>
