<?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; J2ME</title>
	<atom:link href="http://rotand.dk/blog/tag/j2me/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>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>xonix mobile edition</title>
		<link>http://rotand.dk/blog/2007/07/28/xonix-mobile-edition/</link>
		<comments>http://rotand.dk/blog/2007/07/28/xonix-mobile-edition/#comments</comments>
		<pubDate>Sat, 28 Jul 2007 02:29:49 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[algorithms]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[J2ME]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[program]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2007/07/28/xonix-mobile-edition/</guid>
		<description><![CDATA[Having toyed around with J2ME for the freeVibes, I got a bit hooked on coding for the mobile phone.
So I started to recreate the classic oldskool game Xonix, it&#8217;s a game I really like. So simple and addictive. It&#8217;s not the first time I&#8217;m coding it, I have made it as an applet about a [...]]]></description>
			<content:encoded><![CDATA[<p>Having toyed around with J2ME for the freeVibes, I got a bit hooked on coding for the mobile phone.</p>
<p>So I started to recreate the classic oldskool game Xonix, it&#8217;s a game I really like. So simple and addictive. It&#8217;s not the first time I&#8217;m coding it, I have made it as an applet about a year ago (<a href="http://rotand.dk/xonix/xonix.php">Xonix applet</a>). As well as being a fun game to play I find it a fun game to code too. Though I have had my share of frustrations. The basic functionality is a fillalgorithm, that has to fill an area on both sides of the line / trail you make with the &#8216;pilot&#8217;.  This has to be fast and efficient &#8211; nobody likes a game where you have to wait for updates.</p>
<p><img src="http://www.rotand.dk/blog/wp-content/xonix.png" alt="xonix screenshot" /></p>
<p><span id="more-44"></span></p>
<p>When I first made the game i found a neat fill-algorithm. (<a href="http://en.wikipedia.org/wiki/Flood_fill">flood fill wikipedia</a>). So it should have been a piece of cake to implement it in J2me, its java&#8230; I deliberately choose not to reuse old code, as I  feared it would be horrible ugly. And a course in datastructures and algorithms should have given me some tools to make a better / cleaner implementation. Then the woes began. J2ME, has no ArrayList it has vector and a stack, and the are not generic so no typecasting. I made a version using Vector, but somehow i managed to use all the memory. When I look back I have a nagging suspicion that the Vector isn&#8217;t to blame &#8211; but rather me that somehow feed it to much data.  No matter what it was I got rid of the Vector and started using arrays, and using indexing like in images or c-&#8221;double&#8221;arrays (index = x + y * WIDTH). Finally it could fit in memory.</p>
<p>And then I started looking for graphics, a nice game really depends on nice sprites &#8211; much more than a beautiful algorithm.  I couldn&#8217;treally find any and its quite painful, at least for me, to make sprites. It gets real ugly, real fast &#8211; hmm no it gets real ugly real slow, because i&#8217;m no good at creating graphics. Well the frustrations grew and I ending up abandoning the project. The basic gameplay works, but is buggy and as mentioned the graphics sucks.</p>
<p><a href="http://www.rotand.dk/blog/wp-content/xonix2.png" title="xonix screenshot 2"><img src="http://www.rotand.dk/blog/wp-content/xonix2.png" alt="xonix screenshot 2" /></a></p>
<p>All in all it was quite fun programming, and some day i might give it another go.</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2007/07/28/xonix-mobile-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>FreeVibes</title>
		<link>http://rotand.dk/blog/2007/06/27/freevibes/</link>
		<comments>http://rotand.dk/blog/2007/06/27/freevibes/#comments</comments>
		<pubDate>Wed, 27 Jun 2007 11:57:33 +0000</pubDate>
		<dc:creator>jacob</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Weird]]></category>
		<category><![CDATA[cldc]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[eclipse]]></category>
		<category><![CDATA[eclipse plugin]]></category>
		<category><![CDATA[free software]]></category>
		<category><![CDATA[fun]]></category>
		<category><![CDATA[Hack]]></category>
		<category><![CDATA[images]]></category>
		<category><![CDATA[J2ME]]></category>
		<category><![CDATA[jad files]]></category>
		<category><![CDATA[jar file]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[java jad file]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[nokia 6300]]></category>
		<category><![CDATA[phone]]></category>
		<category><![CDATA[program]]></category>
		<category><![CDATA[software]]></category>
		<category><![CDATA[splash screen]]></category>
		<category><![CDATA[telephone]]></category>
		<category><![CDATA[vibelet]]></category>
		<category><![CDATA[wireless toolkit]]></category>

		<guid isPermaLink="false">http://rotand.dk/blog/2007/06/27/freevibes/</guid>
		<description><![CDATA[Finally the summer-holiday arrived, now its time to do some fun coding.
I bought myself a new mobile, a Nokia 6300, it&#8217;s got all the bells and whistles. Hmm well at least those I could afford. I choose this mobile because it has : Java, mp3 -player, bluetooth and memorycard.

specifications from nokia
review from mobilereview.com

I must admit [...]]]></description>
			<content:encoded><![CDATA[<p>Finally the summer-holiday arrived, now its time to do some fun coding.</p>
<p>I bought myself a new mobile, a Nokia 6300, it&#8217;s got all the bells and whistles. Hmm well at least those I could afford. I choose this mobile because it has : Java, mp3 -player, bluetooth and memorycard.</p>
<ul>
<li><a href="http://www.forum.nokia.com/devices/6300">specifications from nokia</a></li>
<li><a href="http://www.mobile-review.com/review/nokia-6300-en.shtml">review from mobilereview.com</a></li>
</ul>
<p>I must admit that i might be a bit of a nerd, so I just had to code something for it. And after &#8220;hello world&#8221; I found a small and some would say useless application to code.</p>
<p><strong>FreeVibes</strong></p>
<p>I must say I got inspired by <a href="http://www.vibelet.com/">vibelet</a> and the article in wired ( <a href="http://www.wired.com/techbiz/media/news/2003/04/58442">Hold the Phone, It&#8217;s a Sex Toy</a> ). As the title suggest, its well vibrating. I think that vibelet &#8211; though i haven&#8217;t seen their program, must be making quite an profit. Because getting a java-enabled phone to vibrate constantly,  is quite easy.</p>
<p>So now its Time for FreeVibes, a free software version.</p>
<p><span id="more-41"></span></p>
<table border="0" width="100%">
<tbody>
<tr>
<td><img src="http://www.rotand.dk/blog/wp-content/splash.png" alt="FreeVibes splash" /></td>
<td><img src="http://www.rotand.dk/blog/wp-content/ducky.png" alt="ducky" /></td>
</tr>
<tr>
<td>That&#8217;s the fancy splash screen</td>
<td>And when its in vibrating mode, this little duck is there. And now why a rubberduck ? ( <a href="http://www.google.dk/search?q=rub+my+duckie&amp;ie=utf-8&amp;oe=utf-8&amp;aq=t">answers</a> )</td>
</tr>
</tbody>
</table>
<p>If you want to try it out, here are the jar  and jad files. Just put them on your java-enabled mobile phone. I have just tested it on my telephone, It should work on any new mobile (with java) :</p>
<p><a href="http://rotand.dk/j2me/vibrator.jad">Jad File</a><br />
<a href="http://rotand.dk/j2me/vibrator.jar">Jar File</a><br />
<a href="http://rotand.dk/j2me/FreeVibesSrc.zip">Source code</a></p>
<p><strong>Installation</strong></p>
<ol>
<li>Download the jar and jad file and place them on the phone in the same directory.</li>
<li>Run the applet</li>
<li>Have fun</li>
</ol>
<p><strong>Technicalities</strong></p>
<p>Getting things to work with ubuntu feisty fawn.</p>
<p>I use SUNs java 6 and the wireless toolkit for the J2me.</p>
<p>Nokia has a nice area with information about coding for their phones (<a>forum.nokia.com</a>). But i didn&#8217;t have any success using their eclipse plugin and  carbide.j seems to be a windows application. But <a href="http://eclipseme.org/">eclipseME</a> worked like a charm.</p>
<p>When setting up a device for EclipseME i had to make sure that it was MIDP 2.0 and CLDC 1.1. It wasn&#8217;t the default and the Nokia 6300 can&#8217;t handle MIDP 2.1.</p>
<p>They code and design is inspired by <a href="http://forum.nokia.com/document/Java_ME_Developers_Library/">Nokias tutorial</a> on making MIDP 2.0 games.</p>
<p>The images I used are from the <a href="http://openclipart.org/wiki/?title=Main_Page">openclipart collection</a>, hacked together with GiMP and Inkscape, and I use obexftp to transfer the files to the phone.</p>
]]></content:encoded>
			<wfw:commentRss>http://rotand.dk/blog/2007/06/27/freevibes/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>
