<?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>batteryslave &#187; .net</title>
	<atom:link href="http://www.batteryslave.com/tag/net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.batteryslave.com</link>
	<description>minor thoughts about gadgets, code, podcasts and other technical stuff...</description>
	<lastBuildDate>Thu, 25 Aug 2011 15:46:58 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>python interop: using jython and ironruby</title>
		<link>http://www.batteryslave.com/2010/11/python-interop-using-jython-and-ironruby/</link>
		<comments>http://www.batteryslave.com/2010/11/python-interop-using-jython-and-ironruby/#comments</comments>
		<pubDate>Tue, 30 Nov 2010 20:13:04 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[pyhton]]></category>
		<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[interop]]></category>
		<category><![CDATA[python]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=197</guid>
		<description><![CDATA[in a project with java and .net komponents we needed to share some validation-code. this code should be executable on both platforms and act against pocos (plain old clr objects) and pojos (plain old java objects). we tested python as a language that can be executed on both sides using jython for java and ironpython [...]]]></description>
			<content:encoded><![CDATA[<p>in a project with java and .net komponents we needed to share some validation-code. this code should be executable on both platforms and act against pocos (plain old clr objects) and pojos (plain old java objects). we tested python as a language that can be executed on both sides using jython for java and ironpython for c#. i want to show you how simple an integration of python is here.</p>
<p>for c# and ironpython:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
</pre></td><td class="code"><pre class="csharp" style="font-family:monospace;"><span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">System</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">IronPython.Hosting</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.Scripting</span><span style="color: #008000;">;</span>
<span style="color: #0600FF; font-weight: bold;">using</span> <span style="color: #008080;">Microsoft.Scripting.Hosting</span><span style="color: #008000;">;</span>
&nbsp;
<span style="color: #0600FF; font-weight: bold;">namespace</span> IronPythonValidationTest <span style="color: #008000;">&#123;</span>
  <span style="color: #0600FF; font-weight: bold;">internal</span> <span style="color: #6666cc; font-weight: bold;">class</span> Program <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">private</span> <span style="color: #0600FF; font-weight: bold;">static</span> <span style="color: #6666cc; font-weight: bold;">void</span> Main<span style="color: #008000;">&#40;</span><span style="color: #6666cc; font-weight: bold;">string</span><span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span> args<span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#123;</span>
      <span style="color: #6666cc; font-weight: bold;">string</span> code <span style="color: #008000;">=</span> <span style="color: #666666;">@&quot;
if this.Von &gt; this.Bis:
    result = 'von soll kleiner sein als bis'
elif this.Child.Name != '':
    result = 'name soll gefüllt sein'&quot;</span><span style="color: #008000;">;</span>
&nbsp;
      ScriptEngine engine <span style="color: #008000;">=</span> Python<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateEngine</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      ScriptScope scope <span style="color: #008000;">=</span> engine<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateScope</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      scope<span style="color: #008000;">.</span><span style="color: #0000FF;">SetVariable</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;this&quot;</span>, <span style="color: #008000;">new</span> TestType <span style="color: #008000;">&#123;</span>Von <span style="color: #008000;">=</span> DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Now</span><span style="color: #008000;">.</span><span style="color: #0000FF;">AddDays</span><span style="color: #008000;">&#40;</span><span style="color: #FF0000;">1</span><span style="color: #008000;">&#41;</span>, Bis <span style="color: #008000;">=</span> DateTime<span style="color: #008000;">.</span><span style="color: #0000FF;">Now</span>, Child <span style="color: #008000;">=</span> <span style="color: #008000;">new</span> TestTypeNested<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#125;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      ScriptSource source <span style="color: #008000;">=</span> engine<span style="color: #008000;">.</span><span style="color: #0000FF;">CreateScriptSourceFromString</span><span style="color: #008000;">&#40;</span>code, SourceCodeKind<span style="color: #008000;">.</span><span style="color: #0000FF;">SingleStatement</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      source<span style="color: #008000;">.</span><span style="color: #0000FF;">Execute</span><span style="color: #008000;">&#40;</span>scope<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      <span style="color: #6666cc; font-weight: bold;">string</span> validationResult <span style="color: #008000;">=</span> scope<span style="color: #008000;">.</span><span style="color: #0000FF;">GetVariable</span><span style="color: #008000;">&#40;</span><span style="color: #666666;">&quot;result&quot;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      Console<span style="color: #008000;">.</span><span style="color: #0000FF;">WriteLine</span><span style="color: #008000;">&#40;</span>validationResult<span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
      Console<span style="color: #008000;">.</span><span style="color: #0000FF;">ReadKey</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">;</span>
    <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> TestType <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> Name <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> DateTime Von <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> DateTime Bis <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> TestTypeNested Child <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span>
&nbsp;
  <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">class</span> TestTypeNested <span style="color: #008000;">&#123;</span>
    <span style="color: #0600FF; font-weight: bold;">public</span> <span style="color: #6666cc; font-weight: bold;">string</span> NochName <span style="color: #008000;">&#123;</span> get<span style="color: #008000;">;</span> set<span style="color: #008000;">;</span> <span style="color: #008000;">&#125;</span>
  <span style="color: #008000;">&#125;</span>
<span style="color: #008000;">&#125;</span></pre></td></tr></table></div>

<p>and almost the same for java:</p>

<div class="wp_syntax"><table><tr><td class="line_numbers"><pre>1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
</pre></td><td class="code"><pre class="java" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.python.util.PythonInterpreter</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">import</span> <span style="color: #006699;">org.python.core.*</span><span style="color: #339933;">;</span>
&nbsp;
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> JythonValidationTest <span style="color: #009900;">&#123;</span>
&nbsp;
	<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">static</span> <span style="color: #000066; font-weight: bold;">void</span> main<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> args<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
		PythonInterpreter python <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> PythonInterpreter<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		<span style="color: #003399;">String</span> code <span style="color: #339933;">=</span> <span style="color: #0000ff;">&quot;if this.Von &gt; this.Bis:<span style="color: #000099; font-weight: bold;">\n</span>    result = <span style="color: #000099; font-weight: bold;">\&quot;</span>von soll kleiner sein als bis<span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\n</span>elif this.Child.Name != <span style="color: #000099; font-weight: bold;">\&quot;</span><span style="color: #000099; font-weight: bold;">\&quot;</span>:<span style="color: #000099; font-weight: bold;">\n</span>    result = <span style="color: #000099; font-weight: bold;">\&quot;</span>name soll gefüllt sein<span style="color: #000099; font-weight: bold;">\&quot;</span>&quot;</span><span style="color: #339933;">;</span>
		PyCode pc <span style="color: #339933;">=</span> python.<span style="color: #006633;">compile</span><span style="color: #009900;">&#40;</span>code<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		TestType l <span style="color: #339933;">=</span> <span style="color: #000000; font-weight: bold;">new</span> TestType<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		l.<span style="color: #006633;">setVon</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">2</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
        l.<span style="color: #006633;">setBis</span><span style="color: #009900;">&#40;</span><span style="color: #cc66cc;">1</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
		python.<span style="color: #006633;">set</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;this&quot;</span>, l<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
	<span style="color: #009900;">&#125;</span>	
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// this has to be a public class, so one could not put it in one classfile</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> TestType <span style="color: #009900;">&#123;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> von<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> name<span style="color: #339933;">;</span>
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> bis<span style="color: #339933;">;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #003399;">String</span> getName<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> name<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setName<span style="color: #009900;">&#40;</span><span style="color: #003399;">String</span> name<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">name</span> <span style="color: #339933;">=</span> name<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getVon<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> von<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setVon<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> von<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">von</span> <span style="color: #339933;">=</span> von<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">int</span> getBis<span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">return</span> bis<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
&nbsp;
    <span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">void</span> setBis<span style="color: #009900;">&#40;</span><span style="color: #000066; font-weight: bold;">int</span> bis<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
        <span style="color: #000000; font-weight: bold;">this</span>.<span style="color: #006633;">bis</span> <span style="color: #339933;">=</span> bis<span style="color: #339933;">;</span>
    <span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></td></tr></table></div>

<p>remaining problems:</p>
<ul>
<li>because of naming-convention ifferences you have to wrap python code so that you can intersept calls to get*() methods. as in c# getters and setters look like Name instead of getName()</li>
<li>if there are user visible strings involved, you have to think about translating them</li>
<li>checking the python code before deployment</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2010/11/python-interop-using-jython-and-ironruby/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>nothing but dotnet &#8211; jean-paul boodhoo&#8217;s bootcamp</title>
		<link>http://www.batteryslave.com/2008/09/nothing-but-dotnet-jean-paul-boodhoos-bootcamp/</link>
		<comments>http://www.batteryslave.com/2008/09/nothing-but-dotnet-jean-paul-boodhoos-bootcamp/#comments</comments>
		<pubDate>Sun, 28 Sep 2008 10:54:51 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[coding]]></category>
		<category><![CDATA[boodhoo]]></category>
		<category><![CDATA[extreme]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=9</guid>
		<description><![CDATA[last week i attended in jean-paul boodhoo&#8217;s nothin but .net &#8211; bootcamp course. this was a great experience. i read about it in his blog and i could convince my boss to send me there. shure i heard some stuff about it and i read the overview from jp with the disclaimer : **********Please be [...]]]></description>
			<content:encoded><![CDATA[<p>last week i attended in jean-paul boodhoo&#8217;s nothin but .net &#8211; bootcamp course. this was a great experience.</p>
<p style="clear: both">i read about it in his blog and i could convince my boss to send me there. shure i heard some stuff about it and i read the overview from jp with the disclaimer :</p>
<blockquote><p>**********Please be aware that the length of course days (based on prior iterations of the course) can fluctuate dramatically based on the level of student interaction. It is best to come ready expecting the course days to be no less than 10 hours.************</p></blockquote>
<p style="clear: both">but what then happened exceeded all my expectations. jp previously send us prep material about what software to install and how to configure the laptop. he also included a small exercise where we should implement some function, so the tests get green. he also gave us the advise to have a look on his shows on <a title="dnr-tv" href="http://www.dnrtv.com" target="_blank">dnrtv</a>. so it is just as you may be thinking now: you can easily spend a weekend or two on the preparations.</p>
<p style="clear: both">after everybody had arrived jp took a look at the excercises we had prepared. then he choose one solution and the magic started. i have never seen someone before who grasps the code of others and navigates through it as fast as him. fast as lightning he refactors and afterwards nothing is like before. it was fascinating but sometimes hard to keep track. fortunately jp recorded everything (as long as anyone reminded him). now we have 6GiB (27h) worth of screencast lying around waiting to see them in slomo.</p>
<p style="clear: both">then we started configuring all laptops to run sql-server (or its express edition) and iis on all those different os (winx xp pro, win xp home, vista 32bit/64bit in german!!) so we all can run the webapplication which we wanted to implement in the following days. here is one of the few things that might be improved concerning the courses to come: the setup of the machines took several hours and at the end not everyone could run the app smoothly. i think it would be helpful to have a different approach to show alle the stuff we wanted to learn during the week. what came to my mind was to use a small wpf app with sql-server compact edition. that way there wouldnt be any complex setup needed. jp appreciated the suggestion. perhaps he will use that kind of environment in his next courses.</p>
<p style="clear: both">the following days we implemented the webstore-app. we mostly used a kind of ping-pong-style. jp wrote a test and we implemented the methods to green the tests. the team (usually small groups of 2-4) that finished the tests at first checked in so the others had to revert their changes and update. that was a bit frustrating when you were part of a slower team and it was hard to follow. but we re-paired perpetually so i think it was ok in the end and everyone was happy.  sometime we had an assignment given by jp to implement a story by ourselves so we had the chance to write the tests ourselves.</p>
<p style="clear: both">for me the last two days where the best. i got used to jp&#8217;s speed and could therefore follow his curser and ideas more easily. moreover the extreme situation of coding till 4am (up until 18h) welded the team together. i think that is the main advantage of the bootcamp style. if we had the same time sliced in the usual 8h days the team wouldnt have become that close. its is a little bit like other situations where people experience  extreme challenges. it brings them together. so i hope i will meet these great guys again. (perhaps just to dive into the memories we all share).</p>
<p style="clear: both">there are many things i didn&#8217;t mention here. but if you want to know more about what happened i list some blogs of other attendees:</p>
<ul>
<li><a href="http://geekswithblogs.net/alternativedotnet/Default.aspx" target="_blank">.net alternatives</a></li>
<li><a href="http://www.lieser-online.de/blog/">stefan liesers blog</a></li>
<li><a href="http://www.bjoernrochel.de/">björn rochel&#8217;s weblog</a></li>
<li><a href="http://dirkdev.blogspot.com">dirk&#8217;s development</a></li>
<li><a href="http://blog.jpboodhoo.com/">develop with passion</a></li>
</ul>
<p>overall it was a great week. thanks to the awesome team. especially jp who is an outstanding personality. i hope i get the chance to meet im again sometime.</p>
<p style="clear: both">keep on movin</p>
<p style="clear: both">basti</p>
<p><br class="final-break" style="clear: both" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2008/09/nothing-but-dotnet-jean-paul-boodhoos-bootcamp/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

