<?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>code name</title>
	<atom:link href="http://victorsergienko.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://victorsergienko.com</link>
	<description>Programming: Java, Groovy, C++, .NET, OOD, a little this and that</description>
	<lastBuildDate>Wed, 06 Feb 2013 11:08:17 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.5.1</generator>
		<item>
		<title>Fast Windows JSON pretty-printer</title>
		<link>http://victorsergienko.com/fast-windows-json-pretty-printer/</link>
		<comments>http://victorsergienko.com/fast-windows-json-pretty-printer/#comments</comments>
		<pubDate>Wed, 06 Feb 2013 11:07:34 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=210</guid>
		<description><![CDATA[Just built a Win32 version of yajl, a comandline C JSON pretty-printer and validator. Viva CMake. Welcome to downoad.]]></description>
				<content:encoded><![CDATA[<p>Just built a Win32 version of <a href="http://lloyd.github.com/yajl/">yajl</a>, a comandline C JSON pretty-printer and validator. Viva CMake.<br />
<a href="http://victorsergienko.com/files/lloyd-yajl-f4b2b1a.zip">Welcome to downoad</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/fast-windows-json-pretty-printer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The dead end of Russian software engineer?</title>
		<link>http://victorsergienko.com/the-dead-end-of-russia-software-engineer/</link>
		<comments>http://victorsergienko.com/the-dead-end-of-russia-software-engineer/#comments</comments>
		<pubDate>Wed, 12 Dec 2012 17:00:08 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[howdy]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=202</guid>
		<description><![CDATA[Ex-USSR has got a great school of engineers. Russia is the 3rd software outsourcing country (market) in the world. Russian (let&#8217;s use the name, though I&#8217;m Ukrainian, for instance) engineers are very educated and think out of the box. We got OOP gurus, Java buddhas, UI Picassos, Haskell Lamas, agile addicts and tech team management [...]]]></description>
				<content:encoded><![CDATA[<p>Ex-USSR has got a great school of engineers. Russia is the 3rd software outsourcing country (market) in the world.<br />
Russian (let&#8217;s use the name, though I&#8217;m Ukrainian, for instance) engineers are very educated and think out of the box.</p>
<p>We got OOP gurus, Java buddhas, UI Picassos, Haskell Lamas, agile addicts and tech team management professionals. Even some good business analysts.</p>
<p>This leads them nowhere. Most of them don&#8217;t have a decent area to apply their superior skills.<br />
<span id="more-202"></span><br />
Most of them stay employed in software outsourcing, the best paid engineering area&#8230; with no perspective.</p>
<p>The whole essence of software outsourcing means you got CxOs (including CTO) onshore, and software team offshore. They don&#8217;t hire anyone higher than a team leader there, period.</p>
<p>If you got the experience to move into management area, still — people here rarely start their own companies — because of fear, procrastination, lack of business knowledge/education/infrastructure or connections, family that needs that daytime job, or because of the USSR anti-commercial culture that is still strong in engineering estate. I&#8217;m probably describing myself now.</p>
<p>So we got a lot of people who grew ready for CTO/VPE positions &#8211; very limited in a ways to found a company, find funding, or create an own product.</p>
<p>Apparently, the next step should be to go find an investor or a founder&#8230; I personally have no idea where to look. But I&#8217;m going to try.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/the-dead-end-of-russia-software-engineer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Getting Glassfish stdout logging under control</title>
		<link>http://victorsergienko.com/getting-glassfish-stdout-logging-under-control/</link>
		<comments>http://victorsergienko.com/getting-glassfish-stdout-logging-under-control/#comments</comments>
		<pubDate>Wed, 21 Nov 2012 14:59:22 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=195</guid>
		<description><![CDATA[By default, Glassfish does an ugly thing: takes an application&#8217;s stdout/stderr and wraps it into its own log with INFO level for stdout and WARN level for stderr. Other logging facility normally log to stdout. In the end, a log entry looks pretty stupidly (and it&#8217;s damn multiline!): [#&#124;2012-11-21T11:25:07.225+0200&#124;INFO&#124;glassfish3.1.2&#124;javax.enterprise.system.std.com.sun.enterprise.server.logging&#124;_ThreadID=100;_ThreadName=Thread-2;&#124;11:25:07.225 [http-thread-pool-8080(2)] DEBUG c.mycompany.packages.SomeClass - Finally, some [...]]]></description>
				<content:encoded><![CDATA[<p>By default, Glassfish does an ugly thing: takes an application&#8217;s <code>stdout/stderr</code> and wraps it into its own log with INFO level for stdout and WARN level for stderr.<br />
Other logging facility normally log to stdout.<br />
In the end, a log entry looks pretty stupidly (and it&#8217;s damn multiline!):</p>
<p><code>[#|2012-11-21T11:25:07.225+0200|INFO|glassfish3.1.2|javax.enterprise.system.std.com.sun.enterprise.server.logging|_ThreadID=100;_ThreadName=Thread-2;|11:25:07.225 [http-thread-pool-8080(2)] DEBUG c.mycompany.packages.SomeClass - Finally, some useful text!<br />
|#]</code></p>
<p>One can <a href="http://www.slf4j.org/api/org/slf4j/bridge/SLF4JBridgeHandler.html">replace a Glassfish logging server-wide</a>.<br />
There&#8217;s a <code>logging.properties</code> file in the root of Glassfish domain, it has a &#8220;<code>handlers</code>&#8221; property that one can swap for Logback&#8217;s handler.<br />
Of course, this requires adding <a href="http://www.slf4j.org/legacy.html#jul-to-slf4j">Logback JUL</a> bridge to Glassfish classpath.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/getting-glassfish-stdout-logging-under-control/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rendering QR codes to SVG</title>
		<link>http://victorsergienko.com/rendering-qr-codes-to-svg/</link>
		<comments>http://victorsergienko.com/rendering-qr-codes-to-svg/#comments</comments>
		<pubDate>Wed, 21 Nov 2012 13:12:58 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=191</guid>
		<description><![CDATA[Had a hard time rendering a QR-code to SVG. Drawing simple rect-s didn&#8217;t work well, visible gaps appeared between bars. I looked for a SVG QR renderer, but apparently neither zxing nor other libraries have a gapless algorithm. There is an online renderer by Kerem Erkan that uses path tag, but the author is apparently [...]]]></description>
				<content:encoded><![CDATA[<p>Had a hard time rendering a QR-code to SVG. Drawing simple <code>rect</code>-s didn&#8217;t work well, <a href="http://tinkerbin.com/73t2Oz33">visible gaps</a> appeared between bars.</p>
<p>I looked for a SVG QR renderer, but apparently neither <a href="http://code.google.com/p/zxing/">zxing</a> nor other libraries have a gapless algorithm. There is an <a href="http://keremerkan.net/qr-code-and-2d-code-generator/">online renderer</a> by Kerem Erkan that uses <code>path</code> tag, but the author is apparently not intending to publish the code.</p>
<p>The closest algorithm that CAN be used to render a QR code as a whole path is <a href="http://en.wikipedia.org/wiki/Marching_squares">marching squares</a>, with a usable implementation <a href="http://www.tomgibara.com/computer-vision/marching-squares">here</a>. Still there&#8217;s a lot to be done in order to render a whole path, mostly hole detection.</p>
<p>Luckily, it was enough <a href="http://stackoverflow.com/questions/13457803/avoid-line-between-tiled-svg-rects-that-are-not-pixel-aligned">to group the <code>rect</code>-s together</a> with a <code>g</code> tag.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/rendering-qr-codes-to-svg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Now on free CDN</title>
		<link>http://victorsergienko.com/now-on-free-cdn/</link>
		<comments>http://victorsergienko.com/now-on-free-cdn/#comments</comments>
		<pubDate>Wed, 11 Apr 2012 10:13:40 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[howdy]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=182</guid>
		<description><![CDATA[Thanks to Dreamhost, now running on CloudFlare CDN. WP Super Cache happily supports it. BTW CloudFlare got a free plan, and it&#8217;s easy to set up so that it doesn&#8217;t interfere: Add a cdn subdomain to your hosting; Add your domain to CloudFlare; On CloudFlare, disable CDN for all subdomains except for cdn. Set up [...]]]></description>
				<content:encoded><![CDATA[<p>Thanks to <a href="http://dreamhost.com/">Dreamhost</a>, now running on <a href="http://www.cloudflare.com/">CloudFlare</a> CDN.<br />
<a href="http://ocaoimh.ie/wp-super-cache/">WP Super Cache</a> happily supports it.</p>
<p>BTW <a href="http://www.cloudflare.com/">CloudFlare</a> got a free plan, and it&#8217;s easy to set up so that it doesn&#8217;t interfere:</p>
<ul>
<li>Add a <strong>cdn</strong> subdomain to your hosting;</li>
<li>Add your domain to CloudFlare;</li>
<li>On CloudFlare, disable CDN for all subdomains except for <strong>cdn.</strong></li>
<li>Set up your site to serve static content from <strong>cdn.*</strong>. Do it by hand, by <code>mod_rewrite</code> or whatever &mdash; I am using <a href="http://ocaoimh.ie/wp-super-cache/">WordPress &#8220;WP Super Cache&#8221; plugin</a> here.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/now-on-free-cdn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Got a StackOverflow careers invitation.</title>
		<link>http://victorsergienko.com/got-a-stackoverflow-careers-invitation/</link>
		<comments>http://victorsergienko.com/got-a-stackoverflow-careers-invitation/#comments</comments>
		<pubDate>Thu, 04 Aug 2011 13:51:26 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[howdy]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=173</guid>
		<description><![CDATA[They do a pretty cool thing: force you to tell &#8220;the truth&#8221; — no matter how subjective this term is — as opposed to emasculated official style: what you really did (whatever it means to you); what opensource/published projects did you participate in; Top Stack questions you answered; your professional reading and (sic!) writing. Here [...]]]></description>
				<content:encoded><![CDATA[<p>They do a pretty cool thing: force you to tell &#8220;the truth&#8221; — no matter how subjective this term is — as opposed to emasculated official style:</p>
<ul>
<li>what you really did (whatever it means to you);</li>
<li>what opensource/published projects did you participate in;</li>
<li>Top Stack questions you answered;</li>
<li>your professional reading and (sic!) writing.</li>
</ul>
<p>Here I am: <a href="http://careers.stackoverflow.com/victors">http://careers.stackoverflow.com/victors</a><br />
(have to complete it still)</p>
<p>Got 5 invites btw.<br />
Actually, just testing a new <a href="http://code.google.com/p/ljxp/">LiveJournal crosspost plugin</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/got-a-stackoverflow-careers-invitation/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		</item>
		<item>
		<title>Why I don&#8217;t like GMock</title>
		<link>http://victorsergienko.com/why-i-dont-like-gmock/</link>
		<comments>http://victorsergienko.com/why-i-dont-like-gmock/#comments</comments>
		<pubDate>Wed, 16 Feb 2011 10:55:51 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[GMock]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[TDD]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=161</guid>
		<description><![CDATA[I don&#8217;t like GMock. It&#8217;s not as if it was badly written or designed. But it lets you to unit-test dirtier code, tying to method call structure instead of resulting data. For instance, this GMock code can be rewritten: loggingService.sendNotification(match{ !it.shouldNotify() }).stub() loggingService.sendNotification(match { it.shouldNotify() &#38;&#38; it instanceof HubOfflineNotification &#38;&#38; it.deadEntities == [hub] }) loggingService.saveEvent(LogEventType.HUB_BECAME_OFFLINE, [...]]]></description>
				<content:encoded><![CDATA[<p>I don&#8217;t like <a href="http://gmock.org/">GMock</a>.</p>
<p>It&#8217;s not as if it was badly written or designed. But it lets you to unit-test dirtier code, tying to method call structure instead of resulting data.</p>
<p>For instance, this GMock code can be rewritten:<br />
<span id="more-161"></span></p>
<pre class="brush: php">
        loggingService.sendNotification(match{ !it.shouldNotify() }).stub()
        loggingService.sendNotification(match {
            it.shouldNotify() &amp;&amp; it instanceof HubOfflineNotification &amp;&amp; it.deadEntities == [hub]
        })
        loggingService.saveEvent(LogEventType.HUB_BECAME_OFFLINE, match { it }, customer)
        loggingService.saveEvent(LogEventType.CAMERA_DIED, match { it }, customer).never()

        play {
            loggingService.reportHealth(diff)
        }
</pre>
<p>to:</p>
<pre class="brush: php">
        eventLogService.reportHealthDiff(diff)

        assertEquals 1, LogEvent.countByEventType(LogEventType.AGENT_BECAME_OFFLINE)
        assertEquals 0, LogEvent.countByEventType(LogEventType.METER_BECAME_DEAD)
        assertEquals 1, LogEvent.countByEventType(LogEventType.SENDING_NOTIFICATION)
</pre>
<p>which relies only to call outcome, and not to implementation details.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/why-i-dont-like-gmock/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Groovy Comparator for class field names</title>
		<link>http://victorsergienko.com/groovy-comparator-for-class-field-names/</link>
		<comments>http://victorsergienko.com/groovy-comparator-for-class-field-names/#comments</comments>
		<pubDate>Tue, 15 Feb 2011 14:23:19 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=157</guid>
		<description><![CDATA[I wonder why this was not in JDK/Groovy Collections. Just put together a Comparator for StackOverflow question &#8211; a Groovy Comparator that would sort class field names in the declaration order. Feel free to use: class PropComparator implements Comparator { private Class clazz PropComparator(Class clazz) { this.clazz = clazz } int compare(Object o1, Object o2) [...]]]></description>
				<content:encoded><![CDATA[<p>I wonder why this was not in JDK/Groovy Collections.</p>
<p>Just put together a Comparator for StackOverflow question &#8211; a Groovy Comparator that would sort class field names in the declaration order. Feel free to use:</p>
<p><code>
<pre>class PropComparator implements Comparator {
    private Class clazz
    PropComparator(Class clazz) { this.clazz = clazz }

    int compare(Object o1, Object o2) {
        clazz.declaredFields.findIndexOf{it.name == o1} 
          - clazz.declaredFields.findIndexOf{it.name == o2}
    }
}</pre>
<p></code></p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/groovy-comparator-for-class-field-names/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Couple of Grails tricks to remember: reload scaffolding and fieldValue formatting</title>
		<link>http://victorsergienko.com/couple-o-grails-tricks-reload-scaffolding-and-fieldvalue-formatting/</link>
		<comments>http://victorsergienko.com/couple-o-grails-tricks-reload-scaffolding-and-fieldvalue-formatting/#comments</comments>
		<pubDate>Tue, 14 Dec 2010 15:29:09 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=149</guid>
		<description><![CDATA[Grails doesn&#8217;t reload scaffolding on-the-fly if you change local templates. But you can open a Groovy console inside application and run in it: org.codehaus.groovy.grails.scaffolding.view. &#160;&#160;&#160;&#160;ScaffoldingViewResolver.scaffoldedViews.clear() In order to change default g:fieldValue formatting for, say, BigDecimal, have a CustomEditorRegistrar in your resources.groovy, and register custom PropertyEditor: registry.registerCustomEditor(BigDecimal.class, 'myProperty', &#160;&#160;&#160;&#160;new OurBigDecimalEditor(BigDecimal.class))]]></description>
				<content:encoded><![CDATA[<ul>
<li>Grails doesn&#8217;t reload scaffolding on-the-fly if you change local templates. But you can open a Groovy console inside application and run in it:<br />
<code>org.codehaus.groovy.grails.scaffolding.view.<br />
&nbsp;&nbsp;&nbsp;&nbsp;ScaffoldingViewResolver.scaffoldedViews.clear()</code><br/></li>
<li>
In order to change default <code>g:fieldValue</code> formatting for, say, BigDecimal, have a CustomEditorRegistrar in your resources.groovy, and register custom PropertyEditor:<br />
<code>registry.registerCustomEditor(BigDecimal.class, 'myProperty',<br />
&nbsp;&nbsp;&nbsp;&nbsp;new OurBigDecimalEditor(BigDecimal.class))</code></li>
<ul>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/couple-o-grails-tricks-reload-scaffolding-and-fieldvalue-formatting/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DB2 supports LIMIT and OFFSET syntax, in MySQL compatibility layer&#8230;</title>
		<link>http://victorsergienko.com/db2-supports-limit-and-offset/</link>
		<comments>http://victorsergienko.com/db2-supports-limit-and-offset/#comments</comments>
		<pubDate>Mon, 29 Nov 2010 13:28:35 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=133</guid>
		<description><![CDATA[It hasn&#8217;t even been a ten years that DB2, one of the most, er, expensive DBMSes, got a feature needed by every other application &#8211; dataset paging. Before, you had to use window functions rownumber() and fetch first 40 rows only. When used by Hibernate, this resulted ugliness like: select * from ( select inner2_.*, [...]]]></description>
				<content:encoded><![CDATA[<p>It hasn&#8217;t even been a ten years that DB2, one of the most, er, expensive DBMSes, got a feature needed by every other application &#8211; dataset paging.</p>
<p>Before, you had to use <a href="http://en.wikipedia.org/wiki/SQL_window_function#Limiting_result_rows">window functions</a> <strong>rownumber()</strong> and <strong>fetch first 40 rows only</strong>. When used by Hibernate, this resulted ugliness like:</p>
<pre class="brush: sql">
select * from ( 
  select inner2_.*, rownumber() over(order by order of inner2_) as rownumber_ 
  from ( 
    select  ...
    fetch first 40 rows only
    ) as inner2_
  ) as inner1_ 
where rownumber_ &gt; 20 
order by rownumber_
</pre>
<p>Since this summer version &#8211; DB2 9.7.2 &#8211; you can just append LIMIT and OFFSET:<span id="more-133"></span></p>
<pre class="brush: sql">SELECT ... LIMIT 5 OFFSET 10</pre>
<p>No wrapping into 2 (!!!) external SELECTs.<br />
One downside is that mighty DB2 does have MySQL compatibility layer mode. Turn it on when starting DB2:</p>
<pre class="brush: bash">
$ db2set DB2_COMPATIBILITY_VECTOR=MYS
$ db2stop
$ db2start
</pre>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/db2-supports-limit-and-offset/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Prim&#8217;s allgorithm in Groovy: inspired by Fortran and Java versions</title>
		<link>http://victorsergienko.com/prims-allgorithm-in-groovy-inspired-by-fortran-and-java-versions/</link>
		<comments>http://victorsergienko.com/prims-allgorithm-in-groovy-inspired-by-fortran-and-java-versions/#comments</comments>
		<pubDate>Mon, 18 Oct 2010 09:43:02 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[groovy]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=126</guid>
		<description><![CDATA[A friend of mine defended Fortran against half-literate coders on an example of Prim&#8217;s allgorithm. Good pretext for another language comparison. Let&#8217;s see Groovy vs Java vs good old Fortran. Great Fortran implementation Great Java implementation by Bruno R. Preiss, P.Eng. and scientist. Some beginner&#8217;s C+ implementation (or is it just a link farm? Whatever). [...]]]></description>
				<content:encoded><![CDATA[<p>A friend of mine defended Fortran against half-literate coders on an example of Prim&#8217;s allgorithm.</p>
<p>Good pretext for another language comparison. Let&#8217;s see Groovy vs Java vs good old Fortran.</p>
<p><a href="http://lib.stat.cmu.edu/apstat/13">Great Fortran implementation</a></p>
<p><a href="http://www.brpreiss.com/books/opus5/programs/pgm16_17.txt">Great Java implementation by Bruno R. Preiss, P.Eng. and scientist.</a></p>
<p>Some <a href="http://ds4beginners.wordpress.com/2006/10/05/prims-algorithm-for-minimum-spanning-tree/">beginner&#8217;s C+ implementation</a> (or is it just a link farm? Whatever).</p>
<p>And here&#8217;s the algorithm in Groovy, copied as precisely as possible from pseudocode in <a href="http://ru.wikipedia.org/wiki/%D0%90%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC_%D0%9F%D1%80%D0%B8%D0%BC%D0%B0#.D0.9F.D1.81.D0.B5.D0.B2.D0.B4.D0.BE.D0.BA.D0.BE.D0.B4">Russian Wikipedia article</a>.<br />
<span id="more-126"></span></p>
<pre class="brush: groovy">
class Edge {
    Integer v1
    Integer v2
    Integer weight

    Edge(Integer v1, Integer v2, Integer w) {
        this.v1 = v1
        this.v2 = v2
        this.weight = w
    }

    boolean contains(Integer v) { v1 == v || v2 == v }
    Integer otherThan(Integer v) { v1 == v ? v2 : v1 }
}

class Graph {
    List&lt;Integer&gt; V
    Collection&lt;Edge&gt; E

    // Dumbest implementation
    List&lt;Integer&gt; getIncident(Integer v) { E.findAll{ it.contains(v) }.collect{ it.otherThan(v) } }
    Edge findEdge(Integer v1, Integer v2) { E.find{ it.contains(v1) &amp;&amp; it.contains(v2) } }
    Number weight(Integer v1, Integer v2) { findEdge(v1, v2)?.weight ?: Double.POSITIVE_INFINITY }
}

Collection&lt;Edge&gt; prim(Graph G) {
    Set&lt;Edge&gt; T = []
    Map&lt;Integer, Number&gt; d = [:] + G.V.collect { new MapEntry(it, Double.POSITIVE_INFINITY) }
    Map&lt;Integer, Integer&gt; p = [:] + G.V.collect { new MapEntry(it, null) }
    d[G.V[0]] = 0

    List&lt;Integer&gt; Q = G.V.collect{it}
    Q.metaClass.extractMin = { -&gt;
        // Dumbest implementation
        int minimum = Q.min { d[it] }
        int indexOfMinimum = Q.indexOf(minimum) // here Groovy fails to make a shortcut.
        return Q.remove(indexOfMinimum)
    }

    Integer v = Q.extractMin()
    while (!Q.isEmpty()) {
        G.getIncident(v).each { Integer u -&gt;
            if(Q.contains(u) &amp;&amp; G.weight(u, v) &lt; d[u]) {
                d[u] = G.weight(u, v)
                p[u] = v
            }
        }
        v = Q.extractMin()
        T &lt;&lt; G.findEdge(p[v], v)
    }

    return T
}

void testPrim() {
    Set&lt;Edge&gt; expected = [
        new Edge(1, 2, 1),
        new Edge(2, 3, 1),
        new Edge(3, 4, 1),
        new Edge(4, 5, 1),
    ]

    Set&lt;Edge&gt; edges = [
        new Edge(1, 3, 2),
        new Edge(1, 4, 3),
        new Edge(1, 5, 2),
        new Edge(2, 4, 7),
        new Edge(3, 5, 2),
    ]

    Graph G = new Graph(V: 1..5, E: expected + edges)

    Set&lt;Edge&gt; T = prim(G)
    assert expected.equals(T)
    println &quot;it worked!&quot;
}

testPrim()</pre>
<p>Not too bad, er? I see only a couple of Groovy overhead points: constructing a Map from collect{}, and absence of findIndexOfMin().<br />
Of course, we could avoid long type declarations, but I like strict typing.<br />
Make your conclusions.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/prims-allgorithm-in-groovy-inspired-by-fortran-and-java-versions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Precise Redmine burndown chart</title>
		<link>http://victorsergienko.com/precise-redmine-burndown-chart/</link>
		<comments>http://victorsergienko.com/precise-redmine-burndown-chart/#comments</comments>
		<pubDate>Mon, 11 Oct 2010 09:28:30 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[Redmine]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=119</guid>
		<description><![CDATA[I&#8217;m thinking of precise Redmine burdown chart, which is not so simple. It has to build burdown chart for a given sprint (Version in Redmine). It has to account issues added to Version and removed from during the sprint. It, after all, has to account for what is considered &#8220;closed&#8221; status, which might be one [...]]]></description>
				<content:encoded><![CDATA[<p>I&#8217;m thinking of precise <a href="http://redmine.org">Redmine</a> burdown chart, which is not so simple.</p>
<ul>
<li>It has to build burdown chart for a given sprint (Version in Redmine).</li>
<li>It has to account issues added to Version and removed from during the sprint.</li>
<li>It, after all, has to account for what is considered &#8220;closed&#8221; status, which might be one of non-stock, custom statuses.</li>
</ul>
<p>There are couple of Redmine addons, but for now I&#8217;m precautious about installing them. They are:</p>
<ul>
<li><a href="http://www.redmine.org/boards/3/topics/4014">ScrumAlliance Burndown</a> is outdated and unsupported for now;</li>
<li><a href="http://www.redminebacklogs.net/">RedmineBacklogs</a> looks very promising and tasty.</li>
</ul>
<p>For now, I do it by hand. I put together a SQL query to get me the data:<br />
<span id="more-119"></span></p>
<pre class="brush: sql">select 
  i.id, i.subject, i.estimated_hours, 
  j.created_on, jd.value, s.name new_status,
  old_versions.name old_version,
  new_versions.name new_version

from
  issues i
  inner join journals j on j.journalized_id = i.id and j.journalized_type = &#039;Issue&#039;
  inner join journal_details jd on jd.journal_id = j.id
  inner join versions on i.fixed_version_id = versions.id
  left outer join issue_statuses s on s.id = jd.value
  left outer join versions old_versions 
    on jd.prop_key = &#039;fixed_version_id&#039; 
      and jd.old_value = old_versions.id
  left outer join versions new_versions 
    on jd.prop_key = &#039;fixed_version_id&#039; 
      and jd.value = new_versions.id
    
where 
  (versions.name = &#039;1.0.8&#039; or old_versions.name = &#039;1.0.8&#039; or new_versions.name = &#039;1.0.8&#039;)
  and property = &#039;attr&#039;
  and jd.prop_key in (&#039;status_id&#039;, &#039;fixed_version_id&#039;)

order by i.id, created_on</pre>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/precise-redmine-burndown-chart/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Google Buzz button for WordPress</title>
		<link>http://victorsergienko.com/google-buzz-button-for-wordpress/</link>
		<comments>http://victorsergienko.com/google-buzz-button-for-wordpress/#comments</comments>
		<pubDate>Fri, 12 Feb 2010 10:09:44 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=116</guid>
		<description><![CDATA[Just installed a shiny new Google Buzz button for WordPress by Tejaswini, Sanjeev. I hacked it a bit, to align to the right. Download this plugin version here, until author updates it. I&#8217;m replacing a diggIt button; Buzz fits my color scheme better Enjoy.]]></description>
				<content:encoded><![CDATA[<p>Just installed a shiny new <a href="http://www.clickonf5.org/google-buzz-button-wordpress">Google Buzz button for WordPress by Tejaswini, Sanjeev</a>.<br />
I hacked it a bit, to align to the right. <a href="http://victorsergienko.com/files/google-buzz-button-1.1.zip">Download this plugin version here</a>, until author updates it.</p>
<p>I&#8217;m replacing a diggIt button; Buzz fits my color scheme better <img src='http://victorsergienko.com/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>Enjoy.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/google-buzz-button-for-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>&#8220;group by&#8221; clause in GORM/HibernateCriteriaBuilder</title>
		<link>http://victorsergienko.com/group-by-clause-in-gormhibernatecriteriabuilder/</link>
		<comments>http://victorsergienko.com/group-by-clause-in-gormhibernatecriteriabuilder/#comments</comments>
		<pubDate>Mon, 08 Feb 2010 17:33:08 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[Hibernate]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=110</guid>
		<description><![CDATA[Just in case someone needs a code snippet. This one groups Prices by PriceProvider and was intended to pick only last 5 values for each PriceProvider – but sadly, it&#8217;s impossible without window functions. Which are not supported in Hibernate in any way. def c = Price.createCriteria() c.list { priceProvider { company { country { [...]]]></description>
				<content:encoded><![CDATA[<p>Just in case someone needs a code snippet.<br />
This one groups Prices by PriceProvider and was intended to pick only last 5 values for each PriceProvider – but sadly, it&#8217;s impossible without <a href="http://en.wikipedia.org/wiki/Window_function_%28SQL%29#Window_function">window functions</a>. Which are not supported in Hibernate in any way.<br />
<span id="more-110"></span></p>
<pre><code>def c = <span style="color: #00007F; font-weight: bold;">Price</span>.createCriteria()
c.list {
    <span style="color: black;">priceProvider</span> {
        <span style="color: black;">company</span> {
            <span style="color: black;">country</span> {
                <span style="color: black;">eq</span>(<span style="color: red;">'currency.id'</span>, 1L)
            }
        }
    }
    <span style="color: black;">projection</span>(
       groupProperty(<span style="color: red;">'id'</span>)
    )
    <span style="color: black;">order</span>(<span style="color: red;">'timestamp'</span>, <span style="color: red;">'desc'</span>)
}</code></pre>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/group-by-clause-in-gormhibernatecriteriabuilder/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Hibernate join bug</title>
		<link>http://victorsergienko.com/hibernate-join-bug-createfromjoinelement/</link>
		<comments>http://victorsergienko.com/hibernate-join-bug-createfromjoinelement/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 17:35:44 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[Main]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[Hibernate]]></category>
		<category><![CDATA[HQL]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=102</guid>
		<description><![CDATA[Hibernate bug 1895 seems to be still there since 2006. If, for instance, in Grails, such a syntax won&#8217;t work for you (it won&#8217;t): def books = Book.findAll("FROM Book AS b JOIN Chapter AS c WHERE c.active = :isActive") with a NullPointerException in &#8220;HqlSqlWalker.createFromJoinElement&#8221; &#8212; just use alternative join syntax, via WHERE: def books = [...]]]></description>
				<content:encoded><![CDATA[<p><a href="http://opensource.atlassian.com/projects/hibernate/browse/HHH-1895">Hibernate bug 1895</a> seems to be still there since 2006.<br />
If, for instance, in Grails, such a syntax won&#8217;t work for you (it won&#8217;t):</p>
<p><code>def books = Book.findAll("FROM Book AS b JOIN Chapter AS c WHERE c.active = :isActive")</code></p>
<p>with a NullPointerException in &#8220;HqlSqlWalker.createFromJoinElement&#8221; &mdash; just use alternative join syntax, via WHERE:</p>
<p><code>def books = Book.executeQuery("select b FROM Book AS b, Chapter AS c WHERE c.active = :isActive")</code></p>
<p>Move <a href="http://docs.jboss.org/hibernate/stable/core/reference/en/html/queryhql.html#queryhql-joins">&#8220;WITH&#8221;</a> conditions to &#8220;WHERE&#8221; as needed.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/hibernate-join-bug-createfromjoinelement/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Self-update library for .NET using WiX: DotUpdater</title>
		<link>http://victorsergienko.com/self-update-library-for-net-using-wix-dotupdater/</link>
		<comments>http://victorsergienko.com/self-update-library-for-net-using-wix-dotupdater/#comments</comments>
		<pubDate>Thu, 03 Sep 2009 11:48:43 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[.net]]></category>
		<category><![CDATA[tools]]></category>
		<category><![CDATA[WiX]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=97</guid>
		<description><![CDATA[Just published a library I created on one of past jobs out of Updater Application Block and WiX&#8217;s ClichThrough component. Please meet: DotUpdater It can auto-update an application, just create a RSS feed of updates and Windows Installer (MSI) binaries.]]></description>
				<content:encoded><![CDATA[<p>Just published a library I created on one of past jobs out of Updater Application Block and WiX&#8217;s ClichThrough component.<br />
Please meet: <a href="http://dotupdater.codeplex.com/">DotUpdater</a><br />
It can auto-update an application, just create a RSS feed of updates and Windows Installer (MSI) binaries.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/self-update-library-for-net-using-wix-dotupdater/feed/</wfw:commentRss>
		<slash:comments>20</slash:comments>
		</item>
		<item>
		<title>Link Taxonomy Terms to Views in Drupal</title>
		<link>http://victorsergienko.com/link-taxonomy-terms-to-views-in-drupal/</link>
		<comments>http://victorsergienko.com/link-taxonomy-terms-to-views-in-drupal/#comments</comments>
		<pubDate>Fri, 07 Aug 2009 13:46:30 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[Drupal]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=90</guid>
		<description><![CDATA[Imagine a task (actually, quite common), if you have: a nodes (articles, ads, whatever) taxonomy in Drupal, a taxonomy-based url path rewrites, like /monkeys/primates/homosapiens and want to show a block/page View with articles only from current path term (and, maybe, its subterms). It might be a hard time finding out the current term. One could [...]]]></description>
				<content:encoded><![CDATA[<p>Imagine a task (actually, quite common), if you have: </p>
<ul>
<li>a nodes (articles, ads, whatever) taxonomy in Drupal, </li>
<li>a taxonomy-based url path rewrites, like <em>/monkeys/primates/homosapiens</em> </li>
<li>and want to show a block/page View with articles <strong>only</strong> from current path term (and, maybe, its subterms).</li>
</ul>
<p>It might be a hard time finding out the current term. One could try <a href="http://www.leveltendesign.com/blog/dustin-currie/link-taxonomy-terms-custom-views-drupal">having two nested views</a>, passing a current term as a parameter to nested view, like Dustin Currie did.</p>
<p>Though, Views has several pre-defined solutions. Just go to /admin/build/views/ and enable this one: <strong>&#8220;Default Node view: taxonomy_term&#8221;</strong>, (clone it to play safe), voila!</p>
<p>You got a View for the current term.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/link-taxonomy-terms-to-views-in-drupal/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Diff a Micorosoft Office documents inder SVN?</title>
		<link>http://victorsergienko.com/diff-a-micorosoft-office-documents-inder-svn/</link>
		<comments>http://victorsergienko.com/diff-a-micorosoft-office-documents-inder-svn/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 15:56:28 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[tools]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=85</guid>
		<description><![CDATA[In case you, like me, need to compare version of Office documents (under Windows), just know that TortoiseSVN got a pretty set of scripts for that. It works out of box! YES! You can compare Office documents just like plaintext files!. Just tried it and it worked. If you were afraid of trying, like me [...]]]></description>
				<content:encoded><![CDATA[<p>In case you, like me, need to compare version of Office documents (under Windows), just know that <a href="http://tortoisesvn.tigris.org/">TortoiseSVN</a> got a pretty <a href="http://tortoisesvn.tigris.org/source/browse/tortoisesvn/trunk/contrib/diff-scripts/">set of scripts</a> for that.<br />
It works out of box!<br />
YES!<br />
<strong>You can compare Office documents just like plaintext files!</strong>.<br />
Just tried it and it worked. If you were afraid of trying, like me &#8211; don&#8217;t be.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/diff-a-micorosoft-office-documents-inder-svn/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Grails: mocking domain objects in unit tests</title>
		<link>http://victorsergienko.com/grails-mocking-domain-objects-in-unit-tests/</link>
		<comments>http://victorsergienko.com/grails-mocking-domain-objects-in-unit-tests/#comments</comments>
		<pubDate>Mon, 13 Jul 2009 09:13:19 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[grails]]></category>
		<category><![CDATA[groovy]]></category>
		<category><![CDATA[java]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=79</guid>
		<description><![CDATA[We&#8217;re trying Grails, Rails-like web application framework for Java. It&#8217;s fine, just that Groovy debugger support is, er, imperfect, even in the best Gruoovy IDE &#8211; IDEA. And, if you want to unit test, you won&#8217;t have fancy domain class methods addTo* &#8211; like Customer.addToOrders(). They&#8217;re generated by Grails on startup. In order to have [...]]]></description>
				<content:encoded><![CDATA[<p>We&#8217;re trying <a href="http://grails.org/">Grails</a>, <a href="http://rubyonrails.org/">Rails</a>-like web application framework for Java.<br />
It&#8217;s fine, just that Groovy debugger support is, er, imperfect, even in the best Gruoovy IDE &#8211; IDEA.</p>
<p>And, if you want to unit test, you won&#8217;t have fancy domain class methods addTo* &#8211; like Customer.addToOrders().<br />
They&#8217;re generated by Grails on startup.<br />
In order to have addTo*(), inherit from GrailsUnitTestCase and call mockDomain(Customer) in setUp().</p>
<p>Oh, if you get <code>"NullPointerException: Cannot invoke method containsKey() on null object"</code>, add super.setUp() to yout testcase&#8217;s setUp().</p>
<p>Having proper save() is more tricky. Implementation from mockDomain() works to some extent: it won&#8217;t save connected objects.<br />
So, in order to get save() working, you have to do something like this:<br />
<span id="more-79"></span></p>
<pre class="ruby">    <span class="color: #0000ff;" >def</span> savedCustomers = []

    void setUp() {
        <span class="color: #0000ff;" >super</span>.setUp()
        Customer.metaClass.save = { saveCustomer(delegate) }
        mockDomain(Customer, savedCustomers)
    }

    private <span class="color: #0000ff;" >def</span> saveCustomer(c) {
        savedCustomers.add(c)
        <span class="color: #0000ff;" >if</span> (c.orders != null) {
            c.orders.<span class="color: #0000ff;" >each</span> { x -&gt; x.save() }
        }
    }
</pre>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/grails-mocking-domain-objects-in-unit-tests/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>&#8220;Project Dependencies&#8221; of Visual Studio 2008 broken in MSBuild</title>
		<link>http://victorsergienko.com/project-dependencies-of-visual-studio-2008-broken-in-msbuild/</link>
		<comments>http://victorsergienko.com/project-dependencies-of-visual-studio-2008-broken-in-msbuild/#comments</comments>
		<pubDate>Thu, 20 Nov 2008 15:37:37 +0000</pubDate>
		<dc:creator>Victor Sergienko</dc:creator>
				<category><![CDATA[blog]]></category>
		<category><![CDATA[MSBuild]]></category>

		<guid isPermaLink="false">http://victorsergienko.com/?p=70</guid>
		<description><![CDATA[Just dealt with another Visual Studio 2008 &#8220;feature&#8221;. You can specify all the necessary &#8220;Project Dependencies&#8221; in Visual Studio, but will get &#8220;CSC : error CS0006: Metadata file FooBar.dll could not be found&#8220;. Even if your csproj files have correct references to other solution projects, msbuild will fail. Maybe it appears only if project output [...]]]></description>
				<content:encoded><![CDATA[<p>Just dealt with another Visual Studio 2008 &#8220;feature&#8221;.</p>
<p>You can specify all the necessary &#8220;Project Dependencies&#8221; in Visual Studio, but will get &#8220;<em><strong>CSC : error CS0006: Metadata file FooBar.dll could not be found</strong></em>&#8220;. Even if your csproj files have correct references to other solution projects, <strong>msbuild will fail</strong>.<br />
Maybe it appears only if project output path is outside of project directory.</p>
<p>It appears that Visual Studio keeps the dependencies in two ways, only one of which is read by MSBuild. I see that because I still can specify dependencies in GUI, copy solution to other machine and build it with VS in correct order.</p>
<p>Not with MSBuild.</p>
<p>The data needed by MSBuild is a &#8220;<code>ProjectSection(ProjectDependencies) = postProject</code>&#8221; section of SLN file. Like this:</p>
<p><span id="more-70"></span>
<pre><code>Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "make_versioninfo", "make_versioninfo.vcproj", "{<strong>F0E0541E-F17D-430B-97C4-93ADF0DD284E</strong>}"
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "pythoncore", "pythoncore.vcproj", "{CF7AC3D1-E2DF-41D2-BEA6-1E2556CDEA26}"
	ProjectSection(ProjectDependencies) = postProject
		{<strong>F0E0541E-F17D-430B-97C4-93ADF0DD284E</strong>} = {<strong>F0E0541E-F17D-430B-97C4-93ADF0DD284E</strong>}
	EndProjectSection
EndProject</code></pre>
<p>Note where to take the GUID of a referenced project.<br />
If you create this section by hand, your project will build.</p>
<p>Not too much fun, if you have over 20 projects, where you can have up to 190 project dependencies&#8230; Have fun.</p>
]]></content:encoded>
			<wfw:commentRss>http://victorsergienko.com/project-dependencies-of-visual-studio-2008-broken-in-msbuild/feed/</wfw:commentRss>
		<slash:comments>12</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 0.789 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2013-05-15 21:17:29 -->

<!-- Compression = gzip -->