<?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>Michael Voong &#187; programming</title>
	<atom:link href="http://www.michaelvoong.com/category/programming/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.michaelvoong.com</link>
	<description>iOS/Android Mobile Developer, London</description>
	<lastBuildDate>Sun, 05 Feb 2012 12:30:20 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>iOS Development &#8211; sizeToFit:</title>
		<link>http://www.michaelvoong.com/2011/05/19/434/</link>
		<comments>http://www.michaelvoong.com/2011/05/19/434/#comments</comments>
		<pubDate>Thu, 19 May 2011 21:16:55 +0000</pubDate>
		<dc:creator>Michael Voong</dc:creator>
				<category><![CDATA[programming]]></category>
		<category><![CDATA[iOS]]></category>
		<category><![CDATA[objective-c]]></category>

		<guid isPermaLink="false">http://www.michaelvoong.com/?p=434</guid>
		<description><![CDATA[Jérémy Chatard explains the intricacies of UIView&#8217;s sizeToFit: with a concrete example of how it should be used to lay out a bunch of subviews stacked vertically. He makes use of recursion in his solution to solve the problem of &#8220;If you want to lay out a parent view, you first need to lay out [...]]]></description>
			<content:encoded><![CDATA[<p>Jérémy Chatard explains the intricacies of UIView&#8217;s <a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/sizeToFit">sizeToFit:</a> with a <a href="http://jchatard.com/understanding-uiview-layout-mecanism/">concrete example</a> of how it should be used to lay out a bunch of subviews stacked vertically. He makes use of recursion in his solution to solve the problem of &#8220;If you want to lay out a parent view, you first need to lay out its children&#8221;. </p>
<p>If, like me, you always wondered what <a href="http://developer.apple.com/library/ios/#documentation/UIKit/Reference/UIView_Class/UIView/UIView.html#//apple_ref/occ/instm/UIView/sizeToFit">sizeToFit:</a> should be used for, I recommend you read this. Cheers Jérémy.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelvoong.com/2011/05/19/434/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Rant About iPhone SDK</title>
		<link>http://www.michaelvoong.com/2010/04/16/rant-about-iphone-sdk/</link>
		<comments>http://www.michaelvoong.com/2010/04/16/rant-about-iphone-sdk/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 21:13:17 +0000</pubDate>
		<dc:creator>Michael Voong</dc:creator>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.michaelvoong.com/?p=223</guid>
		<description><![CDATA[I find most of Apple&#8217;s SDK&#8217;s pretty good &#8211; but their limits are starting to show. Just wanted to briefly cover my experiences with a few. Cocoa Touch The SDK is not all bad. Cocoa Touch is of course, awesome. It gives you plenty of freedom while constraining you in all the right places so [...]]]></description>
			<content:encoded><![CDATA[<p>I find most of Apple&#8217;s SDK&#8217;s pretty good &#8211; but their limits are starting to show. Just wanted to briefly cover my experiences with a few.</p>
<p><strong>Cocoa Touch </strong></p>
<p>The SDK is not all bad. Cocoa Touch is of course, awesome. It gives you plenty of freedom while constraining you in all the right places so you don&#8217;t end up with an unusable app. Most developers can&#8217;t do UI (look at some J2ME apps and you&#8217;ll know what I mean), but most iPhone apps are quite usable. Love the IB tool once you get your head round what it&#8217;s actually doing under the scenes. The widgets are customisable enough and using <em>NSFetchedResultsController</em> with a table is an efficient way to bind data to a table. UITouch events are simple to understand and the way messages cascade through view controllers via their subviews is great to work with.</p>
<p><strong>Music Player Framework:</strong></p>
<p>This is an unacceptable interface to the iPod library simply because it&#8217;s so inflexible and querying the library using <em>MPMediaQuery</em> and <em>MPMediaPredicates</em> is so inefficient and slow.</p>
<p>For example when you&#8217;re searching tracks by various properties you can only do either &#8220;exact match&#8221; or &#8220;contains&#8221;. There is no way  of doing a &#8220;word begins&#8221; search like the iPod does. This would speed up some queries significantly. Furthermore, there is no efficient way to get a list of Artists, Albums, Playlists etc. You&#8217;d imagine you could just do something like NSArray *artists = <em>[[MPMusicPlayerController iPodMusicPlayer] artists]</em> that returns a list of artist strings but actually you have to do something really silly. You have to do a query on the <strong>whole</strong> media library and tell the Music Player Framework to group tracks into collections. These collections can be representative of your grouping criteria &#8211; which in this case would be artist. There&#8217;s lots of heavy lifting going on here as we have to retrieve all the tracks on the collection &#8211; and on my iPhone 3G with around 2GB of songs this takes more than a few seconds.</p>
<p>To get around this problem you can cache the music library, but although there is a mechanism for detecting an iTunes sync while your app is running, there is no way to find out exactly what has changed. There is an API call to get the last modified date of the library, but this time also includes any updates to the library metadata &#8211; e.g. track play count, which makes this useless for detecting collection changes. Apple, please do something about this!</p>
<p><strong>Core Data</strong></p>
<p>I started using this because I thought it would be an easy and efficient way to query a large data set with basic math in the predicates (e.g. <em>abs(r-%f) &lt; .28 AND abs(g-%f) &lt; .28 AND abs(b-%f) &lt; .28</em>) but even though the underlying store is SQLite I realise there are so many limitations. If I wanted to fetch 50 random items, I can&#8217;t do that. I can only sort by attribute name (e.g. title descending). That&#8217;s not very helpful&#8230; I might have to go back to the drawing board and use <em>NSMutableDictionaries</em> instead.</p>
<p>Maybe its time to wipe all preconceptions of programming that I&#8217;ve learnt from web development and start getting used to the Client API way of doing things. Lots of ups and downs but we&#8217;ll get there.</p>
<p>Thanks for reading <img src='http://www.michaelvoong.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p><strong><br />
</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelvoong.com/2010/04/16/rant-about-iphone-sdk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>iPhone Development</title>
		<link>http://www.michaelvoong.com/2010/03/29/iphone-development/</link>
		<comments>http://www.michaelvoong.com/2010/03/29/iphone-development/#comments</comments>
		<pubDate>Mon, 29 Mar 2010 08:56:44 +0000</pubDate>
		<dc:creator>Michael Voong</dc:creator>
				<category><![CDATA[interaction]]></category>
		<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.michaelvoong.com/?p=217</guid>
		<description><![CDATA[Working on an iPhone app! The image gives it away for those who knows me or knew me well enough. Keep your eyes peeled for a preview version! ^_~]]></description>
			<content:encoded><![CDATA[<p><img class="size-full wp-image-219 alignnone" title="Feelings... colours... emotions... sound... music?" src="http://www.michaelvoong.com/wp-content/uploads/2010/03/Rainbow_Ocean__by_Thelma1.jpg" alt="Feelings... colours... emotions... sound... music?" width="300" height="225" /></p>
<p>Working on an iPhone app! The image gives it away for those who knows me or knew me well enough. Keep your eyes peeled for a preview version! ^_~</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelvoong.com/2010/03/29/iphone-development/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Macbook, VMWare, Bluetooth, Windows XP and S60 SDK</title>
		<link>http://www.michaelvoong.com/2008/05/05/macbook-vmware-bluetooth-windows-xp-and-s60-sdk/</link>
		<comments>http://www.michaelvoong.com/2008/05/05/macbook-vmware-bluetooth-windows-xp-and-s60-sdk/#comments</comments>
		<pubDate>Mon, 05 May 2008 00:04:37 +0000</pubDate>
		<dc:creator>Michael Voong</dc:creator>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.michaelvoong.com/?p=142</guid>
		<description><![CDATA[If anyone&#8217;s wondering how to use the Macbook&#8217;s Bluetooth chip under the Nokia S60 3rd Edition Feature Pack 2 emulator in J2ME (as described here), you install S60_SDK_BT_Driver.zip at Forum Nokia, overwriting your Apple Bluetooth driver. In the emulator preferences, go to PAN configuration and set the adaptor type to &#8220;USB&#8221;. I&#8217;ve tested this under [...]]]></description>
			<content:encoded><![CDATA[<p>If anyone&#8217;s wondering how to use the Macbook&#8217;s Bluetooth chip under the Nokia S60 3rd Edition Feature Pack 2 emulator in J2ME (as described <a href="http://blogs.forum.nokia.com/blog/open-source-bluetooth-pans-forum-nokia-blog/symbian-c/2007/10/22/bluetooth-driver-for-s60-sdk">here</a>), you install <a href="http://www.forum.nokia.com/info/sw.nokia.com/id/9d50801f-1f95-4c83-87bc-cb83d4a21bef/S60_SDK_BT_Driver.zip.html">S60_SDK_BT_Driver.zip at Forum Nokia</a>, <strong>overwriting</strong> your Apple Bluetooth driver. In the emulator preferences, go to PAN configuration and set the adaptor type to &#8220;USB&#8221;. I&#8217;ve tested this under VMWare and connecting to a Bluetooth GPS module works great!</p>
<p>This probably works with a Macbook Pro too, and with Feature Pack 1.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelvoong.com/2008/05/05/macbook-vmware-bluetooth-windows-xp-and-s60-sdk/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>W910i J2ME Bluetooth Stack Problems</title>
		<link>http://www.michaelvoong.com/2008/02/20/w910i-j2me-bluetooth-stack-problems/</link>
		<comments>http://www.michaelvoong.com/2008/02/20/w910i-j2me-bluetooth-stack-problems/#comments</comments>
		<pubDate>Wed, 20 Feb 2008 10:54:32 +0000</pubDate>
		<dc:creator>Michael Voong</dc:creator>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.michaelvoong.com/2008/02/20/w910i-j2me-bluetooth-stack-problems/</guid>
		<description><![CDATA[I&#8217;ve been programming with the W910i recently. Theoretically, it should be a great phone to work with. Plenty of optional APIs included, has a J2ME accessible accelerometer, BUT, Bluetooth keeps failing randomly with the following error message (in console output, testing in Java Developer mode using Sony Ericsson Device Explorer/Connection Proxy): [Java/OJEX] bt.core[Util.raiseBluetoothConnectionException] FAILED_NOINFO I&#8217;m [...]]]></description>
			<content:encoded><![CDATA[<p class="img" style="float:none"><img src="http://www.michaelvoong.com/wp-content/uploads/2008/02/w910-narrowweb-300x3802.jpg" alt="W910_narrowweb__300x380,2.jpg" border="0" width="300" height="380" /></p>
<p>I&#8217;ve been programming with the W910i recently. Theoretically, it should be a great phone to work with. Plenty of optional APIs included, has a J2ME accessible accelerometer, BUT, Bluetooth keeps failing randomly with the following error message (in console output, testing in Java Developer mode using Sony Ericsson Device Explorer/Connection Proxy):</p>
<pre>[Java/OJEX] bt.core[Util.raiseBluetoothConnectionException] FAILED_NOINFO</pre>
<p>I&#8217;m using a separate thread that keeps making a serial profile connection (BTSPP://) to a GPS device that outputs in NMEA-0183 format. During random times (sometimes 20 secs, sometimes 5 mins) the thread locks up and any attempt to access it locks up that thread too. It must be to do with some of the bugs listed <a href="http://www.esato.com/board/viewtopic.php?topic=159522">here</a> &#8211; even after updating my firmware using the auto update within the device it&#8217;s not fixed. There seems to be no fix available anywhere!</p>
<p>I&#8217;m going to do a more simpler test later to see if it&#8217;s my code, but I doubt it will make any difference.</p>
<p>This is just a warning for those fellow developers out there tearing their hair out. For now, I&#8217;m sticking with Nokia phones and my <a href="http://www.sparkfun.com/commerce/product_info.php?products_id=254">Sparkfun accelerometer</a>&#8230; Just need to re-solder that power connection!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelvoong.com/2008/02/20/w910i-j2me-bluetooth-stack-problems/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
		<item>
		<title>Java Verification? Not For Me!</title>
		<link>http://www.michaelvoong.com/2008/01/14/java-verification-not-for-me/</link>
		<comments>http://www.michaelvoong.com/2008/01/14/java-verification-not-for-me/#comments</comments>
		<pubDate>Mon, 14 Jan 2008 22:47:35 +0000</pubDate>
		<dc:creator>Michael Voong</dc:creator>
				<category><![CDATA[mobile]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://www.michaelvoong.com/2008/01/14/java-verification-not-for-me/</guid>
		<description><![CDATA[Apparently, the Java ME code verification system is a joke. One developer has said that if you want to use anything other than the buttons and screen, you need your code signed. All of this was supposed to make code signing in Java ME centralised, being based upon impartial third parties like Verisign, Thawte, and [...]]]></description>
			<content:encoded><![CDATA[<p>Apparently, the Java ME code verification system is a joke. One developer has said that if you want to use anything other than the buttons and screen, you <a href="http://www.j2mesecrets.com/page5.cfm">need your code signed</a>. All of this was supposed to make code signing in Java ME centralised, being based upon impartial third parties like Verisign, Thawte, and others, but now some carriers (particularly in the US) have implemented their own certification processes, which defeats the point of having a centralised verification service like the <a href="http://javaverified.com/jvProcess.jsp">Java Verified Program</a>. Cingular&#8217;s lock-down in the US is a prime example of this evil &#8211; developers can only use the Bluetooth API (JSR-82) if you&#8217;re an enterprise partner with $1000 to spare for Cingular to test your application. <a href="http://developers.sun.com/mobility/apis/articles/location/">JSR-179 </a>(location services) is <a href="http://www.spenceruresk.com/2007/05/26/the-hidden-problem-with-j2me/">banned altogether</a>. &#8220;PIM, SMS, and internet connectivity services are also heavily restricted, with most things requiring at least a 3rd party cert ($500 or so per year) to use.&#8221;</p>
<p class="img"><img src="http://www.michaelvoong.com/wp-content/uploads/2008/01/j2me-permission-2.jpg" alt="j2me_permission_2.jpg" border="0" height="74" width="200" /></p>
<p>Here&#8217;s how it goes for the poor developers who want maximum market penetration with their app, but are locked-down by carriers. To get your program verified by the &#8220;official&#8221; verification system &#8211; Java Verified, you need to pay an independent testing lab. For each bug fix release, you need to pay them to re-test. Your Java Me application can get around the security dialogs once it&#8217;s verified, but as soon as you want to release new versions you can understand that costs build up. Read more about the signing process <a href="http://www.joefission.com/2006/06/java_verified_w.html">here</a>.</p>
<p>Bedroom developers, and freeware developers need to start charging to maintain useful applications &#8211; <strong>not an ideal way to encourage innovation is it?</strong>. Google chose to not bother signing their <a href="http://www.google.com/gmm">Google Maps for mobile</a> application, as a testament to how bad the whole process is. I can understand that you need to go through a complicated process to allow application developers to access your personal information and phone numbers, but what about bluetooth access? How much harm can be done? Even so, what about giving users the choice to silence all future security dialogs with a &#8220;remember my decision&#8221; option?</p>
<p>Alas, when the restricted APIs are used in research in the UK it isn&#8217;t so bad &#8211; we don&#8217;t have operators like Cingular here. On the Nokia and Sony Ericsson phones I have tested the security dialogs only appear when you start the program. For the purposes of my experiments, I can just tell users to pick &#8220;allow&#8221; every time, and the problem is solved. I don&#8217;t really need to sign my applications.</p>
<p>More reading and good summary here: <a href="http://javablog.co.uk/2007/08/09/how-midlet-signing-is-killing-j2me/">How Midlet Signing is Killing J2ME/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.michaelvoong.com/2008/01/14/java-verification-not-for-me/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>

