<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:dc="http://purl.org/dc/elements/1.1/" 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/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>Georgik</title>
	
	<link>http://georgik.sinusgear.com</link>
	<description>Journey through the Software sea</description>
	<lastBuildDate>Thu, 09 Feb 2012 17:26:18 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/GeorgikBlog" /><feedburner:info uri="georgikblog" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>StarCube – New program for startups in Czech republic</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/0y5w3MXhgBA/</link>
		<comments>http://georgik.sinusgear.com/2012/02/07/starcube-new-program-for-startups-in-czech-republic/#comments</comments>
		<pubDate>Tue, 07 Feb 2012 20:35:47 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Entrepreneurship]]></category>
		<category><![CDATA[Brno]]></category>
		<category><![CDATA[MIC]]></category>
		<category><![CDATA[Microsoft]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4630</guid>
		<description><![CDATA[Microsoft Innovation Center in Czech republic announced new program for startups &#8211; StarCube. StarCube is continuation of MIC Akcelerator 2.0. I will participate as member of mentors team. My primary focus will be: Software development in startup company. I&#8217;m looking forward to discuss new challenging topics.]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.msic.cz/">Microsoft Innovation Center</a> in Czech republic announced new program for startups &#8211; <a href="http://www.starcube.cz/">StarCube</a>.</p>
<p><a href="http://www.starcube.cz/">StarCube</a> is continuation of <a href="http://georgik.sinusgear.com/2011/02/04/brno-mic-akcelerator-2-0-opportunity-for-students/">MIC Akcelerator 2.0</a>.</p>
<p><iframe width="500" height="281" src="http://www.youtube.com/embed/BZcdD3fEfO0?fs=1&#038;feature=oembed" frameborder="0" allowfullscreen></iframe></p>
<p>I will participate as member of mentors team. My primary focus will be: Software development in startup company. I&#8217;m looking forward to discuss new challenging topics. <img src='http://georgik.sinusgear.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/0y5w3MXhgBA" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2012/02/07/starcube-new-program-for-startups-in-czech-republic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2012/02/07/starcube-new-program-for-startups-in-czech-republic/</feedburner:origLink></item>
		<item>
		<title>Quick online QR code generator in JavaScript</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/91t9UC6V8MM/</link>
		<comments>http://georgik.sinusgear.com/2012/01/29/quick-online-qr-code-generator-in-javascript/#comments</comments>
		<pubDate>Sun, 29 Jan 2012 10:56:19 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Rich Internet Application]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[online]]></category>
		<category><![CDATA[QR code]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4613</guid>
		<description><![CDATA[I found nice jQuery plugin for generating QR codes written by Jerome Etienne: jquery.qrcode. It&#8217;s fairly easy to use. Just pass a text to function and QR code is ready: jquery('#qrcode').qrcode("this plugin is great"); Here is small application that generates QR codes on the fly as you type. You can also download QR code as [...]]]></description>
			<content:encoded><![CDATA[<p>I found nice jQuery plugin for generating <a href="http://en.wikipedia.org/wiki/QR_Code">QR codes</a> written by <a href="http://jetienne.com/">Jerome Etienne</a>: <a href="https://github.com/jeromeetienne/jquery-qrcode">jquery.qrcode</a>. </p>
<p>It&#8217;s fairly easy to use. Just pass a text to function and QR code is ready: </p>
<p><code>jquery('#qrcode').qrcode("this plugin is great");</code></p>
<p>Here is small application that generates QR codes on the fly as you type. </p>
<p>You can also download QR code as image (use: Chrome, FF, Opera or Safari for download).</p>
<p>
<script type="text/javascript" src="/wp-content/html5/qrcode/js/jquery/jquery.qrcode.min.js"></script>
<script type="text/javascript">

function qrKeyUpHandler(event) {
    var value =  $('#qrCodeInput').val();
    $('#qrcode').html("").qrcode(value);
}

function qrDownloadButtonClickHandler(event) {
    var canvas = $("#qrcode > canvas")[0];
    window.location = canvas.toDataURL("image/png");
}

$(document).ready(function () {
    $('#qrCodeInput').keyup(qrKeyUpHandler);
    $('#qrDownloadButton').click(qrDownloadButtonClickHandler);
    qrKeyUpHandler(null);
});
</script>

<body>

<div>
    <div><b>Enter text</b>: <input id="qrCodeInput" type="text" value="http://www.safeq4.com" size="50" />
      <input type="button" id="qrDownloadButton" value="Get QR code as image"/>
    </div>
    <div id="qrcode"></div>
</div>
</p>
<p>Link to standalone <a href="http://georgik.sinusgear.com/wp-content/html5/qrcode/index.html">QR code HTML5 application</a>.</p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/91t9UC6V8MM" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2012/01/29/quick-online-qr-code-generator-in-javascript/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2012/01/29/quick-online-qr-code-generator-in-javascript/</feedburner:origLink></item>
		<item>
		<title>SafeQ4 Roadshow</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/aetL42x3wbQ/</link>
		<comments>http://georgik.sinusgear.com/2012/01/14/safeq4-roadshow/#comments</comments>
		<pubDate>Sat, 14 Jan 2012 09:32:53 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Office automation]]></category>
		<category><![CDATA[cost]]></category>
		<category><![CDATA[paper]]></category>
		<category><![CDATA[print]]></category>
		<category><![CDATA[savings]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[YSoft]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4595</guid>
		<description><![CDATA[YSoft will introduce SafeQ4! The roadshow will start in Prague &#8211; 26.1. 2012. Next stops on roadshow in Europe: Magdeburg, Essen, Nuremberg, Frankfurt am Main, Paris, London, Manchester. Check out cool micro-site: SafeQ4.com. SafeQ is solution for managing, monitoring and securing prints. You can find more details about SafeQ at YSoft website.]]></description>
			<content:encoded><![CDATA[<p>YSoft will introduce SafeQ4!</p>
<p><a href="http://www.safeq4.com">The roadshow</a> will start in Prague &#8211; 26.1. 2012. </p>
<p>Next stops on roadshow in Europe: Magdeburg, Essen, Nuremberg, Frankfurt am Main, Paris, London, Manchester.</p>
<p>Check out cool micro-site: <a href="http://www.safeq4.com">SafeQ4.com</a>.</p>
<p><a href="http://www.safeq4.com"><img src="http://georgik.sinusgear.com/wp-content/uploads/ysoft-logo.png" alt="" title="ysoft-logo" width="353" height="87" class="aligncenter size-full wp-image-4596" /></a></p>
<p>SafeQ is solution for managing, monitoring and securing prints. You can find more details about SafeQ at <a href="http://www.ysoft.com/Products/What-is-Ysoft-SafeQ">YSoft website</a>.</p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/aetL42x3wbQ" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2012/01/14/safeq4-roadshow/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2012/01/14/safeq4-roadshow/</feedburner:origLink></item>
		<item>
		<title>Debian Tomcat 7 – the trustAnchors parameter must be non-empty</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/YLuDXfa6C-o/</link>
		<comments>http://georgik.sinusgear.com/2012/01/10/debian-tomcat-7-the-trustanchors-parameter-must-be-non-empty/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 21:40:10 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[certificate]]></category>
		<category><![CDATA[debian]]></category>
		<category><![CDATA[linux]]></category>
		<category><![CDATA[PKIX]]></category>
		<category><![CDATA[Tomcat]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4583</guid>
		<description><![CDATA[I was deploying application on Tomcat7/OpenJDK. This application was accessing further secure services like SMTPS and HTTPS. Tomcat was complaining that certificates are not correct (PKIX): the trustAnchors parameter must be non-empty. Solution for Debian was quite easy after I found correct path to cacerts. Java cacerts for OpenJDK are stored in file: /etc/ssl/certs/java/cacerts. To [...]]]></description>
			<content:encoded><![CDATA[<p>I was deploying application on <a href="http://tomcat.apache.org">Tomcat7</a>/<a href="http://openjdk.java.net/">OpenJDK</a>. This application was accessing further secure services like <a href="http://www.courier-mta.org/">SMTPS</a> and HTTPS.</p>
<p>Tomcat was complaining that certificates are not correct (PKIX): <em>the trustAnchors parameter must be non-empty</em>.</p>
<p>Solution for Debian was quite easy after I found correct path to cacerts. Java cacerts for OpenJDK are stored in file: <em>/etc/ssl/certs/java/cacerts</em>.</p>
<p>To import certificate it is sufficient to use keytool:</p>
<pre>keytool -import -keystore /etc/ssl/certs/java/cacerts -file cert.pem \
-alias ci.sinusgear.com</pre>
<p>Then I restarted Tomcat and problem with trustAnchors disappeared.</p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/YLuDXfa6C-o" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2012/01/10/debian-tomcat-7-the-trustanchors-parameter-must-be-non-empty/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2012/01/10/debian-tomcat-7-the-trustanchors-parameter-must-be-non-empty/</feedburner:origLink></item>
		<item>
		<title>Videos from AUG Slovakia – November 2011</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/0KTDiu_wqTs/</link>
		<comments>http://georgik.sinusgear.com/2012/01/05/video-from-aug-slovakia-november-2011/#comments</comments>
		<pubDate>Thu, 05 Jan 2012 19:58:23 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Rich Internet Application]]></category>
		<category><![CDATA[2D]]></category>
		<category><![CDATA[3D]]></category>
		<category><![CDATA[Adobe]]></category>
		<category><![CDATA[creative]]></category>
		<category><![CDATA[Flash]]></category>
		<category><![CDATA[Flex]]></category>
		<category><![CDATA[RIA]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4565</guid>
		<description><![CDATA[Videos from AUG Slovakia &#8211; November 2011 are available at: vimeo.com/augsk. Slovak version only. Meeting Agenda &#8211; November 2011 Flex Components Lifecycle / Tomas Lehuta The Future of 2D in Flash / Peter &#8220;Shtif&#8221; Štefček Making Things / Martin Cagalinec &#38; Ivan Klim You can find out more about Adobe Slovakia User Group at groups.adobe.com. Recording [...]]]></description>
			<content:encoded><![CDATA[<p>Videos from AUG Slovakia &#8211; November 2011 are available at: <a href="http://vimeo.com/augsk/videos">vimeo.com/augsk</a>. Slovak version only.</p>
<p><iframe src="http://player.vimeo.com/video/34468212" width="500" height="375" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<p>Meeting Agenda &#8211; November 2011</p>
<p><iframe src="http://player.vimeo.com/video/34502153" width="500" height="375" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<p>Flex Components Lifecycle / Tomas Lehuta</p>
<p><iframe src="http://player.vimeo.com/video/34502791" width="500" height="375" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<p>The Future of 2D in Flash / Peter &#8220;Shtif&#8221; Štefček</p>
<p><iframe src="http://player.vimeo.com/video/34504200" width="500" height="375" frameborder="0" webkitAllowFullScreen mozallowfullscreen allowFullScreen></iframe></p>
<p>Making Things / Martin Cagalinec &amp; Ivan Klim</p>
<p>You can find out more about Adobe Slovakia User Group at <a href="http://slovakia.groups.adobe.com/">groups.adobe.com</a>.</p>
<p>Recording are available thanks to <a href="http://franto.com/">Franto</a> and <a href="http://lharp.net/">Lharp</a>.</p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/0KTDiu_wqTs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2012/01/05/video-from-aug-slovakia-november-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2012/01/05/video-from-aug-slovakia-november-2011/</feedburner:origLink></item>
		<item>
		<title>PF 2012</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/O9R_FtHBLBk/</link>
		<comments>http://georgik.sinusgear.com/2011/12/31/pf-2012/#comments</comments>
		<pubDate>Sat, 31 Dec 2011 17:32:40 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Rich Internet Application]]></category>
		<category><![CDATA[Canvas]]></category>
		<category><![CDATA[game]]></category>
		<category><![CDATA[HTML5]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[pf2012]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4544</guid>
		<description><![CDATA[[SK] Nájdi cestu k pokladu. [EN] Find a path to the treasure. [SK] Odkaz na aplikáciu. [EN] Link to application. Note: Map is based on one geocache puzzle.]]></description>
			<content:encoded><![CDATA[<p>[SK] Nájdi cestu k pokladu.<br />
[EN] Find a path to the treasure. <img src='http://georgik.sinusgear.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>
<iframe src="/wp-content/js/pf2012/pf2012.html" width="720" height="530" frameborder="0" border="0" cellspacing="0"></iframe>
</p>
<p>[SK] <a href="http://georgik.sinusgear.com/wp-content/js/pf2012/pf2012.html">Odkaz na aplikáciu.</a><br />
[EN] <a href="http://georgik.sinusgear.com/wp-content/js/pf2012/pf2012.html">Link to application.</a></p>
<p><a href="http://georgik.sinusgear.com/2011/12/31/pf-2012/"><img src="http://georgik.sinusgear.com/wp-content/uploads/pf2012-qr-code-link.png" alt="" title="pf2012-qr-code-link" width="205" height="206" class="aligncenter size-full wp-image-4551" /></a></p>
<p>Note: Map is <a href="http://www.geocaching.com/profile/?guid=5e44e826-233c-4103-93c4-ef4f51214acf&#038;wid=037e9cb5-690f-45ad-bba4-1c9f33ac0817&#038;ds=2">based on one geocache puzzle</a>.</p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/O9R_FtHBLBk" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2011/12/31/pf-2012/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2011/12/31/pf-2012/</feedburner:origLink></item>
		<item>
		<title>CGI server? Bash one-liner!</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/78zU2x5jmNs/</link>
		<comments>http://georgik.sinusgear.com/2011/12/28/cgi-server-bash-one-liner/#comments</comments>
		<pubDate>Wed, 28 Dec 2011 16:50:59 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[Bash]]></category>
		<category><![CDATA[CGI]]></category>
		<category><![CDATA[ImageMagick]]></category>
		<category><![CDATA[JPEG]]></category>
		<category><![CDATA[Server]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4517</guid>
		<description><![CDATA[Author: Lordrat By now you know, that when you need simple server to serve static pages just for you to play, you use Python&#8217;s SimpleHTTPServer. But this time I wanted more: I wanted to to able to use serve images caught by my webcam. CGI server would be quick answer. While there is class in [...]]]></description>
			<content:encoded><![CDATA[<p>Author: <strong>Lordrat</strong></p>
<p>By now you know, that when you need simple server to serve static pages just for you to play, you use <a href="http://python.org/">Python&#8217;s</a> <a href="http://georgik.sinusgear.com/2010/10/18/instantny-http-server/">SimpleHTTPServer</a>.</p>
<p>But this time I wanted more: I wanted to to able to use serve images caught by my webcam. <a href="https://en.wikipedia.org/wiki/Common_Gateway_Interface">CGI</a> server would be quick answer. While there is class in python doing that, I did not wanted to play with it. I needed something quick to do and maybe I was just little lazy to do so this day.</p>
<p>First thought: one window while cycle with cam-grabber, in the other window SimpleHTTPServer. Well, the solution lacked elegance, as it was not one-liner-styled enough. And then it occurred to me: why not use <a href="http://netcat.sourceforge.net/">Netcat</a>?</p>
<h3></h3>
<h3>Building Blocks</h3>
<p>&nbsp;</p>
<p>At first, I needed to get data from camera. I had figured how to do that some time ago.</p>
<pre>vgrabbj -i vga -d /dev/video0 -a -z 10 -q 100</pre>
<p>Let&#8217;s just elaborate on that a little bit. <a href="http://vgrabbj.gecius.de/">vgrabbj</a> takes `640&#215;480` image from video4linux device `/dev/video0`, with enabled brightness adjustment, taking 10 images just to adjust, and using 100% quality of <a href="http://www.jpeg.org/">JPEG</a>, and sending it to stdout.</p>
<p>Another building block is &#8220;server&#8221; to serve something that returned command. NetCat is our fiend. Little-bit of HTTP-fu is needed, but not much.</p>
<pre>{ echo -ne 'HTTP/1.0 200 OK\r\nConnection: Close\r\n\r\n'; cat file; } | nc -l 1234</pre>
<p>We will be serving JPEG, so we add appropriate HTTP header (<a href="http://www.imdb.com/title/tt0133093/">unless you can see things in binary garbage</a>).</p>
<pre>Content-Type: image/jpeg</pre>
<p>It may happen that file-size of image will cripple user&#8217;s comfort over slower network. <a href="https://code.google.com/speed/articles/gzip.html">What about speeding it up by sending response gzipped</a>? We will need header</p>
<pre>Content-Encoding: gzip</pre>
<p>and we will have to use&#8230; you guessed it: <a href="http://www.gzip.org/">gzip</a>.</p>
<pre>gzip -f</pre>
<p>However, gzip will not reduce the size of JPEG much, as it already has <a href="https://en.wikipedia.org/wiki/Entropy_%28information_theory%29">entropy</a> quite high. We can decrease quality of image i.g. by switch -q of vgrabbj, but in this case I would prefer <a href="http://www.imagemagick.org/">ImageMagick</a> for reasons that will become clear in a moment. Another possibility how to deal with this issue is scaling image down, which can be done here as well.</p>
<pre>convert - -quality 75 -</pre>
<p>It will also be nice to have a non-crippled copy of served file. Can do that: tee.</p>
<p>Serving repeatedly can be done by i.e. by while loop. Small functional enhancement: it will be nice to have so called &#8220;auto-refresh&#8221;. Adding one HTTP header will do that for us. Say every 5 seconds.</p>
<pre>Refresh: 5</pre>
<p>Some cooling enhancements? Server header:</p>
<pre>Server: CoolServer!</pre>
<h3></h3>
<h3>Assembling</h3>
<p>&nbsp;</p>
<p>And now just put it all together.</p>
<pre>while :; do { echo -ne 'HTTP/1.0 200 OK\r\nServer: Kwak!\r\nConnection: Close'\
'\r\nRefresh: 5\r\nContent-Type: image/jpeg\r\nContent-Encoding: gzip\r\n\r\n'\
; vgrabbj -i vga -d /dev/video0 -a -z 10 -q 100 | tee omg-`date +'%Y-%m-%d-%H'\
'%M%S'`.jpg | convert - -quality 75 - | gzip -f; } | nc -l 1234; done</pre>
<p>Feel free to unwrap it <img src='http://georgik.sinusgear.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> .<br />
And a non-one-liner (little bit more readable) version:</p>
<pre>#!/bin/bash
PORT=1234
QUALITY=75
REFRESH=5
HEADER='HTTP/1.0 200 OK\r\n'
HEADER=$HEADER'Server: CoolServer!\r\n'
HEADER=$HEADER"Refresh: $REFRESH\r\n"
HEADER=$HEADER'Connection: Close\r\n'
HEADER=$HEADER'Content-Type: image/jpeg\r\n'
HEADER=$HEADER'Content-Encoding: gzip\r\n'
HEADER=$HEADER'\r\n'
while :; do
    {
        echo -ne "$HEADER"
        vgrabbj -i vga -d /dev/video0 -a -z 10 -q 100 \
        | tee omg-`date +'%Y-%m-%d-%H%M%S'`.jpg \
        | convert - -quality "$QUALITY" - \
        | gzip -f
    } \
    | nc -l "$PORT"
done</pre>
<h3></h3>
<h3>Notes</h3>
<p>&nbsp;</p>
<ul>
<li>Some versions of nc may need to be called more like `nc -l -p 1234`.</li>
<li>First photo will be served from time you started script, every other from time the last shoot was taken. (Exercise for patient reader: why it is so? <img src='http://georgik.sinusgear.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' />  ). This might not be issue, as it speeds up reading of photo on request.</li>
<li>Previous can be solved by creating script, that can be called by nc on connection. That way you can create even interactive &#8220;CGI&#8221; script, that will read (and parse) input from std in and write response to stdout. Not all versions of nc are able to do that.</li>
<li>Another exercise: Will you be able to secure your communication using <a href="http://www.stunnel.org/">stunnel</a>.</li>
</ul>
<p>Enjoy <img src='http://georgik.sinusgear.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/78zU2x5jmNs" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2011/12/28/cgi-server-bash-one-liner/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2011/12/28/cgi-server-bash-one-liner/</feedburner:origLink></item>
		<item>
		<title>How to disable stealing of focus by Console in Eclipse</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/52dnOUKRDPY/</link>
		<comments>http://georgik.sinusgear.com/2011/12/22/how-to-disable-stealing-of-focus-by-console-in-eclipse/#comments</comments>
		<pubDate>Thu, 22 Dec 2011 20:53:52 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[console]]></category>
		<category><![CDATA[Debug]]></category>
		<category><![CDATA[Eclipse]]></category>
		<category><![CDATA[error]]></category>
		<category><![CDATA[focus]]></category>
		<category><![CDATA[output]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4494</guid>
		<description><![CDATA[There is one very annoying issue in Eclipse: stealing of focus by Console window. Console window is displayed when you run application. When you set focus to some other window like Search results and application prints something on output then Eclipse will automatically switch to Console window. Your search results are gone. There is simple [...]]]></description>
			<content:encoded><![CDATA[<p>There is one very annoying issue in Eclipse: stealing of focus by <em>Console</em> window.</p>
<p><em>Console</em> window is displayed when you run application.</p>
<p>When you set focus to some other window like <em>Search results</em> and application prints something on output then Eclipse will automatically switch to <em>Console</em> window. Your search results are gone.</p>
<p>There is simple way how to get rid of such a behavior.</p>
<p>Go to <em>Window -&gt; Preferences -&gt; Run/Debug -&gt; Console</em>. Uncheck options:</p>
<ul>
<li><span style="font-size: 15px;">Show when program writes to standard out</span></li>
<li><span style="font-size: 15px;">Show when program writes to standard error</span></li>
</ul>
<p><span style="font-size: 15px;"><img class="aligncenter size-full wp-image-4495" title="eclipse-disable-console-focus" src="http://georgik.sinusgear.com/wp-content/uploads/eclipse-disable-console-focus.jpg" alt="" width="578" height="601" /></span></p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/52dnOUKRDPY" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2011/12/22/how-to-disable-stealing-of-focus-by-console-in-eclipse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2011/12/22/how-to-disable-stealing-of-focus-by-console-in-eclipse/</feedburner:origLink></item>
		<item>
		<title>WordPress TV</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/6Wvc37ZokY0/</link>
		<comments>http://georgik.sinusgear.com/2011/12/18/wordpress-tv/#comments</comments>
		<pubDate>Sun, 18 Dec 2011 07:52:37 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[TV]]></category>
		<category><![CDATA[web]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4479</guid>
		<description><![CDATA[Good news for WordPress fans! WordPress has its own TV. Check out WordPress.TV. Do you want to join some WordPress events around the world? Then check out WordCamp.org Central.]]></description>
			<content:encoded><![CDATA[<p>Good news for WordPress fans! WordPress has its own TV. <img src='http://georgik.sinusgear.com/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Check out <a href="http://wordpress.tv/">WordPress.TV</a>.</p>
<p><a href="http://wordpress.tv/"><img class="aligncenter size-full wp-image-4481" title="wptv" src="http://georgik.sinusgear.com/wp-content/uploads/wptv.png" alt="" width="210" height="40" /></a></p>
<p>Do you want to join some WordPress events around the world? Then check out <a href="http://central.wordcamp.org/">WordCamp.org Central</a>.</p>
<p><a href="http://central.wordcamp.org/"><img class="aligncenter size-full wp-image-4482" title="wordcamp" src="http://georgik.sinusgear.com/wp-content/uploads/wordcamp.png" alt="" width="286" height="62" /></a></p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/6Wvc37ZokY0" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2011/12/18/wordpress-tv/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2011/12/18/wordpress-tv/</feedburner:origLink></item>
		<item>
		<title>How to define C++ macro with string content and pass it to MSbuild</title>
		<link>http://feedproxy.google.com/~r/GeorgikBlog/~3/IH6D_Ivy844/</link>
		<comments>http://georgik.sinusgear.com/2011/12/15/how-to-define-c-macro-with-string-content-and-pass-it-to-msbuild/#comments</comments>
		<pubDate>Wed, 14 Dec 2011 22:39:00 +0000</pubDate>
		<dc:creator>georgik</dc:creator>
				<category><![CDATA[Software engineering]]></category>
		<category><![CDATA[2008]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Microsoft]]></category>
		<category><![CDATA[vcproj]]></category>
		<category><![CDATA[Visual Studio]]></category>
		<category><![CDATA[xml]]></category>

		<guid isPermaLink="false">http://georgik.sinusgear.com/?p=4472</guid>
		<description><![CDATA[Imagine that we have C++ project e.g. for Visual Studio 2008. It is possible to build this project just by msbuild command: msbuild MyProject.vcproj /p:Configuration="Release" Let say that we want to use #define in the source code. It is necessary to define it in Configuration Properties &#62; C++ &#62; Command Line: /DSIMPLE_DEFINE This just pass [...]]]></description>
			<content:encoded><![CDATA[<p>Imagine that we have C++ project e.g. for Visual Studio 2008. It is possible to build this project just by msbuild command:</p>
<pre>msbuild MyProject.vcproj /p:Configuration="Release"</pre>
<p>Let say that we want to use #define in the source code. It is necessary to define it in Configuration Properties &gt; C++ &gt; Command Line:</p>
<pre>/DSIMPLE_DEFINE</pre>
<p>This just pass SIMPLE_DEFINE as flag.</p>
<p>How to deal with string define which should behave like string? E.g.:</p>
<pre>#define URL "http://georgik.sinusgear.com"</pre>
<p>The trick is in escaping quotes. We can add following define to Command Line:</p>
<pre>/DURL=\"http://georgik.sinusgear.com\"</pre>
<p>It will transform into .vcproj file:</p>
<pre>AdditionalOptions="/DURL=\&amp;quot;http://georgik.sinusgear.com\&amp;quot;"</pre>
<p>Let&#8217;s make one more step.</p>
<p>How to acquire such a define from environment variable? E.g. with following build.bat file:</p>
<pre>set URL="http://georgik.sinusgear.com"
msbuild MyProject.vcproj /p:Configuration="Release"</pre>
<p>It requires only small modification of .vcproj file:</p>
<pre>AdditionalOptions="/DURL=\&amp;quot;$(URL)\&amp;quot;"</pre>
<p> <img src='http://georgik.sinusgear.com/wp-includes/images/smilies/icon_wink.gif' alt=';-)' class='wp-smiley' /> </p>
<p>Small recap of flow: set env variable &#8211; pass it to XML &#8211; pass it compiler &#8211; pass it to code</p>
<img src="http://feeds.feedburner.com/~r/GeorgikBlog/~4/IH6D_Ivy844" height="1" width="1"/>]]></content:encoded>
			<wfw:commentRss>http://georgik.sinusgear.com/2011/12/15/how-to-define-c-macro-with-string-content-and-pass-it-to-msbuild/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://georgik.sinusgear.com/2011/12/15/how-to-define-c-macro-with-string-content-and-pass-it-to-msbuild/</feedburner:origLink></item>
	</channel>
</rss>

