<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Scott builds Software &#187; Tips</title>
	<atom:link href="http://scottpenberthy.com/category/tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://scottpenberthy.com</link>
	<description>Musings on iPhone, Flash and the Cloud</description>
	<lastBuildDate>Tue, 28 Jun 2011 05:02:40 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Learn iPhone fonts in our latest book</title>
		<link>http://scottpenberthy.com/2010/05/28/learn-iphone-fonts-in-our-latest-book/</link>
		<comments>http://scottpenberthy.com/2010/05/28/learn-iphone-fonts-in-our-latest-book/#comments</comments>
		<pubDate>Fri, 28 May 2010 22:45:02 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Apps]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://scottpenberthy.com/?p=568</guid>
		<description><![CDATA[Scott describes a new iPhone book, "More iPhone Cool Projects" where he wrote a chapter on being pragmatic about fonts in OpenGL on the iPhone.]]></description>
			<content:encoded><![CDATA[<div id="attachment_569" class="wp-caption aligncenter" style="width: 310px"><a href="http://amzn.to/91YGHz"><img src="http://scottpenberthy.com/wp-content/uploads/2010/05/book2.jpg" alt="More iPhone Cool Projects" title="book2" width="300" height="300" class="size-full wp-image-569" /></a><p class="wp-caption-text">More iPhone Cool Projects</p></div>
<p>One of the more popular posts on this blog is a little list of iPhone fonts.  When I first started writing iPhone apps, I was puzzled by the lack of documentation on font names within the wonderful little devices.  My post gets visited daily by dozens of programmers who, apparently, run across the same issue.</p>
<p>My love/hate relationship with fonts began in college.  I made pizza and beer money by encoding my friends&#8217; papers into Scribe, an early word processing program. Later in grad school I learned how to hack LaTex, and once contributed a few morsels to the AAAI library for publishing AI papers.  After my PhD thesis my advisor introduced me to a mailing list at CERN,  run by a guy named Tim.  I was smitten BY his vision of a World Wide Web.   I looked for months to find Web work at IBM, and finally landed a job building a rendering engine for IBM&#8217;s first browser.  Most of my coding efforts were spent wrestling OS/2 presentation manager and&#8230; you guessed it&#8230; fonts.  They seemed inescapable.</p>
<p>Fast forward a decade and a half.  At the beginning of my iPhone career, I landed a sweet deal working on an iPhone game for DreamWorks.  We were cruising along when the creative team decided to use a custom font.  Uh oh.  I faced having to rewrite a lot of Apple&#8217;s font mechanisms with very little investment.  I didn&#8217;t have time.  I needed something practical, something that would let me build a font package quickly.</p>
<p>The project tapped some dusty memories from Scribe, LaTex, OS/2, and now OpenGL.  The end result was a quick, useful set of classes and tools for converting any TrueType font into a mipmapped OpenGL font on the iPhone.  Word spread, and soon I found myself writing a chapter from APress about the experience. </p>
<p>I hope the chapter saves you, and other programmers, tons of time in writing and building quick, lightweight font engines!</p>
]]></content:encoded>
			<wfw:commentRss>http://scottpenberthy.com/2010/05/28/learn-iphone-fonts-in-our-latest-book/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Green Tape</title>
		<link>http://scottpenberthy.com/2009/11/17/green-tape/</link>
		<comments>http://scottpenberthy.com/2009/11/17/green-tape/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 14:14:38 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Hot pickles]]></category>
		<category><![CDATA[Personal]]></category>
		<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://scottpenberthy.com/?p=427</guid>
		<description><![CDATA[Green Tape?  Its the antithesis of red tape.  Conserve time, one of our most precious resources.]]></description>
			<content:encoded><![CDATA[<div id="attachment_428" class="wp-caption aligncenter" style="width: 210px"><img src="http://scottpenberthy.com/wp-content/uploads/2009/11/greentape.jpg" alt="Green Tape" title="greentape" width="200" height="200" class="size-full wp-image-428" /><p class="wp-caption-text">Green Tape</p></div>
<p>Croton on Hudson took a step forward to revitalize the Harmon District, an area hit particularly hard by the recession.  The village board approved a resolution to rezone the Harmon district, a first step toward enabling entrepreneurs to build profitable retail space with rental units.  The Mayor (Leo Wiegman) also announced a new &#8220;green tape&#8221; initiative.</p>
<p>Green Tape?</p>
<p>Its the antithesis of Red Tape.   Green Tape is his word for process re-engineering, removing extra layers of red tape, streamlining local government.  The title is catchy.  It calls to mind other green initiatives, conserving natural resources, preserving our environment.</p>
<p>We all spend a lot of our waking hours at work, in our towns, working with people.  Green Tape.  We need more of it, conserving one of life&#8217;s most precious resources &#8212; time.</p>
]]></content:encoded>
			<wfw:commentRss>http://scottpenberthy.com/2009/11/17/green-tape/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Myers-Briggs for Idiots</title>
		<link>http://scottpenberthy.com/2009/10/23/myers-briggs-for-idiots/</link>
		<comments>http://scottpenberthy.com/2009/10/23/myers-briggs-for-idiots/#comments</comments>
		<pubDate>Fri, 23 Oct 2009 17:04:26 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Tips]]></category>

		<guid isPermaLink="false">http://scottpenberthy.com/?p=390</guid>
		<description><![CDATA[A colleague boasted she could guess everyone's personality type in the room with four simple questions.  Surprisingly, she was right.  Scott share's these questions this blog post.]]></description>
			<content:encoded><![CDATA[<p>Myers-Briggs is popular at major corporations, startups, psychologists and more.  They have developed a 4-dimensional matrix of personality profiles, based on whether you&#8217;re an introvert or extrovert, thinking or feeling, intuitive or sensing,  judgmental or perceptive.</p>
<p>Today a colleague offered up four questions to quickly guess your personality type.  I didn&#8217;t think it would work.  The results were surprisingly accurate (though clearly anecdotal).</p>
<p>Let&#8217;s call it Myers-Briggs for Idiots.  Here they are.  What personality are you?</p>
<ol>
<li>After a long day of meetings, do you like to (A) move on to a party to relax, or (B) go home and be by yourself?
<li>Do you prefer to hear about things (A) in general, or (B) more about details?  Describe today&#8217;s weather.  If you say &#8220;nice day,&#8221; you&#8217;re general.  If you say &#8220;it started off at 56 degrees, rained a bit, then cleared around noon, when the sun came out at 3&#8230;&#8221; you&#8217;re clearly detail oriented.
<li>When making a big decision, do you (A) think mainly about the impact on people or (B) prefer the objective right thing to do?
<li>Do you (A) like quick resolution to issues, or (B) prefer to brainstorm all the possibilities?
</ol>
<p>Answers:<br />
1A = E,  1B = I,  2A = N, 2B = S, 3A = F, 3B = T, 4A = J, 4B = P</p>
<p>String your answers together, E &#8211; N &#8211; T &#8211; J.</p>
]]></content:encoded>
			<wfw:commentRss>http://scottpenberthy.com/2009/10/23/myers-briggs-for-idiots/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>DWTF Open Source License</title>
		<link>http://scottpenberthy.com/2008/11/05/dwtf-open-source-license/</link>
		<comments>http://scottpenberthy.com/2008/11/05/dwtf-open-source-license/#comments</comments>
		<pubDate>Wed, 05 Nov 2008 16:44:55 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Personal]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[Tips]]></category>
		<category><![CDATA[ajax on rails]]></category>
		<category><![CDATA[labeling_form_helper]]></category>

		<guid isPermaLink="false">http://scottpenberthy.com/?p=118</guid>
		<description><![CDATA[Seth Rasmussen has an interesting open source license:  DWTF.  Gotta love Rails.]]></description>
			<content:encoded><![CDATA[<p><center style="text-align: center; margin: 0 auto; display: block"><br />
<a href="http://www.amazon.com/Ajax-Rails-Scott-Raymond/dp/0596527446"<img src="http://i35.tinypic.com/24e89zn.jpg"></a><br />
</center></p>
<p><br clear="both"/></p>
<p><a href="http://scottraymond.net/forhire/">Scott Raymond&#8217;s</a> &#8220;Ajax on Rails&#8221; contains a nifty trick for form fields, following the Rails mantra of DRY and convention over configuration. Creating a field with an associated label, error checking, and formatting is as simple as</p>
<pre lang="ruby">
   <%= f.text_field :phone %>
</pre>
<p>This produces a label using the humanized &#8220;Phone: &#8220;, a &lt;div&gt; for holding validation errors, an input tag, and appropriate field values.  Here&#8217;s a complete form using Scott&#8217;s hackery from page 298:</p>
<pre lang="ruby">
<%# See +standard_form+ in application_helper.rb %>
  <%= f.text_field :name %>
  <%= f.date_select :start_date, :label => "First Call" %>
  <%= f.date_select :end_date, :label => "Last Call" %>
  <%= f.text_field :phone %>
  <%= f.text_field :email %>
  <%= f.text_area :body, :label => "Notes" %>
  <%= standard_submit %>
<% end %>
</pre>
<p>Scott&#8217;s magic is embodied in a form helper, LabelingFormBuilder.  For yucks, I Googled in search of a Rails plugin by that name. I stumbled across <a href="http://greatseth.com/svn/rails/plugins/labeling_form_helper/">labeling_form_builder</a> from Seth Rasmussen.  I peeked at the license.  Seth cracked me up.  Only in open source can you get away with this (words bleeped):</p>
<pre lang="text">
           DO WHAT THE F**K YOU WANT TO PUBLIC LICENSE
                   Version 2, December 2004

Copyright (C) 2007-2008 Seth Thomas Rasmussen

Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.

           DO WHAT THE F**K YOU WANT TO PUBLIC LICENSE
  TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION

 0. You just DO WHAT THE F**K YOU WANT TO.
</pre>
]]></content:encoded>
			<wfw:commentRss>http://scottpenberthy.com/2008/11/05/dwtf-open-source-license/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Fisheye effect in ImageMagick</title>
		<link>http://scottpenberthy.com/2008/09/05/fisheye-effect-in-imagemagick/</link>
		<comments>http://scottpenberthy.com/2008/09/05/fisheye-effect-in-imagemagick/#comments</comments>
		<pubDate>Fri, 05 Sep 2008 18:25:32 +0000</pubDate>
		<dc:creator>Scott</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[fisheye imagemagick obama]]></category>

		<guid isPermaLink="false">http://scottpenberthy.com/?p=7</guid>
		<description><![CDATA[ImageMagick is my favorite tool for messing around with images.  At PhotoBucket, we dedicated dozens of machines to &#8220;mogrify&#8221; uploaded images into thumbnails and appropriate sizes for user accounts.  I use it on my pet projects like an image zoomer and a youtube clipper.

Recently I discovered the &#8220;-fx&#8221; or special effects options of the ImageMagick [...]]]></description>
			<content:encoded><![CDATA[<div class="wp-caption aligncenter" style="width: 310px"><img alt="A fisheye view of Obama" src="http://i33.tinypic.com/2lx9emq.jpg" title="Fisheye Obama" width="300" height="348" /><p class="wp-caption-text">A fisheye view of Obama</p></div>
<p><a href="http://imagemagick.org">ImageMagick</a> is my favorite tool for messing around with images.  At PhotoBucket, we dedicated dozens of machines to &#8220;mogrify&#8221; uploaded images into thumbnails and appropriate sizes for user accounts.  I use it on my pet projects like an <a href="http://izoomr.com">image zoomer</a> and a <a href="http://tubechopper.com">youtube clipper.<br />
</a></p>
<p>Recently I discovered the &#8220;-fx&#8221; or special effects options of the ImageMagick toolset.  This was written in 1996 as probably a neat hack.  The code interprets a calculator-like FX language for each channel of every pixel.   This is painfully slow and screams for optimization.  Yet its so much fun. Take the following snippet of FX:</p>
<pre lang="c">kk=w*0.5;
ll=h*0.5;
dx=(i-kk);
dy=(j-ll);
aa=atan2(dy,dx);
rr=hypot(dy,dx);
rs=rr*rr/hypot(kk,ll);
px=kk+rs*cos(aa);
py=ll+rs*sin(aa);
p{px,py}</pre>
<p>Variable names are tricky.  Several characters are reserved to represent pixels (p), various channels (r, g, b), locations (i,j), sizes (w,h) and more.</p>
<p>Lines 1 and 2 of the FX code calculates the center of an image in x,y coordinates as (kk,ll).</p>
<p>Lines 3 through 6 compute the polar coordinates of the current pixel i,j as a radius rr and angle aa.  The internal function hypot() is a shortcut for hypotenuse of a triangle, which is the Euclidean distance between points (kk,ll) and the current pixel (i,j).</p>
<p>Now comes the silly part.  I take the radius of the polar coordinates and square it, then divide by maximum radius of the image, for a new radius RS for &#8220;radius scaled&#8221; in Line 7.  From there, I calculate the cartesian coordinate that correponds to a pixel at radius RS from the center, at the original angle AA, in lines 8 and 9. This creates a 2d bell-shaped surface that is flat at the edges curves up toward infinity at the center.  Finally, Line 10 stores the pixel located at (px,py) in the current pixel (i,j) using the &#8220;p&#8221; operator.</p>
<p>I store this equation in a file, &#8220;effect.fx&#8221;.  I downloaded a picture of Obama as obama.jpg:</p>
<div class="wp-caption aligncenter" style="width: 310px"><img alt="Obama as we all see him" src="http://i33.tinypic.com/2q8c4mo.jpg" title="Obama smiling" width="300" height="348" /><p class="wp-caption-text">Obama as we all see him</p></div>
<p>Next I applied convert using the fx operator:</p>
<pre lang="c">convert -fx @effect.fx obama.jpg fish.jpg</pre>
<p>This takes a few minutes on my MacBook pro. The result is a fisheye view of Obama!  Fun hack, with apologies to Obama.</p>
]]></content:encoded>
			<wfw:commentRss>http://scottpenberthy.com/2008/09/05/fisheye-effect-in-imagemagick/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

