<?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>Blog.Project13.pl &#187; guide</title>
	<atom:link href="http://www.blog.project13.pl/index.php/tag/guide/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blog.project13.pl</link>
	<description>The Blog of a Coder</description>
	<lastBuildDate>Sun, 05 Feb 2012 02:28:52 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Setup git on windows to use kdiff3 as it&#8217;s mergetool</title>
		<link>http://www.blog.project13.pl/index.php/coding/1192/setup-git-on-windows-to-use-kdiff3-as-its-mergetool/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/1192/setup-git-on-windows-to-use-kdiff3-as-its-mergetool/#comments</comments>
		<pubDate>Fri, 25 Feb 2011 23:04:22 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[diff]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[mergetool]]></category>
		<category><![CDATA[Project13]]></category>
		<category><![CDATA[SCM]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[training]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=1192</guid>
		<description><![CDATA[As I&#8217;ll be leading BOTH a presentation and a workshop about git at the upcomming Academic It Festival I&#8217;m preparing myselffor the most problematic of all problems&#8230; MS Windows! Just kidding ;-) But it&#8217;s highly probable that most users will have Windows installed on their notebooks so I&#8217;ll better be prepared :-) One of the [...]]]></description>
			<content:encoded><![CDATA[<p>As I&#8217;ll be leading BOTH a presentation and a workshop about git at the upcomming <a href="http://sfi.org.pl/edycja-2011/prelegenci" onclick="urchinTracker('/outgoing/sfi.org.pl/edycja-2011/prelegenci?referer=');">Academic It Festival</a> I&#8217;m preparing myselffor the most problematic of all problems&#8230; MS Windows! Just kidding ;-) But it&#8217;s highly probable that most users will have Windows installed on their notebooks so I&#8217;ll better be prepared :-) One of the things woth using for merges is&#8230; the mergetool. My favourite (besides intellij) is <strong>KDiff3</strong> it really rocks and usability and look and feel are on a very high standard.</p>
<p>As I&#8217;d rather show the participants around git and not just &#8220;how the hell do I use vimdiff?!&#8221; I&#8217;m posting this little snippet on howto use KDiff3 on windows. Of course we&#8217;re probably going to have quite simple conflicts that could easily be conflicted without tooling but it&#8217;s nice to have one prepared when you need one. So, this is what you need to run KDiff3 on windows as a mergetool (paste this inside of your <strong>.git/config </strong>file)</p>
<pre>
<code>[merge]
    tool = kdiff3

[mergetool "kdiff3"]
    path = C:/Program Files/KDiff3/kdiff3.exe
    keepBackup = false
    trustExitCode = false
</code>
</pre>
<p>And you&#8217;ll need to download kdiff3 for windows of course, this can be done on <a href="http://sourceforge.net/projects/kdiff3/files/kdiff3/0.9.95/" onclick="urchinTracker('/outgoing/sourceforge.net/projects/kdiff3/files/kdiff3/0.9.95/?referer=');">their sourceforga page</a>. And that&#8217;s basically it. I&#8217;ll reconfirm that this really works tomorrow as I&#8217;m getting somewhat tired already&#8230; Well then&#8230;</p>
<p><em>Gundam fighters set, ready&#8230;.. goooo!</em><br />
<em style="font-size:xx-small">* stupid quote from  G Gundam ;-)</em></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/1192/setup-git-on-windows-to-use-kdiff3-as-its-mergetool/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tweets in WordPress; same timeline but skip in rss feed</title>
		<link>http://www.blog.project13.pl/index.php/project13/938/tweets-in-wordpress-same-timeline-but-skip-in-rss-feed/</link>
		<comments>http://www.blog.project13.pl/index.php/project13/938/tweets-in-wordpress-same-timeline-but-skip-in-rss-feed/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 22:00:56 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[Project13]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[twitter]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=938</guid>
		<description><![CDATA[Hi guys, todays post is about yet another fun and small hack, namely: Having twitter posts (tweets) to be displayed right along all wordpress blog posts (posts) in the same timeline (wordpress main view). しかし!!! As my blog is being listed on http://www.dworld.pl/Blogsfera (and for other obvious reasons) I didn&#8217;t want all my tweets to [...]]]></description>
			<content:encoded><![CDATA[<p>Hi guys, todays post is about yet another fun and small hack, namely: Having twitter posts (tweets) to be displayed right along all wordpress blog posts (posts) in the same timeline (wordpress main view). <strong><acronym title="but (in japanese)">しかし</acronym>!!!</strong></p>
<p>As my blog is being listed on <a href="http://www.dworld.pl/Blogsfera" onclick="urchinTracker('/outgoing/www.dworld.pl/Blogsfera?referer=');">http://www.dworld.pl/Blogsfera</a> (and for other obvious reasons) I didn&#8217;t want all my tweets to be translated &#8220;1 to 1&#8243; to plain old blog posts since this would cause each of my tweets (which can be silly sometimes (but quite <strong>rarely!</strong>)) to land on dworld, which they obviously shouldn&#8217;t as it&#8217;s only an place for Java/Development oriented posts. Also I&#8217;d rather they&#8217;d take less space, and would skip all the categories/tags &#8211; it&#8217;s all in the tweet, so why repeat it again and again?</p>
<p>So&#8230; let&#8217;s start by importing tweets into wordpress. There&#8217;s an great plugin for that, and it&#8217;s called <strong><a href="http://skinju.com/wordpress/tweet-import" onclick="urchinTracker('/outgoing/skinju.com/wordpress/tweet-import?referer=');">Tweet Import</a> by skinju</strong>. Just install it and set it up to fetch your tweet&#8217;s at an regular basis. Ok, we&#8217;re done with step 1 &#8211; but neither are the current tweets smaller or ommitted in the rss feed. Let&#8217;s start by filtering them out from the rss feed:</p>
<p>Open up the file <em><strong>/wp-content/themes/default/functions.php </strong></em>and go to the end of the file, we&#8217;ll add an filter here. Please note that in step 1 you should have created an &#8220;twitter&#8221; category all tweets should be marked with. Let&#8217;s assume this category has an ID of 131, then the following code would do the filtering for us:</p>
<div class="geshi no php">
<div class="head">//add at end of file</div>
<ol>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span> ?php</div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// filter out twitter posts from feed</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">function</span> exclude_category<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="kw1">if</span> <span class="br0">&#40;</span> is_feed<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="coMULTI">/* || is_home()*/</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;set_query_var<span class="br0">&#40;</span><span class="st0">&#39;cat&#39;</span><span class="sy0">,</span> <span class="st0">&#39;-131&#39;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">add_filter<span class="br0">&#40;</span><span class="st0">&#39;pre_get_posts&#39;</span><span class="sy0">,</span> <span class="st0">&#39;exclude_category&#39;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">?&gt;</span></div>
</li>
</ol>
</div>
<p>It&#8217;s a very nice trick, and it&#8217;s <a href="http://zeo.my/exclude-category-in-wordpress/" onclick="urchinTracker('/outgoing/zeo.my/exclude-category-in-wordpress/?referer=');">explained more in detail here</a>. The code is really simple, so no explaining here and let&#8217;s go and tune our view (<strong>yup, the RSS feed is already fixed!</strong>).</p>
<p>To setup our view to work a little different for tweets than for posts, well have to edit: <em><strong>/wp-content/themes/maze/index.php</strong></em> so open it up in your favourite editor and add such an if statement inside an post&#8217;s while statement:</p>
<div class="geshi no php">
<div class="head">//add the 2nd line, the rest is just here for the ease of locating the right place</div>
<ol>
<li class="li1">
<div class="de1">&nbsp; <span class="sy0">&lt;</span> ?php <span class="kw1">while</span> <span class="br0">&#40;</span>have_posts<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="sy0">:</span> the_post<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="kw2">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;</span> ?php <span class="kw1">if</span> <span class="br0">&#40;</span>in_category<span class="br0">&#40;</span><span class="st0">&#39;twitter&#39;</span><span class="br0">&#41;</span> <span class="sy0">==</span> <span class="kw2">false</span><span class="br0">&#41;</span><span class="sy0">:</span> <span class="co1">//display post?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;</span>div id<span class="sy0">=</span><span class="st0">&quot;post-&lt;?php the_ID(); ?&gt;&quot;</span><span class="sy0">&gt;&lt;/</span>div<span class="sy0">&gt;</span></div>
</li>
</ol>
</div>
<p>Ok, with this done let&#8217;s write the else part&#8230;</p>
<div class="geshi no php">
<div class="head">//the else for the above if</div>
<ol>
<li class="li1">
<div class="de1"><span class="sy0">&lt;</span> ?php <span class="kw1">else</span><span class="sy0">:</span> <span class="co1">//display tweet ?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;</span>div id<span class="sy0">=</span><span class="st0">&quot;tweet-&lt;?php the_ID(); ?&gt;&quot;</span> style<span class="sy0">=</span><span class="st0">&quot;padding: 15px 15px 0 0&quot;</span><span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;</span>div style<span class="sy0">=</span><span class="st0">&quot;background:none repeat scroll 0 0 #262626; font-size:12px; font-weight:normal; line-height:12px; margin:0 30px 10px 0; padding:5px 5px 5px 10px;&quot;</span><span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;</span> ?php the_content<span class="br0">&#40;</span><span class="st0">&#39;Read More&#8230;&#39;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="kw2">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;/</span>div<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;</span>div<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;Tweeted by <span class="sy0">&lt;</span>a href<span class="sy0">=</span><span class="st0">&quot;http://www.twitter.com/ktosopl&quot;</span><span class="sy0">&gt;@</span>ktosopl<span class="sy0">&lt;/</span>a<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">@</span> <span class="sy0">&lt;</span>a href<span class="sy0">=</span><span class="st0">&quot;&lt;?php $key=&quot;</span>tweetimport_twitter_post_uri<span class="st0">&quot;; echo get_post_meta($post-&gt;ID, $key, true); ?&gt;&quot;</span><span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;</span> ?php <span class="re1">$key</span><span class="sy0">=</span><span class="st0">&quot;tweetimport_date_imported&quot;</span><span class="sy0">;</span> <span class="kw3">echo</span> get_post_meta<span class="br0">&#40;</span><span class="re1">$post</span><span class="sy0">-&gt;</span><span class="me1">ID</span><span class="sy0">,</span> <span class="re1">$key</span><span class="sy0">,</span> <span class="kw2">true</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="kw2">?&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;/</span>a<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="sy0">&lt;/</span>div<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;/</span>div<span class="sy0">&gt;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;<span class="sy0">&lt;</span> ?php <span class="kw1">endif</span> <span class="co1">//end display mode if?&gt;</span></div>
</li>
</ol>
</div>
<p><em>(You can complain about the in line css styling if you want later, I know it&#8217;s bad but this wordpress theme is a mess anyways&#8230; ;-))</em> Let&#8217;s have a look at the more important parts of this code part. You&#8217;ll notice that I&#8217;m using some weird <strong>get_post_meta()</strong> function. It&#8217;s an method that fetches additional information that each post CAN but doesn&#8217;t have to have. And as the TweetImport plugin does fill an post with a lot of useful tweet data, such as post time and tweet url &#8211; that&#8217;s what I&#8217;m fetching here. The rest should be quite self explanatory, there are bit&#8217;s of hardcoded &#8220;ktosopl&#8221; in there but hey &#8211; it&#8217;s just my blog and I&#8217;m a busy person ;-)</p>
<p>Hope you found this post interesting and maybe you&#8217;ll implement the same thing on your blogs&#8230;? :-)<br />
Cheers!</p>
<p>PS: Oh, and if your interested in talking on one of your upcomming JavaCamps &#8211; feel free to contact me or anyone from the <a href="http://www.java.pl" onclick="urchinTracker('/outgoing/www.java.pl?referer=');"><strong>java.pl</strong></a> team, we&#8217;re looking forward to hearing from you. The nearest meeting will probably be organized around 23&#8242;th or 6&#8242;th&#8230;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/project13/938/tweets-in-wordpress-same-timeline-but-skip-in-rss-feed/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NetBeans Platform Lookups as communication method</title>
		<link>http://www.blog.project13.pl/index.php/coding/640/netbeans-platform-lookups-as-communication-method/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/640/netbeans-platform-lookups-as-communication-method/#comments</comments>
		<pubDate>Sun, 23 May 2010 14:54:28 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[english]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[agh]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[netbeans platform]]></category>
		<category><![CDATA[studies]]></category>
		<category><![CDATA[tips]]></category>
		<category><![CDATA[web dev]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=640</guid>
		<description><![CDATA[Helo again! Today&#8217;s post will be an super quick usage scenario for NetBeans Platform Lookups &#8211; the probably most essential part of the Platform. An super simple explanation of them is &#8220;an Map&#60;Class, Object&#62;&#8221;. Sounds simple right? Well it is, and it&#8217;s quite powerful at the same time. It enables you to loosely couple parts [...]]]></description>
			<content:encoded><![CDATA[<p style="text-align: center;"><a href="http://github.com/ktoso/TravelingSalesman-NBP/raw/master/doc/screenshots/pieknygraforazwykresy.png" onclick="urchinTracker('/outgoing/github.com/ktoso/TravelingSalesman-NBP/raw/master/doc/screenshots/pieknygraforazwykresy.png?referer=');"><img class="aligncenter" title="Traveling Salesman on NetBeansPlatform" src="http://github.com/ktoso/TravelingSalesman-NBP/raw/master/doc/screenshots/pieknygraforazwykresy.png" alt="Traveling Salesman on NetBeansPlatform" width="300" /></a></p>
<p>Helo again! Today&#8217;s post will be an super quick usage scenario for <strong>NetBeans Platform Lookups</strong> &#8211; the probably most essential part of the Platform. An super simple explanation of them is &#8220;an Map&lt;Class, Object&gt;&#8221;. Sounds <strong>simple </strong>right? Well<strong> it is,</strong> and it&#8217;s quite powerful at the same time. It enables you to loosely couple parts of your app, create extension points etc. Another use case is passing some date around in the app, but you don&#8217;t know where the modules interested in this data are (because you&#8217;re loosely coupled, right?). In an app I&#8217;ve been writing for my Uni since some days, I&#8217;ve used the Lookup to do exactly this &#8211; pass data from an algorithm to an LineChartDrawer that then will update it&#8217;s chart each time the data is being updated.</p>
<p>This is going to be<strong> quite similar </strong>to an  <a href="http://en.wikipedia.org/wiki/Observer_pattern" onclick="urchinTracker('/outgoing/en.wikipedia.org/wiki/Observer_pattern?referer=');">Observer Pattern</a> implementation, but using the lookup as notification mechanism. Let&#8217;s start out with our Algorithm class (and module &#8211; note that this module is not dependent on the chart drawing module!)</p>
<div class="geshi no java">
<div class="head">package pl.edu.netbeans.algorithms;</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.util.Exceptions;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.util.Lookup;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.util.LookupListener;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.util.lookup.AbstractLookup;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.util.lookup.InstanceContent;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.windows.TopComponent;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.windows.WindowManager;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import pl.edu.netbeans.algorithms.genetic.Chromosom;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import pl.edu.netbeans.algorithms.genetic.Population;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import pl.edu.netbeans.toolbox.ChartDataDTO;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import prefuse.data.Graph;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;* The algorithm implementation, does some stuff and throws the data into an DTO which is packed into the lookup</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;* @author ktoso</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">class</span> FirstTSSolverAction <span class="kw2">extends</span> SolverAction <span class="kw2">implements</span> TSSolverAction, Lookup.<span class="kw3">Provider</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> <span class="kw2">final</span> Population population<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//just to get us some fancy names for this algorithm</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> <span class="kw2">static</span> <span class="kw4">int</span> simcount = <span class="nu0">1</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> <span class="kw2">final</span> <span class="kw3">String</span> SIMULATION_ID = <span class="st0">&quot;symulacja &quot;</span> + FirstTSSolverAction.<span class="me1">simcount</span>++<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="coMULTI">/*</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* Here we&#39;re setting up the Lookup, to work with dynamic content, thanks to this,</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* we&#39;ll be able to modify it&#39;s contents and notify all listeners after some change has happened</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> InstanceContent dynamicContent = <span class="kw2">new</span> InstanceContent<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> Lookup myLookup = <span class="kw2">new</span> AbstractLookup<span class="br0">&#40;</span>dynamicContent<span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//AbstractLookup is NOT an abstract class, it&#39;s an &quot;general purpose lookup&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> Lookup.<span class="me1">Result</span> res<span class="sy0">;</span> <span class="co1">//this is only here because I want to use allItems down there bellow, otherwise it would be just a variable in the method bellow</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> FirstTSSolverAction<span class="br0">&#40;</span>Graph graph<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">super</span><span class="br0">&#40;</span>graph<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* This is not an Runnable class but the run method will act quite the same as if it was,</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* as our framework will call it in constant time delays. We do all the computing here.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw4">void</span> run<span class="br0">&#40;</span><span class="kw4">double</span> frac<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>population.<span class="me1">shouldStop</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//&#8230; stop the execution etc.</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; population.<span class="me1">nextGeneration</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; Chromosom ch = population.<span class="me1">getBestChromosom</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">int</span> numerGeneracji = population.<span class="me1">getNumerGeneracji</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">double</span> avgFitness = population.<span class="me1">getAvgFitness</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">double</span> maxFitness = population.<span class="me1">getWorstFittness</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw4">double</span> minFitness = population.<span class="me1">getBestFitness</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; log<span class="br0">&#40;</span><span class="st0">&quot;Generacja &quot;</span> + numerGeneracji + <span class="st0">&quot;: naj. chromosom: &quot;</span> + ch + <span class="st0">&quot; (&quot;</span> + avgFitness + <span class="st0">&quot;)&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/* Słuchający tego lookup zostaną powiadomieni o zmianie, przerysują wykres */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; dynamicContent.<span class="me1">add</span><span class="br0">&#40;</span><span class="kw2">new</span> ChartDataDTO<span class="br0">&#40;</span>SIMULATION_ID, numerGeneracji, avgFitness, maxFitness, minFitness<span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; res.<span class="me1">allItems</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><span class="co1">//I found it quite helpful in order to be sure that the listeners will notice the change</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* Since we&#39;re an Lookup.Provider, let&#39;s provide our lookup!</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* It can be implemented in multiple ways, but let&#39;s just return our lookup this time.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> Lookup getLookup<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> myLookup<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* Poszukuje oraz ustawia listenera implementującego LineChartDrawer</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* aby ten reagował na każdorazową zmianę w naszym lookup &#8211; aktualizował wykres</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @SuppressWarnings<span class="br0">&#40;</span><span class="st0">&quot;unchecked&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> <span class="kw4">void</span> setupLineGraphDrawerListener<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//a sucky but good enough implementation for our usecase</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//Better solution: You could use another Lookup to find implementations of the &quot;LineGrapghDrawer&quot; interface and then use this instance here!</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; TopComponent drawer = WindowManager.<span class="me1">getDefault</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">findTopComponent</span><span class="br0">&#40;</span><span class="st0">&quot;FitnessGraphTopComponent&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span> </div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span>drawer == <span class="kw2">null</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//depending on if you need this or not, throw exceptions or just ignore this if you dont need it</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//throw new RuntimeException(&quot;Nie znaleziono implementacji FitnessGraphTopComponent. Nikt mnie nie słucha!&quot;);</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//or&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; log<span class="br0">&#40;</span><span class="st0">&quot;No FittnessGraphTopComponent found. That&#39;s OK, so I will continue without it&#8230;&quot;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//below is the actual settup of our &quot;observer&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; res = myLookup.<span class="me1">lookup</span><span class="br0">&#40;</span><span class="kw2">new</span> Lookup.<span class="me1">Template</span><span class="br0">&#40;</span>ChartDataDTO.<span class="kw2">class</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//setup the resultset to react to changes of ChartDataDTOs in it</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; res.<span class="me1">allItems</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span><span class="co1">//THIS IS IMPORTANT! Help out the lookup by &quot;refreshing&quot; its contents</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; res.<span class="me1">addLookupListener</span><span class="br0">&#40;</span><span class="br0">&#40;</span>LookupListener<span class="br0">&#41;</span> drawer<span class="br0">&#41;</span><span class="sy0">;</span><span class="co1">//setup the listener to the drawer we found</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>The code is well commented for this post so take a moment and read through it. It&#8217;s just some pieces of the actual class we&#8217;re using &#8211; so no actual computing stuff is shown here, let&#8217;s focus on the lookups. Note that I&#8217;m getting the TopComponent that I&#8217;ll add as an listener &#8220;by name&#8221;, it&#8217;s super simple but would you need to &#8220;find some implementation of some drawer interface&#8221; just use an lookup and get the instance, or even all the instances of such interface implementations. That said, this solution is not the most universal here (getting the instance) but it&#8217;s good enough for our app since it&#8217;s a very small application. No let&#8217;s look at the &#8220;Observer&#8221;, better named as &#8220;LookupListener&#8221;:</p>
<div class="geshi no java">
<div class="head">package pl.edu.netbeans.visualization;</div>
<ol>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.awt.BorderLayout;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.util.ArrayList;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.util.Collection;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.util.Iterator;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.util.List;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import java.util.logging.Logger;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.jfree.chart.ChartFactory;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.jfree.chart.ChartPanel;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.jfree.chart.JFreeChart;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.jfree.chart.axis.ValueAxis;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.jfree.chart.plot.PlotOrientation;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.jfree.chart.plot.XYPlot;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.jfree.data.xy.XYDataset;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.jfree.data.xy.XYSeries;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.jfree.data.xy.XYSeriesCollection;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.util.NbBundle;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.windows.TopComponent;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.windows.WindowManager;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.netbeans.api.settings.ConvertAsProperties;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.util.Lookup;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.util.LookupEvent;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import org.openide.util.LookupListener;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import pl.edu.netbeans.toolbox.ChartDataDTO;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import pl.edu.netbeans.toolbox.LineChartDrawer;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co2">import prefuse.Visualization;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;* Top component which will draw graphs for all the data it gets&#8230;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1">@ConvertAsProperties<span class="br0">&#40;</span>dtd = <span class="st0">&quot;-//pl.edu.netbeans.visualization//FitnessGraph//EN&quot;</span>,</div>
</li>
<li class="li1">
<div class="de1">autostore = <span class="kw2">false</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">public</span> <span class="kw2">final</span> <span class="kw2">class</span> FitnessGraphTopComponent <span class="kw2">extends</span> TopComponent <span class="kw2">implements</span> LookupListener, LineChartDrawer <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> <span class="kw2">static</span> FitnessGraphTopComponent instance<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> <span class="kw2">static</span> <span class="kw2">final</span> <span class="kw3">String</span> PREFERRED_ID = <span class="st0">&quot;FitnessGraphTopComponent&quot;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//&#8230; skipped all the computing/drawing stuff</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> FitnessGraphTopComponent<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; initComponents<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; setupChart<span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; setName<span class="br0">&#40;</span>NbBundle.<span class="me1">getMessage</span><span class="br0">&#40;</span>FitnessGraphTopComponent.<span class="kw2">class</span>, <span class="st0">&quot;CTL_FitnessGraphTopComponent&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; setToolTipText<span class="br0">&#40;</span>NbBundle.<span class="me1">getMessage</span><span class="br0">&#40;</span>FitnessGraphTopComponent.<span class="kw2">class</span>, <span class="st0">&quot;HINT_FitnessGraphTopComponent&quot;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//note how easy it will be to internationalize this app :-)</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">// &nbsp; &nbsp; &nbsp; &nbsp;setIcon(ImageUtilities.loadImage(ICON_PATH, true));</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; putClientProperty<span class="br0">&#40;</span>TopComponent.<span class="me1">PROP_CLOSING_DISABLED</span>, <span class="kw3">Boolean</span>.<span class="kw2">TRUE</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; putClientProperty<span class="br0">&#40;</span>TopComponent.<span class="me1">PROP_MAXIMIZATION_DISABLED</span>, <span class="kw3">Boolean</span>.<span class="kw2">FALSE</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; putClientProperty<span class="br0">&#40;</span>TopComponent.<span class="me1">PROP_SLIDING_DISABLED</span>, <span class="kw3">Boolean</span>.<span class="kw2">TRUE</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//skipped graph drawing/setup parts, this post is about lookups only ;-)</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;  <span class="co1">//&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">protected</span> <span class="kw3">String</span> preferredID<span class="br0">&#40;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">return</span> PREFERRED_ID<span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="coMULTI">/**</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* This is our resultChanged listener. It will be called if the resultSet we&#39;re observing is changed.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;* Note that &quot;changed&quot; means all CRUD operations on it.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="coMULTI">&nbsp; &nbsp; &nbsp;*/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; @Override</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">public</span> <span class="kw4">void</span> resultChanged<span class="br0">&#40;</span>LookupEvent ev<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; Lookup.<span class="me1">Result</span> res = <span class="br0">&#40;</span>Lookup.<span class="me1">Result</span><span class="br0">&#41;</span> ev.<span class="me1">getSource</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//this is always an safe cast!</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">Collection</span> instances = res.<span class="me1">allInstances</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//we get all instances from the lookup</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span> <span class="br0">&#40;</span><span class="sy0">!</span>instances.<span class="me1">isEmpty</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">Iterator</span> it = instances.<span class="me1">iterator</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">while</span> <span class="br0">&#40;</span>it.<span class="me1">hasNext</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw3">Object</span> o = it.<span class="me1">next</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>o <span class="kw2">instanceof</span> ChartDataDTO<span class="br0">&#41;</span><span class="br0">&#123;</span><span class="co1">//you might wan to use this &#8211; better safe than sorry, check if you got what you expected!</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ChartDataDTO o = <span class="br0">&#40;</span>ChartDataDTO<span class="br0">&#41;</span> it.<span class="me1">next</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="sy0">;</span> <span class="co1">//If not sure if this will always be the case, use an if( instanceof ) here!</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; addDTO2Series<span class="br0">&#40;</span>o<span class="br0">&#41;</span><span class="sy0">;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw2">private</span> <span class="kw4">void</span> addDTO2Series<span class="br0">&#40;</span>ChartDataDTO chartDataDTO<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="co1">//&#8230;add the stuff to the graphs&#8230;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="co1">//&#8230;</span></div>
</li>
<li class="li1">
<div class="de1"><span class="br0">&#125;</span></div>
</li>
</ol>
</div>
<p>That&#8217;s about it. We simply have an<strong> resultChanged()</strong> method that <strong>will be called if the contents of the resultset are changed.</strong> We might also want to arr more lookups to be observed, so it&#8217;s better to check this instanceof I think than not, since there might be some unexpected stuff inside of it&#8230;</p>
<p>All in all, you write an <strong>Lookup.Provider</strong> and <strong>LookupListener,</strong> implement both&#8217;s methods and then at some place in your app hook them up. It doesn&#8217;t really matter &#8220;who looks for who&#8221; as long as it&#8217;s consistent and logical. In this case, the algorithm is looking for people interested in his data. Note that at any moment in time, we can add another listener, no problems here. Note that the <strong>Lookup.Provider and LookupListener are quite similar to the Observer and Observables</strong> mentioned before.And the good thing is, the algorithm does not know about any concrete drawer, and the drawer has no idea about some algorithm. They just have one shared API module &#8211; the toolbox, in which there is the <strong>DataTransferObject</strong> we&#8217;re using to pass the data from one to another &#8211; yay, an <strong>loosely coupled</strong> system. (yeah, I know our code is tightly coupled at some other places, but this part is quite ok :-))</p>
<p>If you have anything you&#8217;d like to comment on this code, feel free to do so. It&#8217;s just parts taken from <a href="http://github.com/ktoso/TravelingSalesman-NBP" onclick="urchinTracker('/outgoing/github.com/ktoso/TravelingSalesman-NBP?referer=');">http://github.com/ktoso/TravelingSalesman-NBP</a> our implementation and visualization of the <strong>Traveling Salesman Problem</strong> being solved by <a href="http://pl.wikipedia.org/wiki/Algorytm_genetyczny" onclick="urchinTracker('/outgoing/pl.wikipedia.org/wiki/Algorytm_genetyczny?referer=');"><strong>Genetic Algorithms</strong></a>.</p>
<p>For more information about lookups goto: <a href="http://netbeans.dzone.com/articles/netbeans-lookups-explained" onclick="urchinTracker('/outgoing/netbeans.dzone.com/articles/netbeans-lookups-explained?referer=');">a nice post by Anton Epple on dzone.com</a> or to <a href="http://netbeans.dzone.com/news/top-10-netbeans-apis-part-2" onclick="urchinTracker('/outgoing/netbeans.dzone.com/news/top-10-netbeans-apis-part-2?referer=');">Geertjan&#8217;s post with some good links</a> or <a href="http://www.antonioshome.net/blog/2008/20081023-1.php" onclick="urchinTracker('/outgoing/www.antonioshome.net/blog/2008/20081023-1.php?referer=');">http://www.antonioshome.net/blog/2008/20081023-1.php</a></p>
<hr />
<strong>Update!</strong> Geertjan contacted me and suggested I&#8217;d post this on netbeans.dzone.com as it&#8217;s quite an interesting post &#8211; and so I did :-) You can <a href="http://netbeans.dzone.com/articles/netbeans-platform-lookups" onclick="urchinTracker('/outgoing/netbeans.dzone.com/articles/netbeans-platform-lookups?referer=');">read and comment it now on dzone.com</a>. Hope to get some feedback if this is good or bad code, would be quite helpful :-)</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/640/netbeans-platform-lookups-as-communication-method/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Installing Git with Gitosis</title>
		<link>http://www.blog.project13.pl/index.php/project13/477/installing-git-with-gitosis/</link>
		<comments>http://www.blog.project13.pl/index.php/project13/477/installing-git-with-gitosis/#comments</comments>
		<pubDate>Sun, 07 Mar 2010 15:22:40 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Project13]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[gitosis]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[terminal]]></category>
		<category><![CDATA[webdeveloper]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=477</guid>
		<description><![CDATA[Git is really simple and VERY powerfull. It makes svn look like an idiot &#8211; but that&#8217;s just my personal opinion ;-) Anyways, I&#8217;m using github most of the time, but now I&#8217;d like to hava a non public repository (yet remote) for some small project. I&#8217;ve been commiting to a local git instance from [...]]]></description>
			<content:encoded><![CDATA[<p>Git is really simple and VERY powerfull. It makes svn look like an idiot &#8211; but that&#8217;s just my personal opinion ;-)</p>
<p>Anyways, I&#8217;m using github most of the time, but now I&#8217;d like to hava a non public repository (yet remote) for some small project. I&#8217;ve been commiting to a local git instance from the begining of this project so just pushing it into a new repo will be really simple.</p>
<p>I wanted to have som easy to administer localozed git to serve hit hosting for my friends etc. So this is how I did it:</p>
<p>On server:</p>
<div class="geshi no bash">
<div class="head"># do this as root of course</div>
<ol>
<li class="li1">
<div class="de1"><span class="kw3">cd</span> ~<span class="sy0">/</span>src</div>
</li>
<li class="li1">
<div class="de1">git clone git:<span class="sy0">//</span>eagain.net<span class="sy0">/</span>gitosis.git</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">cd</span> gitosis</div>
</li>
<li class="li1">
<div class="de1">.<span class="sy0">/</span>setup.py <span class="kw2">install</span></div>
</li>
<li class="li1">
<div class="de1">useradd git</div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#end of obvious stuff</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">gitosis-init <span class="sy0">&lt;</span> <span class="sy0">/</span>location<span class="sy0">/</span>of<span class="sy0">/</span>administrators<span class="sy0">/</span>public<span class="sy0">/</span>id_rsa.pub <span class="co0">#this will allow you to administer gitosis remotely</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw2">sudo</span> <span class="kw2">chmod</span> <span class="nu0">755</span> <span class="sy0">/</span>home<span class="sy0">/</span>git<span class="sy0">/</span>repositories<span class="sy0">/</span>gitosis-admin.git<span class="sy0">/</span>hooks<span class="sy0">/</span>post-update <span class="co0"># in case gitosis-init didn&#39;t do this already</span></div>
</li>
</ol>
</div>
<p>Now we can do all the administration without being logged in into our server &#8211; just by using git!
</pre>
<div class="geshi no bash">
<div class="head">#all of the following is done LOCALLY!</div>
<ol>
<li class="li1">
<div class="de1">git clone git<span class="sy0">@</span>stratos:gitosis-admin.git</div>
</li>
<li class="li1">
<div class="de1"><span class="kw3">cd</span> gitosis-admin</div>
</li>
<li class="li1">
<div class="de1">vim gitosis.conf <span class="co0">#edit groups and repositories</span></div>
</li>
<li class="li1">
<div class="de1">writable = bla is responsible <span class="kw1">for</span> the repositories</div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#for example you could setup:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#then just do the stuff you would normally do with git:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#[group secret-group]</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#writable = bla</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#members = ktoso@homunculus ktoso@protos</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#here&#39;s how your dir structure should look like</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#├── gitosis.conf #repository configuration</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#└── keydir #put all (ssh) public keys of your users in here</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># &nbsp; &nbsp;├── ktoso@homunculus.pub</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># &nbsp; &nbsp;└── ktoso@protos.pub</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#now just do what you would normally do with a git repository</span></div>
</li>
<li class="li1">
<div class="de1">git add .</div>
</li>
<li class="li1">
<div class="de1">git commit -m <span class="st0">&#39;new repo: bla&#39;</span></div>
</li>
<li class="li1">
<div class="de1">git push</div>
</li>
</ol>
</div>
<p>You can then just pull/clone this repo:</p>
<pre lang="bash">git clone git://stratos/bla.git</pre>
<p>Yeah, this post isn't much of an discovery - yet I wanted to show you how SIMPLE and SCALABLE a simple git repository can be. For mor information about git and gitosis see: <a href="http://www.google.com/search?q=google+gitosis" onclick="urchinTracker('/outgoing/www.google.com/search?q=google+gitosis&amp;referer=');">a simple google search</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/project13/477/installing-git-with-gitosis/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>jQuery tricks 1: automatic-wslider</title>
		<link>http://www.blog.project13.pl/index.php/coding/345/jquery-tricks-1-automatic-wslider/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/345/jquery-tricks-1-automatic-wslider/#comments</comments>
		<pubDate>Fri, 11 Dec 2009 22:19:12 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[free]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[web dev]]></category>
		<category><![CDATA[webdeveloper]]></category>
		<category><![CDATA[webmaster]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=345</guid>
		<description><![CDATA[This time I&#8217;ll post some actual code. A client wanted me to write an &#8220;image slider&#8221;. You&#8217;ve probably seen lot&#8217;s of them online &#8211; and a whole lot of them is in flash &#8211; why? There is no need to involve flash in such a trivial task, and jQuery is more than up to the [...]]]></description>
			<content:encoded><![CDATA[<p>This time I&#8217;ll post some actual code. A client wanted me to write an &#8220;image slider&#8221;. You&#8217;ve probably seen lot&#8217;s of them online &#8211; and a whole lot of them is in flash &#8211; why? There is no need to involve flash in such a trivial task, and jQuery is more than up to the job :-) I used <strong>jQuery</strong> with the <strong>wslide plugin</strong>, it&#8217;s simple and quite neat. But it does not slide on it&#8217;s own. But thanks to it&#8217;s simplicity I was able add the functionality I needed in just a few lines of clean code. I used the <strong>timer</strong> plugin to &#8220;click&#8221; on the slider at some interval and voila &#8211; the birth of an automatic jquery image slider. Anyways, here&#8217;s thecode:</p>
<div class="geshi no javascript">
<ol>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="kw2">var</span> canDo = <span class="kw2">true</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="coMULTI">/** plugin @author: http://www.webinventif.fr/wslide-plugin/ */</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span>document<span class="br0">&#41;</span>.<span class="me1">ready</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$<span class="br0">&#40;</span><span class="st0">&#39;#slidermenu, #slider, .cube&#39;</span><span class="br0">&#41;</span>.<span class="me1">mouseover</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; canDo = <span class="kw2">false</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>.<span class="me1">mouseout</span><span class="br0">&#40;</span><span class="kw2">function</span><span class="br0">&#40;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; canDo = <span class="kw2">true</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#39;#slider&#39;</span><span class="br0">&#41;</span>.<span class="me1">wslide</span><span class="br0">&#40;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; width: <span class="nu0">900</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; height: <span class="nu0">200</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pos: <span class="nu0">1</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; fade: <span class="kw2">true</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; horiz: <span class="kw2">true</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; autolink: <span class="st0">&#39;slidermenu&#39;</span>,</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; speed:<span class="nu0">300</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $.<span class="me1">timer</span><span class="br0">&#40;</span><span class="nu0">5000</span>, <span class="kw2">function</span> <span class="br0">&#40;</span>timer<span class="br0">&#41;</span> <span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>canDo<span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="kw1">if</span><span class="br0">&#40;</span>$<span class="br0">&#40;</span><span class="st0">&#39;#slidermenu a:last&#39;</span><span class="br0">&#41;</span>.<span class="me1">hasClass</span><span class="br0">&#40;</span><span class="st0">&#39;wactive&#39;</span><span class="br0">&#41;</span><span class="br0">&#41;</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#39;#slidermenu a:first&#39;</span><span class="br0">&#41;</span>.<span class="me1">click</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="kw1">else</span><span class="br0">&#123;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; $<span class="br0">&#40;</span><span class="st0">&#39;#slidermenu .wactive&#39;</span><span class="br0">&#41;</span>.<span class="me1">next</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">click</span><span class="br0">&#40;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; &nbsp; <span class="br0">&#125;</span><span class="br0">&#41;</span>;</div>
</li>
</ol>
</div>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/345/jquery-tricks-1-automatic-wslider/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		</item>
		<item>
		<title>mencoder mastery &#8211; part 1</title>
		<link>http://www.blog.project13.pl/index.php/coding/98/mencoder-mastery-part-1/</link>
		<comments>http://www.blog.project13.pl/index.php/coding/98/mencoder-mastery-part-1/#comments</comments>
		<pubDate>Tue, 18 Aug 2009 14:46:32 +0000</pubDate>
		<dc:creator>Ktoso</dc:creator>
				<category><![CDATA[coding]]></category>
		<category><![CDATA[guide]]></category>
		<category><![CDATA[hack]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[mencoder]]></category>
		<category><![CDATA[trick]]></category>

		<guid isPermaLink="false">http://www.blog.project13.pl/?p=98</guid>
		<description><![CDATA[Skoro była taka seria z wgetem, to przyszedł czas na to samo z mencoderem. mencoder to program do ogólnie pojętej obróbki plików video. Jeżeli korzystasz z jakiegoś okienkowego programu do modyfikowania wideo pod linuksem, z dużym prawdopodobieństwem jest on nakładką na mencodera :&#62; Dzisiejszy temat to obracanie całego filmu: mencoder -ovc lavc -vf rotate=1 -oac [...]]]></description>
			<content:encoded><![CDATA[<p>Skoro była taka seria z wgetem, to przyszedł czas na to samo z mencoderem. mencoder to program do ogólnie pojętej obróbki plików video. Jeżeli korzystasz z jakiegoś okienkowego programu do modyfikowania wideo pod linuksem, z dużym prawdopodobieństwem jest on nakładką na mencodera :&gt;</p>
<p>Dzisiejszy temat to <strong>obracanie całego filmu</strong>:</p>
<div class="geshi no bash">
<div class="head">mencoder -ovc lavc -vf rotate=1 -oac copy input.mpg -o output.mpg</div>
<ol>
<li class="li1">
<div class="de1"><span class="co0">#Objaśnienia:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#-ovc = output video codec</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#-oac = output audio codec</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#-vf = video filters, pozwala na zakolejkowanie różnych filtrów do wykonania, my korzystamy tylko z jednego:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0">#rotate=X = obraca cały materiał video przy czym X należy do:</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># &nbsp; &nbsp;0 Rotate by 90 degrees clockwise and flip (default).</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># &nbsp; &nbsp;1 Rotate by 90 degrees clockwise.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># &nbsp; &nbsp;2 Rotate by 90 degrees counterclockwise.</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co0"># &nbsp; &nbsp;3 Rotate by 90 degrees counterclockwise and flip.</span></div>
</li>
</ol>
</div>
<p>Masowe obrócenie filmików z wakacji teraz nagle stało się proste czyż nie? :-) Czemu się tym zainteresowałem można by się spytać&#8230; otóż obracałem filmik nagrania mojej nowej popierdółki w j2me: Xplode. ale to już materiał na kolejny wpis.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blog.project13.pl/index.php/coding/98/mencoder-mastery-part-1/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

