<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:georss='http://www.georss.org/georss' xmlns:gd='http://schemas.google.com/g/2005' xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4057906405003000972</id><updated>2012-02-05T14:05:19.598-03:00</updated><category term='objective-c'/><category term='ruby-on-rails'/><category term='serialization objective-c iphone cocoatouch ios'/><category term='ruby-on-rails rest when-not-to-use-rest'/><category term='rails-3'/><category term='autoresize'/><category term='init'/><category term='uiimage'/><category term='initializer'/><category term='mysql'/><category term='rails'/><category term='iphone-sdk'/><category term='microsoft-sql'/><category term='uicolor'/><category term='obj-c'/><category term='uikit'/><category term='cocoatouch'/><category term='virtualbox osx networking'/><category term='objective-c iphone-sdk cocoatouch'/><category term='osx zsh bash git prompt ps1'/><category term='objective-resource objective-c ruby'/><title type='text'>Compile you? I don't even know you!</title><subtitle type='html'>Notes on software development for iOS and also real computers in Ruby on Rails, ActionScript 3 (Flash, Flex), Java, .Net (C#, mostly), PHP, SQL Server and MySql. Also notes on whatever technology problem I happen to find, including OSX, Windows and Linux stuff.</subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default?max-results=100'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default?start-index=101&amp;max-results=100'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>109</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>100</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-2846180997532323124</id><published>2012-02-05T14:04:00.000-03:00</published><updated>2012-02-05T14:05:19.628-03:00</updated><title type='text'>XAMPP on OSX, WordPress and Permalinks</title><content type='html'>Finally I got Permalinks in Wordpress to work on my Wordpress install on local. Whew! &lt;a href="http://murfitt.net/blog/dan/2007/10/04/xampp-and-modrewrite-getting-clean-urls-work"&gt;Thanks to this post.&lt;/a&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;  For me the answer was:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Make sure &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;mod_rewrite&lt;/font&gt; is installed. Using &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;&amp;lt;?php phpinfo(); ?&amp;gt;&lt;/font&gt; is a good way to find out, but you probably just need to comment it out in one of the Apache config files.&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Then for your directory of interest you have to use something like this:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;&amp;lt;Directory &amp;quot;/www&amp;quot;&amp;gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;  &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;Options Indexes FollowSymLinks ExecCGI Includes&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;AllowOverride All&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;Order allow,deny&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;Allow from all&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;&amp;lt;/Directory&amp;gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-2846180997532323124?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/2846180997532323124/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=2846180997532323124' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2846180997532323124'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2846180997532323124'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2012/02/xampp-on-osx-wordpress-and-permalinks.html' title='XAMPP on OSX, WordPress and Permalinks'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-120230536835563894</id><published>2012-02-02T17:34:00.001-03:00</published><updated>2012-02-02T17:34:37.956-03:00</updated><title type='text'>MSB and LSB with MIDI (NRPN)</title><content type='html'>If you know nothing about programming yet find yourself programming for a living (as I do), you might have to deal with some of this bit-shifting bullshit that you should&amp;#39;ve learned in University. I was drinking coffee and reading Foucault, so I did not learn any of this stuff. My skills as a PUA are probably better, however. But I digress...&lt;div&gt;  &lt;br&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;m about to implement NRPN in &lt;a href="http://mididesigner.com"&gt;MIDI Designer&lt;/a&gt;, which led me to &lt;a href="http://sequence15.blogspot.com/2009/01/exploring-fizmo-nrpn-set.html"&gt;this wonderful article&lt;/a&gt;. It&amp;#39;s pretty easy. Kind of.&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Normal MIDI Messages&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;In the normal case (not NRPNs), MIDI messages typically have a &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;channel&lt;/font&gt;, &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;command&lt;/font&gt;, &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;data1&lt;/font&gt; (the cc number or the &amp;quot;note&amp;quot;) and &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;data2&lt;/font&gt; (the value). The first two are combined into &lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;status&lt;/font&gt;. So the whole thing looks like this:&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;   int status = ((command &amp;amp; 0xF0) | (channel &amp;amp; 0x0F));&lt;/font&gt;&lt;/div&gt;        &lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;span class="s1"&gt;   Byte&lt;/span&gt; theBytes[3] = {status &amp;amp; 0xFF, data1 &amp;amp; 0xFF, data2 &amp;amp; 0xFF};&lt;/font&gt;&lt;/div&gt;&lt;br&gt;&lt;b&gt;NRPNs - How to Get MSB and LSB?&lt;/b&gt;&lt;br&gt;&lt;div&gt;&lt;br&gt;  &lt;/div&gt;&lt;div&gt;NRPNs are like this, but the data2 is being used in two different 3-length byte arrays to get more values in there. So instead of going from 0-127, they go from 0-16129 (127 squared).&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Now this creates a problem where you need to get the MSB and the LSB. &lt;b&gt;After talking to &lt;a href="http://www.ratemyprofessors.com/ShowRatings.jsp?tid=159690"&gt;my father&lt;/a&gt; on the phone today, I realized that what&amp;#39;s so messed up about this is that they&amp;#39;re not 8-bit bytes. They&amp;#39;re &amp;quot;7-bit bytes&amp;quot; (they go from 0-127). &lt;/b&gt;So anyway, you have a value and you want to get the MSB and LSB. &lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;static int msb(int value) {&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;    return (value) &amp;gt;&amp;gt; 7; &lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;static int lsb(int value) {&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;    return value &amp;amp; 0x7f; &lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;static int makeValue(int msb, int lsb) {&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;    return ((msb &amp;lt;&amp;lt; 7)) + lsb;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Now, you could do this the normal way, too, like this:&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;int msb = (float)value / 128.0f;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;int lsb = value - msb * 128.0f;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;  &lt;br&gt;&lt;/div&gt;&lt;div&gt;which also works, but people will laugh at you.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Conclusion&lt;/b&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;By now most of you still have no idea what I&amp;#39;m talking about, and this article hasn&amp;#39;t helped you. But if you were about to implement NRPNs in a MIDI program, this article might help. &lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-120230536835563894?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/120230536835563894/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=120230536835563894' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/120230536835563894'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/120230536835563894'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2012/02/msb-and-lsb-with-midi-nrpn.html' title='MSB and LSB with MIDI (NRPN)'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-5628954780825818220</id><published>2012-01-24T17:39:00.000-03:00</published><updated>2012-01-24T17:40:01.832-03:00</updated><title type='text'>Perfect Storm for Software Development</title><content type='html'>&lt;div&gt;Convo with Friend of Mine, Head of Development at Medium-Sized Company&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Me&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Lots of big companies with low quality iOS apps&lt;/div&gt;&lt;div&gt;which strikes me as odd &lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br&gt;&lt;/b&gt;&lt;/div&gt;  &lt;div&gt;&lt;b&gt;CTO&lt;/b&gt;&lt;/div&gt;&lt;div&gt;not surprising at all &lt;/div&gt;&lt;div&gt;development doesn&amp;#39;t scale well&lt;/div&gt;&lt;div&gt;in fact scales horribly&lt;/div&gt;&lt;div&gt;not add on top of that mixed directions and signals from project and product managers &lt;/div&gt;  &lt;div&gt;introverted opinionated team&lt;/div&gt;&lt;div&gt;company politics &lt;/div&gt;&lt;div&gt;etc.. and you have a perfect storm&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-5628954780825818220?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/5628954780825818220/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=5628954780825818220' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5628954780825818220'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5628954780825818220'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2012/01/perfect-storm-for-software-development.html' title='Perfect Storm for Software Development'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-412395458394301433</id><published>2012-01-03T11:46:00.001-03:00</published><updated>2012-01-03T23:08:10.711-03:00</updated><title type='text'>Rename Screenshots OSX</title><content type='html'>I'll have to figure out how to get this into an automatic folder action somehow, but for now this works: &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;#!/usr/bin/env ruby&lt;/span&gt;&lt;br /&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;Dir.chdir("Desktop") # works in 1.8.7, later use Dir.home&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;prefix = "Screen shot-"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;dir = Dir.glob("#{prefix}*.*")&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;dir.each do |file|&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;time_date = File.new(file).mtime.strftime("%Y-%m-%d-%H%M-%S")&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;new_name = "#{prefix}#{time_date}"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;if (file.split(".").count &amp;gt; 1)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;extension = file.split(".").last&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;new_name = "#{new_name}.#{extension}"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;end&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;`mv '#{file}' '#{new_name}'`&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;end&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="font-family: 'courier new', monospace;"&gt;puts "Renamed #{dir.count} files with prefix #{prefix}"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-412395458394301433?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/412395458394301433/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=412395458394301433' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/412395458394301433'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/412395458394301433'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2012/01/rename-screenshots-osx.html' title='Rename Screenshots OSX'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-1989336640793099735</id><published>2011-12-19T17:14:00.001-03:00</published><updated>2011-12-19T17:14:42.165-03:00</updated><title type='text'>Multiple Build Targets, Same Name</title><content type='html'>&lt;div&gt;Have you ever wanted to have multiple build targets like Angry Birds? They use the different icons and the same name, &amp;quot;Angry Birds,&amp;quot; below each of them (mostly). The icons says stuff like, &amp;quot;Free.&amp;quot;&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Anyway, here we go... Xcode 4.x, an already-working target:&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Duplicate your target&lt;/li&gt;&lt;li&gt;Now you will have a target with a funny new name and a new plist. So&lt;/li&gt;&lt;li&gt;Rename the target&lt;/li&gt;  &lt;li&gt;Rename the plist&lt;/li&gt;&lt;li&gt;Adjust the target settings in the Project  to point to the renamed plist. If you don&amp;#39;t do this, Xcode will pretend it&amp;#39;s fine, but it&amp;#39;s not.&lt;/li&gt;&lt;li&gt;Adjust target so that it&amp;#39;s got &lt;b&gt;a unique Product Name&lt;/b&gt;. If you use the same one more than once, you will rot in hell forever.&lt;/li&gt;  &lt;li&gt;Now go to the plist that your target  is pointing to and adjust its CFBundleIdentifier to be something unique.&lt;/li&gt;&lt;li&gt;In that same plist, adjust your CFBundleDisplayName to be the display name you want, e.g., &amp;quot;Angry Birds&amp;quot;&lt;/li&gt;  &lt;li&gt;Xcode will also have created a new &amp;quot;Scheme&amp;quot; for this new target. You can rename the scheme and it will still point to the target, so all is good.&lt;/li&gt;&lt;li&gt;Bring a bunch of Icon.png files in, and associate each one with the correct target.&lt;/li&gt;  &lt;/ol&gt;Now I have to figure out if this is a good idea. However, don&amp;#39;t do this just to get some different arguments in. For that, you can just use schemes, as I mention here: &lt;a href="http://compileyouidontevenknowyou.blogspot.com/2011/09"&gt;http://compileyouidontevenknowyou.blogspot.com/2011/09&lt;/a&gt;&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Keywords&lt;/b&gt;&lt;/div&gt;&lt;div&gt;Xcode, iOS, iPad, Objective-C, Multiple Build Targets&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-1989336640793099735?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/1989336640793099735/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=1989336640793099735' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1989336640793099735'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1989336640793099735'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/12/multiple-build-targets-same-name.html' title='Multiple Build Targets, Same Name'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4035631588432755395</id><published>2011-12-03T02:52:00.000-03:00</published><updated>2011-12-03T02:53:12.334-03:00</updated><title type='text'>Adjust Hue and Saturation of a UIImage</title><content type='html'>How to adjust Hue and Saturation of a UIImage in Objective-C. This is a method for a UIImageView subclass, but you could easily remix in another context.&lt;br&gt;&lt;br&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;- (void) changeToHue:(float)hue saturation:(float)saturation {&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    UIGraphicsBeginImageContext(self.bounds.size);&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    CGContextRef context = UIGraphicsGetCurrentContext();    &lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    UIView *hueBlend = [[UIView alloc] initWithFrame:self.bounds];&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    hueBlend.backgroundColor = [UIColor colorWithHue:hue saturation:saturation brightness:1 alpha:1];&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    CGContextDrawImage(context, self.bounds, self.image.CGImage);&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    CGContextSetBlendMode(context, kCGBlendModeHue);&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    [hueBlend.layer renderInContext:context];&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    self.image = UIGraphicsGetImageFromCurrentImageContext();&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    UIGraphicsEndImageContext();    &lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt;&lt;div&gt; &lt;br&gt; &lt;/div&gt;&lt;a href="http://stackoverflow.com/a/8365850/8047"&gt;From my answer here&lt;/a&gt;.&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4035631588432755395?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4035631588432755395/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4035631588432755395' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4035631588432755395'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4035631588432755395'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/12/adjust-hue-and-saturation-of-uiimage.html' title='Adjust Hue and Saturation of a UIImage'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4334012078097093096</id><published>2011-10-24T18:16:00.000-03:00</published><updated>2011-10-25T13:10:12.386-03:00</updated><title type='text'>Running Two Notational Velocities at Once</title><content type='html'>&lt;div class="mobile-photo"&gt;&lt;a href="http://3.bp.blogspot.com/-jc0lfRtXl8U/TqXV1nT1E4I/AAAAAAAAD0Q/S9tdxuDBw4o/s1600/Screen%2Bshot%2B2011-10-24%2Bat%2B5.15.06%2BPM-729155.png"&gt;&lt;img alt="" border="0" id="BLOGGER_PHOTO_ID_5667170823177573250" src="http://3.bp.blogspot.com/-jc0lfRtXl8U/TqXV1nT1E4I/AAAAAAAAD0Q/S9tdxuDBw4o/s320/Screen%2Bshot%2B2011-10-24%2Bat%2B5.15.06%2BPM-729155.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;Do this: &lt;br /&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Copy your Notational Velocity application (so it's called "Notational Velocity copy" or whatever)&lt;/li&gt;&lt;li&gt;Adjust the key in the info.plist of the package so that the&amp;nbsp;CFBundleIdentifier points someplace different (e.g.,&amp;nbsp;net.notational.velocity2)&lt;/li&gt;&lt;li&gt;Launch the NV copy and adjust the notes directory to also be something different&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;That's it! Now you've got two Notational Velocities running side by side. You can even give them different hot keys and different fonts so you can tell them apart.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I think the same thing would work with nvAlt, which by the way will sync your tags to simplenote, which is a big deal.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;Check out the mini-discussion with &lt;a href="http://superuser.com/users/69039/lri"&gt;heavy-weight Superuser @Lri&lt;/a&gt;&amp;nbsp;and a&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;a href="http://superuser.com/questions/349154/run-two-notational-velocities-at-once/349157#comment384544_349157"&gt;cleaner solution&lt;/a&gt;&amp;nbsp;using defaults write and ditto.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4334012078097093096?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4334012078097093096/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4334012078097093096' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4334012078097093096'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4334012078097093096'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/10/running-two-notational-velocities-at.html' title='Running Two Notational Velocities at Once'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-jc0lfRtXl8U/TqXV1nT1E4I/AAAAAAAAD0Q/S9tdxuDBw4o/s72-c/Screen%2Bshot%2B2011-10-24%2Bat%2B5.15.06%2BPM-729155.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-5361879031129327509</id><published>2011-10-19T20:13:00.001-03:00</published><updated>2011-10-19T20:13:53.168-03:00</updated><title type='text'>Ensure in Main Thread</title><content type='html'>Multithreaded programming is a must in iOS. If you schedule an NSTimer and yet it doesn&amp;#39;t fire, it might be because the thread that launched it is now dead. If it&amp;#39;s related to UI, you&amp;#39;ll need to get to the main thread eventually, anyway. Use this&lt;div&gt;  &lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;#define ensureInMainThread(); if ([NSThread currentThread] != [NSThread mainThread]) { [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];    return; } &lt;/font&gt;&lt;/div&gt;  &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;It can only be used from methods that accept (and return) no parameters.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Now you can have pretty code like this&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;        &lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;- (&lt;span class="s1"&gt;void&lt;/span&gt;) msgReceived {&lt;/font&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;courier new&amp;#39;, monospace; "&gt;&lt;span class="s2"&gt;    &lt;/span&gt;ensureInMainThread&lt;span class="s2"&gt;();&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;  &lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="arial, helvetica, sans-serif"&gt;Beware that using code like this might indicate that you are completely lost in a sea of threads. If you have no idea why you need this method, you should go back to your code and figure it out.&lt;/font&gt;&lt;/p&gt;  &lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-5361879031129327509?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/5361879031129327509/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=5361879031129327509' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5361879031129327509'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5361879031129327509'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/10/ensure-in-main-thread.html' title='Ensure in Main Thread'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-2030124168880467868</id><published>2011-10-12T16:57:00.001-03:00</published><updated>2011-10-12T17:08:02.149-03:00</updated><title type='text'>Localize Your NSString</title><content type='html'>I probably won't use this code since I'm pretty sure it's a terrible idea. But since I put it together today, I'll share it. It's an NSString category that overwrite just the stringWithFormat: method, and just replaces the text with the text from your local language bundle.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I thought it would be useful for localizing an application, but it will probably result in madness and, eventually, blindness. It's a category "extension" for NSString.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;#import "NSString+Localization.h"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@implementation NSString (Localization)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;+ (NSString*)stringWithFormat:(NSString *)text, ...&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; va_list args;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; va_start(args, text);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; text = NSLocalizedString(text, nil);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; NSString *retVal = [[NSString alloc] initWithFormat:text arguments:args];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; return retVal;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;Perhaps more sane than overriding the stringWithFormat: method would be to create one. Any help on the name would be appreciated:&lt;br /&gt;&lt;br /&gt;&lt;div class="p1"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s1"&gt;#import &lt;/span&gt;"NSString+Localization.h"&lt;/span&gt;&lt;/div&gt;&lt;div class="p2"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s1"&gt;@implementation&lt;/span&gt; NSString (Localization)&lt;/span&gt;&lt;/div&gt;&lt;div class="p2"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;+ (&lt;span class="s2"&gt;NSString&lt;/span&gt;*)twiceLocalizedStringWithFormat:(&lt;span class="s2"&gt;NSString&lt;/span&gt; *)text, ...&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;{&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="s2"&gt;va_list&lt;/span&gt; args;&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="s1"&gt;va_start&lt;/span&gt;(args, text);&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; text = &lt;span class="s1"&gt;NSLocalizedString&lt;/span&gt;(text, &lt;span class="s1"&gt;nil&lt;/span&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div class="p4"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="s3"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;NSString&lt;span class="s3"&gt; *retVal = [[&lt;/span&gt;NSString&lt;span class="s3"&gt; &lt;/span&gt;alloc&lt;span class="s3"&gt;] &lt;/span&gt;initWithFormat&lt;span class="s3"&gt;:text &lt;/span&gt;locale&lt;span class="s3"&gt;: [[&lt;/span&gt;NSUserDefaults&lt;span class="s3"&gt; &lt;/span&gt;standardUserDefaults&lt;span class="s3"&gt;] &lt;/span&gt;dictionaryRepresentation&lt;span class="s3"&gt;] &lt;/span&gt;arguments&lt;span class="s3"&gt;:args];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp; &amp;nbsp; &lt;span class="s1"&gt;return&lt;/span&gt; retVal;&lt;/span&gt;&lt;/div&gt;&lt;div class="p3"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: Times;"&gt;&lt;b&gt;NOTE&lt;/b&gt;: This code is ARC friendly. If you are not ARCing, autorelease the retVal in both examples.&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-2030124168880467868?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/2030124168880467868/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=2030124168880467868' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2030124168880467868'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2030124168880467868'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/10/localize-your-nsstring.html' title='Localize Your NSString'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-3542905447079034849</id><published>2011-09-18T22:44:00.001-03:00</published><updated>2011-09-18T22:47:33.511-03:00</updated><title type='text'>UIViewAutoresizing Has Limits</title><content type='html'>If you're going to try to resize stuff seriously -- all the way down, then all the way up -- &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;UIViewAutoresizing&lt;/span&gt;&amp;nbsp;sucks. Why? All the information it uses comes from the current state. Over resizes to smaller sizes it will lose precision. This means that a "flexible sides" subview that was 180 pixels from the left side could end up at 18 pixels from the left side. So you'll need to store your subviews' sizes. You get something cheesy like this: &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;#pragma mark All the storing position stuff since UIViewAutoSize sucks&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;-(NSMutableDictionary *)positions {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; if (!positions)&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; self.positions = [NSMutableDictionary dictionary];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; return positions;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void) repositionElements {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; for (NSValue *key in [self.positions allKeys]) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [self reposition:[key nonretainedObjectValue]];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void) storePositionsForElements {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; for (UIView *view in self.subviews) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; if (CGRectIsEmpty(view.frame))&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; return;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; [self storeFirstPosition:view];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;-(void)storeFirstPosition:(UIView *)element {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; NSValue *key = [NSValue valueWithNonretainedObject:element];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; [self.positions setObject:[NSValue valueWithCGRect:element.frame] forKey:key];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;- (void)reposition:(UIView *)element {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;NSValue *key = [NSValue valueWithNonretainedObject:element];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;CGRect firstFrame = ((NSValue*)[self.positions objectForKey:key]).CGRectValue;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;float newX = firstFrame.origin.x / firstBounds.size.width * self.bounds.size.width;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;float newY = firstFrame.origin.y / firstBounds.size.height * self.bounds.size.height;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;float newWidth = firstFrame.size.width / firstBounds.size.width * self.bounds.size.width;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;float newHeight = firstFrame.size.height / firstBounds.size.height * self.bounds.size.height;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;element.frame = CGRectMake(newX, newY, newWidth, newHeight); &amp;nbsp;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This would allow you to store everything in an &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;NSMutableArray&lt;/span&gt; called positions (make sure it's not nil, for God's sake). You would call &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;storePositionsForElements&lt;/span&gt; in your &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;initWithCoder&lt;/span&gt; (so it stores the NIB's positions), and then call &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;repositionElements&lt;/span&gt; from your &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;setFrame&lt;/span&gt; override.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;If categories let you store stuff, I would monkey patch &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;UIView&lt;/span&gt; and get a much better solution.&amp;nbsp;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-3542905447079034849?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/3542905447079034849/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=3542905447079034849' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3542905447079034849'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3542905447079034849'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/09/uiviewautoresizing-has-limits.html' title='UIViewAutoresizing Has Limits'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-1287218673671914974</id><published>2011-09-16T16:59:00.000-03:00</published><updated>2011-09-16T17:00:05.117-03:00</updated><title type='text'>Lock Aspect Ratio to Max</title><content type='html'>This is pretty much exactly how &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;UIImageView&lt;/font&gt; works when you use &amp;quot;Aspect Fill.&amp;quot; If you use this in the enclosing view&amp;#39;s &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;setFrame&lt;/font&gt;, you can let the &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;UIImageView&lt;/font&gt; freewheel (scale to fit), and resize other things according to your new size:&lt;div&gt;  &lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;-(void)setFrame:(CGRect)frameIn {&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    if (!ignoreAspectRatio) {&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;        float aspectRatio = self.frame.size.width / self.frame.size.height;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;        frameIn.size.width = MIN(frameIn.size.width, frameIn.size.height * aspectRatio);&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;        frameIn.size.height = frameIn.size.width/aspectRatio;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    }&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    [super setFrame:frameIn];&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;  &lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="arial, helvetica, sans-serif"&gt;This kind of programming is not my strong suit, but with a few minutes goofing around in Excel, it was easy to figure out. And it works.&lt;/font&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-1287218673671914974?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/1287218673671914974/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=1287218673671914974' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1287218673671914974'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1287218673671914974'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/09/lock-aspect-ratio-to-max.html' title='Lock Aspect Ratio to Max'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-6495429211795834819</id><published>2011-09-05T13:25:00.000-03:00</published><updated>2011-09-16T10:30:14.544-03:00</updated><title type='text'>Parameters into iOS Apps, XCode 4.x</title><content type='html'>I needed to get arguments and version numbers and so forth into an iOS app.&lt;br /&gt;The arguments come in via the Scheme. You can have one scheme per target, or one scheme per multiple targets. I'm using arguments in the format paramOne=35.5 paramTwo=release&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;BR&gt;&lt;a href="http://4.bp.blogspot.com/-KH-vzvKrgQQ/TmT2gUlIKYI/AAAAAAAAAAQ/vvDHaUx2Qdw/s1600/build-arguments.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="194" src="http://4.bp.blogspot.com/-KH-vzvKrgQQ/TmT2gUlIKYI/AAAAAAAAAAQ/vvDHaUx2Qdw/s320/build-arguments.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;BR&gt;Then you can pick up the arguments like this:&lt;br /&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;        NSMutableDictionary *arguments = [NSMutableDictionary dictionary];        for (NSString *argument in [[NSProcessInfo processInfo] arguments]) {            NSRange equalsSign = [argument rangeOfString:@"="];            if(equalsSign.location != NSNotFound)            {                NSString *key = [argument substringToIndex:equalsSign.location];                NSString *value = [argument substringFromIndex:equalsSign.location + equalsSign.length];                [arguments setValue:value forKey:key];            }        }&lt;/script&gt;&lt;br /&gt;Version numbers, differently, come in via the target. You get a "version" number and a "build" number. &lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;BR&gt;&lt;a href="http://4.bp.blogspot.com/-zH0ULIZb9ho/TmT3G4huqLI/AAAAAAAAAAY/GeyrzpM81n8/s1600/build-version.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" height="174" src="http://4.bp.blogspot.com/-zH0ULIZb9ho/TmT3G4huqLI/AAAAAAAAAAY/GeyrzpM81n8/s320/build-version.png" width="320" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;BR&gt;Then you can pick up the build and version with something like this&lt;br /&gt;&lt;BR&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;+ (NSString*) version {    NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleShortVersionString"];    NSString *build = [[[NSBundle mainBundle] infoDictionary] objectForKey:@"CFBundleVersion"];    return [[NSString alloc] initWithFormat:@"%@ build %@", version, build];}&lt;/script&gt;&lt;BR&gt;Yet another way, from my colleague Jose at Thingee:&lt;BR&gt;&lt;BR&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-HuCDsBavay4/TnNOmm3c1KI/AAAAAAAAAAg/ZU4U68D0RBs/s1600/dcompile-flags.png" imageanchor="1" style="margin-left:1em; margin-right:1em"&gt;&lt;img border="0" height="182" width="320" src="http://4.bp.blogspot.com/-HuCDsBavay4/TnNOmm3c1KI/AAAAAAAAAAg/ZU4U68D0RBs/s320/dcompile-flags.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;BR&gt;&lt;script class="brush: java" type="syntaxhighlighter"&gt;#if COMPILE_DEBUG    NSLog(@"In debug mode");#else    NSLog(@"In release mode");#endif&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-6495429211795834819?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/6495429211795834819/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=6495429211795834819' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/6495429211795834819'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/6495429211795834819'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/09/parameters-into-ios-apps-xcode-4x.html' title='Parameters into iOS Apps, XCode 4.x'/><author><name>Dan Rosenstark</name><uri>http://www.blogger.com/profile/00767517859104928654</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='24' height='32' src='http://1.bp.blogspot.com/-X92tbA6tuQ0/Tw-tcNx_fhI/AAAAAAAAAAw/Gf_pa2LUIBg/s220/P1010546%2Bcopy.JPG'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-KH-vzvKrgQQ/TmT2gUlIKYI/AAAAAAAAAAQ/vvDHaUx2Qdw/s72-c/build-arguments.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-5338393898507306257</id><published>2011-08-28T14:33:00.000-03:00</published><updated>2011-08-28T14:34:24.695-03:00</updated><title type='text'>Regular Expressions for Those Nasty Autorelease Statements in ARC Migration</title><content type='html'>&lt;p class="mobile-photo"&gt;&lt;a href="http://3.bp.blogspot.com/-rtybBpzABpU/Tlp8IAxK5GI/AAAAAAAADz8/KM1JV06h6y0/s1600/replacing-those-nasty-autorelease-statements-764696.png"&gt;&lt;img src="http://3.bp.blogspot.com/-rtybBpzABpU/Tlp8IAxK5GI/AAAAAAAADz8/KM1JV06h6y0/s320/replacing-those-nasty-autorelease-statements-764696.png"  border="0" alt="" id="BLOGGER_PHOTO_ID_5645961559949370466" /&gt;&lt;/a&gt;&lt;/p&gt;Maybe I&amp;#39;m missing something and the &amp;quot;migrate to ARC&amp;quot; tool in the XCode 4.2 Beta replaces your autorelease statements, but that&amp;#39;s not what I&amp;#39;ve found. Please correct me if I&amp;#39;m wrong. &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Here&amp;#39;s a simple regex replace in Textmate for changing lines like:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;[[[Thing alloc] initWithWhatever:whoever] autorelease];&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;to &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;[[Thing alloc] initWithWhatever:whoever];&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;The regex is &lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;(\[\[\[)([^\]]*\][^\]]*\])(\ autorelease\]);&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;and the replacement string is:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;  &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;[[$2;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Then I needed to fix these lines&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;for (Thinger *thing in [thingers copy] autorelease])&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;and I used regex:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;(\[)([^\]]*\][^\]]*)(\ autorelease\])&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;and the replacement string is:&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;$2&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-5338393898507306257?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/5338393898507306257/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=5338393898507306257' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5338393898507306257'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5338393898507306257'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/08/regular-expressions-for-those-nasty.html' title='Regular Expressions for Those Nasty Autorelease Statements in ARC Migration'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-rtybBpzABpU/Tlp8IAxK5GI/AAAAAAAADz8/KM1JV06h6y0/s72-c/replacing-those-nasty-autorelease-statements-764696.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-766947376259286698</id><published>2011-05-17T16:18:00.005-03:00</published><updated>2011-09-08T15:04:21.471-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='microsoft-sql'/><title type='text'>Backing up an MS SQL 2008 Database with Metadata Intact</title><content type='html'>&lt;div class="mobile-photo"&gt;&lt;/div&gt;&lt;div class="mobile-photo"&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;In a strange time machine recently which has taken me back to ASP (which still feels higher GL than reference counting in Objective-C, but whatever), I'm dealing with a shopping cart vendor on that platform. I explain that I have the entire system (website) copied over, but two functions aren't working. When I describe the symptoms, he writes, "Based on your comments I am about 99% sure the issue was the database transfer.  The primary keys were probably dropped." So he writes, check the docs, which say, essentially, get a DBA. Ironically, they were the same docs I was following when I decided not to call a DBA. Primary keys!? Oh yeah, right.&amp;nbsp;&lt;/div&gt;&lt;br /&gt;So how do you transfer a Microsoft SQL 2008 DB with Enterprise Manager and the kind of permissions they give you on a shared cheapo server somewhere like Winhost?&lt;br /&gt;&lt;br /&gt;There are many false paths. First, do not do what I did, which drops the primary keys and any relevant meta-information about the DB:&lt;br /&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-onj4Mm4es1I/TdLOR6VeW5I/AAAAAAAADfk/I37Zz3gQuyU/s1600/mssql2008-export-data.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-onj4Mm4es1I/TdLOR6VeW5I/AAAAAAAADfk/I37Zz3gQuyU/s1600/mssql2008-export-data.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;Do not try to backup or mirror, as both of these are dead ends due to permissions issues:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-8HcjYl9W5gk/TdLOWJ2_C0I/AAAAAAAADfo/uGUs7ZuSi8Y/s1600/mssql2008-backup.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-8HcjYl9W5gk/TdLOWJ2_C0I/AAAAAAAADfo/uGUs7ZuSi8Y/s1600/mssql2008-backup.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;You have to script it. But do NOT use this!&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://3.bp.blogspot.com/-GHA3UdsssvQ/TdLLcM_p3eI/AAAAAAAADfY/79oO5Nbh4qs/s1600/mssql-script-database-as.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://3.bp.blogspot.com/-GHA3UdsssvQ/TdLLcM_p3eI/AAAAAAAADfY/79oO5Nbh4qs/s1600/mssql-script-database-as.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;Instead you have to use:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://2.bp.blogspot.com/-4Nua2gmpH0Q/TdLLkCIxcXI/AAAAAAAADfc/msVX_7Mai-Q/s1600/mssql-tasks-generate-scripts.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://2.bp.blogspot.com/-4Nua2gmpH0Q/TdLLkCIxcXI/AAAAAAAADfc/msVX_7Mai-Q/s1600/mssql-tasks-generate-scripts.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;It's mostly intuitive, but use these options:&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: center;"&gt;&lt;a href="http://4.bp.blogspot.com/-SU2EQWvnJyo/TdLLtQfdoaI/AAAAAAAADfg/ITVu_uk3C0A/s1600/mssql-scripting-options.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"&gt;&lt;img border="0" src="http://4.bp.blogspot.com/-SU2EQWvnJyo/TdLLtQfdoaI/AAAAAAAADfg/ITVu_uk3C0A/s1600/mssql-scripting-options.png" /&gt;&lt;/a&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;And then you have a query which you can execute as if you had typed it by hand.&lt;/span&gt;&lt;/div&gt;&lt;div class="separator" style="clear: both; text-align: left;"&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: Helvetica;"&gt;&lt;b&gt;Update:&amp;nbsp;&lt;/b&gt;You should set "If not exists" to Yes and "indexes" to "Yes" too.&lt;/span&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-766947376259286698?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/766947376259286698/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=766947376259286698' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/766947376259286698'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/766947376259286698'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/05/backing-up-ms-sql-2008-database-with.html' title='Backing up an MS SQL 2008 Database with Metadata Intact'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://4.bp.blogspot.com/-onj4Mm4es1I/TdLOR6VeW5I/AAAAAAAADfk/I37Zz3gQuyU/s72-c/mssql2008-export-data.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4359164025528766049</id><published>2011-05-05T20:10:00.000-03:00</published><updated>2011-05-05T20:11:01.249-03:00</updated><title type='text'>Rails 2.3x and Gem Hell</title><content type='html'>Today I hit up against two of my favorite problems in Rails 2.3x, or maybe both at once. This is a play by play with no additional info. It&amp;#39;s mostly here for me, but if someone else finds it useful, great. The reason that I need to document most of this is that my brilliant coworker, Sean, fed me a lot of the lines here. &lt;div&gt;  &lt;br&gt;&lt;/div&gt;&lt;div&gt;First error: the Rails install was 2.3.8 and on deploy to the server the message was:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta http-equiv="Content-Style-Type" content="text/css"&gt; &lt;title&gt;&lt;/title&gt; &lt;meta name="Generator" content="Cocoa HTML Writer"&gt; &lt;meta name="CocoaVersion" content="1038.35"&gt; &lt;style type="text/css"&gt; p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Lucida Grande'} &lt;/style&gt;   &lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;uninitialized constant ActiveSupport::Dependencies::Mutex&lt;/font&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;Which led me to &lt;a href="http://stackoverflow.com/questions/5176782/uninitialized-constant-activesupportdependenciesmutex-nameerror/5554370#5554370"&gt;this post&lt;/a&gt; on SO. So my choices were two: either upgrade the Rails installation or downgrade my rubygems system.&lt;/p&gt;  &lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;I opted for upgrading Rails, of course.&lt;/p&gt;&lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta http-equiv="Content-Style-Type" content="text/css"&gt; &lt;title&gt;&lt;/title&gt; &lt;meta name="Generator" content="Cocoa HTML Writer"&gt; &lt;meta name="CocoaVersion" content="1038.35"&gt; &lt;style type="text/css"&gt; p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Lucida Grande'} &lt;/style&gt;   &lt;/p&gt;&lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;sudo gem install rails --version=2.3.11&lt;/font&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;I updated the environment.rb, deleted the vendorized version of Rails and tried to vendorize the new one:&lt;/p&gt;  &lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta http-equiv="Content-Style-Type" content="text/css"&gt; &lt;title&gt;&lt;/title&gt; &lt;meta name="Generator" content="Cocoa HTML Writer"&gt; &lt;meta name="CocoaVersion" content="1038.35"&gt; &lt;style type="text/css"&gt; p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Lucida Grande'} &lt;/style&gt;   &lt;/p&gt;&lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;rake rails:freeze:gems&lt;/font&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;Could not vendor with problem:&lt;/p&gt;&lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;  &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta http-equiv="Content-Style-Type" content="text/css"&gt; &lt;title&gt;&lt;/title&gt; &lt;meta name="Generator" content="Cocoa HTML Writer"&gt; &lt;meta name="CocoaVersion" content="1038.35"&gt; &lt;style type="text/css"&gt; p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px 'Lucida Grande'} &lt;/style&gt;   &lt;/p&gt;&lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;undefined method `version_requirements&amp;#39; for #&amp;lt;Gem::Dependency:0x10055b0d0&amp;gt;&lt;/font&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;  To fix this, I needed to follow the instructions &lt;a href="https://gist.github.com/807008"&gt;here&lt;/a&gt;, which were basically &lt;/p&gt;&lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;gem install rubygems-update -v=&amp;#39;1.4.2&amp;#39;&lt;/font&gt;&lt;/p&gt;  &lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;gem uninstall rubygems-update -v=&amp;#39;1.5.0&amp;#39;&lt;/font&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;update_rubygems&lt;/font&gt;&lt;/p&gt;  &lt;p&gt;&lt;/p&gt;&lt;p class="p1"&gt;However, at this point I had already screwed up my RubyGems by doing a &lt;/p&gt;&lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;sudo gem update --system&lt;/font&gt;&lt;/p&gt;  &lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;and I ended up at 1.8.0 with a whole bunch of deprecation warnings &lt;b&gt;and intermediate versions of RubyGems&lt;/b&gt;. So first I had to uninstall all the unwanted versions. So I listed them:&lt;/p&gt;  &lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8"&gt; &lt;meta http-equiv="Content-Style-Type" content="text/css"&gt; &lt;title&gt;&lt;/title&gt; &lt;meta name="Generator" content="Cocoa HTML Writer"&gt; &lt;meta name="CocoaVersion" content="1038.35"&gt; &lt;style type="text/css"&gt; p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px Helvetica} &lt;/style&gt;   &lt;/p&gt;&lt;p class="p1"&gt; &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;gem list | grep rubygems&lt;/font&gt;&lt;/p&gt;&lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;and then proceded to run &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;gem uninstall rubygems-update -v=&amp;#39;1.x.x&amp;#39; &lt;/font&gt;on each except the last one. Then I followed the three lines above. &lt;/p&gt;  &lt;p class="p1"&gt;&lt;br&gt;&lt;/p&gt;&lt;p class="p1"&gt;This allowed me to vendorize the right Rails version and I was cooking, just 35 minutes later. Well, really 70 person-minutes later, at least. Thanks Sean!&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;p&gt;&lt;/p&gt;&lt;/div&gt;  &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4359164025528766049?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4359164025528766049/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4359164025528766049' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4359164025528766049'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4359164025528766049'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/05/rails-23x-and-gem-hell.html' title='Rails 2.3x and Gem Hell'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7336956688691298869</id><published>2011-03-31T17:01:00.000-03:00</published><updated>2011-03-31T17:02:08.633-03:00</updated><title type='text'>Wimpy OSX! Nano for everything!</title><content type='html'>So one of the things I never asked was how to use nano as the default editor on OSX. I&amp;#39;d always run piecemeal commands like this &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;git config --global core.editor &amp;quot;nano&amp;quot;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;but it makes a lot more sense, in most cases, to use&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;export EDITOR=nano&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;unless you want to use vi for some things and nano for others.&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7336956688691298869?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7336956688691298869/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7336956688691298869' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7336956688691298869'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7336956688691298869'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/03/wimpy-osx-nano-for-everything.html' title='Wimpy OSX! Nano for everything!'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-1219360164772770413</id><published>2011-02-23T09:33:00.001-03:00</published><updated>2011-02-23T09:33:40.144-03:00</updated><title type='text'>Autocomplete with BBEdit</title><content type='html'>&lt;p class="mobile-photo"&gt;&lt;a href="http://3.bp.blogspot.com/-s7gpoYcxWQ4/TWT-pCBc75I/AAAAAAAADc4/YIQLqJ5jc8s/s1600/Screen%2Bshot%2B2011-02-20%2Bat%2B7.10.31%2BPM-720145.png"&gt;&lt;img src="http://3.bp.blogspot.com/-s7gpoYcxWQ4/TWT-pCBc75I/AAAAAAAADc4/YIQLqJ5jc8s/s320/Screen%2Bshot%2B2011-02-20%2Bat%2B7.10.31%2BPM-720145.png"  border="0" alt="" id="BLOGGER_PHOTO_ID_5576862219462569874" /&gt;&lt;/a&gt;&lt;/p&gt;This is my nightmare of autocomplete: Visual Studio was 100x better than this 10 years ago. Autocomplete in BBEdit on OSX fails utterly to pick up relevant cues from context. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-1219360164772770413?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/1219360164772770413/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=1219360164772770413' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1219360164772770413'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1219360164772770413'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/02/autocomplete-with-bbedit.html' title='Autocomplete with BBEdit'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/-s7gpoYcxWQ4/TWT-pCBc75I/AAAAAAAADc4/YIQLqJ5jc8s/s72-c/Screen%2Bshot%2B2011-02-20%2Bat%2B7.10.31%2BPM-720145.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7176196293083580978</id><published>2011-02-15T20:11:00.001-03:00</published><updated>2011-02-15T20:11:49.985-03:00</updated><title type='text'>More Boilerplate Code for Obj-C Done In Ruby</title><content type='html'># excuse this terrible code, but sometimes you want a solution now&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;meta charset="utf-8"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;courier new&amp;#39;, monospace; "&gt;# put your text in between the TEXT markers&lt;/span&gt;&lt;/div&gt;  &lt;div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;courier new&amp;#39;, monospace; "&gt;text = &amp;lt;&amp;lt;-TEXT&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@property (nonatomic, retain) IBOutlet UIWindow *window;&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@property (nonatomic, retain) IBOutlet UIViewController *viewController;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@property (nonatomic, retain) IBOutlet CentralNavController *navController;&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@property (nonatomic, retain) IBOutlet SplashController *splash;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;TEXT&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;puts &amp;quot;// Generated by #{$0.split(&amp;#39;/&amp;#39;).last}&amp;quot;&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;text.lines.each do |line|&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;  variable_name = line.split(&amp;quot;*&amp;quot;)[1].chomp(&amp;quot;;\n&amp;quot;);&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;  puts &amp;quot;self.#{variable_name} = nil;&amp;quot;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;end&lt;/font&gt;&lt;/div&gt;  &lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7176196293083580978?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7176196293083580978/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7176196293083580978' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7176196293083580978'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7176196293083580978'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/02/more-boilerplate-code-for-obj-c-done-in.html' title='More Boilerplate Code for Obj-C Done In Ruby'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-2437874877451224149</id><published>2011-02-02T17:32:00.001-03:00</published><updated>2011-02-02T17:33:08.254-03:00</updated><title type='text'>Simplest Example: Hierarchical Plist in iOS and Rails</title><content type='html'>These examples are based directly on &lt;a href="http://iphonedevelopertips.com/data-file-management/reading-a-plist-into-an-nsarray.html"&gt;this article, Reading a Plist into an NSArray&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The Plist&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;lt;?xml version=&lt;span style="color: #e90000;"&gt;"1.0"&lt;/span&gt; encoding=&lt;span style="color: #e90000;"&gt;"UTF-8"&lt;/span&gt;?&amp;gt;&lt;/div&gt;&lt;div style="color: #3000ff; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #d200a5;"&gt;&amp;lt;!DOCTYPE plist PUBLIC &lt;/span&gt;&lt;span style="color: #e90000;"&gt;"-//Apple//DTD PLIST 1.0//EN"&lt;/span&gt;&lt;span style="color: #d200a5;"&gt; &lt;/span&gt;&lt;span style="color: #e90000;"&gt;"&lt;a href="http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;&lt;span style="color: #3000ff;"&gt;http://www.apple.com/DTDs/PropertyList-1.0.dtd&lt;/span&gt;&lt;/a&gt;"&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;lt;plist &lt;span style="color: #9b8129;"&gt;version&lt;/span&gt;=&lt;span style="color: #e90000;"&gt;"1.0"&lt;/span&gt;&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;lt;dict&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&amp;lt;key&amp;gt;&lt;span style="color: black;"&gt;Region 1&lt;/span&gt;&amp;lt;/key&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&amp;lt;array&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&amp;lt;string&amp;gt;&lt;span style="color: black;"&gt;John Bob&lt;/span&gt;&amp;lt;/string&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&amp;lt;string&amp;gt;&lt;span style="color: black;"&gt;Billy Ray&lt;/span&gt;&amp;lt;/string&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&amp;lt;/array&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&amp;lt;key&amp;gt;&lt;span style="color: black;"&gt;Region 2&lt;/span&gt;&amp;lt;/key&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&amp;lt;array&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&amp;lt;string&amp;gt;&lt;span style="color: black;"&gt;John Bob's Bro&lt;/span&gt;&amp;lt;/string&amp;gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;&amp;lt;string&amp;gt;&lt;/span&gt;Frankie Sanders&lt;span style="color: #d200a5;"&gt;&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&amp;lt;/array&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;lt;/dict&amp;gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;lt;/plist&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and the code&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSString&lt;/span&gt;&lt;span style="color: black;"&gt; *path = [[&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSBundle&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;mainBundle&lt;span style="color: black;"&gt;] &lt;/span&gt;pathForResource&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #e90000;"&gt;@"regions"&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;ofType&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #e90000;"&gt;@"plist"&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSDictionary&lt;/span&gt;&lt;span style="color: black;"&gt; *regions = [[[&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSDictionary&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;alloc&lt;span style="color: black;"&gt;] &lt;/span&gt;initWithContentsOfFile&lt;span style="color: black;"&gt;:path] &lt;/span&gt;autorelease&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;for&lt;/span&gt; (&lt;span style="color: #7e11ad;"&gt;NSString&lt;/span&gt; *region &lt;span style="color: #d200a5;"&gt;in&lt;/span&gt; regions) {&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSArray&lt;/span&gt; *array = [regions &lt;span style="color: #480085;"&gt;objectForKey&lt;/span&gt;:region];&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;for&lt;/span&gt; (&lt;span style="color: #7e11ad;"&gt;NSString&lt;/span&gt; *representative &lt;span style="color: #d200a5;"&gt;in&lt;/span&gt; array) {&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;   &lt;/span&gt;&lt;span style="color: #480085;"&gt;NSLog&lt;/span&gt;(&lt;span style="color: #e90000;"&gt;@"rep=%@, region=%@"&lt;/span&gt;, representative, region);&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;}&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;If you're dealing with a plist, the file is read in one giant gulp, so if you have memory problems, you'll have to use CoreData, and I don't think XML can be the backing store.&lt;br /&gt;&lt;br /&gt;So what's the simplest code to read this same plist in Rails?&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Arial, 'Liberation Sans', 'DejaVu Sans', sans-serif; font-size: 14px; line-height: 18px;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;pre class="default prettyprint" style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 10px; margin-left: 0px; margin-right: 0px; margin-top: 0px; max-height: 600px; overflow-x: auto; overflow-y: auto; padding-bottom: 5px; padding-left: 5px; padding-right: 5px; padding-top: 5px; vertical-align: baseline; width: auto;"&gt;&lt;code style="background-attachment: initial; background-clip: initial; background-color: #eeeeee; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; font-family: Consolas, Menlo, Monaco, 'Lucida Console', 'Liberation Mono', 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Courier New', monospace, serif; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;require&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="str" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;'test_helper'&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;class&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;ReadPlistTest&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&amp;lt;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;ActiveSupport&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;::&lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;TestCase&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; test &lt;/span&gt;&lt;span class="str" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;"recover names of regions and names of reps"&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;do&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;require&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="str" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;"rexml/document"&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; file &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;File&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;new&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="str" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;"../data/regions.plist"&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;)&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="com" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;# we're run from test, otherwise it'd be /data/regions.plist&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; doc &amp;nbsp;&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; REXML&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;::&lt;/span&gt;&lt;span class="typ" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: #2b91af; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;Document&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;new&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; file&lt;br /&gt;&amp;nbsp; &amp;nbsp; region_names &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[]&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; doc&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;elements&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;each&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="str" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;"plist/dict/key"&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;)&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;{&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;|&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;element&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;|&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; region_names &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; element&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;text &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;}&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; regions &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;{}&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; i &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="lit" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;0&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &amp;nbsp; &amp;nbsp;&lt;/span&gt;&lt;span class="com" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: grey; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;# can't use each_with_index&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; doc&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;elements&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;each&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="str" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;"plist/dict/array"&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;)&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;do&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;|&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;element&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;|&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; region &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[]&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; regions&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;region_names&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;[&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;i&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;]]&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;=&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; region&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; element&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;each_element&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="str" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;"string"&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;)&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;{&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;|&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;thing&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;|&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; region &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&amp;lt;&amp;lt;&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt; thing&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;text &lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;}&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; i&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;+=&lt;/span&gt;&lt;span class="lit" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: maroon; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;1&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;end&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &amp;nbsp; puts regions&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;count&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;.&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;to_s&lt;br /&gt;&amp;nbsp; &amp;nbsp; puts y&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;(&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;regions&lt;/span&gt;&lt;span class="pun" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;)&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&lt;br /&gt;&amp;nbsp; &lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;end&lt;/span&gt;&lt;span class="pln" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: black; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="kwd" style="background-attachment: initial; background-clip: initial; background-color: transparent; background-image: initial; background-origin: initial; background-position: initial initial; background-repeat: initial initial; border-bottom-width: 0px; border-color: initial; border-left-width: 0px; border-right-width: 0px; border-style: initial; border-top-width: 0px; color: darkblue; font-size: 14px; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; padding-bottom: 0px; padding-left: 0px; padding-right: 0px; padding-top: 0px; vertical-align: baseline;"&gt;end&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-2437874877451224149?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/2437874877451224149/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=2437874877451224149' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2437874877451224149'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2437874877451224149'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/02/simplest-example-hierarchical-plist-in.html' title='Simplest Example: Hierarchical Plist in iOS and Rails'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-8137867904799398769</id><published>2011-02-02T14:47:00.003-03:00</published><updated>2011-05-16T16:07:02.739-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='rails'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby-on-rails'/><category scheme='http://www.blogger.com/atom/ns#' term='rails-3'/><title type='text'>DRY Way to Read CSV File Into ActiveRecord Model</title><content type='html'>&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: arial, helvetica, sans-serif;"&gt;I've been looking for a DRY way to do this for a while.&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;require "csv"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;file_path = "data/lunar-lander-1520turbo.csv"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;  &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;# define columns, symbols MUST be column names in module&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;names = {}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;names[:lander_name] = names.length&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;names[:wing] = names.length&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;names[:wheel] = names.length&amp;nbsp;&lt;/div&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;names[:wheel_base] = 95&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;start = true&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;CSV.open(file_path, 'r') do |row|&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;if start # skip first row&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;start = false&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;else&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;puts "Creating #{row[names[:lander_name]]}"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;m = MobileDevice.new&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;names.each_key { |name| m[name] = row[names[name]] }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;m.save&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp;end&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;end&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-8137867904799398769?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/8137867904799398769/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=8137867904799398769' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/8137867904799398769'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/8137867904799398769'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/02/dry-way-to-read-csv-file-into.html' title='DRY Way to Read CSV File Into ActiveRecord Model'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4552959066632257100</id><published>2011-01-30T15:00:00.000-03:00</published><updated>2011-01-30T15:01:14.673-03:00</updated><title type='text'>Me on IDEs, Again</title><content type='html'>&lt;p class="mobile-photo"&gt;&lt;a href="http://3.bp.blogspot.com/_QFCElrKyI6g/TUWnbGx7fiI/AAAAAAAADcs/sZ95gdEwCTw/s1600/Screen%2Bshot%2B2011-01-30%2Bat%2B12.59.53%2BPM-774674.png"&gt;&lt;img src="http://3.bp.blogspot.com/_QFCElrKyI6g/TUWnbGx7fiI/AAAAAAAADcs/sZ95gdEwCTw/s320/Screen%2Bshot%2B2011-01-30%2Bat%2B12.59.53%2BPM-774674.png"  border="0" alt="" id="BLOGGER_PHOTO_ID_5568040598431825442" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;a href="http://programmers.stackexchange.com/questions/39798/being-ide-dependent-how-can-it-harm-me/41459#41459"&gt;Me on IDEs yet again.&lt;/a&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4552959066632257100?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4552959066632257100/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4552959066632257100' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4552959066632257100'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4552959066632257100'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/01/me-on-ides-again.html' title='Me on IDEs, Again'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_QFCElrKyI6g/TUWnbGx7fiI/AAAAAAAADcs/sZ95gdEwCTw/s72-c/Screen%2Bshot%2B2011-01-30%2Bat%2B12.59.53%2BPM-774674.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-3638638939217384167</id><published>2011-01-17T15:02:00.003-03:00</published><updated>2011-01-18T16:07:24.330-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='objective-resource objective-c ruby'/><title type='text'>What Does Your Obj-C Code Look Like?</title><content type='html'>With a little help from Ruby, mine looks like this&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;example_model = ExhibitContributionSponsorship.new&lt;br /&gt;field_names = example_model.attribute_names&lt;br /&gt;field_names.collect! do |field_name|&lt;br /&gt;&amp;nbsp;&amp;nbsp;splitOut = field_name.split("_");&lt;br /&gt;&amp;nbsp;&amp;nbsp;splitOut.collect! { |piece| piece==splitOut.first ? piece : piece.capitalize }&lt;br /&gt;&amp;nbsp;&amp;nbsp;splitOut.join&lt;br /&gt;end&lt;br /&gt;&lt;br /&gt;field_names.each { |field| puts "@property (nonatomic retain) NSString *#{field};" }&lt;br /&gt;synthesize = "@synthesize "&lt;br /&gt;synthesize &amp;lt;&amp;lt; field_names.join(", ")&lt;br /&gt;puts synthesize&lt;br /&gt;&lt;br /&gt;field_names.each { |field| puts "@property (nonatomic retain) IBOutlet UITextField *#{field}Control;" }&lt;br /&gt;synthesize = "@synthesize "&lt;br /&gt;synthesize &amp;lt;&amp;lt; field_names.collect.join(", ")&lt;br /&gt;puts synthesize&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;I used to use Excel, but Ruby is cooler.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-3638638939217384167?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/3638638939217384167/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=3638638939217384167' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3638638939217384167'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3638638939217384167'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/01/what-does-your-obj-c-code-look-like.html' title='What Does Your Obj-C Code Look Like?'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7019211536022286770</id><published>2011-01-11T11:40:00.001-03:00</published><updated>2011-01-18T14:00:53.038-03:00</updated><title type='text'>Why ObjectiveResource Sucks</title><content type='html'>&lt;i&gt;I could be wrong about this, so feel free to school me. Until then...&lt;/i&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I've been screwing around with &lt;a href="http://iphoneonrails.com/"&gt;ObjectiveResource&lt;/a&gt; for a bit and comparing it as an option to &lt;a href="http://allseeing-i.com/ASIHTTPRequest/"&gt;ASIHTTP&lt;/a&gt;&amp;nbsp;until I realized that &lt;b&gt;even&lt;/b&gt; &lt;b&gt;I &lt;/b&gt;can tell how bad ObjectiveResource is, so it must really suck. Why?&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;Overall architectural choice: Categories Only&lt;/b&gt;&amp;nbsp;- these guys are Rubyists and they code like it. Ruby is an interpreted (read "slow") language which is only run in environments where it's fast enough (and with modern computers, those are many). Obj-C (especially on iPhone) ain't Ruby, so the choice to use &lt;b&gt;categories instead of inheritance&lt;/b&gt;&amp;nbsp;for your objects, while cute, costs the library dearly. Categories cannot, by definition, hold state, so you have to build the entire state every time you need something. This results in very inefficient code. As an example, put an NSLog in any of the methods of the&amp;nbsp;&lt;span class="Apple-style-span" style="color: #e90000; font-family: Menlo; font-size: 10px;"&gt;NSObject+PropertySupport&amp;nbsp;&lt;/span&gt;and watch 'er spin for even the simplest Web Services call. "No premature optimization" is not a get-out-of-jail pass.&amp;nbsp;&lt;/li&gt;&lt;li&gt;&lt;b&gt;Overall architectural choice: Focus On Crud&lt;/b&gt;&amp;nbsp;- I actually enjoy a good Scaffold now and again, having built major admin portions of sites that rely on &amp;nbsp;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;map.resources&lt;/span&gt; (now in Rails 3, just &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;resources&lt;/span&gt;), but you'll need more than create-read-update-delete if your app is actually going to be more than a few milliseconds away from your server. Then you'd have to think about how to aggregate, and how to call other methods. There is a method called:&amp;nbsp;&lt;span class="Apple-style-span" style="font-family: Menlo; font-size: 11.6667px;"&gt;- (&lt;span class="s1"&gt;BOOL&lt;/span&gt;)createRemoteWithParameters:(&lt;span class="s2"&gt;NSDictionary&lt;/span&gt; *)parameters andResponse:(&lt;span class="s2"&gt;NSError&lt;/span&gt; **)aError;&amp;nbsp;&lt;/span&gt;I wonder what that does. Which leads to:&lt;/li&gt;&lt;li&gt;&lt;b&gt;No Documentation At All&lt;/b&gt;&amp;nbsp;- I mean the kind where you look at the .h and it tells you what methods actually do. But I guess if you're a Rubyist you consider all code to be self-documenting. Isn't true in Ruby, and it isn't true here. There is a five-minute walkthrough and a jumpstart.&lt;/li&gt;&lt;li&gt;&lt;b&gt;No Concept of Async&lt;/b&gt;&amp;nbsp;- While I would love to run my stuff in performInBackgroundThread, that's not really how serious business is done. Check out ASIHTTP to see how to actually do async correctly, &lt;b&gt;and provide examples of it&lt;/b&gt;.&lt;/li&gt;&lt;li&gt;&lt;b&gt;No Concept of Failure&lt;/b&gt;&amp;nbsp;- that's right. If your Rails site is down, ObjectiveResource doesn't throw any Exceptions. &lt;b&gt;In fact, it returns answers just like those you expect, only with incorrect values.&lt;/b&gt; It's like that employee you don't want to have, who just pretends that there are no problems while they make a small problem into a large one.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;I could probably go on, but I have to finish a CRUD layer for ASIHTTP (or maybe just do some HelloWorlds and start running). I'm sure I'll be stealing lots of code from ObjectiveResource anyway.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Update&lt;/b&gt;: The thought of doubling my code on the client and server side was just too much to take, so I'm taking another look at ObjectiveResource. Coming back to a project after a pause often provides perspective. &lt;b&gt;At least #5 is wrong&lt;/b&gt;. Here's the code to get it to work:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #6e37aa;"&gt;NSError&lt;/span&gt; *error = &lt;span style="color: #b424a3;"&gt;nil&lt;/span&gt;;&lt;/div&gt;&lt;div style="color: #36595d; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #6e37aa;"&gt;NSArray&lt;/span&gt;&lt;span style="color: black;"&gt; *posts = [&lt;/span&gt;&lt;span style="color: #548087;"&gt;Post&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;findAllRemoteWithResponse&lt;span style="color: black;"&gt;:&amp;amp;error];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #b424a3;"&gt;if&lt;/span&gt; (error)&lt;/div&gt;&lt;div style="color: #ca2f22; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3c1581;"&gt;NSLog&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;@"yes this is an error"&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #b424a3; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;else&lt;span style="color: black;"&gt; {&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #ca2f22; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #3c1581;"&gt;NSLog&lt;/span&gt;&lt;span style="color: black;"&gt;(&lt;/span&gt;@"NO Error! Groovy"&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7019211536022286770?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7019211536022286770/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7019211536022286770' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7019211536022286770'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7019211536022286770'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/01/why-objectiveresource-sucks.html' title='Why ObjectiveResource Sucks'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7330404553658681514</id><published>2011-01-11T11:07:00.003-03:00</published><updated>2011-01-11T11:11:47.693-03:00</updated><title type='text'>ObjectiveResource Bug Fix</title><content type='html'>&lt;div class="gmail_quote"&gt;&lt;div&gt;Needing to do some Rails-iOS bridging, I've been checking out &lt;a href="http://iphoneonrails.com/" target="_blank"&gt;ObjectiveResource&lt;/a&gt;. At first I thought it was dated and also checked out the wonderfully documented and loved &lt;a href="http://allseeing-i.com/ASIHTTPRequest/" target="_blank"&gt;ASIHTTP request&lt;/a&gt;, which does indeed rock. But really, why parse when you can freeload?&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The only problems I've found with ObjectiveResource is&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;How terribly the Google Groups forum works for solving problems. It's also notorious how few comments there are in the code.&lt;/li&gt;&lt;li&gt;It's pathetically synchronous, or perhaps there are just no docs for that.&amp;nbsp;&lt;/li&gt;&lt;li&gt;If I bring down the Rails server it immediately returns wrong answers, which is just so disheartening I don't know why I didn't give up on it hours ago.&lt;/li&gt;&lt;li&gt;The following problem, which I spent over an hour fixing just now. To be honest, I'm not sure why the fix works exactly, but it's the right fix.&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;The problem is that ObjectiveResource blows up under iOS 4.x. I actually forget where the call is made to cause it to blow up, but the blowup begins by infinitely recursing and calling a method on&amp;nbsp;&lt;span style="color: #e90000; font-family: Menlo; font-size: 11.6667px;"&gt;NSObject+PropertySupport.h&amp;nbsp;&lt;/span&gt;called&amp;nbsp;&lt;span style="color: #e90000; font-family: Menlo; font-size: 11.6667px;"&gt;propertyNamesAndTypes&lt;/span&gt;. The fascinating thing about the problem is that the line that causes the blowup is&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;style type="text/css"&gt; p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo} span.s1 {color: #480085} span.s2 {color: #d200a5} span.s3 {color: #1b5a5e} &lt;/style&gt;   &lt;br /&gt;&lt;div class="p1"&gt;[propertyNames &lt;span class="s1"&gt;setObject&lt;/span&gt;:[&lt;span class="s2"&gt;self&lt;/span&gt; &lt;span class="s3"&gt;getPropertyType&lt;/span&gt;:type] &lt;span class="s1"&gt;forKey&lt;/span&gt;:propName];&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and it's actually the calling of setObject that causes the recursion to spin. I still have no idea why this happens, but here's the fix. Change this line&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;style type="text/css"&gt; p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo} span.s1 {color: #d200a5} span.Apple-tab-span {white-space:pre} &lt;/style&gt;   &lt;br /&gt;&lt;div class="p1"&gt;&lt;span class="s1"&gt;while&lt;/span&gt; (currentClass != &lt;span class="s1"&gt;nil&lt;/span&gt;) {&lt;span class="Apple-tab-span"&gt; &lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;to this&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;style type="text/css"&gt; p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 13.0px Menlo} span.s1 {color: #d200a5} span.s2 {color: #7e11ad} span.s3 {color: #480085} &lt;/style&gt;   &lt;br /&gt;&lt;div class="p1"&gt;&lt;span class="s1"&gt;while&lt;/span&gt; (currentClass != &lt;span class="s1"&gt;nil&lt;/span&gt; &amp;amp;&amp;amp; [&lt;span class="s2"&gt;NSObject&lt;/span&gt; &lt;span class="s3"&gt;class&lt;/span&gt;]!= currentClass) {&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and that's it. Why does this only happen if you set the object on the propertyNames mutable dictionary? I don't know. I'm not really here to solve problems, just make them go away.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="border: 1px solid black; padding: 10px;text-align:center"&gt;&lt;i&gt;&lt;span style="font-family: 'arial narrow', sans-serif;"&gt;THroNG's &lt;a href="http://www.youtube.com/watch?v=eLqsd7n5N-s" target="_blank"&gt;latest music video&lt;/a&gt;: 100% improvised in realtime like a mugging or a marriage proposal.&lt;/span&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7330404553658681514?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7330404553658681514/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7330404553658681514' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7330404553658681514'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7330404553658681514'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/01/objectiveresource-bug-fix.html' title='ObjectiveResource Bug Fix'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7595236157818495835</id><published>2011-01-06T12:58:00.002-03:00</published><updated>2011-01-11T11:08:46.888-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='initializer'/><category scheme='http://www.blogger.com/atom/ns#' term='cocoatouch'/><category scheme='http://www.blogger.com/atom/ns#' term='obj-c'/><category scheme='http://www.blogger.com/atom/ns#' term='init'/><category scheme='http://www.blogger.com/atom/ns#' term='uikit'/><category scheme='http://www.blogger.com/atom/ns#' term='objective-c'/><title type='text'>Default Init in iOS (Obj-C)</title><content type='html'>The standard advice is to use a "designated initializer" which ends up with me having to think, which is always bad. Here is a pattern that never fails, and you could put it in a UIView category (UIView+SharedInit) and be done with this forever.&lt;br /&gt;&lt;br /&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;- (&lt;span style="color: #d200a5;"&gt;void&lt;/span&gt;) sharedInit {&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;- (&lt;span style="color: #d200a5;"&gt;id&lt;/span&gt;) init&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;{&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;self&lt;span style="color: black;"&gt; = [&lt;/span&gt;super&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #480085;"&gt;init&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;if&lt;/span&gt; (&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt; != &lt;span style="color: #d200a5;"&gt;nil&lt;/span&gt;) {&lt;/div&gt;&lt;div style="color: #1b5a5e; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;[&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;sharedInit&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;}&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;self&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;-(&lt;span style="color: #d200a5;"&gt;id&lt;/span&gt;) initWithCoder:(&lt;span style="color: #7e11ad;"&gt;NSCoder&lt;/span&gt; *)aDecoder {&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #d200a5;"&gt;self&lt;/span&gt; = [&lt;span style="color: #d200a5;"&gt;super&lt;/span&gt; &lt;span style="color: #480085;"&gt;initWithCoder&lt;/span&gt;:aDecoder];&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #d200a5;"&gt;if&lt;/span&gt; (&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt;) {&lt;/div&gt;&lt;div style="color: #1b5a5e; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;[&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;sharedInit&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;self&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;- (&lt;span style="color: #d200a5;"&gt;id&lt;/span&gt;)initWithFrame:(&lt;span style="color: #7e11ad;"&gt;CGRect&lt;/span&gt;)&lt;span style="color: #7e11ad;"&gt;frame&lt;/span&gt; {&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt;&lt;span style="color: black;"&gt; = [&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;super&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;initWithFrame&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;frame&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #d200a5;"&gt;if&lt;/span&gt; (&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt;) {&lt;/div&gt;&lt;div style="color: #1b5a5e; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;[&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;sharedInit&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;self&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;This is for a UIView subclass only, of course, but you could do the same thing for other classes as well.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7595236157818495835?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7595236157818495835/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7595236157818495835' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7595236157818495835'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7595236157818495835'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/01/default-init-in-ios-obj-c.html' title='Default Init in iOS (Obj-C)'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-1367247949545390582</id><published>2011-01-05T20:13:00.001-03:00</published><updated>2011-01-05T20:13:25.966-03:00</updated><title type='text'>Singleton in Interface Builder?</title><content type='html'>Here&amp;#39;s an answer to my question on StackOverflow: &lt;a href="http://stackoverflow.com/questions/4609609/use-singleton-in-interface-builder/4609809#4609809"&gt;can you use a Singleton in Interface Builder&lt;/a&gt;?&lt;div&gt;&lt;br&gt;&lt;/div&gt;  &lt;div&gt;Why would you want to do this? I know, Singleton is bad bad bad, but &lt;a href="http://stackoverflow.com/questions/350861/what-bad-practice-do-you-do-and-why/350900#350900"&gt;here it is&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;div&gt;&lt;br clear="all"&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;br&gt;&lt;/i&gt;&lt;/div&gt;&lt;div&gt;&lt;i&gt;&lt;font class="Apple-style-span" face="&amp;#39;arial narrow&amp;#39;, sans-serif"&gt;THroNG&amp;#39;s &lt;a href="http://www.youtube.com/watch?v=eLqsd7n5N-s"&gt;latest music video&lt;/a&gt;: 100% improvised in realtime like a mugging or a marriage proposal.&lt;/font&gt;&lt;/i&gt;&lt;/div&gt;  &lt;div&gt;&lt;meta charset="utf-8"&gt;&lt;br&gt;&lt;/div&gt;&lt;br&gt; &lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-1367247949545390582?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/1367247949545390582/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=1367247949545390582' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1367247949545390582'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1367247949545390582'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2011/01/singleton-in-interface-builder.html' title='Singleton in Interface Builder?'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4940938294687469650</id><published>2010-12-13T20:26:00.002-03:00</published><updated>2010-12-13T20:41:46.636-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='uicolor'/><category scheme='http://www.blogger.com/atom/ns#' term='serialization objective-c iphone cocoatouch ios'/><category scheme='http://www.blogger.com/atom/ns#' term='uiimage'/><title type='text'>Change the Colors of a UIImage Using a UIColor</title><content type='html'>Lots of googling led me &lt;a href="http://www.developers-life.com/change-color.html"&gt;here&lt;/a&gt;. Then it was pretty easy to mash &lt;a href="http://stackoverflow.com/questions/437113/how-to-get-rgb-values-from-uicolor"&gt;this&lt;/a&gt; into that. When you combine this with the &lt;a href="http://compileyouidontevenknowyou.blogspot.com/2010/07/custom-uiactionsheet-those-damn-blue_08.html"&gt;UIButton images provided by Apple&lt;/a&gt;, you can do cool stuff.&lt;br /&gt;&lt;br /&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;- (&lt;span style="color: #7e11ad;"&gt;UIImage&lt;/span&gt; *) changeColorForImage:(&lt;span style="color: #7e11ad;"&gt;UIImage&lt;/span&gt; *)image toColor:(&lt;span style="color: #7e11ad;"&gt;UIColor&lt;/span&gt;*)color {&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;UIGraphicsBeginImageContext&lt;span style="color: black;"&gt;(image.&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;size&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;CGRect&lt;/span&gt; contextRect;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;contextRect.&lt;span style="color: #7e11ad;"&gt;origin&lt;/span&gt;.&lt;span style="color: #7e11ad;"&gt;x&lt;/span&gt; = &lt;span style="color: #3900de;"&gt;0.0f&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;contextRect.&lt;span style="color: #7e11ad;"&gt;origin&lt;/span&gt;.&lt;span style="color: #7e11ad;"&gt;y&lt;/span&gt; = &lt;span style="color: #3900de;"&gt;0.0f&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;contextRect.&lt;span style="color: #7e11ad;"&gt;size&lt;/span&gt; = [image &lt;span style="color: #480085;"&gt;size&lt;/span&gt;];&lt;/div&gt;&lt;div style="color: #008d00; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;// Retrieve source image and begin image context&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;CGSize&lt;/span&gt; itemImageSize = [image &lt;span style="color: #480085;"&gt;size&lt;/span&gt;];&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;CGPoint&lt;/span&gt; itemImagePosition;&amp;nbsp;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;itemImagePosition.&lt;span style="color: #7e11ad;"&gt;x&lt;/span&gt; = &lt;span style="color: #480085;"&gt;ceilf&lt;/span&gt;((contextRect.&lt;span style="color: #7e11ad;"&gt;size&lt;/span&gt;.&lt;span style="color: #7e11ad;"&gt;width&lt;/span&gt; - itemImageSize.&lt;span style="color: #7e11ad;"&gt;width&lt;/span&gt;) / &lt;span style="color: #3900de;"&gt;2&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;itemImagePosition.&lt;span style="color: #7e11ad;"&gt;y&lt;/span&gt; = &lt;span style="color: #480085;"&gt;ceilf&lt;/span&gt;((contextRect.&lt;span style="color: #7e11ad;"&gt;size&lt;/span&gt;.&lt;span style="color: #7e11ad;"&gt;height&lt;/span&gt; - itemImageSize.&lt;span style="color: #7e11ad;"&gt;height&lt;/span&gt;) );&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;UIGraphicsBeginImageContext&lt;span style="color: black;"&gt;(contextRect.&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;size&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;CGContextRef&lt;/span&gt;&lt;span style="color: black;"&gt; c = &lt;/span&gt;UIGraphicsGetCurrentContext&lt;span style="color: black;"&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #008d00; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;// Setup shadow&lt;/div&gt;&lt;div style="color: #008d00; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;// Setup transparency layer and clip to mask&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;CGContextBeginTransparencyLayer&lt;span style="color: black;"&gt;(c, &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;NULL&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;CGContextScaleCTM&lt;span style="color: black;"&gt;(c, &lt;/span&gt;&lt;span style="color: #3900de;"&gt;1.0&lt;/span&gt;&lt;span style="color: black;"&gt;, -&lt;/span&gt;&lt;span style="color: #3900de;"&gt;1.0&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #480085;"&gt;CGContextClipToMask&lt;/span&gt;(c, &lt;span style="color: #480085;"&gt;CGRectMake&lt;/span&gt;(itemImagePosition.&lt;span style="color: #7e11ad;"&gt;x&lt;/span&gt;, -itemImagePosition.&lt;span style="color: #7e11ad;"&gt;y&lt;/span&gt;, itemImageSize.&lt;span style="color: #7e11ad;"&gt;width&lt;/span&gt;, -itemImageSize.&lt;span style="color: #7e11ad;"&gt;height&lt;/span&gt;), [image &lt;span style="color: #480085;"&gt;CGImage&lt;/span&gt;]);&lt;/div&gt;&lt;div style="color: #008d00; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;// Fill and end the transparency layer&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;const&lt;/span&gt; &lt;span style="color: #d200a5;"&gt;float&lt;/span&gt;* colors = &lt;span style="color: #480085;"&gt;CGColorGetComponents&lt;/span&gt;( color.&lt;span style="color: #7e11ad;"&gt;CGColor&lt;/span&gt; );&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #480085;"&gt;CGContextSetRGBFillColor&lt;/span&gt;(c, colors[&lt;span style="color: #3900de;"&gt;0&lt;/span&gt;], colors[&lt;span style="color: #3900de;"&gt;1&lt;/span&gt;], colors[&lt;span style="color: #3900de;"&gt;2&lt;/span&gt;], &lt;span style="color: #3900de;"&gt;.75&lt;/span&gt;);&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;contextRect.&lt;span style="color: #7e11ad;"&gt;size&lt;/span&gt;.&lt;span style="color: #7e11ad;"&gt;height&lt;/span&gt; = -contextRect.&lt;span style="color: #7e11ad;"&gt;size&lt;/span&gt;.&lt;span style="color: #7e11ad;"&gt;height&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;contextRect.&lt;span style="color: #7e11ad;"&gt;size&lt;/span&gt;.&lt;span style="color: #7e11ad;"&gt;height&lt;/span&gt; -= &lt;span style="color: #3900de;"&gt;15&lt;/span&gt;;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #480085;"&gt;CGContextFillRect&lt;/span&gt;(c, contextRect);&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;CGContextEndTransparencyLayer&lt;span style="color: black;"&gt;(c);&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;UIImage&lt;/span&gt;&lt;span style="color: black;"&gt; *img = &lt;/span&gt;UIGraphicsGetImageFromCurrentImageContext&lt;span style="color: black;"&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;UIGraphicsEndImageContext&lt;span style="color: black;"&gt;();&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;return&lt;/span&gt; img;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: Times, 'Times New Roman', serif;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;Now that I know this simple code, I can even create idiotic methods like:&lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;- (&lt;span style="color: #7e11ad;"&gt;UIColor&lt;/span&gt;*) oppositeColor:(&lt;span style="color: #7e11ad;"&gt;UIColor&lt;/span&gt;*)color {&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;const&lt;/span&gt; &lt;span style="color: #d200a5;"&gt;float&lt;/span&gt;* colors = &lt;span style="color: #480085;"&gt;CGColorGetComponents&lt;/span&gt;(color.&lt;span style="color: #7e11ad;"&gt;CGColor&lt;/span&gt;);&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;return&lt;/span&gt; [&lt;span style="color: #7e11ad;"&gt;UIColor&lt;/span&gt; &lt;span style="color: #480085;"&gt;colorWithRed&lt;/span&gt;:&lt;span style="color: #3900de;"&gt;1&lt;/span&gt;-colors[&lt;span style="color: #3900de;"&gt;0&lt;/span&gt;] &lt;span style="color: #480085;"&gt;green&lt;/span&gt;:&lt;span style="color: #3900de;"&gt;1&lt;/span&gt;-colors[&lt;span style="color: #3900de;"&gt;1&lt;/span&gt;] &lt;span style="color: #480085;"&gt;blue&lt;/span&gt;:&lt;span style="color: #3900de;"&gt;1&lt;/span&gt;-colors[&lt;span style="color: #3900de;"&gt;2&lt;/span&gt;] &lt;span style="color: #480085;"&gt;alpha&lt;/span&gt;:&lt;span style="color: #3900de;"&gt;1&lt;/span&gt;];&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4940938294687469650?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4940938294687469650/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4940938294687469650' title='2 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4940938294687469650'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4940938294687469650'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/12/change-colors-of-uiimage-using-uicolor.html' title='Change the Colors of a UIImage Using a UIColor'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-3985835315832939714</id><published>2010-12-08T23:59:00.001-03:00</published><updated>2010-12-08T23:59:26.236-03:00</updated><title type='text'>More Stupid Comments on Programming: "This Code Sucks!"</title><content type='html'>&lt;p class="mobile-photo"&gt;&lt;a href="http://2.bp.blogspot.com/_QFCElrKyI6g/TQBGDiWJpCI/AAAAAAAADcA/iN1u-6cZYH8/s1600/Screen%2Bshot%2B2010-12-08%2Bat%2B9.57.54%2BPM-766237.png"&gt;&lt;img src="http://2.bp.blogspot.com/_QFCElrKyI6g/TQBGDiWJpCI/AAAAAAAADcA/iN1u-6cZYH8/s320/Screen%2Bshot%2B2010-12-08%2Bat%2B9.57.54%2BPM-766237.png"  border="0" alt="" id="BLOGGER_PHOTO_ID_5548511767493714978" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-3985835315832939714?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/3985835315832939714/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=3985835315832939714' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3985835315832939714'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3985835315832939714'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/12/more-stupid-comments-on-programming.html' title='More Stupid Comments on Programming: &quot;This Code Sucks!&quot;'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_QFCElrKyI6g/TQBGDiWJpCI/AAAAAAAADcA/iN1u-6cZYH8/s72-c/Screen%2Bshot%2B2010-12-08%2Bat%2B9.57.54%2BPM-766237.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-2406688425826836366</id><published>2010-12-08T13:22:00.001-03:00</published><updated>2010-12-08T13:22:33.251-03:00</updated><title type='text'>Wordpress and jQuery: Where's the Dollar?</title><content type='html'>The first thing I did in Wordpress was add jQuery, using the normal tag:&lt;div&gt;&lt;br&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;wp_enqueue_script( &amp;#39;jquery&amp;#39; );&lt;/font&gt;&lt;/div&gt;  &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;right above &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;wp_head();&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;But then &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;$&lt;/font&gt; was not recognized? Why? Because Wordpress loads in noConflict mode. To put jQuery back for a particular page, use:&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;// set the _$ which jQuery uses for backup&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;window._$ = $;&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;// set the $ to jQuery&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;window.$ = jQuery;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Another option is to put this above the wp_enqueue_script, which will load jQuery in normal conflicty mode.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;wp_deregister_script( &amp;#39;jquery&amp;#39; );&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;wp_register_script( &amp;#39;jquery&amp;#39;, &amp;#39;&lt;a href="http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js"&gt;http://ajax.googleapis.com/ajax/libs/jquery/1.4.4/jquery.min.js&lt;/a&gt;&amp;#39;, false, &amp;#39;&amp;#39; );&lt;/font&gt;&lt;/div&gt;  &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;See the meandering Stackoverflow thread &lt;a href="http://stackoverflow.com/questions/4378165/jquery-in-wordpress-jquery-loads-but-not-usable/4378195#4378195"&gt;here&lt;/a&gt;.&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-2406688425826836366?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/2406688425826836366/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=2406688425826836366' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2406688425826836366'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2406688425826836366'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/12/wordpress-and-jquery-wheres-dollar.html' title='Wordpress and jQuery: Where&apos;s the Dollar?'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-8331484629726897215</id><published>2010-12-07T17:02:00.000-03:00</published><updated>2010-12-07T17:02:46.704-03:00</updated><title type='text'>Arbitrary Code Plugin for Wordpress</title><content type='html'>My favorite silly plugin for Wordpress. Sometimes you don't care about what Wordpress can do for you. you just want to do some PHP.&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[&lt;?php /*  Plugin Name: Arbitrary Code Plugin  Author: Daniel Rosenstark */ add_option('arbitrary_code_sub_tag', 'ArbitraryCode', 'The tag to sub in the users HTML.'); add_option('arbitrary_code_filename', 'test_include.php', 'Name of the PHP to include'); // Add page to options menu. function addAdminPage() {     // Add a new submenu under Options:     add_options_page('Arbitrary Code Options', 'ArbitraryCode', 8, 'ArbitraryCode', 'displayAdminPage'); } function displayAdminPage() {  if (isset($_POST['arbitrary_code_update']))  {   check_admin_referer();   // Update title tag   $titleTag = $_POST['arbitrary_code_sub_tag'];   if ($titleTag == '') $titleTag = 'ArbitraryCode';   update_option(arbitrary_code_sub_tag, $titleTag);   $titleTag = $_POST['arbitrary_code_filename'];   if ($titleTag == '') $titleTag = 'ArbitraryCode';   update_option(arbitrary_code_filename, $titleTag);   // echo message updated   echo "&lt;div class='updated fade'&gt;&lt;p&gt;ArbitraryCode Stuff Changed.&lt;/p&gt;&lt;/div&gt;";  }  ?&gt;  &lt;div class="wrap"&gt;   &lt;h2&gt;Arbitrary Code Options&lt;/h2&gt;   &lt;form method="post"&gt;    &lt;fieldset class='options'&gt;     &lt;table class="editform" cellspacing="2" cellpadding="5" width="100%"&gt;      &lt;tr&gt;       &lt;th width="30%" valign="top" style="padding-top: 10px;"&gt;        &lt;label for="arbitrary_code_sub_tag"&gt;Sub Tag:&lt;/label&gt;       &lt;/th&gt;       &lt;td&gt;        &amp;lt;!--&lt;input type='text' size='56' maxlength='130' name='arbitrary_code_sub_tag' id='arbitrary_code_sub_tag' value='&lt;?php echo(get_option('arbitrary_code_sub_tag')); ?&gt;' /&gt;--&amp;gt;        The tag you want us to substitute with your file.       &lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;       &lt;th width="30%" valign="top" style="padding-top: 10px;"&gt;        &lt;label for="arbitrary_code_sub_tag"&gt;Filename of Include:&lt;/label&gt;       &lt;/th&gt;       &lt;td&gt;        &lt;input type='text' size='66' maxlength='130' name='arbitrary_code_filename' id='arbitrary_code_filename' value='&lt;?php echo(get_option('arbitrary_code_filename')); ?&gt;' /&gt;        The PHP file to include.       &lt;/td&gt;      &lt;/tr&gt;      &lt;tr&gt;       &lt;td colspan="2"&gt;       &lt;p class="submit"&gt;&lt;input type='submit' name='arbitrary_code_update' value='Update Options' /&gt;&lt;/p&gt;       &lt;/td&gt;      &lt;/tr&gt;     &lt;/table&gt;    &lt;/fieldset&gt;   &lt;/form&gt;  &lt;/div&gt;  &lt;?php } // // Actual functionality // function replaceTag ($content = '') {  $replaceTag = "&lt;!--".get_option('arbitrary_code_sub_tag')."--&gt;";  $includeFilename = get_option('arbitrary_code_filename');    $replaceWith = "";  $newContent = str_replace($replaceTag, $replaceWith, $content);  if (strlen($newContent) != strlen($content)) {   include $includeFilename; // this sucks, but we do not actually sub the tag. We instead insert right now!      return $newContent;  } else {   return $content;  } } // // Hooks // add_action('admin_menu', 'addAdminPage'); add_filter('the_content', 'replaceTag', 1);?&gt;]]&gt;&lt;/script&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-8331484629726897215?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/8331484629726897215/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=8331484629726897215' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/8331484629726897215'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/8331484629726897215'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/12/arbitrary-code-plugin-for-wordpress.html' title='Arbitrary Code Plugin for Wordpress'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-5688843468125535372</id><published>2010-11-28T19:34:00.001-03:00</published><updated>2010-11-28T19:39:31.365-03:00</updated><title type='text'>Ruby Scripts to Get Keys As Array for Objective-C</title><content type='html'>&lt;div&gt;It's a common situation to have a line like this&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@synthesize control, command, channel, data1, min, max;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;which you want to make into one of these&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;NSArray *arrayOfKeys = [NSArray arrayWithObjects:@"control", @"command", @"channel", @"data1", @"min", @"max", nil];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;While I could &lt;a href="http://stackoverflow.com/questions/848636/objective-c-2-0-class-copypropertylist-how-to-list-properties-from-categories"&gt;look for the Objective-C way to do it&lt;/a&gt;, another way is to cut my losses and do it with Ruby. Just fire up &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;irb&lt;/span&gt; and paste this in&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;keys = "control, command, channel, data1, min, max"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;keys = keys.split(", ")&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;text = "NSArray *arrayOfKeys = [NSArray arrayWithObjects:"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;keys.each {|key| text &amp;lt;&amp;lt; %Q!@"#{key}", ! }&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;text &amp;lt;&amp;lt; "nil];"&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;puts text&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-5688843468125535372?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/5688843468125535372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=5688843468125535372' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5688843468125535372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5688843468125535372'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/11/ruby-scripts-to-get-keys-as-array-for.html' title='Ruby Scripts to Get Keys As Array for Objective-C'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4380185214439360525</id><published>2010-11-28T13:23:00.000-03:00</published><updated>2010-11-28T13:24:01.445-03:00</updated><title type='text'>Funky Errors with Unit Tests on iOS</title><content type='html'>These are just two links for my own reference. If you see this message&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;Command /bin/sh failed with exit code 1&lt;/font&gt;&lt;/div&gt;  &lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;go &lt;a href="http://sqllyw.wordpress.com/2009/11/22/adding-unit-test-to-objective-c-application-in-xcode-3-2/"&gt;here&lt;/a&gt;. Though the answer is that you need to get your Unit Tests set up.&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;If you see this message:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;An internal error occurred when handling command output: -[XCBuildLogCommandInvocationSectionRecorder endMarker]: &lt;/font&gt;&lt;/div&gt;  &lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;go &lt;a href="http://stackoverflow.com/questions/3516745/sentestcase-in-xcode-3-2-and-xcbuildlogcommandinvocationsection-errors/3741466#3741466"&gt;here&lt;/a&gt;.&lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4380185214439360525?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4380185214439360525/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4380185214439360525' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4380185214439360525'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4380185214439360525'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/11/funky-errors-with-unit-tests-on-ios.html' title='Funky Errors with Unit Tests on iOS'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-3733313172175861914</id><published>2010-11-26T09:56:00.000-03:00</published><updated>2010-11-26T09:57:19.900-03:00</updated><title type='text'>Switch Ruby and Rails Versions</title><content type='html'>&lt;div&gt;Once you&amp;#39;ve done the one-time setup of &lt;a href="http://rvm.beginrescueend.com/"&gt;rvm&lt;/a&gt;, some ruby versions, and Rails:&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;&lt;br&gt;  &lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;$&lt;/font&gt;rails -v&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;Rails 3.0.1&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;$&lt;/font&gt;rails _2.3.10_ -v&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;Rails 2.3.10&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;$&lt;/font&gt;ruby -v&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#33CC00"&gt;$&lt;/font&gt;rvm -use 1.9.1&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;$&lt;/font&gt;ruby -v&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-darwin10.4.0]&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;$&lt;/font&gt;rvm -use system&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;$&lt;/font&gt;ruby -v        &lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;font class="Apple-style-span" color="#009900"&gt;ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]&lt;/font&gt;&lt;/font&gt;&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Once the Rails app is created, you manipulate the Rails version from the &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;environment.rb&lt;/font&gt;.&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-3733313172175861914?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/3733313172175861914/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=3733313172175861914' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3733313172175861914'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3733313172175861914'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/11/switch-ruby-and-rails-versions.html' title='Switch Ruby and Rails Versions'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4379532965051098039</id><published>2010-11-11T15:08:00.002-03:00</published><updated>2010-11-22T13:33:36.398-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='mysql'/><category scheme='http://www.blogger.com/atom/ns#' term='ruby-on-rails'/><category scheme='http://www.blogger.com/atom/ns#' term='rails-3'/><title type='text'>Installing Rails 3 on OSX</title><content type='html'>&lt;div&gt;Most see this &lt;a href="http://www.blog.bridgeutopiaweb.com/post/how-to-install-rvm-and-rails-3-on-snow-leopard/"&gt;link&lt;/a&gt;. However, lets's skip the rvm stuff:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;sudo gem install tzinfo builder memcache-client rack rack-test rack-mount erubis mail text-format thor bundler i18n&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;sudo gem install rails&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;which gave me this message&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;File not found: lib&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;The answer was &lt;a href="http://www.spritle.com/blogs/?p=915"&gt;here&lt;/a&gt;:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;cd&amp;nbsp;/Library/Ruby/Gems/1.8/gems/rails-3.0.1&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;mkdir lib&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Also, I should mention that I never knew that&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;gem server&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;is the answer to all documentation on Ruby (thanks Sean). Another good answer is &lt;a href="http://railsapi.com/"&gt;railsapi.com&lt;/a&gt;, including the &lt;a href="http://railsapi.com/doc/rails-v2.3.8/"&gt;2.3.8 documentation&lt;/a&gt;&amp;nbsp;and &lt;a href="http://railsapi.com/doc/rails-v3.0.1/"&gt;the 3.0.1 documentation&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I'll have to run through a Rails 3 book soon, I see, mostly to learn the stuff I should've known even in Rails 2.&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Note&lt;/b&gt;: After writing this it turns out that I still couldn't connect to MySql from XAMPP on my OSX box. I ended up using this command&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;env ARCHFLAGS="-arch x86_64" sudo gem install mysql -- --with-mysql config=/usr/local/mysql/bin/mysql_config&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;but I have no idea why I have a mysql_config there. Perhaps it's from an earlier botched install of MySql? If all of this doesn't work, you can always run through the real MySql directions &lt;a href="http://xponrails.net/2010/09/13/how-to-install-mysql-and-rails-on-osx-snow-leopard/"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;From there, there was a simple two-step process:&lt;br /&gt;&lt;br /&gt;1. Add&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;gem 'mysql' &amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;to the gemfile.&lt;br /&gt;&lt;br /&gt;2. Change the development section of the database.yml to say&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;development:&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;adapter: mysql&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;encoding: utf8&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;database: test-rails3&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;username: root&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;password: 512ilwae2iwo&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;host: localhost&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&amp;nbsp;&amp;nbsp;socket: /Applications/XAMPP/xamppfiles/var/mysql/mysql.sock&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;subbing the appropriate values as necessary.&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then use &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;rails server&lt;/span&gt; and you're up and running.&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4379532965051098039?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4379532965051098039/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4379532965051098039' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4379532965051098039'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4379532965051098039'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/11/installing-rails-3-on-osx.html' title='Installing Rails 3 on OSX'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-9138608196540536600</id><published>2010-10-24T02:59:00.001-03:00</published><updated>2010-10-24T02:59:29.628-03:00</updated><title type='text'>Fascinating Style Guide</title><content type='html'>&lt;p class="mobile-photo"&gt;&lt;a href="http://3.bp.blogspot.com/_QFCElrKyI6g/TMPLQbIgzzI/AAAAAAAADbY/f_TPQdfIOJc/s1600/Screen+shot+2010-10-24+at+1.48.27+AM-769628.png"&gt;&lt;img src="http://3.bp.blogspot.com/_QFCElrKyI6g/TMPLQbIgzzI/AAAAAAAADbY/f_TPQdfIOJc/s320/Screen+shot+2010-10-24+at+1.48.27+AM-769628.png"  border="0" alt="" id="BLOGGER_PHOTO_ID_5531488250362908466" /&gt;&lt;/a&gt;&lt;/p&gt;This is &lt;a href="http://cocoadevcentral.com/articles/000082.php"&gt;a style guide on Objective-C&lt;/a&gt;, but it makes a case for self-descriptive code by basing it on a fascinating fact: &amp;quot;[Since] you do far more reading of code than writing, invest the time to type an extra eight characters.&amp;quot; Of course you don&amp;#39;t need to save characters typing (especially if you&amp;#39;ve learned to touch type)! While I&amp;#39;m here I should link to&lt;a href="http://steve-yegge.blogspot.com/2008/09/programmings-dirtiest-little-secret.html"&gt; the controversial and insulting rant&lt;/a&gt; by Steve Yegge, &lt;a href="http://en.wikipedia.org/wiki/Steve_Yegge"&gt;who I didn&amp;#39;t know about until today&lt;/a&gt;. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-9138608196540536600?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/9138608196540536600/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=9138608196540536600' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/9138608196540536600'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/9138608196540536600'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/10/fascinating-style-guide.html' title='Fascinating Style Guide'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_QFCElrKyI6g/TMPLQbIgzzI/AAAAAAAADbY/f_TPQdfIOJc/s72-c/Screen+shot+2010-10-24+at+1.48.27+AM-769628.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-2597588552512605615</id><published>2010-10-04T02:28:00.000-03:00</published><updated>2010-10-04T02:29:19.545-03:00</updated><title type='text'>Windows Permissions Problems: ASP.NET Site Won't Serve</title><content type='html'>&lt;p class="mobile-photo"&gt;&lt;a href="http://2.bp.blogspot.com/_QFCElrKyI6g/TKlmL_3P0YI/AAAAAAAADZU/2DH1Xh8zau4/s1600/Screen+shot+2010-10-04+at+1.25.19+AM-759546.png"&gt;&lt;img src="http://2.bp.blogspot.com/_QFCElrKyI6g/TKlmL_3P0YI/AAAAAAAADZU/2DH1Xh8zau4/s320/Screen+shot+2010-10-04+at+1.25.19+AM-759546.png"  border="0" alt="" id="BLOGGER_PHOTO_ID_5524058774254375298" /&gt;&lt;/a&gt;&lt;/p&gt;I&amp;#39;ll readily admit that I don&amp;#39;t know much about Windows admin, but today -- suddenly, it seemed, but I&amp;#39;m sure I haven&amp;#39;t touched my Windows VirtualBox in months -- I couldn&amp;#39;t get an &lt;a href="http://ASP.NET"&gt;ASP.NET&lt;/a&gt; site to work at all. The error in the Event Viewer was completely vague, but I knew it was a permissions problem. In the end, I found a directory that did work, and copied the permissions from there. They have to look like this, or you&amp;#39;re sunk (the CREATOR OWNER and SYSTEM being pretty pivotal). &lt;div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-2597588552512605615?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/2597588552512605615/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=2597588552512605615' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2597588552512605615'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2597588552512605615'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/10/windows-permissions-problems-aspnet.html' title='Windows Permissions Problems: ASP.NET Site Won&apos;t Serve'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_QFCElrKyI6g/TKlmL_3P0YI/AAAAAAAADZU/2DH1Xh8zau4/s72-c/Screen+shot+2010-10-04+at+1.25.19+AM-759546.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-6203627040663184445</id><published>2010-09-22T03:10:00.000-03:00</published><updated>2010-09-22T03:11:11.373-03:00</updated><title type='text'>Object-oriented Coding</title><content type='html'>Object-oriented coding is easy, in some sense. &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;First you use functions. Repeated code disappears and the problem of &amp;quot;what do I call THIS variable?&amp;quot; disappears. Redefine the context, and suddenly giving nice, coherent names is easy. That&amp;#39;s pre-OO but always the first step. No methods, no OO.&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Then you start to generalize. When you generalize well, things start to fall into line. Messages are being called on &amp;quot;this&amp;quot; or &amp;quot;self&amp;quot; instead of that other thing. And code gets deleted from subclasses.&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Then at some point you look at the monster base or superclass or the whole hierarchy and you say, &amp;quot;this cannot be good.&amp;quot; So you start to delegate some of its work to other classes. If you do it right, they have a small bridge between them (and not a &amp;quot;Spaghetti Junction&amp;quot;). Then you start to work on the new structures that develop.&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;And as you add code, you continue to do this, and crystalline or fractal-ish structures form. And then you say, &amp;quot;my God, I&amp;#39;ve got a total mess. Any code could be anywhere.&amp;quot; But of course that didn&amp;#39;t happen, because you&amp;#39;ve got people yelling at you from every direction to do MVC or some super-structure to organize. But isn&amp;#39;t it obvious, really, that you need to organize your stuff? Coding is 10% brilliant solutions and 90% organization.&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;And THAT the fizz-buzz problem does not test.&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-6203627040663184445?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/6203627040663184445/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=6203627040663184445' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/6203627040663184445'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/6203627040663184445'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/09/object-oriented-coding.html' title='Object-oriented Coding'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4011352417649335404</id><published>2010-09-19T18:35:00.000-03:00</published><updated>2010-09-19T18:36:14.900-03:00</updated><title type='text'>Problems With Unit Testing, XCode 3.2.4 for iOS</title><content type='html'>I was beating my head against this for a while, but I eventually found someone else&amp;#39;s solution. Here&amp;#39;s the error&lt;div&gt; &lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;An internal error occurred when handling command output: -[XCBuildLogCommandInvocationSection setTestsPassedString:]: unrecognized selector sent to instance 0x200ed2d80&lt;/font&gt;&lt;/p&gt;  &lt;p class="p1"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;An internal error occurred when handling command output: -[XCBuildLogCommandInvocationSectionRecorder endMarker]: unrecognized selector sent to instance 0x200efecc0&lt;/font&gt;&lt;/p&gt;  &lt;p class="p2"&gt; &lt;/p&gt;&lt;p class="p2"&gt;I arrived at by following Apple&amp;#39;s docs on Unit Testing. &lt;/p&gt;&lt;p class="p2"&gt;The answer was here (&lt;a href="http://stackoverflow.com/questions/3516745/3741466#3741466"&gt;http://stackoverflow.com/questions/3516745/3741466#3741466&lt;/a&gt;) and basically says to change the Run Script stage of the target from &lt;/p&gt;  &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&amp;quot;${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests&amp;quot; &lt;br&gt;&lt;/font&gt;&lt;br&gt;to&lt;br&gt;&lt;br&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&amp;quot;${SYSTEM_DEVELOPER_DIR}/Tools/RunUnitTests&amp;quot; 1&amp;gt; /tmp/RunUnitTests.out &lt;/font&gt;&lt;br&gt;  &lt;br&gt; &lt;p&gt;&lt;/p&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4011352417649335404?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4011352417649335404/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4011352417649335404' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4011352417649335404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4011352417649335404'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/09/problems-with-unit-testing-xcode-324.html' title='Problems With Unit Testing, XCode 3.2.4 for iOS'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-1189124062044166645</id><published>2010-09-17T22:27:00.000-03:00</published><updated>2010-09-17T22:28:17.592-03:00</updated><title type='text'>iPhone Apps with Companion Desktop Apps</title><content type='html'>Yes, they are possible. While some early reports indicated that you &lt;a href="http://blog.clickablebliss.com/2009/05/04/iphone-apps-cant-require-desktop-apps/"&gt;cannot require a companion application&lt;/a&gt;, these turn out to be bogus (or premature, really): it&amp;#39;s actually &lt;a href="http://www.davidmcgavern.com/2009/05/06/iflash-touch-update-on-rejection/"&gt;not a problem&lt;/a&gt;. Whew! &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-1189124062044166645?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/1189124062044166645/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=1189124062044166645' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1189124062044166645'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1189124062044166645'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/09/iphone-apps-with-companion-desktop-apps.html' title='iPhone Apps with Companion Desktop Apps'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-9133893266568569811</id><published>2010-09-01T03:02:00.001-03:00</published><updated>2010-09-01T03:02:52.629-03:00</updated><title type='text'>Sometimes, Ruby is Beautiful</title><content type='html'>I hate \concise languages, since they seem so data-use averse (i.e., cheap), but sometimes Ruby is so cool &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;@config = YAML.load(File.open(&amp;quot;#{RAILS_ROOT}/config/my_thinger.yml&amp;quot;))[RAILS_ENV].symbolize_keys&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;The String interpolation here is totally unnecessary, of course, but idiomatic.&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-9133893266568569811?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/9133893266568569811/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=9133893266568569811' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/9133893266568569811'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/9133893266568569811'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/09/sometimes-ruby-is-beautiful.html' title='Sometimes, Ruby is Beautiful'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7918719476077226374</id><published>2010-08-16T01:55:00.002-03:00</published><updated>2010-08-16T18:25:30.630-03:00</updated><title type='text'>Make a Universal App From an iPhone App</title><content type='html'>I was trying to figure out what makes a Universal application tick, because I wanted the easiest way to switch mine over. Here it is:&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;In the build settings for the project, switch Targeted Device Family to iPhone/iPad&lt;/li&gt;&lt;li&gt;Optional: if you want to use different initial NIBs for the two devices, add this to your application's plist file:&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;lt;key&amp;gt;NSMainNibFile~ipad&amp;lt;/key&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;lt;string&amp;gt;MainWindow_iPad&amp;lt;/string&amp;gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;Then you can adjust anything you want differentially using&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)&amp;nbsp;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;It might be worth noting that right now the iPad can only do up to 3.2 at this time.&lt;br /&gt;&lt;br /&gt;What about the default.png? See &lt;a href="http://iphonedevelopertips.com/ipad/ipad-managing-multiple-launch-images.html"&gt;here&lt;/a&gt; for how to include images for the iPad: it's basically manual.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7918719476077226374?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7918719476077226374/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7918719476077226374' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7918719476077226374'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7918719476077226374'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/08/make-universal-app-from-iphone-app.html' title='Make a Universal App From an iPhone App'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-627877333694947372</id><published>2010-08-04T12:03:00.002-03:00</published><updated>2010-08-04T14:00:55.221-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='iphone-sdk'/><category scheme='http://www.blogger.com/atom/ns#' term='cocoatouch'/><category scheme='http://www.blogger.com/atom/ns#' term='autoresize'/><category scheme='http://www.blogger.com/atom/ns#' term='objective-c'/><title type='text'>Autoresize, programmatically</title><content type='html'>&lt;p&gt;There are two ways to do this. One is the super-custom-I-don't-know-about-autoresizing way. Before I delete it (since it could be useful later, I wanted to document it here) It looks like this in a UIView subclass. &lt;/p&gt;&lt;h3&gt;Init Method&lt;/h3&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didRotate:) name:UIDeviceOrientationDidChangeNotification object:nil];]]&gt;&lt;/script&gt;&lt;h3&gt;didRotate method&lt;/h3&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[- (void) didRotate:(NSNotification*) notification { CGRect frame = CGRectMake(0,0,0,0); frame.size = [self.text sizeWithFont:self.font]; frame.size.width += 50; frame.size.height += 50; frame.origin.x = (self.superview.bounds.size.width - frame.size.width)/2; frame.origin.y = (self.superview.bounds.size.height - frame.size.height)/2; self.frame = frame;}]]&gt;&lt;/script&gt;&lt;p&gt;Of course, this makes no sense at all when you can just do this (or do in IB, but that's not my point here):&lt;/p&gt;&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[[self setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin]; ]]&gt;&lt;/script&gt;&lt;p&gt;The important advantage of the second one is that -- I think -- it actually readjusts DURING the rotation as well. That could be wrong.&lt;/p&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-627877333694947372?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/627877333694947372/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=627877333694947372' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/627877333694947372'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/627877333694947372'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/08/autoresize-programmatically.html' title='Autoresize, programmatically'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7464404928512539656</id><published>2010-08-01T15:10:00.000-03:00</published><updated>2010-08-01T15:19:04.171-03:00</updated><title type='text'>Why iPhone Apps Don't Rotate With Keyboard</title><content type='html'>I&amp;#39;ve always wondered, as a user, why most (but not all) iPhone apps cannot rotate when the keyboard is showing. The reason is that you generally need a &lt;span style="font-family: courier new,monospace;"&gt;UIKeyboardDidShowNotification&lt;/span&gt; to figure out how big the keyboard is. You cannot get one of these when you want. You usually get them only when the keyboard is being shown or hidden. I&amp;#39;m not saying it&amp;#39;s impossible to get the keyboard height without this notification, but it &lt;b&gt;might&lt;/b&gt; require calling private SDK methods.&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7464404928512539656?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7464404928512539656/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7464404928512539656' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7464404928512539656'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7464404928512539656'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/08/why-iphone-apps-dont-rotate-with.html' title='Why iPhone Apps Don&apos;t Rotate With Keyboard'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-1290359607142788929</id><published>2010-07-28T11:13:00.003-03:00</published><updated>2010-11-26T21:23:25.652-03:00</updated><title type='text'>Simple Serialization (Well, Archiving) on iOS: Filenames</title><content type='html'>I sometimes forget that the simulator is not a real device, though it sure does get you there about 99% of the time. So anyway, the filenames that I presented in &lt;a href="http://www.blogger.com/2010/07/nskeyedarchiver-encoding-and-decoding.html"&gt;this post&lt;/a&gt; do not work. But after looking around for 10 seconds, I found &lt;a href="http://forums.macrumors.com/showthread.php?t=544459"&gt;the answer&lt;/a&gt;:&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="border: none; margin: 0 0 0 40px; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;NSString *docsPath = [&lt;/span&gt;NSSearchPathForDirectoriesInDomains&lt;span style="color: black;"&gt;(&lt;/span&gt;NSDocumentDirectory&lt;span style="color: black;"&gt;, &lt;/span&gt;NSUserDomainMask&lt;span style="color: black;"&gt;, &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;YES&lt;/span&gt;&lt;span style="color: black;"&gt;) &lt;/span&gt;objectAtIndex&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #3900de;"&gt;0&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;NSString *filename = [docsPath &lt;span style="color: #480085;"&gt;stringByAppendingPathComponent&lt;/span&gt;:&lt;span style="color: #e90000;"&gt;@"somewhereInAppSandbox"&lt;/span&gt;];&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then you can just use&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="border: none; margin: 0 0 0 40px; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;[&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSKeyedArchiver&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;archiveRootObject&lt;span style="color: black;"&gt;:array &lt;/span&gt;toFile&lt;span style="color: black;"&gt;:filename];&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/blockquote&gt;and&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="border: none; margin: 0 0 0 40px; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;[&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSKeyedUnarchiver&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;unarchiveObjectWithFile&lt;span style="color: black;"&gt;:filename];&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;as I suggested in the other post. Obviously for anything serious you would use CoreData or Sqlite.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-1290359607142788929?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/1290359607142788929/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=1290359607142788929' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1290359607142788929'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1290359607142788929'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/simple-serialization-well-archiving-on.html' title='Simple Serialization (Well, Archiving) on iOS: Filenames'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7753455198946994824</id><published>2010-07-26T22:43:00.005-03:00</published><updated>2010-11-26T20:33:03.527-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='serialization objective-c iphone cocoatouch ios'/><title type='text'>NSKeyedArchiver: Encoding and Decoding for Fun and Profit</title><content type='html'>More on Serializing and deserializing, which -- if you're ever on a job interview -- is called "archiving and unarchiving." &lt;a href="http://stackoverflow.com/questions/4288719/serialization-vs-archiving/4288893#4288893"&gt;Serialization is a superset, or something&lt;/a&gt;... I'm a bit loose with the terminology these days.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What if you want to get a serializable piece and then just reconstruct your object with it yourself? Could you save that piece to disk and recover it and do this too? I needed this for an app I'm doing, so the answer is yes. It works.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Simple object .h&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="border: none; margin: 0 0 0 40px; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: #d200a5;"&gt;@interface&lt;/span&gt; Person : NSObject &amp;lt;NSCoding&amp;gt;{&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSString&lt;/span&gt; *name;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;@property&lt;span style="color: black;"&gt; (&lt;/span&gt;nonatomic&lt;span style="color: black;"&gt;, &lt;/span&gt;retain&lt;span style="color: black;"&gt;) NSString *name;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="color: black;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;and .m&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="border: none; margin: 0 0 0 40px; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;@synthesize&lt;span style="color: black;"&gt; name;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px; min-height: 15.0px;"&gt;&lt;br /&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-style-span" style="font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-family: Menlo; font-size: small;"&gt;&lt;span class="Apple-style-span" style="font-size: 13px;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-style-span" style="font-family: Menlo; font-size: small;"&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;- (&lt;span style="color: #d200a5;"&gt;void&lt;/span&gt;)encodeWithCoder:(&lt;span style="color: #7e11ad;"&gt;NSCoder&lt;/span&gt; *)aCoder {&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;[&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;super&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;encodeWithCoder&lt;span style="color: black;"&gt;:aCoder];&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;[aCoder &lt;/span&gt;encodeObject&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt;&lt;span style="color: black;"&gt;.&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;forKey&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #e90000;"&gt;@"name"&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;- (&lt;span style="color: #d200a5;"&gt;id&lt;/span&gt;)initWithCoder:(&lt;span style="color: #7e11ad;"&gt;NSCoder&lt;/span&gt; *)aDecoder {&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; &lt;span style="color: #d200a5;"&gt;if&lt;/span&gt; ((&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt; = [&lt;span style="color: #d200a5;"&gt;super&lt;/span&gt; &lt;span style="color: #480085;"&gt;initWithCoder&lt;/span&gt;:aDecoder])) {&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;  &lt;/span&gt;&lt;span style="color: #d200a5;"&gt;self&lt;/span&gt;.&lt;span style="color: #7e11ad;"&gt;name&lt;/span&gt; = [aDecoder &lt;span style="color: #480085;"&gt;decodeObjectForKey&lt;/span&gt;:&lt;span style="color: #e90000;"&gt;@"name"&lt;/span&gt;];&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&amp;nbsp; &amp;nbsp; }&lt;/div&gt;&lt;div style="color: #d200a5; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&amp;nbsp; &amp;nbsp; &lt;/span&gt;return&lt;span style="color: black;"&gt; &lt;/span&gt;self&lt;span style="color: black;"&gt;;&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;and now the code that does everything&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div style="font: normal normal normal 13px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; white-space: pre;"&gt;Person *person = [[[Person &lt;span style="color: #480085;"&gt;alloc&lt;/span&gt;] &lt;span style="color: #480085;"&gt;init&lt;/span&gt;] &lt;span style="color: #480085;"&gt;autorelease&lt;/span&gt;];&lt;/div&gt;&lt;div style="font: normal normal normal 13px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; white-space: pre;"&gt;person.name = &lt;span style="color: #e90000;"&gt;@"bob"&lt;/span&gt;;&lt;/div&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&lt;/span&gt;&lt;div style="font: normal normal normal 13px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 15px; white-space: pre;"&gt;NSData *dater = [&lt;span style="color: #7e11ad;"&gt;NSKeyedArchiver&lt;/span&gt; &lt;span style="color: #480085;"&gt;archivedDataWithRootObject&lt;/span&gt;:person];&lt;/div&gt;&lt;div style="color: #7e11ad; font: normal normal normal 13px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; white-space: pre;"&gt;&lt;span style="color: #d200a5;"&gt;BOOL&lt;/span&gt;&lt;span style="color: black;"&gt; result = [&lt;/span&gt;NSKeyedArchiver&lt;span style="color: black;"&gt;&amp;nbsp;&lt;/span&gt;&lt;span class="Apple-style-span" style="color: #e90000;"&gt;&lt;span style="color: #480085;"&gt;archiveRootObject&lt;/span&gt;&lt;span style="color: black;"&gt;:dater&amp;nbsp;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #7e11ad; font: normal normal normal 13px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: #e90000;"&gt;&lt;span class="Apple-style-span" style="color: black;"&gt;                &lt;/span&gt;&lt;span style="color: #480085;"&gt;toFile&lt;/span&gt;&lt;span style="color: black;"&gt;:&lt;/span&gt;@"somewhereInAppSandbox"&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #e90000; font: normal normal normal 13px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; white-space: pre;"&gt;&lt;span style="color: black;"&gt;NSLog(&lt;/span&gt;@"How was saving? %@"&lt;span style="color: black;"&gt;, result ? &lt;/span&gt;@"yes"&lt;span style="color: black;"&gt; : &lt;/span&gt;@"no"&lt;span style="color: black;"&gt; );&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&lt;/span&gt;&lt;div style="font: normal normal normal 13px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; min-height: 15px; white-space: pre;"&gt;&lt;span class="Apple-style-span" style="color: #e90000;"&gt;&lt;span style="color: black;"&gt;dater = [&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSKeyedUnarchiver&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;&lt;span style="color: #480085;"&gt;unarchiveObjectWithFile&lt;/span&gt;&lt;span style="color: black;"&gt;:&lt;/span&gt;@"somewhereInAppSandbox"&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #480085; font: normal normal normal 13px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; white-space: pre;"&gt;&lt;span style="color: black;"&gt;person = [&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;NSKeyedUnarchiver&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;unarchiveObjectWithData&lt;span style="color: black;"&gt;:dater];&lt;/span&gt;&lt;/div&gt;&lt;div style="color: #e90000; font: normal normal normal 13px/normal Menlo; margin-bottom: 0px; margin-left: 0px; margin-right: 0px; margin-top: 0px; white-space: pre;"&gt;&lt;span style="color: black;"&gt;NSLog(&lt;/span&gt;@"Are we there? %@"&lt;span style="color: black;"&gt;, person.&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;name&lt;/span&gt;&lt;span style="color: black;"&gt;);&lt;/span&gt;&lt;/div&gt;&lt;span class="Apple-style-span" style="white-space: pre;"&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;Since we call the super methods for both init and encode, this works perfectly well even if the initial serialized object was a NIB.&lt;br /&gt;&lt;br /&gt;The point of this entire exercise is to allow you to reuse your &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;encodeWithCoder&lt;/span&gt; and &lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;initWithCoder&lt;/span&gt; methods to, for instance, make deep clones. This is very important because it will keep:&lt;br /&gt;&lt;div&gt;&lt;ol&gt;&lt;li&gt;Your code DRY and therefore&lt;/li&gt;&lt;li&gt;You from going insane&lt;/li&gt;&lt;/ol&gt;&lt;div&gt;&lt;b&gt;Note&lt;/b&gt;: The filenames as presented won't work on an iOS device. &lt;a href="http://compileyouidontevenknowyou.blogspot.com/2010/07/simple-serialization-well-archiving-on.html"&gt;See my later post here for just the filenames bit.&lt;/a&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7753455198946994824?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7753455198946994824/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7753455198946994824' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7753455198946994824'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7753455198946994824'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/nskeyedarchiver-encoding-and-decoding.html' title='NSKeyedArchiver: Encoding and Decoding for Fun and Profit'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-9051215547060235706</id><published>2010-07-24T19:31:00.001-03:00</published><updated>2010-07-24T19:31:14.762-03:00</updated><title type='text'>Serializing for iPhone, Part II: HelloWorlds With NSCoder</title><content type='html'>So all this &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;NSUserDefaults&lt;/font&gt; stuff is cute, but it&amp;#39;s probably the most annoying option. It does handle some of the code for you, but you end up writing it in other places. So let&amp;#39;s start again, this time using the &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;NSCoder&lt;/font&gt; paradigm 100%. This time we have two objects:&lt;div&gt; &lt;br&gt;&lt;/div&gt;&lt;div&gt;Inner which holds a CGPoint&lt;blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;&lt;br&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;#import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@interface Inner : NSObject {&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;CGPoint point;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt; &lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@property CGPoint point;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt; &lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@en&lt;/font&gt;d&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;and Outer which holds an Inner&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt; &lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;#import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;#import &amp;quot;Inner.h&amp;quot;&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@interface Outer : NSObject {&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;courier new&amp;#39;, monospace; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;Inner *inner;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@property (nonatomic, retain)  Inner *inner;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt; &lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;@en&lt;/font&gt;d&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt; &lt;div&gt;That&amp;#39;s it! Now figure it out. I do not want to inform the client class about Outer&amp;#39;s structure.&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;First, without any clue as to how this will work, I implement NSCoding for Outer like so (after making the changes to the .h):&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;- (void)encodeWithCoder:(NSCoder *)aCoder {&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[aCoder encodeObject:self.inner forKey:@&amp;quot;inner&amp;quot;];&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt; &lt;span class="Apple-style-span" style="font-family: &amp;#39;courier new&amp;#39;, monospace; "&gt;}&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt; &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;- (id)initWithCoder:(NSCoder *)aDecoder {&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;self.inner = [aDecoder decodeObjectForKey:@&amp;quot;inner&amp;quot;];&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return self;&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;and for Inner&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;- (void)encodeWithCoder:(NSCoder *)aCoder &lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;courier new&amp;#39;, monospace; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[aCoder encodeObject:NSStringFromCGPoint(self.point) forKey:@&amp;quot;point&amp;quot;];&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;- (id)initWithCoder:(NSCoder *)aDecoder {&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;courier new&amp;#39;, monospace; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;self.point = CGPointFromString([aDecoder decodeObjectForKey:@&amp;quot;point&amp;quot;]);&lt;/span&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;courier new&amp;#39;, monospace; "&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return self;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Now let&amp;#39;s just serialize and them, or something.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt; &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;Outer *outer = [[[Outer alloc] init] autorelease];&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;outer.inner = [[[Inner alloc] init] autorelease];&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;outer.inner.point = CGPointMake(525, 525);&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;BOOL result = [NSKeyedArchiver archiveRootObject:outer toFile:@&amp;quot;somewhereInAppSandbox&amp;quot;];&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;NSLog(@&amp;quot;how did that go %@&amp;quot;, result ? @&amp;quot;yes&amp;quot; : @&amp;quot;no&amp;quot; );&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;And deserialize them? &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;Outer *outer = [NSKeyedUnarchiver unarchiveObjectWithFile:@&amp;quot;somewhereInAppSandbox&amp;quot;];&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;NSLog(@&amp;quot;moment of truth %@&amp;quot;, NSStringFromCGPoint(outer.inner.point));&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Wow, this is actually pretty cool. I mean, not as cool as C#&amp;#39;s automatic XML serialization, but I&amp;#39;ll take it.&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Now... what happens if we house the Outer in an NSArray? &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;blockquote class="webkit-indent-blockquote" style="margin: 0 0 0 40px; border: none; padding: 0px;"&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;Outer *outer;&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithFile:@&amp;quot;somewhereInAppSandbox.anArray&amp;quot;];&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;if (array != nil) {&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;outer = [array objectAtIndex:0];&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;NSLog(@&amp;quot;moment of truth %@&amp;quot;, NSStringFromCGPoint(outer.inner.point));&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;} &lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;outer = [[[Outer alloc] init] autorelease];&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;outer.inner = [[[Inner alloc] init] autorelease];&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;outer.inner.point = CGPointMake(525, 525);&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;array = [[[NSArray alloc] initWithObjects:outer, nil] autorelease];&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;br&gt; &lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;BOOL result = [NSKeyedArchiver archiveRootObject:array toFile:@&amp;quot;somewhereInAppSandbox.anArray&amp;quot;];&lt;/font&gt;&lt;/div&gt;&lt;/div&gt; &lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;NSLog(@&amp;quot;how did that go %@&amp;quot;, result ? @&amp;quot;yes&amp;quot; : @&amp;quot;no&amp;quot; &lt;/font&gt;);&lt;/div&gt;&lt;/div&gt;&lt;/blockquote&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Awesome. Now I can have a drink. So what was the point? This way we get an object graph, and each object -- via conforming to the NSCoding protocol --  gets to define how it wants to serialize. And standard property-set objects know how to do their own stuff anyway. Nice!&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-9051215547060235706?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/9051215547060235706/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=9051215547060235706' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/9051215547060235706'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/9051215547060235706'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/serializing-for-iphone-part-ii.html' title='Serializing for iPhone, Part II: HelloWorlds With NSCoder'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-2669153869128726442</id><published>2010-07-24T18:01:00.001-03:00</published><updated>2010-07-24T18:01:51.835-03:00</updated><title type='text'>HelloWorld: Saving Application State for iPhone Apps</title><content type='html'>So now I urgently need to know how to persist the data for my iPhone app. Otherwise, every time the user exits, they have to start from zero. Let&amp;#39;s forget about how much mucking my app will need to be able to reconstruct state at any moment. First, the HelloWorld.&lt;div&gt; &lt;br&gt;&lt;/div&gt;&lt;div&gt;So before anything, I Google the problem and the first information points to the NSUserDefaults class. Apparently, this class can do it all, though if you need more complex models you might use CoreData. And it looks like all I&amp;#39;ll need to do is to have my objects conform to the NSCoding protocol if they&amp;#39;re in an NSArray. Nice. I might be able to do that. Let&amp;#39;s get started.&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;But on the off-chance that you can just call writeToFile in arrays, let&amp;#39;s try that first:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSArray *fred = [NSArray arrayWithContentsOfFile:@&amp;quot;myArray&amp;quot;];&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSLog(@&amp;quot;is he null %@&amp;quot;, [fred description]);&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;So that worked perfectly! It&amp;#39;s null. So now let&amp;#39;s try:&lt;/div&gt;&lt;div&gt; &lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSArray *bob = [[[NSArray alloc] initWithObjects:@&amp;quot;one&amp;quot;, @&amp;quot;two&amp;quot;, @&amp;quot;three&amp;quot;, nil] autorelease];&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[bob writeToFile:@&amp;quot;myArray&amp;quot; atomically:YES];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSLog(@&amp;quot;that seemed okay %d&amp;quot;, [bob count]);&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;And now I run it a third time and it&amp;#39;s:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;2010-07-24 16:06:56.217 TestingPersistence001[4442:207] is he null (&lt;/div&gt;&lt;div&gt;    one,&lt;/div&gt;&lt;div&gt;    two,&lt;/div&gt;&lt;div&gt;    three&lt;/div&gt; &lt;div&gt;)&lt;/div&gt;&lt;div&gt;2010-07-24 16:06:56.219 TestingPersistence001[4442:207] that seemed okay 3&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Which basically means that if we wanted to, we could run with that for now!&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt; So let&amp;#39;s go a bit further because that only took about 5 minutes so far, and see if we can get it into this NSUserDefaultsClass. And then we have to see if we can somehow serialize a thing that is holding a CGPoint (for instance).&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;So first we try to retrieve the defaults, so we can make sure we&amp;#39;re not getting faked out (as we did above):&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSArray *bob = [defaults arrayForKey:@&amp;quot;bob&amp;quot;];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if (bob == nil)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;NSLog(@&amp;quot;sorry it&amp;#39;s nil&amp;quot;);&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Now I have no idea how to persist this thing. Hmmm... So first let&amp;#39;s set the array. But wait! There&amp;#39;s no setArray method. Whatever. It must use setObject and sort &amp;#39;em out.&lt;/div&gt;&lt;div&gt;&lt;br&gt; &lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;bob = [[[NSArray alloc] initWithObjects:@&amp;quot;one&amp;quot;, @&amp;quot;two&amp;quot;, @&amp;quot;three&amp;quot;, nil] autorelease];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[defaults setObject:bob forKey:@&amp;quot;bob&amp;quot;];&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSLog(@&amp;quot;made it&amp;quot;);&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Okay, so putting these two together and running twice didn&amp;#39;t work. It doesn&amp;#39;t persist automatically. How does it, then? Let&amp;#39;s try the synchronize method. Good, that worked. So this is the final HelloWorld code:&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSArray *bob = [defaults arrayForKey:@&amp;quot;bob&amp;quot;];&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if (bob == nil)&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;NSLog(@&amp;quot;sorry it&amp;#39;s nil&amp;quot;);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;else &lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;NSLog(@&amp;quot;bob has %d things&amp;quot;, [bob count]);&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if (bob == nil) {&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;bob = [[[NSArray alloc] initWithObjects:@&amp;quot;one&amp;quot;, @&amp;quot;two&amp;quot;, @&amp;quot;three&amp;quot;, nil] autorelease];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;[defaults setObject:bob forKey:@&amp;quot;bob&amp;quot;];&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;[defaults synchronize];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSLog(@&amp;quot;made it&amp;quot;);&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Great. Now we only have to make a custom object, put a CGFloat on it and we&amp;#39;re done with most things.&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Note:&lt;/b&gt; I&amp;#39;m oversimplifying and there&amp;#39;s a bunch of stuff about domains on the save, and a bunch of stuff about property lists on the setObject. But let&amp;#39;s finish this up first.&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;TheObject&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;div&gt;#import &amp;lt;Foundation/Foundation.h&amp;gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;@interface TheObject : NSObject {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;CGPoint point;&lt;/div&gt; &lt;div&gt;}&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;@property (nonatomic, assign) CGPoint point;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;@end&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;with standard .m file (with @synthesize!)&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;So we run this&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;TheObject *object = [[[TheObject alloc] init] autorelease];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;object.point = CGPointMake(1024, 768);&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[defaults setObject:object forKey:@&amp;quot;theObject&amp;quot;];&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;br&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;a&lt;/span&gt;nd the console says, &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;-[NSUserDefaults setObject:forKey:]: Attempt to insert non-property value &amp;#39;&amp;lt;TheObject: 0x59351c0&amp;gt;&amp;#39; of class &amp;#39;TheObject&amp;#39;.&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;That was fast and wrong! Sooo... how can we make it a property value. Before reading anything, let&amp;#39;s make it conform to NSCoding. And that didn&amp;#39;t work. At all. And reading about it, it has nothing to do with anything. This thing has to be a property list. I can&amp;#39;t take it anymore. Brute force!&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;On TheObject class&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;- (NSDictionary*) getSerializablePiece {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSArray *keys = [[[NSArray alloc] initWithObjects:@&amp;quot;point&amp;quot;, nil] autorelease];&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;NSArray *objects = [[[NSArray alloc] initWithObjects:NSStringFromCGPoint(self.point), nil] autorelease];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;return [[[NSDictionary alloc] initWithObjects:objects forKeys:keys] autorelease];&lt;/div&gt; &lt;div&gt;}&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;And in the testing main&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;TheObject *object = [defaults objectForKey:@&amp;quot;theObj&amp;quot;];&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;if (object != nil) {&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;NSDictionary *dic = (NSDictionary*)object;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;		&lt;/span&gt;NSLog(@&amp;quot;what %@&amp;quot;, [dic objectForKey:@&amp;quot;point&amp;quot;]);&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;}&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;&lt;/div&gt;&lt;div&gt; &lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;object = [[[TheObject alloc] init] autorelease];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;object.point = CGPointMake(1024, 768);&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[defaults setObject:[object getSerializablePiece]  forKey:@&amp;quot;theObj&amp;quot;];&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;	&lt;/span&gt;[defaults synchronize];&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;man is that ugly. But it does work. Now that we&amp;#39;re done with the HelloWorld, it&amp;#39;s time to sweep the floor and figure out how to use this stuff for real(s).&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Conclusion: you can use NSUserDefaults, but it&amp;#39;s a bit particular about what it will serialize.&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-2669153869128726442?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/2669153869128726442/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=2669153869128726442' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2669153869128726442'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2669153869128726442'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/helloworld-saving-application-state-for.html' title='HelloWorld: Saving Application State for iPhone Apps'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-5019596352075197458</id><published>2010-07-17T13:35:00.001-03:00</published><updated>2011-10-12T17:25:00.801-03:00</updated><title type='text'>Blocks in Objective-C</title><content type='html'>Unfortunately, Objective-C is dominated mostly by geniuses (who laugh at any possible ambiguity between "heap" and "stack") and newbies to programming ("I have an IBOutlet, but the screen is blank!?"). Thanks to iPhone development, there are increasing numbers of simple HelloWorld types of examples of things, but... &lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Block Basics&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br /&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;I'm not going to talk about whether the variables are on the heap or stack (&lt;a href="http://stackoverflow.com/questions/2054608/asterisk-usage-in-objective-c-related-questions"&gt;which apparently is not that important&lt;/a&gt;&amp;nbsp;in Obj-C,&amp;nbsp;and many C developers misunderstand it anyway), nor about the problems with retain counts and other technical details about blocks. This topic is best covered by people who can really take it apart... maybe. Maybe I'll get to it myself. In any case, here's the &lt;a href="http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Blocks/Articles/00_Introduction.html#//apple%5Fref/doc/uid/TP40007502-CH1-SW1"&gt;definitive source&lt;/a&gt;.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;But here are some examples for the lost. The syntax really really really sucks (compared to Ruby blocks, which are beautiful, but I digress).&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Simplest Example (void in, void out) of Passing a Block to a Function&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;typedef void (^simplestBlock)(void);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@synthesize window;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;simplestBlock b = ^(void) { NSLog(@"inside simple block"); };&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;[self blah:b];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void)blah:(simplestBlock)b {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;b();&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@end&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Simplest Example, NSString* in&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;typedef void (^simplestBlock)(NSString *);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@synthesize window;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;simplestBlock b = ^(NSString* thing) { NSLog(@"got your string %@", thing); };&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;[self blah:b];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void)blah:(simplestBlock)b {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;b(@"got one");&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@end&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Simplest Example, NSString* in and out&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;typedef NSString* (^simplestBlock)(NSString *);&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@synthesize window;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt; &lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;simplestBlock b = ^NSString* (NSString* thing) { return [NSString stringWithFormat:@"processed: %@", thing]; };&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;[self blah:b];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void)blah:(simplestBlock)b {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;NSLog(@"here goes nothing: %@", b(@"stirng sent to block"));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@end&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;Simplest Example In and Out, No typedef&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;The typedef is recommended by Apple: "You can also create types for blocks—doing so is generally considered to be best practice when you use a block with a given signature in multiple places:" But what does it look like without them?&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'Lucida Grande', Geneva, Helvetica, Arial, sans-serif; font-size: 16px;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@synthesize window;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void)applicationDidFinishLaunching:(NSNotification *)aNotification {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;NSString* (^b) (NSString *) = ^NSString* (NSString* thing) { return [NSString stringWithFormat:@"processed: %@", thing]; };&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;[self blah:b];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void)blah:(NSString* (^)(NSString* thing))b {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;NSLog(@"here goes nothing: %@", b(@"stirng sent to block"));&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;@end&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I cannot seem to increase the retain count of the block, so perhaps you don't need to release it?&lt;br /&gt;&lt;br /&gt;&lt;b&gt;Later:&lt;/b&gt;&amp;nbsp;You don't need to release it nor retain it. However, under ARC you should always use copy if you're going to store it.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-5019596352075197458?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/5019596352075197458/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=5019596352075197458' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5019596352075197458'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5019596352075197458'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/blocks-in-objective-c.html' title='Blocks in Objective-C'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-1081278842802999707</id><published>2010-07-13T02:44:00.001-03:00</published><updated>2010-07-13T02:44:24.815-03:00</updated><title type='text'>Animation in iOS 4.0</title><content type='html'>Well, I just got schooled on Core Animation. Apparently, iOS 4.0 changed everything, and now they want you to use blocks. Matz would be so happy, although it&amp;#39;s a C thing (like so much of Ruby). Anyway, here&amp;#39;s how I&amp;#39;m using blocks until told better (I could, at least, invert the logic so the BOOL is called &amp;quot;animate&amp;quot;): &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;- (void) makePhrases:(BOOL)inAnimation {&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;if (!inAnimation) {&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;		&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;[UIView animateWithDuration:3&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;						&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt; animations:^{ [self makePhrases:YES]; }&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;						&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt; completion:^(BOOL finished){ [self zoomIn:NO]; }];&lt;/font&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;		&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;return;&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;CGSize spaceSize = [@&amp;quot; &amp;quot; sizeWithFont:tView.font];&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;float leftMargin = 8;&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;float topMargin = 8;&lt;/font&gt;&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I&amp;#39;m using this inAnimation parameter everywhere, until I can figure out why it&amp;#39;s a bad idea. Blocks! Small world, eh?&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-1081278842802999707?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/1081278842802999707/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=1081278842802999707' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1081278842802999707'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1081278842802999707'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/animation-in-ios-40.html' title='Animation in iOS 4.0'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-614719322933976103</id><published>2010-07-11T22:05:00.001-03:00</published><updated>2010-07-11T22:05:55.119-03:00</updated><title type='text'>Your First Extension With Radiant</title><content type='html'>So I&amp;#39;m trying out Radiant, and one of my first questions is, what if I wanted to actually get a Rails view in there as content? Without a doubt I&amp;#39;ll need to make a Radiant extension, so I&amp;#39;ll be following the steps &lt;a href="http://wiki.github.com/radiant/radiant/how-to-create-an-extension"&gt;laid out here&lt;/a&gt;.&lt;div&gt; &lt;br&gt;&lt;/div&gt;&lt;div&gt;So you do a script/generate extension whatever and you get a full directory replete with views and even a routes.rb and everything. Which seems to be a normal Rails extension. So I just did a HelloWorld, but they did an example with scaffold. Either way works. The interesting thing is that your routes end up available in Rails just like normal. So: &lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;  map.connect &amp;#39;helloWorld&amp;#39;, :controller =&amp;gt; &amp;#39;root&amp;#39;, :action =&amp;gt; &amp;#39;hello&amp;#39;&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt; &lt;/div&gt;&lt;div&gt;refers to the real url helloWorld, even though it&amp;#39;s in its own mini routes.rb. So it&amp;#39;s all normal and 100% Rails.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;Only one thing in the instructions was wrong: the routes.rb, they say, &amp;quot;In the extension directory (/sample/vendor/extensions/queen), edit the queen_extension.rb file, to define the routes to your extension, replace:&amp;quot; but this should be in the routes.rb, actually (perhaps it&amp;#39;s changed?).&lt;div&gt; &lt;br&gt;&lt;div&gt;And then you... follow the instructions and finish, and it works perfectly. Not much of a blog entry, I know, but perhaps my optimism about Radiant has gotten the better of me.&lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-614719322933976103?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/614719322933976103/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=614719322933976103' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/614719322933976103'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/614719322933976103'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/your-first-extension-with-radiant.html' title='Your First Extension With Radiant'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-1824871358298504121</id><published>2010-07-08T12:17:00.005-03:00</published><updated>2010-07-13T02:17:25.287-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='objective-c iphone-sdk cocoatouch'/><title type='text'>Custom UIActionSheet, Those Damn Blue Buttons and Simple Animation</title><content type='html'>&lt;div class="gmail_quote"&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;Custom UIActionSheet&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;a href="http://www.nearinfinity.com/blogs/andrew_homeyer/display_a_custom_uiview_like_a.html" target="_blank"&gt;CustomUIActionSheet&lt;/a&gt;? Sometimes blogs are annoying and the process is hard to follow. But here it's just a matter of grabbing the code in GitHub and making sure to call the viewWillAppear method. Great great great thank you to Andrew Homeyer!&lt;br /&gt;&lt;br /&gt;He's got a view sliding up inside a background view. For what I need to do (right now), I ended up doing this:&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;self.tweakPage.view.frame = self.view.window.frame;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;[self.view.window addSubview:self.tweakPage.view];&lt;/span&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'Courier New', Courier, monospace;"&gt;[self.tweakPage viewWillAppear:YES];&lt;/span&gt;&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;br /&gt;&lt;div&gt;which is to say, you can attach it to the UIWindow at the top of your view hierarchy and then it really is -- for all intents and purposes -- modal.&lt;br /&gt;&lt;br /&gt;You can also get into his NIB and put in a close button instead of the one he's got, and get rid of the UINavigationBar... actually you can do whatever you want. The example code is (like) perfect!&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: large;"&gt;&lt;b&gt;Those Cool Blue Buttons&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;What about the stupid blue buttons that appear in real iPhone apps? This is directly from the Apress book. First, download the icons from here:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;a href="http://developer.apple.com/iphone/library/samplecode/UICatalog/index.html" target="_blank"&gt;http://developer.apple.com/iphone/library/samplecode/UICatalog/index.html&lt;/a&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and then in your ViewDidLoad method do something like this&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;UIImage *image = [UIImage imageNamed:@"blueButton.png"];&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;UIImage *stretchedImage = [image stretchableImageWithLeftCapWidth:12 topCapHeight:0];&lt;br /&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;[self.closeButton setBackgroundImage:stretchedImage forState:UIControlStateNormal];&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;Then you can mess around with the button's type. I just got a great result setting the type to custom (in IB). Anyway...&amp;nbsp;the stretchable part is the stuff you wouldn't figure out without opening the book.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-size: x-large;"&gt;&lt;b&gt;Tweens on the iPhone&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;They're tweens. iPhone devs might not know this, but that's what we called them in Flash.&lt;br /&gt;&lt;br /&gt;Animation on iPhone is pretty simple, or at least the simple kind is. This is 99% from the CustomUIActionSheet code above.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;[UIView beginAnimations:@"someName" context:nil];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;// Set delegate and selector to remove from superview when animation completes&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;[UIView setAnimationDelegate:self];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;// move stuff by setting frames to the end positions &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span style="white-space: pre-wrap;"&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;[UIView commitAnimations];&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;Then the animationDidStop method looks like this&lt;br /&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;- (void)animationDidStop:(NSString *)animationID&amp;nbsp;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;finished:(NSNumber *)finished context:(void *)context {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if ([animationID isEqualToString:@"&lt;/span&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;someName"]) {&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;// do something here&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;}&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;br /&gt;&lt;/span&gt;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;b&gt;NOTE: &lt;/b&gt;I just noticed that this is behind the times. See &lt;a href="http://stackoverflow.com/questions/3126833/what-are-block-based-animation-methods-in-iphone-os-4-0"&gt;this question on SO&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-1824871358298504121?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/1824871358298504121/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=1824871358298504121' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1824871358298504121'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/1824871358298504121'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/custom-uiactionsheet-those-damn-blue_08.html' title='Custom UIActionSheet, Those Damn Blue Buttons and Simple Animation'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-6825300438362106723</id><published>2010-07-06T23:08:00.001-03:00</published><updated>2010-07-06T23:08:38.737-03:00</updated><title type='text'>Load UIView From Nib</title><content type='html'>This was a hassle to track down and I actually ended up opening a book. The Internet is not very helpful sometimes. Books still rule, sometimes.&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;- (void)viewDidLoad {&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;    [super viewDidLoad];&lt;/font&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;NSArray *bundle = [[NSBundle mainBundle] loadNibNamed:@&amp;quot;Blah&amp;quot; &lt;/font&gt;&lt;span class="Apple-style-span" style="font-family: &amp;#39;courier new&amp;#39;, monospace; "&gt;owner:self options:nil];&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;Blah *blah;&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;for (id object in bundle) {&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;		&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;if ([object isKindOfClass:[Blah class]])&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;			&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;blah = (Blah *)object;&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt; &lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-tab-span" style="white-space:pre"&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;	&lt;/font&gt;&lt;/span&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;[self.view addSubview: blah];&lt;/font&gt;&lt;/div&gt; &lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;}&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;This assumes a Xib named &amp;#39;Blah&amp;#39; with its view set to a UIView subclass named &amp;#39;Blah&amp;#39; (which also exists).&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-6825300438362106723?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/6825300438362106723/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=6825300438362106723' title='1 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/6825300438362106723'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/6825300438362106723'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/load-uiview-from-nib.html' title='Load UIView From Nib'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>1</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7403878256354348534</id><published>2010-07-01T16:36:00.001-03:00</published><updated>2010-07-01T16:36:17.130-03:00</updated><title type='text'>Skype Call Problems</title><content type='html'>&lt;p class="mobile-photo"&gt;&lt;a href="http://2.bp.blogspot.com/_QFCElrKyI6g/TCzuMe6690I/AAAAAAAADY4/9p-ABV-vxSA/s1600/ScreenShot004-777131.jpg"&gt;&lt;img src="http://2.bp.blogspot.com/_QFCElrKyI6g/TCzuMe6690I/AAAAAAAADY4/9p-ABV-vxSA/s320/ScreenShot004-777131.jpg"  border="0" alt="" id="BLOGGER_PHOTO_ID_5489023944083830594" /&gt;&lt;/a&gt;&lt;/p&gt;I found this from a few years ago... &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7403878256354348534?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7403878256354348534/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7403878256354348534' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7403878256354348534'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7403878256354348534'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/07/skype-call-problems.html' title='Skype Call Problems'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://2.bp.blogspot.com/_QFCElrKyI6g/TCzuMe6690I/AAAAAAAADY4/9p-ABV-vxSA/s72-c/ScreenShot004-777131.jpg' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-6545675973353706219</id><published>2010-06-21T19:14:00.003-03:00</published><updated>2010-12-04T19:02:18.487-03:00</updated><title type='text'>Random Colors in Objective-C</title><content type='html'>My main focus in coding always has been doing Hello Worlds. Putting a bunch of them together to actually write a well-organized program that does something is trivial, really. HelloWorlds, on the other hand, are a bitch.&lt;br /&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;So anyway... I've been going through the different ways to get multiple pages in CocoaTouch (&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;UIScrollView&lt;/span&gt;, &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;UINavigationViewController&lt;/span&gt;, &lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;UITabViewController&lt;/span&gt; etc.). Then you can put one inside the other in lots of cool combinations. But when you're creating views programmatically, it's really helpful to have random colors so your HelloWorlds look cool. To do that, you need this ridiculously simple method:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;span class="Apple-style-span" style="font-family: 'courier new', monospace;"&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;- (&lt;span style="color: #7e11ad;"&gt;UIColor&lt;/span&gt; *) getRandomColor {&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; [&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;UIColor&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;colorWithRed&lt;span style="color: black;"&gt;:(&lt;/span&gt;random&lt;span style="color: black;"&gt;()%&lt;/span&gt;&lt;span style="color: #3900de;"&gt;100&lt;/span&gt;&lt;span style="color: black;"&gt;)/(&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;float&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;span style="color: #3900de;"&gt;100&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;green&lt;span style="color: black;"&gt;:(&lt;/span&gt;random&lt;span style="color: black;"&gt;()%&lt;/span&gt;&lt;span style="color: #3900de;"&gt;100&lt;/span&gt;&lt;span style="color: black;"&gt;)/(&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;float&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;span style="color: #3900de;"&gt;100&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;blue&lt;span style="color: black;"&gt;:(&lt;/span&gt;random&lt;span style="color: black;"&gt;()%&lt;/span&gt;&lt;span style="color: #3900de;"&gt;100&lt;/span&gt;&lt;span style="color: black;"&gt;)/(&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;float&lt;/span&gt;&lt;span style="color: black;"&gt;)&lt;/span&gt;&lt;span style="color: #3900de;"&gt;100&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;alpha&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #3900de;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/span&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;If you can simplify the math, you should. [Later] Here's a better version, based on the answer &lt;a href="http://stackoverflow.com/questions/3357173/getrandomcolor-but-avoid-dark-colors-help-my-algorithm/3357312#3357312"&gt;here&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;- (&lt;span style="color: #7e11ad;"&gt;UIColor&lt;/span&gt; *) getRandomColor {&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;CGFloat&lt;/span&gt; hue = ( &lt;span style="color: #480085;"&gt;arc4random&lt;/span&gt;() % &lt;span style="color: #3900de;"&gt;256&lt;/span&gt; / &lt;span style="color: #3900de;"&gt;256.0&lt;/span&gt; );&amp;nbsp; &lt;span style="color: #008d00;"&gt;//&amp;nbsp; 0.0 to 1.0&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;CGFloat&lt;/span&gt; saturation = ( &lt;span style="color: #480085;"&gt;arc4random&lt;/span&gt;() % &lt;span style="color: #3900de;"&gt;128&lt;/span&gt; / &lt;span style="color: #3900de;"&gt;256.0&lt;/span&gt; ) + &lt;span style="color: #3900de;"&gt;0.5&lt;/span&gt;;&amp;nbsp; &lt;span style="color: #008d00;"&gt;//&amp;nbsp; 0.5 to 1.0, away from white&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;CGFloat&lt;/span&gt; brightness = ( &lt;span style="color: #480085;"&gt;arc4random&lt;/span&gt;() % &lt;span style="color: #3900de;"&gt;128&lt;/span&gt; / &lt;span style="color: #3900de;"&gt;256.0&lt;/span&gt; ) + &lt;span style="color: #3900de;"&gt;0.5&lt;/span&gt;; &amp;nbsp;&lt;/div&gt;&lt;div style="color: #480085; font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;&lt;span style="color: black;"&gt;&lt;span class="Apple-tab-span" style="white-space: pre;"&gt; &lt;/span&gt;&lt;/span&gt;&lt;span style="color: #d200a5;"&gt;return&lt;/span&gt;&lt;span style="color: black;"&gt; [&lt;/span&gt;&lt;span style="color: #7e11ad;"&gt;UIColor&lt;/span&gt;&lt;span style="color: black;"&gt; &lt;/span&gt;colorWithHue&lt;span style="color: black;"&gt;:hue &lt;/span&gt;saturation&lt;span style="color: black;"&gt;:saturation &lt;/span&gt;brightness&lt;span style="color: black;"&gt;:brightness &lt;/span&gt;alpha&lt;span style="color: black;"&gt;:&lt;/span&gt;&lt;span style="color: #3900de;"&gt;1&lt;/span&gt;&lt;span style="color: black;"&gt;];&lt;/span&gt;&lt;/div&gt;&lt;div style="font: 13.0px Menlo; margin: 0.0px 0.0px 0.0px 0.0px;"&gt;}&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-6545675973353706219?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/6545675973353706219/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=6545675973353706219' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/6545675973353706219'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/6545675973353706219'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/06/random-colors-in-objective-c.html' title='Random Colors in Objective-C'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-136389782650890189</id><published>2010-06-20T21:03:00.001-03:00</published><updated>2010-06-20T21:03:51.673-03:00</updated><title type='text'>World's Simplest Example: UINavigationController</title><content type='html'>This is a Simplest Example of how to use a UINavigationController (based on my question &lt;a href="http://stackoverflow.com/questions/3077613"&gt;here&lt;/a&gt;). The idea is that the example is 100% self contained. &lt;b&gt;Warning: if you actually code this way (big monolithic classes) your code will suck&lt;/b&gt;. In this example, the UIViewControllers should actually be subclasses that contain the behavior and data they need to do their work. But that&amp;#39;s another problem.&lt;div&gt; &lt;br&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, &amp;#39;Liberation Sans&amp;#39;, &amp;#39;DejaVu Sans&amp;#39;, sans-serif; font-size: 11.1111px; border-collapse: collapse; line-height: 20px; "&gt;&lt;pre class="prettyprint" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, &amp;#39;Lucida Console&amp;#39;, &amp;#39;Liberation Mono&amp;#39;, &amp;#39;DejaVu Sans Mono&amp;#39;, &amp;#39;Bitstream Vera Sans Mono&amp;#39;, &amp;#39;Courier New&amp;#39;, monospace, serif; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Menlo, Monaco, &amp;#39;Lucida Console&amp;#39;, &amp;#39;Liberation Mono&amp;#39;, &amp;#39;DejaVu Sans Mono&amp;#39;, &amp;#39;Bitstream Vera Sans Mono&amp;#39;, &amp;#39;Courier New&amp;#39;, monospace, serif; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;-&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;(&lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;void&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;)&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;viewDidLoad &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;{&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt;     &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[&lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;super&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; viewDidLoad&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;br&gt;    &lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;UIViewController&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;*&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;one &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[[[&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;UIViewController&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; alloc&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;]&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; init&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;]&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; autorelease&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;br&gt;    &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;one&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;view setBackgroundColor&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;:[&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;UIColor&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; yellowColor&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;]];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt;     &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;one setTitle&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;:@&lt;/span&gt;&lt;span class="str" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;&amp;quot;One&amp;quot;&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;br&gt;    navController &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[[&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;UINavigationController&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; alloc&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;]&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; initWithRootViewController&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;:&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;one&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt;     &lt;/span&gt;&lt;span class="com" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: gray; background-position: initial initial; background-repeat: initial initial; "&gt;// here &amp;#39;s the key to the whole thing: we&amp;#39;re adding the navController&amp;#39;s view to the &lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt;     &lt;/span&gt;&lt;span class="com" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: gray; background-position: initial initial; background-repeat: initial initial; "&gt;// self.view, NOT the one.view! So one would be the home page of the app (or something)&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt;     &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[&lt;/span&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;self&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;view addSubview&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;:&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;navController&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;view&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;br&gt;    one &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[[[&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;UIViewController&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; alloc&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;]&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; init&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;]&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; autorelease&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;br&gt;    &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;one&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;view setBackgroundColor&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;:[&lt;/span&gt;&lt;span class="typ" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(43, 145, 175); background-position: initial initial; background-repeat: initial initial; "&gt;UIColor&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; blueColor&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;]];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt;     &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;one setTitle&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;:@&lt;/span&gt;&lt;span class="str" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;&amp;quot;Two&amp;quot;&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;br&gt;    &lt;/span&gt;&lt;span class="com" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: gray; background-position: initial initial; background-repeat: initial initial; "&gt;// subsequent views get pushed, pulled, prodded, etc.&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt;     &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;[&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;navController pushViewController&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;:&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;one animated&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;:&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;YES&lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;];&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;}&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt; &lt;/span&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-136389782650890189?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/136389782650890189/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=136389782650890189' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/136389782650890189'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/136389782650890189'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/06/worlds-simplest-example.html' title='World&apos;s Simplest Example: UINavigationController'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4679235458801887511</id><published>2010-06-04T10:53:00.001-03:00</published><updated>2010-06-04T10:53:14.042-03:00</updated><title type='text'>Twitter Over Capacity</title><content type='html'>&lt;p class="mobile-photo"&gt;&lt;a href="http://3.bp.blogspot.com/_QFCElrKyI6g/TAkFSuRtsbI/AAAAAAAADYw/j7gOY_WJeT4/s1600/Screen+shot+2010-06-04+at+9.52.04+AM-794043.png"&gt;&lt;img src="http://3.bp.blogspot.com/_QFCElrKyI6g/TAkFSuRtsbI/AAAAAAAADYw/j7gOY_WJeT4/s320/Screen+shot+2010-06-04+at+9.52.04+AM-794043.png"  border="0" alt="" id="BLOGGER_PHOTO_ID_5478916240891031986" /&gt;&lt;/a&gt;&lt;/p&gt;&lt;br&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4679235458801887511?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4679235458801887511/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4679235458801887511' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4679235458801887511'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4679235458801887511'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/06/twitter-over-capacity.html' title='Twitter Over Capacity'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media='http://search.yahoo.com/mrss/' url='http://3.bp.blogspot.com/_QFCElrKyI6g/TAkFSuRtsbI/AAAAAAAADYw/j7gOY_WJeT4/s72-c/Screen+shot+2010-06-04+at+9.52.04+AM-794043.png' height='72' width='72'/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-461214084762657690</id><published>2010-06-04T10:48:00.001-03:00</published><updated>2010-06-04T10:48:04.274-03:00</updated><title type='text'>parse_git_branch, still</title><content type='html'>I&amp;#39;m &lt;b&gt;still &lt;/b&gt;working with the&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt; parse_git_branch &lt;/font&gt;script &lt;a href="http://stackoverflow.com/questions/2850425/translate-parse-git-branch-function-to-zsh-from-bash-for-prompt/2851964#2851964"&gt;that goes against the plumbing instead of the porcelain&lt;/a&gt; to get it right (well, I haven&amp;#39;t done any of the actual work). &lt;b&gt;I&amp;#39;m beginning to think that it&amp;#39;s better to use what I had before&lt;/b&gt; (I&amp;#39;ll redo it in Ruby sometime, probably): if you compare &lt;b&gt;using&lt;/b&gt; &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;git status&lt;/font&gt; (inflexible) to writing  your own git status (crazy!), the former has some clear advantages: &lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;git status &lt;/font&gt;is a relatively complex program that works. &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-461214084762657690?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/461214084762657690/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=461214084762657690' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/461214084762657690'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/461214084762657690'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/06/parsegitbranch-still.html' title='parse_git_branch, still'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-2689581323990322720</id><published>2010-05-21T12:00:00.000-03:00</published><updated>2010-05-21T12:00:10.891-03:00</updated><title type='text'>Using YAML to Move ActiveRecord Objects Between Rails Installations</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: arial; font-size: small;"&gt;&lt;/span&gt;&lt;br /&gt;&lt;div&gt;So I was trying to get some ActiveRecord objects from the server to my local box. This is not the right or cleverest way to do it, but it works.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;On the server I just did&amp;nbsp;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;script class="brush: ruby" type="syntaxhighlighter"&gt;&lt;![CDATA[File.open("thingers.yaml", 'w') {|f| f.write(thingers.to_yaml)]]&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;Then I moved to the file to local via ssh and fired up a local Rails console.&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;I read the file in&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;script class="brush: ruby" type="syntaxhighlighter"&gt;&lt;![CDATA[thingers = YAML.load_file("thingers.yaml")]]&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;and then I realized that I had these weird YAML objects and no time to actually read any documentation on how they work. But thanks to spelunking with inspect, this worked:&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;&lt;script class="brush: ruby" type="syntaxhighlighter"&gt;&lt;![CDATA[thingers.each do |yaml_obj|      t = Thinger.new(yaml_obj.ivars['attributes'])     t.save end]]&gt;&lt;/script&gt;&lt;/div&gt;&lt;div&gt;&lt;br /&gt;&lt;/div&gt;&lt;div&gt;where Thinger is my ActiveRecord obj. Now I'm locked and loaded.&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-2689581323990322720?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/2689581323990322720/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=2689581323990322720' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2689581323990322720'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2689581323990322720'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/05/using-yaml-to-move-activerecord-objects.html' title='Using YAML to Move ActiveRecord Objects Between Rails Installations'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-5087501528946376075</id><published>2010-05-19T13:23:00.001-03:00</published><updated>2010-05-19T13:23:26.789-03:00</updated><title type='text'>Why did Ruby get Rails but Python got a whole bunch of things...</title><content type='html'>&lt;a href="http://stackoverflow.com/questions/406907/why-does-ruby-have-rails-while-python-has-no-central-framework"&gt;My question about the history of Ruby/Rails and Python/Django&lt;/a&gt; got a bit of attention of late, so I finally got around to answering it. Ah, the beauty of talking to oneself in public! The question:&lt;div&gt; &lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;span class="Apple-style-span" style="font-family: Arial, &amp;#39;Liberation Sans&amp;#39;, &amp;#39;DejaVu Sans&amp;#39;, sans-serif; font-size: 11.1111px; border-collapse: collapse; line-height: 20px; "&gt;&lt;blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "&gt; This is a(n) historical question, not a comparison-between-languages question:&lt;/blockquote&gt;&lt;blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "&gt; &lt;a href="http://tomayko.com/writings/no-rails-for-python" rel="nofollow" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; cursor: pointer; "&gt;&lt;font class="Apple-style-span" color="#000000"&gt;This article from 2005&lt;/font&gt;&lt;/a&gt; talks about the lack of a single, central framework for Python. For Ruby, this framework is clearly Rails. &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; "&gt;Why, historically speaking, did this happen for Ruby but not for Python?&lt;/span&gt; (or did it happen, and that framework is Django?)&lt;/blockquote&gt; &lt;blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "&gt; Also, the hypothetical questions: &lt;span style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; "&gt;would Python be more popular if it had one, good framework? Would Ruby be less popular if it had no central framework?&lt;/span&gt;&lt;/blockquote&gt; &lt;/span&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;My notes:&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;div&gt;Check out this article on &lt;a href="http://blog.ianbicking.org/what-really-makes-rails-work.html"&gt;why we&amp;#39;ll never see Python-on-Rails&lt;/a&gt;. The author gives some of the basic reasons why Python has never had and will never have a central framework. I might add, myself, that Java doesn&amp;#39;t have one either, and for the same reasons.&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;According to the author, Rails is strictly tied to its &amp;quot;implementation,&amp;quot; which is Ruby. Rails was adopted by many developers and Ruby was just part of it. Rails works perfectly on Ruby (or Ruby copy-cats like Groovy), but more importantly, as many other answers say, Rails led the way to Ruby adoption.&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;blockquote class="gmail_quote" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; "&gt; This is why Rails-for-Python won&amp;#39;t work, or at least what people have been focusing on with Rails isn&amp;#39;t correct. It&amp;#39;s not about the implementation or the quality of the framework, it&amp;#39;s about the pattern of adoption. It&amp;#39;s about putting the framework up front, and the implementation in the back -- even if this wasn&amp;#39;t the Rails developers intentions (though maybe they are clever and this was their intention).&lt;/blockquote&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Basically, you can&amp;#39;t get a bunch of language-loving folk to gather around a single framework. On the Java side, while Spring is well-loved, it&amp;#39;s no Rails in terms of popularity in the Java community. In a mature community developers have their own ideas about what metaphors work and don&amp;#39;t work in a framework. &lt;b&gt;This&lt;/b&gt; is why Rails leads to Ruby and not the other way around (typically, mostly, not in all cases).&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-5087501528946376075?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/5087501528946376075/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=5087501528946376075' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5087501528946376075'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/5087501528946376075'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/05/why-did-ruby-get-rails-but-python-got.html' title='Why did Ruby get Rails but Python got a whole bunch of things...'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-3884898169171045044</id><published>2010-05-18T18:07:00.001-03:00</published><updated>2010-05-18T18:07:28.621-03:00</updated><title type='text'>Are IE6 and IE7 Standalone Browsers The Real Thing?</title><content type='html'>&lt;div&gt;Today I finally got around to making Windows XP images to have all the versions of IE running for real. And then I compared them to the &amp;quot;standalone&amp;quot; versions and found no difference. Ever. Even on the strangest IE6 rendering.&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;So I asked for evidence of the &amp;quot;you can&amp;#39;t have more than one real IE running at a time&amp;quot; position on SO. As expected, &lt;a href="http://stackoverflow.com/questions/2859010/ie6-and-ie7-standalone-what-do-they-render-differently"&gt;the question got little interest and no new data points&lt;/a&gt;. What did I expect? Hearsay is cheap, and evidence is hard to come by. The standalone IEs (&lt;b&gt;not&lt;/b&gt; &lt;a href="http://www.my-debugbar.com/wiki/IETester/HomePage"&gt;that IETester thing&lt;/a&gt;) are perfect, in my experience, and when they&amp;#39;re not, it&amp;#39;s that I got confused in my testing. I haven&amp;#39;t been able to find &lt;b&gt;any&lt;/b&gt; differences.&lt;div&gt; &lt;ol&gt;&lt;li&gt;&lt;a href="http://tredosoft.com/Multiple_IE"&gt;IE6 in MultipleIEs install&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;&lt;a href="http://ie7-standalone.en.softonic.com/"&gt;IE7 Standalone&lt;/a&gt;.&lt;/li&gt;&lt;li&gt;Then install IE8 for real (as in download it from Microsoft).&lt;/li&gt; &lt;/ol&gt;&lt;div&gt;Three IEs on one XP box isn&amp;#39;t bad. &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;And &lt;a href="http://browsershots.org/"&gt;browsershots&lt;/a&gt; ain&amp;#39;t bad either. &lt;a href="http://litmus.com"&gt;Litmus&lt;/a&gt;, on the other hand, seems like a cheesy simulator, in my two days of experience with it... but that might be wrong. Anyway, I don&amp;#39;t care what the site &lt;b&gt;looks&lt;/b&gt; like on a bunch of browsers. It&amp;#39;s a UI: it&amp;#39;s a question of look, feel and behavior. That&amp;#39;s something screenshots can&amp;#39;t tell you. That&amp;#39;s why I need these browsers to take up as few virtual machines as possible, hence the initial question.&lt;/div&gt; &lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-3884898169171045044?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/3884898169171045044/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=3884898169171045044' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3884898169171045044'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/3884898169171045044'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/05/are-ie6-and-ie7-standalone-browsers.html' title='Are IE6 and IE7 Standalone Browsers The Real Thing?'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-8094195719934117209</id><published>2010-05-17T15:24:00.004-03:00</published><updated>2010-05-18T06:41:49.310-03:00</updated><category scheme='http://www.blogger.com/atom/ns#' term='osx zsh bash git prompt ps1'/><title type='text'>GIT Branch in Zsh (or Bash)</title><content type='html'>It's been a long damn day and a half, but here's the final code for my .zshrc:&lt;br /&gt;&lt;br /&gt;&lt;script type="syntaxhighlighter" class="brush: shell"&gt;&lt;![CDATA[parse_git_branch() {    in_wd="$(git rev-parse --is-inside-work-tree 2&gt;/dev/null)" || return    test "$in_wd" = true || return    state=''    git diff-index HEAD --quiet 2&gt;/dev/null || state='*'    branch="$(git symbolic-ref HEAD 2&gt;/dev/null)"    test -z "$branch" &amp;&amp; branch='&lt;detached-HEAD&gt;'    echo "(${branch#refs/heads/}${state})"}setopt PROMPT_SUBSTPROMPT='$PR_GREEN%n@$PR_GREEN%m%u$PR_NO_COLOR:$PR_BLUE%9c$PR_NO_COLOR$(parse_git_branch):' #RPROMPT='$PR_GREEN$(parse_git_branch)$PR_NO_COLOR']]&gt;&lt;/script&gt;&lt;br /&gt;For Bash, here's my PS1 (albeit, the important part is \$(parse_git_branch) , but I don't want to go shopping for a Bash prompt for now):&lt;script type="syntaxhighlighter" class="brush: java"&gt;&lt;![CDATA[PS1="${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$(parse_git_branch):$"]]&gt;&lt;/script&gt;Big thanks to the people who answered my questions &lt;a href="http://stackoverflow.com/questions/2850425"&gt;here&lt;/a&gt; and &lt;a href="http://superuser.com/questions/142099"&gt;here&lt;/a&gt;. Now I'm finally ready for zsh!&lt;br /&gt;&lt;BR&gt;&lt;div&gt;&lt;b&gt;Note:&lt;/b&gt; So much has been learned from this one, though. Even GIT has a plumbing vs. porcelain (logic/presentation) split. The new command, thanks to &lt;a href="http://stackoverflow.com/users/193688"&gt;Chris Johnsen&lt;/a&gt;, teaches us all that what felt wrong all this time--parsing git status---really was. Using the plumbing commands gives us long-term stability. This is particularly important if you don't ever want to do shell scripting again :)&lt;/div&gt;&lt;BR&gt;&lt;div&gt;To be fair (to myself), parsing GIT status is just one call, whereas the new script is three. But until we have speed problems, we don't worry about it. Better yet, Chris' script &lt;b&gt;runs on Bash and Zshell without modification&lt;/b&gt;!&lt;/div&gt;&lt;div&gt;Oh yeah, the only other change I made was to sub &lt;pre&gt;ls -G&lt;/pre&gt; for &lt;pre&gt;ls --color&lt;/pre&gt; from the zsh scripts I got from &lt;a href="http://friedcpu.wordpress.com/2007/07/24/zsh-the-last-shell-youll-ever-need/"&gt;Zsh: The Last Shell You'll Ever Need.&lt;/a&gt;&lt;/div&gt;&lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-8094195719934117209?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/8094195719934117209/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=8094195719934117209' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/8094195719934117209'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/8094195719934117209'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/05/burning-fast-git-branch-in-zsh.html' title='GIT Branch in Zsh (or Bash)'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-8142289385140875900</id><published>2010-05-16T14:27:00.001-03:00</published><updated>2010-05-16T14:27:35.621-03:00</updated><title type='text'>Notes on Converting an HTML Comp</title><content type='html'>&lt;div&gt;I learned HTML on the street. I&amp;#39;ve been a corporate trainer in Java and XML, so I know all the basic stuff in those fields by heart, but I don&amp;#39;t think I&amp;#39;ve ever read an entire book on HTML/CSS. On the other hand, maybe I have, but it was probably before I understood anything much.&lt;/div&gt; &lt;div&gt;&lt;br&gt;&lt;/div&gt;This weekend was massive. I&amp;#39;ve been commissioned to do a tiny site on Rails (overkill, but good to have around). We&amp;#39;ve got the PDF comps and the resources half in Photoshop and half exported to GIFs, JPGs and whatever. The site is very simple, so the Rails part took about 10 minutes to finish the entire structure, including the paging stuff and my famous ie6? and ie7? helper methods, which I try never to use.&lt;div&gt; &lt;br&gt;&lt;/div&gt;&lt;div&gt;So what have I learned?&lt;div&gt;&lt;ol&gt;&lt;li&gt;&lt;b&gt;CSS Reset&lt;/b&gt; - Based on my lukewarm experience the last time I did a full site, this time I followed the CSS-reset route. I chose this &lt;a href="http://meyerweb.com/eric/tools/css/reset/"&gt;radical CSS reset&lt;/a&gt;, which was probably not the best idea. A more opinionated CSS-reset might&amp;#39;ve worked better. But the CSS-reset, plus using the strict HTML doctype, resulted in a minimum of cross-browser problems.&lt;/li&gt; &lt;li&gt;&lt;b&gt;HTML5&lt;/b&gt;: We didn&amp;#39;t use any HTML5 on this project. But when I was asked to change the doc-type to the one for HTML5, and the site didn&amp;#39;t budge, so the future is sound.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Cross-Browser Problems &lt;/b&gt;- I tested every single thing I did in IE6, IE7 and Chrome on Mac. This is totally annoying to say the least, but it kept me sane throughout (IE6 really makes one think that Microsoft was hoping to kill the Internet as a concept).&lt;/li&gt; &lt;li&gt;&lt;b&gt;Design is a science, kind of&lt;/b&gt;: I usually kind of eyeball the comps and then build the thing. I measure later. Getting good measurements using &lt;a href="http://www.pixelatedsoftware.com/products/pixelstick/index.html"&gt;PixelStick&lt;/a&gt; in the first place &lt;b&gt;even while working on more interesting problems&lt;/b&gt; would have been brilliant (so I didn&amp;#39;t do it this time, either). &lt;/li&gt; &lt;li&gt;One of the biggest mistakes I made was not making a serious attempt to figure out that the PDF comp needed to be zoomed to 73% (why?) to match the assets I was given. But measuring it worked. Design is empirical. Mostly, so...&lt;/li&gt; &lt;li&gt;&lt;b&gt;Use a test harness to figure stuff out&lt;/b&gt;. A test.html (like a test.fla, or a HelloWorldSocketConnection or whatever) is invaluable, especially when compared to poking around in a complex situation to figure things out. HelloWorlds are our friend at all phases of a project.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Default position of elements is not static: it&amp;#39;s relative&lt;/b&gt;. This took a while to debug, since I was debugging my knowledge itself :)... If the comps are really exact, just make the outer DIV relative, and then place everything inside with absolute positioning. This works solidly, unlike what I had thought previously. But more importantly...&lt;/li&gt; &lt;li&gt;&lt;b&gt;Designers do design much faster than me&lt;/b&gt;, but I can still do design. I learned Fireworks a bit back, and while I can barely do anything beyond slicing in Photoshop, in Fireworks I can create assets as needed (though sometimes I have to go spelunking to find how stuff works). The thing about asset creation is that if you need an asset, you should try to measure what you do know. I only created one asset here: a rounded rectangular box with an inner and outer glow. The outer glow needed to go to transparent, and the inner glow needed to go over white (PNG8!). So I eye-balled the rounded corners, but the rest was data-based. I knew I needed it to have a certain size and use certain colors. The amusing thing was that when I finished I thought, &amp;quot;damn, that inner glow looks like crap, let me check the comps.&amp;quot; The comps looked the same: anybody can do glows and drop shadows with modern tools.&lt;/li&gt; &lt;li&gt; &lt;b&gt;Margins and padding are very different&lt;/b&gt;, though in certain browsers they kind of work the same. The point is mostly that negative margins are usually a mess (at least in IE), whereas negative padding is pretty cool. This is a topic for study, but nothing simple like &lt;a href="http://www.tutorials2learn.com/2009/06/scripts/css/comparison-css-padding-css-margin-properties/"&gt;this&lt;/a&gt; will help.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Z-index, negative margins and absolute position: &lt;/b&gt;z-index does not work with static positioning (I think), but with absolute positioning it works well. While in some cases I was able to get a negative top value to work, in others I couldn&amp;#39;t get it below zero. In those cases a negative margin &lt;b&gt;in addition to the position&lt;/b&gt; worked nicely. I have no definitive point here, but surely in 10 minutes of goofing around one could figure out what the real situation is. &lt;/li&gt; &lt;li&gt;&lt;b&gt;Measuring stuff in em&amp;#39;s is incredible. &lt;/b&gt;Though sometimes you want to measure in pixels, of course.&lt;/li&gt;&lt;li&gt;&lt;b&gt;Font sizes like +1 and -1 are relative to the current font size&lt;/b&gt;. I wish I had known this a while back.&lt;/li&gt; &lt;li&gt;&lt;b&gt;Next time, no more screwing around: &lt;/b&gt;I will do the CSS as an ERB. There is no reason to not be able to define variables in your stylesheet. Otherwise &lt;a href="http://ajaxian.com/archives/css-variables-are-next"&gt;how do you keep colors consistent?&lt;/a&gt; &lt;/li&gt; &lt;/ol&gt;&lt;div&gt;The next time I do one of these corporate designs, I&amp;#39;ll probably do 90% of it as absolutely positioned. &lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Working with GIT was a dream, especially now that &lt;a href="http://stackoverflow.com/questions/2302736/trimming-git-checkins-squashing-git-history/2311501#2311501"&gt;I know about soft and hard reset&lt;/a&gt;.&lt;/div&gt; &lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;Now I can get back to my iPhone/Objective-C learning, which has taken a turn for the better. The other day I was actually writing code...&lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-8142289385140875900?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/8142289385140875900/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=8142289385140875900' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/8142289385140875900'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/8142289385140875900'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/05/notes-on-converting-html-comp.html' title='Notes on Converting an HTML Comp'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-2668280060893383749</id><published>2010-04-06T06:36:00.001-03:00</published><updated>2010-04-06T06:36:07.845-03:00</updated><title type='text'>Why Software Development is Hard</title><content type='html'>Software development is difficult to do well because the developer must constantly weigh: &lt;div&gt;&lt;ul&gt;&lt;li&gt;Invention vs. reuse and integration time (build or buy, essentially)&lt;/li&gt;&lt;li&gt;Generalization/abstraction for reuse vs. the one-off job (hack): if the generalization &lt;b&gt;never&lt;/b&gt; pays off, you&amp;#39;ve wasted time. Same goes with externalizing configurations, using inheritance, etc.&lt;/li&gt; &lt;li&gt;Building test instruments vs. building the actual software. No test instruments and the software takes forever to build. Too much testing and you never build the software.&lt;/li&gt;&lt;/ul&gt;&lt;div&gt;Striking the right balance given a specific situation is difficult and requires experience and flexibility. I don&amp;#39;t mean years of experience, I mean hours.&lt;/div&gt; &lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-2668280060893383749?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/2668280060893383749/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=2668280060893383749' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2668280060893383749'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/2668280060893383749'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/04/why-software-development-is-hard.html' title='Why Software Development is Hard'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-4940240255391629306</id><published>2010-04-04T12:40:00.001-03:00</published><updated>2010-04-04T12:40:16.240-03:00</updated><title type='text'>shell_here: Spawning a New Terminal Window in OSX</title><content type='html'>&lt;div class="gmail_quote"&gt;&lt;div&gt;My lack of desire to learn bash scripting has resulted in today&amp;#39;s script.&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;This script will take your current terminal window and spawn a new one with your entire environment copied. paste_env will also, as a side effect, leave a file called /pasted_env.&lt;/div&gt; &lt;div&gt;&lt;br&gt; &lt;/div&gt;&lt;div&gt;&lt;b&gt;shell_here&lt;/b&gt;&lt;/div&gt;&lt;blockquote style="margin:0 0 0 40px;border:none;padding:0px"&gt;&lt;/blockquote&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, monospace"&gt;#!/bin/sh&lt;/span&gt;&lt;br&gt; &lt;blockquote style="margin:0 0 0 40px;border:none;padding:0px"&gt;&lt;/blockquote&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, monospace"&gt;env | pbcopy &lt;/span&gt;&lt;br&gt; &lt;blockquote style="margin:0 0 0 40px;border:none;padding:0px"&gt;&lt;/blockquote&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, monospace"&gt;osascript &amp;lt;&amp;lt;END &lt;/span&gt;&lt;br&gt; &lt;blockquote style="margin:0 0 0 40px;border:none;padding:0px"&gt;&lt;/blockquote&gt;&lt;span style="font-family:&amp;#39;courier new&amp;#39;, monospace"&gt;tell app &amp;quot;Terminal&amp;quot; to do script &amp;quot;$(paste_env)&amp;quot; &lt;/span&gt;&lt;br&gt; &lt;div&gt;&lt;div&gt;&lt;font face="&amp;#39;courier new&amp;#39;, monospace"&gt;END&lt;/font&gt;&lt;/div&gt;&lt;/div&gt;&lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;paste_env&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;div&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;div&gt; #!/usr/bin/env ruby&lt;/div&gt;&lt;div&gt;`pbpaste`.each { |var| &lt;span class="Apple-style-span" style="font-family: arial; "&gt;&lt;b&gt;&lt;div style="display: inline !important; "&gt;&lt;font class="Apple-style-span" face="&amp;#39;courier new&amp;#39;, monospace"&gt;&lt;span class="Apple-style-span" style="font-weight: normal;"&gt;&lt;div style="display: inline !important; "&gt; puts var }&lt;/div&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;/b&gt;&lt;/span&gt;&lt;/div&gt;&lt;div&gt;puts &amp;#39;clear&amp;#39;&lt;/div&gt;&lt;/span&gt;&lt;/font&gt;&lt;/div&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;&lt;b&gt;&lt;br&gt;&lt;/b&gt;&lt;/div&gt;&lt;div&gt;This opens up a previously locked door for Ruby scripting: affecting the current shell.&lt;/div&gt;  &lt;div&gt;&lt;br&gt;&lt;/div&gt;&lt;div&gt;I ended up bothering people &lt;a href="http://superuser.com/questions/127117" target="_blank"&gt;here&lt;/a&gt; and &lt;a href="http://stackoverflow.com/questions/2573516" target="_blank"&gt;here&lt;/a&gt; and &lt;a href="http://stackoverflow.com/questions/2574793/source-from-standard-in-bash-on-osx/2574802#2574802"&gt;here&lt;/a&gt; to do this.&lt;/div&gt; &lt;/div&gt; &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-4940240255391629306?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/4940240255391629306/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=4940240255391629306' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4940240255391629306'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/4940240255391629306'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/04/shellhere-spawning-new-terminal-window.html' title='shell_here: Spawning a New Terminal Window in OSX'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7255040582511186716</id><published>2010-03-19T12:29:00.001-03:00</published><updated>2010-03-19T12:29:44.953-03:00</updated><title type='text'>So easy, you just call your Java code from Groovy!</title><content type='html'>This is total crap. There are several cases where it just doesn&amp;#39;t work, but my favorite is this runtime exception (well, we&amp;#39;re using Groovy, what did you expect) that looks like this, &amp;quot;org.codehaus.groovy.runtime.GStringImpl cannot be cast to java.lang.String&amp;quot;... right right. So what should I do? I guess I&amp;#39;ll have to go in and hack up my Java code with .toString() methods? &lt;div class="blogger-post-footer"&gt;&lt;img width='1' height='1' src='https://blogger.googleusercontent.com/tracker/4057906405003000972-7255040582511186716?l=compileyouidontevenknowyou.blogspot.com' alt='' /&gt;&lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://compileyouidontevenknowyou.blogspot.com/feeds/7255040582511186716/comments/default' title='Post Comments'/><link rel='replies' type='text/html' href='http://www.blogger.com/comment.g?blogID=4057906405003000972&amp;postID=7255040582511186716' title='0 Comments'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7255040582511186716'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4057906405003000972/posts/default/7255040582511186716'/><link rel='alternate' type='text/html' href='http://compileyouidontevenknowyou.blogspot.com/2010/03/so-easy-you-just-call-your-java-code.html' title='So easy, you just call your Java code from Groovy!'/><author><name>Daniel Rosenstark</name><uri>http://www.blogger.com/profile/12477764482153529031</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='http://img2.blogblog.com/img/b16-rounded.gif'/></author><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4057906405003000972.post-7509302869808129219</id><published>2010-03-08T14:34:00.001-03:00</published><updated>2010-03-08T14:34:58.167-03:00</updated><title type='text'>Backticks and Ruby Shell Scripting by Yar</title><content type='html'>&lt;span class="Apple-style-span" style="font-family: Arial, &amp;#39;Liberation Sans&amp;#39;, &amp;#39;DejaVu Sans&amp;#39;, sans-serif; font-size: 16px; border-collapse: collapse; line-height: 20px; "&gt;&lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; clear: both; background-position: initial initial; background-repeat: initial initial; "&gt; Here are my additional notes on Ruby shell scripting from &lt;a href="http://stackoverflow.com/questions/166347/how-do-i-use-ruby-for-shell-scripting/2392597#2392597"&gt;here&lt;/a&gt;.&lt;/p&gt;&lt;ol style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 30px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; list-style-type: decimal; list-style-position: initial; list-style-image: initial; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; clear: both; background-position: initial initial; background-repeat: initial initial; "&gt; Backticks (or back-ticks) let you do some scripting stuff a lot easier. Consider&lt;/p&gt;&lt;pre class="prettyprint" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Monaco, &amp;#39;Lucida Console&amp;#39;, &amp;#39;Liberation Mono&amp;#39;, &amp;#39;DejaVu Sans Mono&amp;#39;, &amp;#39;Bitstream Vera Sans Mono&amp;#39;, &amp;#39;Courier New&amp;#39;; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Monaco, &amp;#39;Lucida Console&amp;#39;, &amp;#39;Liberation Mono&amp;#39;, &amp;#39;DejaVu Sans Mono&amp;#39;, &amp;#39;Bitstream Vera Sans Mono&amp;#39;, &amp;#39;Courier New&amp;#39;; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;puts &lt;/span&gt;&lt;span class="str" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;`find . | grep -i lib`&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; clear: both; background-position: initial initial; background-repeat: initial initial; "&gt; If you run into problems with getting the output of backticks, the stuff is going to standard err instead of standard out. &lt;a href="http://www.weheartcode.com/2007/09/14/capturing-stderr-with-ruby-backticks/comment-page-1/#comment-30518" rel="nofollow" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(74, 107, 130); text-decoration: none; cursor: pointer; background-position: initial initial; background-repeat: initial initial; "&gt;Use this advice&lt;/a&gt;&lt;/p&gt; &lt;pre class="prettyprint" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Monaco, &amp;#39;Lucida Console&amp;#39;, &amp;#39;Liberation Mono&amp;#39;, &amp;#39;DejaVu Sans Mono&amp;#39;, &amp;#39;Bitstream Vera Sans Mono&amp;#39;, &amp;#39;Courier New&amp;#39;; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Monaco, &amp;#39;Lucida Console&amp;#39;, &amp;#39;Liberation Mono&amp;#39;, &amp;#39;DejaVu Sans Mono&amp;#39;, &amp;#39;Bitstream Vera Sans Mono&amp;#39;, &amp;#39;Courier New&amp;#39;; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;span class="kwd" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: rgb(0, 0, 139); background-position: initial initial; background-repeat: initial initial; "&gt;out&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="str" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;`git status 2&amp;gt;`&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/li&gt;&lt;li style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;p style="margin-top: 0px; margin-right: 0px; margin-bottom: 1em; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; clear: both; background-position: initial initial; background-repeat: initial initial; "&gt; Backticks do string interpolation:&lt;/p&gt;&lt;pre class="prettyprint" style="margin-top: 0px; margin-right: 0px; margin-bottom: 10px; margin-left: 0px; padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Monaco, &amp;#39;Lucida Console&amp;#39;, &amp;#39;Liberation Mono&amp;#39;, &amp;#39;DejaVu Sans Mono&amp;#39;, &amp;#39;Bitstream Vera Sans Mono&amp;#39;, &amp;#39;Courier New&amp;#39;; overflow-x: auto; overflow-y: auto; width: auto; max-height: 600px; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;code style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: rgb(238, 238, 238); font-family: Consolas, Monaco, &amp;#39;Lucida Console&amp;#39;, &amp;#39;Liberation Mono&amp;#39;, &amp;#39;DejaVu Sans Mono&amp;#39;, &amp;#39;Bitstream Vera Sans Mono&amp;#39;, &amp;#39;Courier New&amp;#39;; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;blah &lt;/span&gt;&lt;span class="pun" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;=&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt; &lt;/span&gt;&lt;span class="str" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;&amp;#39;lib&amp;#39;&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: black; background-position: initial initial; background-repeat: initial initial; "&gt;&lt;br&gt; &lt;/span&gt;&lt;span class="str" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; border-color: initial; font-size: 16px; vertical-align: baseline; background-image: initial; background-attachment: initial; background-origin: initial; background-clip: initial; background-color: transparent; color: maroon; background-position: initial initial; background-repeat: initial initial; "&gt;`touch #{blah}`&lt;/span&gt;&lt;span class="pln" style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; padding-top: 0px; padding-right: 0px; padding-bottom: 0px; padding-left: 0px; border-top-width: 0px; border-right-width: 0px; border-bottom-width: 0px; border-left-width: 0px; border-style: initial; b
