<?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</title>
	<atom:link href="http://www.batteryslave.com/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>start ssh-agent</title>
		<link>http://www.batteryslave.com/2011/08/start-ssh-agent/</link>
		<comments>http://www.batteryslave.com/2011/08/start-ssh-agent/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 15:46:58 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[remember]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=221</guid>
		<description><![CDATA[because i always forget how to start ssh-agent, here it is: eval $(ssh-agent)]]></description>
			<content:encoded><![CDATA[<p>because i always forget how to start ssh-agent, here it is:</p>
<p style="text-align: left;">eval $(ssh-agent)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2011/08/start-ssh-agent/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<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>java-bits #1: filedragdrop handler</title>
		<link>http://www.batteryslave.com/2010/11/java-bits-1-filedragdrop-handler/</link>
		<comments>http://www.batteryslave.com/2010/11/java-bits-1-filedragdrop-handler/#comments</comments>
		<pubDate>Tue, 02 Nov 2010 18:06:53 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[dragdrop]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=178</guid>
		<description><![CDATA[drop a file from the explorer to a textbox and make the path the text of that textbox: // imports omitted, dont know why... public class Foo extends TransferHandler &#123; &#160; //... &#160; /* DRAG &#38;amp;amp; DROP */ @Override public boolean importData&#40;JComponent comp, Transferable t&#41; &#123; // Make sure we have the right starting points [...]]]></description>
			<content:encoded><![CDATA[<p>drop a file from the explorer to a textbox and make the path the text of that textbox:</p>

<div class="wp_syntax"><div class="code"><pre class="java" style="font-family:monospace;"><span style="color: #666666; font-style: italic;">// imports omitted, dont know why...</span>
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000000; font-weight: bold;">class</span> Foo <span style="color: #000000; font-weight: bold;">extends</span> TransferHandler <span style="color: #009900;">&#123;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">//...</span>
&nbsp;
<span style="color: #666666; font-style: italic;">/*
DRAG &amp;amp;amp; DROP
*/</span>
@Override
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> importData<span style="color: #009900;">&#40;</span><span style="color: #003399;">JComponent</span> comp, <span style="color: #003399;">Transferable</span> t<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #666666; font-style: italic;">// Make sure we have the right starting points</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span><span style="color: #009900;">&#40;</span>comp <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #003399;">JTextField</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span><span style="color: #339933;">!</span>t.<span style="color: #006633;">isDataFlavorSupported</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">DataFlavor</span>.<span style="color: #006633;">javaFileListFlavor</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
<span style="color: #666666; font-style: italic;">// Grab the tree, its model and the root node</span>
<span style="color: #003399;">JTextField</span> textField <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">JTextField</span><span style="color: #009900;">&#41;</span> comp<span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">try</span> <span style="color: #009900;">&#123;</span>
<span style="color: #003399;">List</span> data <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">List</span><span style="color: #009900;">&#41;</span> t.<span style="color: #006633;">getTransferData</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">DataFlavor</span>.<span style="color: #006633;">javaFileListFlavor</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">Object</span> object <span style="color: #339933;">:</span> data<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #003399;">File</span> f <span style="color: #339933;">=</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">File</span><span style="color: #009900;">&#41;</span> object<span style="color: #339933;">;</span>
textField.<span style="color: #006633;">setText</span><span style="color: #009900;">&#40;</span>f.<span style="color: #006633;">getAbsolutePath</span><span style="color: #009900;">&#40;</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">UnsupportedFlavorException</span> ufe<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">err</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Ack! we should not be here.<span style="color: #000099; font-weight: bold;">\n</span>Bad Flavor.&quot;</span><span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span> <span style="color: #000000; font-weight: bold;">catch</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">IOException</span> ioe<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #003399;">System</span>.<span style="color: #006633;">out</span>.<span style="color: #006633;">println</span><span style="color: #009900;">&#40;</span><span style="color: #0000ff;">&quot;Something failed during import:<span style="color: #000099; font-weight: bold;">\n</span>&quot;</span> <span style="color: #339933;">+</span> ioe<span style="color: #009900;">&#41;</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
&nbsp;
@Override
<span style="color: #000000; font-weight: bold;">public</span> <span style="color: #000066; font-weight: bold;">boolean</span> canImport<span style="color: #009900;">&#40;</span><span style="color: #003399;">JComponent</span> comp, <span style="color: #003399;">DataFlavor</span><span style="color: #009900;">&#91;</span><span style="color: #009900;">&#93;</span> transferFlavors<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>comp <span style="color: #000000; font-weight: bold;">instanceof</span> <span style="color: #003399;">JTextField</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">for</span> <span style="color: #009900;">&#40;</span><span style="color: #003399;">DataFlavor</span> transferFlavor <span style="color: #339933;">:</span> transferFlavors<span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">if</span> <span style="color: #009900;">&#40;</span>transferFlavor.<span style="color: #006633;">equals</span><span style="color: #009900;">&#40;</span><span style="color: #003399;">DataFlavor</span>.<span style="color: #006633;">javaFileListFlavor</span><span style="color: #009900;">&#41;</span><span style="color: #009900;">&#41;</span> <span style="color: #009900;">&#123;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">true</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #000000; font-weight: bold;">return</span> <span style="color: #000066; font-weight: bold;">false</span><span style="color: #339933;">;</span>
<span style="color: #009900;">&#125;</span>
<span style="color: #009900;">&#125;</span></pre></div></div>

]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2010/11/java-bits-1-filedragdrop-handler/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>on my way to become a keyboard jedi, part II</title>
		<link>http://www.batteryslave.com/2010/04/on-my-way-to-become-a-keyboard-jedi-part-ii/</link>
		<comments>http://www.batteryslave.com/2010/04/on-my-way-to-become-a-keyboard-jedi-part-ii/#comments</comments>
		<pubDate>Tue, 20 Apr 2010 21:05:39 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=169</guid>
		<description><![CDATA[last time i told you about launchy as a program starter. this time i want to talk about window handling. to switch between windows most people know that you can flip through your open applications with alt+tab. but in vista and 7 you can after you entered alt+tab once move through the applications with the [...]]]></description>
			<content:encoded><![CDATA[<p>last time i told you about launchy as a program starter. this time i want to talk about window handling.</p>
<p>to switch between windows most people know that you can flip through your open applications with alt+tab. but in vista and 7 you can after you entered alt+tab once move through the applications with the cursor. e.g. when you have many open applications they are arranged in a row-column-layout when pressing alt+tab. the first item is highlighted. then instead of going though all the items one-by-one you can go down and right for example.</p>
<p>see this video:</p>
<p><object id="scPlayer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="370" height="198" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="thumb=http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/FirstFrame.jpg&amp;containerwidth=370&amp;containerheight=198&amp;content=http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/alt_tab_with_cursor.mp4&amp;blurover=false" /><param name="allowFullScreen" value="true" /><param name="scale" value="showall" /><param name="allowScriptAccess" value="always" /><param name="base" value="http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/" /><param name="src" value="http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/jingh264player.swf" /><param name="flashvars" value="thumb=http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/FirstFrame.jpg&amp;containerwidth=370&amp;containerheight=198&amp;content=http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/alt_tab_with_cursor.mp4&amp;blurover=false" /><param name="allowfullscreen" value="true" /><embed id="scPlayer" type="application/x-shockwave-flash" width="370" height="198" src="http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/jingh264player.swf" base="http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/" allowscriptaccess="always" scale="showall" allowfullscreen="true" flashvars="thumb=http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/FirstFrame.jpg&amp;containerwidth=370&amp;containerheight=198&amp;content=http://content.screencast.com/users/dotob/folders/Jing/media/ecdb4d30-fbed-445c-81a2-cda0da5c63d7/alt_tab_with_cursor.mp4&amp;blurover=false" bgcolor="#FFFFFF" quality="high"></embed></object></p>
<p>next thing: window management with <a href="http://www.winsplit-revolution.com/">winsplit revolution</a>:</p>
<p>see this video:</p>
<p><object id="scPlayer" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="400" height="290" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="quality" value="high" /><param name="bgcolor" value="#FFFFFF" /><param name="flashVars" value="thumb=http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/FirstFrame.jpg&amp;containerwidth=400&amp;containerheight=290&amp;content=http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/winsplit_revolution.mp4&amp;blurover=false" /><param name="allowFullScreen" value="true" /><param name="scale" value="showall" /><param name="allowScriptAccess" value="always" /><param name="base" value="http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/" /><param name="src" value="http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/jingh264player.swf" /><param name="flashvars" value="thumb=http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/FirstFrame.jpg&amp;containerwidth=400&amp;containerheight=290&amp;content=http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/winsplit_revolution.mp4&amp;blurover=false" /><param name="allowfullscreen" value="true" /><embed id="scPlayer" type="application/x-shockwave-flash" width="400" height="290" src="http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/jingh264player.swf" base="http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/" allowscriptaccess="always" scale="showall" allowfullscreen="true" flashvars="thumb=http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/FirstFrame.jpg&amp;containerwidth=400&amp;containerheight=290&amp;content=http://content.screencast.com/users/dotob/folders/Jing/media/e8c82c10-bf77-48af-b911-8132c81b4601/winsplit_revolution.mp4&amp;blurover=false" bgcolor="#FFFFFF" quality="high"></embed></object></p>
<p>here are the keycombinations:</p>
<ul>
<li>Ctrl+Alt+1 = Bottom left corner of the screen</li>
<li>Ctrl+Alt+2 = Bottom part</li>
<li>Ctrl+Alt+3 = Bottom right corner</li>
<li>Ctrl+Alt+4 = Left part</li>
<li>Ctrl+Alt+5 = Full screen</li>
<li>Ctrl+Alt+6 = Right part</li>
<li>Ctrl+Alt+7 = Upper left corner</li>
<li>Ctrl+Alt+8 = Upper part</li>
<li>Ctrl+Alt+9 = Upper right corner</li>
</ul>
<p>it is a great tool &#8211; really.</p>
<p>to be continued&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2010/04/on-my-way-to-become-a-keyboard-jedi-part-ii/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>on my way to become a keyboard jedi, part I</title>
		<link>http://www.batteryslave.com/2010/03/on-my-way-to-become-a-keyboard-jedi-part-i/</link>
		<comments>http://www.batteryslave.com/2010/03/on-my-way-to-become-a-keyboard-jedi-part-i/#comments</comments>
		<pubDate>Sun, 21 Mar 2010 18:08:01 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=163</guid>
		<description><![CDATA[on my daily work i try to become better in not using the mouse for almost anything. starting programs, file system tasks, navigating the internet, programming, handling windows (as in dialogs not as in os) and more&#8230; i want to show some of that stuff: launchy alt-tab winsplit revolution ultramon totalcommander resharper psi menu-mnemonics autohotkey [...]]]></description>
			<content:encoded><![CDATA[<p>on my daily work i try to become better in not using the mouse for almost anything. starting programs, file system tasks, navigating the internet, programming, handling windows (as in dialogs not as in os) and more&#8230;</p>
<p>i want to show some of that stuff:</p>
<ul>
<li>launchy</li>
<li>alt-tab</li>
<li>winsplit revolution</li>
<li>ultramon</li>
<li>totalcommander</li>
<li>resharper</li>
<li>psi</li>
<li>menu-mnemonics</li>
<li>autohotkey</li>
</ul>
<p>but more on that step by step.</p>
<p><a href="http://www.launchy.net/" target="_blank">launchy</a>, free, (Win, MacOS, Linux)</p>
<p>launchy is a program launcher. you can start it with a keycombination (default is alt+space) then an entryfield shows up and you can type any part of a programs name you have installed and launchy will show a list of matches. usually a simple enter will start the found program. thats great for starters.</p>
<div id="attachment_174" class="wp-caption alignnone" style="width: 365px"><img class="size-full wp-image-174 " title="launchy" src="http://www.batteryslave.com/wp-content/launchy.png" alt="launchy app starter" width="355" height="215" /><p class="wp-caption-text">launchy app starter</p></div>
<p>but there is more: launchy supports plugins. two of them i wanna show:</p>
<p><a href="http://code.google.com/p/putty-launchy-plugin/" target="_blank">putty-launchy-plugin</a>: tell it where your putty lives and it can start saved putty sessions via defined (default &#8220;ssh&#8221;) shortcut. have a session called &#8220;webserver&#8221; start it with alt+space, ssh we. if you have putty and your ssh configured for public-key-authentication (and you should have) you are now ready to use your shell.<br />
runner (default installed): you can launch special programs from here with parameters you like and give it a special shortcut. e.g. i have special two-letter shortcuts for important specification documents or <a href="http://technet.microsoft.com/de-de/sysinternals/bb896653.aspx" target="_blank">processexplorer</a>.</p>
<p>to be continued&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2010/03/on-my-way-to-become-a-keyboard-jedi-part-i/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>ant replace task: remind the encoding</title>
		<link>http://www.batteryslave.com/2010/02/ant-replace-task-remind-the-encoding/</link>
		<comments>http://www.batteryslave.com/2010/02/ant-replace-task-remind-the-encoding/#comments</comments>
		<pubDate>Sat, 20 Feb 2010 18:39:36 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[uncategorized]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=160</guid>
		<description><![CDATA[puh man again nearly going crazy over a simple problem. the environment: java project edited in eclipse (an a mac) check into subversion (on a linux box) teamcity buildserver using ant build script (same linux box as subversion) what happened: everywhere the encoding was correct beside one file. in that file my umlauts where messed. [...]]]></description>
			<content:encoded><![CDATA[<p>puh man again nearly going crazy over a simple problem. </p>
<p>the environment: </p>
<ul>
<li>java project</li>
<li>edited in eclipse (an a mac)</li>
<li>check into subversion (on a linux box)</li>
<li>teamcity buildserver using ant build script (same linux box as subversion)</li>
</ul>
<p>what happened: everywhere the encoding was correct beside one file. in that file my umlauts where messed. in my eclipse build (warning: not using the ant there) everything was fine. but when is looked at the file in teamcitys build directory it was messed. at first i thought of subversion. checked everything  out by hand on the linux box => fine. then i tried to find out how teamcity uses svn. they have their own implementation. so i figured they do something wrong. so i updated teamcity from 4.5 to 5.0.2&#8230;same result. so i waited about a week.<br />
then with a fresh mind i looked at the ant script when it hit me: i had a replace task to set the buildnumber in the messed sourcecode file (perhaps an unusual attemped but&#8230;). and replace uses the default encoding of the executing jvm. i neede to set the encoding for the javac task but i forgot or better didnt consider it a problem for the replace.<br />
with the encoding set everything was fine. see how:<br />
[source language='xml']<br />
<replace file="MainWindow.java" token="buildnumber" value="${myBuildNumber}"  encoding="ISO-8859-1"/><br />
[/source]</p>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2010/02/ant-replace-task-remind-the-encoding/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>walk in the park: installing mod_rails aka phusion passenger</title>
		<link>http://www.batteryslave.com/2009/10/walk-in-the-park-installing-mod_rails-aka-phusion-passenger/</link>
		<comments>http://www.batteryslave.com/2009/10/walk-in-the-park-installing-mod_rails-aka-phusion-passenger/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 15:43:41 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[linux]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=158</guid>
		<description><![CDATA[man that was easy. after my problems with getting ruby, gem and rails to run installing mod_rails aka phusion passenger was really easy: gem install passenger passenger-install-apache2-module i followed the steps that the installer told me and go. just needed to apt-get some apache dev packages and was ready to run. cant tell you how [...]]]></description>
			<content:encoded><![CDATA[<p>man that was easy. after my <a href="http://www.batteryslave.com/2009/10/getting-ruby-on-rails-to-run-on-my-debian-4-vps/">problems</a> with getting ruby, gem and rails to run installing mod_rails aka phusion passenger was really easy:</p>
<ul>
<li>gem install passenger</li>
<li>passenger-install-apache2-module</li>
</ul>
<p>i followed the steps that the installer told me and go. just needed to apt-get some apache dev packages and was ready to run. </p>
<p>cant tell you how happy i am.</p>
<p>now the rails fun can start.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2009/10/walk-in-the-park-installing-mod_rails-aka-phusion-passenger/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>getting ruby on rails to run on my debian 4 vps</title>
		<link>http://www.batteryslave.com/2009/10/getting-ruby-on-rails-to-run-on-my-debian-4-vps/</link>
		<comments>http://www.batteryslave.com/2009/10/getting-ruby-on-rails-to-run-on-my-debian-4-vps/#comments</comments>
		<pubDate>Tue, 13 Oct 2009 12:29:26 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[uncategorized]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=151</guid>
		<description><![CDATA[man&#8230;always fighting to get a recent version of anything to run on the debian 4 (etch) vps i have. this time: ruby on rails. ruby v1.9.1, gems 1.3.5 and ror 2.3.4 is what i had i mind. first step: download ruby. execute the usual ./configure &#038;&#038; make &#038;&#038; make install triplet. worked fine. then download [...]]]></description>
			<content:encoded><![CDATA[<p>man&#8230;always fighting to get a recent version of anything to run on the debian 4 (etch) vps i have. this time: ruby on rails. ruby v1.9.1, gems 1.3.5 and ror 2.3.4 is what i had i mind. </p>
<p>first step: download ruby. execute the usual ./configure &#038;&#038; make &#038;&#038; make install triplet. worked fine. then download ruby gems. but when i tried to run anything with gem i got:</p>
<p><code><br />
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- zlib (LoadError)<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/spec_fetcher.rb:1<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/commands/update_command.rb:5<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:167:in `load_and_instantiate'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:88:in `[]'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:144:in `find_command'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:131:in `process_args'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/command_manager.rb:102:in `run'<br />
	from /usr/local/lib/ruby/site_ruby/1.8/rubygems/gem_runner.rb:58:in `run'<br />
	from /usr/local/bin/gem:21<br />
</code></p>
<p>after googleing and trying some stuff i solved it this way:</p>
<ul>
<li>edit ruby-1.9.1-p0/ext/Setup</li>
<li>uncomment the line zlib</li>
<li>make &#038;&#038; make install again</li>
</ul>
<p>next step. successfully let gem install rails. but then <code>ruby script/server</code> stopped with:</p>
<p><code><br />
=> Booting WEBrick<br />
=> Rails 2.3.4 application starting on http://0.0.0.0:3000<br />
/usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/initializer.rb:271:in `rescue in require_frameworks': no such file to load -- openssl (RuntimeError)<br />
	from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/initializer.rb:268:in `require_frameworks'<br />
	from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/initializer.rb:134:in `process'<br />
	from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/initializer.rb:113:in `run'<br />
	from /var/www/rails/ukk/config/environment.rb:9:in `<top (required)>'<br />
	from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'<br />
	from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `block in require'<br />
	from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'<br />
	from /usr/local/lib/ruby/gems/1.9.1/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'<br />
	from /usr/local/lib/ruby/gems/1.9.1/gems/rails-2.3.4/lib/commands/server.rb:84:in `<top (required)>'<br />
	from script/server:3:in `require'<br />
	from script/server:3:in `<main>'<br />
</code></p>
<p>after a another round i found <a href="http://linuxnuggetz.blogspot.com/2009/06/ruby-on-rail-on-ubuntu.html">this site</a> with help:</p>
<ul>
<li>apt-get install openssl libssl-dev</li>
<li>apt-get install ruby1.9-dev</li>
<li>cd ruby-1.9.1-p129/ext/openssl</li>
<li>ruby extconf.rb</li>
<li>make &#038;&#038; make install</li>
</ul>
<p>that worked. nice. so now i am waiting for the next fail</p>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2009/10/getting-ruby-on-rails-to-run-on-my-debian-4-vps/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>itemtemplate selection by type in xaml only</title>
		<link>http://www.batteryslave.com/2009/09/itemtemplate-selection-by-type-in-xaml-only/</link>
		<comments>http://www.batteryslave.com/2009/09/itemtemplate-selection-by-type-in-xaml-only/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 17:29:23 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[wpf]]></category>
		<category><![CDATA[xaml]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=136</guid>
		<description><![CDATA[some days ago i found my self in need to change the itemtemplate in a listbox according to their type. and if with less code as possible. i had done this in a treeview but i couldnt find the code again. so i needed to figure it out again and with some help from a [...]]]></description>
			<content:encoded><![CDATA[<p>some days ago i found my self in need to change the itemtemplate in a listbox according to their type. and if with less code as possible. i had done this in a treeview but i couldnt find the code again. so i needed to figure it out again and with some help from a collegue we ended with this:</p>
<p>[source language='xml']<br />
<!-- more xaml here --></p>
<p><ItemsControl ItemsSource="{Binding Items}"><br />
  <ItemsControl.Resources><br />
    <DataTemplate DataType="{x:Type MyNameSpace:MyType1}"><br />
      <RadioButton /><br />
    </DataTemplate><br />
    <DataTemplate DataType="{x:Type MyNameSpace:MyType2}"><br />
      <ComboBox  /><br />
    </DataTemplate><br />
    <DataTemplate DataType="{x:Type MyNameSpace:MyType3}"><br />
      <TextBox /><br />
    </DataTemplate><br />
  </ItemsControl.Resources><br />
</ItemsControl></p>
<p><!-- more xaml here --><br />
[/source]</p>
<p><strong>remark</strong>: you arent allowed to give a key to that resources. i suppose the type is kind of key here.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2009/09/itemtemplate-selection-by-type-in-xaml-only/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>prio conf 28.-29.10. in munich</title>
		<link>http://www.batteryslave.com/2009/09/prio-conf-28-29-10-in-munich/</link>
		<comments>http://www.batteryslave.com/2009/09/prio-conf-28-29-10-in-munich/#comments</comments>
		<pubDate>Wed, 23 Sep 2009 17:28:41 +0000</pubDate>
		<dc:creator>batteryslave</dc:creator>
				<category><![CDATA[.net]]></category>
		<category><![CDATA[conference]]></category>

		<guid isPermaLink="false">http://www.batteryslave.com/?p=135</guid>
		<description><![CDATA[i am existed about a conference i am attending end of oktober in munich, germany: prio conference. its totally ui centric and that why its so hot. never saw such an interesting conference all about ui in germany before.]]></description>
			<content:encoded><![CDATA[<p>i am existed about a conference i am attending end of oktober in munich, germany: <a href="http://www.prio-conference.de">prio conference</a>. its totally ui centric and that why its so hot. never saw such an interesting conference all about ui in germany before. </p>
]]></content:encoded>
			<wfw:commentRss>http://www.batteryslave.com/2009/09/prio-conf-28-29-10-in-munich/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

