<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2enclosuresfull.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:sy="http://purl.org/rss/1.0/modules/syndication/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:media="http://search.yahoo.com/mrss/" xmlns:itunes="http://www.itunes.com/dtds/podcast-1.0.dtd" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Coding techniques and tips</title>
	
	<link>http://codeheaven.org</link>
	<description>heaven for professional programmers</description>
	<lastBuildDate>Fri, 12 Oct 2012 22:47:14 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.4.2</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Codeheavenorg" /><feedburner:info uri="codeheavenorg" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><itunes:explicit>no</itunes:explicit><itunes:subtitle>heaven for professional programmers</itunes:subtitle><feedburner:browserFriendly></feedburner:browserFriendly><item>
		<title>APK MIME Type</title>
		<link>http://codeheaven.org/apk-mime-type.html</link>
		<comments>http://codeheaven.org/apk-mime-type.html#comments</comments>
		<pubDate>Thu, 11 Oct 2012 05:01:25 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Android]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[apk]]></category>
		<category><![CDATA[apk mime type]]></category>
		<category><![CDATA[mime-type]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=526</guid>
		<description><![CDATA[I have a web application of asp.net hosted on iis 7.5. From my server i need my clients to download the android apk, so they can pull them up on the Android browser to download and install them. I quickly ran into a 404 and realized I hadn&#8217;t added the APK MIME type to IIS [...]]]></description>
			<content:encoded><![CDATA[<p>I have a web application of <strong>asp.net</strong> hosted on <strong>iis 7.5</strong>. From my server i need my clients to download the android apk, so they can pull them up on the Android browser to download and install them. I quickly ran into a 404 and realized I hadn&#8217;t added the <strong>APK MIME type</strong> to IIS (7.5). This is what I added:</p>
<p>File name extension: <span style="text-decoration: underline;">.apk</span><br />
MIME type:<span style="text-decoration: underline;"> application/vnd.android.package-archive</span></p>
<h6></h6>
<p><img class="alignleft size-full wp-image-529" title="iis-apk" src="http://codeheaven.org/wp-content/uploads/2012/10/iis-apk.jpg" alt="" width="306" height="175" /></p>
<p>&nbsp;</p>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/apk-mime-type.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/apk-mime-type.html&text=APK MIME Type" target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/apk-mime-type.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Uncheck/check all checkbox on a form using javascript</title>
		<link>http://codeheaven.org/uncheckcheck-all-checkbox-on-a-form-using-javascript.html</link>
		<comments>http://codeheaven.org/uncheckcheck-all-checkbox-on-a-form-using-javascript.html#comments</comments>
		<pubDate>Tue, 11 Sep 2012 07:58:35 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java Script]]></category>
		<category><![CDATA[check Checkboxes]]></category>
		<category><![CDATA[checkbox]]></category>
		<category><![CDATA[checkboxes]]></category>
		<category><![CDATA[uncheck Checkboxes]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=442</guid>
		<description><![CDATA[To use the following javascript function, you can check or uncheck all checkboxes in your form. function CheckUncheckAll(isChecked){ var w = document.getElementsByTagName('input'); for(var i = 0; i &#60; w.length; i++){ if(w[i].type=='checkbox'){ w[i].checked = isChecked; } } }]]></description>
			<content:encoded><![CDATA[<p>To use the following javascript function, you can check or uncheck all checkboxes in your form.</p>
<pre class="wp-code-highlight prettyprint">
function CheckUncheckAll(isChecked){ 
      var w = document.getElementsByTagName('input'); 
      for(var i = 0; i &lt; w.length; i++){ 
        if(w[i].type=='checkbox'){ 
          w[i].checked = isChecked; 
        }
      }
  } 
</pre>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/uncheckcheck-all-checkbox-on-a-form-using-javascript.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/uncheckcheck-all-checkbox-on-a-form-using-javascript.html&text=Uncheck/check all checkbox on a form using javascript" target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/uncheckcheck-all-checkbox-on-a-form-using-javascript.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How do I get the value after hash (#) from a URL using javascript</title>
		<link>http://codeheaven.org/how-do-i-get-the-value-after-hash-from-a-url-using-javascript.html</link>
		<comments>http://codeheaven.org/how-do-i-get-the-value-after-hash-from-a-url-using-javascript.html#comments</comments>
		<pubDate>Mon, 10 Sep 2012 20:17:12 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java Script]]></category>
		<category><![CDATA[hash value of url]]></category>
		<category><![CDATA[hash-value]]></category>
		<category><![CDATA[hash-value-from-url]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[url]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=440</guid>
		<description><![CDATA[var url ='www.site.com/index.php#hello'; var type = url.split('#'); var hash = ''; if(type.length &#62; 1) hash = type[1]; alert(hash); Another simple technique is.. var type = window.location.hash.substr(1);]]></description>
			<content:encoded><![CDATA[<pre class="wp-code-highlight prettyprint">
var url ='www.site.com/index.php#hello';
var type = url.split('#');
var hash = '';
if(type.length &gt; 1)
  hash = type[1];
alert(hash);

</pre>
<p>Another simple technique is..</p>
<pre class="wp-code-highlight prettyprint">
var type = window.location.hash.substr(1);
</pre>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/how-do-i-get-the-value-after-hash-from-a-url-using-javascript.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/how-do-i-get-the-value-after-hash-from-a-url-using-javascript.html&text=How do I get the value after hash (#) from a URL using javascript" target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/how-do-i-get-the-value-after-hash-from-a-url-using-javascript.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>how to delete all files from specific folder?</title>
		<link>http://codeheaven.org/how-to-delete-all-files-from-specific-folder.html</link>
		<comments>http://codeheaven.org/how-to-delete-all-files-from-specific-folder.html#comments</comments>
		<pubDate>Mon, 10 Sep 2012 19:55:19 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[Directory]]></category>
		<category><![CDATA[File.Delete]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=436</guid>
		<description><![CDATA[add namespace using System.IO; and use the Directory class to reach on the specific folder string[] fileNames = Directory.GetFiles(@&#34;your directory path&#34;); foreach (string fileName in fileNames) File.Delete(fileName);]]></description>
			<content:encoded><![CDATA[<p>add namespace</p>
<pre class="wp-code-highlight prettyprint">
using System.IO;
</pre>
<p>and use the Directory class to reach on the specific folder</p>
<pre class="wp-code-highlight prettyprint">
string[] fileNames = Directory.GetFiles(@&quot;your directory path&quot;);
foreach (string fileName in fileNames)
    File.Delete(fileName);
</pre>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/how-to-delete-all-files-from-specific-folder.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/how-to-delete-all-files-from-specific-folder.html&text=how to delete all files from specific folder?" target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/how-to-delete-all-files-from-specific-folder.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>html5 doctype</title>
		<link>http://codeheaven.org/html5-doctype.html</link>
		<comments>http://codeheaven.org/html5-doctype.html#comments</comments>
		<pubDate>Mon, 16 Jul 2012 07:24:44 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[HTML5]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[html5]]></category>
		<category><![CDATA[html5-doctype]]></category>
		<category><![CDATA[standards-compliant-mode]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=431</guid>
		<description><![CDATA[the html5 doctype is: &#60;!DOCTYPE html&#62; When you use the new HTML5 DOCTYPE, it triggers browsers to render the page in standards compliant mode. Standards-compliant mode In standards-compliant mode, the web browser assumes the page has been authored to the web content specification declared; code that does not conform to the declared standard may not [...]]]></description>
			<content:encoded><![CDATA[<p>the html5 doctype is:</p>
<pre class="wp-code-highlight prettyprint">&lt;!DOCTYPE html&gt;</pre>
<p>When you use the new <strong>HTML5 DOCTYPE</strong>, it triggers browsers to render the page in <strong>standards compliant mode</strong>.</p>
<p><strong>Standards-compliant mode</strong></p>
<ul>
<li>In standards-compliant mode, the web browser assumes the page has been authored to the web content specification declared; code that does not conform to the declared standard may not display, or may display incorrectly.</li>
<li>For a web browser’s standards-compliant mode to be triggered, the webpage must have a complete document type declaration, including the URI to the document type definition (DTD).</li>
<li>There is typically less variation in webpage display between different browsers when standards-compliant mode is triggered, as the same centralised W3C specification is used as a reference when creating the web browser software.</li>
</ul>
<p>&nbsp;</p>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/html5-doctype.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/html5-doctype.html&text=html5 doctype" target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/html5-doctype.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Dynamically load css and js files using JavaScript</title>
		<link>http://codeheaven.org/dynamically-load-css-and-js-files-using-javascriptjquery.html</link>
		<comments>http://codeheaven.org/dynamically-load-css-and-js-files-using-javascriptjquery.html#comments</comments>
		<pubDate>Thu, 12 Apr 2012 09:37:17 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Java Script]]></category>
		<category><![CDATA[Jquery]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[dynamically load css]]></category>
		<category><![CDATA[dynamically load js]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[js]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=419</guid>
		<description><![CDATA[function loadjscssfile(filename, filetype) { if (filetype == &#34;js&#34;) { //if filename is a external JavaScript file // alert('called'); var fileref = document.createElement('script') fileref.setAttribute(&#34;type&#34;, &#34;text/javascript&#34;) fileref.setAttribute(&#34;src&#34;, filename) alert('called'); } else if (filetype == &#34;css&#34;) { //if filename is an external CSS file var fileref = document.createElement(&#34;link&#34;) fileref.setAttribute(&#34;rel&#34;, &#34;stylesheet&#34;) fileref.setAttribute(&#34;type&#34;, &#34;text/css&#34;) fileref.setAttribute(&#34;href&#34;, filename) } if (typeof fileref [...]]]></description>
			<content:encoded><![CDATA[<pre class="wp-code-highlight prettyprint">function loadjscssfile(filename, filetype) {
            if (filetype == &quot;js&quot;) { //if filename is a external JavaScript file
               // alert('called');
                var fileref = document.createElement('script')
                fileref.setAttribute(&quot;type&quot;, &quot;text/javascript&quot;)
                fileref.setAttribute(&quot;src&quot;, filename)
                alert('called');
            }
            else if (filetype == &quot;css&quot;) { //if filename is an external CSS file
                var fileref = document.createElement(&quot;link&quot;)
                fileref.setAttribute(&quot;rel&quot;, &quot;stylesheet&quot;)
                fileref.setAttribute(&quot;type&quot;, &quot;text/css&quot;)
                fileref.setAttribute(&quot;href&quot;, filename)
            }
            if (typeof fileref != &quot;undefined&quot;)
                document.getElementsByTagName(&quot;head&quot;)[0].appendChild(fileref)
        }</pre>
<p>Call this javascript function to dynamically load the css and js file. Pass the complete file path with name in &#8216;filename&#8217; argument.</p>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/dynamically-load-css-and-js-files-using-javascriptjquery.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/dynamically-load-css-and-js-files-using-javascriptjquery.html&text=Dynamically load css and js files using JavaScript" target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/dynamically-load-css-and-js-files-using-javascriptjquery.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Bring custom window form on top of setup project window</title>
		<link>http://codeheaven.org/bring-custom-window-form-on-top-of-setup-project-window.html</link>
		<comments>http://codeheaven.org/bring-custom-window-form-on-top-of-setup-project-window.html#comments</comments>
		<pubDate>Mon, 09 Apr 2012 09:55:13 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[.net-setup]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[dot net]]></category>
		<category><![CDATA[dot-net-setup-project]]></category>
		<category><![CDATA[installer]]></category>
		<category><![CDATA[msi]]></category>
		<category><![CDATA[visual-studio]]></category>
		<category><![CDATA[visual-studio-setup-project]]></category>
		<category><![CDATA[visual-studio2010]]></category>
		<category><![CDATA[window form]]></category>
		<category><![CDATA[window-forms]]></category>
		<category><![CDATA[winforms]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=411</guid>
		<description><![CDATA[Recently i faced a problem while creating visual studio setup project with custom form, so, i would like to share it with solution. Problem: I have an application that is being deployed via a Visual Studio Setup Project, however, I had to create some custom Windows Forms to collect some specific data from the user. [...]]]></description>
			<content:encoded><![CDATA[<p>Recently i faced a problem while creating visual studio setup project with custom form, so, i would like to share it with solution.</p>
<h2>Problem:</h2>
<p><strong></strong>I have an application that is being deployed via a Visual Studio Setup Project, however, I had to create some custom Windows Forms to collect some specific data from the user. These forms are shown in the Install() method of the application&#8217;s Installer class, right after application files have been deployed by the Setup Project (I.E. the MSI). The problem is that when my forms appear, they appear under the Setup Project&#8217;s window rather than being the topmost form on the screen. The form then has to be focused on manually by clicking on its icon in the taskbar to bring it up, if the user even notices it.<br />
I&#8217;m using the ShowDialog() method to show the forms. I&#8217;ve tried setting TopMost to true, using BringToFront(), using Focus(), but none of these brought the form over the Setup Project&#8217;s window. I&#8217;ve also experimented that uses user32.dll and a method like the following to try to force the form to the top; unfortunately, this didn&#8217;t work either.</p>
<h2>Reason:</h2>
<p><strong></strong>Dialogs created by custom actions are always displayed behind the installation dialogs on newer Windows versions (Vista and Windows 7). This is because Windows prevents applications to move a window on top of all other windows.</p>
<h2>Solution:</h2>
<p>The problem&#8217;s been resolved. All I had to do was pick the Setup project&#8217;s window from the list of processes and set it as the owner of the custom forms as I was displaying them. Here&#8217;s a breakdown of the steps I used:<br />
1) Go through the list of processes named &#8220;msiexec&#8221;, and get the handle of the one displaying the Setup .msi&#8217;s window, identifiable by the MainWindowTitle &#8211; the title of the window.<br />
2) You now have the handle of this process (MainWindowHandle), but how do you use it? You can specify the owner of a Form when you&#8217;re calling ShowDialog through the parameter that takes an IWin32Window; the problem is that IWin32Window doesn&#8217;t let you set the handle of the window. This is worked around by using a wrapper class which extends IWin32Window.<br />
3) So finally, all you have to do is set the owner of the form as you&#8217;re calling ShowDialog(), with something like CustomForm.ShowDialog(new WindowWrapper(process.MainWindowHandle), message, etc.). Myself, I made a method which returns the Setup Project&#8217;s window as a WindowWrapper, and then used that in each of the Installer class&#8217;s methods (Install, Commit, Uninstall and Rollback) to set the owner of every form and messagebox I am creating.<br />
Also, don&#8217;t change the owners of any child forms or messageboxes of your custom forms (except maybe to &#8220;this&#8221;), as they&#8217;ll be owned by the custom forms that show them; otherwise they&#8217;ll show up over the Setup project&#8217;s window but under the custom forms, not that we desired.</p>
<h2>Sample Code:</h2>
<pre class="wp-code-highlight prettyprint"> public override void Install(System.Collections.IDictionary stateSaver)
  {
      base.Install(stateSaver);
      try
      {
          ExecuteSqlScript();
      }
      catch (InstallException ex)
      {
           throw ex;
      }

}
private void ExecuteSqlScript()
{
      IntPtr hwnd = IntPtr.Zero;
      WindowWrapper wrapper = null;
      Process[] procs = Process.GetProcessesByName(&quot;msiexec&quot;);
      if (null != procs &amp;amp;&amp;amp; procs.Length &amp;gt; 0)
         hwnd = procs[0].MainWindowHandle;
       wrapper = new WindowWrapper(hwnd);
       //Set the windows forms owner to setup project so it can be focused and
       //set infront
       frmInstance objInstance = new frmInstance();
       if (null != wrapper)
          objInstance.ShowDialog(wrapper);
       else
           objInstance.ShowDialog();
}

 public class WindowWrapper : System.Windows.Forms.IWin32Window
    {
        public WindowWrapper(IntPtr handle)
        {
            _hwnd = handle;
        }

        public IntPtr Handle
        {
            get { return _hwnd; }
        }

        private IntPtr _hwnd;
    }</pre>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/bring-custom-window-form-on-top-of-setup-project-window.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/bring-custom-window-form-on-top-of-setup-project-window.html&text=Bring custom window form on top of setup project window" target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/bring-custom-window-form-on-top-of-setup-project-window.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get sql server instances using C#</title>
		<link>http://codeheaven.org/get-sql-server-instances-using-c.html</link>
		<comments>http://codeheaven.org/get-sql-server-instances-using-c.html#comments</comments>
		<pubDate>Tue, 03 Apr 2012 04:52:30 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[ADO.net]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[enumerate sql server instances]]></category>
		<category><![CDATA[fetch sql server instances]]></category>
		<category><![CDATA[get sql instances from registry]]></category>
		<category><![CDATA[reading sql server instances]]></category>
		<category><![CDATA[sql server instance]]></category>
		<category><![CDATA[sql server instance from registry]]></category>
		<category><![CDATA[sql-server-instances]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=401</guid>
		<description><![CDATA[SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance; System.Data.DataTable table = instance.GetDataSources(); foreach (System.Data.DataRow row in table.Rows) { string instanceName = string.Empty; if (row[&#34;ServerName&#34;] != DBNull.Value) instanceName = row[&#34;ServerName&#34;].ToString(); if(row[&#34;InstanceName&#34;] != DBNull.Value &#124;&#124; !string.IsNullOrEmpty(Convert.ToString(row[&#34;InstanceName&#34;]).Trim())) { instanceName += @&#34;\&#34; + Convert.ToString(row[&#34;InstanceName&#34;]).Trim(); } listview1.Items.Add(instanceName); } The SqlDataSourceEnumerator class exposes this information to the application developer, providing a DataTable containing information about [...]]]></description>
			<content:encoded><![CDATA[<pre class="wp-code-highlight prettyprint">SqlDataSourceEnumerator instance = SqlDataSourceEnumerator.Instance;
System.Data.DataTable table = instance.GetDataSources();
foreach (System.Data.DataRow row in table.Rows)
        {
                string instanceName = string.Empty;
                if (row[&quot;ServerName&quot;] != DBNull.Value) instanceName = row[&quot;ServerName&quot;].ToString();
                if(row[&quot;InstanceName&quot;] != DBNull.Value ||  !string.IsNullOrEmpty(Convert.ToString(row[&quot;InstanceName&quot;]).Trim()))
                {
                    instanceName += @&quot;\&quot; + Convert.ToString(row[&quot;InstanceName&quot;]).Trim();
                }
                listview1.Items.Add(instanceName);
        }</pre>
<p><span style="color: #000000;">The</span> <span style="color: #3366ff;">SqlDataSourceEnumerator</span> <span style="color: #000000;">class exposes this information to the application developer, providing a DataTable containing information about all the visible servers. This returned table contains a list of server instances available on the network that matches the list provided when a user attempts to create a new connection, and expands the drop-down list containing all the available servers on the Connection Properties dialog box.</span><span style="color: #d8265b;"> The results displayed are not always complete,<span style="color: #000000;"> because of timeouts and network traffics. Servers listed through the SQL Server browser service will have more details than those found through the Windows infrastructure, which will list only the name.</span></span></p>
<p>&nbsp;</p>
<p>Server enumeration is only available when running in full-trust. Assemblies running in a partially-trusted environment will not be able to use it, even if they have the <a href="http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlclientpermission.aspx">SqlClientPermission</a> Code Access Security (CAS) permission.</p>
<p><span style="text-decoration: underline;"><strong>By Reading Registry:</strong></span></p>
<p>Another way to get the installed instance names of sql server is to read your machine registry. It will fetch all the instances of sql from your local machine.</p>
<p>&nbsp;</p>
<pre class="wp-code-highlight prettyprint">
 RegistryKey rk = Registry.LocalMachine.OpenSubKey(@&quot;SOFTWARE\Microsoft\Microsoft SQL Server&quot;);
            String[] instances = (String[])rk.GetValue(&quot;InstalledInstances&quot;);
            if (instances.Length &gt; 0)
            {
                foreach (String element in instances)
                {
                    if (element == &quot;MSSQLSERVER&quot;)
                        Console.WriteLine(System.Environment.MachineName);
                    else
                        Console.WriteLine(System.Environment.MachineName + @&quot;\&quot; + element);

                }
                Console.ReadLine();
            }
</pre>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/get-sql-server-instances-using-c.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/get-sql-server-instances-using-c.html&text=Get sql server instances using C#" target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/get-sql-server-instances-using-c.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Multiple columns using CSS3</title>
		<link>http://codeheaven.org/multiple-columns-using-css3.html</link>
		<comments>http://codeheaven.org/multiple-columns-using-css3.html#comments</comments>
		<pubDate>Wed, 28 Mar 2012 11:48:53 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CSS3]]></category>
		<category><![CDATA[column-gap]]></category>
		<category><![CDATA[column-rules]]></category>
		<category><![CDATA[css]]></category>
		<category><![CDATA[css-3]]></category>
		<category><![CDATA[css3]]></category>
		<category><![CDATA[multiple-columns]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=380</guid>
		<description><![CDATA[At present, this feature is available in Firefox and Safari 3. When the module becomes finalised in the CSS3 specification it will be adopted by other browsers and rolled into their updates. There are four properties which relate to the multiple column layout in CSS3, allowing you to set the number of columns, width, gap [...]]]></description>
			<content:encoded><![CDATA[<p>At present, this feature is available in Firefox and Safari 3. When the module becomes finalised in the CSS3 specification it will be adopted by other browsers and rolled into their updates.<br />
There are four properties which relate to the multiple column layout in CSS3, allowing you to set the number of columns, width, gap between each column and a border between each:</p>
<p>column-count<br />
column-width<br />
column-gap<br />
column-rule</p>
<p>At present, a browser specific selector is also needed to identify whether Safari or Firefox should display the selector. The code to be used to create a two column layout with a 1px rule between columns would be:</p>
<pre class="wp-code-highlight prettyprint">
&lt;style&gt;
            .multiplecolumns {
            -moz-column-width: 130px;;
            -webkit-column-width: 130px;
            -moz-column-gap: 20px;
            -webkit-column-gap: 20px;
            -moz-column-rule: 1px solid #ddccb5;
            -webkit-column-rule: 1px solid #ddccb5;
            -moz-column-count:3; /* Firefox */
            -webkit-column-count:3; /* Safari and Chrome */
            column-count:3;
            }

&lt;/style&gt;</pre>
<p>you can use this mulipltcolumns class as:</p>
<div class="multiplecolumns">Multiple columns are a major facet of laying out text – newspapers have used them for decades. So important are they that it is amazing that the current way to achieve a multi column layout is one of the most complex techniques for a new designer to grasp.</div>
<div id="attachment_383" class="wp-caption alignleft" style="width: 488px"><a href="http://codeheaven.org/wp-content/uploads/2012/03/multipleColumns.png"><img class="size-full wp-image-383" title="Example of Multiple Columns in css3" src="http://codeheaven.org/wp-content/uploads/2012/03/multipleColumns.png" alt="Example of Multiple Columns in css3" width="478" height="123" /></a><p class="wp-caption-text">Multiple Columns in css3</p></div>
<p><br clear="all" /><br />
<strong>Spanning columns</strong><br />
It could also be the case that you would like an element to span more than one column – a heading, table or image for instance. This is facilitated in the specification through the use of:</p>
<pre class="wp-code-highlight prettyprint">h2 {
column-span: all
}</pre>
<p>Numbers can also be used to allow the element to span a certain number of columns. At present this feature isn’t implemented in any major browsers, but should provide much needed additional flexibility when designing around this feature.</p>
<p><strong>Columns Gap</strong><br />
The column-gap property specifies the gap between the columns:</p>
<pre class="wp-code-highlight prettyprint">div
{
-moz-column-gap:40px; /* Firefox */
-webkit-column-gap:40px; /* Safari and Chrome */
column-gap:40px;
}</pre>
<p><strong>Columns Rules</strong><br />
The column-rule property sets the width, style, and color of the rule between columns.</p>
<pre class="wp-code-highlight prettyprint">div
{
-moz-column-rule:3px outset #ff00ff; /* Firefox */
-webkit-column-rule:3px outset #ff00ff; /* Safari and Chrome */
column-rule:3px outset #ff00ff;
}</pre>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/multiple-columns-using-css3.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/multiple-columns-using-css3.html&text=Multiple columns using CSS3" target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/multiple-columns-using-css3.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Mixed mode assembly is built against version ‘v2.0.50727′ of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.</title>
		<link>http://codeheaven.org/mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-runtime-and-cannot-be-loaded-in-the-4-0-runtime-without-additional-configuration-information.html</link>
		<comments>http://codeheaven.org/mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-runtime-and-cannot-be-loaded-in-the-4-0-runtime-without-additional-configuration-information.html#comments</comments>
		<pubDate>Tue, 27 Mar 2012 12:42:43 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[.Net]]></category>
		<category><![CDATA[Dot Net]]></category>
		<category><![CDATA[.net2.0.50727]]></category>
		<category><![CDATA[.net4.0]]></category>
		<category><![CDATA[app.config]]></category>
		<category><![CDATA[mixed-mode]]></category>
		<category><![CDATA[visual studio 2010]]></category>

		<guid isPermaLink="false">http://codeheaven.org/?p=375</guid>
		<description><![CDATA[One of the recent problems we’ve seen is that, because of the support for side-by-side runtimes, .NET 4.0 has changed the way that it binds to older mixed-mode assemblies. These assemblies are, for example, those that are compiled from C++\CLI. Currently available DirectX assemblies are mixed mode. If you see a message like this then [...]]]></description>
			<content:encoded><![CDATA[<p>One of the recent problems we’ve seen is that, because of the support for side-by-side runtimes, .NET 4.0 has changed the way that it binds to older mixed-mode assemblies. These assemblies are, for example, those that are compiled from C++\CLI. Currently available DirectX assemblies are mixed mode. If you see a message like this then you know you have run into the issue:</p>
<p><em>Mixed mode assembly is built against version &#8216;v1.1.4322&#8242; of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information.</em></p>
<p>The good news for applications is that you have the option of falling back to .NET 2.0 era binding for these assemblies by setting an app.config flag like so:</p>
<pre class="wp-code-highlight prettyprint">
&lt;startup useLegacyV2RuntimeActivationPolicy=&quot;true&quot;&gt;
   &lt;supportedRuntime version=&quot;v4.0&quot; sku=&quot;.NETFramework,Version=v4.0&quot;/&gt;
&lt;/startup&gt;
</pre>
<p><strong>useLegacyV2RuntimeActivationPolicy:</strong> Specifies whether to enable the .NET Framework version 2.0 runtime activation policy or to use the .NET Framework version 4 activation policy.<br />
<strong>supportedRuntime:</strong> Specifies which versions of the common language runtime the application supports.</p>
<div id="fcbk_share"><div class="fcbk_button">
										<a name="fcbk_share"	href="http://www.facebook.com/pages/CodeHeavenorg/233118043415516"	target="blank">
											<img src="http://codeheaven.org/wp-content/plugins/facebook-button-plugin/img/standart-facebook-ico.jpg" alt="Fb-Button" />
										</a>	
									</div><div class="fcbk_like">
										<div id="fb-root"></div>
										<script src="http://connect.facebook.net/en_US/all.js#appId=224313110927811&amp;xfbml=1"></script>
										<fb:like href="http://codeheaven.org/mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-runtime-and-cannot-be-loaded-in-the-4-0-runtime-without-additional-configuration-information.html" send="false" layout="button_count" width="450" show_faces="false" font=""></fb:like>
									</div></div><div class="twttr_button">
				<a href="http://twitter.com/share?url=http://codeheaven.org/mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-runtime-and-cannot-be-loaded-in-the-4-0-runtime-without-additional-configuration-information.html&text=Mixed mode assembly is built against version 'v2.0.50727' of the runtime and cannot be loaded in the 4.0 runtime without additional configuration information." target="_blank" title="Click here if you liked this article.">
					<img src="http://codeheaven.org/wp-content/plugins/twitter-plugin/images/twitt.gif" alt="Twitt" />
				</a>
			</div>]]></content:encoded>
			<wfw:commentRss>http://codeheaven.org/mixed-mode-assembly-is-built-against-version-v2-0-50727-of-the-runtime-and-cannot-be-loaded-in-the-4-0-runtime-without-additional-configuration-information.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	<media:rating>nonadult</media:rating></channel>
</rss>
