<?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>Sean&#039;s Blog &#187; api</title>
	<atom:link href="http://seanbehan.com/tag/api/feed/" rel="self" type="application/rss+xml" />
	<link>http://seanbehan.com</link>
	<description>Web Programming, Ruby on Rails, Wordpress, PHP from Burlington, Vermont</description>
	<lastBuildDate>Wed, 18 Jan 2012 21:44:54 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Collection Select Helper and OnChange Event in Rails</title>
		<link>http://seanbehan.com/posts/collection-select-helper-and-onchange-event-in-rails/</link>
		<comments>http://seanbehan.com/posts/collection-select-helper-and-onchange-event-in-rails/#comments</comments>
		<pubDate>Tue, 31 Aug 2010 14:38:23 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Posts]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[collection]]></category>
		<category><![CDATA[helpers]]></category>
		<category><![CDATA[html]]></category>
		<category><![CDATA[select]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1162</guid>
		<description><![CDATA[Given a collection of Active Record objects, you may use the collection_select helper method to produce a select form field. You need to pass in a number of arguments to the helper function. 1) object &#8211; your model object used in the collection 2) method &#8211; a valid model attribute or method 3) collection &#8211; [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fposts%2Fcollection-select-helper-and-onchange-event-in-rails%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Collection Select Helper and OnChange Event in Rails" data-url="http://seanbehan.com/posts/collection-select-helper-and-onchange-event-in-rails/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>Given a collection of Active Record objects, you may use the collection_select helper method to produce a select form field. You need to pass in a number of arguments to the helper function.</p>
<p>1) object &#8211; your model object used in the collection<br />
2) method &#8211; a valid model attribute or method<br />
3) collection &#8211; a collection of active record model objects<br />
4) option_value &#8211; value being set from the model for the &lt;option value=&#8221;option_value&#8221;&gt; html element<br />
5) option_name &#8211; what is displayed for the user e.g., &lt;option&gt; option_name &lt;<br />
6) option &#8211; general options<br />
7) options for the select html element</p>
<pre class="wp-code-highlight prettyprint"># helper and arguments...
# collection_select( model, id, collection, option_value, option_name, options, html_options)

&amp;lt;%= collection_select(&quot;states&quot;, &quot;state_id&quot;,
  State.participating,
  &quot;abbreviation&quot;, &quot;name&quot;,
   {:selected=&amp;gt; get_current_state_or_nil },
   {:onchange=&amp;gt;&quot;document.location='/states/'+this.value&quot;}
) %&amp;gt;

#which will produce something like...

&lt;pre id=&quot;line27&quot;&gt;&amp;lt;select id=&quot;state_id&quot; name=&quot;state[id]&quot; onchange=&quot;document.location='/states/'+this.value&quot;&amp;gt;
&amp;lt;option value=&quot;AL&quot;&amp;gt;Alabama&amp;lt;/option&amp;gt;
&amp;lt;option value=&quot;AK&quot;&amp;gt;Alaska&amp;lt;/option&amp;gt;
&amp;lt;option value=&quot;AZ&quot;&amp;gt;Arizona&amp;lt;/option&amp;gt;
&amp;lt;option value=&quot;AR&quot;&amp;gt;Arkansas&amp;lt;/option&amp;gt;
&amp;lt;/select&amp;gt;</pre>
</pre>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/posts/collection-select-helper-and-onchange-event-in-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Get Child Categories of Parent Category on Single Post in WordPress</title>
		<link>http://seanbehan.com/programming/get-child-categories-of-parent-category-on-single-post-in-wordpress/</link>
		<comments>http://seanbehan.com/programming/get-child-categories-of-parent-category-on-single-post-in-wordpress/#comments</comments>
		<pubDate>Thu, 17 Jun 2010 15:51:26 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Wordpress]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[children]]></category>
		<category><![CDATA[functionality]]></category>
		<category><![CDATA[get_categories]]></category>
		<category><![CDATA[parent]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1056</guid>
		<description><![CDATA[I was hoping to find a function in the WordPress API, that goes something like this&#8230; the_child_categories(&#34;Vermont&#34;); // print Burlington, Brattleboro... etc if this post has any child categories of Vermont But I could not. The result that I did find, from various forums goes something like this&#8230; $parentcat = get_category_by_slug('Vermont'); foreach((get_the_category()) as $childcat): if [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fprogramming%2Fget-child-categories-of-parent-category-on-single-post-in-wordpress%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Get Child Categories of Parent Category on Single Post in WordPress" data-url="http://seanbehan.com/programming/get-child-categories-of-parent-category-on-single-post-in-wordpress/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I was hoping to find a function in the WordPress API, that goes something like this&#8230;</p>
<pre class="wp-code-highlight prettyprint">
  the_child_categories(&quot;Vermont&quot;);
  // print Burlington, Brattleboro... etc if this post has any child categories of Vermont
</pre>
<p>But I could not. The result that I did find, from various forums goes something like this&#8230;</p>
<pre class="wp-code-highlight prettyprint">
$parentcat = get_category_by_slug('Vermont');
foreach((get_the_category()) as $childcat):
  if (cat_is_ancestor_of($parentcat, $childcat)):
    echo get_category_link($childcat-&gt;cat_ID);
    echo $childcat-&gt;cat_name;
  endif;
endforeach;
</pre>
<p>If you&#8217;re in the in the Loop, you can use the get_the_category() function to retrieve the category objects of the current post, without printing the results to the screen. You can loop over the contents from what is returned by the function.</p>
<p>This condition uses the API function &#8220;cat_is_ancestor_of&#8221; to check whether or not the category from the current post is a child of the parent which we fetched with the &#8220;get_category_by_slug&#8221; function.</p>
<p>Here is a little function that I threw into &#8220;functions.php&#8221; so that I can get the child categories easily in my theme.</p>
<pre class="wp-code-highlight prettyprint">
/** Usage
_the_category_children(&quot;Vermont&quot;); */
function _the_category_children($slug=&quot;&quot;){
  if($categories       = get_the_category()):
    if($slug_category   = get_category_by_slug($slug)):
      foreach($categories as $category):
        echo (cat_is_ancestor_of($slug_category, $category)) ? $category-&gt;cat_name : '';
      endforeach;
    endif;
  endif;
}
</pre>
<p>More info/references on accomplishing this functionality are available<br />
<a href="http://codex.wordpress.org/Function_Reference/cat_is_ancestor_of">http://codex.wordpress.org/Function_Reference/cat_is_ancestor_of</a><br />
<a href="http://wordpress.org/support/topic/284057?replies=8#post-1120489">http://wordpress.org/support/topic/284057?replies=8#post-1120489</a><br />
<a href="http://wordpress.org/support/topic/297615">http://wordpress.org/support/topic/297615</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/get-child-categories-of-parent-category-on-single-post-in-wordpress/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		</item>
		<item>
		<title>My Review of Moodle 1.9 Extension Development</title>
		<link>http://seanbehan.com/programming/review-of-moodle-1-9-extension-development/</link>
		<comments>http://seanbehan.com/programming/review-of-moodle-1-9-extension-development/#comments</comments>
		<pubDate>Fri, 04 Jun 2010 19:59:52 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[book review]]></category>
		<category><![CDATA[moodle]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[php]]></category>
		<category><![CDATA[software development]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=1040</guid>
		<description><![CDATA[I wrote a review for Joseph Thibault&#8217;s Moodle News on extension development for Moodle. The book is quite good and I think an essential resource for anyone wanting to develop in Moodle. The book focuses on plugin development, but it will also give you an overview of the architecture, api and best practices. I wish [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fprogramming%2Freview-of-moodle-1-9-extension-development%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="My Review of Moodle 1.9 Extension Development" data-url="http://seanbehan.com/programming/review-of-moodle-1-9-extension-development/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I wrote a review for <a href="http://moodlenews.com">Joseph Thibault&#8217;s Moodle News</a> on extension development for Moodle. The book is quite good and I think an essential resource for anyone wanting to develop in Moodle. The book focuses on plugin development, but it will also give you an overview of the architecture, api and best practices.</p>
<p>I wish I had this book about 3 years ago when I first started fooling around in the code base! At any rate, you can read the review on <a href="http://moodlenews.com">Moodle News</a> at <a href="http://www.moodlenews.com/2010/moodle-1-9-extension-development-review-by-bseanvt/">http://www.moodlenews.com/2010/moodle-1-9-extension-development-review-by-bseanvt/</a></p>
<p>There is also an interesting discussion underway about the &#8216;bloat&#8217; in the Moodle code at <a href="http://www.moodlenews.com/2010/opinion-1000000-lines-of-code/">http://www.moodlenews.com/2010/opinion-1000000-lines-of-code/</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/programming/review-of-moodle-1-9-extension-development/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Updating Your Twitter Status with cURL and a Bash Function</title>
		<link>http://seanbehan.com/linux/updating-your-twitter-status-with-curl-and-a-bash-function/</link>
		<comments>http://seanbehan.com/linux/updating-your-twitter-status-with-curl-and-a-bash-function/#comments</comments>
		<pubDate>Tue, 08 Dec 2009 01:34:50 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[bash]]></category>
		<category><![CDATA[curl]]></category>
		<category><![CDATA[twitter]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=673</guid>
		<description><![CDATA[I&#8217;m usually at the command line so I wrote a little a bash function so that i can type tweet this is really neat but kind of pointless and it will update my twitter status! some characters trip it up but in general it&#8217;s useful for most of my tweets. The tweet function just spits [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Flinux%2Fupdating-your-twitter-status-with-curl-and-a-bash-function%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Updating Your Twitter Status with cURL and a Bash Function" data-url="http://seanbehan.com/linux/updating-your-twitter-status-with-curl-and-a-bash-function/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I&#8217;m usually at the command line so I wrote a little a bash function so that i can type</p>
<pre class="wp-code-highlight prettyprint">
tweet this is really neat but kind of pointless
</pre>
<p>and it will update my twitter status! some characters trip it up but in general it&#8217;s useful for most of my tweets. The tweet function just spits out the arguments passed to it for the status parameter for the API call to twitter.</p>
<p>Add the following to the .bash_profile file and reload the terminal (don&#8217;t forget to add your email and pwd where appropriate).</p>
<pre class="wp-code-highlight prettyprint">
tweet() {
   curl -u your_twitter_email_addr:your_twitter_passwd -d status=&quot;$*&quot; http://twitter.com/statuses/update.xml
 }
 </pre>
<p>*** Twitter still uses http basic authentication for their API. However, they are moving away from it in favor of oAuth. So I&#8217;m not sure how long this fun will last :{</p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/linux/updating-your-twitter-status-with-curl-and-a-bash-function/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Ruby on Rails, jQuery and YUI API Docs Available as Mac OS X Dictionary Binaries</title>
		<link>http://seanbehan.com/documentation/ruby-on-rails-jquery-and-yui-api-docs-available-as-mac-os-x-dictionary-binaries/</link>
		<comments>http://seanbehan.com/documentation/ruby-on-rails-jquery-and-yui-api-docs-available-as-mac-os-x-dictionary-binaries/#comments</comments>
		<pubDate>Sat, 05 Dec 2009 15:09:02 +0000</pubDate>
		<dc:creator>bseanvt</dc:creator>
				<category><![CDATA[Documentation]]></category>
		<category><![CDATA[api]]></category>
		<category><![CDATA[dictionary]]></category>
		<category><![CDATA[jquery]]></category>
		<category><![CDATA[mac os x]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[yui]]></category>

		<guid isPermaLink="false">http://seanbehan.com/?p=636</guid>
		<description><![CDATA[I came across an awesome tool this morning. Priit Haamer has chunked Ruby on Rails, jQuery, and some of YUI documentation into native Mac OS X dictionary binaries. This lets you search those API docs from Spotlight, TextMate, any application that uses the dictionary app! I have tested the Ruby on Rails API within TextMate. [...]]]></description>
			<content:encoded><![CDATA[<div style="height:33px;" class="really_simple_share robots-nocontent snap_nopreview"><div class="really_simple_share_facebook_like" style="width:px;">
				<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fseanbehan.com%2Fdocumentation%2Fruby-on-rails-jquery-and-yui-api-docs-available-as-mac-os-x-dictionary-binaries%2F&amp;layout=button_count&amp;show_faces=false&amp;width=&amp;action=like&amp;colorscheme=light&amp;send=false&amp;height=27" 
						scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:px; height:27px;" allowTransparency="true"></iframe>
				</div><div class="really_simple_share_twitter" style="width:px;">
					<a href="http://twitter.com/share" class="twitter-share-button" data-count="horizontal" 
						data-text="Ruby on Rails, jQuery and YUI API Docs Available as Mac OS X Dictionary Binaries" data-url="http://seanbehan.com/documentation/ruby-on-rails-jquery-and-yui-api-docs-available-as-mac-os-x-dictionary-binaries/" 
						data-via="" ></a> 
				</div></div>
		<div style="clear:both;"></div><p>I came across an awesome tool this morning. <a href="http://www.priithaamer.com/">Priit Haamer</a> has chunked Ruby on Rails, jQuery, and some of YUI documentation into native Mac OS X dictionary binaries. This lets you search those API docs from Spotlight, TextMate, any application that uses the dictionary app!</p>
<p>I have tested the Ruby on Rails API within TextMate. Hover over any function and hit ctl+cmd+d and a little popup will give you a glimpse at the API docs. Seems like a nice alternative to ACK or the normal TextMate function lookup.</p>
<p>More information and installation instructions are available at Priit&#8217;s site <a href="http://www.priithaamer.com/blog">http://www.priithaamer.com/blog</a></p>
<p>Here is a nice video of the tool</p>
<p><a href="http://seanbehan.com/documentation/ruby-on-rails-jquery-and-yui-api-docs-available-as-mac-os-x-dictionary-binaries/"><em>Click here to view the embedded video.</em></a></p>
]]></content:encoded>
			<wfw:commentRss>http://seanbehan.com/documentation/ruby-on-rails-jquery-and-yui-api-docs-available-as-mac-os-x-dictionary-binaries/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

