<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Climens&#039; Codelog &#187; Programming</title>
	<atom:link href="http://codelog.climens.net/category/programacion/feed/" rel="self" type="application/rss+xml" />
	<link>http://codelog.climens.net</link>
	<description>Development, productivity, blogging, technology, life in the trenches...</description>
	<lastBuildDate>Tue, 20 Dec 2011 22:41:32 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Lessons learned optimizing MySQL</title>
		<link>http://codelog.climens.net/2011/08/05/lessons-learned-optimizing-mysql/</link>
		<comments>http://codelog.climens.net/2011/08/05/lessons-learned-optimizing-mysql/#comments</comments>
		<pubDate>Fri, 05 Aug 2011 11:41:18 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[optimization]]></category>
		<category><![CDATA[performance]]></category>
		<category><![CDATA[tips]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=409</guid>
		<description><![CDATA[This week I&#8217;ve been quite entertained at work optimizing a big MySQL database, 18M rows and about 10Gb of table data for a high traffic web site (11M unique views per month). Not optimizing for perfomance is overkill in this case, so I have been learning and enjoying a lot during these days. The first [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2011/08/05/lessons-learned-optimizing-mysql/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2011/08/05/lessons-learned-optimizing-mysql/" data-text="Lessons learned optimizing MySQL" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2011/08/05/lessons-learned-optimizing-mysql/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>This week I&#8217;ve been quite entertained at work optimizing a big <a href="http://dev.mysql.com/">MySQL database</a>, 18M rows and about 10Gb of table data for a high traffic web site (11M unique views per month). Not optimizing for perfomance is overkill in this case, so I have been learning and enjoying a lot during these days.</p>
<p>The first thing to note is that <strong>database servers are complex beasts</strong> (don&#8217;t underestimate them) and each and every database provider has its own strengths but also its own caveats.</p>
<p><img class="alignleft size-full wp-image-410" src="http://codelog.climens.net/files/2011/08/logo-mysql-110x57.png" alt="MySQL logo" width="110" height="110" />Sooner or later you&#8217;ll face a behavior that may seem counter-intuitive and there&#8217;s when you must <strong>read a lot of documentation</strong>. In this case, <a href="http://www.mysqlperformanceblog.com/">MySQL Performance Blog</a> and <a href="http://dev.mysql.com/doc/refman/5.5/en/">MySQL documentation</a> have been of great help, as well as the now unmantained-but-still-useful <a href="http://hackmysql.com/">Hack MySQL</a> site, which provides great tips very well explained.</p>
<p>Second. As always, <strong>doing an 80% optimization consumes 20% of the time</strong> and most of it is quite straightforward. <code>EXPLAIN</code>, review results, create index, <code>EXPLAIN</code> again. This way you can do a good job just knowing some indexing basics. Your indexes may be a bit fat, but will do the job.</p>
<p>Then you&#8217;ll need to <strong>be patient</strong>, creating indexes is not always fast, in fact the number, size and heterogeneusy of the columns involved will increase the time it takes to create them. While you wait, the best is to read good books about MySQL or relational databases like: <a href="http://www.amazon.com/gp/product/0471719994/ref=as_li_ss_tl?ie=UTF8&amp;tag=climecodel-20&amp;linkCode=as2&amp;camp=217145&amp;creative=399373&amp;creativeASIN=0471719994">Relational Database Index Design and the Optimizers</a><img src="http://www.assoc-amazon.com/e/ir?t=&amp;l=as2&amp;o=1&amp;a=0471719994&amp;camp=217145&amp;creative=399373" width="1" height="1" border="0" alt="" style="border:none !important;margin:0px !important" />.</p>
<p>You&#8217;ll need to <strong>be organized</strong>. Creating indexes randomly just looking a couple of slow <code>SELECT</code>s is something, but you must look at the big picture: make an inventory of all the application queries, no matter how unimportant look like because if they attack a big table with a WHERE or an <code>ORDER BY</code> they will perform bad. Fact. This list will help you organize the indexes and see which ones are used and which not and where.</p>
<p>Learn as well <strong>what the configuration parameters mean</strong>, MySQL has a bunch of them. Just increasing numbers will not always solve your bottlenecks. If you see something strange, there might be a parameter misconfigured and causing bad results.</p>
<p>Sometimes you&#8217;ll <strong>find yourself frustrated</strong> by something that you can&#8217;t understand. I found that almost anything in this field has an explanation, even a reasonable one.</p>
<p>Finally, don&#8217;t overlook other thinks. <strong>Database performance is important</strong> but there may be a lot of room to improve in your code, don&#8217;t blame MySQL as the root of all problems!</p>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/08/05/lessons-learned-optimizing-mysql/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Simple Mini Profiler Glimpse plugin</title>
		<link>http://codelog.climens.net/2011/06/19/simple-mini-profiler-glimpse-plugin/</link>
		<comments>http://codelog.climens.net/2011/06/19/simple-mini-profiler-glimpse-plugin/#comments</comments>
		<pubDate>Sun, 19 Jun 2011 16:01:35 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[glimpse]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[profiler]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=389</guid>
		<description><![CDATA[I recently published on Github a simple small project (miniprofiler-glimpse-plugin) to integrate the results collected by the excellent MVC Mini Profiler created by the people at Stackoverflow with Glimpse, the Firebug for ASP.NET and MVC applications. Creating Glimpse plugins is really easy (just implement IGlimpsePlugin and decorate it with GlimpsePluginAttribute), implement the methods and reference [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2011/06/19/simple-mini-profiler-glimpse-plugin/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2011/06/19/simple-mini-profiler-glimpse-plugin/" data-text="Simple Mini Profiler Glimpse plugin" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2011/06/19/simple-mini-profiler-glimpse-plugin/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>I recently published on Github a simple small project (<a href="https://github.com/mcliment/miniprofiler-glimpse-plugin">miniprofiler-glimpse-plugin</a>) to integrate the results collected by the excellent <a href="https://code.google.com/p/mvc-mini-profiler/">MVC Mini Profiler</a> created by the people at Stackoverflow with <a href="http://getglimpse.com/">Glimpse</a>, the Firebug for ASP.NET and MVC applications.</p>
<p>Creating Glimpse plugins is really easy (just implement <code>IGlimpsePlugin</code> and decorate it with <code>GlimpsePluginAttribute</code>), implement the methods and reference the plug-in assembly in the project where you are using Glimpse. <a href="http://mef.codeplex.com/">MEF</a> will do the gluing and the <a href="http://json.codeplex.com/">JSON.NET</a> will do its best to deserialize the results in a human readable way.</p>
<p>To use this plug-in, just compile it and reference the assembly in your Glimpse-enabled project. I you have questions, suggestions or bug reports, you can use Github&#8217;s own issue reporting system, drop me a line o fork the project and make your improvements.</p>
<p>So, I hope you like it.</p>
<p>Link: <a href="https://github.com/mcliment/miniprofiler-glimpse-plugin">miniprofiler-glimpse-plugin</a> [github.org]</p>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/06/19/simple-mini-profiler-glimpse-plugin/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Troubleshooting MSDTC, RPC and NServiceBus issues</title>
		<link>http://codelog.climens.net/2011/06/06/troubleshooting-msdtc-rpc-and-nservicebus-issues/</link>
		<comments>http://codelog.climens.net/2011/06/06/troubleshooting-msdtc-rpc-and-nservicebus-issues/#comments</comments>
		<pubDate>Mon, 06 Jun 2011 16:19:47 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[msdtc]]></category>
		<category><![CDATA[nservicebus]]></category>
		<category><![CDATA[rpc]]></category>
		<category><![CDATA[troubleshooting]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=350</guid>
		<description><![CDATA[At first it seemed easy, but it&#8217;s been a long distance hurdle race. At the end, I have solved the problems I&#8217;ve found and my painful experience can be useful for other people, so this is it. First of all, my topology is the following: a client, in this case for testing purposes, my machine, [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2011/06/06/troubleshooting-msdtc-rpc-and-nservicebus-issues/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2011/06/06/troubleshooting-msdtc-rpc-and-nservicebus-issues/" data-text="Troubleshooting MSDTC, RPC and NServiceBus issues" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2011/06/06/troubleshooting-msdtc-rpc-and-nservicebus-issues/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>At first it seemed easy, but it&#8217;s been a long distance hurdle race. At the end, I have solved the problems I&#8217;ve found and my painful experience can be useful for other people, so this is it.</p>
<p>First of all, my topology is the following: a client, in this case for testing purposes, my machine, which is running an ASP.NET web application and a NServiceBus host that processes all the messages. This has been configured following <a href="http://www.nservicebus.com/Documentation.aspx">the official documentation</a> and <a href="https://github.com/NServiceBus/NServiceBus/tree/master/Samples">looking at the samples</a> (check out the full <a href="https://github.com/NServiceBus/NServiceBus">NServiceBus source code</a>, you&#8217;ll need it). It&#8217;s a bit messy but with some trial and error you can make sense of it. There are some obscure properties that have to be googled to know what they mean.</p>
<p>Processing the messages is not trivial for the bus host. Some of them attack the database and need to use <abbr title="Microsoft Distributed Transaction Coordinator">MSDTC</abbr> to manage the transactions. This means that MSDTC must be up and running without problems.</p>
<p>One trick I learned after a lot of researching is <a href="http://blog.zoolutions.se/post/2010/04/01/Conquering-NServiceBus-part-5-e28093-Troubleshooting-DTC.aspx">the <code>Runner.exe</code> tool from NServiceBus</a>. This comes with NServiceBus source code (and I think that also with paid version) and ends up in <code>build\tools\MsmqUtils</code> if you build it with <code>build.bat</code> or <code>build-net4.bat</code>. Just open a command line as administrator and run:</p>
<pre class="brush: plain; title: ; notranslate">Runner.exe /i</pre>
<p>This will install MSDTC and configure it properly. I don&#8217;t think you&#8217;ll need anything else but check the MSDTC configuration in <em>Component Services -&gt; Computers -&gt; My Computer -&gt; Distributed Transaction Coordinator -&gt; Local DTC</em>. Right click to go to properties and ensure everything is configured like in this <a href="http://blog.zoolutions.se/post/2010/04/01/Conquering-NServiceBus-part-5-e28093-Troubleshooting-DTC.aspx">Troubleshooting DTC</a> post.</p>
<p>At this point, I recommend you to disable the Windows Firewall on both machines, at least for domain network, just to be sure it&#8217;s not interfering and breaking the tests, we will solve this later.</p>
<p>Then, <a href="http://www.microsoft.com/downloads/details.aspx?displaylang=en&amp;FamilyID=5e325025-4dcd-4658-a549-1d549ac17644">DTCPing</a> is your friend. This small tool will check the DTC connectivity between two machines. It&#8217;s a bit awkward. You have to start the tool in both machines, then put the name of the other and click ping on each one. This will make a test and if everything goes well, you&#8217;ll see a detailed log without errors:</p>
<pre class="brush: plain; title: ; notranslate">
++++++++++++Validating Remote Computer Name++++++++++++
Please refer to following log file for details:
	C:\tools\DTCPing\LOCALMACHINE2928.log
Invoking RPC method on REMOTEMACHINE
RPC test is successful
++++++++++++RPC test completed+++++++++++++++
++++++++++++Start DTC Binding Test +++++++++++++
Trying Bind to REMOTEMACHINE
Received reverse bind call from REMOTEMACHINE
Binding success: LOCALMACHINE--&gt;REMOTEMACHINE
++++++++++++DTC Binding Test END+++++++++++++
Please send following LOG to Microsoft for analysis:
	Partner LOG: REMOTEMACHINE5928.log
	My LOG: LOCALMACHINE2928.log
++++++++++++Start Reverse Bind Test+++++++++++++
Received Bind call from REMOTEMACHINE
Trying Reverse Bind to REMOTEMACHINE
Reverse Binding success: LOCALMACHINE--&gt;REMOTEMACHINE
++++++++++++Reverse Bind Test ENDED++++++++++
</pre>
<p>Here started my nightmare, I got the damned: <code>RPC error 5 (Access denied)</code>. After hours googling for the problem I found <a href="http://blogs.msdn.com/b/distributedservices/archive/2008/11/12/troubleshooting-msdtc-issues-with-the-dtcping-tool.aspx">this post about MSDTC problems</a> (I was looking for RPC problems, which actually was the root cause). The cause is that remote RPC is disabled in Windows workstations by default.</p>
<p>I opened for the N-th time the registry and added the RPC key to <code>HKLM\Software\Policies\Microsoft\Windows NT</code> and the RestrictRemoteClients DWORD value to 0. Rebooted without much hope. Magically, DTCPing worked and life seemed better and brighter.</p>
<p>Then, the Windows Firewall must be configured. In Windows Server 2008 (or Windows 7, it&#8217;s the same interface), go to Control Panel -&gt; System and Security -&gt; Windows Firewall (or just execute <code>firewall.cpl</code> at the command prompt). Go to Advanced Configuration to open a new window. Go to inbound rules and look for the Distributed Transaction Coordinator. If they are disabled, enable them. On the workstation the firewall can be enabled. Beware that DTCPing may not work, because the Firewall is only allowing connections to/from svchost.exe and msdtc.exe (if you want it to work, add a rule for that process).</p>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/06/06/troubleshooting-msdtc-rpc-and-nservicebus-issues/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How msiinv saved my day</title>
		<link>http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/</link>
		<comments>http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/#comments</comments>
		<pubDate>Fri, 14 Jan 2011 10:22:31 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>
		<category><![CDATA[MSI]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=327</guid>
		<description><![CDATA[In my previous post I reported my problems installing MVC3 in my machine. That led me to further investigation as that worked perfectly in my co-workers&#8217; machines. I tried to repair Visual Studio 2010 and told me that it had troubles with vs_setup.msi&#8230; strange. Looking around I found a post that led me to an [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/" data-text="How msiinv saved my day" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>In my <a href="http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/">previous post</a> I reported my problems installing MVC3 in my machine. That led me to further investigation as that worked perfectly in my co-workers&#8217; machines.</p>
<p>I tried to repair Visual Studio 2010 and told me that it had troubles with vs_setup.msi&#8230; strange. Looking around I found a post that led me to <a href="http://blogs.msdn.com/b/astebner/archive/2005/07/01/using-msiinv-to-gather-information-about-what-is-installed-on-a-computer.aspx">an explanation of the msiinv.exe tool</a>.</p>
<p>It took me a while to get the tool as the author&#8217;s site is broken, but Stackoverflow <a href="http://stackoverflow.com/questions/239264/anyone-got-a-copy-of-msiinv-exe">came on rescue</a>.</p>
<p>Then, I ran the tool:</p>
<pre class="brush: plain; title: ; notranslate">
msiinv -p &gt; msiinv.txt
</pre>
<p>Then opened the file and&#8230; surprise!</p>
<pre class="brush: plain; title: ; notranslate">
Microsoft Visual Studio 2010 Professional - ESN
    Product code:    {725041D1-9F45-30D3-A78E-DF08C4E1A297}
    Product state:    (1) The product is advertised, but not installed.
    Package code:    {9E58363D-E4A9-49D3-82B7-42584AFCA9E7}
    AssignmentType:    1
    Language:    3082
        Package:    vs_setup.msi
    0 patch packages.
</pre>
<p>Strange. I tried to fix it with MSI:</p>
<pre class="brush: plain; title: ; notranslate">
msiexec /f {725041D1-9F45-30D3-A78E-DF08C4E1A297}
</pre>
<p>It asked me for the vs_setup.msi, it&#8217;s in the root of the Visual Studio 2010 DVD in case it&#8217;s not found automatically. Magically it worked and now it&#8217;s installed:</p>
<pre class="brush: plain; title: ; notranslate">
Microsoft Visual Studio 2010 Professional - ESN
    Product code:    {725041D1-9F45-30D3-A78E-DF08C4E1A297}
    Product state:    (5) Installed.
    Package code:    {9E58363D-E4A9-49D3-82B7-42584AFCA9E7}
    Version:    10.0.30319
    AssignmentType:    1
    Publisher:    Microsoft Corporation
    Language:    3082
       Installed from: D:\VS2010\
    Package:    vs_setup.msi
    Help link:    http://go.microsoft.com/fwlink/?LinkId=133405
    Local package:    C:\Windows\Installer\3f3bc84.msi
    Install date:    2011&#092;&#048;1\14
    0 patch packages.
</pre>
<p>Great! Now the ASP.NET MVC3 RTM setup package worked like a charm.</p>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Install ASP.NET MVC 3 Manually</title>
		<link>http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/</link>
		<comments>http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/#comments</comments>
		<pubDate>Wed, 12 Jan 2011 14:49:08 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[ASP.NET MVC]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=320</guid>
		<description><![CDATA[Update 14-jan-2011: I found the root solution to all my problems with msiinv, check my post on the subject. I don&#8217;t know exactly why but I can&#8217;t install the MVC 3 package provided by Web Platform Installer nor the standalone one, so I uncompressed it and tried to figure out how to install it manually. [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/" data-text="Install ASP.NET MVC 3 Manually" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p><strong>Update 14-jan-2011:</strong> I found the root solution to all my problems with msiinv, check <a href="http://codelog.climens.net/2011/01/14/how-msiinv-saved-my-day/">my post on the subject</a>.</p>
<p>I don&#8217;t know exactly why but I can&#8217;t install the MVC 3 package provided by <a href="http://www.microsoft.com/web/downloads/platform.aspx">Web Platform Installer</a> nor the <a href="http://www.microsoft.com/downloads/en/details.aspx?FamilyID=d2928bc1-f48c-4e95-a064-2a455a22c8f6">standalone one</a>, so I uncompressed it and tried to figure out how to install it manually.</p>
<p><img class="alignright size-full wp-image-322" src="http://codelog.climens.net/files/2011/01/dotnetlogo.png" alt="" width="306" height="104" />The problem I have is with vs10-kb2465236-x86.exe that gives me a &#8220;failed with 0x8007066a&#8221; error. It seems to be for <a href="http://support.microsoft.com/kb/2465236/en-us">enabling Razor syntax</a> but the prerequisites are Visual Studio 2010 Ultimate ENU. I have Visual Studio 2010 Professional ESN and that may be the reason or may not.</p>
<p>Anyway, I found the way to install the package manually, although the Razor Intellisense stuff is not available in my setup.</p>
<p>First you have to uncompress the AspNetMVC3Setup.exe into a folder and then install the following files (I got the sequence from the parameterinfo.xml file, which describes the installation process):</p>
<ul>
<li><span style="text-decoration: line-through">VS10-KB2465236-x86.exe</span> (it fails in my case, I don&#8217;t install it)</li>
<li>AspNetWebPages.msi &#8211; ASP.NET Web Pages</li>
<li>AspNetWebPagesVS2010Tools.msi &#8211; ASP.NET Web Pages Visual Studio 2010 Tools</li>
<li>AspNetMVC3.msi &#8211; ASP.NET MVC 3 Runtime</li>
<li>AspNetMVC3VS2010Tools.msi &#8211; ASP.NET MVC 3 Visual Studio 2010 Tools</li>
<li>NuGet.msi &#8211; NuGet</li>
</ul>
<p>And that&#8217;s all. In case you have Web Developer Express instead of full Visual Studio, you have ton install the tools specifically for that edition, AspNetWebPagesVWD2010Tools.msi instead of AspNetWebPagesVS2010Tools.msi and AspNetMVC3VWD2010Tools.msi instead of AspNetMVC3VS2010Tools.msi.</p>
<p>Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2011/01/12/install-asp-net-mvc-3-rc-manually/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Deployment web site Zip with MsBuild and TeamCity</title>
		<link>http://codelog.climens.net/2010/11/30/deploymet-web-site-zip-with-msbuild-and-teamcity/</link>
		<comments>http://codelog.climens.net/2010/11/30/deploymet-web-site-zip-with-msbuild-and-teamcity/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 10:09:28 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[continuous integration]]></category>
		<category><![CDATA[msbuild]]></category>
		<category><![CDATA[subversion]]></category>
		<category><![CDATA[teamcity]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=309</guid>
		<description><![CDATA[One of the most useful practices that I&#8217;ve been using during the last years is continuous integration and for that purpose, TeamCity is the tool of choice, which offers a free professional version with up to 20 users and 20 build configurations, enough for a small team. Recently I tried (again, first time I found [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2010/11/30/deploymet-web-site-zip-with-msbuild-and-teamcity/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2010/11/30/deploymet-web-site-zip-with-msbuild-and-teamcity/" data-text="Deployment web site Zip with MsBuild and TeamCity" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2010/11/30/deploymet-web-site-zip-with-msbuild-and-teamcity/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>One of the most useful practices that I&#8217;ve been using during the last years is continuous integration and for that purpose, <a href="http://www.jetbrains.com/teamcity/">TeamCity</a> is the tool of choice, which offers a free professional version with up to 20 users and 20 build configurations, enough for a small team.</p>
<p>Recently I tried (again, first time I found some trouble) to create an <a href="http://msdn.microsoft.com/en-us/library/0k6kkbsd.aspx">MsBuild</a> script to make a web publication to a folder an then zip that folder in order to make a simple distributable with all the things needed to set up our web project that anyone in the organization could download and install, instead of having to create that zip myself or publishing through Visual Studio.</p>
<p>Finally, I got the script and seems to work using <a href="http://msbuildtasks.tigris.org/">MsBuildCommunityTasks</a> and some community knowledge.</p>
<p>The first part deals with publishing the site:</p>
<pre class="brush: xml; title: ; notranslate">
  &lt;PropertyGroup&gt;
    &lt;OutputFolder&gt;$(MSBuildProjectDirectory)\publish&lt;/OutputFolder&gt;
    &lt;TempFolder&gt;$(MSBuildProjectDirectory)\temp\&lt;/TempFolder&gt;
  &lt;/PropertyGroup&gt;
  &lt;Target Name=&quot;PublishSite&quot;&gt;
    &lt;Message Text=&quot;Publishing in folder: $(OutputFolder)&quot; /&gt;
    &lt;RemoveDir Directories=&quot;$(OutputFolder);$(TempFolder)&quot; ContinueOnError=&quot;true&quot; /&gt;
    &lt;MSBuild
      Projects=&quot;src\Adapting.Web\Adapting.Web.csproj&quot;
      Targets=&quot;ResolveReferences;_WPPCopyWebApplication&quot;
      Properties=&quot;Configuration=Release;WebProjectOutputDir=$(OutputFolder);OutDir=$(TempFolder)&quot;
      StopOnFirstFailure=&quot;true&quot; /&gt;
    &lt;RemoveDir Directories=&quot;$(TempFolder)&quot; ContinueOnError=&quot;true&quot; /&gt;
  &lt;/Target&gt;
</pre>
<p>I define some variables and then I call the <code>_WPPCopyWebApplication</code> which is the important target (in .NET 2.0 was <code>_CopyWebApplication</code>). This should be the same as publishing a web site to a folder using the wizard.</p>
<p>Then, I get the files in the <code>OutputFolder</code> and make a zip with them:</p>
<pre class="brush: xml; title: ; notranslate">
  &lt;Target Name=&quot;PackageSite&quot; DependsOnTargets=&quot;PublishSite&quot;&gt;
    &lt;ItemGroup&gt;
      &lt;PublishFiles Include=&quot;$(OutputFolder)\**&quot; /&gt;
    &lt;/ItemGroup&gt;
    &lt;Message Text=&quot;Packaging Site&quot; /&gt;
    &lt;Zip
      Files=&quot;@(PublishFiles)&quot;
      ZipFileName=&quot;release-web.zip&quot;
      WorkingDirectory=&quot;$(OutputFolder)&quot;
      /&gt;
  &lt;/Target&gt;
</pre>
<p>I simplified this a little bit because I have as well a target that generates the build number from SVN and changes the <code>AssemblyInfo.cs</code> and uses this numbers to name the zip.</p>
<p>In TeamCity, you can create a new configuration with <code>*.zip</code> as artifacts, that points to your SCM (Subversion in my case) and the most important thing is that uses the MsBuild runner targeting <code>PackageSite</code>.</p>
<p>The only thing that was that if I put the <code>&lt;ItemGroup&gt;</code> section out of the <code>&lt;Target&gt;</code>, works on the command line but not inside TeamCity.</p>
<p>That&#8217;s all, I hope this helps.</p>
<p>Sources:</p>
<ul>
<li><a href="http://codingcockerel.co.uk/2008/05/18/how-to-publish-a-web-site-with-msbuild/">How to publish a web site with MsBuild</a></li>
<li><a href="http://blog.benhall.me.uk/2008/09/using-msbuild-to-create-deployment-zip.html">Using MsBuild to create a deployment zip</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2010/11/30/deploymet-web-site-zip-with-msbuild-and-teamcity/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Testing ConfigurationSection</title>
		<link>http://codelog.climens.net/2010/11/24/testing-configurationsection/</link>
		<comments>http://codelog.climens.net/2010/11/24/testing-configurationsection/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 14:17:15 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[bugs]]></category>
		<category><![CDATA[mvccontrib]]></category>
		<category><![CDATA[testing]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=301</guid>
		<description><![CDATA[Creating ConfigurationSections can be tricky but it&#8217;s quite straightforward to test them, provided you take care and don&#8217;t try to do too much like this subtle bug in MvcContrib.IncludeHandling that lead me crazy for a couple of hours. The thing is that the code does like this: Where this is the constructor and .Css and [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2010/11/24/testing-configurationsection/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2010/11/24/testing-configurationsection/" data-text="Testing ConfigurationSection" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2010/11/24/testing-configurationsection/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p><img src="http://codelog.climens.net/files/2010/11/logoset-final.jpg" alt="" width="293" height="100" class="alignright size-full wp-image-307" />Creating <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationsection.aspx">ConfigurationSection</a>s can be tricky but it&#8217;s quite straightforward to test them, provided you take care and don&#8217;t try to do too much like this subtle bug in <a href="http://mvccontrib.codeplex.com/">MvcContrib</a>.IncludeHandling that lead me crazy for a couple of hours.</p>
<p>The thing is that the code does like this:</p>
<pre class="brush: csharp; title: ; notranslate">
public IncludeHandlingSectionHandler()
{
    _types = new Dictionary&lt;IncludeType, IIncludeTypeSettings&gt;
    {
        { IncludeType.Css, Css },
        { IncludeType.Js, Js }
    };
}
</pre>
<p>Where this is the constructor and .Css and .Js properties are marked with <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationpropertyattribute.aspx">[ConfigurationProperty]</a>, so in theory seems correct.</p>
<p>In the tests, there&#8217;s an XML file with the section and it&#8217;s loaded using the <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationsection.deserializesection.aspx">DeserializeSection</a> method of the ConfigurationSection base class. And this seems correct, everything goes ok and the dictionary is populated correctly with the data from the XML file.</p>
<p>But it&#8217;s wrong. If you add the section to the app.config (or web.config) file and instead of using DeserializeSection you use <a href="http://msdn.microsoft.com/en-us/library/system.configuration.configurationmanager.getsection.aspx">ConfigurationManager.GetSection(sectionName)</a>, the constructor is called <strong>before </strong>populating the Css and Js properties so the dictionary is not created properly but as those properties return a default implementation in case there&#8217;s no configuration, it seems to work, but the configured values are never loaded.</p>
<p>This way, tests pass but it&#8217;s impossible to configure the library via web.config. Anyway, in my opinion the problem is in .NET Framework because internally, GetSection should use DeserializeSection to be consistent.</p>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2010/11/24/testing-configurationsection/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get MAC from IP address in .NET</title>
		<link>http://codelog.climens.net/2010/06/14/get-mac-from-ip-address-in-net/</link>
		<comments>http://codelog.climens.net/2010/06/14/get-mac-from-ip-address-in-net/#comments</comments>
		<pubDate>Mon, 14 Jun 2010 07:38:36 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[.NET]]></category>
		<category><![CDATA[networking]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=259</guid>
		<description><![CDATA[After dealing with several options, most of them involving a call to a command line tool and parsing the output, which is not really elegant. Other solutions were based on obsolete VBScript client code and ActiveX, even worse. Finally I found in the excellent pinvoke.net site a very nice and simple example using a simple [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2010/06/14/get-mac-from-ip-address-in-net/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2010/06/14/get-mac-from-ip-address-in-net/" data-text="Get MAC from IP address in .NET" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2010/06/14/get-mac-from-ip-address-in-net/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>After dealing with several options, most of them involving a call to a command line tool and parsing the output, which is not really elegant. Other solutions were based on obsolete VBScript client code and ActiveX, even worse.</p>
<p>Finally I found in the excellent <a href="http://www.pinvoke.net/">pinvoke.net</a> site <a href="http://www.pinvoke.net/default.aspx/iphlpapi.SendARP">a very nice and simple example</a> using a simple call to iphlpapi.dll&#8217;s SendARP method. The trick was to use <a href="http://en.wikipedia.org/wiki/Address_Resolution_Protocol">ARP</a> to get the MAC from the IP.</p>
<p>Note that this has it&#8217;s limitations, as I will only work if the remote machine is in the same network and the packet does not need to go through a router. I was enough for our needs.</p>
<p>Here&#8217;s the code I adapted from the example:</p>
<pre class="brush: csharp; title: ; notranslate">
public static string GetMAC(IPAddress ipAddr)
{
var mac = new byte[6];
var len = (uint)mac.Length;

var result = SendARP((int)ipAddr.Address, 0, mac, ref len);

if (result != 0)
{
return &quot;MAC not found!&quot;;
}

var str = new string[(int)len];

for (var i = 0; i &amp;lt; len; i++)
{
str[i] = mac[i].ToString(&quot;x2&quot;);
}

return string.Join(&quot;:&quot;, str);
}

[DllImport(&quot;iphlpapi.dll&quot;, ExactSpelling = true)]
private static extern int SendARP(int destIP, int srcIP, byte[] pMacAddr, ref uint phyAddrLen);
</pre>
<p>Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2010/06/14/get-mac-from-ip-address-in-net/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NHibernate: Custom type is not serializable</title>
		<link>http://codelog.climens.net/2010/06/10/nhibernate-custom-type-is-not-serializable/</link>
		<comments>http://codelog.climens.net/2010/06/10/nhibernate-custom-type-is-not-serializable/#comments</comments>
		<pubDate>Thu, 10 Jun 2010 16:02:33 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[NHibernate]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=253</guid>
		<description><![CDATA[Since I acquired a NHibernateProfiler license, an initialization warning message draw my attention, the text seemed quite easy to solve: WARN: custom type is not Serializable: MyLibrary.MyCustomDataType My first solution was adding [Serializable] attribute to the custom type, but that didn&#8217;t make the trick. As it was only a warning, I did not investigate further at [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2010/06/10/nhibernate-custom-type-is-not-serializable/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2010/06/10/nhibernate-custom-type-is-not-serializable/" data-text="NHibernate: Custom type is not serializable" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2010/06/10/nhibernate-custom-type-is-not-serializable/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>Since I acquired a NHibernateProfiler license, an initialization warning message draw my attention, the text seemed quite easy to solve:</p>
<blockquote><p>WARN: custom type is not Serializable: MyLibrary.MyCustomDataType</p></blockquote>
<div>My first solution was adding <code>[Serializable]</code> attribute to the custom type, but that didn&#8217;t make the trick. As it was only a warning, I did not investigate further at that moment.</div>
<div>But the other day, debugging data access code I saw the warning again and the easiest solution was going to the source NHibernate code to find this:</div>
<div>
<pre class="brush: csharp; title: ; notranslate">TypeFactory.InjectParameters(userType, parameters);
if (!userType.ReturnedClass.IsSerializable)
{
LogManager.GetLogger(typeof(CustomType)).Warn("custom type is not Serializable: " + userTypeClass);
}</pre>
</div>
<div>As seen in this code, the message is unclear, because the class that must be serializable is the ReturnedClass, not the custom UserType itself.</div>
<div>So, to solve the warning I just needed to add <code>[Serializable]</code> to the class returned by my custom UserType instead than the type itself.</div>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2010/06/10/nhibernate-custom-type-is-not-serializable/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting MIME type in .NET from file extension</title>
		<link>http://codelog.climens.net/2009/10/28/getting-mime-type-in-net-from-file-extension/</link>
		<comments>http://codelog.climens.net/2009/10/28/getting-mime-type-in-net-from-file-extension/#comments</comments>
		<pubDate>Wed, 28 Oct 2009 13:00:49 +0000</pubDate>
		<dc:creator>climens</dc:creator>
				<category><![CDATA[Programming]]></category>

		<guid isPermaLink="false">http://codelog.climens.net/?p=234</guid>
		<description><![CDATA[After some research, I posted a question at stackoverflow.com without much success, but the problem was that the answer was already there. I you are working on any application that needs to serve files on it&#8217;s own, for example for encrypted storage or a rich ACL that needs to be enforced, you will need to [...]]]></description>
			<content:encoded><![CDATA[<div class="socialize-in-content" style="float:left;"><div class="socialize-in-button socialize-in-button-left"><g:plusone size="tall" href="http://codelog.climens.net/2009/10/28/getting-mime-type-in-net-from-file-extension/"></g:plusone></div><div class="socialize-in-button socialize-in-button-left"><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://codelog.climens.net/2009/10/28/getting-mime-type-in-net-from-file-extension/" data-text="Getting MIME type in .NET from file extension" data-count="vertical" data-via="socializeWP" ><!--Tweetter--></a></div><div class="socialize-in-button socialize-in-button-left"><iframe src="http://www.facebook.com/plugins/like.php?href=http://codelog.climens.net/2009/10/28/getting-mime-type-in-net-from-file-extension/&amp;layout=box_count&amp;show_faces=true&amp;width=80&amp;action=like&amp;font=arial&amp;colorscheme=light&amp;height=65" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:80px !important; height:65px;" allowTransparency="true"></iframe></div></div><p>After some research, I <a href="http://stackoverflow.com/questions/1612767/file-extensions-and-mime-types-in-net">posted a question</a> at <a href="http://stackoverflow.com/">stackoverflow.com</a> without much success, but the problem was that the answer was already there.<br />
I you are working on any application that needs to serve files on it&#8217;s own, for example for encrypted storage or a rich ACL that needs to be enforced, you will need to provide <strong>the most correct Content-Type possible or MIME type from a given file extension</strong> to the reponse in order to achieve the best user experience.<br />
For example, if you serve a PDF and use a generic MIME like application/octet-stream, the user may not se a PDF reader to open it, depending on the browser and platform.<br />
Then, in .NET there are 4 alternatives to do this, with their pros and their cons:</p>
<ol>
<li><strong>Use <a href="http://stackoverflow.com/questions/1029740/get-a-mime-from-an-extention/1029796#1029796">the Windows registry</a></strong> &#8211; This may be a good solution for desktop applications but depends on the software installed on the machine and typically web servers don&#8217;t have Acrobat or Office.</li>
<li><strong>Use <a href="http://stackoverflow.com/questions/58510/using-net-how-can-you-find-the-mime-type-of-a-file-based-on-the-file-signature/58570#58570">urlmon.dll&#8217;s FindMimeFromData</a></strong> &#8211; I don&#8217;t know exactly the efectiveness of this method, but it&#8217;s used internally by Windows. It should give good and reliable information but you have to read the file and give the method up to 256 bytes of the file header.</li>
<li>Use <a href="http://stackoverflow.com/questions/174888/asp-net-iis6-how-to-search-the-servers-mime-map/174988#174988">IIS information</a> &#8211; Maybe the most obscure mechanism, based on Directory Services and COM stuff. It&#8217;s based on the same mechanism IIS uses, so it should be quite reliable, but complex and may not be the fastest.</li>
<li>Use your own dictionary &#8211; Maybe not the most elegant but even .NET uses this internally (see System.Web.MimeMapping&#8230; <a href="http://www.red-gate.com/products/reflector/">you know how</a>). You get a bunch of types <a href="http://svn.apache.org/repos/asf/httpd/httpd/trunk/docs/conf/mime.types">from somewhere</a> and add them to a dictionary with the associated extension. Easy.</li>
</ol>
<p>So, the optiones are clear. Finally in my case, I used a simple dictionary to ensure compatibility between platforms and homogeneity. Using other mechanisms could lead to strange errors on some platforms that I wanted to avoid over other benefits. But there are <a href="http://stackoverflow.com/questions/1612767/file-extensions-and-mime-types-in-net/1623612#1623612">much more elaborate mechanisms</a> that can be done.</p>
]]></content:encoded>
			<wfw:commentRss>http://codelog.climens.net/2009/10/28/getting-mime-type-in-net-from-file-extension/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

