<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0"><channel><atom:link rel="hub" href="http://tumblr.superfeedr.com/" xmlns:atom="http://www.w3.org/2005/Atom"/><description>iOS and Android developer. Having an affair with Node.js and Django.

Follow @programpro
</description><title>Sam Stewart</title><generator>Tumblr (3.0; @samthestewart)</generator><link>http://samthestewart.tumblr.com/</link><item><title>When to call, how to use our friend: [super dealloc]</title><description>&lt;p&gt;I&amp;#8217;ve been refactoring an application for a client and continually ran into a peculiar error involving malloc. Apparently the code was trying to access an object which had already been released. I pored over each dealloc method until I narrowed the issue down by painful trial and error. The release statements appeared normal but I began to notice the [super dealloc] call was at the &lt;em&gt;top &lt;/em&gt;of every dealloc method &lt;em&gt;before&lt;/em&gt; the code released the other instance variables. Usually I place my [super dealloc] methods at the end of each dealloc, by convention, but I&amp;#8217;ve never thought there was a good reason for doing so.&lt;/p&gt;
&lt;p&gt;Until today. The crash which took me days to track down immediately disappeared when I moved the [super dealloc] call to the &lt;em&gt;top&lt;/em&gt; of the dealloc method. The issue was sporadic and did not occur in every dealloc method which made it especially confusing. When you call [super dealloc] you are effectively destroying the heap space allocated for yourself thus invalidating all pointer references. If you then try to release the other instance variables, the system throws a cryptic error. This link on StackOverflow sums up the problem: &lt;a href="http://stackoverflow.com/a/4566488" title="http://stackoverflow.com/a/4566488"&gt;&lt;a href="http://stackoverflow.com/a/4566488"&gt;http://stackoverflow.com/a/4566488&lt;/a&gt;&lt;/a&gt;&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/24748556534</link><guid>http://samthestewart.tumblr.com/post/24748556534</guid><pubDate>Sat, 09 Jun 2012 08:32:07 -0700</pubDate><category>bugs</category><category>objective-c</category><category>iOS</category><category>iphone</category><category>programming</category><category>beware</category></item><item><title>Inventing on Principal
Some excellent career advice in addition...</title><description>&lt;iframe src="http://player.vimeo.com/video/36579366" width="400" height="225" frameborder="0"&gt;&lt;/iframe&gt;&lt;br/&gt;&lt;br/&gt;&lt;p&gt;Inventing on Principal&lt;/p&gt;
&lt;p&gt;Some excellent career advice in addition to amazing UI demos&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/23838509799</link><guid>http://samthestewart.tumblr.com/post/23838509799</guid><pubDate>Sat, 26 May 2012 20:04:07 -0700</pubDate><category>programming</category><category>videos</category><category>learning</category></item><item><title>Don't touch the UI in init methods</title><description>&lt;p&gt;When overriding or adding an init method to a UIView or UIViewController &lt;strong&gt;do not&lt;/strong&gt; touch any elements of the view hiearchay as this behavior can lead to unintended side effects. A common error is to do the following in an init method:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;self.view.autoresizingMask = &amp;#8230;;&lt;/p&gt;
&lt;/blockquote&gt;
&lt;p&gt;This seemingly innocuous line of code will actually start the view loading and call loadView, viewDidLoad, etc. since self.view is really a getter. Of course, it is bad practice to load the entire view hierarchy from the init method; that should be done by the parent view when it&amp;#8217;s ready to ensure &amp;#8220;lazy loading&amp;#8221;. The easy solution is to abstain from touching any UIView elements in the initializers; wait until viewDidLoad.&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/23806867565</link><guid>http://samthestewart.tumblr.com/post/23806867565</guid><pubDate>Sat, 26 May 2012 10:44:47 -0700</pubDate><category>programming</category><category>iOS</category><category>tips</category><category>coding</category><category>uiview</category></item><item><title>Using #pragma in Obejctive-C</title><description>&lt;p&gt;When dealing with large files developers can add &amp;#8220;#pragma mark &amp;#8230;&amp;#8221; statements to clarify  different sections. This is especially helpful when viewing the method listing in XCode.&lt;/p&gt;
&lt;p&gt;To further demarcate the separations, &amp;#8220;#pragma mark -&amp;#8221; creates a horizontal line in the method listing. Up to this point I have thus been writing:&lt;/p&gt;
&lt;p&gt;#pragma mark -&lt;br/&gt;#pragma mark Calculation methods&lt;/p&gt;
&lt;p&gt;Today I learned you can combine these two lines into:&lt;/p&gt;
&lt;p&gt;#pragma mark - Calculation Methods&lt;/p&gt;
&lt;p&gt;A small change, but it will eliminate one more unnecessary line of code!&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/23381106459</link><guid>http://samthestewart.tumblr.com/post/23381106459</guid><pubDate>Sat, 19 May 2012 17:15:29 -0700</pubDate><category>tips</category><category>reminder</category><category>reference</category><category>programming</category><category>ios</category><category>objective-c</category></item><item><title>Loving Ruby..</title><description>&lt;a href="http://stackoverflow.com/questions/4500375/double-pipe-symbols-in-ruby-variable-assignment"&gt;Loving Ruby..&lt;/a&gt;: &lt;p&gt;Quickly check for instance variables which have been already set!&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/23202804661</link><guid>http://samthestewart.tumblr.com/post/23202804661</guid><pubDate>Wed, 16 May 2012 18:38:59 -0700</pubDate><category>ruby</category><category>tips</category><category>stackoverflow</category></item><item><title>Xcode 4.3.2 Excessive CPU Usage Fix</title><description>&lt;a href="http://stackoverflow.com/questions/10115551/why-does-xcode-4-3-2-hang-when-archiving"&gt;Xcode 4.3.2 Excessive CPU Usage Fix&lt;/a&gt;: &lt;p&gt;Apparently the new Xcode installer does not properly switch out thexcodebuildtool.&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/23176385216</link><guid>http://samthestewart.tumblr.com/post/23176385216</guid><pubDate>Wed, 16 May 2012 12:13:03 -0700</pubDate><category>tips</category><category>fixes</category><category>stackoverflow</category></item><item><title>Python 'is' vs '==' operator</title><description>&lt;a href="http://stackoverflow.com/questions/1504717/python-vs-is-comparing-strings-is-fails-sometimes-why"&gt;Python 'is' vs '==' operator&lt;/a&gt;</description><link>http://samthestewart.tumblr.com/post/23047247694</link><guid>http://samthestewart.tumblr.com/post/23047247694</guid><pubDate>Mon, 14 May 2012 11:15:41 -0700</pubDate></item><item><title>Run a specific Nose test</title><description>&lt;a href="http://stackoverflow.com/a/3704797"&gt;Run a specific Nose test&lt;/a&gt;</description><link>http://samthestewart.tumblr.com/post/20714071474</link><guid>http://samthestewart.tumblr.com/post/20714071474</guid><pubDate>Sun, 08 Apr 2012 07:41:44 -0700</pubDate><category>nose</category><category>python</category><category>programming</category><category>tips</category></item><item><title>Display Logging Output when Running Nose Unit Tests</title><description>&lt;a href="http://readthedocs.org/docs/nose/en/latest/plugins/logcapture.html"&gt;Display Logging Output when Running Nose Unit Tests&lt;/a&gt;: &lt;p&gt;By default, nose consumes the output generated by the logging module but you can easily disable this behavior with the —nologcapture flag.&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/20713825784</link><guid>http://samthestewart.tumblr.com/post/20713825784</guid><pubDate>Sun, 08 Apr 2012 07:35:41 -0700</pubDate><category>python</category><category>tips</category><category>programming</category></item><item><title>Previous Command (Up-Arrow) in Emacs Shell</title><description>&lt;a href="http://superuser.com/questions/139815/how-do-you-run-the-previous-command-in-emacs-shell"&gt;Previous Command (Up-Arrow) in Emacs Shell&lt;/a&gt;: &lt;p&gt;Useful keyboard shortcut (instead of up arrow) for using previous command in Emacs shell.&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/20348920691</link><guid>http://samthestewart.tumblr.com/post/20348920691</guid><pubDate>Mon, 02 Apr 2012 07:19:21 -0700</pubDate><category>tips</category><category>emacs</category></item><item><title>Use Option as Emacs Meta key on Mac OS X</title><description>&lt;a href="http://www.3hv.co.uk/blog/2009/05/11/the-meta-key-in-emacs-on-mac-os-x/"&gt;Use Option as Emacs Meta key on Mac OS X&lt;/a&gt;: &lt;p&gt;Useful tip for using Option/Alt key in Terminal as Emacs meta key.&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/20191844873</link><guid>http://samthestewart.tumblr.com/post/20191844873</guid><pubDate>Fri, 30 Mar 2012 15:53:18 -0700</pubDate><category>programming</category><category>coding</category><category>emacs</category><category>tips</category><category>terminal</category><category>mac os x</category></item><item><title>"When calculators can do multidigit long division in a microsecond, graph complicated functions at..."</title><description>“When calculators can do multidigit long division in a microsecond, graph complicated functions at the push of a button, and instantaneously calculate derivatives and [[integrals, serious questions arise about what is important in the mathematics curriculum and what it means to learn mathematics. More than ever, mathematics must include the mastery of concepts instead of mere memorization and the following of procedures. More than ever, school mathematics must include an understanding of how to use technology to arrive meaningfully at solutions to problems instead of endless attention to increasingly outdated computational tedium.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;&lt;span class="Apple-style-span"&gt;&lt;a href="http://en.wikipedia.org/wiki/National_Council_of_Teachers_of_Mathematics" title="National Council of Teachers of Mathematics"&gt;National Council of Teachers of Mathematics&lt;/a&gt;, Commonsense Facts to Clear the Air&lt;/span&gt;&lt;/em&gt;</description><link>http://samthestewart.tumblr.com/post/20183816809</link><guid>http://samthestewart.tumblr.com/post/20183816809</guid><pubDate>Fri, 30 Mar 2012 13:23:16 -0700</pubDate><category>thoughts</category><category>math</category></item><item><title>Error: "gcc: error trying to exec 'cc1plus': execvp: No such file or directory"</title><description>&lt;a href="http://www.ducea.com/2007/10/25/gcc-error-trying-to-exec-cc1plus-execvp-no-such-file-or-directory/"&gt;Error: "gcc: error trying to exec 'cc1plus': execvp: No such file or directory"&lt;/a&gt;</description><link>http://samthestewart.tumblr.com/post/20097983084</link><guid>http://samthestewart.tumblr.com/post/20097983084</guid><pubDate>Wed, 28 Mar 2012 19:32:51 -0700</pubDate><category>tips</category><category>problems</category><category>unix</category></item><item><title>Unix dig command</title><description>&lt;a href="http://blog.mitemitreski.com/2011/04/unix-dig-command.html"&gt;Unix dig command&lt;/a&gt;: &lt;p&gt;Query DNS servers about an IP address or URL&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/20096077320</link><guid>http://samthestewart.tumblr.com/post/20096077320</guid><pubDate>Wed, 28 Mar 2012 19:01:42 -0700</pubDate><category>unix</category><category>tips</category></item><item><title>Unix &amp; Linux Background Job Management</title><description>&lt;a href="http://javamomentum.be/2011/04/unix-background-jobs-101/"&gt;Unix &amp; Linux Background Job Management&lt;/a&gt;</description><link>http://samthestewart.tumblr.com/post/20096003125</link><guid>http://samthestewart.tumblr.com/post/20096003125</guid><pubDate>Wed, 28 Mar 2012 19:00:33 -0700</pubDate><category>unix</category></item><item><title>Insert Multiple Entries with MySQL</title><description>&lt;a href="http://www.electrictoolbox.com/mysql-insert-multiple-records/"&gt;Insert Multiple Entries with MySQL&lt;/a&gt;</description><link>http://samthestewart.tumblr.com/post/19434150033</link><guid>http://samthestewart.tumblr.com/post/19434150033</guid><pubDate>Fri, 16 Mar 2012 20:39:56 -0700</pubDate><category>mysql</category><category>tips</category><category>interesting</category></item><item><title>Python Raw Strings</title><description>&lt;p&gt;Quite interesting, didn&amp;#8217;t know this:&lt;/p&gt;
&lt;blockquote&gt;
&lt;p&gt;When an &amp;#8220;r&amp;#8221; or &amp;#8220;R&amp;#8221; prefix is present, a character following a backslash is included in the string without change, and &lt;em&gt;all backslashes are left in the string&lt;/em&gt;. For example, the string literal &lt;code&gt;r"\n"&lt;/code&gt; consists of two characters: a backslash and a lowercase &amp;#8220;n&amp;#8221;. String quotes can be escaped with a backslash, but the backslash remains in the string; for example, &lt;code&gt;r"\""&lt;/code&gt; is a valid string literal consisting of two characters: a backslash and a double quote; &lt;code&gt;r"\"&lt;/code&gt; is not a valid string literal (even a raw string cannot end in an odd number of backslashes). Specifically, &lt;em&gt;a raw string cannot end in a single backslash&lt;/em&gt; (since the backslash would escape the following quote character). Note also that a single backslash followed by a newline is interpreted as those two characters as part of the string, &lt;em&gt;not&lt;/em&gt; as a line continuation.&lt;/p&gt;
&lt;/blockquote&gt;</description><link>http://samthestewart.tumblr.com/post/19066358288</link><guid>http://samthestewart.tumblr.com/post/19066358288</guid><pubDate>Sat, 10 Mar 2012 09:54:03 -0800</pubDate><category>python</category><category>tips</category><category>programming</category></item><item><title>Exclude Java Files in Eclipse</title><description>&lt;a href="http://isagoksu.com/2009/development/developer-tools/dislikes/eclipse/how-to-exclude-files-from-build-path/"&gt;Exclude Java Files in Eclipse&lt;/a&gt;: &lt;p&gt;Especially helpful when using external libraries!&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/18816308331</link><guid>http://samthestewart.tumblr.com/post/18816308331</guid><pubDate>Mon, 05 Mar 2012 16:03:57 -0800</pubDate><category>eclipse</category><category>java</category><category>tips</category><category>programming</category></item><item><title>"It is not knowledge, but the act of learning, not possession but the act of getting there, which..."</title><description>“It is not knowledge, but the act of learning, not possession but the act of getting there, which grants the greatest enjoyment. When I have clarified and exhausted a subject, then I turn away from it, in order to go into darkness again. The never-satisfied man is so strange; if he has completed a structure, then it is not in order to dwell in it peacefully, but in order to begin another. I imagine the world conqueror must feel thus, who, after one kingdom is scarcely conquered, stretches out his arms for others.”&lt;br/&gt;&lt;br/&gt; - &lt;em&gt;Carl Friedrich Gauss&lt;/em&gt;</description><link>http://samthestewart.tumblr.com/post/18812974774</link><guid>http://samthestewart.tumblr.com/post/18812974774</guid><pubDate>Mon, 05 Mar 2012 15:13:04 -0800</pubDate><category>quotes</category><category>thoughts</category><category>life</category></item><item><title>Location of Python Standard Libraries</title><description>&lt;a href="http://stackoverflow.com/a/4907053"&gt;Location of Python Standard Libraries&lt;/a&gt;: &lt;p&gt;Simply use the &lt;em&gt;os.prefix &lt;/em&gt;property.&lt;/p&gt;</description><link>http://samthestewart.tumblr.com/post/18758473296</link><guid>http://samthestewart.tumblr.com/post/18758473296</guid><pubDate>Sun, 04 Mar 2012 15:53:01 -0800</pubDate><category>python</category><category>tips</category><category>reference</category></item></channel></rss>
