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

<channel>
	<title>Gray Kittens with Socks</title>
	<atom:link href="http://graykittenswithsocks.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://graykittenswithsocks.wordpress.com</link>
	<description>Just another WordPress.com weblog</description>
	<lastBuildDate>Sat, 10 Dec 2011 00:32:22 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='graykittenswithsocks.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Gray Kittens with Socks</title>
		<link>http://graykittenswithsocks.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://graykittenswithsocks.wordpress.com/osd.xml" title="Gray Kittens with Socks" />
	<atom:link rel='hub' href='http://graykittenswithsocks.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Rails: Accessing &#8216;regular&#8217; helpers from RJS templates</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/03/17/rails-accessing-regular-helpers-from-rjs-templates/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/03/17/rails-accessing-regular-helpers-from-rjs-templates/#comments</comments>
		<pubDate>Thu, 18 Mar 2010 00:10:45 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[rjs]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=285</guid>
		<description><![CDATA[I&#8217;ve been working on a bit of a side project that&#8217;s been occupying a lot of my personal time recently.  It&#8217;s a project in Rails which I haven&#8217;t used regularly for almost two years at this point (yikes!).  On reentering the world of Rails I had a lot I need to refresh on and relearn.  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=285&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a bit of a side project that&#8217;s been occupying a lot of my personal time recently.  It&#8217;s a project in Rails which I haven&#8217;t used regularly for almost two years at this point (yikes!).  On reentering the world of Rails I had a lot I need to refresh on and relearn.  One of those things was RJS.  I remember hearing  a lot of hype about it both positive and negative but I thought I&#8217;d give them another go to draw my own conclusions.  Unfortunately I very quickly ran into a road block.</p>
<p>The app I&#8217;m working on is very heavy in 2.0 features.  The majority of the actions are initiated from a single page and updates are done asynchronously.  Many of those operations create or update records in the database and as a result need some kind of validation.  My solution to displaying the error messages was to render a template that called <code>error_messages_for</code> to build the message and then dump it into a <code>div</code>.  More precisely I setup a template that called a helper to render the messages and update the <code>div</code>.  According to the <a href="http://api.rubyonrails.org/classes/ActionView/Helpers/PrototypeHelper/JavaScriptGenerator/GeneratorMethods.html" target="_blank">docs</a>, when using helpers with RJS responses, there should be a <code>page</code> method that&#8217;s accessible from the helper and it surely was.</p>
<p><code>class ApplicationHelper<br />
def render_rjs_errors<br />
page.replace_html :errors, error_messages_for(:account)<br />
end<br />
end</code></p>
<p>But to my surprise, <code>error_messages_for</code> was not available!  After a bit of digging I discovered what was happening.  When you call <code>update_page</code> or render an RJS template your code is evaluated in a <code>JavaScriptGenerator</code> instance instead of an instance of <code>ActionView::Base</code>.  This instance gives you access to all the miscellaneous Javascript/Prototype helpers such as <code>replace_html</code>, <code>show</code> and <code>hide</code>, but it doesn&#8217;t include any of the <code>ActionView::Helpers</code>.  As far as I could tell the only things that it included automatically were <code>ApplicationHelper</code> and any helpers that you&#8217;d explicitly included in your controller.  I felt a bit gypped.</p>
<p>After still more digging I discovered that the original <code>ActionView::Base</code> instance is available via a <code>@context</code> member variable that&#8217;s available in your helpers in much the same way that the page method is available.  Since your helper modules are being included into the <code>JavaScriptGenerator</code> instance you have access to all it&#8217;s methods and member variables.  The <code>page</code> method, for example, is just a special instance that returns <code>self</code>.  Since the <code>@context</code> member refers to the original <code>ActionView::Base</code> instance we could use it to get to all the helpers.</p>
<p><code>class ApplicationHelper<br />
def render_rjs_errors<br />
page.replace_html :errors, @context.error_messages_for(:account)<br />
end<br />
end</code></p>
<p>Pretty lame though.  The code is very magic.  It doesn&#8217;t follow the pattern of the other helpers.  Why do I suddenly have to access the member via <code>@context</code>.  Where did it come from?  The <code>page</code> method is enough of a stretch. What to do?</p>
<p>It turns out that <code>JavaScriptGenerator</code> implements a method_missing method that catches any calls it doesn&#8217;t know about and passes them off to a <code>JavaScriptProxy</code> object (it&#8217;s not really important for this discuss but that object appears to generate some fancy JS from your call).  If we hooked <code>method_missing </code>we could ask it to route to <code>@context</code> behind the scenes and our helpers would be clean once again.  After a bit of tinkering I created a plugin that does just that, <a href="http://github.com/timjnh/better_rjs_helpers/tree/0.1.1" target="_blank">BetterRJSHelpers</a>.  All is now right with the world.  My helpers are clean and all (most) of the magic is hidden away.  Enjoy!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/285/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/285/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/285/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=285&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/03/17/rails-accessing-regular-helpers-from-rjs-templates/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>
	</item>
		<item>
		<title>Haml and Ruby Blocks: Why isn&#8217;t my block eval&#8217;d?</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/03/10/haml-and-ruby-blocks-why-isnt-my-block-evald/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/03/10/haml-and-ruby-blocks-why-isnt-my-block-evald/#comments</comments>
		<pubDate>Thu, 11 Mar 2010 02:02:42 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[haml]]></category>
		<category><![CDATA[rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=263</guid>
		<description><![CDATA[I&#8217;ve been using Haml for a small project I&#8217;m working on and recently ran into a problem with blocks.  The syntax isn&#8217;t quite what I expected but it makes sense when you think about it.  In my particular case I had a link_to_function call that ran a few page updates using the JavascriptGenerator.  My first [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=263&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using <a href="http://haml-lang.com/" target="_blank">Haml</a> for a small project I&#8217;m working on and recently ran into a problem with blocks.  The syntax isn&#8217;t quite what I expected but it makes sense when you think about it.  In my particular case I had a link_to_function call that ran a few page updates using the JavascriptGenerator.  My first attempt looked like this:</p>
<p><code>= link_to_function 'My Link' do |page|<br />
&nbsp;&nbsp;page[:some_div].show()</code></p>
<p>The resulting JS included some dandy error handling but where I expected an Element update what I saw was literally &#8216;page[:some_div].show()&#8217;.  After a little Googling and some thinking I realized my mistake.  The Haml interpreter has to parse every line of your input file.  Those lines that you flagged to be evaluated with Ruby, those that start with &#8216;-&#8217; and &#8216;=&#8217;, are chunked into sections and eval&#8217;d (or something along those lines).  The interpreter was therefore treating my line as straight text, not to be treated as Ruby code!  Silly me.</p>
<p>The working code looks like this.  Eval all the lines of my block please Haml!</p>
<p><code>= link_to_function 'My Link' do |page|<br />
&nbsp;&nbsp;- page[:some_div].show()</code></p>
<p>FYI, the reference for using blocks in Haml can be found <a href="http://haml-lang.com/docs/yardoc/file.HAML_REFERENCE.html#ruby_blocks" target="_blank">here</a>.  The documentation is correct but another example or two wouldn&#8217;t hurt.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/263/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/263/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/263/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=263&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/03/10/haml-and-ruby-blocks-why-isnt-my-block-evald/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>
	</item>
		<item>
		<title>Evolution of a Print</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/03/08/evolution-of-a-print/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/03/08/evolution-of-a-print/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 02:29:20 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[photography]]></category>
		<category><![CDATA[darkroom]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=202</guid>
		<description><![CDATA[Unlike the digital process, silver gelatin printing can be rather involved.  Some prints come very easily but most require some kind of tweaking to get to a finish product.  Folks who have been doing it for a while call this the fine print but I don&#8217;t feel justified in applying that title to mywork quite [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=202&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Unlike the digital process, silver gelatin printing can be rather involved.  Some prints come very easily but most require some kind of tweaking to get to a finish product.  Folks who have been doing it for a while call this the <em>fine print</em> but I don&#8217;t feel justified in applying that title to mywork quite yet.  Anyway, I thought it might be interesting to show an example of working through the process.</p>
<p style="text-align:center;"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_2.png"><img class="size-medium wp-image-251 aligncenter" title="Print 2" src="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_2.png?w=233&#038;h=300" alt="Print 2" width="233" height="300" /></a></p>
<p>Initial print.  Based on a test strip including mostly exterior areas.  Result was very dark.  Contrast on the outer areas was relatively low.  Ran a couple more test strips at higher contrasts.  Was still focusing on the exterior.  Pretty much decided that some significant dodging would be required for the interior.</p>
<p style="text-align:center;"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_1.png"><img class="size-medium wp-image-250  aligncenter" title="First Print" src="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_1.png?w=235&#038;h=300" alt="First Print" width="235" height="300" /></a></p>
<p>Second print had better contrast on the exterior but was somewhat dark.  No interior detail.</p>
<p style="text-align:center;"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_3.png"><img class="size-medium wp-image-252 aligncenter" title="Print 3" src="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_3.png?w=236&#038;h=300" alt="Print 3" width="236" height="300" /></a></p>
<p>Cut out a mask for the interior and made a couple of prints similar to this one.  Note the burn shadow at the top of the door.  Needed to adjust the mask to leave more of the doorway open.  Area to the right of the door was still too light but generally contrast on the exterior was pretty good.</p>
<p style="text-align:center;"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_4.png"><img class="size-medium wp-image-253 aligncenter" title="Print 4" src="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_4.png?w=234&#038;h=300" alt="Print 4" width="234" height="300" /></a></p>
<p>Came back the next day and made this print with fresh developer.  Learned a bit of a lesson that day.</p>
<p style="text-align:center;"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_5.png"><img class="size-medium wp-image-254 aligncenter" title="Print 5" src="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_5.png?w=236&#038;h=300" alt="Print 5" width="236" height="300" /></a></p>
<p>I liked the darker print so went a bit darker on the exterior and burned in to the right of the door.  Got kind of a crappy burn on the right side and the bottom of the door.</p>
<p style="text-align:center;"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_6.png"><img class="size-medium wp-image-255 aligncenter" title="Print 6" src="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_6.png?w=236&#038;h=300" alt="Print 6" width="236" height="300" /></a></p>
<p>Slightly too dark around the upper left due to some crappy hand burning.  Bad halo around the doorknob and got a bad dodge from the mask at the bottom.</p>
<p style="text-align:center;"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_7.png"></a><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_7.png"><img class="size-medium wp-image-256 aligncenter" title="Print 7" src="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_7.png?w=235&#038;h=300" alt="Print 7" width="235" height="300" /></a></p>
<p>Final print.  The main area is a just how I wanted it.  The only issue is another bad dodge around the bottom.  Some of it will be cut off by the mat and it&#8217;s not especially obvious in the print.  Overall I&#8217;m very happy with it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/202/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/202/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/202/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=202&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/03/08/evolution-of-a-print/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_2.png?w=233" medium="image">
			<media:title type="html">Print 2</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_1.png?w=235" medium="image">
			<media:title type="html">First Print</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_3.png?w=236" medium="image">
			<media:title type="html">Print 3</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_4.png?w=234" medium="image">
			<media:title type="html">Print 4</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_5.png?w=236" medium="image">
			<media:title type="html">Print 5</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_6.png?w=236" medium="image">
			<media:title type="html">Print 6</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_7.png?w=235" medium="image">
			<media:title type="html">Print 7</media:title>
		</media:content>
	</item>
		<item>
		<title>Concise Code: Extract the first (only) key/value pair from a associative array</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/03/08/concise-code-extract-the-first-only-keyvalue-pair-from-a-associative-array/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/03/08/concise-code-extract-the-first-only-keyvalue-pair-from-a-associative-array/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:57:13 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[php]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=244</guid>
		<description><![CDATA[I&#8217;m a huge fan of concise code.  I really like to write the absolute minimum amount of code I have to in order to get something done.  It&#8217;s easier to read, easier to debug and easier to test.  Typically this involves writing little helper functions here and there to build myself up a nice library.  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=244&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a huge fan of concise code.  I really like to write the absolute minimum amount of code I have to in order to get something done.  It&#8217;s easier to read, easier to debug and easier to test.  Typically this involves writing little helper functions here and there to build myself up a nice library.  Those functions replace common patterns I use in my code and shorten my source.  What makes me even happier though is when I find a way to do neat tricks within a language to do the same type of thing.  I ran into one in PHP the other day that probably isn&#8217;t very common but can certainly clean up some code.</p>
<p>I had a situation where I had an associative array that contained a single key value pair.  I wanted to extract the key and the value into two separate variables.  First I tried this:</p>
<p><code>$key = array_keys($array)[0];<br />
$value= array_values($array)[0];</code></p>
<p>If I&#8217;d had more experience with PHP I would have known that it won&#8217;t allow the result of a function to be indexed directly (if I&#8217;m wrong about this and there is some syntax that allows this please let me know!).  The ugly alternative was something like this:</p>
<p><code>$key = array_keys($array);<br />
$key = $key[0];<br />
$value = array_values($array);<br />
$value = $value[0];</code></p>
<p>It then occurred to me that I could use the <a href="http://us.php.net/manual/en/function.list.php" target="_blank">list</a> function (it&#8217;s really a language construct, not a function) to accomplish the same thing.  That resulted in the following code:</p>
<p><code>list($key) = array_keys($array);<br />
list($value) = array_values($array);</code></p>
<p>Much cleaner!  Obviously this is a very specific case but handy if you ever run into it.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/244/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/244/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/244/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=244&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/03/08/concise-code-extract-the-first-only-keyvalue-pair-from-a-associative-array/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>
	</item>
		<item>
		<title>CakePHP: Load Paths</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/03/08/cakephp-load-paths/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/03/08/cakephp-load-paths/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:36:36 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[cakephp]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=239</guid>
		<description><![CDATA[So normally when you&#8217;re importing files with Cake you use App::import.  This is fine when you&#8217;ve got files in the standard list of directories (models, components, vendor, etc) but what happens when you want to start a util or a lib directory?  Wouldn&#8217;t it be nice to use App::Import to pull in those files too?  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=239&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>So normally when you&#8217;re importing files with Cake you use App::import.  This is fine when you&#8217;ve got files in the standard list of directories (models, components, vendor, etc) but what happens when you want to start a util or a lib directory?  Wouldn&#8217;t it be nice to use App::Import to pull in those files too?  Turns out you can but I actually haven&#8217;t found any documentation for it.</p>
<p>If you dig deep enough you&#8217;ll find that Cake hooks into Configure when it goes looking for those &#8216;classes&#8217; of files (e.g. Vendor, Core, Components).  As an example, if I wanted to be able to load files from a util directory that lived inside my root directory I could do the following.</p>
<p><code>Configure::write('utilPaths', APP.'util'.DS);<br />
App::import('Util', 'MyLibClass');</code></p>
<p>When App::import is called it will look for a key in configure matching the lowercase of the key you provided followed by &#8216;Paths&#8217;.  The fact that it&#8217;s lowercase actually seems like a bug and is rather unintuitive but it does work.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/239/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/239/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/239/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=239&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/03/08/cakephp-load-paths/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>
	</item>
		<item>
		<title>vi: Line numbers</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/03/08/vi-line-numbers/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/03/08/vi-line-numbers/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 01:21:51 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[vi]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=235</guid>
		<description><![CDATA[I&#8217;m usually an emacs person but have been using vi off and on the last few weeks.  One problem I ran into was moving to a specific line in a file.  Turns out it&#8217;s stupidly simple.  When you&#8217;ve escaped your way out of any edit mode just type &#8216;:&#8217; (colon) followed by the line number [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=235&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m usually an emacs person but have been using vi off and on the last few weeks.  One problem I ran into was moving to a specific line in a file.  Turns out it&#8217;s stupidly simple.  When you&#8217;ve escaped your way out of any edit mode just type &#8216;:&#8217; (colon) followed by the line number you want.  To display line numbers while you&#8217;re editing type &#8216;:set number&#8217;.  Lastly if you want to open a file at a particular line you can add &#8216;+&#8217; (plus) followed by the line number to the command line.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/235/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/235/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/235/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=235&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/03/08/vi-line-numbers/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>
	</item>
		<item>
		<title>The Darkroom: Importance of Consistency</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/03/03/the-darkroom-importance-of-consistency/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/03/03/the-darkroom-importance-of-consistency/#comments</comments>
		<pubDate>Thu, 04 Mar 2010 02:01:23 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[photography]]></category>
		<category><![CDATA[darkroom]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=200</guid>
		<description><![CDATA[Here&#8217;s an interesting lesson.  I&#8217;m usually lazy about mixing new chemistry.  It&#8217;s time consuming, it costs money and I could be printing.  It&#8217;s also extremely important as I learned last week (although this shouldn&#8217;t really be a surprise).  I was working on a particular print with some developer that was already a couple days old.  [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=200&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s an interesting lesson.  I&#8217;m usually lazy about mixing new chemistry.  It&#8217;s time consuming, it costs money and I could be printing.  It&#8217;s also extremely important as I learned last week (although this shouldn&#8217;t really be a surprise).  I was working on a particular print with some developer that was already a couple days old.  I had a result I was pretty happy with but still needed some small tweaks before I&#8217;d consider it finished.  Unfortunately I also had to be somewhere so I had to close up the darkroom for the day.</p>
<p>The next day I went back with some fresh developer to finish things up.  Big difference.  Have a look at the scans below to see for yourself.  In some ways it was a happy accident as I actually prefer a darker, but still slightly revised, version of the print.  On the other hand it would have been nice to know that I had my numbers right in the first place so I could get a consistent result if I wanted to reprint down the road.  I take careful notes of all my prints but if my development conditions aren&#8217;t the same then those notes are useless.  I think I&#8217;ll be mixing a lot more chemistry in the future.</p>
<div id="attachment_226" class="wp-caption alignleft" style="width: 199px"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_stale1.png"><img class="size-medium wp-image-226  " title="Abbey Door with Stale Developer" src="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_stale1.png?w=189&#038;h=240" alt="Abbey Door with Stale Developer" width="189" height="240" /></a><p class="wp-caption-text">Abbey Door with stale developer.</p></div>
<div id="attachment_227" class="wp-caption alignright" style="width: 197px"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_fresh2.png"><img class="size-medium wp-image-227 " title="Abbey Door with Fresh Developer" src="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_fresh2.png?w=187&#038;h=240" alt="Abbey Door with Fresh Developer" width="187" height="240" /></a><p class="wp-caption-text">Abbey Door with fresh developer.  Notice the much darker tones</p></div>
<div style="clear:both;">As a reference point, my the information for my developer says it goes stale 24 hours after mixing.  My fixer lasts a week.  Happy mixing!</div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/200/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/200/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/200/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=200&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/03/03/the-darkroom-importance-of-consistency/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_stale1.png?w=236" medium="image">
			<media:title type="html">Abbey Door with Stale Developer</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/abbey_door_fresh2.png?w=234" medium="image">
			<media:title type="html">Abbey Door with Fresh Developer</media:title>
		</media:content>
	</item>
		<item>
		<title>Windows 7: Share this!</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/03/01/windows-7-share-this/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/03/01/windows-7-share-this/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 02:22:41 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=192</guid>
		<description><![CDATA[Overall I&#8217;ve been pretty impressed with Windows 7.  It&#8217;s been the first Windows release that has actually has some truly useful features and improvements to the interface.  What I&#8217;d originally thought would be gimmicky features such as splitting windows across half the screen and alt-tabbed previews turn out to be very useful in every day [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=192&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Overall I&#8217;ve been pretty impressed with Windows 7.  It&#8217;s been the first Windows release that has actually has some truly useful features and improvements to the interface.  What I&#8217;d originally thought would be gimmicky features such as splitting windows across half the screen and alt-tabbed previews turn out to be very useful in every day use.  One place where it falls short though is sharing.</p>
<div id="attachment_217" class="wp-caption alignleft" style="width: 310px"><a href="http://graykittenswithsocks.files.wordpress.com/2010/03/network_settings.jpg"><img class="size-medium wp-image-217" style="margin:5px;" title="Network Settings" src="http://graykittenswithsocks.files.wordpress.com/2010/03/network_settings.jpg?w=300&#038;h=274" alt="Network Settings" width="300" height="274" /></a><p class="wp-caption-text">Network and Sharing Center</p></div>
<p>In XP I could right click and share.  Not so with Windows 7.  Twice it has taken me upwards of half an hour to share a file between two machines on the same network, both running 7.  I&#8217;m still not sure what the proper procedure is.  Most recently I had luck with Homegroups.  If you haven&#8217;t setup a homegroup on your network you can do so from Control Panels -&gt; Network and Sharing Center.  It will provide you with a ridiculously long password that you&#8217;ll need to enter on the other machines in you network.  I&#8217;m not sure if it&#8217;s possible to recover or change this password.  After setting up your homegroup on the two machines you want to share between you can right click on a folder (probably only in a directory you own) and choose the <em>Share With&#8230;</em> option.  One of the options that comes up should be your homegroup.  Be sure that you have file and printer sharing turned on in your Home network options, Control Panels -&gt; Network and Sharing Center -&gt; Advanced Sharing Settings.</p>
<p>Wasn&#8217;t one of those Microsoft commercials about making Windows easier to use?</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/192/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/192/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/192/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=192&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/03/01/windows-7-share-this/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/03/network_settings.jpg?w=300" medium="image">
			<media:title type="html">Network Settings</media:title>
		</media:content>
	</item>
		<item>
		<title>PHP: Exceptions, Unwanted Traces and XDebug</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/03/01/php-exceptions-unwanted-traces-and-xdebug/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/03/01/php-exceptions-unwanted-traces-and-xdebug/#comments</comments>
		<pubDate>Tue, 02 Mar 2010 01:37:47 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[code]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[xdebug]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=196</guid>
		<description><![CDATA[Ran into a &#8220;fun&#8221; problem today at work and felt like sharing.  This one involved PHP, XDebug and some unwanted stack traces.  I&#8217;d been playing with exceptions which are rarely used in the project I&#8217;m working on and I had no experience with them in PHP myself.  The scenario was a very simple try/catch demonstrated [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=196&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Ran into a &#8220;fun&#8221; problem today at work and felt like sharing.  This one involved PHP, XDebug and some unwanted stack traces.  I&#8217;d been playing with exceptions which are rarely used in the project I&#8217;m working on and I had no experience with them in PHP myself.  The scenario was a very simple try/catch demonstrated by the following code.</p>
<p><code>try {<br />
throw new Exception('fail whale');<br />
} catch(Exception $e) {<br />
echo 'got here';<br />
}</code></p>
<p>Simple right?  I thought so too but despite the fact that the exception was being caught I was still seeing stack traces being dumped to my console (and via stdout, not even stderr).  In this case it looked something like this:</p>
<p><code>Exception: fail whale in C:\Users\Tim\Desktop\test.php on line 3</code></p>
<p><code>Call Stack:</code><br />
<code>0.0005     322640   1. {main}() test.php:</code></p>
<p><code>Variables in local scope (#1):</code><br />
<code>$e = *uninitialized*</code></p>
<p><code>got here</code></p>
<p>After much poking around I discovered that the problem was XDebug.  Apparently it has a setting, show_exception_trace, which will dump exceptions, even those that are caught and handled.  I&#8217;m not sure if I copied the setting from somewhere or if it was the default but it certainly through me off.  Change it to zero in your php.ini file and you&#8217;ll be much happier.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/196/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/196/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/196/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=196&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/03/01/php-exceptions-unwanted-traces-and-xdebug/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>
	</item>
		<item>
		<title>Bring us&#8230; a shrubbery!</title>
		<link>http://graykittenswithsocks.wordpress.com/2010/02/26/bring-us-a-shrubbery/</link>
		<comments>http://graykittenswithsocks.wordpress.com/2010/02/26/bring-us-a-shrubbery/#comments</comments>
		<pubDate>Sat, 27 Feb 2010 00:58:10 +0000</pubDate>
		<dc:creator>timjnh</dc:creator>
				<category><![CDATA[personal]]></category>
		<category><![CDATA[house]]></category>

		<guid isPermaLink="false">http://graykittenswithsocks.wordpress.com/?p=182</guid>
		<description><![CDATA[A large shrubbery appeared in my driveway last night.  Given that there were winds reported at 70 mph I&#8217;m surprised there weren&#8217;t more.  This one was about 80 feet tall.  Our neighbor, a Loudon police officer, very kindly stopped by the a chain saw and took care of most of this evening.  If not for [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=182&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>A large shrubbery appeared in my driveway last night.  Given that there were winds reported at 70 mph I&#8217;m surprised there weren&#8217;t more.  This one was about 80 feet tall.  Our neighbor, a Loudon police officer, very kindly stopped by the a chain saw and took care of most of this evening.  If not for him we still wouldn&#8217;t be able to get out.</p>
<p style="text-align:center;"><a href="http://graykittenswithsocks.files.wordpress.com/2010/02/tree_and_house.jpg"></a></p>
<div id="attachment_184" class="wp-caption aligncenter" style="width: 310px"><a href="http://graykittenswithsocks.files.wordpress.com/2010/02/tree_and_house.jpg"><img class="size-medium wp-image-184" title="Tree and House" src="http://graykittenswithsocks.files.wordpress.com/2010/02/tree_and_house.jpg?w=300&#038;h=225" alt="Tree and House" width="300" height="225" /></a><p class="wp-caption-text">A view of all 80 feet of tree and the house</p></div>
<p style="text-align:center;">
<div id="attachment_185" class="wp-caption aligncenter" style="width: 310px"><a href="http://graykittenswithsocks.files.wordpress.com/2010/02/tree_side.jpg"><img class="size-medium wp-image-185" title="Tree Side" src="http://graykittenswithsocks.files.wordpress.com/2010/02/tree_side.jpg?w=300&#038;h=225" alt="Tree Side" width="300" height="225" /></a><p class="wp-caption-text">The whole length of the monster.</p></div>
<p style="text-align:center;">
<div id="attachment_186" class="wp-caption aligncenter" style="width: 310px"><a href="http://graykittenswithsocks.files.wordpress.com/2010/02/a_bit_of_scale1.jpg"><img class="size-medium wp-image-186" title="A Bit Of Scale" src="http://graykittenswithsocks.files.wordpress.com/2010/02/a_bit_of_scale1.jpg?w=300&#038;h=225" alt="A Bit Of Scale" width="300" height="225" /></a><p class="wp-caption-text">The tree and cars for a bit of scale.  Glad it wasn&#39;t any taller!</p></div>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/graykittenswithsocks.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/graykittenswithsocks.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/graykittenswithsocks.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/graykittenswithsocks.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/graykittenswithsocks.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/graykittenswithsocks.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/graykittenswithsocks.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/graykittenswithsocks.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/graykittenswithsocks.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/graykittenswithsocks.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/graykittenswithsocks.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/graykittenswithsocks.wordpress.com/182/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/graykittenswithsocks.wordpress.com/182/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/graykittenswithsocks.wordpress.com/182/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=graykittenswithsocks.wordpress.com&amp;blog=9903780&amp;post=182&amp;subd=graykittenswithsocks&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://graykittenswithsocks.wordpress.com/2010/02/26/bring-us-a-shrubbery/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/9847bb5a8dd8e518d70c0a6e8e40a745?s=96&#38;d=identicon&#38;r=G" medium="image">
			<media:title type="html">timjnh</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/02/tree_and_house.jpg?w=300" medium="image">
			<media:title type="html">Tree and House</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/02/tree_side.jpg?w=300" medium="image">
			<media:title type="html">Tree Side</media:title>
		</media:content>

		<media:content url="http://graykittenswithsocks.files.wordpress.com/2010/02/a_bit_of_scale1.jpg?w=300" medium="image">
			<media:title type="html">A Bit Of Scale</media:title>
		</media:content>
	</item>
	</channel>
</rss>
