<?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>A world in dk(decay/denmark) &#187; Programming</title>
	<atom:link href="http://rotand.dk/blog/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://rotand.dk/blog</link>
	<description>Just another pointless weblog</description>
	<lastBuildDate>Sat, 27 Jun 2009 19:17:46 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>DTMF dialer got new features</title>
		<link>http://rotand.dk/blog/2009/06/27/dtmf-dialer-got-new-features/</link>
		<comments>http://rotand.dk/blog/2009/06/27/dtmf-dialer-got-new-features/#comments</comments>
		<pubDate>Sat, 27 Jun 2009 17:14:29 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[cldc]]></category>
		<category><![CDATA[dialer]]></category>
		<category><![CDATA[dtmf]]></category>
		<category><![CDATA[J2ME]]></category>
		<category><![CDATA[jar file]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[open source]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/?p=198</guid>
		<description><![CDATA[I got a comment from a reader who used my DTMF dialer but missed a feature.
It was the ability to change what prefix to remove. As i live in Denmark, whenever i make a call on a land-line there is no reason to dial +45, which is the danish country code. Actually the plus is [...]]]></description>
			<content:encoded><![CDATA[<p>I got a <a href="http://rotand.dk/blog/about-2/comment-page-1/#comment-1385">comment from a reader</a> who used my <a href="http://rotand.dk/blog/2008/03/20/dtmf-dialer/">DTMF dialer</a> but missed a feature.</p>
<p>It was the ability to change what prefix to remove. As i live in Denmark, whenever i make a call on a land-line there is no reason to dial +45, which is the danish country code. Actually the plus is converted into 00 as well.</p>
<p>But Eli needed the prefix 08 to be removed.</p>
<p>And i guess that there are a lot of other prefixes that could be removed and + shouldn&#8217;t always be converted to 00. So I decided to implement this feature.</p>
<h2>Whats new</h2>
<ul>
<li>It now remembers your settings</li>
<li>It possible to choose a prefix to remove</li>
<li>its possible to decide what + should be replaced by.</li>
<li>I slapped a GPL V3 license on it</li>
</ul>
<h3>The files</h3>
<p><a href="http://rotand.dk/blog/wp-content/dtmfdialer.jad">dtmfdialer jad file</a></p>
<p><a href="http://rotand.dk/blog/wp-content/dtmfdialer.jar">dtmfdialer jar file</a></p>
<p><a href="http://rotand.dk/blog/wp-content/dtmfdialer.zip">dtmfdialer source code</a></p>
<p>Unfortunately it wasn&#8217;t just a 5 min hack. There were two major challenges.</p>
<h3>Persistence</h3>
<p>In J2me access to the filesystem is restricted and requires all sorts of security permissions, but every application has access to a &#8220;RecordStore&#8221;. The RecordStore (RMS) only allows byte[] to be stored, so you have to marshall/unmarshall every piece of data at quite a low level. I haven&#8217;t persisted any data in the first version, as this is indeed tedious to work with. But not having persistence for a prefix remover functionality wouldn&#8217;t be of any use. You would have to enter the same data every time you used the application and then it would be faster to just edit the number to call.</p>
<h3>Netbeans mobility pack</h3>
<p>It was supposed to be so eays.</p>
<p>But the floweditor somehow did mess up and didn&#8217;t generate the code, so the flow diagram and the sourcecode were out of sync, and i didn&#8217;t see any way to &#8220;resync&#8221;/&#8221;regenerate code/diagram&#8221;. This was cause for a lot of frustrations.</p>
<p>Originally i made it with netbeans so compiling and editing the generated code were best done in netbeans. But if i ever were to mess with it again i would seriosly consider &#8220;porting&#8221; it to J2me Polish or just &#8220;vanillia&#8221; j2me. As i really really don&#8217;t like the netbeans editor.</p>
<p>update : Eli found a bug in the prefix substitution, i fixed and uploaded the new version (June 27, 2009, 21:17)</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2009/06/27/dtmf-dialer-got-new-features/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>CNC for summerproject</title>
		<link>http://rotand.dk/blog/2009/06/06/cnc-for-summerproject/</link>
		<comments>http://rotand.dk/blog/2009/06/06/cnc-for-summerproject/#comments</comments>
		<pubDate>Sat, 06 Jun 2009 08:24:41 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[CNC]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[cnc machine]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[reprap]]></category>
		<category><![CDATA[summer vacation]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/?p=189</guid>
		<description><![CDATA[I have decided to build a CNC machine in the summer vacation. As soon as I finish the last exams i&#8217;ll start building / hacking. For the moment I&#8217;m looking into building plans and cnc in general. At first I wanted to build a reprap using a kit, but my funds are limited, so it [...]]]></description>
			<content:encoded><![CDATA[<p>I have decided to build a CNC machine in the summer vacation. As soon as I finish the last exams i&#8217;ll start building / hacking. For the moment I&#8217;m looking into building plans and cnc in general. At first I wanted to build a <a href="http://reprap.org/bin/view/Main/WebHome">reprap</a> using a kit, but my funds are limited, so it will be a three axis cnc router which hopefully will be able to act as an <a href="http://reprap.org/bin/view/Main/RepStrap">repstrap</a>.</p>
<p>The project as it looks so far :<br />
I ordered a set with steppers, motor-control and psu from ebay, and I&#8217;m waiting for it to arrive(The seller said 10-12 days, so maybe if I am lucky next week). It should be 1.7NM motors and a more or less &#8220;plug&#8217;n'play&#8221; set.</p>
<p>I intend to drive the motors using a old computer running <a href="http://www.linuxcnc.org/">linuxcnc</a>. linuxcnc looks real neat, but might prove to be hard to set up.</p>
<h3>The construction</h3>
<p>I am looking at two set of plans at the moment</p>
<h4><a href="http://www.instructables.com/id/How-to-Make-a-Three-Axis-CNC-Machine-Cheaply-and-/">How-to-Make-a-Three-Axis-CNC-Machine-Cheaply</a></h4>
<p style="padding-left: 30px;">This was the building plan that made me decide that this was a possible task. But there are some issues with the construction I don&#8217;t like, especially that it uses belts. They are hard to find and they are not cheap.</p>
<h4>JGRO&#8217;s plans</h4>
<p style="padding-left: 30px;">This is a free diy plan. it can be found here : <a href="http://www.cncroutersource.com/cnc-router-plans.html">http://www.cncroutersource.com/cnc-router-plans.html</a></p>
<p style="padding-left: 30px;">It uses threaded rod instead of belts. And the overall construction looks simpler.</p>
<h3>Materials</h3>
<p>Although I do want to do &#8220;fabbing&#8221; using a extruder at first I think that there will be enough work for a couple of days getting the mechanics and electronics up and running. Just as there is a lot to learn about g-code and all sorts of 3dmodelling.</p>
<p>To begin with I want to cut using a dremel tool, maybe a more powerful spindle(?) to be able to cut wood &#8211; if I have enough power in the steppers.</p>
<p>You might ask what do you want to make / &#8220;fab&#8221; with a 3 axis cnc machine?  I can come up with a lot of different small things like &#8220;coat hanger&#8221;, &#8220;coffee filter&#8221;, &#8220;PCBs&#8221; but I guess that it just boils down to: &#8221; I think its a very fascinating technology and want to play with it&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2009/06/06/cnc-for-summerproject/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>CLI voip calls</title>
		<link>http://rotand.dk/blog/2009/05/03/cli-voip-calls/</link>
		<comments>http://rotand.dk/blog/2009/05/03/cli-voip-calls/#comments</comments>
		<pubDate>Sun, 03 May 2009 08:13:27 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[Scripting]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[shell script]]></category>
		<category><![CDATA[sip]]></category>
		<category><![CDATA[system]]></category>
		<category><![CDATA[telephone]]></category>
		<category><![CDATA[voip connection]]></category>
		<category><![CDATA[voip phone]]></category>
		<category><![CDATA[voip service provider]]></category>
		<category><![CDATA[vps]]></category>
		<category><![CDATA[wake up call]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/?p=178</guid>
		<description><![CDATA[
Sometimes it would be nice to use a script call somebody and play a message.
I &#8220;needed&#8221; a wake-up-call system and since I use a voip-phone and have access to a server. I thought i would be quite nifty if I could have the server call me. Furthermore i would like to be able to script [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://rotand.dk/zen/phone/front1.jpg"><img class="ZenphotoPress_thumb alignleft" title="front1" src="http://rotand.dk/zen/phone/image/thumb/front1.jpg" alt="front1" width="180" height="180" /></a><br />
Sometimes it would be nice to use a script call somebody and play a message.<br />
I &#8220;needed&#8221; a wake-up-call system and since I use a voip-phone and have access to a server. I thought i would be quite nifty if I could have the server call me. Furthermore i would like to be able to script calls, so for instance the calendar could call me with reminders rather than sending an email.</p>
<p>I googled around but weren&#8217;t able to find such a utility. But i did find cli-sip client <a href="http://www.pjsip.org/pjsua.htm">pjsua</a>, based on <a href="http://www.pjsip.org/">pjsip</a>. Its posible to use it in conjunction with a shell script.</p>
<h4>Scripting</h4>
<p><code>jacob@vps:~./control.sh sip:108329@foobar.com "wake up you lazy bastard!"</code><br />
Is the basic usage i wanted to have. In order to get this functionality there are two steps.</p>
<p><span id="more-178"></span></p>
<h5>Generating wav file</h5>
<p>I ust use text2wave, from <a href="http://www.speech.cs.cmu.edu/festival/">festival</a>, which is available as a package on ubuntu.<br />
<code>echo $2 | text2wave - -o message.wav </code></p>
<p>$2 to use the second argument, and pipe it to text2wave. Let text2wave read sdtin and output a file message.wav</p>
<h5>Call and play the wav file</h5>
<p><code>pjsua_app --config-file=test.conf --play-file message.wav $1</code><br />
Here the magic is in the conf file. Its a rather straightforward to use, and the documentation is good.<br />
<code><br />
# we don't want the host's audio device<br />
--null-audio<br />
# SIP parameters<br />
--realm domain.com<br />
--registrar sip:number@domain.dk # DNS SRV, or FQDN</code><br />
<code> --username USERNAME<br />
--password PASS<br />
# default of 55 will be rejected as being too short by sipX<br />
--reg-timeout 3600<br />
# auto-answer all calls with "200 OK"<br />
--auto-answer 200<br />
# automatically loop incoming RTP to outgoing RTP<br />
--auto-loop<br />
# mix WAV file into the audio stream</code><br />
<code> --auto-play<br />
--auto-loop<br />
--duration=60<br />
</code><br />
This is based on a config file i found somewhere, can&#8217;t remember where. There a a lot of other options, pjsua handles nat quite nicely as well. It was easy to test it at my homebox, behind a router, just be sure to set an external ip address.</p>
<p>Now this will call and play the message, but it wont stop pjsua. It will just sit around waiting for someone to call. I couldn&#8217;t find any nice way to handle this, but since pjsua reads stdin for commands, it possible to pipe commands to it.<br />
<code>echo "sleep 60000 q" | pjsua_app --config-file=test.conf --play-file message.wav $1 </code><br />
So sleep for 60 seconds, then accept the next input from stdin, the &#8220;q&#8221;uit command.</p>
<p>Generally this configuration is set for 1 minute, it might be necessary to tweak this.</p>
<h4>Frustrations</h4>
<p>There is/were a bug in the tarball, that meant that it wouldn&#8217;t run if it couldn&#8217;t find a soundcard, since it should run on a vps this is quite annoying. But in the svn version its solved, so if you want to do something like this, use the svn version. Other than this installation is straightforward.</p>
<p>When working with cron, remember to use full paths. In the <tt>control.sh</tt> script the better solution were to add a cd working directory, in order to have all the paths correct. This were quite annoying to debug, as the script would run from the shell. And just fail when added to the crontab. Furthermore mails from crontab were delayed, so i couldn&#8217;t see the output. I did get someone to look over my shoulder and spot the bug.</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2009/05/03/cli-voip-calls/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Collection of Processing.org hacks</title>
		<link>http://rotand.dk/blog/2009/02/27/collection-of-processingorg-hacks/</link>
		<comments>http://rotand.dk/blog/2009/02/27/collection-of-processingorg-hacks/#comments</comments>
		<pubDate>Fri, 27 Feb 2009 20:07:06 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jar file]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[openGL]]></category>
		<category><![CDATA[processing]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[webcam]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/?p=74</guid>
		<description><![CDATA[Its been quite a while since I last posted anything.
That doesn&#8217;t mean that i haven&#8217;t been coding small hacks, just that i haven&#8217;t posted them. But now is probably a good time to show some of the stuff.
As the title suggest it has something to do with processing.org. I have been using processing on and [...]]]></description>
			<content:encoded><![CDATA[<p>Its been quite a while since I last posted anything.</p>
<p>That doesn&#8217;t mean that i haven&#8217;t been coding small hacks, just that i haven&#8217;t posted them. But now is probably a good time to show some of the stuff.</p>
<p>As the title suggest it has something to do with processing.org. I have been using processing on and off for some time. Its is really nice when you want to make a quick hack, or as its called in processing a &#8220;sketch&#8221;.</p>
<p>In no particular order here is some of the fun stuff made using processing.</p>
<h3>General remarks</h3>
<p>The following sketches and their sourcecode have served as small hacks, hence don&#8217;t expect nice comments or optimal algorithms&#8230;</p>
<h2>shrinkImage</h2>
<p>It is possible to remove the line from a picture representing the least amount of information. The algorithm evaluates every pixels &#8220;weight&#8221; as the absolute difference between the different color channels (r,g,b). And then finds the &#8220;lightest path&#8221; from the bottom to the top.</p>
<p>This means that &#8220;prominent features&#8221; won&#8217;t be removed or change size when shrinking the image. Here the definition of &#8220;prominent features&#8221; is high difference in colors between the neighboring pixels.</p>
<p>Have a look at <a title="processing hack" href="http://rotand.dk/processing/shrinkImage" target="_self">shrinkImage</a></p>
<p>Room for optimizations :</p>
<p>Eventhough its quite quick at calculating the weights and finding the lightest path, it does so in every iteration. Letting it use a bit more memory and just recalculate the changes when removing a line should speed it up. I found a huge speedup when just having an array with the weights from the last and current line, when calculation the path, so not only would saving all weights require a bit more memory it would also slow down the first calculation. But I&#8217;m sure it would give a significant speed up in the next iterations, and a lot of +-1 frustrations <img src='http://rotand.dk/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<h2>helloFoo</h2>
<p>There a some quick getting to know processing hacks, this is one off the. <a href="http://rotand.dk/processing/helloFoo" target="_self">helloFoo</a></p>
<p>One of the very cool things about processing is the ability to use openGL, so originally this sketch uses openGL. But applets and openGL isn&#8217;t exactly the best combination. It can be done, but since it doesn&#8217;t work for me (firefox, linux openJDK JRE) i just converted it to standard java graphics. And the effort required to do this, is remove an import and don&#8217;t say setup(400,400, OPENGL) but just setup(400,400). This is trivially true the other way around. If you want to use openGL its quite easy.</p>
<p>The sketch is just bouncing balls, when going away from openGL I reduced the size and number of balls, in order to get a decent animation speed.</p>
<h2>FooIII</h2>
<p>Again used openGl originally <a href="http://rotand.dk/processing/FooIII" target="_self">FooIII</a></p>
<p>Some satellites rotating around some satellites rotating around some &#8230;.</p>
<h2>sndHello</h2>
<p>yes sketches tend to have silly names : <a href="http://rotand.dk/processing/sndHello">sndHello</a></p>
<p>From Clifford Pickovers  book : Computers, Pattern, Chaos, and Beauty &#8211; graphics from an unseen world (p 39 section 4.3 snowflakes from   sound)<br />
Draw symmetrically and in &#8220;polar form&#8221; the fft of the sound, hence creating snowflakes based on the sound.<br />
Music by <a href="http://www.davidrovics.com/">David Rovics</a><br />
Choppy sound I had some problems with the sound when run as an applet. You might have better luck using the <a href="http://rotand.dk/processing/sndHello/sndHello.jar">jar</a> directly or by downloading the sourcecode and running it with processing</p>
<h2>Slit-scanning</h2>
<p>The former applet relied on an external library for the sound, ther are quite a few libraries available. I did use <a href="http://users.design.ucla.edu/~acolubri/processing/gsvideo/home/">GSvideo</a> to hook up my crappy webcam and do some video effects. I experimented with slit-scanning in different ways.Unfortunately this won&#8217;t run as an applet and it might only run on Linux.</p>
<p>By creating a cube of the images, where the z-axis represents time, its possible to play back different parts of the movie from different layers in time. Which makes for some quite interesting and dizzing effects.</p>
<p>For example a time buble where playback is delayed around a &#8220;bulge in the timespace continuum&#8221; :s (a video of some guy playing with it (<a href="http://rotand.dk/processing/timebuble1.avi">timebuble1.avi</a>) some sourcecode for a similar effect where the mouse pointer moves the buble (<a href="http://rotand.dk/processing/TimeCube.pde">TimeCube.pde</a>) another more &#8220;traditional slitscan&#8221; (<a href="http://rotand.dk/processing/CamWarpTime.pde">CamWarpTime.pde</a>) .</p>
<p>In general there is plenty of room to fiddle with the code, there a functions like selectSlice or initQueues where its decided how to slice time. its great fun to play with..</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2009/02/27/collection-of-processingorg-hacks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
<enclosure url="http://rotand.dk/processing/timebuble1.avi" length="2640804" type="video/x-msvideo" />
		</item>
		<item>
		<title>Matrix Multiplication</title>
		<link>http://rotand.dk/blog/2008/06/14/matrix-multiplication/</link>
		<comments>http://rotand.dk/blog/2008/06/14/matrix-multiplication/#comments</comments>
		<pubDate>Sat, 14 Jun 2008 16:03:46 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[jar file]]></category>
		<category><![CDATA[mathematics]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/?p=69</guid>
		<description><![CDATA[Who would have thought that matrix multiplication could be beautiful ?

The very short desctiption :
inspiration from an example of homogeneous coordinates in my linear algebra book and lectures about lineartransforms.
There is a jar, with sourcecode, if you want to se it &#8220;live&#8221; or twiddle with it.
tegneri
]]></description>
			<content:encoded><![CDATA[<p>Who would have thought that matrix multiplication could be beautiful ?</p>
<p><a href="http://rotand.dk/blog/wp-content/lintrans.png"><img class="alignnone size-full wp-image-70" title="lintrans" src="http://rotand.dk/blog/wp-content/lintrans.png" alt="linear tranformation by matrix multiplication" width="400" height="328" /></a></p>
<p>The very short desctiption :</p>
<p>inspiration from an example of homogeneous coordinates in my linear algebra book and lectures about lineartransforms.</p>
<p>There is a jar, with sourcecode, if you want to se it &#8220;live&#8221; or twiddle with it.</p>
<p><a href="http://rotand.dk/blog/wp-content/tegneri.jar">tegneri</a></p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2008/06/14/matrix-multiplication/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>Strange Attractor Wars</title>
		<link>http://rotand.dk/blog/2008/04/08/strange-attractor-wars/</link>
		<comments>http://rotand.dk/blog/2008/04/08/strange-attractor-wars/#comments</comments>
		<pubDate>Mon, 07 Apr 2008 22:10:04 +0000</pubDate>
		<dc:creator>admin</dc:creator>
				<category><![CDATA[Art]]></category>
		<category><![CDATA[Cool]]></category>
		<category><![CDATA[Fractal]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[contest]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[JSP]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[Strange Attractor]]></category>
		<category><![CDATA[system]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2008/04/08/strange-attractor-wars/</guid>
		<description><![CDATA[Strange Attractors are quite pretty.
I made have generated quite some random attractors.
Now I need to find the most beautiful ones, and I need your help!
I have created a voting system, where 3 attractors line up and you select the best one. The votes are then accumulated and and overall top 10 is generated.
Strange Attractor wars
It [...]]]></description>
			<content:encoded><![CDATA[<p>Strange Attractors are quite pretty.</p>
<p>I made have generated quite some random attractors.</p>
<p>Now I need to find the most beautiful ones, and I need your help!</p>
<p>I have created a voting system, where 3 attractors line up and you select the best one. The votes are then accumulated and and overall top 10 is generated.</p>
<p><a href="http://rotand.dk/AttractorWars">Strange Attractor wars</a></p>
<p>It is heavily inspired by <a href="http://kittenwars.com">kittenwars.com</a>.</p>
<p>I have been hacking away on this far to long. But expect an article with more details on Strange attractors and probably more features in the &#8220;war&#8221; application. (like top 100, biggest looser, most victorious etc).</p>
<p>Now just go and make some votes <img src='http://rotand.dk/blog/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2008/04/08/strange-attractor-wars/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>DTMF dialer</title>
		<link>http://rotand.dk/blog/2008/03/20/dtmf-dialer/</link>
		<comments>http://rotand.dk/blog/2008/03/20/dtmf-dialer/#comments</comments>
		<pubDate>Thu, 20 Mar 2008 20:23:54 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[dtmf]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[J2ME]]></category>
		<category><![CDATA[jar file]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[nokia 6300]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2008/03/20/dtmf-dialer/</guid>
		<description><![CDATA[UPDATE : see  dtmf-dialer-got-new-features
I got around to hacking some code together for a simple DTMF dialer on the mobile.
Its functional and simple. Enter a number, click ok and it will play the correct sequence of tones. It&#8217;s  even possible to tweak the duration and pauses.
I have only tested it on my own Nokia 6300, [...]]]></description>
			<content:encoded><![CDATA[<p>UPDATE : see <span id="sample-permalink"> </span><a href="http://rotand.dk/blog/2009/06/27/dtmf-dialer-got-new-features"><span id="sample-permalink"><span id="editable-post-name-full">dtmf-dialer-got-new-features</span></span></a></p>
<p>I got around to hacking some code together for a simple DTMF dialer on the mobile.</p>
<p>Its functional and simple. Enter a number, click ok and it will play the correct sequence of tones. It&#8217;s  even possible to tweak the duration and pauses.</p>
<p>I have only tested it on my own Nokia 6300, but as far as I can tell it should run on most java enabled mobile phones.</p>
<p><a title="dtmf logo" href="http://www.rotand.dk/blog/wp-content/phone.png"><img src="http://www.rotand.dk/blog/wp-content/phone.png" alt="dtmf logo" /></a></p>
<p>Here are the <a href="http://en.wikipedia.org/wiki/MIDlet">jad and jar files.</a> If you want to run the program download them to your mobile and have fun.</p>
<ul>
<li><a title="dtmf jad" href="http://rotand.dk/blog/wp-content/dtmfdialer.jad">dtmf jad</a></li>
<li><a title="dtmf jar" href="http://rotand.dk/blog/wp-content/dtmfdialer.jar">dtmf jar</a></li>
</ul>
<p>At the moment it converts + to 00 and removes +45, as this is appropriate for a danish setting.</p>
<p>Here is the sourcecode if you need to make changes.</p>
<p><a title="DTMF sourcecode" href="http://www.rotand.dk/blog/wp-content/dtmfsrc.zip">DTMF sourcecode</a></p>
<p><strong>Using Netbeans</strong></p>
<p>I used netbeans 6.0.1 and it was a mixed pleasure. Creating the the flow using a drag&#8217;n'drop interface, is well nice for something small and simple as this, but I found that it soon got frustrating. There&#8217;s no API to look in, and you have to use the mouse all the time.</p>
<p><a title="dtfmFlow" href="http://www.rotand.dk/blog/wp-content/flowdiagram.png"><img src="http://www.rotand.dk/blog/wp-content/flowdiagram-150x150.png" alt="dtfmFlow" width="189" height="132" /></a></p>
<p>This is the basic flow of the midlet. It was very quick to set this up, and it were indeed a pleasure to start with. Somewhere along the way a made a mistake, which the flowdesigner and codegenerator couldn&#8217;t handle. And no matter what I tried I couldn&#8217;t get rid of it, I knew exactly what i was. I had misnamed a variable and managed to let the generated code go into a never-ending recursion. (something along the lines of:<em> private TextField foo() { return new TextField(Foo);} </em>). But no matter what I tried it just wouldn&#8217;t get back to normal. In the end I just created a new project, remade the flow stuff to what you see above, and copied a few functions over.</p>
<p>And the flowdesigner is quick to work with, but I get a nagging suspicion that if you are going to make something a little more complicated than this it will be an annoyance. You might know exactly where and what to change in the source code, but do you remember where to point, click and edit in the <em>designer</em>interface? Another critique is that even when you know what to do, your workflow gets abruptted by having to constantly shift hands between keyboard and mouse.</p>
<p>To Netbeans defence i must say that I am used to using Eclipse, and changing to another IDE is in it self a frustrating experience. Whats the shortcut for blah, where do I set this. And its quite possible that I just didn&#8217;t  know enough about Netbeans structure and shortcuts to feel at home.</p>
<p>Credit goes out to : <a href="http://www.openclipart.org/">openclipart.org</a> for the image of the phone and <a href="http://dialabc.com/about/">dialabc</a> for the soundfiles.</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2008/03/20/dtmf-dialer/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Retro insane asylum telephone</title>
		<link>http://rotand.dk/blog/2008/03/18/retro-insane-asylum-telephone/</link>
		<comments>http://rotand.dk/blog/2008/03/18/retro-insane-asylum-telephone/#comments</comments>
		<pubDate>Tue, 18 Mar 2008 20:15:51 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Weird]]></category>
		<category><![CDATA[dtmf]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[insane asylum]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[netbeans]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[psychiatric hospital]]></category>
		<category><![CDATA[pulsedialing]]></category>
		<category><![CDATA[retro]]></category>
		<category><![CDATA[servlet]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[telephone]]></category>
		<category><![CDATA[voip connection]]></category>
		<category><![CDATA[voip service provider]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2008/03/18/retro-insane-asylum-telephone/</guid>
		<description><![CDATA[I recently bought an oldskool rotary phone. I saw it at an auction and it looked nice, but its history was even more fascinating. In its youth it was doing service at the local insane asylum.

image from the museum.
From the leaflet: &#8220;Welcome as a patient to the Psychiatric Hospital&#8221;
 About the Psychiatric Hospital
The highly regarded [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-size: small;">I recently bought an oldskool rotary phone. I saw it at an auction and it looked nice, but its history was even more fascinating. In its youth it was doing service at the local insane asylum.</span></p>
<p><a title="insane asylum" href="http://www.rotand.dk/blog/wp-content/hovedbygning.jpg"><img src="http://www.rotand.dk/blog/wp-content/hovedbygning.jpg" alt="insane asylum" /></a></p>
<p>image from the <a href="http://museum-psyk.dk">museum</a>.</p>
<p>From the leaflet: &#8220;<a href="http://www.sundhed.dk/wps/portal/_s.155/1923?_ARTIKEL_ID_=1046050310131223&amp;_ARTIKELGRUPPE_ID_=1046040910163003">Welcome as a patient to the Psychiatric Hospita</a>l&#8221;<br />
<strong> About the Psychiatric Hospital</strong></p>
<p><em>The highly regarded Copenhagen architect, Gotlieb Bindsboll, built the Jyske Asylum in the middle of the 19th Century. The inspiration for the building, with its crow step gables and many beautiful courtrooms, was taken from the typical Danish manor houses. Its position, with views over the Århus bay was in keeping with the contemporary view of the healing benefits of beauty. The hospital became known as a model institution for the treatment of the mentally ill, also on a European scale. The first part of the hospital was completed in 1852 and it was extended several times over the next fifty years. </em></p>
<p><a title="kirk phone" href="http://www.rotand.dk/blog/wp-content/phone.jpg"><img src="http://www.rotand.dk/blog/wp-content/phone.jpg" alt="kirk phone" /></a></p>
<p>The phone is from <span style="text-decoration: line-through;">1951</span> 1955 and the &#8220;electronics&#8221; looks aged but in surprisingly good condition. My first plan for it were to gut it, and put a more modern telephone inside, so I could use it for voip. But when I saw that it were in good condition, I thought it would be a shame to kill it entirely.</p>
<p>So I wanted to see whether it would be possible to use it as it is.</p>
<p>For the voip connection i have a <a href="http://www.linksys.com/servlet/Satellite?childpagename=US%2FLayout&amp;packedargs=c%3DL_Product_C2%26cid%3D1117044308483&amp;pagename=Linksys%2FCommon%2FVisitorWrapper">PAP2T linksys adaptor</a> (<em>pap</em>), its quite simple to work with. Plug in power and ethernet cable and configure it with a voip service-provider. Initially I used a normal phone to make sure that i had a working setup, before trying to get the rotary phone to work. The normal phone were quite easy to setup and it &#8220;just works&#8221;.</p>
<p>For the rotary phone there is still some difficulties. But i have managed to get something to work, and I am working on the rest.</p>
<p>First of all i had to change to <em>pap</em>s power output to maximum, else it wouldn&#8217;t ring the bells. I am still in the process of fiddling with settings for impedance and/or input gain. The problem is that the microphone volume is very low, and if I just turn the input gain up it turns up for the noise as well. It isn&#8217;t a problem for me as i have a crisp and clear sound, but apparently it&#8217;s a pain to whomever I am talking to. So something has to be done.</p>
<p>Then there is the dialing. A rotary phone dials by using <a href="http://en.wikipedia.org/wiki/Pulse_dial">pulse dialing</a>, which in essence means that it disconnects/hangs up, in short intervals as a method of counting the numbers. But any modern voip-adaptor (at least a cheap one) can only function using <a href="http://en.wikipedia.org/wiki/Dual-tone_multi-frequency">DTMF</a>. That&#8217;s were sending different tones means different numbers. Which basically means that it is enough to send the correct sequence of tones into the microphone in order to dial a number.</p>
<p>I had seen some applets for dialling they did work with the modern telephone, but the rotary phone with its microphone troubles had to get something more. I had success  using &#8220;DTMF-dial&#8221; (from the ubuntu repositories), because it was possible to tweak the duration of tones and pauses.</p>
<p>Next step, as holding the phone to the PC-speaker every time i need to make a phone call, is not an option, were to make a midlet, that&#8217;s a mobile applet. A java program for the mobile. Using the mobile as a dialer may seem awkward, but it already holds all my contacts and the voip is a great deal cheaper. I have a midlet at the moment that is at the proof of concept stage. It can dial and I am able to take a number from my address-book dial it using DTMF. It still needs a bit of polishing, but its mostly cosmetic, maybe a list of recent calls would be a nice feature to implement.</p>
<p>soon to come:</p>
<ul>
<li> Nice pictures of the phone, and the electronics.</li>
<li> Some software for DTMF dialing on the mobile and a bit about devolping a simple mobile application in netbeans.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2008/03/18/retro-insane-asylum-telephone/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Flash development</title>
		<link>http://rotand.dk/blog/2008/02/09/flash-development/</link>
		<comments>http://rotand.dk/blog/2008/02/09/flash-development/#comments</comments>
		<pubDate>Fri, 08 Feb 2008 21:21:13 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[flash]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[haxe]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[school]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[video]]></category>
		<category><![CDATA[wordpress]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2008/02/09/flash-development/</guid>
		<description><![CDATA[A course Im taking requires that we use flash and we are left to using specific workstations at school or download a 30 day trial for the 6-7 week project. And well either way we are supposed to be using a proprietary piece of software from Adobe.
The first flash assignment were to create a picture [...]]]></description>
			<content:encoded><![CDATA[<p>A course Im taking requires that we use flash and we are left to using specific workstations at school or download a 30 day trial for the 6-7 week project. And well either way we are supposed to be using a proprietary piece of software from Adobe.</p>
<p>The first flash assignment were to create a picture slide show, with captions and a soundtrack. Using the Adobe flash gui its very easy, drag and drop &#8220;programming&#8221;.</p>
<p>But as Richard Stallman says &#8220;its not a matter of convenience, but of ethics&#8221;. So I went looking for replacements. In another course I had no problems using octave instead of matlab, so should this be any different? Yes, unfortunately it seems that its very difficult to get the needed features in free software, well at least in the given timeframe.</p>
<p><a href="http://haxe,org" title="HaXe">HaXe</a> is able to compile to swf, as well as doing a lot of other nifty stuff. I just learnt about it recently from this <a href="http://blog.haxe.org/entry/29" title="HaXe video ">video</a>.</p>
<p>I didn&#8217;t manage to make the entire assignment, (yet?)  in  haxe, but i did make this :<br />
<a href="http://rotand.dk/blog/wp-content/view.html"> flash presentation(5MB+)</a></p>
<p><strong>UPDATE</strong></p>
<p>I did manage to add sound and captions.</p>
<p>So how did I do it?</p>
<p>Well first of all i installed haxe and <a href="http://swfmill.org/" title="swfmill">swfmill</a>. Haxe is able to use the actionsscript api and swfmill can create resources so your are able to refference them in you haxe code.Here is the recipe i used to create this slideshow.</p>
<p>1. create a xml file for swfmill, in order to create a resources for the haxe code.This i something like</p>
<pre> &lt;movie width="480" height="480" framerate="25"&gt;</pre>
<pre>   &lt;frame&gt;</pre>
<pre>      &lt;library&gt;&lt;clip id="img1" import="library/newton001Slide_.png"/&gt;</pre>
<p>unfortunately swfmill isn&#8217;t able to add sound to a library, so that had to be loaded directly from a file. I had some trouble getting it to function on the server but i think that adding &#8220;-D network-sandbox&#8221; to the haxe compilation might have done something. ???</p>
<p>2. run swfmill, thats swfmill simple slides.xml slides.swf</p>
<p>now i had linkage names for the image files, and could add them to the movieClip.</p>
<p>3. Create file SlideShow.hx</p>
<p>The main part. The basic haxe syntax is pretty straightforward, but since it uses the actionscript api it were mostly a question of getting a hang of actionscript. I did however strugle a bit with making a anonymous function, for the sounds onLoad. I used  &#8220;<em>static inline function sndStart(succes){&#8230;}</em>&#8221; , its a wee bit diffrent than what i would do in java. but it works.</p>
<p>3. compile.</p>
<p>make a &#8220;make file&#8221; for haxe, compile.hxml</p>
<pre>-swf test.swf</pre>
<pre>-main SlideShow</pre>
<pre>-swf-lib slides.swf</pre>
<pre>-swf-header 480:480:25:FFFFFF</pre>
<pre>-D network-sandbox</pre>
<p>The last part -D is a conditional flag and as far as i can tell it shouldn&#8217;t do anything, but a saw it in <a href="http://filt3r.free.fr/index.php/2007/12/22/38-sexy-light-mp3-player" title="fmp3"><strong>Fmp3PlayerHx</strong></a> and when i added it the sound seemed to work from the server, using a URL :s :s</p>
<p>4. run haxe compile.hxml</p>
<p>5. display the pretty result. (try not to go crazy when wordpress decides to help you format the html code&#8230;.), at first i tried embedding the flash in this post, but wordpress kept on changing the code, apparently if you add code and have newlines between the tags it throws in a couple og &lt;p&gt; tags &#8230;..</p>
<p>Now its on a separate page, then you don&#8217;t have to download the 5 mb flash file just to view the page, and I can use wordpress with out getting too frustrated.</p>
<p><a href="http://rotand.dk/blog/wp-content/SlideShow.hx">sourcecode slideShow.hx</a></p>
<p>The music is <a href="http://en.wikipedia.org/wiki/Free_Software_Song">&#8220;the free software song&#8221;</a> this version is by <a href="http://www.jonobacon.org/">Jono Bacon</a> , and I personally prefer it to the version by Richard Stallman</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2008/02/09/flash-development/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Sound Sequencing Mouse</title>
		<link>http://rotand.dk/blog/2007/12/02/sound-sequencing-mouse/</link>
		<comments>http://rotand.dk/blog/2007/12/02/sound-sequencing-mouse/#comments</comments>
		<pubDate>Sat, 01 Dec 2007 22:27:32 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Arduino]]></category>
		<category><![CDATA[Electronics]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[mousewheel]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2007/12/02/sound-sequencing-mouse/</guid>
		<description><![CDATA[I saw this cool sound sequencer ( arduino punk console ). I don&#8217;t much about sound and that kind of stuff, but i thought it was quite nifty. And I had just gotten a ps2-mouse to work with the arduino. And hmmm, I had to use it for something. So why not try to make [...]]]></description>
			<content:encoded><![CDATA[<p>I saw this cool sound sequencer ( <a href="http://www.beavisaudio.com/Projects/digital/ArduinoPunkConsole/index.htm">arduino punk console</a> ). I don&#8217;t much about sound and that kind of stuff, but i thought it was quite nifty. And I had just gotten a ps2-mouse to work with the arduino. And hmmm, I had to use it for something. So why not try to make a sound sequencer with it ?</p>
<p>So I started hacking away. Unfortunately I don&#8217;t have any nice video or sound clip, but then again its more like a noisemaker and its just a mess of wires. I&#8217;ll try to get something up soon.</p>
<p>But it does work, you have to take my word for it or download the sourcecode and wire up your arduino and try it out.</p>
<p>How does it work ?</p>
<p>There a two modes of operation &#8220;play mode&#8221; or &#8220;sequencing mode&#8221;, and it shift between modes by clicking the middelbutton (mousewheel button) and it starts out in sequence mode.</p>
<p><strong>sequencing mode </strong></p>
<ul>
<li>moving the mouse changes the frequency of the sound. It&#8217;s very simple the more you move, the more it changes (just by (X + Y) *magic_number)</li>
<li>pressing the right mouse button reduces the duration of the sound</li>
<li>pressing the left mouse button increases the duration</li>
<li>turning the mousewheel selects a tone in the sequence,  either an existing or adds a new one to the sequence.</li>
</ul>
<p><strong>play mode</strong></p>
<ul>
<li> it plays the sequence of tones you&#8217;ve recorded.</li>
<li>the mouse wheel changes the playback speed.</li>
</ul>
<p>So it keeps track of both a duration and a frequency, it uses a queue and its possible to add sounds to both ends. I haven&#8217;t yet hit a maximum but since its in a int array my guess is that it should be able to hold a lot 100 or 1000 of tones.  And it should be possible to do some bytepacking to reduce the memory requirements, but since you have to enter each sound manually and there are no persistent storage you really don&#8217;t need that to hold a lot of tones.</p>
<p><a href="http://rotand.dk/blog/wp-content/soundmouse3.pde" title="Sound Sequencing Mouse sourcecode">Sound Sequencing Mouse sourcecode</a></p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2007/12/02/sound-sequencing-mouse/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
