<?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:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Makaron i kapusta</title>
	<atom:link href="http://wbachnik.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://wbachnik.wordpress.com</link>
	<description>...enough already!</description>
	<pubDate>Wed, 04 Jul 2007 12:45:24 +0000</pubDate>
	<generator>http://wordpress.org/?v=MU</generator>
	<language>en</language>
			<item>
		<title>ShackShag 0.1.2</title>
		<link>http://wbachnik.wordpress.com/2007/07/04/shackshag-012/</link>
		<comments>http://wbachnik.wordpress.com/2007/07/04/shackshag-012/#comments</comments>
		<pubDate>Wed, 04 Jul 2007 12:41:41 +0000</pubDate>
		<dc:creator>wb</dc:creator>
		
		<category><![CDATA[ShackShag]]></category>

		<guid isPermaLink="false">http://wbachnik.wordpress.com/2007/07/04/shackshag-012/</guid>
		<description><![CDATA[There were some changes in ImageShack web interface, which caused ShackShag to stop working. Hopefully, the new release is doing just fine. You can get it from Google hosting page.
I&#8217;d like to thank Wael, Allesio and Yannick for their reports and patch proposals. Guys, I&#8217;m sorry it took so long, but I had to face [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>There were some changes in ImageShack web interface, which caused ShackShag to stop working. Hopefully, the new release is doing just fine. You can get it from <a href="http://code.google.com/p/shackshag/downloads/list">Google hosting page</a>.</p>
<p>I&#8217;d like to thank Wael, Allesio and Yannick for their reports and patch proposals. Guys, I&#8217;m sorry it took so long, but I had to face some other challenges in my life.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wbachnik.wordpress.com/35/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wbachnik.wordpress.com/35/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wbachnik.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wbachnik.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wbachnik.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wbachnik.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wbachnik.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wbachnik.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wbachnik.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wbachnik.wordpress.com/35/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wbachnik.wordpress.com/35/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wbachnik.wordpress.com/35/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wbachnik.wordpress.com&blog=10494&post=35&subd=wbachnik&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wbachnik.wordpress.com/2007/07/04/shackshag-012/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/wbachnik-128.jpg" medium="image">
			<media:title type="html">wb</media:title>
		</media:content>
	</item>
		<item>
		<title>Function references in Perl</title>
		<link>http://wbachnik.wordpress.com/2006/11/02/function-references-in-perl/</link>
		<comments>http://wbachnik.wordpress.com/2006/11/02/function-references-in-perl/#comments</comments>
		<pubDate>Thu, 02 Nov 2006 11:26:21 +0000</pubDate>
		<dc:creator>wb</dc:creator>
		
		<category><![CDATA[perl]]></category>

		<guid isPermaLink="false">http://wbachnik.wordpress.com/2006/11/02/function-references-in-perl/</guid>
		<description><![CDATA[My task was to write a file processor that would perform some data manipulation in different file types. Since the general mechanism was the same for all files, but the procedure differed slightly for each file type I decided to build one function that would serve as a framework and little specialized functions to handle [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>My task was to write a file processor that would perform some data manipulation in different file types. Since the general mechanism was the same for all files, but the procedure differed slightly for each file type I decided to build one function that would serve as a framework and little specialized functions to handle operations for each file type. That sounded reasonable and would provide elegant solution, preventing code duplication at the same time. The only problem was <em>how</em>.</p>
<p>Since passing function pointers is possible in C, why shouldn&#8217;t it be in Perl, I asked? While my Perl skills are rather rusty (last time I used it was a few years ago) I was still able to come up with the solution after browsing Perl documentation and googling a bit. I couldn&#8217;t find a clear example of handling function references, though, and that&#8217;s why I&#8217;m writing this now.</p>
<p>Two simple functions for different file types, they will be passed by reference later:</p>
<pre><code>
# type1 requires second token in each line to be
# turned to upper case
sub type1_handler {
    my $line = shift;
    # ignore comments
    if ($line !~ m/^#/) {
        my @parts = split(/ /, $line);
        # capitalize second token in line
        $parts[1] = uc $parts[1];
        $line = join(" ", @parts);
    }
    return $line;
}

# type2 requires second token in each line to be
# turned to lower case
sub type2_handler {
    my $line = shift;
    # ignore comments
    if ($line !~ m/^#/) {
        my @parts = split(/ /, $line);
        # capitalize second token in line
        $parts[1] = lc $parts[1];
        $line = join(" ", @parts);
    }
    return $line;
}
</code></pre>
<p>General file handling function, it takes two parameters: reference to the line handling function and list of file names to be processed. It uses get_file_name() function (not defined here) to generate new file name for the output file. Here&#8217;s the code:</p>
<pre><code>
my $OUTPUT_DIR = './output/';

sub process_files {
    my ($line_handler, @files) = @_;
    foreach my $file_name (@files) {
        print "Processing: $file_name &#92;n";
        my $new_file_name = get_file_name($file_name);
        open(INPUT, " $OUTPUT_DIR$new_file_name") or die("Could not open output file: $OUTPUT_DIR$new_file_name &#92;n");
        while (my $line = &lt;INPUT&gt;) {
            print OUTPUT &amp;$line_handler($line);
        }
    close(INPUT) or die("Could not close input file: $file_name &#92;n");
    close(OUTPUT) or die("Could not close output file: $OUTPUT_DIR$new_file_name &#92;n");
    }
}
</code></pre>
<p>As you can see, function reference can be stored in a scalar variable. Once you want to call referenced function, you use ampersand (<code>&amp;</code>) before the reference name, like this: <code>&amp;$reference_name($param1, $param2)</code></p>
<p>How to create function references and pass them to other functions? You simply need to put a backslash and ampersand (<code>\&amp;</code>) in front of the function name. Example:</p>
<pre><code>
#process type1 files
process_files(&#92;&amp;type1_handler, &lt;*.type1&gt;);
# process type2 files
process_files(&#92;&amp;type2_handler, &lt;*.type2&gt;);
</code></pre>
<p>As you can see, using function references in Perl is pretty simple, once you find out how to pass them around.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wbachnik.wordpress.com/29/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wbachnik.wordpress.com/29/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wbachnik.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wbachnik.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wbachnik.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wbachnik.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wbachnik.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wbachnik.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wbachnik.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wbachnik.wordpress.com/29/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wbachnik.wordpress.com/29/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wbachnik.wordpress.com/29/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wbachnik.wordpress.com&blog=10494&post=29&subd=wbachnik&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wbachnik.wordpress.com/2006/11/02/function-references-in-perl/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/wbachnik-128.jpg" medium="image">
			<media:title type="html">wb</media:title>
		</media:content>
	</item>
		<item>
		<title>SVN repository @ Google Code Hosting</title>
		<link>http://wbachnik.wordpress.com/2006/09/18/svn-repository-google-code-hosting/</link>
		<comments>http://wbachnik.wordpress.com/2006/09/18/svn-repository-google-code-hosting/#comments</comments>
		<pubDate>Mon, 18 Sep 2006 20:14:34 +0000</pubDate>
		<dc:creator>wb</dc:creator>
		
		<category><![CDATA[ShackShag]]></category>

		<guid isPermaLink="false">http://wbachnik.wordpress.com/2006/09/18/svn-repository-google-code-hosting/</guid>
		<description><![CDATA[ShackShag&#8217;s code is now hosted in SVN repository provided by Google.
You can find the project&#8217;s page at: http://code.google.com/p/shackshag/
Feel free to check out the latest version and mess with it.
Thanks, Google!
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>ShackShag&#8217;s code is now hosted in SVN repository provided by Google.</p>
<p>You can find the project&#8217;s page at: <a href="http://code.google.com/p/shackshag/">http://code.google.com/p/shackshag/</a><br />
Feel free to check out the latest version and mess with it.</p>
<p><em>Thanks, Google!</em></p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wbachnik.wordpress.com/28/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wbachnik.wordpress.com/28/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wbachnik.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wbachnik.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wbachnik.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wbachnik.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wbachnik.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wbachnik.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wbachnik.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wbachnik.wordpress.com/28/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wbachnik.wordpress.com/28/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wbachnik.wordpress.com/28/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wbachnik.wordpress.com&blog=10494&post=28&subd=wbachnik&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wbachnik.wordpress.com/2006/09/18/svn-repository-google-code-hosting/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/wbachnik-128.jpg" medium="image">
			<media:title type="html">wb</media:title>
		</media:content>
	</item>
		<item>
		<title>ShackShag in Arch Linux</title>
		<link>http://wbachnik.wordpress.com/2006/08/29/shackshag-in-arch-linux/</link>
		<comments>http://wbachnik.wordpress.com/2006/08/29/shackshag-in-arch-linux/#comments</comments>
		<pubDate>Tue, 29 Aug 2006 21:17:40 +0000</pubDate>
		<dc:creator>wb</dc:creator>
		
		<category><![CDATA[ShackShag]]></category>

		<guid isPermaLink="false">https://wbachnik.wordpress.com/2006/08/29/shackshag-in-arch-linux/</guid>
		<description><![CDATA[By accident, I found out that my little project made its way to Arch Linux repository (package page). Wow! There&#8217;s even an account support patch provided, but it doesn&#8217;t seem to bring any new functionality.
That&#8217;s a really nice way to provide me with motivation! I&#8217;ll get back to development as soon as I finish writing [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>By accident, I found out that <a href="http://bachnik.com/projects/shackshag/">my little project</a> made its way to <a href="http://www.archlinux.org/">Arch Linux</a> repository (<a href="http://aur.archlinux.org/packages.php?do_Details=1&amp;ID=6581">package page</a>). <i>Wow! </i>There&#8217;s even an account support patch provided, but it doesn&#8217;t seem to bring any new functionality.</p>
<p>That&#8217;s a really nice way to provide me with motivation! I&#8217;ll get back to development as soon as I finish writing my thesis (I expect that to happen by the middle of September). Account support is on top of my to-do list, and I already have working <i>proof-of-concept</i> code. Stay tuned.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wbachnik.wordpress.com/27/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wbachnik.wordpress.com/27/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wbachnik.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wbachnik.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wbachnik.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wbachnik.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wbachnik.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wbachnik.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wbachnik.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wbachnik.wordpress.com/27/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wbachnik.wordpress.com/27/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wbachnik.wordpress.com/27/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wbachnik.wordpress.com&blog=10494&post=27&subd=wbachnik&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wbachnik.wordpress.com/2006/08/29/shackshag-in-arch-linux/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/wbachnik-128.jpg" medium="image">
			<media:title type="html">wb</media:title>
		</media:content>
	</item>
		<item>
		<title>ShackShag 0.1.1</title>
		<link>http://wbachnik.wordpress.com/2006/01/06/shackshag-011/</link>
		<comments>http://wbachnik.wordpress.com/2006/01/06/shackshag-011/#comments</comments>
		<pubDate>Fri, 06 Jan 2006 17:37:56 +0000</pubDate>
		<dc:creator>wb</dc:creator>
		
		<category><![CDATA[ShackShag]]></category>

		<guid isPermaLink="false">http://wbachnik.wordpress.com/2006/01/06/shackshag-011/</guid>
		<description><![CDATA[I added -r switch which causes removing the size information bar from thumbnails of uploaded images. You can download the script from ShackShag homepage.
       ]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>I added <strong>-r</strong> switch which causes removing the size information bar from thumbnails of uploaded images. You can download the script from <a href="http://bachnik.com/projects/shackshag/">ShackShag homepage</a>.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wbachnik.wordpress.com/24/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wbachnik.wordpress.com/24/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wbachnik.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wbachnik.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wbachnik.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wbachnik.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wbachnik.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wbachnik.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wbachnik.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wbachnik.wordpress.com/24/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wbachnik.wordpress.com/24/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wbachnik.wordpress.com/24/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wbachnik.wordpress.com&blog=10494&post=24&subd=wbachnik&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wbachnik.wordpress.com/2006/01/06/shackshag-011/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/wbachnik-128.jpg" medium="image">
			<media:title type="html">wb</media:title>
		</media:content>
	</item>
		<item>
		<title>ShackShag 0.1 &#8212; ImageShack batch image uploader &#8212; initial release</title>
		<link>http://wbachnik.wordpress.com/2005/12/14/shackshag-01-imageshack-batch-image-uploader-initial-release/</link>
		<comments>http://wbachnik.wordpress.com/2005/12/14/shackshag-01-imageshack-batch-image-uploader-initial-release/#comments</comments>
		<pubDate>Wed, 14 Dec 2005 19:47:46 +0000</pubDate>
		<dc:creator>wb</dc:creator>
		
		<category><![CDATA[ShackShag]]></category>

		<guid isPermaLink="false">http://wbachnik.wordpress.com/2005/12/14/shackshag-01-imageshack-batch-image-uploader-initial-release/</guid>
		<description><![CDATA[ShackShag is a small script allowing you to upload many images to imageshack.us hosting service. It was written in Python and should run on any platform that supports Python interpreter. It&#8217;s free software, released under the GPL license.
You&#8217;ll find more details and download links on project&#8217;s homepage.
ShackShag is still in development, more features are expected [...]]]></description>
			<content:encoded><![CDATA[<div class='snap_preview'><br /><p>ShackShag is a small script allowing you to upload many images to <a href="http://imageshack.us">imageshack.us hosting service</a>. It was written in <a href="http://python.org">Python</a> and should run on any platform that supports Python interpreter. It&#8217;s free software, released under the GPL license.</p>
<p>You&#8217;ll find more details and download links on <a href="http://bachnik.com/projects/shackshag/">project&#8217;s homepage</a>.</p>
<p>ShackShag is still in development, more features are expected soon.</p>
<img alt="" border="0" src="http://feeds.wordpress.com/1.0/categories/wbachnik.wordpress.com/23/" /> <img alt="" border="0" src="http://feeds.wordpress.com/1.0/tags/wbachnik.wordpress.com/23/" /> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/wbachnik.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/wbachnik.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/wbachnik.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/wbachnik.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/wbachnik.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/wbachnik.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/wbachnik.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/wbachnik.wordpress.com/23/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/wbachnik.wordpress.com/23/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/wbachnik.wordpress.com/23/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=wbachnik.wordpress.com&blog=10494&post=23&subd=wbachnik&ref=&feed=1" /></div>]]></content:encoded>
			<wfw:commentRss>http://wbachnik.wordpress.com/2005/12/14/shackshag-01-imageshack-batch-image-uploader-initial-release/feed/</wfw:commentRss>
	
		<media:content url="http://a.wordpress.com/avatar/wbachnik-128.jpg" medium="image">
			<media:title type="html">wb</media:title>
		</media:content>
	</item>
	</channel>
</rss>