<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Lost lines of code</title>
	<atom:link href="http://reecon.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://reecon.wordpress.com</link>
	<description>Rafał Sroka - code snippets and ideas</description>
	<lastBuildDate>Fri, 20 Jan 2012 09:10:40 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='reecon.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://1.gravatar.com/blavatar/34d1d15c2eacb54c0b44a5b4be0fcb12?s=96&#038;d=http%3A%2F%2Fs2.wp.com%2Fi%2Fbuttonw-com.png</url>
		<title>Lost lines of code</title>
		<link>http://reecon.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://reecon.wordpress.com/osd.xml" title="Lost lines of code" />
	<atom:link rel='hub' href='http://reecon.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Memento and Proxy design patterns in iOS.</title>
		<link>http://reecon.wordpress.com/2011/12/25/memento-and-proxy-design-patterns-in-ios/</link>
		<comments>http://reecon.wordpress.com/2011/12/25/memento-and-proxy-design-patterns-in-ios/#comments</comments>
		<pubDate>Sun, 25 Dec 2011 15:29:28 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Design patterns]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[memento]]></category>
		<category><![CDATA[proxy]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=571</guid>
		<description><![CDATA[In the last article I wrote about Model-View-Controller design patterns that is present in almost every iOS application. This time I will try to reveal some secrets of two other design patterns &#8211; Memento and Proxy. I will show how to design an efficient data persistence mechanism with these two aforementioned approaches. What the heck [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=571&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><img class="alignright" title="Xcode hammer" src="http://d339vfjsz5zott.cloudfront.net/Misc/Learn-Objective-C.png" alt="" width="160" height="160" />In the <a title="Model-View-Controller design pattern in iOS development." href="http://reecon.wordpress.com/2011/12/25/model-view-controller-design-pattern-in-ios-development/">last article</a> I wrote about <strong>Model-View-Controller</strong> design patterns that is present in almost every iOS application. This time I will try to reveal some secrets of two other design patterns &#8211; <strong>Memento</strong> and <strong>Proxy</strong>. I will show how to design an efficient data persistence mechanism with these two aforementioned approaches.</p>
<h4>What the heck is Memento?</h4>
<p>Quick definition:</p>
<blockquote><p><em>&#8220;Without violating encapsulation, capture and externalize an object’s internal state so that the object can be restored to this state later&#8221;</em>, Design Patterns, by the “Gang of Four” (Addison-Wesley, 1994)</p></blockquote>
<p><span id="more-571"></span>Let&#8217;s say we have an object or thousands of objects and we want to store them when the user saves the state of the work/game/application or in dozens of other cases. A <strong>memento</strong> is an object that keeps the information about the state of the other object. Thus, the memento encapsulates information that can be used to recreate the original object.</p>
<p>To make the pattern work we need objects that fulfill roles of:</p>
<ul>
<li><strong>originator</strong> &#8211; creates a memento with all information that is relevant for us and will be useful later to recreate the object,</li>
<li><strong>memento</strong> &#8211; stores the information about the state of the originator object</li>
<li><strong>caretaker</strong> &#8211; stores the memento somewhere in the memory.</li>
</ul>
<p>Everything&#8217;s easy. The caretaker asks originator to create a memento. Originator creates the memento. However, the originator does not know how to save it. This is done by the caretaker, which takes the memento and stores it in the file system (for instance as a <em>NSData</em> or a plist). In case of loading the memento from the file system steps are analogical.</p>
<p>Cocoa Touch uses the <strong>Memento pattern</strong> in archiving, property list serialization and Core Data.</p>
<h4>Aha, and what is this Proxy all about?</h4>
<p>Quick definition:</p>
<blockquote><p><em>&#8220;Provides a surrogate or placeholder for another object to control access to it.</em>&#8220;, Design Patterns, by the “Gang of Four” (Addison-Wesley, 1994)</p></blockquote>
<p>The main idea of the Proxy pattern is very easy. Let&#8217;s say we have an image we would like to present in our <em>UIImageView</em>. However, the image is located on the external server and we need to fetch it. So, in order to raise the user&#8217;s experience we are presenting the placeholder image and when the download is finished we update the photo. This is all about <strong>Proxy</strong> pattern.</p>
<p>We can apply Proxy pattern to an iOS app to lazy-load the data that is expensive in terms of memory usage. A virtual proxy object gives some sort of initial information of the object that will be loaded when the user requests it.<br />
References:<br />
<em>Pro Objective-C Design Patterns for iOS</em>, Carlo Chung</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/571/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/571/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/571/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=571&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2011/12/25/memento-and-proxy-design-patterns-in-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>

		<media:content url="http://d339vfjsz5zott.cloudfront.net/Misc/Learn-Objective-C.png" medium="image">
			<media:title type="html">Xcode hammer</media:title>
		</media:content>
	</item>
		<item>
		<title>Model-View-Controller design pattern in iOS development.</title>
		<link>http://reecon.wordpress.com/2011/12/25/model-view-controller-design-pattern-in-ios-development/</link>
		<comments>http://reecon.wordpress.com/2011/12/25/model-view-controller-design-pattern-in-ios-development/#comments</comments>
		<pubDate>Sun, 25 Dec 2011 12:44:01 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[MVC]]></category>
		<category><![CDATA[Design patterns]]></category>
		<category><![CDATA[Strategy]]></category>
		<category><![CDATA[Observer]]></category>
		<category><![CDATA[Composite]]></category>
		<category><![CDATA[Mediator]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=561</guid>
		<description><![CDATA[In object-oriented programming, design patterns show a general view of how classes and objects interact, describe their relationships. They are like a sign on a crossroads, pointing to the possible solution for a given problem. With design patterns you can develop fast and effectively. However, using a particular design pattern is not a mandatory, the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=561&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div class="wp-caption alignleft" style="width: 255px"><img class=" " title="Model-view-controller concept." src="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/ModelViewControllerDiagram2.svg/350px-ModelViewControllerDiagram2.svg.png" alt="Model-view-controller concept. The solid line represents a direct association, the dashed an indirect association (via an observer for example). Source: Wikipedia." width="245" height="112" /><p class="wp-caption-text">Model-view-controller concept. The solid line represents a direct association, the dashed an indirect association (via an observer for example). Source: Wikipedia.</p></div>
<p>In object-oriented programming, design patterns show a general view of how classes and objects interact, describe their relationships. They are like a sign on a crossroads, pointing to the possible solution for a given problem.</p>
<p>With design patterns you can develop fast and effectively. However, using a particular design pattern is not a mandatory, the only right way of achieving desired functionality. A developer has to keep in mind all the limitation and drawbacks of using the design pattern that seems to fit well as a good solution for a given task.</p>
<h4>Quality, not quantity.</h4>
<p>Someone has recently asked me if a code that uses more design patterns is better then the code that utilizes only a few of them. Of course, it is not about the quantity. A developer may use only one design pattern (or doesn&#8217;t use any at all) and the app may work perfectly, the code can be clean and professional. It all depends on the particular application or a feature the developer is dealing with. <strong>Quality</strong>, this is what counts.<span id="more-561"></span></p>
<h4>Classification</h4>
<p>I will not reinvent the wheel here, there is a nice presentation of the classification of the design patterns in the article about the design patterns on <a title="wikipedia" href="http://en.wikipedia.org/wiki/Software_design_pattern" target="_blank">wikipedia</a>.</p>
<h4>So how it looks in iOS development?</h4>
<p>Here I present some examples of classes and approaches that fulfill the rules of several design patterns. Firstly, I present the <strong>Model View Controller</strong> (MVC) pattern that you must have encountered during the development of a view (or window) based application.</p>
<h4>Model-View Controller pattern</h4>
<p>In <strong>MVC</strong>, every controller owns a view and a model (with data presented by the view). In fact, the MVC pattern consists of a set of more primitive patterns. I will introduce them here:</p>
<ul>
<li><strong>Composite</strong> &#8211; Views form a hierarchy. Each view has a strictly specified position in the view hierarchy. Each view can be drawn on screen or respond to touch events. What is more, every view can be a parent node for another set of views. This pattern is very common. When we add <em>UIButton</em>, <em>UITextField</em>, <em>UITableView</em> or any other <em>UIView</em> to the parent <em>UIView</em> of <em>UIViewController</em> we utilize this patterns.</li>
</ul>
<ul>
<li><strong>Command</strong> &#8211; The mighty target-action approach. Views can defer and forward execution to other objects (in most cases they forward it to our <em>UIViewController</em> subclass). The execution is forwarded to other objects when certain events occur (for instance user taps a button &#8211; <em>UIControlEventTouchUpInside</em>).</li>
</ul>
<ul>
<li><strong>Mediator</strong> &#8211; Our view controller mediates between our presentation layer (the views) and model layer. The interaction is bi-directional. So, if the model changes the view objects are informed about this change not directly but via the Mediator (our <em>UIViewController</em>).</li>
</ul>
<ul>
<li><strong>Strategy</strong> &#8211; The fact that view objects interact not directly with the Model but using the Mediator pattern with controller object gives as a good starting point to use a Strategy pattern. The controller decides which &#8220;strategy&#8221; will be the best for dealing with the particular problem (f.e. which algorithm to use with data acquired from the user by view objects).</li>
</ul>
<ul>
<li><strong>Observer</strong> &#8211; This pattern is very common throughout whole Cocoa. If a model gets updated it may inform all objects that registered as the observers about the change that occurred. This can also be done in the opposite direction, when model should be updated, because user interacted with the model through the view objects. Now you probably think about<strong></strong> <em>Protocols, Key-Value Observing</em> and <em>Notification Center</em>. That&#8217;s right, these are all perfectly working examples of the Observer design pattern.</li>
</ul>
<p>References:<br />
<em>Pro Objective-C Design Patterns for iOS</em>, Carlo Chung</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/561/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/561/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/561/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=561&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2011/12/25/model-view-controller-design-pattern-in-ios-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>

		<media:content url="http://upload.wikimedia.org/wikipedia/commons/thumb/b/b5/ModelViewControllerDiagram2.svg/350px-ModelViewControllerDiagram2.svg.png" medium="image">
			<media:title type="html">Model-view-controller concept.</media:title>
		</media:content>
	</item>
		<item>
		<title>Obstacle detection using MC68HC908AB32.</title>
		<link>http://reecon.wordpress.com/2011/12/06/obstacle-detection-using-mc68hc908ab32/</link>
		<comments>http://reecon.wordpress.com/2011/12/06/obstacle-detection-using-mc68hc908ab32/#comments</comments>
		<pubDate>Tue, 06 Dec 2011 21:53:12 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[C/C++]]></category>
		<category><![CDATA[Code]]></category>
		<category><![CDATA[c++]]></category>
		<category><![CDATA[detection]]></category>
		<category><![CDATA[MC68HC908AB32]]></category>
		<category><![CDATA[microprocessor]]></category>
		<category><![CDATA[obstacle]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=545</guid>
		<description><![CDATA[What the heck is MC68HC908AB32? The MC68HC908AB32 is a member of the low-cost, high-performance M68HC08 Family of 8-bit microcontroller units (MCUs) designed by Motorola with embedded EEPROM for user data storage. This article presents the source code for Knight 1 Robot which I developed as a part of Microprocessor course at my uni. Special thanks [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=545&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<h3>What the heck is MC68HC908AB32?</h3>
<p>The MC68HC908AB32 is a member of the low-cost, high-performance M68HC08 Family of 8-bit microcontroller units (MCUs) designed by Motorola with embedded EEPROM for user data storage. This article presents the source code for Knight 1 Robot which I developed as a part of Microprocessor course at my uni. Special thanks to my friend Łukasz Siwko who helped in the construction of this electronic monster.</p>
<div style="text-align:left;"></div>
<div style="text-align:left;"><a title="Knight 1 Robot" href="http://reecon.files.wordpress.com/2011/12/1.jpg"><img class="size-thumbnail wp-image-546 aligncenter" title="Knight 1 Robot" src="http://reecon.files.wordpress.com/2011/12/1.jpg?w=150&#038;h=112" alt="Knight 1 Robot" width="150" height="112" /></a><span id="more-545"></span></div>
<p>The code is very simple. There was much more work in setting up the electronic elements then in writing the C program. The code handles the reception of the signals from the ultrasonic sensor and the management of two engines (A and B) of the robot that is based on MC68HC908AB32 microcontroller unit. If an obstacle is detected the engines turn the robot right by stoping the right engine (A stops, B full forward).</p>
<h3>Two words about pins</h3>
<p>PTB_PTB1 to PTB_PTB6 are Port B data register pins from 1 to 6 connected to engine motion control circuit. Pins 1 and 4 enable engines while pins 2,3,5,6 control the movement (10 &#8211; forward, 01 &#8211; reverse).</p>
<p>PTB_PTB0 (Port B data register pin 0) contains information (logical 0 or 1) from connected ultrasonic sensor receiver circuit about obstacle in view. Sensor sends logical 1 on obstacle detection (0 &#8211; no obstacle in view). Output pin of this sensor is connected to Port B data register pin 0.</p>
<pre> 
#include &lt;time.h&gt;
#include &lt;hidef.h&gt; /* for EnableInterrupts macro */
#include "derivative.h" /* include peripheral declarations */
#define DELAY 10000
void moveForward(void);
void turnRight(void);
int checkSensors(void);
void main(void) {
    EnableInterrupts; /* enable interrupts */
    for(;;) {
        __RESET_WATCHDOG(); /* feeds the dog */
        if(checkSensors()) {
            turnRight();
        }
        else {
            moveForward();
        }
    } /* loop forever */
    /* please make sure that you never leave main */
}
void turnRight(void) { /* Turns the robot right. */
    int i=0;
    /* Engine A stop */
    PTB_PTB1 = 1; // Enable
    PTB_PTB2 = 1; // Input 1
    PTB_PTB3 = 0; // Input 2
    /* Engine B full forward */
    PTB_PTB4 = 1; // Enable
    PTB_PTB5 = 0; // Input 1
    PTB_PTB6 = 1; // Input 2
    /* sleep(1) */
    /* Sleeping unsupported, using a "for" loop to cause a delay */
    for(i=0;i&lt;DELAY;i++){}
}
void moveForward(void) {
    /* Engine A full forward */
    PTB_PTB1 = 1; // Enable
    PTB_PTB2 = 1; // Input 1
    PTB_PTB3 = 0; // Input 2
    /* Engine B full forward */
    PTB_PTB4 = 1; // Enable
    PTB_PTB5 = 1; // Input 1
    PTB_PTB6 = 0; // Input 2
    /* PTB_PTB1 - 6 are Port B data register pins from 1 to 6 connected
to engine motion control circuit. Pins 1 and 4 enable engines while pins 2,3,5,6
control the movement (10 - forward, 01 - reverse). */
}
int checkSensors(void) { /* Checks whether the obstacle was detected.
Returns 1 on successful detection.*/
    if (PTB_PTB0 == 1) return 1;
    else return 0;
    /* PTB_PTB0 (Port B data register pin 0) contains information (logical 0 or 1)
from connected ultrasonic sensor receiver circuit about obstacle in view. Sensor sends
logical 1 on obstacle detection (0 - no obstacle in view). Output pin of this sensor is
connected to Port B data register pin 0. */
}</pre>
<p>This code is available at my <a title="GitHub" href="https://github.com/r3econ/Obstacle-Detector-for-MC68HC908AB32">GitHub</a> under GPL license. Feel free to download.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/545/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/545/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/545/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=545&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2011/12/06/obstacle-detection-using-mc68hc908ab32/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>

		<media:content url="http://reecon.files.wordpress.com/2011/12/1.jpg?w=150" medium="image">
			<media:title type="html">Knight 1 Robot</media:title>
		</media:content>
	</item>
		<item>
		<title>UIImage Sprite Additions. Objective-C.</title>
		<link>http://reecon.wordpress.com/2011/11/19/uiimage-sprite-additions-objective-c/</link>
		<comments>http://reecon.wordpress.com/2011/11/19/uiimage-sprite-additions-objective-c/#comments</comments>
		<pubDate>Sat, 19 Nov 2011 18:52:31 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[animation]]></category>
		<category><![CDATA[Core Graphics]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[iPad]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Sprite]]></category>
		<category><![CDATA[Spritesheet]]></category>
		<category><![CDATA[Texture Atlas]]></category>
		<category><![CDATA[UIImageView]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=498</guid>
		<description><![CDATA[I wrote an useful UIImage category for handling sprite sheets. The add-on smoothes the way of extracting images from a sprite sheet (or texture atlas). This can be useful in UIImageView animations where animationImages array has to be filled with a set of images representing frames. UIImage-Sprite category makes this process trivial by introducing two [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=498&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="attachment_499" class="wp-caption alignleft" style="width: 170px"><a href="http://reecon.files.wordpress.com/2011/11/1.png"><img class="size-medium wp-image-499" title="1" src="http://reecon.files.wordpress.com/2011/11/1.png?w=160&#038;h=300" alt="" width="160" height="300" /></a><p class="wp-caption-text">UIImage Sprite Additions</p></div>
<p>I wrote an useful UIImage category for handling sprite sheets. The add-on smoothes the way of extracting images from a sprite sheet (or texture atlas).</p>
<p>This can be useful in UIImageView animations where <em>animationImages</em> array has to be filled with a set of images representing frames. <strong>UIImage-Sprite</strong> category makes this process trivial by introducing two methods:</p>
<pre><code>-(NSArray *)spritesWithSpriteSheetImage:(UIImage *)image spriteSize:(CGSize)size; -(NSArray *)spritesWithSpriteSheetImage:(UIImage *)image inRange:(NSRange)range spriteSize:(CGSize)size; </code></pre>
<p>The first method returns an array with UIImages. Original sprite sheet (<em>image</em>) is sliced into smaller chunks, each of the specified size.</p>
<p>Second method is very similar &#8211; extends the first one with option of specifying the range of the chunks we want to get.</p>
<p>I wrote this add-on to facilitate the setup of short animations using UIImageView. For more complex animations I recommend using OpenGLES.</p>
<p><span id="more-498"></span></p>
<p>I also wrote the SpriteAnimationDemo project that presents the usage of the <strong>UIImage+Sprite</strong> methods. The example shows how to create an animated UIImageView. This cool explosion sprite sheet which I included in the demo can be found at <a href="http://gushh.net/blog/free-game-sprites-explosion-3/">http://gushh.net/blog/free-game-sprites-explosion-3/</a>. I added some numbers to this image to make testing and debugging easier.</p>
<p>The code is distributed under the terms and conditions of the MIT license and can be found at my github: <a title="https://github.com/r3econ/UIImage-Sprite-Additions" href="https://github.com/r3econ/UIImage-Sprite-Additions" target="_blank">https://github.com/r3econ/UIImage-Sprite-Additions</a></p>
<p>Note that for performance reasons you should not fire these methods every time you want to get the array of animation frames. You should rather fire it once and store the output array somewhere. This is because the Core Graphics image manipulation operations (especially on large images) are not so fast and your application may slow down.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/498/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/498/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/498/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=498&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2011/11/19/uiimage-sprite-additions-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>

		<media:content url="http://reecon.files.wordpress.com/2011/11/1.png?w=160" medium="image">
			<media:title type="html">1</media:title>
		</media:content>
	</item>
		<item>
		<title>Noughts and Crosses. Complete iPhone project. Objective-C.</title>
		<link>http://reecon.wordpress.com/2011/10/30/noughts-and-crosses-complete-iphone-project-objective-c/</link>
		<comments>http://reecon.wordpress.com/2011/10/30/noughts-and-crosses-complete-iphone-project-objective-c/#comments</comments>
		<pubDate>Sun, 30 Oct 2011 22:18:59 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Game]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[Noughts and Crosses]]></category>
		<category><![CDATA[RSToast]]></category>
		<category><![CDATA[Tic Tac Toe]]></category>
		<category><![CDATA[Toast]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=490</guid>
		<description><![CDATA[Everybody knows what Tic Tac Toe or Noughts and Crosses game is. Everyone has played it. It is simple, trivial or someone may even say stupid. Whateverm I made a full, complete working iPhone game &#8211; Noughts and Crosses. For those who still don&#8217;t know what I am talking about please take a look at  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=490&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<div id="attachment_491" class="wp-caption alignleft" style="width: 168px"><a href="http://reecon.files.wordpress.com/2011/10/1.png"><img class="size-medium wp-image-491" title="Noughts and Crosses iPhone App" src="http://reecon.files.wordpress.com/2011/10/1.png?w=158&#038;h=300" alt="Noughts and Crosses iPhone App" width="158" height="300" /></a><p class="wp-caption-text">Noughts and Crosses iPhone App</p></div>
<p>Everybody knows what Tic Tac Toe or Noughts and Crosses game is. Everyone has played it. It is simple, trivial or someone may even say stupid. Whateverm I made a full, complete working iPhone game &#8211; Noughts and Crosses. For those who still don&#8217;t know what I am talking about please take a look at  a brief information about the rules and origins of the game at <a title="http://en.wikipedia.org/wiki/Noughts_%26_Crosses" href="http://en.wikipedia.org/wiki/Noughts_%26_Crosses" target="_blank">wikipedia</a>.</p>
<p>Although the game, its rules and implementation are rather trivial, it took me several evenings to code it. It was made just for fun to show my coding etiquette and my development habits. There is also another reason &#8211; I decided to create something that may help those that start messing with iOS development. The project covers such topics as:</p>
<ul>
<li>UIView animations</li>
<li>Protocols and delegates</li>
<li>Custom UI components</li>
<li>Playing with UIActionsheet, UIAlertView</li>
<li>Creation of UI controls from code</li>
<li>CALayers (adding shadows, rounded corners)<span id="more-490"></span></li>
</ul>
<p>To present some short notifications about game progress, I needed an equivalent of Android&#8217;s Toast component. That was a reason for developing a <strong>RSToast</strong> class &#8211; a UI component that presents a short message and disappears after a short time without the need for tapping on it. Current version of RSToast is very simple. However, I will extend it to support icons and add some helper methods for customizing its appearance.</p>
<p>The source code is publicly available, released under MIT license. Xcode project can be downloaded from <a title="https://github.com/r3econ/Noughts-and-Crosses" href="https://github.com/r3econ/Noughts-and-Crosses" target="_blank">github</a>. Feel free to download and criticize!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/490/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/490/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/490/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=490&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2011/10/30/noughts-and-crosses-complete-iphone-project-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>

		<media:content url="http://reecon.files.wordpress.com/2011/10/1.png?w=158" medium="image">
			<media:title type="html">Noughts and Crosses iPhone App</media:title>
		</media:content>
	</item>
		<item>
		<title>Starting a method in a new thread causes memory leak. Objective-C.</title>
		<link>http://reecon.wordpress.com/2011/07/15/starting-a-method-in-a-new-thread-causes-memory-leak-objective-c/</link>
		<comments>http://reecon.wordpress.com/2011/07/15/starting-a-method-in-a-new-thread-causes-memory-leak-objective-c/#comments</comments>
		<pubDate>Fri, 15 Jul 2011 12:37:02 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[memory leak]]></category>
		<category><![CDATA[NSAuroreleasePool]]></category>
		<category><![CDATA[NSThread]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=467</guid>
		<description><![CDATA[When we start a method in a new thread we may easily cause a memory leak. Methods that allow for starting a new thread are: [self performSelectorInBackground:@selector(customMethod:) withObject:nil]; [NSThread detachNewThreadSelector:@selector(customMethod:) toTarget:self withObject:nil]; After running our app we may see something strange in logs: App[7254:7d03] *** __NSAutoreleaseNoPool(): Object 0x27b7a0 of class NSCFString autoreleased with no pool [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=467&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>When we start a method in a new thread we may easily cause a memory leak. Methods that allow for starting a new thread are:</p>
<pre>
[self performSelectorInBackground:@selector(customMethod:) withObject:nil];

[NSThread detachNewThreadSelector:@selector(customMethod:) toTarget:self withObject:nil];
</pre>
<p><span id="more-467"></span><br />
After running our app we may see something strange in logs:</p>
<pre>
App[7254:7d03] *** __NSAutoreleaseNoPool(): Object 0x27b7a0 of class NSCFString autoreleased with no pool in place - just leaking</pre>
<p>This log message indicates that we are leaking an object. To solve this and get rid of the memory leak, we have to set up our own autorelease pool that will clean the memory for us.</p>
<pre>
-(void)customMethod:(id)customObject {

NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
//
// Your code here
//
[pool release]; // or [pool drain]; pool = nil;

}</pre>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/467/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/467/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/467/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=467&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2011/07/15/starting-a-method-in-a-new-thread-causes-memory-leak-objective-c/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>
	</item>
		<item>
		<title>A simple thermometer model in PSpice.</title>
		<link>http://reecon.wordpress.com/2011/07/08/a-simple-thermometer-model-in-pspice/</link>
		<comments>http://reecon.wordpress.com/2011/07/08/a-simple-thermometer-model-in-pspice/#comments</comments>
		<pubDate>Fri, 08 Jul 2011 08:22:40 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[PSpice]]></category>
		<category><![CDATA[model]]></category>
		<category><![CDATA[resistor]]></category>
		<category><![CDATA[thermometer]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=453</guid>
		<description><![CDATA[Two resistors and a voltage source &#8211; that is all we need to create a very simple thermometer model. Figure below shows the idea. R1 is an ideal resistor model. R2 resistance value changes with temperature allowing us to indirectly measure it. R2 2 0 15K TC=0.001 0.000005 R1 1 2 15k Vin 0 1 [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=453&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Two resistors and a voltage source &#8211; that is all we need to create a very simple thermometer model. Figure below shows the idea. R1 is an ideal resistor model. R2 resistance value changes with temperature allowing us to indirectly measure it.</p>
<p><a href="http://reecon.files.wordpress.com/2011/06/thermometer.png"><img title="thermometer" src="http://reecon.files.wordpress.com/2011/06/thermometer.png?w=150&#038;h=123" alt="" width="150" height="123" /></a><br />
<span id="more-453"></span></p>
<pre>R2 2 0 15K TC=0.001 0.000005

R1 1 2 15k

Vin 0 1 10

.DC TEMP -50 100 2

.PROBE

.END</pre>
<p>In probe: <strong>(V(1)- V(2))/ I(R1)</strong> and  <strong>V(2)/ I(R2)</strong></p>
<p>After running the simulation we get some interesting results, R1 resistance is fixed while R2 resistance increases as the temperature rises:</p>
<p><a href="http://reecon.files.wordpress.com/2011/06/screen-shot-2011-06-11-at-22-43-11.png"><img class="alignright size-full wp-image-455" title="Resistance and temperature" src="http://reecon.files.wordpress.com/2011/06/screen-shot-2011-06-11-at-22-43-11.png?w=620&#038;h=217" alt="" width="620" height="217" /></a></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/453/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/453/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/453/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=453&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2011/07/08/a-simple-thermometer-model-in-pspice/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>

		<media:content url="http://reecon.files.wordpress.com/2011/06/thermometer.png?w=150" medium="image">
			<media:title type="html">thermometer</media:title>
		</media:content>

		<media:content url="http://reecon.files.wordpress.com/2011/06/screen-shot-2011-06-11-at-22-43-11.png" medium="image">
			<media:title type="html">Resistance and temperature</media:title>
		</media:content>
	</item>
		<item>
		<title>Symbolicating crash log using the console. Xcode 4.</title>
		<link>http://reecon.wordpress.com/2011/05/21/xcode-4-symbolicate-crash-bug/</link>
		<comments>http://reecon.wordpress.com/2011/05/21/xcode-4-symbolicate-crash-bug/#comments</comments>
		<pubDate>Sat, 21 May 2011 22:28:02 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[Crash]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[log]]></category>
		<category><![CDATA[symbolicate]]></category>
		<category><![CDATA[Xcode 4]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=441</guid>
		<description><![CDATA[I found that Xcode 4.0 does not symbolicate crash logs as it should. After receiving crash logs from beta tester I dragged .crash file into the Organizer, which normally resulted in crash log being symbolicated. However, crash log was not symbolicated. Solution that I end up with was symbolicating the crash log using the console. [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=441&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p><a href="http://reecon.files.wordpress.com/2011/05/512-terminal.png"><img class="alignright size-thumbnail wp-image-450" title="Terminal" src="http://reecon.files.wordpress.com/2011/05/512-terminal.png?w=150&#038;h=150" alt="" width="150" height="150" /></a>I found that Xcode 4.0 does not symbolicate crash logs as it should. After receiving crash logs from beta tester I dragged .<em>crash</em> file into the Organizer, which normally resulted in crash log being symbolicated. However, crash log was not symbolicated. Solution that I end up with was symbolicating the crash log using the console. Furthermore, I used the <strong><em>symbolicatecrash</em></strong> command which is used by Xcode by default when it comes to symbolicating a crash. In my opinion, that is an evident bug.</p>
<p>Here is how I managed to symbolicate the crash:</p>
<pre>reecon$/Xcode4.0/Platforms/iPhoneOS.platform/Developer/Library/PrivateFrameworks/DTDeviceKit.framework/Versions/A/Resources/symbolicatecrash your_crash_log.crash</pre>
<p>Above-mentioned command produces the very same output that Xcode does when it&#8217;s symbolicating logs.</p>
<p>What is interesting, after installing Xcode 4, iPhone devices that I use for testing does not load their crash logs when they are connected to my Mac. To force it to do so, I have to synchronise the iPhones in iTunes and reboot the device every time I want to get the logs. That is strange. I hope they will fix it soon.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/441/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/441/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/441/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/441/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/441/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/441/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/441/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/441/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/441/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/441/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/441/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/441/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/441/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/441/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=441&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2011/05/21/xcode-4-symbolicate-crash-bug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>

		<media:content url="http://reecon.files.wordpress.com/2011/05/512-terminal.png?w=150" medium="image">
			<media:title type="html">Terminal</media:title>
		</media:content>
	</item>
		<item>
		<title>Configuring Router on a Stick. Cisco iOS.</title>
		<link>http://reecon.wordpress.com/2010/11/12/configuring-router-on-a-stick-cisco-ios/</link>
		<comments>http://reecon.wordpress.com/2010/11/12/configuring-router-on-a-stick-cisco-ios/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 14:36:55 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[Networking]]></category>
		<category><![CDATA[Routing & Switching]]></category>
		<category><![CDATA[Cisco]]></category>
		<category><![CDATA[IOS]]></category>
		<category><![CDATA[Router on a Stick]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=404</guid>
		<description><![CDATA[Solution called Router-On-A-Stick is commonly used to enable communication between different VLANs. This article presents configuration quickie for this issue. At first we must configure a trunk on a switch: Switch(config)# interface fastethernet 0/1 Switch(config-if)# switchport mode trunk Switch(config-if)# switchport trunk encapsulation dot1q You can also specify trunk native vlan and vlans allowed on a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=404&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p style="text-align:left;">Solution called Router-On-A-Stick is commonly used to enable communication between different VLANs. This article presents configuration quickie for this issue.</p>
<p style="text-align:center;"><a href="http://reecon.files.wordpress.com/2010/11/screenshot.png"><img class="aligncenter" title="Router on a Stick" src="http://reecon.files.wordpress.com/2010/11/screenshot.png?w=300&#038;h=270" alt="" width="300" height="270" /></a></p>
<p>At first we must configure a trunk on a switch:</p>
<pre>Switch(config)# interface fastethernet 0/1
Switch(config-if)# switchport mode trunk
Switch(config-if)# switchport trunk encapsulation dot1q</pre>
<p><span id="more-404"></span>You can also specify trunk native vlan and vlans allowed on a trunk. Remember that 802.1Q encapsulation type is the IEEE standard, is Cisco proprietary.</p>
<pre>Switch(config-if)#switchport trunk native vlan 99
Switch(config-if)#switchport trunk allowed vlan add 10</pre>
<p><!--more-->Now we have to configure subinterfaces on a router to make trunk work:</p>
<pre>Router(config-if)#no ip address
 Router(config-if)#no shutdown
 Router(config-if)#interface fa 0/1.10
 Router(config-subif)#encapsulation dot1q 10
 Router(config-subif)#ip address 192.168.10.254 255.255.255.0
 Router(config-subif)#interface fa 0/1.20
 Router(config-subif)#encapsulation dot1q 20
 Router(config-subif)#ip address 192.168.20.254 255.255.255.0</pre>
<p>Hosts A and B should now configure their default-gateways to 192.168.10.254 and 192.168.20.254 and be able to ping each other. That&#8217;s all.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/404/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/404/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/404/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=404&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2010/11/12/configuring-router-on-a-stick-cisco-ios/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>

		<media:content url="http://reecon.files.wordpress.com/2010/11/screenshot.png?w=300" medium="image">
			<media:title type="html">Router on a Stick</media:title>
		</media:content>
	</item>
		<item>
		<title>Setting a reminder using UILocalNotification in iOS 4. Objective-C.</title>
		<link>http://reecon.wordpress.com/2010/11/12/setting-a-reminder-using-uilocalnotification-in-ios-4-objective-c/</link>
		<comments>http://reecon.wordpress.com/2010/11/12/setting-a-reminder-using-uilocalnotification-in-ios-4-objective-c/#comments</comments>
		<pubDate>Fri, 12 Nov 2010 13:39:00 +0000</pubDate>
		<dc:creator>Rafał Sroka</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Objective-C]]></category>
		<category><![CDATA[iPhone]]></category>
		<category><![CDATA[NSDate]]></category>
		<category><![CDATA[UIDatePicker]]></category>
		<category><![CDATA[UILocalNotification]]></category>

		<guid isPermaLink="false">http://reecon.wordpress.com/?p=414</guid>
		<description><![CDATA[iOS 4 comes with new functionality called UILocalNotification. UILocalNotification class gives us the ability to cast notifications to a user without running the application which can be very useful in several situations. This article presents a quick How-To that shows how to use local notifications. For more information check the UILocalNotification Class Reference. Remember that [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=414&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>iOS 4 comes with new functionality called <strong>UILocalNotification</strong>. UILocalNotification class gives us the ability to cast notifications to a user without running the application which can be very useful in several situations.</p>
<p>This article presents a quick <strong>How-To</strong> that shows how to use local notifications. For more information check the <a title="UILocalNotification Class Reference" href="http://developer.apple.com/library/ios/#documentation/iphone/Reference/UILocalNotification_Class/Reference/Reference.html" target="_blank">UILocalNotification Class Reference</a>. Remember that <strong>UILocalNotification</strong> is available in iOS 4.0 and later.</p>
<h4>Introduction</h4>
<p>Implementing local notifications is very easy &#8211; all we have to do is to inform the operating system that we want to schedule a new notification. OS will show scheduled notification at the specified time. With <strong>UILocalNotification</strong> we are able to play alerts,  sounds, and badging application icon. In this example we will use a instance of UIDatePicker that will allow user to specify the time for the notification to occur and a <strong>UIButton</strong>.</p>
<p>When user clicks the button, action <em>setReminderUsingDateFromDatePicker</em> will schedule a notification with date picked from <strong>UIDatePicker</strong>. Setting the notification is done in <em>scheduleNotificationForDate</em> method. Let&#8217;s jump to the code.</p>
<h4>Implementation</h4>
<p>This is a UIButton&#8217;s action that schedules the notification. UIDatePicker  must be set up, and linked with code (f.e in Interface Builder) to make  this work. Action <em>setReminderUsingDateFromDatePicker</em> is attached to  UIButton object and simply schedules notification for a date that was  picked using UIDatePicker:</p>
<pre>-(IBAction)<strong>setReminderUsingDateFromDatePicker</strong>: (id)sender {

<em>/* datePicker is a UIDatePicker object, synthesized property, linked using IB */</em>
 [self scheduleNotificationForDate: datePicker.date];
<span id="more-414"></span>
UIAlertView  *alert = [[UIAlertView alloc] initWithTitle:@""
             message:@"Alarm has  been set"
             delegate:self cancelButtonTitle:@"OK" 
             otherButtonTitles:nil];

[alert show];
[alert release];
}</pre>
<p>Here is a main part of implementing notification:</p>
<pre>-(void) <strong>scheduleNotificationForDate</strong>: (NSDate*)date {

<em>/* Here we cancel all previously scheduled notifications */</em>
 [[UIApplication sharedApplication] cancelAllLocalNotifications];

UILocalNotification *localNotification = [[UILocalNotification alloc] init];

localNotification.fireDate = date;
NSLog(@"Notification will be shown on: %@",localNotification.fireDate);

localNotification.timeZone = [NSTimeZone defaultTimeZone];
localNotification.alertBody = [NSString stringWithFormat:
                              @"Your notification message"];
localNotification.alertAction = NSLocalizedString(@"View details", nil);

<em>/* Here we set notification sound and badge on the app's icon "-1" </em>
<em>means that number indicator on the badge will be decreased by one </em>
<em>- so there will be no badge on the icon */</em>

localNotification.soundName = UILocalNotificationDefaultSoundName;
localNotification.applicationIconBadgeNumber = -1;

[[UIApplication sharedApplication] <strong>scheduleLocalNotification:localNotification</strong>];
}</pre>
<p>Here is an example of setting the notification for a fixed date.</p>
<pre>-(IBAction)<strong>setReminder</strong> {

<em>// Setting all the information about our date</em>
<strong>int hour = 4;</strong>
<strong>int minutes = 15;</strong>
<strong>int day = 21;</strong>
<strong>int month = 12;</strong>
<strong>int year = 2012;</strong>

NSCalendar *calendar = [[NSCalendar alloc] initWithCalendarIdentifier:NSGregorianCalendar];
NSDateComponents *components = [[NSDateComponents alloc] init];

[components setDay:day];
[components setMonth:month];
[components setYear:year];
[components setMinute:minutes];
[components setHour:hour];

NSDate *myNewDate = [calendar dateFromComponents:components];
[components release];
[calendar release];

[self <strong>scheduleNotificationForDate</strong>:myNewDate];

UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@""
               message:@"Alarm has been set"
               delegate:self cancelButtonTitle:@"OK"
               otherButtonTitles:nil];
[alert show];
[alert release];
}</pre>
<p>That&#8217;s all.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/reecon.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/reecon.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/reecon.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/reecon.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/reecon.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/reecon.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/reecon.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/reecon.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/reecon.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/reecon.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/reecon.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/reecon.wordpress.com/414/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/reecon.wordpress.com/414/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/reecon.wordpress.com/414/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=reecon.wordpress.com&amp;blog=13037553&amp;post=414&amp;subd=reecon&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://reecon.wordpress.com/2010/11/12/setting-a-reminder-using-uilocalnotification-in-ios-4-objective-c/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
	
		<media:content url="http://0.gravatar.com/avatar/effc7c286f270fe581b8d7404e9d6e6a?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">reecon</media:title>
		</media:content>
	</item>
	</channel>
</rss>
