<?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>DEV</title>
	<atom:link href="http://thegothicparty.com/dev/feed/" rel="self" type="application/rss+xml" />
	<link>http://thegothicparty.com/dev</link>
	<description>Developement notes</description>
	<lastBuildDate>Fri, 25 Jun 2010 21:17:48 +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>Orienteering Compass iPhone App</title>
		<link>http://thegothicparty.com/dev/iphone/orienteering-compass/</link>
		<comments>http://thegothicparty.com/dev/iphone/orienteering-compass/#comments</comments>
		<pubDate>Fri, 14 May 2010 02:46:50 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Apple iPhone Apps]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=505</guid>
		<description><![CDATA[Orienteering Compass is the only iPhone compass designed specifically with the sport of orienteering in mind. Practical and energy efficient(*), it is well suited to backpacking, hiking and mountaineering.

Featuring multiple realistic views, this elegant tool behaves just like an oil-bath mechanical compass  equipped with a locking outer-ring&#8230;




&#8220;Map used with permission of the Bay Area Orienteering [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thegothicparty.com/dev/iphone/orienteering-compass/"><img class="alignleft size-full wp-image-540" style="margin: 0px; border: 0px solid black;" title="Orienteering Compass iPhone App" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/protractor_crop_33per100.jpg" alt="" width="218" height="217" /></a>Orienteering Compass is the <span style="text-decoration: underline;">only</span> iPhone compass designed specifically with the sport of orienteering in mind. Practical and energy efficient(*), it is well suited to backpacking, hiking and mountaineering.<br />
<a href="http://itunes.apple.com/us/app/orienteering-compass/id372749402?mt=8"><img class="size-full wp-image-578 alignnone" style="margin: 0px 0px 0px 0px; border: 0pt none;" title="Orienteering Compass iPhone App" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/app_store.png" alt="Visit Orienteering Compass on the App Store" width="300" height="71" /></a><br />
Featuring multiple realistic views, this elegant tool behaves just like an oil-bath mechanical compass  equipped with a locking outer-ring&#8230;<br />
<a href="http://thegothicparty.com/dev/iphone/orienteering-compass/"><img class="alignright size-full wp-image-544" style="margin: 0px; border: 0px solid black;" title="Designed to work without GPS and in Airplane Mode" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/nogps.png" alt="" width="513" height="29" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><span id="more-505"></span><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /></em><img src="" /><br />
<em>&#8220;Map used with permission of the <strong>Bay Area Orienteering Club</strong> <a href="http://baoc.org">baoc.org</a>&#8220;</em><br />
<!-- space --></p>
<div style="clear: both;"><!-- reset --></div>
<h2>Features</h2>
<ol>
<li>Outer-rim is a protractor that rotates just like oil-bath compass</li>
<li>Protractor can be locked, and stays locked</li>
<li>Compass needle responds to magnetic north</li>
<li>Day and night views</li>
<li>Designed to perform correctly in airplane mode (GPS disabled)</li>
<li>No cellular signal nor GPS signal required needed</li>
<li>Accurate rulers graduated with 2.5 inches and 6 cm (Based on iPhone @ 163 ppi)</li>
<li>No setting. Pick it up, it works</li>
</ol>
<p>Since the Orienteering Compass performs equally well with or without Global Positioning System enabled, it can be used to simulate a physical protractor compass used under similar conditions. While it is not intended to be used during orienteering competitions, it certainly makes a great and realistic training apparatus.</p>
<table width="100%">
<tbody>
<tr>
<td><img class="aligncenter size-full wp-image-516" style="margin: 0px; border: 0px solid black;" title="International Orienteering Symbol" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/orienteering_symbol_64.png" alt="" width="64" height="64" /></td>
<td><!-- //TopListed Link Code Begins// --><a href="http://orienteering.toplisted.net/index.php?id=25094" target="_orienteering.toplisted.net"><img class="aligncenter size-full wp-image-516" style="margin: 0px; border: 0px solid black;" src="http://orienteering.toplisted.net/image.php?id=25094&amp;type=3" border="0" alt="" width="143" height="72" /></a><!-- //TopListed Link Code Ends// --></td>
</tr>
</tbody>
</table>
<p>Its minimalistic and intuitive interface makes it an ideal learning and teaching tool, complete with rotating protractor and glow-in-the-dark appearance.<br />
Since it is designed primarily around the stringent needs of orienteering (accuracy, readability, no setup or preferences to fiddle with, protractor and rulers, no cellular signal), it makes it a perfect compass for outdoors activities such as backpacking, hiking and trekking. The simple fact that it runs in &#8220;Airplane Mode&#8221;  allows Orienteering Compass to be a low consumption, energy efficient application.</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>Hardware Requirements</h2>
<ol>
<li>An iPhone 4</li>
<li>or an iPhone 3Gs (with internal magnetometer)</li>
<li>or an iPad (any version) <em>Note that the rulers are not accurate on iPad</em></li>
</ol>
<p>(Not to worry, you will not be able to buy this application from the App Store if your device does not have an internal magnetometer.)</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>About the Compasses&#8230;</h2>
<h3><!-- blank --></h3>
<h3><strong>1.</strong> Familiar Interface</h3>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/05/Screenshot.Generic.jpg"><img class="size-full wp-image-551 alignright" style="margin: 0px; border: 0px solid black;" title="Generic" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/Screenshot.Generic1.jpg" alt="" width="162" height="242" /></a><br />
<strong><span style="font-weight: normal;"> </span>All protractors&#8217; outer rims rotate the same way</strong><strong>.</strong><br />
Use the outer rim to adjust, and a single lock button to fix.</p>
<p>A lock prevents the compass-heading information from drifting.<br />
The heading can be set once, and will stick until changed. Quitting the application will not affect the heading. Just like an oil-bath compass, only one heading is stored at a time.</p>
<div style="clear: both;"><!-- reset --></div>
<h3><!-- blank --></h3>
<h3><strong>2.</strong> Different looks</h3>
<p><strong><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/05/Screenshot.night_.jpg"><img class="alignright size-full wp-image-554" style="margin: 0px; border: 0px solid black;" title="Night" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/Screenshot.night_1.jpg" alt="" width="162" height="242" /></a>Regular protractor ; Large and Off-centered ; Night ; Nautical</strong><strong>.</strong><br />
Day, twilight and night (low light screen).</p>
<p>The protractor lines in the Nautical style make it easy to adjust the heading using an iPhone. After all, the iPhone is not transparent and the practical layout makes it a useful tool.</p>
<p>Headings are remembered across all compasses styles.</p>
<p>The night-look interface featured here is particularly dim and readable in low-light situations.</p>
<div style="clear: both;"><!-- reset --></div>
<h3><!-- blank --></h3>
<h3><strong>3.</strong> A tool, not a toy</h3>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/05/Screenshot.nautical.jpg"><img class="alignright size-full wp-image-553" style="margin: 0px; border: 0px solid black;" title="Nautical" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/Screenshot.nautical1.jpg" alt="" width="162" height="242" /></a><strong>Simplicity has not been sacrificed to the interface</strong></p>
<p><strong><span style="font-weight: normal;">While most compass applications give the geographic (true) and magnetic north, the approach to Orienteering compass is to make it a straight substitution for a physical device. Where others may have created eye-candy, most of the time relying on the GPS for current coordinates and even links to actual maps (using precious battery power in the field), Orienteering Compass is explicitly replicates the simple and elegant oil-bath compass.</span></strong></p>
<div style="clear: both;"><!-- reset --></div>
<h3><!-- blank --></h3>
<h3><strong>4.</strong> Rulers, Direction Of Travel and other features</h3>
<p><strong>Rulers</strong><br />
<img class="alignleft size-full wp-image-557" style="margin: 0px; border: 0px solid black;" title="rulers" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/rulers.png" alt="" width="208" height="46" /></p>
<div style="clear: both;"><!-- reset --></div>
<p><span style="font-weight: normal;">All iPhones (and iPod Touch) come with a screen resolution of 320&#215;480 pixels at 163 ppi. This means that, when measured vertically or horizontally, exactly 163 pixels will fit in a linear inch. Using this characteristic, Orienteering Compass is able to provide two different rulers, one 2.5 inches long on one side, and one 6 cm long on the other.</span></p>
<p><strong>DOT</strong></p>
<p><img class="alignleft size-full wp-image-558" style="margin: 0px; border: 0px solid black;" title="DOT" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/dot.png" alt="" width="43" height="77" />The Direction Of Travel is clearly marked by an arrow on all screens.</p>
<div style="clear: both;"><!-- reset --></div>
<p><strong>Independent Outer-Rim and lock</strong></p>
<p><img class="alignleft size-full wp-image-561" style="margin: 0px; border: 0px solid black;" title="Independent Protractor Rim" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/halfrim.png" alt="" width="147" height="75" />The outer-rim rotates and locks independently of the compass needle. Once locked, it is not at risk of being accidentally changed. The application can also be safely exited, the setting of the outer rim is not affected.</p>
<div style="clear: both;"><!-- reset --></div>
<p><strong>Airplane Mode</strong></p>
<p><img class="alignleft size-full wp-image-545" style="margin: 0px; border: 0px solid black;" title="iPhone Settings: Airplane Mode" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/set-airplanemode.png" alt="" width="302" height="45" /></p>
<div style="clear: both;"><!-- reset --></div>
<p>Orienteering Compass does not rely on the GPS nor the cellular signal to calculate it&#8217;s orientation. It relies upon the internal magnetometer embedded in the iPhone 4, 3Gs and the iPad. If you are using Orienteering Compass in an outdoor setting where a source of power may not be readily available, it is recommended to put your phone in Airplane Mode to conserve battery. As a matter of fact, Orienteering Compass <span style="text-decoration: underline;">will</span> work in an airplane!</p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>How to use&#8230;</h2>
<h3><!-- blank --></h3>
<p><img class="alignnone size-full wp-image-575" style="margin: 0px; border: 0px solid black;" title="Orienteering Compass iPhone App" src="http://thegothicparty.com/dev/wp-content/uploads/2010/05/XAV2055_50pcrop.jpg" alt="" width="576" height="108" /><br />
<em>&#8220;Map used with permission of the <strong>Bay Area Orienteering Club</strong> <a href="http://baoc.org">baoc.org</a>&#8220;</em></p>
<h3><strong>1.</strong> Align the Direction Of Travel</h3>
<p><strong>Put the device on top of the map</strong><strong>.</strong><br />
Align the course to the side of the phone. It matters not to align the current position with the rulers. Only the direction of travel matters.</p>
<div style="clear: both;"><!-- reset --></div>
<h3><!-- blank --></h3>
<h3><strong>2.</strong> Adjust the outer-ring</h3>
<p><strong>Unlock the outer-rim.<br />
</strong>Align the protractor with the magnetic north of the map. There is no need to orient the map, since the protractor rotates freely. Make sure you use the maps&#8217;s magnetic north, or compensate for local declination. Orienteering maps indicate the magnetic north. When set, tap &#8220;lock&#8221;. Note that the rim would lock on it&#8217;s own after a short delay.</p>
<h3><!-- blank --></h3>
<h3><strong>3.</strong> Orient the compass</h3>
<p><strong>Rotate the device until the needle and the protractor overlap.<br />
</strong>When the compass needle and the protractor overlap, the DOT arrow (the front of the phone when held flat) points to the direction of travel.</p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2><span style="color: #ff6600;"><a href="http://itunes.apple.com/us/app/orienteering-compass/id372749402?mt=8"><img class="alignnone size-full wp-image-580" style="margin: 0px; border: 0pt none;" title="Orienteering Compass iPhone App" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/app_store_icon.jpg" alt="" width="115" height="114" /></a></span>Get it now.</h2>
<h2>Orienteering Compass is available on the App Store.</h2>
<h2><span style="color: #ff0000;"> </span></h2>
<h3><!-- keep this --></h3>
<p><a title="Orienteering Compass iPhone App" href="http://itunes.apple.com/us/app/orienteering-compass/id372749402?mt=8"><span style="color: #ff6600;">Click here to visit Orienteering Compass on the App Store.</span><br />
</a></p>
<p><a title="Orienteering Compass iPhone App" href="http://itunes.apple.com/us/app/orienteering-compass/id372749402?mt=8"></p>
<h3><!-- keep this --></h3>
<p></a></p>
<p><a title="Orienteering Compass iPhone App" href="http://itunes.apple.com/us/app/orienteering-compass/id372749402?mt=8">(http://itunes.apple.com/us/app/orienteering-compass/id372749402?mt=8)</a><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>Technical Support</h2>
<ul>
<li>orienteeringcompass@thegothicparty.com</li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>End-User License Agreement (EULA)</h2>
<p>No guaranties, implicit or explicit.<br />
The complete End-User License Agreement can be read at:</p>
<p><a title="Orienteering Compass End User License Agreement" href="http://thegothicparty.com/dev/wp-content/extras/orienteering-compass-EULA.html" target="_blank">thegothicparty.com/dev/wp-content/extras/orienteering-compass-EULA.html</a></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fiphone%2Forienteering-compass&amp;title=Orienteering+Compass+iPhone+App', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://static.delicious.com/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fiphone%2Forienteering-compass&amp;title=Orienteering+Compass+iPhone+App"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/iphone/orienteering-compass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Old Compass iPhone App</title>
		<link>http://thegothicparty.com/dev/iphone/oldcompass/</link>
		<comments>http://thegothicparty.com/dev/iphone/oldcompass/#comments</comments>
		<pubDate>Wed, 28 Apr 2010 08:02:59 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Apple iPhone Apps]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=432</guid>
		<description><![CDATA[Old Compass is a collection of skillfully crafted antique magnetic compasses for the iPhone. All four compasses are fully functional, and will orient themselves according to the magnetometer present in the iPhone 4 or iPhone 3Gs, or iPad.

With these compasses, the rotating dial and the background are independent and spin freely. Some parts of the [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thegothicparty.com/dev/iphone/oldcompass/"><img class="alignleft size-full wp-image-467" style="border: 0pt none;" title="Old Compass iPhone App" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/tilted1.png" alt="" width="169" height="264" /></a>Old Compass is a collection of skillfully crafted antique magnetic compasses for the iPhone. All four compasses are fully functional, and will orient themselves according to the magnetometer present in the iPhone 4 or iPhone 3Gs, or iPad.<br />
<a href="http://itunes.apple.com/us/app/old-compass/id370131301?mt=8"><img class="size-full wp-image-578 alignnone" style="margin: 0px 20px 0px 10px; border: 0pt none;" title="Old Compass iPhone App" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/app_store.png" alt="Visit Old Compass on the App Store" width="300" height="71" /></a><br />
With these compasses, the rotating dial and the background are independent and spin freely. Some parts of the devices can be operated by a swipe gesture. The designs are faithful renditions of genuine drawings. They are either inspired by actual inventions, or by old maps&#8217; compass roses.</p>
<div style="clear: both;"><!-- reset --></div>
<p><span id="more-432"></span><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>Features</h2>
<ol>
<li> Magnetic north, to suit the traditional behavior of good old compasses</li>
<li>Compass moves independently of background</li>
<li>4 compasses to choose from, using the <em><strong>i</strong></em> button.<br />
<img class="alignnone size-full wp-image-598" style="border: 0pt none;" title="i_button" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/i_button.png" alt="(i) button" width="347" height="91" /></li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>Hardware Requirements</h2>
<ol>
<li>iPhone 4</li>
<li> or iPhone 3Gs (with internal compass)</li>
<li>or an iPad (any version)</li>
</ol>
<p>(Not to worry, you will not be able to buy this application from the App Store if your device does not have an internal magnetometer.)</p>
<p style="text-align: center;"><img class="aligncenter size-full wp-image-469" style="border: 0pt none;" title="Aguiar" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/aguiar_persp.png" alt="" width="550" height="83" /></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>About the Compasses&#8230;</h2>
<h3><!-- blank --></h3>
<h3><strong>1.</strong> E. L. Holmes</h3>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/04/holmes_screenshot.png"><img class="alignright size-full wp-image-463" style="border: 0pt none;" title="Holmes" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/screenshot1_50.png" alt="" width="162" height="232" /></a></p>
<p><strong>Master Compass, a navigating apparatus.</strong></p>
<p>Inspired by an apparatus patented by Edward L. Holmes on February 1, 1926. Patent No 1,702,405.</p>
<p>&#8230;Fig. 1 shows schematically the several units comprising the master-compass and a repeater-compass illustrative of mechanism which may be actuated and  controlled by said master-compass &#8211; together with a wiring diagram of an electrical system which may be employed in connection therewith; &#8230;</p>
<p>A single drawing from E. L. Holmes has been carefully and faithfully reproduced, to bring this invention to life in Old Compass. The only modification added for convenience and use as a compass is the addition of three typewriter characters indicating west, south and east, not present in the original graphic.</p>
<div style="clear: both;"><!-- reset --></div>
<h3><!-- blank --></h3>
<h3><strong>2.</strong> J. Schiessler</h3>
<p><strong><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/04/schiessler_screenshot.png"><img class="alignright size-full wp-image-464" style="border: 0pt none;" title="Schiessler" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/screenshot2_50.png" alt="" width="162" height="232" /></a>Sound-Indicator for Vessels.</strong><br />
An apparatus patented by Josef Schiessler on October 18, 1904. Patent No 772,676.</p>
<p>&#8230;The principal object of the invention is to indicate the direction of movement or the approach of a vessel not yet seen, maybe at night or in a fog. &#8230; The apparatus consists of two main parts, one of which is arranged on the deck of ship, whereas the other is submerged into the water and connected with the other main part by means of a tube &#8230;</p>
<p>While not actually a compass in the original J. Schiessler invention, the device has as similar needle pointer in the author&#8217;s drawings. The device comes to like in Old Compass, as the magnetic heading is indicated by the floating arrow.</p>
<div style="clear: both;"><!-- reset --></div>
<h3><!-- blank --></h3>
<h3><strong>3.</strong> T. Dawson</h3>
<p><strong><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/04/dawson_screenshot.png"><img class="alignright size-full wp-image-465" style="border: 0pt none;" title="Dawson" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/screenshot3_50.png" alt="" width="162" height="232" /></a>Navigational mariner&#8217;s compass, composed of two systems.</strong></p>
<p><strong><br />
<span style="font-weight: normal;">By the end of the sixteenth century, several features of the compass were established conventions: the image of the rose at the axis ; the eight-pointed star ; the points of the compass such as &#8220;north by north-east&#8221; ; the Fleur de Lys indicating north ; the Cross indicating east; four quadrants of 90 degrees each ; and sometimes a sundial. This compass rose has it all, including the sundial which the mariner could use to tell the time as well as heading. The sundial&#8217;s marking were designed to be used on the northern hemisphere.</span></strong></p>
<p><strong><span style="font-weight: normal;">You too can use the Old Compass to tell time from the secondary dial using the sun&#8217;s position, or find the geographical north independently of the compass position when knowing the local time.</span></strong></p>
<p>As published in &#8220;The Seaman&#8217;s Secrets&#8221;, Thomas Dawson, 1607. First appeared in a 1596 document.<br />
National Library of Canada</p>
<p><em>The image (or other media file) is in the public domain because its copyright has expired.</em></p>
<div style="clear: both;"><!-- reset --></div>
<h3><!-- blank --></h3>
<h3><strong>4.</strong> J. Aguiar</h3>
<p><strong><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/04/aguiar_screenshot.png"><img class="alignright size-full wp-image-466" style="border: 0pt none;" title="Aguiar" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/screenshot4_50.png" alt="" width="162" height="232" /></a>A 32-point compass rose</strong><br />
From a nautical chart drawn by Jorge de Aguiar. This is apparently the oldest personally signed Portuguese nautical chart, dated 1492.</p>
<p>Original is in the Beinecke Library, Yale University, USA.</p>
<p><em>The image (or other media file) is in the public domain because its copyright has expired.</em></p>
<p>The rose hovers over the map.</p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2><span style="color: #ff6600;"><a href="http://itunes.apple.com/us/app/old-compass/id370131301?mt=8"><img class="alignnone size-full wp-image-580" style="margin: 0px; border: 0pt none;" title="Old Compass iPhone App" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/app_store_icon.jpg" alt="" width="115" height="114" /></a></span>Get it now.</h2>
<h2>Old Compass is available on the App Store.</h2>
<h2><span style="color: #ff0000;"> </span></h2>
<h3><!-- keep this --></h3>
<p><a title="Old Compass iPhone App" href="http://itunes.apple.com/us/app/old-compass/id370131301?mt=8"><span style="color: #ff6600;">Click here to visit Old Compass on the App Store.</span><br />
(http://itunes.apple.com/us/app/old-compass/id370131301?mt=8)</a><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>Technical Support</h2>
<ul>
<li>oldcompass@thegothicparty.com</li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>End-User License Agreement (EULA)</h2>
<p>No guaranties, implicit or explicit.<br />
The complete End-User License Agreement can be read at:</p>
<p><a title="Old Compass End User License Agreement" href="http://thegothicparty.com/dev/wp-content/extras/oldcompass-EULA.html" target="_blank">thegothicparty.com/dev/wp-content/extras/oldcompass-EULA.html</a></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em>
<div style="clear: both;"><!-- reset --></div>
<h2>Old Compass iPhone App On The Web&#8230;</h2>
<div style="clear: both;"><!-- reset --></div>
<p><a href="http://www.chasses-au-tresor.com/generalites/outils/boussole-iphone.html"><img src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/chasses-au-tresor-com.jpg" style="border: 0pt none;" title="Chasses aux tr&eacute;sor.com"  title="chasses-au-tresor.com" width="75" height="50" class="alignnone size-full wp-image-603" /></a><br />
Old Compass iPhone App (Vieille Boussole appli) is featured on<br />
<a href="http://www.chasses-au-tresor.com/generalites/outils/boussole-iphone.html">Chasses-aux-tr&eacute;sor.com</a>.</p>
<h3><!-- blank --></h3>
<p><!-- //TopListed Link Code Begins// --><a href="http://ipod.toplisted.net/index.php?id=25096" target="_ipod.toplisted.net"><img class="aligncenter size-full wp-image-516" style="margin: 0px; border: 0px solid black;" src="http://ipod.toplisted.net/image.php?id=25096&amp;type=1" border="0" alt="" width="94" height="20" /></a><!-- //TopListed Link Code Ends// --></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fiphone%2Foldcompass&amp;title=Old+Compass+iPhone+App', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://static.delicious.com/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fiphone%2Foldcompass&amp;title=Old+Compass+iPhone+App"></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" /><br />
</em></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/iphone/oldcompass/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>WWW (Wilson WordPress Website)</title>
		<link>http://thegothicparty.com/dev/web/wilson-wordpress/</link>
		<comments>http://thegothicparty.com/dev/web/wilson-wordpress/#comments</comments>
		<pubDate>Wed, 14 Apr 2010 23:47:34 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Web]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=420</guid>
		<description><![CDATA[New to the www, a website built using WordPress, custom CSS, audio, video.
Located at bernadettewilson.com.


This site is really a hybrid of out-of-the-box WordPress, and the following:

Customized stylesheets
Home brew Template theme file
Movies &#38; Audio plug-ins
A CSS animation (on the home page)
GraphicConverter automatic web-page feature
Word to HTML feature

]]></description>
			<content:encoded><![CDATA[<p><a title="BernadetteWilson.com" href="http://bernadettewilson.com"><a title="Bernadette Wilson Home" href="http://bernadettewilson.com"><img class="alignleft size-full wp-image-425" style="border: 0pt none;" title="Bernadette Wilson Home Page" src="http://thegothicparty.com/dev/wp-content/uploads/2010/04/bwilson_home.png" alt="Bernadette Wilson" width="166" height="119" /></a></a>New to the www, a website built using WordPress, custom CSS, audio, video.<br />
Located at <a href="http://bernadettewilson.com">bernadettewilson.com</a>.</p>
<div style="clear: both;"><!-- reset --></div>
<p><span id="more-420"></span><br />
This site is really a hybrid of out-of-the-box WordPress, and the following:</p>
<ol>
<li>Customized stylesheets</li>
<li>Home brew Template theme file</li>
<li>Movies &amp; Audio plug-ins</li>
<li>A CSS animation (on the home page)</li>
<li>GraphicConverter automatic web-page feature</li>
<li>Word to HTML feature</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/web/wilson-wordpress/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Software crash on LandingGear-&gt;Deploy()</title>
		<link>http://thegothicparty.com/dev/article/software-crash-on-landing/</link>
		<comments>http://thegothicparty.com/dev/article/software-crash-on-landing/#comments</comments>
		<pubDate>Fri, 26 Mar 2010 08:58:03 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=357</guid>
		<description><![CDATA[Referencing and de-referencing objects in an Object Oriented Environment can be a challenge.These are real life examples; the names of the objects have been changed to preserve the identity of the victims. Please fasten your seat belt.

When I take an airplane, I cannot help but think of all the poor programming practices I have witnessed [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://thegothicparty.com/dev/article/software-crash-on-landing/"><img style="border: 0pt none;" title="Software crash on LandingGear-&gt;Deploy()" src="http://yuml.me/diagram/scruffy/class/[Airplane]." alt="" /></a>Referencing and de-referencing objects in an Object Oriented Environment can be a challenge.<br />These are real life examples; the names of the objects have been changed to preserve the identity of the victims. Please fasten your seat belt.</p>
<div style="clear: both;"><!-- reset --></div>
<blockquote><p>When I take an airplane, I cannot help but think of all the poor programming practices I have witnessed -some committed by myself- over the years. I often wonder if the on-board computers have been programmed by my earlier engineering peers.</p></blockquote>
<p><span id="more-357"></span></p>
<h2>1. A short Object Oriented Programming Refresher</h2>
<h3>1.1 Object Inheritance</h3>
<p>Say you have three classes. An airplane, a commercial airliner and a private jet. We can all agree that both the jet and the airliner are kinds of airplanes.<br />
<img src="http://yuml.me/diagram/scruffy/class/[Airplane]^[Private Jet], [Airplane]^[Commercial Airliner]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p>This is the basis of object-oriented development. You model abstract objects after entities in the real world.</p>
<div style="clear: both;"><!-- reset --></div>
<h3>1.2. Object Properties</h3>
<p>Say that an airplane has landing gear, I reckon all airplanes have landing gear. Assuming we are not discussing here the very specific case of hydroplanes, the gear (at least a generic one) should probably belong to the airplane object.<br />
<img src="http://yuml.me/diagram/scruffy/class/[Airplane]uses-.-&gt;[LandingGear]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<h3>1.3. Inherited Properties</h3>
<p>So in the real world, having landing gear is not particularly specific to the private jet or the commercial airliner. Being fitted with landing gear, retractable or not, is general to all airplanes.</p>
<p><img src="http://yuml.me/diagram/scruffy/class/[Commercial Airliner]->[Airplane], [Private Jet]->[Airplane], [Airplane]uses-.->[LandingGear].&#8221; alt=&#8221;" /></p>
<div style="clear: both;"><!-- reset --></div>
<h3>1.4. Class Members</h3>
<p>The landing gear, in itself, can be a pretty complex device.</p>
<ol>
<li>
<h4>Member variables</h4>
<p>It has members that remember states, such as stowed away vs. ready for landing.<br />
Example: <strong>isReady</strong></li>
<li>
<h4>Member methods</h4>
<p>It also has functions, which generally, but not always, will change its state. Such functions can be deploy vs. stow.</p>
<p>Example: <strong>Deploy()</strong></li>
</ol>
<p><img src="http://yuml.me/diagram/scruffy/class/[LandingGear|isReady|Deploy()]-[note: Invoking Deploy() will open the landing gear and change the state of isReady{bg:yellow}]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p>This is where encapsulating functionality into an object starts to make a lot of sense. You need not to know the specifics of how a mechanism (or an algorithm) is implemented. You only need to know how to invoke it: in this example, it&#8217;s Deploy().</p>
<h3>1.5. Delegate Behavior</h3>
<p>In this simplified model, it matters not which kind of airplane you fly. All you need to do is to flip a switch to initiate the landing procedure, and the airplane object just &#8220;knows&#8221; what to do.<br />
<img src="http://yuml.me/diagram/scruffy/usecase/[Pilot]-(Initiate Landing Procedure), (Initiate Landing Procedure)&gt;(LandingGear Deploy), [Pilot]-(note: Pilot does not need to know how the landing gear works{bg:yellow})." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<h3>1.6. Larger Picture</h3>
<p><a href="http://yuml.me/diagram/scruffy;dir:lr/class/[Commercial%20Airliner]-%3E[RetractableGearPlane],%20[Private%20Jet]-%3E[RetractableGearPlane],%20[Hydroplane]-%3E[FixedGearPlane],%20[FixedGearPlane]-%3E[Airplane|PrepareForLanding()],%20[RetractableGearPlane]-%3E[Airplane],%20[Airplane]uses-.-%3E[LandingGear|isReady|Deploy()],%20[Airplane]uses-.-%3E[Flaps],%20[Airplane]-[note:%20Invoking%20PrepareForLanding()%20will%20operate%20LandingGear%20&#038;%20Flaps%20based%20on%20configuration{bg:yellow}],%20[LandingGear]-[note:%20Invoking%20Deploy()%20will%20be%20interpreted%20by%20the%20implementation{bg:yellow}],%20[LandingGear]%3C-[FixedGear],%20[LandingGear]%3C-[RetractableGear|Deploy()],%20[FixedGear]-[note:%20Invoking%20Deploy()%20will%20do%20nothing{bg:wheat}],%20[RetractableGear]-[note:%20Invoking%20Deploy()%20will%20open%20the%20landing%20gear%20and%20change%20the%20state%20of%20isReady{bg:wheat}],%20[RetractableGearPlane]implements-.-%3E[RetractableGear],%20[FixedGearPlane]implements-.-%3E[FixedGear],%20[RetractableGear]-.-%3E[Open%20gear%20trap],%20[RetractableGear]-.-%3E[self%20check],%20[RetractableGearPlane]-[note:%20A%20single%20switch%20will%20operate%20the%20LandingGear%20regardless%20of%20apparatus%20complexity{bg:yellow}],%20[note:%20Do%20NOT%20use%20this%20model%20to%20implement%20an%20actual%20airplane!{bg:red}]."><img style="border: 0pt none;" title="click to enlarge" src="http://yuml.me/diagram/scruffy;scale:80;dir:lr/class/[note:%20Do%20NOT%20use%20this%20model%20to%20implement%20an%20actual%20airplane!{bg:red}]." alt=""/><img style="border: 0pt none;" title="click to enlarge" src="http://yuml.me/diagram/scruffy;scale:40;dir:lr/class/[Commercial%20Airliner]-%3E[RetractableGearPlane],%20[Private%20Jet]-%3E[RetractableGearPlane],%20[Hydroplane]-%3E[FixedGearPlane],%20[FixedGearPlane]-%3E[Airplane|PrepareForLanding()],%20[RetractableGearPlane]-%3E[Airplane],%20[Airplane]uses-.-%3E[LandingGear|isReady|Deploy()],%20[Airplane]uses-.-%3E[Flaps],%20[Airplane]-[note:%20Invoking%20PrepareForLanding()%20will%20operate%20LandingGear%20&#038;%20Flaps%20based%20on%20configuration{bg:yellow}],%20[LandingGear]-[note:%20Invoking%20Deploy()%20will%20be%20interpreted%20by%20the%20implementation{bg:yellow}],%20[LandingGear]%3C-[FixedGear],%20[LandingGear]%3C-[RetractableGear|Deploy()],%20[FixedGear]-[note:%20Invoking%20Deploy()%20will%20do%20nothing{bg:wheat}],%20[RetractableGear]-[note:%20Invoking%20Deploy()%20will%20open%20the%20landing%20gear%20and%20change%20the%20state%20of%20isReady{bg:wheat}],%20[RetractableGearPlane]implements-.-%3E[RetractableGear],%20[FixedGearPlane]implements-.-%3E[FixedGear],%20[RetractableGear]-.-%3E[Open%20gear%20trap],%20[RetractableGear]-.-%3E[self%20check],%20[RetractableGearPlane]-[note:%20A%20single%20switch%20will%20operate%20the%20LandingGear%20regardless%20of%20apparatus%20complexity{bg:yellow}]." alt="" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>2. A Programming Error Crash Course: Dont&#8217; fly with those!</h2>
<p>I have gathered below a few errors I have seen in the past. Do <strong>not</strong> try this at home!<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<h3>2.1. public static</h3>
<p><img src="http://yuml.me/diagram/scruffy/class/[Airplane]owns-&gt;[LandingGear|isReady|Deploy(){bg:red}], [Airplane]^[Private Jet], [Private Jet]creates-.-&gt;[LandingGear]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p><code><br />
<strong><span style="color: #800000;">BAD:</span></strong><span style="color: #800000;"><br />
// Whenever needed<br />
if( nil == Airplane.staticLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;Airplane.staticLandingGear = </span><em><span style="color: #800000;">create an instance of LandingGear</span></em><span style="color: #800000;"><br />
}<br />
</span><span style="color: #800000;"><br />
... followed somewhere upon destruction of the object:<br />
</span><span style="color: #800000;"><br />
// Upon desctruction of the creator<br />
if( nil != Airplane.staticLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;delete Airplane.staticLandingGear;<br />
&nbsp;&nbsp;&nbsp;&nbsp;Airplane.staticLandingGear = nil;<br />
}</span><br />
</code></p>
<p>While this may look proper at first glance, and possibly even work depending on the situation, I have seen this code create havoc when placed in the &#8220;Private Jet&#8221; or &#8220;Commercial Airliner&#8221; sub-class. Create more than one plane and you have a disaster.<br/></p>
<p><code><span style="color: #008000;"><strong>BETTER:</strong><br />
// Whenever needed<br />
aLandingGear = Airplane.getLandingGear();</span></p>
<p><span style="color: #008000;">... and the LandingGear instance in turn created and maintained by a singleton</span></p>
<p><span style="color: #008000;">getLandingGear()<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;// Ensures only one LandingGear instance exists<br />
&nbsp;&nbsp;&nbsp;&nbsp;if( nil == staticLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;staticLandingGear = </span><em><span style="color: #008000;">create a unique instance of LandingGear</span></em><span style="color: #008000;"><br />
&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;return staticLandingGear;<br />
}</span></code></p>
<ol>
<li>Problem:
<p>More than one object may destroy the public static variable</li>
<li>Suggestion:
<p>Use a singleton and a private static.</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<h3>2.2. silent error</h3>
<p><img src="http://yuml.me/diagram/scruffy/usecase/[Pilot]-(Flip switch in Airplane), (Flip switch in Airplane)&gt;(LandingGear Deploy not invoked), [Pilot]-(note: Pilot not informed that gear did not deploy. Neither was QA.{bg:red})." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p><code><span style="color: #ff0000;"><strong><span style="color: #800000;">BAD:</span></strong></span><br />
<span style="color: #800000;"> if( nil != aLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;aLandingGear.Deploy();<br />
}</span><br />
</code><br />
Defensive programming has it&#8217;s price. In this case, the software <span style="text-decoration: underline;">will not crash</span> if the LandingGear object does not exist. Good.<br />
Conversely, the <span style="text-decoration: underline;">plane will crash</span> because no landing gear has been deployed. Bad.<br />
This situation could have been detected early on if the software had not failed silently during the development phase, before it was deployed.<br />
<code><br />
<span style="color: #00ff00;"><strong><span style="color: #008000;">BETTER:</span></strong></span><span style="color: #008000;"><br />
</span><span style="color: #008000;">assert( aLandingGear); // Will alert QA that something went terribly wrong<br />
if( nil != aLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;aLandingGear.Deploy();<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;// Something is terribly wrong and we should not be there<br />
&nbsp;&nbsp;&nbsp;&nbsp;startEmergencyProcedure();<br />
} </span></code></p>
<ol>
<li>Problem:
<p>Failure goes undetected and unreported during development</li>
<li>Suggestion:
<p>Use <em>assert()</em> and <em>error_log()</em> to report unexpected conditions</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<h3>2.3. uninitialized object</h3>
<p><img src="http://yuml.me/diagram/scruffy/class/[Aiplane], [LandingGear]-[note: Not attached!{bg:red}]." alt="" /></p>
<div style="clear: both;"><!-- reset --></div>
<p>For this example, assume that the landing gear needs to be connected to an airplane.<br />
<code><span style="color: #800000;"><br />
BAD:<br />
if( ! aLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;aLandingGear = new LandingGear();<br />
}<br />
// The app will not crash, because aLandingGear exists<br />
aLandingGear->Deploy(); // Will do nothing. Plane will crash!<br />
</span></code></p>
<p>If an object MUST be initialized, one possibility is to make the default constructor private</p>
<p><code><span style="color: #008000;">BETTER:<br />
if( ! aLandingGear) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;aLandingGear = new LandingGear( anAirplane);<br />
}<br />
</span></code></p>
<ol>
<li>Problem:
<p>Failure to initialize an object</li>
<li>Suggestion:
<p>Make constructor private to force the use of proper initializer, otherwise source code will not compile in the first place.</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<h3>2.4. A bug? Which bug? I didn&#8217;t see a bug.</h3>
<p>I will conclude with my favorite quote from an engineer with whom I do not share the view. I can see the benefits and even possibly some logic behind it, but this is why I hate to fly.<br />
<em><br />
If a bug cannot occur, it is not a bug.</p>
<p>W.W.<br />
</em><br />
I guess that I am not inclined to take the risk; a condition could have been overlooked, or simply created at a later maintenance stage. New situations will arise as the software evolves, and code that was once safe may be misunderstood and misused. From the same engineer, I&#8217;ve also heard this:<br />
<img src="http://yuml.me/diagram/scruffy/class/-[note: 'Well. Of course it will crash if you pass it corrupted data...'{bg:red}]." alt="" /><em><br />
W.W.</p>
<p></em></p>
<div style="clear: both;"><!-- reset --></div>
<p>No comment.</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Farticle%2Fsoftware-crash-on-landing&amp;title=Software+crash+on+LandingGear-%3EDeploy()', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://static.delicious.com/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Farticle%2Fsoftware-crash-on-landing&amp;title=Software+crash+on+LandingGear-%3EDeploy()"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/software-crash-on-landing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Finding hidden memory leak with Instruments</title>
		<link>http://thegothicparty.com/dev/article/finding-hidden-memory-leak-with-instruments/</link>
		<comments>http://thegothicparty.com/dev/article/finding-hidden-memory-leak-with-instruments/#comments</comments>
		<pubDate>Tue, 23 Mar 2010 07:20:52 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[OS Development]]></category>
		<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=275</guid>
		<description><![CDATA[Using the 1 Mb NSDateFormatter memory leak as a case-study, this tutorial shows how to locate and isolate  unexpected memory allocation using Instruments. Technically, this 1 Mb loss is arguably not a leak, since the data is cached, and is still actively referenced by the system. Yet&#8230;
Instruments has built-in tools to isolate true leaks [...]]]></description>
			<content:encoded><![CDATA[<p>Using the 1 Mb <a title=" NSDateFormatter memory leak" href="http://thegothicparty.com/dev/iphone/nsdateformatter-memory-leak/">NSDateFormatter memory leak</a> as a case-study, this tutorial shows how to locate and isolate  unexpected memory allocation using Instruments. Technically, this 1 Mb loss is arguably not a leak, since the data is cached, and is still actively referenced by the system. Yet&#8230;</p>
<p><a href="http://thegothicparty.com/dev/macos/finding-hidden-memory-leak-with-instruments/"><img class="size-full wp-image-276      alignnone" style="border: 0pt none;" title="Finding hidden memory leak with Instruments" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss00.png" alt="" width="256" height="194" /></a><em>Instruments has built-in tools to isolate true leaks (lost blocks) but can also be used to locate memory loss.</em><em> While this session references iPhone OS 3.1.3, it can be generalized: only the  example is specific, not the concept.</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><span id="more-275"></span></p>
<p>&#8230;as an engineer, I tend to differ: if every time I invoked a library API, I&#8217;d loose roughly 1 megabyte of RAM, I&#8217;d soon be running out of memory. I will also argue that, since this memory &#8220;cache&#8221; is neither documented nor explicitly reported it is, for all purposes, a leak(*).</p>
<p><span style="color: #1459ea;">(*) A leak is a lost block. But not all lost blocks qualify as leaks. This article focuses on the ones that don&#8217;t. Just like leaks, these lost blocks are consuming memory space. That space is generally not reclaimed until the host application quits.</span></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>1. Launch Instruments</h2>
<p style="text-align: center;">From XCode, launch your application using &#8220;Object Allocations&#8221;<br />
<a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss01.png"><img class="size-full wp-image-277 aligncenter" style="border: 0pt none;" title="XCode &gt; Run &gt; Start with Performance Tool &gt; Object Allocations" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss01.png" alt="" width="512" height="324" /></a>For this tutorial, we are not using Leaks Instrument Template. While Leaks is very effective against true leaks, it is oblivious to retained but forgotten objects, over-retained objects, or poor API implementation.</p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>2. Run your application<!--more--></h2>
<p>In this example, only 32 seconds (about 0.54 minutes in Instruments notation) were needed to expose the unexpected memory usage.<br />
<a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss02.png"><img class="alignnone size-full wp-image-309" style="border: 0pt none;" title="Run your application" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss02.png" alt="" width="669" height="464" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>It is a good idea to be generous in early scoping of memory usage, since it will fluctuate. For the purpose of this tutorial, this preliminary analysis phase has been skipped entirely.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>3. Stop the Application execution</h2>
<p>It has been established during other sessions that the particular memory consumption we are studying does not change during the lifetime of this application. Stopping it after 34 seconds.</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss03.png"><img class="alignnone size-full wp-image-311" style="border: 0pt none;" title="Stop" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss03.png" alt="" width="103" height="52" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>Instruments can start/stop/save/restore sessions, which makes it invaluable to compare the program behavior before/after alterations.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>4. Objects Created and Still Living</h2>
<p>Focus on the objects that have been allocated, but not de-allocated.</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss04.png"><img class="alignnone size-full wp-image-312" style="border: 0pt none;" title="Objects Created &amp; Still Living" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss04.png" alt="" width="215" height="68" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>Obviously, objects created but no longer living have been de-allocated, and are not of particular interest while searching for leaks.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>5. Observe the Object Allocation Graph</h2>
<p>Looking at the graph, it is easy to spot sudden memory allocation. For increased granularity, reduce the &#8220;Inspection Range&#8221;.<br />
<a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss05.png"><img class="alignnone size-full wp-image-313" style="border: 0pt none;" title="Inspection Range" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss05.png" alt="" width="544" height="158" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>The Inspection Range will reduce the number of items present in the Diagram View below.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>6. Set the View mode to Diagram View</h2>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss06.png"><img class="alignnone size-full wp-image-314" style="border: 0pt none;" title="View Mode" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss06.png" alt="" width="237" height="28" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>7. Navigate the Diagram View</h2>
<p>This is a very handy feature of Instruments. By sliding or dragging the time line cursor, the Diagram View selection will scroll accordingly. By bringing the triangular cursor precisely over the edge of the sharp raise of memory usage around the 0.54 min (32.5 seconds) area, one discovers pages and pages of a repeated call to -[NSDateFormatter getObjectValue:forString:range:error:]</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss07.png"><img class="alignnone size-full wp-image-315" style="border: 0pt none;" title="Navigate" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss07.png" alt="" width="544" height="158" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>8. Focus on the Diagram View</h2>
<p>Observing the Diagram View, sorted either by &#8220;Responsible Caller&#8221; or by &#8220;Creation Time&#8221;, one can see the repeated invocation to the same NSDateFormatter method.</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss08.png"><img class="alignnone size-full wp-image-318" style="border: 0pt none;" title="Focus" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss08.png" alt="" width="669" height="461" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>9. Call Stack</h2>
<p>Turn on the call stack view (Extended Detail View)</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss09.png"><img class="alignnone size-full wp-image-319" style="border: 0pt none;" title="Extended Detail View" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss09.png" alt="" width="237" height="28" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>10. Final analysis</h2>
<p>By selecting a single line in the Diagram View, and inspecting the corresponding call stack in the Extended Detail View, one can focus on a single invocation and, hopefully, isolate the code responsible for the memory allocation. A double-click will jump to the source code, if available.</p>
<p>For example, +[Manager dateFromString] is the method responsible for invoking the suspicious NSDateFormatter -dateFromString selector.</p>
<p><a href="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss10.png"><img class="alignnone size-full wp-image-320" style="border: 0pt none;" title="Call Stack" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/ss10.png" alt="" width="671" height="454" /></a></p>
<div style="clear: both;"><!-- reset --></div>
<p>Two facts will attract our attention:</p>
<ol>
<li>There are pages upon pages of NSDateFormatter invocations, all grouped together when sorted by Responsible Caller.</li>
<li>When sorted by Creation Time, about 8000 invocations to NSDateFormatter take place within the same 100 ms.</li>
</ol>
<p>When looked at closely, this study lead to a decision to not use NSDateFormatter time zones, which turned out to be the culprit.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<h2>11. Related links</h2>
<ul>
<li><a href="http://thegothicparty.com/dev/iphone/nsdateformatter-memory-leak/">NSFormatter memory leak</a></li>
<li><a href="http://en.wikipedia.org/wiki/Memory_leak">Wikipedia article about memory leak</a></li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" /><br />
</em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fmacos%2Ffinding-hidden-memory-leak-with-instruments&amp;title=Finding+hidden+memory+leak+with+Instruments', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://static.delicious.com/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fmacos%2Ffinding-hidden-memory-leak-with-instruments&amp;title=Finding+hidden+memory+leak+with+Instruments"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/finding-hidden-memory-leak-with-instruments/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NSDateFormatter memory leak</title>
		<link>http://thegothicparty.com/dev/article/nsdateformatter-memory-leak/</link>
		<comments>http://thegothicparty.com/dev/article/nsdateformatter-memory-leak/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 20:15:08 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[OS Development]]></category>
		<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=231</guid>
		<description><![CDATA[This is a follow-up to a post on stackoverflow.com, where it appears that 1 MB is lost after invoking NSFormatter -dateFromString.
I ran into the same situation, with very similar leak sizes to the ones reported on that article. Instruments shows that 868 Kb (889520 bytes to be exact) are allocated by Cocoa on iPhone OS [...]]]></description>
			<content:encoded><![CDATA[<p>This is a follow-up to a post on <a title="Instruments (Leaks) and NSDateFormatter" href="http://stackoverflow.com/questions/1117263/instruments-leaks-and-nsdateformatter">stackoverflow.com</a>, where it appears that 1 MB is lost after invoking NSFormatter -dateFromString.</p>
<p>I ran into the same situation, with very similar leak sizes to the ones reported on that article. Instruments shows that 868 Kb (889520 bytes to be exact) are allocated by Cocoa on iPhone OS (verified from 2.x to 3.x up to 3.1.3).<br />
<span id="more-231"></span></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>1. Z Offending Code<br />
</h2>
<p>The objective of this method is to convert  a string into a date.<br />
Note that I do invoke -release on the NSDateFormatter object, and that the newly created NSDate is destroyed when the NSAutoreleasePool is drained. This is not where the problem lies.</p>
<p><span style="color: #808080;"><code>NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];<br />
[dateFormatter setTimeZone:[ NSTimeZone timeZoneWithName:@"GMT"]];<br />
[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss <span style="color: #ff0000;">z</span>"];<br />
[dateFormatter setLenient:YES];<br />
{<br />
&nbsp;&nbsp;&nbsp;&nbsp;NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];<br />
&nbsp;&nbsp;&nbsp;&nbsp;NSDate *testDate = [dateFormatter dateFromString:string];<span style="color: #339966;"> // &lt;- Allocates 868 Kb</span><br />
&nbsp;&nbsp;&nbsp;&nbsp;// Do something with testDate<br />
&nbsp;&nbsp;&nbsp;&nbsp;[pool drain];<br />
}<br />
[dateFormatter release];<br />
</code></span></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>2. Discussion<br />
</h2>
<p>It appears that this is caused by the <span style="color: #ff0000;">z</span> option in setDateFormat.<br />
My guess is that Cocoa allocates exactly 8618 time-zone related objects that live in memory for the duration of the application.<br />
I do not know of any workaround, other than not using the &#8220;z&#8221; option.<br />
<code>[ dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss"];</code></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>3. Instruments log<br />
</h2>
<p>Here is the allocation log for the first 3 of the 8618 objects, allocated all at once by a single invocation to dateFromString. Without going into too much details, suffice it to say that I used &#8220;Created &#038; Still Living&#8221; option in &#8220;Allocation Lifespan&#8221;, and that the &#8220;Extended Detail&#8221; view in Instruments shows that all those objects are created back to back as the result of the CoreFoundation CFDateFormatterGetAbsoluteTimeFromString method.</p>
<pre><span style="color: #888888;">
<table border="0">
<tbody>
<tr>
<td><strong>#</strong></td>
<td><strong>Address</strong></td>
<td><strong>Category</strong></td>
<td><strong>Time</strong></td>
<td><strong>Size</strong></td>
<td><strong>Library</strong></td>
<td><strong>Caller</strong></td>
</tr>
<tr>
<td>2280</td>
<td>0xa20be00</td>
<td>GeneralBlock-32</td>
<td>01:07.742</td>
<td>32</td>
<td>Foundation</td>
<td>-[NSDateFormatter getObjectValue:forString:range:error:]</td>
</tr>
<tr>
<td>2281</td>
<td>0xa219670</td>
<td>GeneralBlock-176</td>
<td>01:07.833</td>
<td>176</td>
<td>Foundation</td>
<td>-[NSDateFormatter getObjectValue:forString:range:error:]</td>
</tr>
<tr>
<td>2282</td>
<td>0xa298db0</td>
<td>GeneralBlock-48</td>
<td>01:07.833</td>
<td>48</td>
<td>Foundation</td>
<td>-[NSDateFormatter getObjectValue:forString:range:error:]</td>
</tr>
</tbody>
</table>

</span></pre>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>4. All 8618 Objects<br />
</h2>
<h3>The <a title="Instruments Log" href="http://thegothicparty.com/dev/wp-content/extras/instruments-log.html" target="_blank">entire log</a> (8618 entries) can be viewed <a title="Instruments Log" href="http://thegothicparty.com/dev/wp-content/extras/instruments-log.html" target="_blank">here</a>.</h3>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>5. Conclusion</h2>
<p>The StackOverflow.com positively isolates the problem and the workaround. Do not use setDateFormat:@&#8221;EEE, d MMM yyyy HH:mm:ss <span style="color: #ff0000;">z</span>&#8220;, unless you are willing to loose 868 Kb for the rest of the lifetime of the application. The alternative is to not use the time zone which is, I agree, a pain: setDateFormat:@&#8221;EEE, d MMM yyyy HH:mm:ss&#8221;.</p>
<p>A possible approach is to test the string against &#8221; GMT&#8221;, and to only invoke &#8220;z&#8221; when not in GMT:<br />
<span style="color: #808080;"><code><br />
NSDateFormatter *dateFormatter = [[NSDateFormatter alloc] init];<br />
[dateFormatter setTimeZone:[NSTimeZone timeZoneWithName:@"GMT"]];<br />
if( ![string hasSuffix:@" GMT"]) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;// If the string is not GMT, we must use time zone <img src='http://thegothicparty.com/dev/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /><br />
&nbsp;&nbsp;&nbsp;&nbsp;[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss z"];<br />
} else {<br />
&nbsp;&nbsp;&nbsp;&nbsp;[dateFormatter setDateFormat:@"EEE, d MMM yyyy HH:mm:ss"];<br />
}<br />
</code></span></p>
<p>As of today&#8217;s date iPhone GB cost, your user either $0.005 or $0.01, depending on which device she or he bought.</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>6. External Links</h2>
<ul>
<li>stackoverflow.com<br />
<a href="http://stackoverflow.com/questions/1117263/instruments-leaks-and-nsdateformatter">http://stackoverflow.com/questions/1117263/instruments-leaks-and-nsdateformatter</a>
</li>
<li>
Developer.apple.com<br />
Your tracking number for this issue is Bug ID# <a href="https://bugreport.apple.com/cgi-bin/WebObjects/RadarWeb.woa/92/wo/3EQvovmScvH9F84H22jHSw/11.56">7745113</a></li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<div style="clear: both;"><!-- reset --></div>
<p><em> </em></p>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fiphone%2Fnsdateformatter-memory-leak&amp;title=NSDateFormatter+memory+leak', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://static.delicious.com/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fiphone%2Fnsdateformatter-memory-leak&amp;title=NSDateFormatter+memory+leak"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/nsdateformatter-memory-leak/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Drowning in NSAutoreleasePool</title>
		<link>http://thegothicparty.com/dev/article/nsautoreleasepool/</link>
		<comments>http://thegothicparty.com/dev/article/nsautoreleasepool/#comments</comments>
		<pubDate>Sun, 15 Nov 2009 19:37:14 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[OS Development]]></category>
		<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=189</guid>
		<description><![CDATA[When developing in Cocoa for Mac OS X or for iPhone, it is easy to overlook objects that are dropped in the current NSAutoreleasePool, ultimately leading to a crash. The following article applies to the use of NSAutoreleasePool when garbage collection is not enabled.

Summary

Preventing over-release
[ -retain &#38; -release] vs. [ -autorelease]
Circumventing -autorelease
NSAutoreleasePool is a stack [...]]]></description>
			<content:encoded><![CDATA[<p>When developing in Cocoa for Mac OS X or for iPhone, it is easy to overlook objects that are dropped in the current NSAutoreleasePool, ultimately leading to a crash. The following article applies to the use of NSAutoreleasePool when garbage collection is not enabled.</p>
<p><span id="more-189"></span></p>
<p>Summary</p>
<ol>
<li>Preventing over-release</li>
<li>[ -retain &amp; -release] vs. [ -autorelease]</li>
<li>Circumventing -autorelease</li>
<li>NSAutoreleasePool is a stack object</li>
<li>NSAutoreleasePool pseudo-code</li>
<li>[pool release] vs. [pool drain]</li>
<li>External links</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>1. Preventing over-release</h2>
<p>There seem to be some unpredictable stability behavior with objects that are released more than once (objects for which the -retainCount drops below 1). At times, some objects sent too many [ release ] will fail silently, whereas occasionally the host application will crash.</p>
<p>An application must balance the number of -retain and -release sent to a NSObject.</p>
<pre><code>SomeObject * myObj = [[SomeObject <span style="color: #333399;">alloc</span>] <span style="color: #333399;">init</span>];
...
[myObj <span style="color: #333399;">release</span>];</code></pre>
<p>To a certain extent, it would be better if over-release would never crash (akin to [ nil release ]) or always crash, thus not hiding bugs during the development stage. The combination of NSZombie and malloc_history is a wonderful tool to debug over-releasing. Read &#8220;Debugging Autorelease&#8221; on CocoaDev:<br />
<a title="DebuggingAutorelease" href="http://www.cocoadev.com/index.pl?DebuggingAutorelease">http://www.cocoadev.com/index.pl?DebuggingAutorelease</a><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>2. [ -retain &amp; -release] vs. [ -autorelease]</h2>
<p>Sending -autorelease to an object allows to literally forget about it. [ someObject -autorelease] ensures that someObject with a -retainCount of 1 will remain retained for the life of the NSAutoreleasePool it belongs to, and will receive a -release message when such pool receives -drain or -release. Generally, the question is &#8220;Which NSAutoreleasePool ?&#8221;. While the answer is &#8220;The most nested one, Sir.&#8221;, not knowing may lead to surprising behaviors. A defensive approach may be to only create only one NSAutoreleasePool for the entire duration of the application, but this is certainly a costly and rarely practical answer.</p>
<p>-autorelease, contrarily to -release, can be invoked more than once without ill effects.</p>
<p>For some reason, once an object received the -autorelease message, the operation cannot be undone. There is no -unautorelease message. Nor is there a way to tell the NSAutoreleasePool to just forget about that object.</p>
<p>This can lead to the following situations:</p>
<ol>
<li>Preventing to save/release memory occupied by a given object</li>
<li>Preventing to delete that object at all before deleting the NSAutoreleasePool (sending one-too-many -release will cause the NSAutoreleasePool to send a -release to an already deallocated object, and crash)</li>
<li>Preventing the deletion of a given NSAutoreleasePool, since one cannot know what&#8217;s in it.</li>
</ol>
<p>Following design patterns while being aware of these limitations is generally not a problem. A suggested approach is to use small scopes with local NSAutoreleasePool any time granularity can be achieved. In Cocoa, Threads do just that.</p>
<pre><code>{
<span style="color: #800080;">    NSAutoreleasePool</span> * pool = [[<span style="color: #800080;">NSAutoreleasePool</span> <span style="color: #333399;">alloc</span>] <span style="color: #333399;">init</span>];
    SomeObject * myObj = [[SomeObject <span style="color: #333399;">alloc</span>] <span style="color: #333399;">init</span>];
    [myObj <span style="color: #333399;">autorelease</span>]; <span style="color: #008000;">// No need to remember about that object</span>
    ...
    [pool <span style="color: #333399;">drain</span>];
}</code></pre>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>3. Circumventing -autorelease</h2>
<p>Unfortunately, some Cocoa routines will, without a choice, drop objects it creates in the current NSAutoreleasePool.<br />
Example:</p>
<pre><code><span style="color: #800080;">UIImage</span> * newImage = [<span style="color: #800080;">UIImage</span> <span style="color: #333399;">imageWithCGImage</span>:some_CGImageRef];</code></pre>
<p>As a result, the caller has little or no control of when the new object will be destroyed. It will likely be deallocated when the NSAutoreleasePool to which it belongs is deallocated, which is generally not predictable.</p>
<p>The NSAutoreleasePool seems to be nothing more than a linked list which sends a -release message to all objects it contains (regardless of their state) upon drain. In a managed memory environment, the pseudo-code of NSAutoreleasePool -drain could be simplified like this:</p>
<pre><code>-(<span style="color: #800080;">void</span>) drain {
    [autoreleasePool <span style="color: #333399;">release</span>];
}
</code></pre>
<p>Objects that for which the -retainCount is greater than 1 after the -drain will thus not be released. One can take an object out of a pool by retaining it, then releasing the pool entirely. Such object will be effectively removed from the NSAutoreleasePool.<br />
Example:</p>
<pre><code><span style="color: #800080;">UIImage</span> * newImage = <span style="color: #800080;">nil</span>;
{
<span style="color: #800080;">    NSAutoreleasePool</span> * pool = [[<span style="color: #800080;">NSAutoreleasePool</span> <span style="color: #333399;">alloc</span>] <span style="color: #333399;">init</span>];
    newImage = [[<span style="color: #800080;">UIImage</span> <span style="color: #333399;">imageWithCGImage</span>:some_CGImageRef] <span style="color: #333399;">retain</span>];
    [pool <span style="color: #333399;">drain</span>];
}
<span style="color: #008000;">// The  newImage* is now outside of the pool, and retained normally</span></code></pre>
<p>An example of this technique can be found on Björn Sållarp&#8217;s article &#8220;UIImage with round corners&#8221;:<br />
<a title="UIImage with round corners" href="http://blog.sallarp.com/iphone-uiimage-round-corners">http://blog.sallarp.com/iphone-uiimage-round-corners</a></p>
<p>Note that in the example above, a special scope has been declared around the NSAutoreleasePool creation and destruction. This is good practice since the pool is actually a stack object, and must be created and released in the same { }. Please read on.</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>4. NSAutoreleasePool is a stack object</h2>
<p>By nature, an NSAutoreleasePool instance is stored on the stack (as opposed to the heap). As a direct consequence, the scope of these pools, and ultimately of the objects they reference, are tightly coupled with the methods that created them. Even though the pools (just like the invocation of methods) are nested, there is no virtual stack of NSAutorelease pools.</p>
<p>As the method that created a given pool goes out of scope, so does that very pool, and all the objects referenced by it will receive a single -release message. For an object to survive a pool drain, it must be explicitly retained. See paragraph 3, Circumventing -Autorelease.</p>
<p>Being a stack object also makes it <span style="text-decoration: underline;">illegal</span> to create an NSAutoreleasePool instance in a method, and to release it in another. This reason alone can serve as a good motivation for creating small, local and  nested NSAutoreleasePool rather than one gigantic one for the life of the Thread.</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>5. NSAutoreleasePool pseudo-code</h2>
<p>In a managed memory environment, the NSAutoreleasePool acts pretty much like a NSArray. The pool maintains strong references to its content. Objects added to the pool receive a -retain message.</p>
<h3>Possible pseudo-code for NSAutoreleasePool</h3>
<pre><code>
<span style="color: #008000;"> // .h</span>
<span style="color: #800080;">@interface</span> NSAutoreleasePool2 : NSObject {
<span style="color: #800080;">@private</span>
<span style="color: #800080;">    NSMutableArray</span> * autoreleasePool;
}
-(<span style="color: #800080;">void</span>) drain;
-(<span style="color: #800080;">void</span>) addObject:(<span style="color: #800080;">id</span>)anObject;
-(<span style="color: #800080;">id</span>) autoreleaseObject:(<span style="color: #800080;">id</span>)anObject;
<span style="color: #800080;">@end</span>

<span style="color: #008000;">// .m</span>
<span style="color: #800080;">@implementation</span> NSAutoreleasePool2
-(<span style="color: #800080;">id</span>)init {
<span style="color: #800080;">    if</span> ((<span style="color: #800080;">self</span> = [<span style="color: #800080;">super</span> <span style="color: #333399;">init</span>] ) != <span style="color: #800080;">nil</span> ) {
        autoreleasePool = [[<span style="color: #800080;">NSMutableArray</span> <span style="color: #333399;">alloc</span>] <span style="color: #333399;">init</span>];
    }
<span style="color: #800080;">    return</span> <span style="color: #800080;">self</span>;
}
-(<span style="color: #800080;">void</span>) dealloc {
    [<span style="color: #800080;">self</span> <span style="color: #333399;">drain</span>];
    [<span style="color: #800080;">super</span> <span style="color: #333399;">dealloc</span>];
}
-(<span style="color: #800080;">void</span>) drain {
    [autoreleasePool <span style="color: #333399;">release</span>];
}
-(<span style="color: #800080;">void</span>) addObject:(<span style="color: #800080;">id</span>)anObject {
    [autoreleasePool <span style="color: #333399;">addObjec</span>t:anObject];
}
-(<span style="color: #800080;">id</span>) autoreleaseObject:(<span style="color: #800080;">id</span>)anObject {
<span style="color: #800080;">    if</span>( ! [autoreleasePool <span style="color: #333399;">containsObject</span>:anObject]) {
        [<span style="color: #800080;">self</span> <span style="color: #333399;">addObject</span>:anObject];
    }
<span style="color: #800080;">    return</span> anObject;
}
<span style="color: #800080;">@end</span>
</code></pre>
<h3>Discussion</h3>
<p>This is pseudo-code, not actual NSAutoreleasePool source code.<br />
Objects <span style="text-decoration: underline;">must</span> be added explicitly to this pool (using [pool <span style="color: #000000;">autoreleaseObject</span>:someObject ]; instead of [someObject autorelease];)<br />
-autoreleaseObject is lenient, and will not penalize objects added more than once.<br />
-addObject is strict ; objects added more than once will receive -release more than once.<br />
-drain and -release do not have the same behavior. This pseudo-code expects an invocation to [pool release ] rather than [pool drain ] to free the NSAutoReleasePool2.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>6. [pool release] vs. [pool drain]</h2>
<p>In a reference-counted environment sending -release or -drain to a NSAutoreleasePool has the same effect.</p>
<p>In a garbage-collection environment, without NSAutoreleasePool, -release has no effect while -drain triggers garbage collection. For this reason, the developer documentation explicitly recommends using  -drain, since it has a meaning in both management models, even on iPhone.</p>
<p>Read more about NSAutoreleasePool -drain on Apple&#8217;s developer site:<br />
<a title="NSAutoreleasePool Class Reference" href="http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html">http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html</a><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<h2>7. External links</h2>
<ul>
<li><a title="DebuggingAutorelease" href="http://www.cocoadev.com/index.pl?DebuggingAutorelease">http://www.cocoadev.com/index.pl?DebuggingAutorelease</a></li>
<li><a title="UIImage with round corners" href="http://blog.sallarp.com/iphone-uiimage-round-corners/">http://blog.sallarp.com/iphone-uiimage-round-corners/</a></li>
<li><a title="NSAutoreleasePool Class Reference" href="http://developer.apple.com/mac/library/documentation/cocoa/reference/Foundation/Classes/NSAutoreleasePool_Class/Reference/Reference.html">http://developer.apple.com/&#8230;/NSAutoreleasePool_Class/&#8230;</a></li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" /><br />
</em></p>
<p><em> </em></p>
<div style="clear: both;"><!-- reset --></div>
<p><script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fmacos%2Fnsautoreleasepool&amp;title=Drowning+in+NSAutoreleasePool', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://static.delicious.com/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fmacos%2Fnsautoreleasepool&amp;title=Drowning+in+NSAutoreleasePool"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/nsautoreleasepool/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>AndroidTether</title>
		<link>http://thegothicparty.com/dev/android/androidtether/</link>
		<comments>http://thegothicparty.com/dev/android/androidtether/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 02:56:52 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Google Android]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=48</guid>
		<description><![CDATA[AndroidTether is a software that brings the Internet connection of an Android device to a Mac OS X computer.
An Android (such as the Google G1 phone) can be tethered to a computer running Mac OS X, allowing the computer to browse the web. The device is connected to the computer using a USB cable. The [...]]]></description>
			<content:encoded><![CDATA[<h3><em>AndroidTether is a software that brings the Internet connection of an Android device to a Mac OS X computer.</em></h3>
<p><img class="alignnone size-full wp-image-166" title="AndroidTether icon" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/at_icon128.png" alt="at_icon128" width="128" height="128" />An Android (such as the Google G1 phone) can be tethered to a computer running Mac OS X, allowing the computer to browse the web. The device is connected to the computer using a USB cable. The web is browsed with Firefox. The detailed communication procedure is documented <a title="Dev Android Proxy article" href="http://thegothicparty.com/dev/android/androidproxy/">here</a>.</p>
<p>This article is only intended to give a brief overview of AndroidTether and provide a link to the download page.</p>
<ol>
<li>overview</li>
<li>copyright and guaranties</li>
<li>download AndroidTether</li>
<li>launch AndroidTether</li>
<li>advanced preferences</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em><br />
<h2>1. Overview</h2>
<h3>1.1 What is Tetherbot?</h3>
<p>Tetherbot enables an Android device (such a Google G1 cellular phone) to be used as a network interface to provide a MacIntosh OS X laptop with an Internet data connection. It provides mobile, wide-area Internet access for the computer via the cellular-phone network &#8212; for instance where unrestricted WiFi is not available. This process is generally referred to as &#8220;tethering.&#8221;  In addition to expanding the range of Internet access for the OS X computer, Tetherbot enables the features of the OS X device to overcome the limitations of the Android device, so that one can use a more fully featured keyboard and Flash-enabled web browser (Firefox), to access webbase e-mail and browse the web efficiently. Tetherbot runs on the Android device, and requires a mirror application to run on the computer.</p>
<h3>1.2 What is AndroidTether?</h3>
<p>AndroidTether is designed to automate the process of tethering and eliminate the need to reconfigure your computer system every time you wish to tether. You should refer to the terms of service of your cellular service provider before tethering. AndroidTether runs on the computer, and connects to Tetherbot.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>2. Copyright, guaranties, cost.</h2>
<h3>Copyright</h3>
<p style="padding-left: 30px;">Written by (c) Xavier Schott 2009.</p>
<h3>Guaranties</h3>
<p style="padding-left: 30px;">none.<br />
<span style="color: #888888;">The software is provided  &#8220;AS IS&#8221;; &#8220;thegothicparty.com/dev&#8221; and &#8220;the author&#8221; make NO GUARANTIES and NO WARRANTIES OF ANY TYPE, expressed or implied, including NO WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE.</span><br />
Again, none.</p>
<h3>Cost</h3>
<p style="padding-left: 30px;">free</p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>3. Download AndroidTether</h2>
<p><a href="http://thegothicparty.com/download/androidtether/bin/AndroidTether.dmg" class="broken_link"><img class="alignnone size-full wp-image-163" style="border: 0pt none;" title="download AndroidTether" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/at_icon64.png" alt="at_icon64" width="64" height="64" /><br />
</a></p>
<p>Start here:</p>
<p><a title="download AndroidTether" href="http://thegothicparty.com/download/androidtether/bin/AndroidTether.dmg" class="broken_link">Download AndroidTether 0.91</a> for Mac OS X.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>4. Launch AndroidTether <span style="text-decoration: underline;">and</span> Tetherbot</h2>
<p>Tethering is automatically started upon launch, and stopped when quit.<br />
You can also stop and restart the connection using the Stop/Start button.<br />
Thus, when you are done, simply quit AndroidTether. Refer to the complete procedure, device installation requirements, and how to use Tetherbot  <a title="Dev Android Proxy article" href="http://thegothicparty.com/dev/android/androidproxy/">here</a>.</p>
<p style="padding-left: 150px;"><img class="alignnone size-full wp-image-127" style="border: 0pt none;" title="AndroidTether running" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/at_tethered1080_413x133.png" alt="at_tethered1080_413x133" width="413" height="133" /></p>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em><br />
<h2>5. Advanced Preferences</h2>
<p>It is possible to change AndroidTether ports to accommodate to changes in Firefox or Tetherbot.<br />
The local port (left number) refers to the SOCKS Host: localhost Port: 1080 setup in Firefox</p>
<p style="padding-left: 30px;"><img class="alignnone size-full wp-image-135" title="Firefox Proxy Advanced Preferences local port" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/at_localport508x114.png" alt="at_localport508x114" width="508" height="114" /></p>
<p>The remote port (right number) refers to Socks Proxy Server on: 1080 setup in Tetherbot</p>
<p style="padding-left: 210px;"><img class="alignnone size-full wp-image-136" title="Tetherbot remote port" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/at_remoteport320x138.png" alt="at_remoteport320x138" width="320" height="138" /></p>
<p>Note:<br />
<em>AndroidTether will conflict with adb. You cannot use adb and AndroidTether simultaneously.</em><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em><br />
<h2>6. External links</h2>
<ul>
<li><a href="http://thegothicparty.com/dev/android/androidproxy/">Android proxy</a></li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" />
<div style="clear: both;"><!-- reset --></div>
<p></em><br />
<script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fandroid%2Fandroidtether&amp;title=AndroidTether', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://static.delicious.com/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fandroid%2Fandroidtether&amp;title=AndroidTether"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/android/androidtether/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Android Proxy (Tethering Android on Mac OS X)</title>
		<link>http://thegothicparty.com/dev/android/androidproxy/</link>
		<comments>http://thegothicparty.com/dev/android/androidproxy/#comments</comments>
		<pubDate>Mon, 26 Jan 2009 02:55:18 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Google Android]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=51</guid>
		<description><![CDATA[Notes on connecting an Android (such as Google G1 phone) via a USB cable to a computer running Mac OS X, in order to browse the web.
This mechanism requires two independent pieces of software, namely Tetherbot on the Android device, and AndroidTether (or alternatively Terminal and the Android SDK) on the Macintosh.
The objective of this article is [...]]]></description>
			<content:encoded><![CDATA[<h3><em>Notes on connecting an Android (such as Google G1 phone) via a USB cable to a computer running Mac OS X, in order to browse the web.</em></h3>
<p>This mechanism requires two independent pieces of software, namely <a title="Tetherbot Android Proxy" href="http://graha.ms/androidproxy">Tetherbot</a> on the Android device, and <a title="AndroidTether for MacOS X" href="http://thegothicparty.com/dev/android/androidtether/">AndroidTether</a> (or alternatively Terminal and the Android SDK) on the Macintosh.</p>
<p><img class="alignleft size-full wp-image-36" title="tetherbot_icon1" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/tetherbot_icon1.png" alt="tetherbot_icon1" width="59" height="61" />The objective of this article is to clarify the installation and setup process for Mac OS X. It does not apply to other operating systems.<br />
A general understanding the <a title="Tetherbot Android Proxy" href="http://graha.ms/androidproxy/">Tetherbot documentation</a> may be helpful.<br />
The screen shots relate to <em>Tetherbot.apk 39.57KB&#8221;</em> (in lieu of a better version) and <em>Firefox 2.0.0.16</em> on Mac OS X 10.5.5.</p>
<p>This article is divided in 2 sections:</p>
<ol>
<li><strong>Things to do every time</strong>
<ul>
<li>Launch Tetherbot on the device</li>
<li>Launch AndroidTether on the computer<br />
(alternatively, launch Terminal on the computer)</li>
<li>Change some Firefox preferences</li>
</ul>
</li>
<li><strong>Installation to be done just once </strong>
<ul>
<li>Installation of Tetherbot on the device</li>
<li>Installation of AndroidTether on the computer<br />
(alternatively, install the Android SDK)</li>
<li>One-time Setup of the device</li>
<li>One-time Firefox setup</li>
</ul>
</li>
</ol>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>1. Things to do every time</h2>
<h3>1.1. Launch Tetherbot on the device</h3>
<p>Connect the computer to the device using a USB cable.<br />
Launch Tetherbot and tap “Start Socks”.<br />
If everything goes well, the proxy server will start on port 1080.</p>
<p style="padding-left: 360px;"><a href="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_start_socks320x480.png"><span style="text-decoration: underline;"><img class="size-full wp-image-79 alignnone" style="border: 0pt none;" title="Start Socks" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_start_socks192x288.png" alt="ap_start_socks192x288" width="192" height="288" /></span></a></p>
<h3>1.2. Launch AndroidTether on the computer</h3>
<p>Starting AndroidTether will automatically setup the connection.</p>
<p style="padding-left: 120px;"><img class="alignnone size-full wp-image-127" title="AndroidTether" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/at_tethered1080_413x133.png" alt="at_tethered1080_413x133" width="413" height="133" /></p>
<h3>1.3. (alternatively, launch Terminal on the computer)</h3>
<p>On the Macintosh, launch a Terminal window. Assuming here that you have installed the <a title="public link to the Android SDK" href="http://code.google.com/android/intro/tools.html">Android Software Development Kit</a>. See step 2.3 for details.<br />
In Terminal, type exactly &#8220;<code>adb forward tcp:1080 tcp:1080</code>&#8220;.<br />
Note that the syntax is &#8220;<code>adb forward tcp:{local port} tcp:{remote port}</code>&#8220;.<br />
The <code>{local port}</code> is the SOCKS host mentioned in section 1.4<br />
The <code>{remote port}</code> must match <em>Socks Proxy Server on: 1080</em> mentioned in section 1.1</p>
<p><em><img class="alignnone size-full wp-image-18" title="adb" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/adb_forward.png" alt="adb" width="589" height="173" /><br />
</em></p>
<h3>1.4. Change some Firefox* preferences</h3>
<p>On the computer, launch Firefox.<br />
Go to “Firefox&gt;Preferences…&gt;Advanced&gt;Network&gt;Settings…”.</p>
<ul>
<li>“Manual proxy configuration:”</li>
<li>“SOCKS Host:” to <em>“localhost”</em>, “Port:” 1080</li>
<li>“SOCKS v5″</li>
</ul>
<p>Note that “Port: 1080″ represents this time the <code>{local port}</code> parameter in “<code>adb forward tcp:{local port} tcp:{remote port}</code>”.</p>
<p style="padding-left: 90px;"><a href="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_ff_adv_ntwrk_set681x551.png"><img class="alignnone size-full wp-image-104" style="border: 0pt none;" title="Firefox Proxy" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_ff_adv_ntwrk_set409x331.png" alt="ap_ff_adv_ntwrk_set409x331" width="409" height="331" /></a></p>
<p>Firefox is now ready to browse the Internet.<br />
Restore the original setting after you are done tethering the device or you won&#8217;t be able to browse the web with Firefox. For added security, restore item 2.5 as well.</p>
<p>(*) Safari does not provide preferences to manually change the proxy, which is a <em>sine qua non</em> condition for the entire mechanism to function. System Preferences must be changed instead, with various levels of success.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>2. Installation to be done just once</h2>
<h3>2.1. Installation of Tetherbot on the device</h3>
<p>2.1.1. Prior downloading Tetherbot on the G1, you must change the “Home&gt;MENU&gt;Applications&gt;Unknown sources” setting and “Allow install of non-Market application”.<br />
Warning, this is a dangerous and potentially unsafe action. Review the warning carefully.</p>
<p style="padding-left: 360px;"><a href="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_app_settings320x480.png"><img class="alignnone size-full wp-image-110" style="border: 0pt none;" title="Application settings" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_app_settings192x288.png" alt="Application Settings" width="192" height="288" /></a></p>
<p>2.1.2 Using the G1 Brower, go to <a href="http://graha.ms/androidproxy/Tetherbot.apk">http://graha.ms/androidproxy/Tetherbot.apk</a> to download Tetherbot.</p>
<p style="padding-left: 270px;"><a href="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_url480x320.png"><img class="alignnone size-full wp-image-116" style="border: 0pt none;" title="Navigate to URL and click 'here'" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_url288x192.png" alt="ap_url288x192" width="288" height="192" /></a></p>
<p>2.1.3. After download completes on the device, simply select the “.apk” Android Package to install.</p>
<p style="padding-left: 360px;"><a href="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_tetherbot_apk320x480.png"><img class="alignnone size-full wp-image-119" style="border: 0pt none;" title="Tetherbot.apk" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_tetherbot_apk192x68.png" alt="ap_tetherbot_apk192x68" width="192" height="68" /></a></p>
<h3>2.2. Installation of AndroidTether on the computer</h3>
<p><a href="http://thegothicparty.com/dev/android/androidtether/"><img class="alignnone size-full wp-image-163" style="border: 0pt none;" title="Go to AndroidTether home page" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/at_icon64.png" alt="at_icon64" width="64" height="64" /></a>AndroidTether is a Macintosh OS X application that will setup the computer side of the communication automatically.<br />
It runs in just one click, and does not require the download of the entire Android SDK.<br />
AndroidTether is lightweight, flexible, free, and can be downloaded <a title="AndroidTether for MacOS X" href="http://thegothicparty.com/dev/android/androidtether/">here</a>.</p>
<h3>2.3. (alternatively, install the Android SDK)</h3>
<p>Install the <a title="public link to the Android SDK" href="http://code.google.com/android/intro/tools.html">Android Software Development Kit</a>.<br />
Once installed, follow the instructions on adding <code>android-sdk-mac_.../tools</code> to your <code>PATH</code>.<br />
The alternative is to execute <code>adb</code> from the <code>tools</code> directory:<br />
( <code>cd .../android-sdk-mac_.../tools ; ./adb forward ...</code>)</p>
<h3>2.4. One-time setup of the device</h3>
<p>To use Tetherbot, you will need to perform these operations:</p>
<p>On the device, turn on “USB debugging”<br />
“Home&gt;MENU&gt;Settings&gt;Applications&gt;Development&gt;USB debugging”<br />
Additionally, you may want to turn on “Stay awake” as well.</p>
<p style="padding-left: 360px;"><a href="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_usb_debug320x480.png"><img class="alignnone size-full wp-image-121" style="border: 0pt none;" title="USB debugging" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_usb_debug192x112.png" alt="ap_usb_debug192x112" width="192" height="112" /></a></p>
<h3>2.5. One-time Firefox setup</h3>
<p>This change allows Firefox to fetch DNS information from the proxy. You must allow it to tether the device.<br />
For <span style="text-decoration: underline;">maximum security</span>, restore it to <code>false</code> after each use.</p>
<ol>
<li>In Firefox, File&gt;Open Location&#8230; <a title="modify Firefox configuration " href="about:config">about:config</a>.</li>
<li>Add the <em>Filter:</em> “dns” for clarity</li>
<li>select the Preference <em>network.proxy.socks_remote_dns</em> and set it to <code>true<br />
</code>(hit &lt;enter&gt; or right-click).</li>
</ol>
<p style="padding-left: 30px;"><a href="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_ff_about_config871x467.png"><img class="alignnone size-full wp-image-123" style="border: 0pt none;" title="about:config" src="http://thegothicparty.com/dev/wp-content/uploads/2009/01/ap_ff_about_config523x280.png" alt="ap_ff_about_config523x280" width="523" height="280" /></a></p>
<p>These changes have been tested on <em>Firefox 2.0.0.16</em> and <em>Firefox 3.0.5</em>.<br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
<h2>3. External links</h2>
<ul>
<li><a title="Tetherbot Android Proxy" href="http://graha.ms/androidproxy">Tetherbot</a></li>
<li><a title="AndroidTether for MacOS X" href="http://thegothicparty.com/dev/android/androidtether/">AndroidTether</a></li>
<li><a title="public link to the Android SDK" href="http://code.google.com/android/intro/tools.html">Android Software Development Kit</a></li>
<li><a href="http://graha.ms/androidproxy/Tetherbot.apk">Tetherbot.apk</a></li>
</ul>
<p><em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="3" />
<div style="clear: both;"><!-- reset --></div>
<p></em><br />
<script src="http://widgets.digg.com/buttons.js" type="text/javascript"></script></p>
<p><a onclick="window.open('http://delicious.com/save?v=5&amp;noui&amp;jump=close&amp;url=thegothicparty.com%2Fdev%2Fandroid%2Fandroidproxy&amp;title=Android+Proxy+(Tethering+Android+on+Mac+OS+X)', 'delicious', 'toolbar=no,width=550,height=550'); return false;" href="http://delicious.com/save"><img style="border: 0pt none;" src="http://static.delicious.com/img/delicious.small.gif" alt="Delicious" width="16" height="16" />Bookmark this on Delicious</a></p>
<p><a class="DiggThisButton DiggCompact" rev="news, programming" href="http://digg.com/submit?url=http%3A%2F%2Fthegothicparty.com%2Fdev%2Fandroid%2Fandroidproxy&amp;title=Android+Proxy+(Tethering+Android+on+Mac+OS+X)"></a></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/android/androidproxy/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>NSLog(@&#8221;Hello world!&#8221;);</title>
		<link>http://thegothicparty.com/dev/article/hello-world/</link>
		<comments>http://thegothicparty.com/dev/article/hello-world/#comments</comments>
		<pubDate>Fri, 02 Jan 2009 04:26:52 +0000</pubDate>
		<dc:creator>dev</dc:creator>
				<category><![CDATA[Tech Articles]]></category>

		<guid isPermaLink="false">http://thegothicparty.com/dev/?p=1</guid>
		<description><![CDATA[Welcome to TheGothicParty.com/dev.
Mission Statement:
Post software development insights as I come across them.




]]></description>
			<content:encoded><![CDATA[<p>Welcome to <code>TheGothicParty.com/dev</code>.</p>
<p><strong>Mission Statement</strong>:<br />
Post software development insights as I come across them.<br />
<a href="http://www.paperblog.fr/" rel="paperblog goth" title="Paperblog : Les meilleurs articles issus des blogs" ><img src="http://media.paperblog.fr/assets/images/logos/minilogo.png" border="0" alt="Paperblog" /></a><br />
<em><img class="size-full wp-image-335 alignleft" style="border: 0pt none;" title="orangewhite" src="http://thegothicparty.com/dev/wp-content/uploads/2010/03/orangewhite.png" alt="" width="500" height="1" />
<div style="clear: both;"><!-- reset --></div>
<p></em></p>
]]></content:encoded>
			<wfw:commentRss>http://thegothicparty.com/dev/article/hello-world/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
