<?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>NinjaCipher &#187; ruby</title>
	<atom:link href="http://www.ninjacipher.com/category/development/ruby/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ninjacipher.com</link>
	<description>kungpow programming</description>
	<lastBuildDate>Thu, 25 Mar 2010 14:39:12 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<cloud domain='www.ninjacipher.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
		<item>
		<title>Top 5 Django IDEs</title>
		<link>http://www.ninjacipher.com/2009/05/01/top-5-django-ides/</link>
		<comments>http://www.ninjacipher.com/2009/05/01/top-5-django-ides/#comments</comments>
		<pubDate>Sat, 02 May 2009 03:22:24 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[random thoughts]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[ide]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=108</guid>
		<description><![CDATA[I&#8217;ve seen a lot of people out there looking for a good IDE for doing Django work. Personally I&#8217;m a pydev guy. I have been using Eclipse for so long for everything else it&#8217;s very natural to keep on that path. However there are definitely other alternatives out there. Here is a list of other [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve seen a lot of people out there looking for a good IDE for doing Django work. Personally I&#8217;m a pydev guy. I have been using Eclipse for so long for everything else it&#8217;s very natural to keep on that path. However there are definitely other alternatives out there. Here is a list of other IDEs and editors that have Django support.</p>
<ol>
<li><a href="http://pydev.blogspot.com/2006/09/configuring-pydev-to-work-with-django.html" target="_blank">Eclipse with PyDev</a> (part of <a href="http://www.aptana.com/python" target="_blank">Aptana</a> now)</li>
<li><a href="http://macromates.com/blog/archives/2006/08/21/getting-more-bundles/" target="_blank">TextMate with Django Bundle</a> (technically not an IDE but allot of people love it)</li>
<li><a href="http://code.google.com/p/netbeans-django/" target="_blank">Netbeans with Django Plugin</a></li>
<li><a href="http://www.wingware.com/doc/howtos/django" target="_blank">Wing</a></li>
<li><a href="http://code.google.com/p/django-komodo-kit/" target="_blank">Komodo with Django Komodo Kit</a></li>
</ol>
<p>So I&#8217;m sure some of you people out there will say man up&#8230; use VIM or Emacs&#8230; be a real programmer! To that I say have at it. If that&#8217;s your preference then do what works best for you. By all means, leave me a comment and tell my how wrong I am and/or glow about how good your IDE/editor is. Long story short Django is an awesome framework and whatever you choose to work in I hope you enjoy it as much as I have.</p>
<div id="stb-container" class="stb-container"><div id='caption' class='stb-alert-caption_box' >Reality Check!</div><div id='body' class='stb-alert-body_box' >Of course there are other options out there. And top 5 doesn&#8217;t mean these are the best. But from my research these are the editors most people seem to be using.<br />
</div></div>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2009/05/01/top-5-django-ides/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>post_from_link javascript tip</title>
		<link>http://www.ninjacipher.com/2008/12/13/post_from_link-javascript-tip/</link>
		<comments>http://www.ninjacipher.com/2008/12/13/post_from_link-javascript-tip/#comments</comments>
		<pubDate>Sat, 13 Dec 2008 23:50:03 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[dev]]></category>
		<category><![CDATA[js]]></category>
		<category><![CDATA[tip]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=55</guid>
		<description><![CDATA[I wrote this the other day. Thought someone might find it useful. Will let you do a POST request from a link. Good for delete buttons, since we all know your not supposed to let users delete things from a get request&#8230; right?!   
Basically it takes your url &#038; params and dynamically builds [...]]]></description>
			<content:encoded><![CDATA[<p>I wrote this the other day. Thought someone might find it useful. Will let you do a POST request from a link. Good for delete buttons, since we all know your not supposed to let users delete things from a get request&#8230; right?! <img src='http://www.ninjacipher.com/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' />  </p>
<p>Basically it takes your url &#038; params and dynamically builds the DOM for the form and then submits it. </p>
<p>Requires that you include <a href="http://www.prototypejs.org" target="prototype">prototype.js</a>.</p>
<p>Here is an example link. You just pass the url you wish to submit to and an associative array of the params.</p>
<pre name="code" class="html"><a href="#" onClick="post_from_link('/the/url/to/post/to',{'param1':'val1','param2':'val2'});" >post the request</a></pre>
<p>Here is the js function. Include this in the head of your page.</p>
<pre name="code" class="javascript">
/*
* Dynamically creates a form based on args and submits it to the given url
* @param {Object} url
* @param {Object} params
*/
function post_from_link(url,params){
   var form = new Element('form', { action: url, method: 'POST' });
   for(param in params){
       var hidden = new Element('input', {type:'hidden', name:param, value:params[param]});
       form.insert(hidden);
   }
   document.body.appendChild(form);
   form.submit();
}
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2008/12/13/post_from_link-javascript-tip/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python vs Ruby on Google Blogs</title>
		<link>http://www.ninjacipher.com/2008/02/28/python-vs-ruby-on-google-blogs/</link>
		<comments>http://www.ninjacipher.com/2008/02/28/python-vs-ruby-on-google-blogs/#comments</comments>
		<pubDate>Thu, 28 Feb 2008 05:04:58 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[development]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/2008/02/28/python-vs-ruby-on-google-blogs/</guid>
		<description><![CDATA[Here is a graph I generated from trendrr.com to show how many search results google blogs returns for ruby vs python. It makes me happy on the inside to see them so neck and neck.

]]></description>
			<content:encoded><![CDATA[<p>Here is a graph I generated from <a href="http://trendrr.com">trendrr.com</a> to show how many search results google blogs returns for ruby vs python. It makes me happy on the inside to see them so neck and neck.</p>
<p><img src="http://www.trendrr.com/public/graphs/370807" /></p>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2008/02/28/python-vs-ruby-on-google-blogs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>autoCreated ajax ext dialog</title>
		<link>http://www.ninjacipher.com/2007/08/12/autocreated-ajax-ext-dialog/</link>
		<comments>http://www.ninjacipher.com/2007/08/12/autocreated-ajax-ext-dialog/#comments</comments>
		<pubDate>Mon, 13 Aug 2007 05:17:06 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=27</guid>
		<description><![CDATA[Here is a tidbit that will autoCreate an ExtJs BasicDialog populated by a partial returned from an AJAX call to a rails controller action. 
In your js

function loadDialog(){
    var cb = {
      success: showDialog,
      failure: displayError
    };
   [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a tidbit that will autoCreate an ExtJs BasicDialog populated by a partial returned from an AJAX call to a rails controller action. </p>
<h3>In your js</h3>
<pre>
function loadDialog(){
    var cb = {
      success: showDialog,
      failure: displayError
    };
    Ext.lib.Ajax.formRequest( 'merge_form', '/controller/get_dialog' , cb , null, false, null);
}
function showDialog(response){
   var dlg = new Ext.BasicDialog("example_dialog",{
		        height: 200,
		        width: 300,
		        resizeable: false,
			autoCreate: true,
		        modal: true,
		        draggable:false,
			collapsible:false,
		        shadow: true,
			title:'Hola'
		    });

		    dlg.addKeyListener(27, dlg.hide, dlg);
		    dlg.addButton('Yes', dlg.hide, dlg);
		    dlg.addButton('No', dlg.hide, dlg);
		    dlg.body.dom.innerHTML = response.responseText;
		    dlg.show();
		}
function displayError(response){
   if(response.responseText == null){
	 Ext.MessageBox.alert("Woops!","The requested operation failed.");
   }else{
	Ext.MessageBox.alert("Woops!",response.responseText);
   }
}
</pre>
<h3>In your controller</h3>
<pre>
  def get_dialog
    @msg = "hello world"
    render :partial=>"/dialogs/content"
  end
</pre>
<h3>In your partial</h3>
<pre>
  <%= @msg %>
</pre>
<h3>In your view</h3>
<pre>
&lt;input type="button" onClick="loadDialog();" value="show dialog" /&gt;
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2007/08/12/autocreated-ajax-ext-dialog/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>3 helpfull functions</title>
		<link>http://www.ninjacipher.com/2007/08/11/3-helpfull-functions/</link>
		<comments>http://www.ninjacipher.com/2007/08/11/3-helpfull-functions/#comments</comments>
		<pubDate>Sat, 11 Aug 2007 11:25:38 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[ruby]]></category>
		<category><![CDATA[tutorials]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=26</guid>
		<description><![CDATA[These are a few functions that I use in every rails project I do so I figured I would pass them along. Perhaps someone will find them useful. 
This first one is a function to get a page number for pagination based on start index and result set size. 

  def get_page(_start,_limit)
   [...]]]></description>
			<content:encoded><![CDATA[<p>These are a few functions that I use in every rails project I do so I figured I would pass them along. Perhaps someone will find them useful. </p>
<p>This first one is a function to get a page number for pagination based on start index and result set size. </p>
<pre>
  def get_page(_start,_limit)
    start = (_start || 1).to_i
    size = (_limit || 25).to_i
    return ((start/size).to_i)+1
  end
</pre>
<p>This function returns an age based on birth date thats pulled from a DateTime db col. </p>
<pre>
  def age(birthdate)
    unless birthdate.nil?
      age = Date.today.year - birthdate.year
      if Date.today.month < birthdate.month ||
      (Date.today.month == birthdate.month &#038;&#038; birthdate.day >= Date.today.day)
        age = age - 1
      end
      return age
    else
      return 0
    end
  end
</pre>
<p>This function takes a string and a length and truncates it while also appending &#8230; to the end. </p>
<pre>
  def ellipses(str,length)
    if str.nil?
      return
    else
      return (str.length > length) ? "#{str[0,length]}..." : str
    end
  end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2007/08/11/3-helpfull-functions/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>merging model validation errors</title>
		<link>http://www.ninjacipher.com/2007/05/14/merging-model-validation-errors/</link>
		<comments>http://www.ninjacipher.com/2007/05/14/merging-model-validation-errors/#comments</comments>
		<pubDate>Mon, 14 May 2007 22:18:26 +0000</pubDate>
		<dc:creator>mattd</dc:creator>
				<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://www.ninjacipher.com/?p=24</guid>
		<description><![CDATA[Here is a simple chunk of code that I find very useful when working with multiple objects in one form that leverage the Rails model validation functions. 
In this example we see how to merge validation errors for more then one object so they can be displayed with the error_messages_for helper. 

if @user.update_attributes(params[:user])
   [...]]]></description>
			<content:encoded><![CDATA[<p>Here is a simple chunk of code that I find very useful when working with multiple objects in one form that leverage the Rails model validation functions. </p>
<p>In this example we see how to merge validation errors for more then one object so they can be displayed with the error_messages_for helper. </p>
<pre>
if @user.update_attributes(params[:user])
   flash[:notice] = "Account Updated"
else
   flash[:notice] = "Account Updated Failed"
   @user.profile.errors.each do |attribute, error|
      @user.errors.add(attribute, error)
   end
end
</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.ninjacipher.com/2007/05/14/merging-model-validation-errors/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
