<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><!-- generator="wordpress/2.2.1" --><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/" version="2.0">

<channel>
	<title>IProgrammable</title>
	<link>http://www.iprogrammable.com</link>
	<description>Kawalerowicz Consulting News</description>
	<pubDate>Fri, 16 Apr 2010 14:32:00 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.1</generator>
	<language>en</language>
			<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/Iprogrammable" /><feedburner:info xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" uri="iprogrammable" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Continuous Integration in .NET book MEAP update</title>
		<link>http://www.iprogrammable.com/2010_01_21/continuous-integration-in-net-book-meap-update/en/</link>
		<comments>http://www.iprogrammable.com/2010_01_21/continuous-integration-in-net-book-meap-update/en/#comments</comments>
		<pubDate>Thu, 21 Jan 2010 16:11:00 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2010_01_21/continuous-integration-in-net-book-meap-update/</guid>
		<description><![CDATA[ There are two new chapters available at Manning MEAP site. The third one about build process automation (with MSBuild) and the forth one about choosing the right CI server (covering CCNet, TeamCity and TFS 2010).
And wow the book is third on this weeks bestselling early access titles. Juhu!
]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iprogrammable.com/wp-content/uploads/2010/01/image2.png"><img style="border-bottom: 0px; border-left: 0px; margin: 0px 0px 0px 5px; display: inline; border-top: 0px; border-right: 0px" title="image" border="0" alt="image" align="right" src="http://www.iprogrammable.com/wp-content/uploads/2010/01/image-thumb2.png" width="244" height="220" /></a> There are two new chapters available at <a href="http://www.manning.com/kawalerowicz/">Manning MEAP site</a>. The third one about build process automation (with MSBuild) and the forth one about choosing the right CI server (covering CCNet, TeamCity and TFS 2010).</p>
<p>And wow the book is third on this weeks bestselling early access titles. Juhu!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2010_01_21/continuous-integration-in-net-book-meap-update/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Speaking about continuous integration</title>
		<link>http://www.iprogrammable.com/2010_01_16/speaking-about-continuous-integration/en/</link>
		<comments>http://www.iprogrammable.com/2010_01_16/speaking-about-continuous-integration/en/#comments</comments>
		<pubDate>Sat, 16 Jan 2010 17:09:55 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Continuous Integration]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2010_01_16/speaking-about-continuous-integration/</guid>
		<description><![CDATA[ I will be speaking on Wednesday (20.01.2010) in Krakow, Poland at the Karkow .NET Developers Group meeting. The session is about Continuous Integration in .NET. So if you like hear what I have to say about CI meet me at ABB ISDC, Pałac Pugetow, ul. Starowislna 13, Krakow at 18:30. I believe the attendance [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iprogrammable.com/wp-content/uploads/2010/01/image.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2010/01/image-thumb.png" style="border: 0px none ; margin: 0px 10px 0px 0px; display: inline" title="image" alt="image" align="left" border="0" height="164" width="164" /></a> I will be speaking on Wednesday (20.01.2010) in Krakow, Poland at the <a href="http://ms-groups.pl/kgd.net/">Karkow .NET Developers Group</a> meeting. The session is about Continuous Integration in .NET. So if you like hear what I have to say about CI meet me at ABB ISDC, Pałac Pugetow, ul. Starowislna 13, Krakow at 18:30. I believe the attendance is free but registration is required. See you in Krakow!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2010_01_16/speaking-about-continuous-integration/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Selenium RC and FitNesse as a service on Windows Server 2008</title>
		<link>http://www.iprogrammable.com/2009_11_07/selenium-rc-and-fitnesse-as-a-service-on-windows-server-2008/en/</link>
		<comments>http://www.iprogrammable.com/2009_11_07/selenium-rc-and-fitnesse-as-a-service-on-windows-server-2008/en/#comments</comments>
		<pubDate>Sat, 07 Nov 2009 20:19:16 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Windows]]></category>

		<category><![CDATA[Continuous Integration]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2009_11_07/selenium-rc-and-fitnesse-as-a-service-on-windows-server-2008/</guid>
		<description><![CDATA[If you are working in a team or running a continuous integration process the most comfortable way to run tools like Selenum RC Server or FitNesse is to install them as a windows service. I was doing this earlier on my old Windows Server 2003 by issuing the  instsrv.exe (to install a service) on srvany.exe [...]]]></description>
			<content:encoded><![CDATA[<p>If you are working in a team or running a continuous integration process the most comfortable way to run tools like Selenum RC Server or FitNesse is to install them as a windows service. I was doing this earlier on my old Windows Server 2003 by issuing the  instsrv.exe (to install a service) on srvany.exe (to run anything) - both from Windows Resource Kit. I had to edit the registry to provide what exactly do I wanted to run (java –jar selenium-server.jar or java –jar fitnesse.jar).</p>
<p>But there is no Windows Resource Kit for 2008. You might use the sc.exe and get the old srvany.exe (with compatibility issues according to Microsoft itself). It would work but why bother when there is a <a href="http://iain.cx/src/nssm/">Non-Sucking Service Manager</a>! All you have to do to install a service with this tool is to download it, issue a</p>
<p>nssm.exe install SeleniumRC</p>
<p>and edit this dialog box:</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2009/11/image.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2009/11/image-thumb.png" style="border: 0px none ; display: inline" title="image" alt="image" border="0" height="175" width="340" /></a></p>
<p>Click Install service and you are done. Selenium RC Server is installed. All you have to do is to start it. Voila!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2009_11_07/selenium-rc-and-fitnesse-as-a-service-on-windows-server-2008/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>How to make CruiseControl.NET accept SSL certificate under Windows Server 2008?</title>
		<link>http://www.iprogrammable.com/2009_10_24/how-to-make-cruisecontrolnet-accept-ssl-certificate-under-windows-server-2008/en/</link>
		<comments>http://www.iprogrammable.com/2009_10_24/how-to-make-cruisecontrolnet-accept-ssl-certificate-under-windows-server-2008/en/#comments</comments>
		<pubDate>Sat, 24 Oct 2009 21:44:42 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Windows]]></category>

		<category><![CDATA[Continuous Integration]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2009_10_24/how-to-make-cruisecontrolnet-accept-ssl-certificate-under-windows-server-2008/</guid>
		<description><![CDATA[If you are running CruiseControl.NET under the Local System account and your SVN server certificate was issued by yourself (or by VisualSVN Server) you will quickly run into trouble. Normally if you run any command on your repository you will get this information:
C:\Program Files\svn\bin&#62;svn log https://your_server/svn/your_repository/trunk &#8211;username username &#8211;password password
Error validating server certificate for &#8216;https://your_server:443&#8242;:
- [...]]]></description>
			<content:encoded><![CDATA[<p>If you are running CruiseControl.NET under the Local System account and your SVN server certificate was issued by yourself (or by VisualSVN Server) you will quickly run into trouble. Normally if you run any command on your repository you will get this information:</p>
<p>C:\Program Files\svn\bin&gt;svn log <a href="https://your_server/svn/your_repository/trunk">https://your_server/svn/your_repository/trunk</a> &#8211;username username &#8211;password password<br />
Error validating server certificate for &#8216;<a href="https://your_server:443':">https://your_server:443&#8242;:</a><br />
- The certificate is not issued by a trusted authority. Use the<br />
fingerprint to validate the certificate manually!<br />
- The certificate hostname does not match.<br />
Certificate information:<br />
- Hostname: your_server<br />
- Valid: from Sat, 26 Sep 2009 17:24:27 GMT until Tue, 24 Sep 2019 17:24:27 GMT</p>
<p>- Issuer: your_server<br />
- Fingerprint: 24:8e:f6:ba:c7:a6:3f:69:32:c0:21:92:64:44:62:fe:2c:bb:b4:69<br />
(R)eject, accept (t)emporarily or accept (p)ermanently?</p>
<p>If you accept you will not be bothered again. But CCNet works as a Windows Service. There is no one to make the decision. How to deal with this issue. Well earlier it was easy enough. You had to use one of the security holes and start cmd.exe in interactive mode wit at command (<a href="http://blog.threenine.co.uk/Posts/tabid/93/EntryId/4/CruiseControl-Accept-SSL-Certificate-Local-System-Account.aspx">look here for more details</a>). But with Windows Server 2008 it is not possible you will simply get this:</p>
<p>C:\Users\Administrator&gt;time<br />
The current time is: 23:31:11.59<br />
Enter the new time:</p>
<p>C:\Users\Administrator&gt;at 22:32 /interactive cmd.exe<br />
Warning: Due to security enhancements, this task will run at the time<br />
expected but not interactively.<br />
Use schtasks.exe utility if interactive task is required (&#8217;schtasks /?&#8217;<br />
for details).<br />
Added a new job with job ID = 1</p>
<p>How to deal with this. There is very easy solution. Set the CruiseContril.NET service “Allow to interact with desktop” flag (Start –&gt; Control Panel –&gt; Administrative Tools –&gt; Services –CruiseControl.NET) like this</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2009/10/image1.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2009/10/image-thumb1.png" style="border: 0px none ; display: inline" title="image" alt="image" border="0" width="218" height="244" /></a></p>
<p>Restart the service and wait a while for this windows to appear:</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2009/10/image2.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2009/10/image-thumb2.png" style="border: 0px none ; display: inline" title="image" alt="image" border="0" width="244" height="123" /></a></p>
<p>Select show me the message.</p>
<p>Voila! You have command line as Local System user available. You can now issue the</p>
<p>C:\Program Files\svn\bin&gt;svn log <a href="https://your_server/svn/your_repository/trunk">https://your_server/svn/your_repository/trunk</a> &#8211;username username &#8211;password password<br />
command and accept the SSL certificate permanently.</p>
<p><img src="http://www.iprogrammable.com/wp-content/uploads/2009/10/image3.png" style="border: 0px none ; display: inline" title="Local Service User Accepting SSL SVN certificate fir CruiseControl.NET server" alt="Local Service User Accepting SSL SVN certificate fir CruiseControl.NET server" border="0" width="244" height="186" /></p>
<p>From this time on you CCNet server will not have any problems with accessing your secured repository.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2009_10_24/how-to-make-cruisecontrolnet-accept-ssl-certificate-under-windows-server-2008/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Buy Continuous Integration in .NET book</title>
		<link>http://www.iprogrammable.com/2009_10_19/buy-continuous-integration-in-net-book/en/</link>
		<comments>http://www.iprogrammable.com/2009_10_19/buy-continuous-integration-in-net-book/en/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 05:52:50 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Continuous Integration]]></category>

		<category><![CDATA[Books]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2009_10_19/buy-continuous-integration-in-net-book/</guid>
		<description><![CDATA[
The Continuous Integration in .NET book is available as an early access edition from MEAP. For those of you that are not familiar with MEAP it stands for Manning Early Access Program and it is the place where you can download a free chapter and buy the whole book printed or as an ebook before [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iprogrammable.com/wp-content/uploads/2009/10/image.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2009/10/image-thumb.png" style="border: 0px none ; margin: 0px 5px 0px 0px; display: inline" title="Continuous Integration in .NET book cover" alt="Continuous Integration in .NET book cover" align="left" border="0" width="150" height="187" /></a></p>
<p>The Continuous Integration in .NET book is available as an <a href="http://www.manning.com/kawalerowicz/">early access edition from MEAP</a>. For those of you that are not familiar with MEAP it stands for Manning Early Access Program and it is the place where you can download a free chapter and buy the whole book printed or as an ebook before it gets published. You will get continuously chapter after chapter successively as they will be written.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2009_10_19/buy-continuous-integration-in-net-book/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Get Oracle stored procedure object output in NHibernate</title>
		<link>http://www.iprogrammable.com/2009_09_05/get-oracle-stored-procedure-output-object-output-in-nhibernate/en/</link>
		<comments>http://www.iprogrammable.com/2009_09_05/get-oracle-stored-procedure-output-object-output-in-nhibernate/en/#comments</comments>
		<pubDate>Sat, 05 Sep 2009 15:24:34 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Oracle]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2009_09_05/get-oracle-stored-procedure-output-object-output-in-nhibernate/</guid>
		<description><![CDATA[I’ve wasted view hours on this so I think I share in case you have a similar problem.
We are working with Oracle Database and .NET project using NHibernate as a object-relation mapper. We have a function in Oracle that returns an Oracle Object. Objects in Oracle are user defined types. They are defined like this:
CREATE [...]]]></description>
			<content:encoded><![CDATA[<p>I’ve wasted view hours on this so I think I share in case you have a similar problem.</p>
<p>We are working with Oracle Database and .NET project using NHibernate as a object-relation mapper. We have a function in Oracle that returns an Oracle Object. Objects in Oracle are user defined types. They are defined like this:</p>
<blockquote><p>CREATE OR REPLACE TYPE Foo as object(<br />
Value1 number,<br />
Value2 date,<br />
Value3 varchar(10)<br />
);</p></blockquote>
<p>And now Oracle Function with signature like this:</p>
<blockquote><p>CREATE OR REPLACE FUNCTION Bar (id int)<br />
return Foo pipelined</p></blockquote>
<p>This function returns a Foo object and gets the id key from a table VT (some table). The 3 values from Foo object should extend an NHibernate VT object. So I want to have 3 new properties in the NHibernate entity.</p>
<p>Sound easy? Well it wasn&#8217;t for me. At first how to get the values? You can get an instance of IDBConnection down from NHibernate context and fight your way with ordinary ADO.NET (which is not so easy for functions with user defined return values – at least I don’t know how to do this). But you can use a TABLE() function of Oracle. You can issue this SQL select statement:</p>
<blockquote><p>select * from Table(Bar(1))</p></blockquote>
<p>It will return a result set as a table you can select from. Cool stuff! But to use it you have to know it exists ;)</p>
<p>Ok, now the easy part. I though. I define a property in NHibernate with a formula attribute and I will map this on a property in my class. Something like this:</p>
<pre class="code"><span style="color: blue">&lt;</span><span style="color: #a31515">property
  </span><span style="color: red">name</span><span style="color: blue">=</span>&#8220;<font color="#0000ff">Value1</font>&#8221;
  <span style="color: red">type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Int64</span>&#8221;
  <span style="color: red">formula</span><span style="color: blue">=</span>&#8220;(<span style="color: blue">select Value1</span><span style="color: red"> </span><span style="color: blue">from Table(Bar(id)))</span>&#8220;<span style="color: blue">&gt;
&lt;/</span><span style="color: #a31515">property</span><span style="color: blue">&gt;</span></pre>
<p>Not so easy! If you do this you will get the Oracle exception. NHibernate thinks that Value1 from your formula is a part of NHibernate object and gives it a suffix. It is transformed to something like that:</p>
<p>select _vt0.Value1 from Table(Bar(4711))</p>
<p>_vt0 being the object alias. It is obviously not the case. There is no Value1 field physically in the database. There is a custom made property with SQL formula in NHibernate. As you can se the id was translated to actual key in the table.</p>
<p>The general rule for the formula attribute is everything tat NHibernate does not understand is send direct to database as is. The trick was to make NHibernate think it does not understands the statement completely.</p>
<p>The answer is to enclose Value1 with quotation marks. To achieve this you will have to use the XML escape marks. Just like this:</p>
<pre class="code">    <span style="color: blue">&lt;</span><span style="color: #a31515">property
      </span><span style="color: red">name</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Value1</span>&#8221;
      <span style="color: red">type</span><span style="color: blue">=</span>&#8220;<span style="color: blue">Int64</span>&#8221;
      <span style="color: red">formula</span><span style="color: blue">=</span>&#8220;<span style="color: blue">(select </span><span style="color: red">&#8220;</span><span style="color: blue">Value1</span><span style="color: red">&#8221; </span><span style="color: blue">from Table(Bar(id)))</span>&#8220;<span style="color: blue">&gt;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>A lot of tiny puzzles to put together. But it works!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2009_09_05/get-oracle-stored-procedure-output-object-output-in-nhibernate/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Next big thing – continuous integration book</title>
		<link>http://www.iprogrammable.com/2009_08_14/next-big-thing-continuous-integration-book/en/</link>
		<comments>http://www.iprogrammable.com/2009_08_14/next-big-thing-continuous-integration-book/en/#comments</comments>
		<pubDate>Fri, 14 Aug 2009 19:39:59 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Continuous Integration]]></category>

		<category><![CDATA[Books]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2009_08_14/next-big-thing-continuous-integration-book/</guid>
		<description><![CDATA[ I’m going to write a book about Continuous Integration in .NET for the Manning Publications. I’m sure I don’t have to tell you how exited am I. I will join the noble team of Manning authors like John Skeet, Ayende Rahien or Roy Osherove. I’ll keep you posted about the progress. In the mean [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iprogrammable.com/wp-content/uploads/2009/08/image.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2009/08/image-thumb.png" style="border: 0px none ; margin: 0px 10px 0px 0px; display: inline" title="image" alt="image" align="left" border="0" height="72" width="262" /></a> I’m going to write a book about Continuous Integration in .NET for the <a href="http://www.manning.com/">Manning Publications</a>. I’m sure I don’t have to tell you how exited am I. I will join the noble team of Manning authors like <a href="http://www.amazon.com/Depth-What-you-need-master/dp/1933988363/ref=sr_1_1?ie=UTF8&amp;qid=1250278049&amp;sr=8-1">John Skeet</a>, <a href="http://www.amazon.com/Building-Domain-Specific-Languages-Boo/dp/1933988606/ref=sr_1_1?ie=UTF8&amp;qid=1250278074&amp;sr=8-1">Ayende Rahien</a> or <a href="http://www.amazon.com/Art-Unit-Testing-Examples-NET/dp/1933988274/ref=sr_1_1?ie=UTF8&amp;qid=1250278097&amp;sr=8-1">Roy Osherove</a>. I’ll keep you posted about the progress. In the mean time let me give you some history.</p>
<p>I’ve once written an article for Software Developers Journal about Continuous Integration in .NET. It was very well received. I always thought I have a lot more to say in this topic. The idea to write a book came while speaking with my good friend hsd (well I have more and more to thank you for :). I’ve tried to propose the book to a polish publisher <a href="http://helion.pl/">Helion</a>. Very fortunately for me they said there is not enough place on the polish marketplace to get enough sell (<a href="http://www.iprogrammable.com/2009_05_03/ksiazka-o-continuous-integration/pl/">I’ve blogged about this in polish</a>). I presume they know better. I’ve already buried the idea about the book when I saw the <a href="http://www.amazon.com/ASP-NET-MVC-Quickly-Maarten-Balliauw/dp/184719754X">ASP.NET MVC 1.0 Quickly</a> book from <a href="http://www.packtpub.com/">Packt Publication</a>. It was written by a guy from Belgium (Maarten Balliauw). I’ve read his blog and I realized has not native English speaker. “If he can, why not to try myself?” I thought and written a short proposal for Packt. They were interested! I’ve worked on the proposal with the Acquisition Editor and I’ve shortly after that I’ve got the information that the book was “committed”. I was very, very happy until something went wrong at Packt (the went scared by a download stats of one of the tools I wanted to write about). The book was “uncommitted” and we didn’t sign the agreement. I don’t throw my hands up! I thought if they are interested probably someone else will be too. I’ve send view more proposals to other publishers and the Manning appeared. In the mean time Packt turned to be after all interested in me writing the book. The Acquisition Editor at Packt Publishing was a great guy. I’m sure it would be great to write a book for them but it was to late. Manning found me a co-writer <a href="http://www.craigberntson.com/">Craig Berntson</a>. Someone that speaks English a lot better than I and has a know how in continuous integration. The way the Manning deals with his authors seems very provisional and I’ve very glad to get this opportunity.</p>
<p>So be aware. The best Continuous Integration in .NET book comes sooner than you expected!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2009_08_14/next-big-thing-continuous-integration-book/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>ASP.NET MVC custom binder for currency</title>
		<link>http://www.iprogrammable.com/2009_06_24/aspnet-mvc-custom-binder-for-currency/en/</link>
		<comments>http://www.iprogrammable.com/2009_06_24/aspnet-mvc-custom-binder-for-currency/en/#comments</comments>
		<pubDate>Wed, 24 Jun 2009 06:05:41 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[ASP.NET MVC]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2009_06_24/aspnet-mvc-custom-binder-for-currency/</guid>
		<description><![CDATA[I can imagine that&#8217;s quite common problem. You have a double (or better decimal) value that you want to show formatted as a currency field. Lets assume we are storing the price data in an object like this:
public class TestModel
{
    public double NumberField
    {
      [...]]]></description>
			<content:encoded><![CDATA[<p>I can imagine that&#8217;s quite common problem. You have a double (or better decimal) value that you want to show formatted as a currency field. Lets assume we are storing the price data in an object like this:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">TestModel
</span>{
    <span style="color: blue">public double </span>NumberField
    {
        <span style="color: blue">get</span>;
        <span style="color: blue">set</span>;
    }

    <span style="color: blue">public double </span>CurrencyField
    {
        <span style="color: blue">get</span>;
        <span style="color: blue">set</span>;
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a><a href="http://11011.net/software/vspaste"></a></p>
<p>The MVC view is strongly typed with this <span style="color: #2b91af">TestModel</span>. And the view model value is formatted like this:</p>
<p><span style="background: #ffee62 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">&lt;%</span><span style="color: blue">=</span>Html.TextBox(<span style="color: #a31515">&#8220;NumberField&#8221;</span>, Model.NumberField)<span style="background: #ffee62 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">%&gt;</p>
<p></span><span style="background: #ffee62 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">&lt;%</span><span style="color: blue">=</span>Html.TextBox(<span style="color: #a31515">&#8220;CurrencyField&#8221;</span>, Model.CurrencyField.ToString(<span style="color: #a31515">&#8220;c&#8221;</span>))<span style="background: #ffee62 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">%&gt;</span></p>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>If you set the current culture to German-Swiss, for example in (base)controller like that:</p>
<pre class="code"><span style="color: blue">protected override void </span>Initialize(System.Web.Routing.<span style="color: #2b91af">RequestContext </span>requestContext)
{
    <span style="color: blue">base</span>.Initialize(requestContext);

    <span style="color: blue">string </span>culture = <span style="color: #a31515">&#8220;de-CH&#8221;</span>;

    <span style="color: #2b91af">CultureInfo </span>ci = <span style="color: #2b91af">CultureInfo</span>.GetCultureInfo(culture);

    <span style="color: #2b91af">Thread</span>.CurrentThread.CurrentCulture = ci;
    <span style="color: #2b91af">Thread</span>.CurrentThread.CurrentUICulture = ci;
}</pre>
<p>Done so we will get a text boxes looking like this:</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2009/06/image.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2009/06/image-thumb.png" title="image" style="border-width: 0px; display: inline" alt="image" border="0" height="51" width="212" /></a></p>
<p>What will happen if you use a default binder to get this value? The default binder will try to parse the string as a double value and get an ModelState error. The string does not represent a double value.</p>
<p>To deal with this issue we have to write our own model binder. This can be done by implementing the <span style="color: #2b91af">IModelBinder</span>. But I don’t want to reimplement this how <span style="color: #2b91af">DefaultModelBinder </span>reads other values than my currency doubles. So I though I will set a special attribute to the “special” properties. Something like this:</p>
<pre class="code">[<span style="color: #2b91af">AttributeUsage</span>(<span style="color: #2b91af">AttributeTargets</span>.Property)]
<span style="color: blue">public class </span><span style="color: #2b91af">CurrencyAttribute </span>: <span style="color: #2b91af">Attribute
</span>{
}</pre>
<p>And my object:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">TestModel
</span>{
    <span style="color: blue">public double </span>NumberField
    {
        <span style="color: blue">get</span>;
        <span style="color: blue">set</span>;
    }

    [<span style="color: #2b91af">Currency</span>]
    <span style="color: blue">public double </span>CurrencyField
    {
        <span style="color: blue">get</span>;
        <span style="color: blue">set</span>;
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>And now we can overload the <span style="color: #2b91af">DefaultModelBinder </span>and implement our <span style="color: #2b91af">TestModelBinder </span>like this:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">TestModelBinder </span>: <span style="color: #2b91af">DefaultModelBinder
    </span>{
        <span style="color: blue">public override object </span>BindModel(<span style="color: #2b91af">ControllerContext </span>controllerContext,
            <span style="color: #2b91af">ModelBindingContext </span>bindingContext)
        {
            <span style="color: blue">object </span>bindingObject = <span style="color: blue">base</span>.BindModel(controllerContext,
                bindingContext);

            <span style="color: blue">foreach </span>(System.Reflection.<span style="color: #2b91af">PropertyInfo </span>propInfo
                <span style="color: blue">in </span>bindingObject.GetType().GetProperties())
            {
                <span style="color: blue">object</span>[] attributes =
                    propInfo.GetCustomAttributes(<span style="color: blue">typeof</span>(<span style="color: #2b91af">CurrencyAttribute</span>), <span style="color: blue">false</span>);

                <span style="color: blue">foreach </span>(<span style="color: blue">object </span>attribute <span style="color: blue">in </span>attributes)
                {
                    <span style="color: #2b91af">CurrencyAttribute </span>currAtt = attribute <span style="color: blue">as </span><span style="color: #2b91af">CurrencyAttribute</span>;

                    <span style="color: blue">if </span>(currAtt != <span style="color: blue">null</span>)
                    {
                        bindingContext.ModelState[propInfo.Name].Errors.Clear();

                        <span style="color: blue">string </span>attempted =
                            bindingContext.ValueProvider[propInfo.Name].AttemptedValue;
                        <span style="color: #2b91af">CultureInfo </span>ci =
                            bindingContext.ValueProvider[propInfo.Name].Culture;

                        propInfo.SetValue(
                            bindingObject,
                            <span style="color: blue">double</span>.Parse(attempted, <span style="color: #2b91af">NumberStyles</span>.Currency, ci),
                            <span style="color: blue">null</span>);

                    }
                }
            }

            <span style="color: blue">return </span>bindingObject;
        }
    }</pre>
<p><a href="http://11011.net/software/vspaste"></a>And now we have to set the attribute to our object to tell MVC that it has to use your binder.</p>
<pre class="code">[<span style="color: #2b91af">ModelBinder</span>(<span style="color: blue">typeof</span>(<span style="color: #2b91af">TestModelBinder</span>))]
<span style="color: blue">public class </span><span style="color: #2b91af">TestModel
</span>{
    <span style="color: blue">public double </span>NumberField
    {
        <span style="color: blue">get</span>;
        <span style="color: blue">set</span>;
    }

    [<span style="color: #2b91af">Currency</span>]
    <span style="color: blue">public double </span>CurrencyField
    {
        <span style="color: blue">get</span>;
        <span style="color: blue">set</span>;
    }
}</pre>
<p><a href="http://11011.net/software/vspaste"></a>Done! Although there are a view issues with this solution (if you are using Entity Framework you cannot set custom attributes, and in the binder above you will have to implement checking if the field is present on the view), but you get the general idea!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2009_06_24/aspnet-mvc-custom-binder-for-currency/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Easiest way to have 2 submit button in one html form</title>
		<link>http://www.iprogrammable.com/2009_06_12/easiest-way-to-have-2-submit-button-in-one-html-form/en/</link>
		<comments>http://www.iprogrammable.com/2009_06_12/easiest-way-to-have-2-submit-button-in-one-html-form/en/#comments</comments>
		<pubDate>Fri, 12 Jun 2009 14:41:05 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[JavaScript]]></category>

		<category><![CDATA[DHTML]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2009_06_12/easiest-way-to-have-2-submit-button-in-one-html-form/</guid>
		<description><![CDATA[Here is the easiest way to have two (or more) submit buttons in one html form and to make them “do” something else. It is very helpful if you are planning to implement a toolbar like behavior. Example is from ASP.NET MVC but it does not matter. Since it uses JavaScript to dynamically change the [...]]]></description>
			<content:encoded><![CDATA[<p>Here is the easiest way to have two (or more) submit buttons in one html form and to make them “do” something else. It is very helpful if you are planning to implement a toolbar like behavior. Example is from ASP.NET MVC but it does not matter. Since it uses JavaScript to dynamically change the action attribute of a form tag, it can be used everywhere. Here it is:</p>
<pre class="code">    <span style="color: blue">&lt;</span><span style="color: #a31515">h2</span><span style="color: blue">&gt;</span><span style="background: #ffee62 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">&lt;%</span><span style="color: blue">= </span>Html.Encode(ViewData[<span style="color: #a31515">&#8220;Message&#8221;</span>]) <span style="background: #ffee62 none repeat scroll 0% 0%; -moz-background-clip: -moz-initial; -moz-background-origin: -moz-initial; -moz-background-inline-policy: -moz-initial">%&gt;</span><span style="color: blue">&lt;/</span><span style="color: #a31515">h2</span><span style="color: blue">&gt;

    &lt;</span><span style="color: #a31515">script </span><span style="color: red">language</span><span style="color: blue">=&#8221;javascript&#8221; </span><span style="color: red">type</span><span style="color: blue">=&#8221;text/javascript&#8221;&gt;
        function </span>ChangeFormAction(sender, url) {
            sender.form.action = url;
        }
    <span style="color: blue">&lt;/</span><span style="color: #a31515">script</span><span style="color: blue">&gt;

    &lt;</span><span style="color: #a31515">form </span><span style="color: red">method</span><span style="color: blue">=&#8221;post&#8221;&gt;
        &lt;</span><span style="color: #a31515">input </span><span style="color: red">id</span><span style="color: blue">=&#8221;text&#8221; </span><span style="color: red">name</span><span style="color: blue">=&#8221;text&#8221; </span><span style="color: red">type</span><span style="color: blue">=&#8221;text&#8221; </span><span style="color: red">value</span><span style="color: blue">=&#8221;Hello from Action&#8221; /&gt;
        &lt;</span><span style="color: #a31515">br </span><span style="color: blue">/&gt;
        &lt;</span><span style="color: #a31515">input </span><span style="color: red">type</span><span style="color: blue">=&#8221;submit&#8221; </span><span style="color: red">value</span><span style="color: blue">=&#8221;Go to action 1&#8243;
            </span><span style="color: red">onclick</span><span style="color: blue">=&#8221;ChangeFormAction(this, &#8216;/Home/Action1&#8242;)&#8221; /&gt;
        &lt;</span><span style="color: #a31515">input </span><span style="color: red">type</span><span style="color: blue">=&#8221;submit&#8221; </span><span style="color: red">value</span><span style="color: blue">=&#8221;Go to action 2&#8243;
            </span><span style="color: red">onclick</span><span style="color: blue">=&#8221;ChangeFormAction(this, &#8216;/Home/Action2&#8242;)&#8221; /&gt;
    &lt;/</span><span style="color: #a31515">form</span><span style="color: blue">&gt;
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>And the actions that responds to this form are here:</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: #2b91af">HomeController </span>: <span style="color: #2b91af">Controller
</span>{
    <span style="color: blue">public </span><span style="color: #2b91af">ActionResult </span>Action1(<span style="color: blue">string </span>text)
    {
        ViewData[<span style="color: #a31515">&#8220;Message&#8221;</span>] = text + <span style="color: #a31515">&#8220;1&#8243;</span>;

        <span style="color: blue">return </span>View(<span style="color: #a31515">&#8220;Index&#8221;</span>);
    }

    <span style="color: blue">public </span><span style="color: #2b91af">ActionResult </span>Action2(<span style="color: blue">string </span>text)
    {
        ViewData[<span style="color: #a31515">&#8220;Message&#8221;</span>] = text + <span style="color: #a31515">&#8220;2&#8243;</span>;

        <span style="color: blue">return </span>View(<span style="color: #a31515">&#8220;Index&#8221;</span>);
    }
}</pre>
<pre class="code"><font face="Trebuchet MS">Nice!</font></pre>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2009_06_12/easiest-way-to-have-2-submit-button-in-one-html-form/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Keep your lib folder up to date</title>
		<link>http://www.iprogrammable.com/2009_02_09/keep-your-lib-folder-up-to-date/en/</link>
		<comments>http://www.iprogrammable.com/2009_02_09/keep-your-lib-folder-up-to-date/en/#comments</comments>
		<pubDate>Mon, 09 Feb 2009 20:22:58 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[NUnit]]></category>

		<category><![CDATA[SVN]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2009_02_09/keep-your-lib-folder-up-to-date/</guid>
		<description><![CDATA[I’m keeping all the 3rd party assemblies that I use in my .NET projects in a separate library folder called lib. It is a part of my Subversion repository. In most of my project it is placed in linked repository (with svn:externals property). It lets my check out the whole project on any machine I [...]]]></description>
			<content:encoded><![CDATA[<p>I’m keeping all the 3rd party assemblies that I use in my .NET projects in a separate library folder called <em>lib</em>. It is a part of my Subversion repository. In most of my project it is placed in linked repository (with svn:externals property). It lets my check out the whole project on any machine I like and it compiles right away.</p>
<p>But be aware! In such scenario (and, well… in any other scenario as well) you have to keep your lib up to date. Take a look at this nasty bug. I was using the NUnit version 2.4.6.0</p>
<p>Take a look at this test method:</p>
<pre class="code">[NUnit.Framework.<span style="color: #2b91af">Test</span>]
<span style="color: blue">public void </span>Test()
{
    System.Text.<span style="color: #2b91af">ASCIIEncoding </span>ASCIIEncoding = <span style="color: blue">new </span>System.Text.<span style="color: #2b91af">ASCIIEncoding</span>();

    <span style="color: blue">string </span>str1 = <span style="color: #a31515">&#8220;abc&#8221;</span>;

    <span style="color: blue">byte</span>[] array = ASCIIEncoding.GetBytes(str1.ToCharArray());

    System.<span style="color: #2b91af">Array</span>.Resize&lt;<span style="color: blue">byte</span>&gt;(<span style="color: blue">ref </span>array, 10);

    <span style="color: blue">string </span>str2 = ASCIIEncoding.GetString(array);

    NUnit.Framework.<span style="color: #2b91af">Assert</span>.AreEqual(str1, str2);
}</pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>What would you expect?</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2009/02/image.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2009/02/image-thumb.png" title="image" style="border: 0px none ; display: inline" alt="image" border="0" height="78" width="393" /></a></p>
<p>Fail! Isn’t it?</p>
<p>No! 1 passed, 0 failed, 0 skipped, took 0,54 seconds.</p>
<p>Even NUnit hast bugs to! I’ve updated to the newest version and it works as a charm! So keep you <em>lib</em> folder up to date!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2009_02_09/keep-your-lib-folder-up-to-date/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>How to associate a file extension with a given file?</title>
		<link>http://www.iprogrammable.com/2009_01_12/how-to-associate-a-file-extension-with-a-given-file/en/</link>
		<comments>http://www.iprogrammable.com/2009_01_12/how-to-associate-a-file-extension-with-a-given-file/en/#comments</comments>
		<pubDate>Mon, 12 Jan 2009 19:25:59 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Windows]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2009_01_12/how-to-associate-a-file-extension-with-a-given-file/</guid>
		<description><![CDATA[(Windows) You can edit a file type in Explorer (XP: Tools –&#62; Folder options, Vista: Start –&#62; Default Programs). But lets say you want to do it automatically and you have to set an additional parameter to the program you want to start (I have still not figured it out how to define such parameter [...]]]></description>
			<content:encoded><![CDATA[<p>(Windows) You can edit a file type in Explorer (XP: Tools –&gt; Folder options, Vista: Start –&gt; Default Programs). But lets say you want to do it automatically and you have to set an additional parameter to the program you want to start (I have still not figured it out how to define such parameter under Vista). The easiest way is to create a file with *.reg extension that contains this script:</p>
<pre><a href="http://www.iprogrammable.com/wp-content/uploads/2009/01/image.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2009/01/image-thumb.png" title="image" style="border: 0px none ; display: inline" alt="image" border="0" height="257" width="413" /></a></pre>
<p>Red (<font color="#ff0000">cicstarter</font>) – Schell command name</p>
<p>Blue (<font color="#0000ff">startf</font>) – Action name</p>
<p>Brown (<font color="#804000">cicvlm.exe f=\&#8221;%1\&#8221;</font>) – Application path (parameter inside f=)</p>
<p>Green (<font color="#008000">.cic</font>) – File extension</p>
<p>You can manipulate the colored parts to feet your needs. <a href="http://www.iprogrammable.com/wp-content/uploads/2009/01/register_cic.zip" title="Register file extension type">Here is the script</a>. Good luck!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2009_01_12/how-to-associate-a-file-extension-with-a-given-file/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>SQL from Linq to Entity Framework</title>
		<link>http://www.iprogrammable.com/2008_11_27/sql-from-linq-to-entity-framework/en/</link>
		<comments>http://www.iprogrammable.com/2008_11_27/sql-from-linq-to-entity-framework/en/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 06:49:03 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Oracle]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_11_27/sql-from-linq-to-entity-framework/</guid>
		<description><![CDATA[Problem: how do I tell what SQL does Linq to Entity Framework generates?
If you are using SQL Server its easy. You start the SQL Profiler and you are done. If you are using Oracle the task is not so easy. You can:
1. start the trace on the Oracle server and get the huge barely readable [...]]]></description>
			<content:encoded><![CDATA[<p>Problem: how do I tell what SQL does Linq to Entity Framework generates?</p>
<p>If you are using SQL Server its easy. You start the <a href="http://msdn.microsoft.com/en-us/library/ms181091.aspx">SQL Profiler</a> and you are done. If you are using Oracle the task is not so easy. You can:</p>
<p>1. start the trace on the Oracle server and get the huge barely readable text file physically on the server and use <a href="http://download-west.oracle.com/docs/cd/B10501_01/server.920/a96533/sqltrace.htm#1018">TKPROF</a></p>
<p>2. look up the lat SQL query from session using the Enterprise Manager-Konsole</p>
<p>3. buy a 3rd party tool like <a href="http://www.easymatica.com/flextracer/">FlexTracer</a> to trace the OCI communication.</p>
<p>Well yeah! Not fun.</p>
<p>But there is another option inside Entity Framework itself! It is not quite obvious, so it took me a little to figure it out:</p>
<p>((System.Data.Objects.ObjectQuery)Query).ToTraceString()</p>
<p>where Query is something like System.Linq.IQueryable&lt;T&gt;.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2008_11_27/sql-from-linq-to-entity-framework/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Everyone is entitled to broad opinion</title>
		<link>http://www.iprogrammable.com/2008_10_26/everyone-is-entitled-to-broad-opinion/en/</link>
		<comments>http://www.iprogrammable.com/2008_10_26/everyone-is-entitled-to-broad-opinion/en/#comments</comments>
		<pubDate>Sun, 26 Oct 2008 18:18:58 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_10_26/everyone-is-entitled-to-broad-opinion/</guid>
		<description><![CDATA[I had an interesting dispute with my colleague weather to use only qualified type names in code or not. He insisted that we should not use the using directive to introduce a namespace but to write the fully qualified name every time it is necessary. I had quite opposite opinion but I agreed to give [...]]]></description>
			<content:encoded><![CDATA[<p>I had an interesting dispute with my colleague weather to use only qualified type names in code or not. He insisted that we should not use the using directive to introduce a namespace but to write the fully qualified name every time it is necessary. I had quite opposite opinion but I agreed to give it a try. So I started to write</p>
<pre class="code"><span style="color: blue">public class </span><span style="color: black">MyClass
{
    </span><span style="color: blue">public static void </span><span style="color: black">Main()
    {
        System.Console.WriteLine(</span><span style="color: maroon">&#8220;Foo&#8221;</span><span style="color: black">);
    }
}
</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>instead of</p>
<pre class="code"><span style="color: blue">using </span><span style="color: black">System;
</span><span style="color: blue">public class </span><span style="color: black">MyClass
{
    </span><span style="color: blue">public static void </span><span style="color: black">Main()
    {
        Console.WriteLine(</span><span style="color: maroon">&#8220;Foo&#8221;</span><span style="color: black">);
    }
}</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Unfortunately over time it proofed no value to me. I was not happy with this rule, but I thought I’ll consult the brother audience for opinion before I start a holly war against something that I might not fully understand.</p>
<p>I decided to give <a href="http://stackoverflow.com/questions/214825/should-i-agree-to-ban-the-using-directive-from-my-c-projects">stackoverflow.com</a> a try. It is quite new Q&amp;A Service dedicated specially for software developers. I write my question I was given a flood of answers. Some better, some worse. Some hitting the bottom line, some pouring “divine knowledge” of individuals that think they know things better.</p>
<p>Nevertheless the discussion on <a href="http://stackoverflow.com/">stackoverflow.com</a> helped my back my opinion. Give it a try!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2008_10_26/everyone-is-entitled-to-broad-opinion/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>MTS 2008, Warsaw, Poland</title>
		<link>http://www.iprogrammable.com/2008_10_12/mts-2008-warsaw-poland/en/</link>
		<comments>http://www.iprogrammable.com/2008_10_12/mts-2008-warsaw-poland/en/#comments</comments>
		<pubDate>Sun, 12 Oct 2008 20:28:31 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_10_12/mts-2008-warsaw-poland/</guid>
		<description><![CDATA[
Microsoft Technology Summit 2008 (8th and 9th November), the biggest  Microsoft technology event in Poland went quite well. It was my first MTS and I was trying not to expect anything special. And indeed I haven’t experienced anything  earth shaking but altogether it was quite interesting and a good investment of time. I surely learned [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/10/image.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/10/image-thumb.png" title="image" style="border: 0px none " alt="image" height="228" width="147" align="right" border="0" /></a></p>
<p>Microsoft Technology Summit 2008 (8th and 9th November), the biggest  Microsoft technology event in Poland went quite well. It was my first MTS and I was trying not to expect anything special. And indeed I haven’t experienced anything  earth shaking but altogether it was quite interesting and a good investment of time. I surely learned a few new things and meet interesting people there. I was astonished by the sheer number of attendees that gathered in there. I presume the old communist “castle” in the center of Warsaw the “Palace of Culture and Science” was the only place to accommodate this whole crowd, but it is not a cushy place. It’s big and cold and far from perfect to host a technology event like that. And well… despite the overwhelming size of this place, you almost have to eat you lunch on the floor, because there was no eno<a href="http://www.iprogrammable.com/wp-content/uploads/2008/10/image1.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/10/image-thumb1.png" title="image" style="border: 0px none ; margin: 0px 10px 0px 0px" alt="image" height="84" width="164" align="left" border="0" /></a>ugh tables ;-)</p>
<p>But I passed the 70-543 Exam there and gained the Microsoft Certified Professional Developer in ASP.NET title. So altogether it was a full success!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2008_10_12/mts-2008-warsaw-poland/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>What null smaller than 0? Adventures with nullable types in .NET</title>
		<link>http://www.iprogrammable.com/2008_09_09/what-null-smaller-than-0-adventures-with-nullable-types-in-net/en/</link>
		<comments>http://www.iprogrammable.com/2008_09_09/what-null-smaller-than-0-adventures-with-nullable-types-in-net/en/#comments</comments>
		<pubDate>Tue, 09 Sep 2008 19:14:36 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_09_09/what-null-smaller-than-0-adventures-with-nullable-types-in-net/</guid>
		<description><![CDATA[Lets say we have two nullable integers like this:
int? i = null;
int? j = 0;

Is null smaller than 0
Console.WriteLine(i &#60; j);

False – no it is not.
So probably null is greater than 0
Console.WriteLine(i &#62; j);

False – no it is not greater as well.
All right! So null is equal 0. It has to be, JIT has no [...]]]></description>
			<content:encoded><![CDATA[<p>Lets say we have two nullable integers like this:</p>
<pre class="code"><span style="color: blue">int</span><span style="color: black">? i = </span><span style="color: blue">null</span><span style="color: black">;
</span><span style="color: blue">int</span><span style="color: black">? j = </span><span style="color: red">0</span><span style="color: black">;</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>Is <span style="color: blue">null</span> smaller than <span style="color: red">0</span></p>
<pre class="code"><span style="color: black">Console.WriteLine(i &lt; j);</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>False – no it is not.</p>
<p>So probably <span style="color: blue">null</span> is greater than <span style="color: red">0</span></p>
<pre class="code"><span style="color: black">Console.WriteLine(i &gt; j);</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p>False – no it is not greater as well.</p>
<p>All right! So <span style="color: blue">null</span> is equal <span style="color: red">0</span>. It has to be, JIT has no other choice, right?</p>
<pre class="code"><span style="color: black">Console.WriteLine(i == j);</span></pre>
<p><a href="http://11011.net/software/vspaste"></a>Well False too! This two little fellows are not equal too. What? Is it raining frogs and we about to experience Armageddon?</p>
<p>No! We have to use Nullable.Compare() and we will by back in normal world:</p>
<pre class="code"><span style="color: blue">switch </span><span style="color: black">(Nullable.Compare(i, j))
        {
               </span><span style="color: blue">case </span><span style="color: black">-</span><span style="color: red">1</span><span style="color: black">:
                  Console.WriteLine(&#8221;</span><span style="color: teal">i &lt; j</span><span style="color: black">&#8220;);
              </span><span style="color: blue">break</span><span style="color: black">;
               </span><span style="color: blue">case </span><span style="color: red">1</span><span style="color: black">:
                  Console.WriteLine(&#8221;</span><span style="color: teal">i &gt; j</span><span style="color: black">&#8220;);
              </span><span style="color: blue">break</span><span style="color: black">;
               </span><span style="color: blue">case </span><span style="color: red">0</span><span style="color: black">:
                  Console.WriteLine(&#8221;</span><span style="color: teal">i == j</span><span style="color: black">&#8220;);
              </span><span style="color: blue">break</span><span style="color: black">;
        }</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
<p><span style="color: red">0</span> is a little more than <span style="color: blue">null</span>. <span style="color: blue">null</span> is less than <span style="color: red">0</span>. <span style="color: blue">null</span> equals <span style="color: blue">null</span> and <span style="color: red">0</span> equals <span style="color: red">0</span>.</p>
<p>Uff!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2008_09_09/what-null-smaller-than-0-adventures-with-nullable-types-in-net/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Enum Factory</title>
		<link>http://www.iprogrammable.com/2008_08_10/enum-factory/en/</link>
		<comments>http://www.iprogrammable.com/2008_08_10/enum-factory/en/#comments</comments>
		<pubDate>Sun, 10 Aug 2008 19:16:22 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_08_10/enum-factory/</guid>
		<description><![CDATA[I have a little tip for you. Let’s say you have an enumeration. You need a enumeration constant out of string variable. simply use System.Enum.Parse(). Here a small Snippet Compiler source code.
using System;
using System.Collections.Generic;

public class MyClass
{
    public enum FooBar
    {
        Foo,
  [...]]]></description>
			<content:encoded><![CDATA[<p>I have a little tip for you. Let’s say you have an <a href="http://msdn.microsoft.com/en-us/library/sbbt4032(VS.80).aspx">enumeration</a>. You need a enumeration constant out of string variable. simply use System.Enum.Parse(). Here a small <a href="http://www.sliver.com/dotnet/SnippetCompiler/">Snippet Compiler</a> source code.</p>
<pre class="code"><span style="color: blue">using </span><span style="color: black">System;
</span><span style="color: blue">using </span><span style="color: black">System.Collections.Generic;

</span><span style="color: blue">public class </span><span style="color: black">MyClass
{
    </span><span style="color: blue">public enum </span><span style="color: black">FooBar
    {
        Foo,
        Bar,
        FooBar
    }</span></pre>
<pre class="code"><span style="color: black">
    </span><span style="color: blue">public static void </span><span style="color: black">Main()
    {
        WL(FooBarFactory(&#8221;</span><span style="color: teal">Foo</span><span style="color: black">&#8220;));
        RL();
    }

    </span><span style="color: blue">public static </span><span style="color: black">FooBar FooBarFactory(</span><span style="color: blue">string </span><span style="color: black">init)
    {
        </span><span style="color: blue">try
        </span><span style="color: black">{
            </span><span style="color: blue">return </span><span style="color: black">(FooBar)System.Enum.Parse(</span><span style="color: blue">typeof</span><span style="color: black">(FooBar), init);
        }
        </span><span style="color: blue">catch
        </span><span style="color: black">{
            </span><span style="color: green">// Do something
            </span><span style="color: blue">throw</span><span style="color: black">;
        }
    }

    </span><span style="color: blue">#region </span><span style="color: black">Helper methods

    </span><span style="color: blue">private static void </span><span style="color: black">WL(</span><span style="color: blue">object </span><span style="color: black">text, </span><span style="color: blue">params object</span><span style="color: black">[] args)
    {
        Console.WriteLine(text.ToString(), args);
    }

    </span><span style="color: blue">private static void </span><span style="color: black">RL()
    {
        Console.ReadLine();
    }

    </span><span style="color: blue">private static void </span><span style="color: black">Break()
    {
        System.Diagnostics.Debugger.Break();
    }

    </span><span style="color: blue">#endregion
</span><span style="color: black">}</span></pre>
<p><a href="http://11011.net/software/vspaste"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2008_08_10/enum-factory/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Silverlight for everybody</title>
		<link>http://www.iprogrammable.com/2008_06_22/silverlight-for-everybody/en/</link>
		<comments>http://www.iprogrammable.com/2008_06_22/silverlight-for-everybody/en/#comments</comments>
		<pubDate>Sun, 22 Jun 2008 15:32:01 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Silverlight]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_06_22/silverlight-for-everybody/</guid>
		<description><![CDATA[ My fist text for a Polish computer magazine NEXT hast just been published. It is called “Silverlight for everybody”. New publisher new challenge. I hope for a long lasting collaboration. In a mean time you can check my GeoCodedCalcualtor. A simple piece of Silverlight app that calculates the degrees, minutes, seconds form of latitude, [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/06/image5.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/06/image-thumb5.png" alt="image" style="border: 0px none " title="image" align="left" border="0" height="90" width="146" /></a> My fist text for a Polish computer <a href="http://www.nextmag.pl/">magazine NEXT</a> hast just been published. It is called “Silverlight for everybody”. New publisher new challenge. I hope for a long lasting collaboration. In a mean time you can check my <a href="http://kawalerowicz.net/GeoCodeCalculator/GeoCoderCalculatorTestPage.html">GeoCodedCalcualtor</a>. A simple piece of Silverlight app that calculates the degrees, minutes, seconds form of latitude, longitude notation to a numeric notation and shows the translated coordinates using Google Static Maps Api. Enjoy!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2008_06_22/silverlight-for-everybody/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Remember to brake your egg at the small end*</title>
		<link>http://www.iprogrammable.com/2008_06_09/remember-to-brake-your-egg-at-the-small-end/en/</link>
		<comments>http://www.iprogrammable.com/2008_06_09/remember-to-brake-your-egg-at-the-small-end/en/#comments</comments>
		<pubDate>Mon, 09 Jun 2008 19:53:15 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[Clarion]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_06_09/remember-to-brake-your-egg-at-the-small-end/</guid>
		<description><![CDATA[Sometimes the interoperability between .NET and Win32 could by a pain in the ass. Especially in places you don&#8217;t expect it to be. I&#8217;ve worked recently on a cryptography algorithm. I had the source code in Clarion and all I had to do was to implement it in C#. No problem I guessed. But&#8230; The [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes the interoperability between .NET and Win32 could by a pain in the ass. Especially in places you don&#8217;t expect it to be. I&#8217;ve worked recently on a cryptography algorithm. I had the source code in <a href="http://www.softvelocity.com/">Clarion</a> and all I had to do was to implement it in C#. No problem I guessed. But&#8230; The Clarion algorithm used pointers extensively. I have worked with byte arrays. I read the text as a char array and I copied the bytes into long variables using a binary shift. Lets say we have a</p>
<pre class="code"><span style="color: blue">string </span><span style="color: black">s = &#8220;</span><span style="color: teal">abcd</span><span style="color: black">&#8220;;</span></pre>
<p>Its something like this:</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/06/image.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/06/image-thumb.png" style="border-width: 0px" alt="image" border="0" height="65" width="469" /></a></p>
<p>If we try to interpret this as a uint variable:</p>
<pre class="code"><span style="color: blue">uint </span><span style="color: black">ui = (</span><span style="color: blue">uint</span><span style="color: black">)((s[0</span><span style="color: black">] &lt;&lt; </span><span style="color: red">24</span><span style="color: black">) | (s[1</span><span style="color: black">] &lt;&lt; </span><span style="color: red">16</span><span style="color: black">) | (s[2</span><span style="color: black">] &lt;&lt; </span><span style="color: red">8</span><span style="color: black">) | s[3</span><span style="color: black">]);</span></pre>
<p>we will get something like this number 1633837924.</p>
<p>Lets look at this from the other side. Our string goes direct into memory:</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/06/image1.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/06/image-thumb1.png" style="border-width: 0px" alt="image" border="0" height="65" width="469" /></a></p>
<p>Using Win32 compiler we want to read it to a ulong variable x from a px address. In Clarion the code to do this will look like this:</p>
<p>x                      &amp;ulong</p>
<p>long                 px</p>
<p>x &amp;= (px)</p>
<p>What do we get in x?</p>
<p>1684234849</p>
<p>Hmm, variable ui in C# and x in Wind32 are not the same. Why? Because Intel is using a small endian way to store the numbers. So it means that the highest byte is saved at the right side and the lowest at the left. Like this (small endian):</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/06/image2.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/06/image-thumb2.png" style="border-width: 0px" alt="Small_Endian" border="0" height="173" width="471" /></a></p>
<p>and not (big endian)</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/06/image3.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/06/image-thumb3.png" style="border-width: 0px" alt="Big_Endian" border="0" height="173" width="471" /></a></p>
<p>* In Jonathan Swift&#8217;s Gulliver&#8217;s Travels the Little Endians broke their eggs at the small end, where the Big Endians broke theirs at the large end. And the ones were not very fond of the others ;-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2008_06_09/remember-to-brake-your-egg-at-the-small-end/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Multiple projects - multiple repositories</title>
		<link>http://www.iprogrammable.com/2008_04_26/multiple-projects-multiple-repositories/en/</link>
		<comments>http://www.iprogrammable.com/2008_04_26/multiple-projects-multiple-repositories/en/#comments</comments>
		<pubDate>Sat, 26 Apr 2008 19:00:22 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[SVN]]></category>

		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_04_26/multiple-projects-multiple-repositories/</guid>
		<description><![CDATA[Do you have one project you want to share between multiple solutions? Something like a big set of helpers or a framework you need here and there? There are multiple ways ones have achieved this goal. Let me describe how I&#8217;ve done this.
We work with Visual Studio as our main development environment and Subversion as [...]]]></description>
			<content:encoded><![CDATA[<p>Do you have one project you want to share between multiple solutions? Something like a big set of helpers or a framework you need here and there? There are multiple ways ones have achieved this goal. Let me describe how I&#8217;ve done this.</p>
<p>We work with Visual Studio as our main development environment and Subversion as our source control system. What we needed was a systematic approach where we share our framework across all of our projects. We are actively developing our framework so simple dll reference is not an option. Our rules according to framework development make it fairly save to share the same code across multiple projects and to develop at the same time.</p>
<p>We decided that the framework should by placed in separate SVN repository and a separate Visual Studio project. But we wanted the framework and the project being pullable from source control as a whole. Firstly because we are (I&#8217;m!) lazy and I don&#8217;t want to remember that I have to check out the framework and than the project separately. Secondly we have a living Continuous Integration system running on CruiseControl.NET and it should by able to detect the changes and build to project in one shot.</p>
<p>Our way is to add the framework as an existing project from separate solutions&#8230;</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/04/image1.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/04/image-thumb1.png" style="border-width: 0px" alt="Project structure" border="0" height="195" width="303" /></a></p>
<p>and to connect the main SVN project repository with framework repository as a <a href="http://svnbook.red-bean.com/en/1.4/svn.advanced.externals.html">svn:external</a>.</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/04/image2.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/04/image-thumb2.png" style="border-width: 0px" alt="Folder structure" border="0" height="257" width="303" /></a></p>
<p>Step by step solution:</p>
<p>1. Create &#8220;Framework&#8221; Project in Visual Studio</p>
<p>2. Create a SVN repository for this project (check everything you need in)</p>
<p>3. Create new solution in Visual Studio that will hold your &#8220;Project&#8221;</p>
<p>4. Create a SVN repository for this project</p>
<p>5. Create new folder on hard drive inside the &#8220;Project&#8221; folder</p>
<p>6. Check out the framework from repository into newly created folder</p>
<p>7. In Visual Studio add the framework to you solution as a existing project.</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/04/image3.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/04/image-thumb3.png" style="border-width: 0px" alt="Adding exisitng project" border="0" height="315" width="275" /></a></p>
<p>8. Link the Framework repository with the Project repository (using svn propset or with TortoiseSVN like this)</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/04/image4.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/04/image-thumb4.png" style="border-width: 0px" alt="svn:externals" border="0" height="308" width="433" /></a></p>
<p>You are done!</p>
<p>Now if you check out the &#8220;Project&#8221; you will get the &#8220;Framework&#8221; automatically. Unfortunately if you will make changes into &#8220;Framework&#8221; you will not by able to checkc everything in. You will have to separately check the &#8220;Framework&#8221; changes and &#8220;Project&#8221; changes. But if you are using Tortoise SVN you will by warned.</p>
<p><a href="http://www.iprogrammable.com/wp-content/uploads/2008/04/image5.png"><img src="http://www.iprogrammable.com/wp-content/uploads/2008/04/image-thumb5.png" style="border-width: 0px" alt="TortoiseSvn externals warning" border="0" height="76" width="474" /></a></p>
<p>Is is cool or not!?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.iprogrammable.com/2008_04_26/multiple-projects-multiple-repositories/en/feed/en/</wfw:commentRss>
		</item>
		<item>
		<title>Aiding your work with Visual Studio Code Snippets</title>
		<link>http://www.iprogrammable.com/2008_04_16/aiding-your-work-with-visual-studio-code-snippets/en/</link>
		<comments>http://www.iprogrammable.com/2008_04_16/aiding-your-work-with-visual-studio-code-snippets/en/#comments</comments>
		<pubDate>Wed, 16 Apr 2008 17:35:38 +0000</pubDate>
		<dc:creator>Marcin Kawalerowicz</dc:creator>
		
		<category><![CDATA[DotNet]]></category>

		<guid isPermaLink="false">http://www.iprogrammable.com/2008_04_16/aiding-your-work-with-visual-studio-code-snippets/</guid>
		<description />
			<content:encoded />
			<wfw:commentRss>http://www.iprogrammable.com/2008_04_16/aiding-your-work-with-visual-studio-code-snippets/en/feed/en/</wfw:commentRss>
		</item>
	</channel>
</rss>
