<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Blazing Bytes</title>
	<atom:link href="http://geekrelief.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://geekrelief.wordpress.com</link>
	<description>Programming and bits of code</description>
	<lastBuildDate>Tue, 12 Apr 2011 18:16:03 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='geekrelief.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Blazing Bytes</title>
		<link>http://geekrelief.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://geekrelief.wordpress.com/osd.xml" title="Blazing Bytes" />
	<atom:link rel='hub' href='http://geekrelief.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Mixing sounds with haXe, the Memory API, and looping MP3s</title>
		<link>http://geekrelief.wordpress.com/2010/09/13/mixing-sounds-with-haxe-the-memory-api-and-looping-mp3s/</link>
		<comments>http://geekrelief.wordpress.com/2010/09/13/mixing-sounds-with-haxe-the-memory-api-and-looping-mp3s/#comments</comments>
		<pubDate>Mon, 13 Sep 2010 06:12:32 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=87</guid>
		<description><![CDATA[SampleTrackManager I started working on my own Sound manager, called the SampleTrackManager, for mixing and playing back music and sound effects in flash. I know there are quite a few Sound manager&#8217;s out there, but I was inspired by Joe Berkovitz&#8217;s standingwave project and the Alchemy work done on standingwave3 to synchronize playback of sounds. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=87&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p><strong>SampleTrackManager</strong></p>
<p>I started working on my own Sound manager, called the SampleTrackManager, for mixing and playing back music and sound effects in flash.  I know there are quite a few Sound manager&#8217;s out there, but I was inspired by <a href="http://code.google.com/p/standingwave/">Joe Berkovitz&#8217;s standingwave project</a> and the Alchemy work done on <a href="http://github.com/maxl0rd/standingwave3">standingwave3</a> to synchronize playback of sounds.  I played around with the Flash 10 SampleDataEvent when it first came out, so I figured this would be a good opportunity to make something useful with it.  Plus I was kind of annoyed that I couldn&#8217;t play 32 Sounds in a for loop and have them synchronize because there&#8217;s some latency. <img src='http://s0.wp.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The goal of the Sound manager was to make it easy to play samples on different tracks so I could operate on them separately while still being able to choreograph them.  The first version was in AS3 and while it worked the performance was terrible.  Playing a single looping sample was 3 times slowing than playing a looping Sound instance, and while increasing the number of samples written to the SampleDataEvent helped performance it introduced latency.  I suspected the all the ByteArray function calls for reading and writing floats in the inner mixing loop was slowing things, down since functions calls in Flash are very slow.  </p>
<p>So I created a <a href="http://www.haxe.org">haXe</a> version and utilized the <a href="http://haxe.org/api/flash9/memory">haxe.Memory API</a> which uses the new Alchemy opcodes.  To my surprise I can now mix 64 samples using about the same amount of CPU as playing back 32 Sound instances!  Wow!</p>
<p>Once I organize things, I&#8217;ll put the SampleTrackManager up on github.  I have a hierarchical state machine I want to release as well, but that&#8217;s another post.</p>
<p><strong>Looping MP3s</strong><br />
One issue I ran into while working on my test demo, was the infamous gap issue with mp3 playback.  I did a little searching and found a solution posted by <a href="http://www.flickr.com/photos/schill/4499319436/">Scott Schiller for SoundManager2</a>.  It turns out that using the lame mp3 encoder&#8217;s &#8211;nogap options is the key to creating looping mp3s.  I created a little bash script that works great!</p>
<p><code><br />
#!/bin/bash</p>
<p># Creates a loopable mp3 from a looping wav.<br />
# Example: loopMp3 input.wav output.mp3</p>
<p>mkdir loop_gapless<br />
cp $1 loop_gapless/start.wav<br />
cp $1 loop_gapless/mid.wav<br />
cp $1 loop_gapless/end.wav<br />
cd loop_gapless<br />
lame -b 128 -h --nogap start.wav mid.wav end.wav<br />
cp mid.mp3 ../$2<br />
cd ..<br />
rm -rf loop_gapless<br />
</code></p>
<p>Enjoy!</p>
<p>&#8211; UPDATE:  I&#8217;ve posted the code, the  mp3 script, and a sample here:<br />
<a href="https://github.com/geekrelief/gr_sound">https://github.com/geekrelief/gr_sound</a></p>
<p>Cheers!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/87/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/87/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=87&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2010/09/13/mixing-sounds-with-haxe-the-memory-api-and-looping-mp3s/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
		<item>
		<title>Working on making isometric depth sorting fast and faster</title>
		<link>http://geekrelief.wordpress.com/2009/12/26/working-on-making-isometric-depth-sorting-fast-and-faster/</link>
		<comments>http://geekrelief.wordpress.com/2009/12/26/working-on-making-isometric-depth-sorting-fast-and-faster/#comments</comments>
		<pubDate>Sat, 26 Dec 2009 22:43:52 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=83</guid>
		<description><![CDATA[I&#8217;ve been working on an isometric game with my startup for the past couple of months. And we&#8217;re just about to release it to the public. Amongst other duties, I&#8217;m currently in charge of the iso engine making it work right (sorting) and run fast (sorting and rendering). My initial attempts at depth sorting followed [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=83&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been working on an isometric game with my startup for the past couple of months.  And we&#8217;re just about to release it to the public.  Amongst other duties, I&#8217;m currently in charge of the iso engine making it work right (sorting) and run fast (sorting and rendering).  </p>
<p>My initial attempts at depth sorting followed the steps of others.  I tried to do some calculation to determine a depth ordering based on position and size of the iso object.  It wasn&#8217;t till recently did I realize this only works on square objects because it can use a center point method.  </p>
<p>Unfortunately, our game has rectangular objects.  So I was searching around and came across a lot of different methods all of which were wrong in one way or another.  Read some suggestions on sorting by unit tiles or splitting up art assets.  All of which are too limiting as we had already committed to rectangle objects and had some assets.  Finally, I got Jobe Makar&#8217;s Actionscript for Multiplayer Games and VirtualWorlds and studied his algorithm for sorting of objects.  It&#8217;s correct and works great, but it runs very slowly and relies on flash&#8217;s display renderer for sorting.  In book form, it&#8217;s way too slow. </p>
<p>Finally, taking some ideas from different places I created an algorithm that sorts iso objects by comparing them to each other giving an answer of front, back, or side.  Then I manage the sorting on my own.  With this approach we&#8217;re able to sort 200+ objects on the screen every frame.  This is good enough for the majority of isometric games you see on facebook.  Turns out the Maxhaus project had this algorithm done years ago and Zeh gives a good explanation of it here: <a href="http://www.stimuli.com.br/works/maxhaus/">http://www.stimuli.com.br/works/maxhaus/</a>  The algorithm looks correct and runs decently but it&#8217;s an O(n^2) algorithm.  We weren&#8217;t be able to achieve lots of tiny objects with this algorithm, but we designed around the issue.</p>
<p>With this algorithm in place I could put sorting to rest and move on.  I wasn&#8217;t really happy with it, but it was good enough.  So I&#8217;d continue thinking about the issue a couple hours every weekend.  And then one night I had a dream about iso sorting.  Over the next couple of weeks I discussed with colleagues to make sure I wasn&#8217;t delusional.  Now we have a prototype of a much faster sorting algorithm waiting to be integrated into the game.  It&#8217;s going to enable more objects on the screen and faster rendering times, and a more engaging world for the players.  I&#8217;ll eventually share the algorithm, but for now it&#8217;s a significant competitive advantage for my small company.  We have other players in our space with access to significantly more resources, and this is one of our best features so sharing will have to wait till we can turn the game into a success.</p>
<p>The real take away lesson for me was to not give up on the problem.  I had a hunch that things could be better and I kept on working at the issue from all kinds of angles and breaking it down step by step.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/83/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/83/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=83&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2009/12/26/working-on-making-isometric-depth-sorting-fast-and-faster/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
		<item>
		<title>StGit &#8211; Stacked Git tutorial for managing patches</title>
		<link>http://geekrelief.wordpress.com/2009/06/26/stgit-stacked-git-tutorial-for-managing-patches/</link>
		<comments>http://geekrelief.wordpress.com/2009/06/26/stgit-stacked-git-tutorial-for-managing-patches/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 23:33:02 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[git]]></category>
		<category><![CDATA[git patches]]></category>
		<category><![CDATA[private config files]]></category>
		<category><![CDATA[Stacked Git]]></category>
		<category><![CDATA[stg]]></category>
		<category><![CDATA[StGit]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=67</guid>
		<description><![CDATA[I&#8217;ve been using git for the past several months hacking away on a new project by myself for the most part, but a couple days ago I decided to branch to maintain a production, test, and dev version of the code base not to mention versions for different platforms. It reminded me of how at [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=67&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been using git for the past several months hacking away on a new project by myself for the most part, but a couple days ago I decided to branch to maintain a production, test, and dev version of the code base not to mention versions for different platforms.  It reminded me of how at my old job everyone had their config settings in the same file, but they were using subversion.</p>
<p>It always seemed like an error prone way to maintain everyone&#8217;s settings.  If someone inadvertently updated the file and you pulled the latest changes, you&#8217;d have to update your settings or hide them, and pulling changes was a hassle.</p>
<p>So I was thinking about how to keep configuration file changes private in different branches of my project.  Luckily Yaakov Nemoy had already written a piece on it. <a href="http://loupgaroublond.blogspot.com/2008/09/keeping-private-config-files-private-in.html">Keeping Private config files Private in Git</a></p>
<p>Awesome.  I wasn&#8217;t really familiar with git rebase, so the tutorial was a concrete example of how to use rebase compared to the man page.</p>
<p>But the after going through it, with my own project, I have to echo the sentiment in the comment by Peter Zei.  So I decided to checkout <a href="http://procode.org/stgit/">Stacked Git</a> which is pretty cool!</p>
<p>So below is a workflow on how to use Stacked Git, stg, to manage changes between your branches.  You should already be familiar with git commands before diving in since some of the stg commands have the same names but different behavior than the git commands.  </p>
<h1>Tutorial</h1>
<pre>
mkdir stg
cd stg
git init
vi README  # insert "init"
git add README
git commit -m "init"

# We've intialized the repo, now let's add our config file.
vi config # insert 'production'
git add config
git commit -m 

# Now let's branch for a development version
stg branch -c dev
# equivalent to : git checkout -b dev ; stg init
# we need to initialize every git branch for use with stg

# Let's create a new patch
stg new conf  # enter message: dev config settings
stg series # shows us our uncommitted patches
# Now modify the config file
vi config # replace production with development
stg status # shows that we modified config
stg refresh # updates our patch
stg show # shows our changes

# Now let's create a new patch, add a file to it and get it back 
# into master without sending along our config changes.
stg new add_code  # message: adding some code
vi Main.as # some code
stg add Main.as # or: git add Main.as 
stg refresh # this completes our patch
stg series 
# this shows our two applied patches 
+ conf
&gt; add_code 
# Before committing we want to pop our conf patch
stg pop conf
stg commit # this turns our add_code stg patch back into a git patch and commits
stg push # pushes conf back on the stg stack

# We'll switch back to our master branch and merge the dev changes
stg branch master
git merge dev
git log -1 # shows the new patch
</pre>
<p>
And there you go.  Managing your config files is just a matter of popping and pushing a patch with Stacked Git.  If you forget to pop before committing you can run an uncommit for the patches through conf, pop conf, and commit.<br />
</p>
<pre>
stg series
# blank from previous commit
git log # shows conf changes are 3 patches away
stg uncommit -n 3
stg series 
# returns
+ dev-config
+ added-x
&gt; addedY
stg pop dev-config
stg commit
stg push

# Notice that the patch names for conf was changed.  Let's rename it
stg rename dev-config conf
stg series
+ conf 
</pre>
<p>Voila!</p>
<p>Here are more links to get you started.<br />
<a href="http://procode.org/stgit/doc/tutorial.html">http://procode.org/stgit/doc/tutorial.html</a><br />
<a href="http://wiki.procode.org/cgi-bin/wiki.cgi/StGIT_Tutorial">http://wiki.procode.org/cgi-bin/wiki.cgi/StGIT_Tutorial</a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/67/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/67/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=67&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2009/06/26/stgit-stacked-git-tutorial-for-managing-patches/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
		<item>
		<title>Wacky Pong</title>
		<link>http://geekrelief.wordpress.com/2009/01/19/wacky-haskell/</link>
		<comments>http://geekrelief.wordpress.com/2009/01/19/wacky-haskell/#comments</comments>
		<pubDate>Mon, 19 Jan 2009 07:40:37 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=62</guid>
		<description><![CDATA[I&#8217;ve been working on a flash, real-time, multi-user system with AMQP. The first app using the system is just pong. Sounds easy, but I haven&#8217;t see an flash, real-time pong game on the internet yet. Flash client side, neko for the server with RabbitMQ in the middle for messaging. Things have been going well so [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=62&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve been working on a flash, real-time, multi-user system with <a href="http://www.amqp.org">AMQP</a>.  The first app using the system is just pong.  Sounds easy, but I haven&#8217;t see an flash, real-time pong game on the internet yet.  Flash client side, neko for the server with <a href="http://www.rabbitmq.com">RabbitMQ</a> in the middle for messaging.  </p>
<p>Things have been going well so far except for the debugging process.  In general I can make do with the trace statement that <a href="http://www.haxe.com">haXe</a> affords.  It&#8217;s better than nothing, which is what Actionscript 3 would give me without components.  However, debugging the effects of latency and lag compensation has been frustrating.  Too bad I&#8217;m such a newbie with real-time, internet, game programming.  Being forced to use TCP/IP doesn&#8217;t help either. </p>
<p>I was about to give up, call it Wacky Pong, and move on to another app, but it dawned on me that I could write a network simulator to gain insight on what is going wrong with the lag compensation.  And doing so has given me insights on how to better architect the system.  </p>
<p>Another way to gain better insight is to have been debugging tools.  HaXe&#8217;s &#8216;trace&#8217; isn&#8217;t good enough considering how buggy my code is.  So I made a few updates to <a href="http://www.github.com/geekrelief/as3tohaxe/tree/master">as3tohaxe</a> and will start to convert <a href="http://www.aswing.org">AsWing</a> to haXe over the weekends.  Having a robust gui framework will be a boon to haXe, so I hope I can get some help with the conversion and testing.</p>
<p>As much fun as haXe is working on as3tohaxe in haskell is a nice change of pace.  I might get a copy of <a href="http://www.realworldhaskell.org/blog/">Real World Haskell</a> after all.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/62/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/62/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=62&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2009/01/19/wacky-haskell/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
		<item>
		<title>hxamqp: AMQP with haxe!</title>
		<link>http://geekrelief.wordpress.com/2008/12/15/hxamqp-amqp-with-haxe/</link>
		<comments>http://geekrelief.wordpress.com/2008/12/15/hxamqp-amqp-with-haxe/#comments</comments>
		<pubDate>Mon, 15 Dec 2008 20:21:43 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[amqp]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[haxe]]></category>
		<category><![CDATA[neko]]></category>
		<category><![CDATA[rabbitmq]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=60</guid>
		<description><![CDATA[It&#8217;s been a while since my last post, but the wait has been worthwhile. I&#8217;ve been working on converting Ben Hood&#8217;s amqp library for as3 with my converter. It&#8217;s been an educational experience on a couple of fronts getting more familiar with the issues of conversion from as3 to haxe, AMQP/RabbitMQ, and flash vs neko [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=60&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>It&#8217;s been a while since my last post, but the wait has been worthwhile.  I&#8217;ve been working on converting <a href="http://github.com/0x6e6562/as3-amqp/tree/master">Ben Hood&#8217;s amqp library for as3</a> with my <a href="http://www.github.com/geekrelief/as3tohaxe">converter</a>.  It&#8217;s been an educational experience on a couple of fronts getting more familiar with the issues of conversion from as3 to haxe, <a href="http://www.amqp.org">AMQP</a>/<a href="http://www.rabbitmq.com">RabbitMQ</a>, and flash vs neko io issues.</p>
<p>The resulting library, <a href="http://www.github.com/geekrelief/hxamqp">hxampq</a>, is up on github with a couple examples to experiment with.</p>
<p>While working on this I ran into issues with trying to map a flash lib to neko.  Flash only has asychronous IO, while <a href="http://www.nekovm.org">Neko</a> is synchronous IO only.  In my examples I create a thread to deal with the socket data and pass messages back and with neko&#8217;s <a href="http://www.haxe.org/api/neko/vm/thread">Thread</a> and <a href="http://www.haxe.org/api/neko/vm/deque">Deque</a> API.</p>
<p>In my tests, I ran into a latency issue with RabbitMQ.  I was trying to send an empty message from a swf, to rabbit, then read that message from a neko server, send a message back to rabbit on another q, and have the swf read it.  The resulting &#8220;roundtrip&#8221; time was measured over thousands of samples.  I was getting terrible times anywhere from 7 to 60ms.  I was running the servers on an Ubuntu VM on my local machine.  Doing a direct connection from a swf to neko and sending bytes back and forth showed times of 3ms.  It turns out that the issue is Linux TCP/IP related.  The <a href="http://en.wikipedia.org/wiki/Nagle%27s_algorithm">Nagle algorithm</a> is buffering these tiny packets.  The issue could probably be solved by sending a lot more data at once.  So after enabling <a href="http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/2008-September/002016.html">TCP_NODELAY in RabbitMQ</a> (this should be the default now with 1.5.0 and on the <a href="http://hg.rabbitmq.com/rabbitmq-server/archive/tip.zip">repo</a>), I tried sending data from one swf to another swf over RabbitMQ and got 3ms!  But sending data to neko is still slow around 30+ms.  Looks like I&#8217;ll have to tinker with the neko socket code to <a href="http://articles.techrepublic.com.com/5100-10878_11-1050878.html">enable high performance tcp/ip options</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/60/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/60/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=60&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2008/12/15/hxamqp-amqp-with-haxe/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
		<item>
		<title>as3tohaxe google group</title>
		<link>http://geekrelief.wordpress.com/2008/10/28/as3tohaxe-google-group/</link>
		<comments>http://geekrelief.wordpress.com/2008/10/28/as3tohaxe-google-group/#comments</comments>
		<pubDate>Tue, 28 Oct 2008 19:26:49 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[as3tohaxe]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[haxe]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=54</guid>
		<description><![CDATA[I&#8217;ve created a google group to discuss issues, features of as3tohaxe and the general love of haXe http://groups.google.com/group/as3tohaxe Please feel free to join it and let the group know what you&#8217;re converting or running into any issues. Thanks. -Don Q. Update: I&#8217;ve uploaded Windows and Mac OSX binaries to the files section of the google [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=54&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I&#8217;ve created a <a href="http://groups.google.com/group/as3tohaxe">google group</a> to discuss issues, features of <a href="http://www.github.com/geekrelief/as3tohaxe">as3tohaxe</a> and the general love of <a href="http://www.haxe.org">haXe</a> <a href="http://groups.google.com/group/as3tohaxe">http://groups.google.com/group/as3tohaxe </a></p>
<p>Please feel free to join it and let the group know what you&#8217;re converting or running into any issues.  </p>
<p>Thanks.<br />
-Don Q.</p>
<p>Update: I&#8217;ve uploaded Windows and Mac OSX binaries to the files section of the google group.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/54/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/54/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=54&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2008/10/28/as3tohaxe-google-group/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
		<item>
		<title>Scrap Your BoilerPlate and Data.Generics for the Win!</title>
		<link>http://geekrelief.wordpress.com/2008/10/23/datagenerics-for-the-win/</link>
		<comments>http://geekrelief.wordpress.com/2008/10/23/datagenerics-for-the-win/#comments</comments>
		<pubDate>Thu, 23 Oct 2008 07:03:53 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[as3tohaxe]]></category>
		<category><![CDATA[Data.Generics]]></category>
		<category><![CDATA[haskell]]></category>
		<category><![CDATA[scrap your boilerplate]]></category>
		<category><![CDATA[SYB]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=48</guid>
		<description><![CDATA[I just updated as3tohaxe with a pretty significant change to allow transforming and querying of the AST. I was working in the translator code to add the ability to convert variable bindings with Number types a little more intelligently. I wanted to convert this AS3: public function s(s:String = "hi", a:Number = -1.0, b:Number = [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=48&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>I just updated <a href="http://www.github.com/geekrelief/as3tohaxe">as3tohaxe</a> with a pretty significant change to allow transforming and querying of the AST.  I was working in the translator code to add the ability to convert variable bindings with Number types a little more intelligently.</p>
<p>I wanted to convert this AS3:</p>
<pre>
        public function s(s:String = "hi", a:Number = -1.0, b:Number = 1):void{
            var c:Number = 0;
            var d:Number = 10.0;
            var o:Dynamic = {}; 
        }
</pre>
<p>to this <a href="http://www.haxe.org">haXe</a>:</p>
<pre>        
        public function s(?s:String = "hi", ?a:Float = -1.0, ?b:Int = 1):Void{
            var c:Int = 0;
            var d:Float = 10.0;
            var o:Dynamic = {}; 
        }
</pre>
<p>Notice how the Number types are changed to Int or Float depending on the initializer.</p>
<p>So I was about to embark on writing a bunch of tedious, error-prone, boilerplate code to deconstruct the nested and recursive AST nodes.  The idea was to perform tests to get down to the bottom of the expression syntax tree to see if there was a float somewhere.</p>
<p>I wanted the code to look something like this pseudo <a href="http://www.haskell.org">Haskell</a>:</p>
<pre> 
hasFloat e = 
    case e of
        ACond a -&gt; case a of
        .... more nested cases till we get to 
            TokenDouble _ -&gt; True ... 
        otherwise -&gt; False
</pre>
<p>But I stopped myself after taking a minute to look at the craziness of the AST just for a simple expression for -1.  </p>
<pre>
ACond (CondE (AEUnary (UEMinus ([(TPos "" 8 63,TokenOp "-")],[]) (UEPrimary (PFFull (FPFPrimary (PELit ([(TPos "" 8 64,TokenNum (TokenDouble "1.0"))],[])) []) Nothing)))) Nothing)))
</pre>
<p>AHHH!</p>
<p>I realized and was hoping someone had dealt with this problem before and found a better way.  So I started searching and landed on JP Moresmau&#8217;s blog where he talked about issues with <a href="http://jpmoresmau.blogspot.com/2008/01/nested-records-headaches-in-haskell.html">nested records</a>.  My problem being nested/recursive constructors seemed to be on a similar boat.  After more googling I came across &#8220;<a href="http://www.cs.vu.nl/boilerplate/">Scrap Your Boilerplate</a>&#8221; which looked like a solution amongst others like polyP and <a href="http://www.cs.uu.nl/research/projects/generic-haskell/">Generic Haskell</a>.  I don&#8217;t know enough about Haskell to make an informed opinion on those, but SYB did the trick.  And after more digging I found <a href="http://jpmoresmau.blogspot.com/2008/01/scraping-my-boilerplate-generics.html">JP had posted</a> about haskell&#8217;s <a href="http://haskell.org/ghc/docs/latest/html/libraries/base/Data-Generics.html">Data.Generics</a>.</p>
<p>Now I can write tests like:</p>
<pre>
hasFloat = everything (||) (False `mkQ` isFloat)
 
isFloat (TokenDouble x) = True
isFloat _ = False
</pre>
<p>which traverses the AST looking for floats.  </p>
<p>I wish this were documented in the haskell tutorials.  <a href="http://www.cs.vu.nl/boilerplate/">SYB</a> is a lifesaver!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/48/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/48/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=48&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2008/10/23/datagenerics-for-the-win/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
		<item>
		<title>hxflickr now on github</title>
		<link>http://geekrelief.wordpress.com/2008/10/21/hxflickr-now-on-github/</link>
		<comments>http://geekrelief.wordpress.com/2008/10/21/hxflickr-now-on-github/#comments</comments>
		<pubDate>Tue, 21 Oct 2008 17:44:23 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[flickr]]></category>
		<category><![CDATA[haxe]]></category>
		<category><![CDATA[hxflickr]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=42</guid>
		<description><![CDATA[Previously, I attempted to convert the AsWing project with as3tohaxe and decided instead to go after a smaller code base, the as3flickrlib. I spent the majority of the time dealing with converting the xml processing which as3tohaxe doesn&#8217;t handle (and I&#8217;m not sure ever will), but the rest of the codebase went through for the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=42&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Previously, I attempted to convert the <a href="http://www.aswing.org">AsWing</a> project with <a href="http://www.github.com/geekrelief/as3tohaxe">as3tohaxe</a> and decided instead to go after a smaller code base, the <a href="http://code.google.com/p/as3flickrlib">as3flickrlib</a>.  I spent the majority of the time dealing with converting the xml processing which as3tohaxe doesn&#8217;t handle (and I&#8217;m not sure ever will), but the rest of the codebase went through for the most part without a hitch.  So my conversion efforts are now on <a href="http://www.github.com">github</a>. </p>
<p>I&#8217;ve uploaded Adobe&#8217;s as3flickrlib and an example by Shang Liang converted to <a href="http://www.haxe.org">haXe</a> as <a href="http://www.github.com/geekrelief/hxflickr">hxflickr</a>.  The library hasn&#8217;t been fully tested, but you should be able to have fun with it.  Enjoy!</p>
<p>Next project is the <a href="http://flare.prefuse.org">flare</a> vis kit!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/42/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/42/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=42&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2008/10/21/hxflickr-now-on-github/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
		<item>
		<title>Translating AsWing</title>
		<link>http://geekrelief.wordpress.com/2008/10/14/translating-aswing/</link>
		<comments>http://geekrelief.wordpress.com/2008/10/14/translating-aswing/#comments</comments>
		<pubDate>Tue, 14 Oct 2008 02:10:49 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[actionscript 3]]></category>
		<category><![CDATA[as3]]></category>
		<category><![CDATA[haxe]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=34</guid>
		<description><![CDATA[Since the last blog post, as3tohaxe converter now has expression parsing, &#8220;as&#8221; converted to &#8220;cast ()&#8221; calls, and a program, as3tohaxe.hs, to run through a directory recursively and convert! So I gave the converter the AsWing codebase as its first big test and ran into a couple problems. The parser was bombing on some unidentifiable [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=34&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>Since the last blog post, <a href="http://www.github.com/geekrelief/as3tohaxe">as3tohaxe converter</a> now has expression parsing, &#8220;as&#8221; converted to &#8220;cast ()&#8221; calls, and a program, as3tohaxe.hs, to run through a directory recursively and convert!   </p>
<p>So I gave the converter the <a href="http://www.aswing.org">AsWing</a> codebase as its first big test and ran into a couple problems.  </p>
<p>The parser was bombing on some unidentifiable characters which turned out to be the <a href="http://en.wikipedia.org/wiki/Byte-order_mark#Representations_of_byte_order_marks_by_encoding">UTF8 header sequence</a> &#8220;\239\187\191&#8243; or EF BB BF in hex.  At first I just tried removing those characters but couldn&#8217;t with vim because the character is &#8220;zero width&#8221;.  So I used a hex editor, 0xED, and the parser ran without issue. So I&#8217;ve updated the lexer to handle the header as whitespace.  </p>
<p>The second problem I came across was one file taking a particularly long time converting.  I think it has to do with one of the statements which has a nested expression.</p>
<p><code>((((((((("GridLayout[hgap=") + hgap) + ",vgap=") + vgap) + ",rows=") + rows) + ",cols=") + cols) + "]");</code></p>
<p>I still need to verify this.</p>
<p>Update: The nested expressions were causing the slowdown.  I removed redundant work being done by the parser and got a huge speedup.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/34/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/34/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=34&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2008/10/14/translating-aswing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
		<item>
		<title>Back from FlashCamp 2008</title>
		<link>http://geekrelief.wordpress.com/2008/10/13/back-from-flashcamp-2008/</link>
		<comments>http://geekrelief.wordpress.com/2008/10/13/back-from-flashcamp-2008/#comments</comments>
		<pubDate>Mon, 13 Oct 2008 23:13:55 +0000</pubDate>
		<dc:creator>geekrelief</dc:creator>
				<category><![CDATA[Uncategorized]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[flashcamp]]></category>
		<category><![CDATA[kitchen sink]]></category>
		<category><![CDATA[yeti]]></category>

		<guid isPermaLink="false">http://geekrelief.wordpress.com/?p=32</guid>
		<description><![CDATA[We all had a terrific time at FlashCamp and got to see all the new features of Flash 10 and CS4 in action. Not only that, we walked away with trial copies, and we&#8217;ll be getting licenses too! The team I was on, &#8220;kitchen sink&#8221;, even won a prize for our efforts! It was a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=32&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></description>
				<content:encoded><![CDATA[<p>We all had a terrific time at <a href="http://www.flashcamp.org">FlashCamp</a> and got to see all the new features of Flash 10 and CS4 in action.  Not only that, we walked away with trial copies, and we&#8217;ll be getting licenses too!  The team I was on, &#8220;kitchen sink&#8221;, even won a prize for our efforts!  </p>
<p>It was a crazy weekend from project conception to presentation, and we had a blast the whole time with our crackpot ideas.  You can tell by the look on our <a href="http://www.flickr.com/photos/dominic/2936670951/">faces</a>.  We used Flash 10&#8242;s IK for animation, dynamic sound, pixel bender shaders for tracking a light source, deco tool for snow, and along the way learned a ton and saw some really cool inspiring demos.  </p>
<p>Here&#8217;s a shout out to team &#8220;kitchen sink&#8221; MT, Dennis, Pedro, Kenny, and James, and the Adobe guys Kuy, Tony, Richard, Justin, and Dom for being so cool and making the weekend a success!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/geekrelief.wordpress.com/32/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/geekrelief.wordpress.com/32/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=geekrelief.wordpress.com&#038;blog=4822973&#038;post=32&#038;subd=geekrelief&#038;ref=&#038;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://geekrelief.wordpress.com/2008/10/13/back-from-flashcamp-2008/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/325619a9ce67e4c50d9ce83eb711da67?s=96&#38;d=http%3A%2F%2F0.gravatar.com%2Favatar%2Fad516503a11cd5ca435acc9bb6523536%3Fs%3D96" medium="image">
			<media:title type="html">geekrelief</media:title>
		</media:content>
	</item>
	</channel>
</rss>
