<?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>jet.ro &#187; Misc.</title>
	<atom:link href="http://jet.ro/category/misc/feed/" rel="self" type="application/rss+xml" />
	<link>http://jet.ro</link>
	<description>designer/programmer tidbits</description>
	<lastBuildDate>Fri, 16 Dec 2011 21:42:56 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Join Google+</title>
		<link>http://jet.ro/2011/12/12/join-google/</link>
		<comments>http://jet.ro/2011/12/12/join-google/#comments</comments>
		<pubDate>Mon, 12 Dec 2011 19:41:32 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=1051</guid>
		<description><![CDATA[Follow me in Google+ for more frequent updates: http://google.com/profiles/jlauha]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve always thought that updating stuff to my homepage/blog feels a bit too much hassle, so I don&#8217;t want to do that very often. Strangely, even switching away from home-made kludges to WordPress didn&#8217;t help the feeling in a dramatic way, although it surely helped a little bit.</p>
<p>That&#8217;s why this page has always been subject to relatively long pauses without updates, even if I have felt like I&#8217;d like to share something. Thinking about alternative solutions, the social media websites, I&#8217;ve had a Facebook and <a href="http://twitter.com/jlauha" title="@jlauha" target="_blank">Twitter</a> account for quite a while now. I have always felt that Facebook suits best for personal friends and not for public stuff. Twitter is ok for public stuff, but the 140 char limit means that you&#8217;ll share only some tiny things, like a little anecdote or just a link to somewhere.</p>
<p>When <a href="http://plus.google.com" title="Google+" target="_blank">Google+</a> came around, I started using it as well. By nature it is like a combination of good things from both Facebook and Twitter, and seems to fit my usage patterns quite well. It allows really easily to select per-post who I&#8217;m sharing it with. It doesn&#8217;t limit me to short posts when I want to say a little more. Each post is automatically a discussion thread, and since it isn&#8217;t hosted by me, I have less to worry about approving posts / preventing spam entries.</p>
<p>So I realized I tend to write there a bit more often &#8211; the smaller things, findings and even some more light-hearted observations go there. So, if you want to follow smaller updates from me, join Google+ if you aren&#8217;t yet there and <a href="http://google.com/profiles/jlauha" title="+Jetro Lauha" target="_blank">add me to your circles</a>. Today, I was originally going to write about my latest findings regarding prototyping with Processing (again), but decided I probably do that in my Google+ stream later and write this endorsement post here instead! ;-D</p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2011/12/12/join-google/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Various ways to backup</title>
		<link>http://jet.ro/2010/07/04/various-ways-to-backup/</link>
		<comments>http://jet.ro/2010/07/04/various-ways-to-backup/#comments</comments>
		<pubDate>Sun, 04 Jul 2010 12:57:54 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=917</guid>
		<description><![CDATA[Over the years I have been using several kinds of solutions to backup stuff. Here&#8217;s a description of the ones I can remember. Many of them focus on being low-cost, simple and straightforward, but are far from a perfect solution in many other ways. A common technique for me has been to just make zip [...]]]></description>
			<content:encoded><![CDATA[<p>Over the years I have been using several kinds of solutions to backup stuff. Here&#8217;s a description of the ones I can remember. Many of them focus on being low-cost, simple and straightforward, but are far from a perfect solution in many other ways.</p>
<p><span id="more-917"></span></p>
<p>A common technique for me has been to just make zip files of whatever I want to backup. Simple snapshots of a project, so I end up with bunch of &#8220;projectname-YYYYMMDD.zip&#8221; files. Or altenatively a common zip of certain folder which gets updated over time. For example, before I moved to using cvs or svn for source code version control, I used a batch file like this to backup all my little coding projects:</p>
<blockquote><p><strong>backup.bat</strong><code><br />
@zip -u -r d:\backup\prog_c * -x *.ilk *.pdb *.idb *.ncb *.opt *.plg *.bsc *.sbr *.pch *.obj *.zip *.dll<br />
</code></p></blockquote>
<p>As you can see, this just updates an existing zip and excludes bunch of unnecessary files which I didn&#8217;t want to keep bloating up the backup zip. A worthy note is that I have usually made sure I have two separate hard disks in a computer and put the backups on the other one from the original data. At some point I also tried to switch to using <a href="http://dar.linux.free.fr/" target="_top">dar</a> instead of the zip files, since it would have had some advantages over the zip files. I didn&#8217;t end up using that for long though.</p>
<p>Like I hinted above, nowadays I&#8217;m using version control for source code, so I don&#8217;t make such zips that frequently anymore. Instead I have made sure that the version control repository gets backed up somehow.</p>
<p>My first solution was to make nightly snapshots of the repository using a script on the server, and then occasionally copy a snapshot file back to my main computer. I used this solution for many years. Below is copy of the backup script I used, which creates a .tar.gz backup file with given prefix from a specified file mask, adding YYYY-MM-DD timestamp to the backup file name, and also keeps only given number of snapshots around cleaning up any older ones.</p>
<blockquote><p><strong>dobackup.sh</strong><code><br />
#!/bin/sh</p>
<p>if [[ ! $1 || ! $2 || ! $3 || ! $4 || ! $5 ]]<br />
then<br />
    echo $0 destdir name execdir mask backups<br />
    echo $'\t'destdir = directory to put backups in<br />
    echo $'\t'name = file prefix name of this backup<br />
    echo $'\t'execdir = directory to run the backup tar command in<br />
    echo $'\t'mask = filemask to give for tar<br />
    echo $'\t'backups = number of backups of name to keep in destdir<br />
    exit<br />
fi</p>
<p>DESTDIR=$1<br />
NAME=$2<br />
EXECDIR=$3<br />
MASK=$4<br />
BACKUPS=$5</p>
<p>DESTFILE=$DESTDIR/$NAME-`date +%F`.tar.gz</p>
<p>cd $EXECDIR<br />
tar zcf $DESTFILE $MASK</p>
<p>EXTRAFILES=$((`ls $DESTDIR/$NAME-* | wc -l` - $BACKUPS))</p>
<p>if [[ $EXTRAFILES > 0 ]]<br />
then<br />
    rm -f `ls -t $DESTDIR/$NAME-* | tail -$EXTRAFILES`<br />
fi<br />
</code></p></blockquote>
<p>I had then another script which called the above one to create backup files from a few places in the system, and was put in a cron job to be run once per night. The backup script looked something like this:</p>
<blockquote><p><strong>allbackups.sh</strong><code><br />
#!/bin/sh<br />
# All automatic nightly backups<br />
cd /home/user/bin<br />
BACKUPDIR=/var/backups/user<br />
umask 007<br />
# /home/share (includes version control repository)<br />
./dobackup.sh $BACKUPDIR share /home share 7<br />
# misc stuff<br />
./dobackup.sh $BACKUPDIR misc /home/user "bin bookmarks.html code" 7<br />
</code>
</p></blockquote>
<p>More recently I have also moved to mirroring stuff over to another computer using rsync. This was something I needed to do to create an off-site remote backup for my workplace&#8217;s version control repository. To do this, I have simply put ssh-keys in place to allow automatic remote ssh login from a certain machine to run rsync over it, and then I have a cron job line like this to update the mirror every night:</p>
<blockquote><p><strong>nightly rsync mirror for cron job file:</strong><code><br />
30 5 * * * /usr/bin/rsync -avz -e ssh user@server:/path/* /backup/mirror/ > /backup/log/last_cron_mirror.txt 2>&#038;1<br />
</code></p></blockquote>
<p>Additionally I&#8217;m also backing up some paths of this web server every now and then using simple tar commands in a script, and the following command to back up a dump of the mysql database:</p>
<blockquote><p><strong>compressed mysql dump, must be run as root:</strong><code><br />
 /usr/bin/mysqldump --defaults-file=/etc/mysql/debian.cnf -A -Q --opt | /bin/bzip2 > ~/db-mysql-`date +%Y%m%d`.sql.bz2<br />
</code></p></blockquote>
<p>Finally, since there are multiple computers in our household, we have also been simply copying manually some files over to a share in another computer to have at least a single duplicate. These days I have also set Windows 7 backup software to maintain a backup of certain folders and system state to a share in my home Linux server. In the past I also sometimes made manually a backup of my Windows XP computer&#8217;s system state using the OS backup tool. Also recently when a brand new hard disk failed for me, I bought another one and after getting the warranty replacement I put the two into a mirrored RAID disk.</p>
<p>I have experienced so many hard disk crashes over time so I have learned to pay at least some attention to backing up the most important stuff, even if I really still tend to be a little bit lazy about it.</p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2010/07/04/various-ways-to-backup/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Buggy software is cheap enough</title>
		<link>http://jet.ro/2010/06/27/buggy-software-is-cheap-enough/</link>
		<comments>http://jet.ro/2010/06/27/buggy-software-is-cheap-enough/#comments</comments>
		<pubDate>Sat, 26 Jun 2010 22:21:03 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=904</guid>
		<description><![CDATA[If software would be made bug-free, that would force prices to be so high that nobody could buy them. How so? Well, let&#8217;s think about what it means to build bug-free software. There actually exists some software, which is built with goal of &#8220;zero-defects&#8221;. By that, I&#8217;m not referring to the constant hype from latest [...]]]></description>
			<content:encoded><![CDATA[<p>If software would be made <a href="http://en.wikipedia.org/wiki/Software_bug">bug</a>-free, that would force prices to be so high that nobody could buy them. How so?</p>
<p>Well, let&#8217;s think about what it means to build bug-free software. There actually exists some software, which is built with goal of &#8220;zero-defects&#8221;. By that, I&#8217;m not referring to the constant hype from latest agile method cult who may have some extravagant claims. I mean software where it&#8217;s of utmost importance to <em>really</em> have no bugs, no matter the costs. A case where a single bug may mean loss of lives or failure of the whole project. This kind of software is built for space missions, nuclear facilities, and so on. And such a policy on quality is inherently very very expensive.</p>
<p>Imagine if <em>Windows</em>, for example, would have been built with such policy. It&#8217;s a really complex and huge piece of software compared to ones normally built with zero-defect policy. But, given the option, would you pay $19,900 of your operating system, if it would never crash? It&#8217;s quite a no-brainer that &#8220;everybody&#8221; would rather pick the same software for $199 and just put up with the few problems they encounter. (The price difference was picked by <a href="http://en.wikipedia.org/wiki/Stetson-Harrison_method">Stetson-Harrison</a> method. It&#8217;s a guess to illustrate the point. The difference could be actually lot worse for niche market software which isn&#8217;t aimed for mass market.)</p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2010/06/27/buggy-software-is-cheap-enough/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Back from Japan</title>
		<link>http://jet.ro/2010/06/09/back-from-japan/</link>
		<comments>http://jet.ro/2010/06/09/back-from-japan/#comments</comments>
		<pubDate>Wed, 09 Jun 2010 18:30:42 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=896</guid>
		<description><![CDATA[I was away for about 2.5 weeks to visit Japan, more exactly Kyoto and Tokyo. The trip was excellent, and in retrospect it was clearly a good idea to visit both cities. While Kyoto is a modern city, it still has a bit more traditional feel to things. For example, the local laws forbid building [...]]]></description>
			<content:encoded><![CDATA[<p><img src="http://jet.ro/wp-content/uploads/2010/06/jp_fireman_board_small.jpg" alt="Fire station" title="Fire station" width="132" height="200" class="alignright size-full wp-image-895" /></p>
<p>I was away for about 2.5 weeks to visit Japan, more exactly Kyoto and Tokyo. The trip was excellent, and in retrospect it was clearly a good idea to visit both cities. While Kyoto is a modern city, it still has a bit more traditional feel to things. For example, the local laws forbid building tall skyscrapers, so there aren&#8217;t much taller buildings than we have in Helsinki.</p>
<p>Tokyo in other hand is very modern city with lots of skyscrapers. When going to see the city view from top of Mori building in Roppongi hills, you can see the city expands in every direction to the horizon as far as you can see. There is also extremely well developed public transportation, just check the <a href="http://www.tokyometro.jp/global/en/service/pdf/routemap_en.pdf" target="_new">Tokyo subway map (PDF)</a>. The public transportation in Helsinki is also quite good, but Helsinki is so tiny compared to a big metropolitan city so that our subway is tiny as well &#8211; just compare the above one to the <a href="http://www.railway-technology.com/projects/helsinki-metro/images/5-helsinki-metro-map.jpg" target="_new">current Helsinki metro map</a>. ^_^</p>
<div class="cb"></div>
<p><img src="http://jet.ro/wp-content/uploads/2010/06/jp_small_gbtruck.jpg" alt="Small garbagetruck" title="Small garbagetruck" width="225" height="200" class="alignright size-full wp-image-897" /></p>
<p>Interestingly when going to USA it feels that everything is bigger. When going to Japan, it feels the opposite. Maybe that&#8217;s partly because there is a whole different class of small cars which are narrower than we&#8217;re used to. I think the average width of streets is a bit less as well. There are also typical big western cars, so there&#8217;s just more variety of different sized cars. There&#8217;s even mini garbage trucks as you can see. However, not everything is small; I think in Japan they just tend to make things small by default, but aren&#8217;t afraid of making things big when there&#8217;s a reason to do so.</p>
<p>Also some things seemed to be done in an opposite way of what we&#8217;ve used to. Not just the left-hand driving and walking, but cars are also almost always parked backing to parking spot so that it&#8217;s slower to park car but easy to leave. And at least in Kyoto the buses worked so that you go in from a single back door and pay when you exit through the front door. Curiously in Japanese language the verb is also put last in sentences (think of Yoda-speak).</p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2010/06/09/back-from-japan/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Smiling parenthesis in parentheses</title>
		<link>http://jet.ro/2010/04/15/smiling-parenthesis-in-parentheses/</link>
		<comments>http://jet.ro/2010/04/15/smiling-parenthesis-in-parentheses/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 21:46:18 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=891</guid>
		<description><![CDATA[Ending a sidenote in parentheses with a smiley]]></description>
			<content:encoded><![CDATA[<p>Time for some trifling thoughts.</p>
<p>When writing you sometimes want to put a sidenote in parentheses, and then end it with a smiley.</p>
<p>This raises a question: Should you write one or two ending parentheses?</p>
<p>This seems to be an awkward problem for many. XKCD even made a comic about it (link at end of this post).</p>
<p>My solution is to use just a single parenthesis, so the ending parenthesis becomes part of the smiley. It just looks better that way! However, this way really sucks if you are writing in e.g. some chat system which automatically replaces smileys with small graphic icons. In that case the ending parenthesis just disappears and it feels like the sidenote keeps going on and on and the whole paragraph starts feeling unbalanced. So, if I know that the system will replace my smileys with icons, I will use double parenthesis.</p>
<p>At this point you&#8217;re probably wondering why I don&#8217;t show an example? I often overuse such sidenotes for some remarks, which is of course the reason I have even realized this earth-shattering problem. However, I have also realized that the best way to fix it is actually just to not use such sidenotes. Often the sidenote may actually be just a natural thing to say in the next sentence. Or perhaps you can consider using a footnote. I feel footnotes don&#8217;t work that well in web pages but I prefer them in print publications.</p>
<p>Anyway, I should save you the trouble (of constructing examples yourselves :).<br />
Or maybe you already tried yourself (I know you did! :-) ).</p>
<p><a href="http://www.xkcd.com/541/" target="_new"><strong>XKCD comic</strong></a></p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2010/04/15/smiling-parenthesis-in-parentheses/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>No entry for LD48, SD update out</title>
		<link>http://jet.ro/2009/12/15/no-entry-for-ld48-sd-update-out/</link>
		<comments>http://jet.ro/2009/12/15/no-entry-for-ld48-sd-update-out/#comments</comments>
		<pubDate>Mon, 14 Dec 2009 23:38:57 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=845</guid>
		<description><![CDATA[The Stair Dismount 1.2.0 (iPhone/iPod touch) update should be out now! In other &#8220;news&#8221;, I didn&#8217;t end up making an entry for the last weekend&#8217;s Ludum Dare 48h game dev compo. The theme was &#8220;Exploration&#8221; &#8211; I wasn&#8217;t really fond of the theme, but I still had a solid idea very quickly I went forward [...]]]></description>
			<content:encoded><![CDATA[<p>The <a href="http://jet.ro/2009/12/07/stair-dismount-update-2/">Stair Dismount 1.2.0</a> (iPhone/iPod touch) update should be out now!</p>
<p>In other &#8220;news&#8221;, I didn&#8217;t end up making an entry for the last weekend&#8217;s Ludum Dare 48h game dev compo. The theme was &#8220;Exploration&#8221; &#8211; I wasn&#8217;t really fond of the theme, but I still had a solid idea very quickly I went forward with. However, I ended up honing gameplay nuances for too long in my head and without actually doing much of implementation. I ended up writing some level generator thing and the supporting draw code etc. Might come back to those later if I want to work more on the idea; or perhaps even integrate with my summer efforts for making a little game for Assembly which also turned out not to be.</p>
<p>On the other hand, at least there was nice chance to have sort of &#8220;role reversal&#8221; for the weekend, since I was the one who went to buy groceries and made some food, and my wife made a <a href="http://www.ludumdare.com/compo/ludum-dare-16/?action=preview&#038;uid=1557" target="_new">nice little game</a> to entry in the same LD48 compo.</p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2009/12/15/no-entry-for-ld48-sd-update-out/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twittering</title>
		<link>http://jet.ro/2009/11/09/twittering/</link>
		<comments>http://jet.ro/2009/11/09/twittering/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 21:58:29 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=795</guid>
		<description><![CDATA[Here's my twitter account: http://twitter.com/jlauha]]></description>
			<content:encoded><![CDATA[<p>So, <a href="http://twitter.com/jlauha">my Twitter account is <strong>jlauha</strong></a>. I configured the blog posts to be automatically updated there, so that&#8217;s one way to follow my stuff if you&#8217;re into that. We&#8217;ll see if I start occasionally posting something else as well.</p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2009/11/09/twittering/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tool: Binary data to embeddable char array</title>
		<link>http://jet.ro/2009/11/09/tool-binary-data-to-embeddable-char-array/</link>
		<comments>http://jet.ro/2009/11/09/tool-binary-data-to-embeddable-char-array/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 20:22:51 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=777</guid>
		<description><![CDATA[Sometimes there&#8217;s a need to embed some little bit of binary data in the executable. The reasons may vary &#8211; perhaps it is for a resource you want to exist even if data files are missing, or it could be even something you want to &#8220;hide&#8221; from some curious wannabe-hackers. In the past years my [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes there&#8217;s a need to embed some little bit of binary data in the executable. The reasons may vary &#8211; perhaps it is for a resource you want to exist even if data files are missing, or it could be even something you want to &#8220;hide&#8221; from some curious wannabe-hackers.</p>
<p>In the past years my typical use case was as follows. I used to make &#8220;64 KB intros&#8221; (such as <a href="http://www.youtube.com/watch?v=tJUX1OL0uVA" target="_new">this one</a>), and for those I needed to embed a few data files to the executable as object data, so that I could exploit compression of the executable packer without writing a proper compression tool myself (such as <a href="http://upx.sourceforge.net" target="_new">UPX</a>).</p>
<p><span id="more-777"></span><br />
First I ended up making a simple tool which just reads in a file, byte-by-byte, and outputs something like this:<br />
<code>static unsigned char data[]={13,37,74,47, ... };</code><br />
That worked just fine and easy &#8211; <code>sizeof(data)</code> can be used to get the length of the data. Writing such a tool took probably something like 5-10 minutes. I think I have actually written that same little utility multiple times in the last decade, sometimes just forgetting where the previously created version were and then just re-creating it.</p>
<p>However, at some point I ended up with a solution where music of the production was an XM module with generated samples. The actual playable module file was huge in size &#8211; several megabytes &#8211; but the trick was that all the samples were generated at initialization time of the application. My quick hack for this was to make a tool which read in the XM module, replaced the sample data with blank data and stored the tiny bits of metadata for sample generation. And then just embed the huge binary file, so that executable compressor would crunch it down a lot (because it&#8217;s mostly empty blank data anyway).</p>
<p>Everything was fine, except for the fact that the compiler&#038;linker I used didn&#8217;t like that idea at all, declaring a compile-time handled char array of several megabytes. To workaround this, I took the previously mentioned little utility and added simple RLE compression, which was just enough of a workaround and was trivial to decode as well. Problem solved. (Note that this way of adding music to an intro is now considered ancient, and more modern way is <a href="http://www.pouet.net/prod.php?which=15073" target="_new">something like this</a>).</p>
<p>Recently I found a version of these two little utilities and decided maybe I can save a few minutes of somebody&#8217;s time &#8212; or at least my own time if I ever consider writing the same thing over again and happen to remember I have added those to my web page.</p>
<p>I called the first one &#8220;binso&#8221; for reason I can&#8217;t remember anymore. The RLE-version is simply &#8220;binsorle&#8221;. There&#8217;s also testrle.c code for testing and decompressing the data made by binsorle. Note that the code has been written no later than 2001 (possibly even earlier than that), and hasn&#8217;t been really &#8220;stress tested&#8221; to be bug-free. Any bug reports are still welcome, of course.</p>
<p>Download source-code and pre-built win32 executable files:<br />
<a href="http://jet.ro/files/binso.zip">binso.zip</a></p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2009/11/09/tool-binary-data-to-embeddable-char-array/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Tool: pngprep</title>
		<link>http://jet.ro/2009/10/17/tool-pngprep/</link>
		<comments>http://jet.ro/2009/10/17/tool-pngprep/#comments</comments>
		<pubDate>Sat, 17 Oct 2009 19:40:08 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=773</guid>
		<description><![CDATA[pngprep tool for pre-processing png files either with color dilation or pre-multiplying by alpha]]></description>
			<content:encoded><![CDATA[<p>When programming visuals, I often need to fix color values of pixels in image data where alpha is 0. Here&#8217;s a little tool called <em>pngprep</em> which can do some pre-processing of image data and save the result as a 32 bpp png file.<br />
<span id="more-773"></span></p>
<p>Supported operations include dilation, where color of alpha>0 pixels are dilated to nearby pixels with alpha=0. This is the default operation. An alternative operation is pre-multiplying colors by alpha, i.e. value of any color component won&#8217;t be larger than the alpha value after this operation.</p>
<p>Using either of these operations will &#8220;magically&#8221; fix many graphical glitches related to drawing images with linear interpolation. Generally using pre-multiplied alpha would be better choice, but using it requires modifications to the source code (different blending mode). That is, it should be known in the source code if image to be drawn has pre-multiplied alpha or not. Just doing the dilation operation won&#8217;t need any changes to the code, so it is helpful in many situations.</p>
<p>I&#8217;m using <a href="http://nothings.org/stb_image.c">stb_image</a> to load the images, so some other input formats should be supported as well in addition to png. However, note that only certain kind of input files are supported, e.g. trying to load 64 bpp (16 bits per color component) png files will lead to a crash. Output files are always normalized to 32 bpp (8 bits per color component) and saved in png format.</p>
<p>Download version 1.0, including source code and a pre-built executable for Windows:<br />
<a href="http://jet.ro/files/pngprep.zip">pngprep.zip</a></p>
<p>Disclaimer: Use it for anything, but do so at your own risk.</p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2009/10/17/tool-pngprep/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Tool update: psdslayer 1.1</title>
		<link>http://jet.ro/2009/10/16/tool-update-psdslayer-1-1/</link>
		<comments>http://jet.ro/2009/10/16/tool-update-psdslayer-1-1/#comments</comments>
		<pubDate>Fri, 16 Oct 2009 20:55:15 +0000</pubDate>
		<dc:creator>jetro</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Misc.]]></category>

		<guid isPermaLink="false">http://jet.ro/?p=764</guid>
		<description><![CDATA[psdlayerstga renamed to psdslayer, updated to include png support]]></description>
			<content:encoded><![CDATA[<p>A while ago I posted <a href="http://jet.ro/2009/09/09/tool-psdlayerstga/">psdlayerstga 1.0</a>. I have now updated it to support saving to PNG files, which is also now the default output format. The tool also got renamed to <strong>psdslayer</strong>, since I was constantly imagining, and even mistyping, the name to be &#8220;psd <em>slayer</em>&#8221; rather than &#8220;psd <em>layers</em>&#8220;. And I find it funny.<br />
<span id="more-764"></span></p>
<p>If you&#8217;re wondering what is psdslayer, it is simply a small command-line tool which extracts each layer from a .psd file to separate png (or tga) files. It also outputs some meta information about each layer to the console (stdout), or optionally also as part of the file names of exported images. The meta info contains position and size of each layer region, which is hopefully useful for automating some part of a tool pipeline.</p>
<p>Grab the version 1.1 here, including source code and a pre-built executable for Windows:<br />
<a href="http://jet.ro/files/psdslayer.zip">psdslayer.zip</a></p>
<p>Disclaimer: Use it for anything, but do so at your own risk.</p>
<p><strong>Update:</strong> The PSD reading code is limited and really handles only a small subset of possible things. Here&#8217;s hints how to make &#8220;compatible&#8221; PSD for processing:</p>
<ul>
<li>Use &#8220;Maximize compatibility&#8221; setting when saving PSD files</li>
<li>Rasterize all special layers to ordinary layers (text, smart objects, layer effects, &#8230;)</li>
<li>Collapse all groups (layer hierarchy should be completely flat)</li>
<li>Use 8 bit depth per color component (16 bit per component is not supported)</li>
<li>Remove all layers which contain a &#8220;very small&#8221; image, e.g. size being just a few pixels (the loader seems to have a bug with handling of these, or perhaps related to reading layers consisting of raw data rather than rle-compressed?)</li>
</ul>
<p><strong>Update Feb 2010:</strong> There&#8217;s also a tool called <a href="http://telegraphics.com.au/sw/" target="_new">psdparse</a> which does the same task, apparently even more robustly.</p>
]]></content:encoded>
			<wfw:commentRss>http://jet.ro/2009/10/16/tool-update-psdslayer-1-1/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

