<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/xsl" media="screen" href="/~d/styles/rss2full.xsl"?><?xml-stylesheet type="text/css" media="screen" href="http://feeds.feedburner.com/~d/styles/itemcontent.css"?><rss 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:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0">

<channel>
	<title>John Bellone - Thoughtless Banter</title>
	
	<link>http://thoughtlessbanter.com</link>
	<description>Musings from an east coast software developer, writer and reader</description>
	<lastBuildDate>Fri, 27 Aug 2010 03:31:43 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="self" type="application/rss+xml" href="http://feeds.feedburner.com/thoughtlessbanter-com" /><feedburner:info uri="thoughtlessbanter-com" /><atom10:link xmlns:atom10="http://www.w3.org/2005/Atom" rel="hub" href="http://pubsubhubbub.appspot.com/" /><item>
		<title>Boston Gameloop 2010 #bgl10</title>
		<link>http://feedproxy.google.com/~r/thoughtlessbanter-com/~3/N4fcliytFS0/</link>
		<comments>http://thoughtlessbanter.com/2010/08/26/boston-gameloop-2010-bgl10/#comments</comments>
		<pubDate>Fri, 27 Aug 2010 03:31:43 +0000</pubDate>
		<dc:creator>jb</dc:creator>
				<category><![CDATA[Pennies for Thought]]></category>
		<category><![CDATA[Boston]]></category>
		<category><![CDATA[Cambridge]]></category>
		<category><![CDATA[Gameloop]]></category>
		<category><![CDATA[Traveling]]></category>

		<guid isPermaLink="false">http://thoughtlessbanter.com/?p=663</guid>
		<description><![CDATA[I will be heading off to the Boston Gameloop 2010 conference at the Microsoft NERD center in Cambridge, MA tomorrow night. I decided to travel by the means of the Bolt Bus which provides both power outlets for laptops as well as free Internet for the trip. I am not quite sure the quality of [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/VeLAosm-OTt4iwUZ2dm2UZw5_5s/0/da"><img src="http://feedads.g.doubleclick.net/~a/VeLAosm-OTt4iwUZ2dm2UZw5_5s/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/VeLAosm-OTt4iwUZ2dm2UZw5_5s/1/da"><img src="http://feedads.g.doubleclick.net/~a/VeLAosm-OTt4iwUZ2dm2UZw5_5s/1/di" border="0" ismap="true"></img></a></p><p>I will be heading off to the Boston Gameloop 2010 conference at the Microsoft NERD center in Cambridge, MA tomorrow night. I decided to travel by the means of the <a href="http://boltbus.com/">Bolt Bus</a> which provides both power outlets for laptops as well as free Internet for the trip. I am not quite sure the quality of either, but I expect to at least be online occasionally tomorrow night to chat on and off. I think I am going to take this time to work more on my <a href="http://typealoud.com/">Ruby on Rails</a> project, Type Aloud, which I am hoping to launch sometime around the beginning of October. I will be sending around some beta invites when the site is ready to rock and roll. </p>
]]></content:encoded>
			<wfw:commentRss>http://thoughtlessbanter.com/2010/08/26/boston-gameloop-2010-bgl10/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://thoughtlessbanter.com/2010/08/26/boston-gameloop-2010-bgl10/</feedburner:origLink></item>
		<item>
		<title>C++ Generic Lazy Loader Implementation</title>
		<link>http://feedproxy.google.com/~r/thoughtlessbanter-com/~3/EUcKDXsoWKg/</link>
		<comments>http://thoughtlessbanter.com/2010/08/22/c-generic-lazy-loader-implementation/#comments</comments>
		<pubDate>Sun, 22 Aug 2010 23:12:33 +0000</pubDate>
		<dc:creator>jb</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[C++]]></category>
		<category><![CDATA[Design Patterns]]></category>
		<category><![CDATA[Lazy Execution]]></category>
		<category><![CDATA[Lazy Loading]]></category>

		<guid isPermaLink="false">http://thoughtlessbanter.com/?p=655</guid>
		<description><![CDATA[Lazy loading is a software design pattern that delays the initialization of resources until the first time they are to be used inside of an application. Thus, for certain applications that rarely use memory intensive resources, you only need to initialize when there is a guarantee it is to be used. This has obvious performance [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/dVybyWXSfssIe_vpisCtFH6USPQ/0/da"><img src="http://feedads.g.doubleclick.net/~a/dVybyWXSfssIe_vpisCtFH6USPQ/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/dVybyWXSfssIe_vpisCtFH6USPQ/1/da"><img src="http://feedads.g.doubleclick.net/~a/dVybyWXSfssIe_vpisCtFH6USPQ/1/di" border="0" ismap="true"></img></a></p><p><a href="http://en.wikipedia.org/wiki/Lazy_loading">Lazy loading</a> is a <a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)">software design pattern</a> that delays the initialization of resources until the first time they are to be used inside of an application. Thus, for certain applications that rarely use memory intensive resources, you only need to initialize when there is a guarantee it is to be used. This has obvious performance and efficiency benefits. As a C++ programmer by trade I find it rather irritating that there is not a generic class that automatically handles lazy loading for me. So like any good lazy fuck I decided to spend a few hours and write one of my own. I currently have two use cases for this little tidbit.</p>
<p>When you have available a default construct its use is quite simple and straight forward. This object allocates the class with the default constructor when it is first called directly through any of the accessor <strong>operators</strong>, or directly with the <strong>get</strong> method. In this particular example when loaded it correctly returns the unique identifier.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;"><span style="color: #0000ff;">class</span> Unique
<span style="color: #008000;">&#123;</span>
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
    Unique<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> 
        <span style="color: #008080;">:</span> m_uuid<span style="color: #008000;">&#40;</span>boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">random_generator</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">const</span> boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">uuid</span><span style="color: #000040;">&amp;</span> uuid<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">return</span> m_uuid<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">private</span><span style="color: #008080;">:</span>
    boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">uuid</span> m_uuid<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> argv<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    thunk<span style="color: #008080;">::</span><span style="color: #007788;">lazy_loader</span><span style="color: #000080;">&lt;</span>Unique<span style="color: #000080;">&gt;</span> loader<span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000ff;">const</span> boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">uuid</span><span style="color: #000040;">&amp;</span> u <span style="color: #000080;">=</span> loader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>uuid<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;uuid: &quot;</span><span style="color: #000080;">&lt;&lt;</span>boost<span style="color: #008080;">::</span><span style="color: #007788;">lexical_cast</span><span style="color: #000080;">&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">string</span><span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span>u<span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>    
&nbsp;
    <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

</p>
<p>The second example uses a boost function structure as a factory method, and it is executed instead of the default constructor. The factory method takes a reference to a boost shared pointer and correctly calls the constructor with any obligatory parameters. The boost shared pointer is owned by the lazy loader implementation and is used to maintain a reference counted state.</p>

<div class="wp_syntax"><div class="code"><pre class="cpp" style="font-family:monospace;">&nbsp;
<span style="color: #0000ff;">class</span> Unique
<span style="color: #008000;">&#123;</span>
<span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
    Unique<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> 
        <span style="color: #008080;">:</span> m_uuid<span style="color: #008000;">&#40;</span>boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">random_generator</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    Unique<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">const</span> boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">uuid</span><span style="color: #000040;">&amp;</span> u<span style="color: #008000;">&#41;</span>
        <span style="color: #008080;">:</span> m_uuid<span style="color: #008000;">&#40;</span>u<span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
    <span style="color: #008000;">&#125;</span>
&nbsp;
    <span style="color: #0000ff;">const</span> boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">uuid</span><span style="color: #000040;">&amp;</span> uuid<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
    <span style="color: #008000;">&#123;</span>
        <span style="color: #0000ff;">return</span> m_uuid<span style="color: #008080;">;</span>
    <span style="color: #008000;">&#125;</span>
<span style="color: #0000ff;">private</span><span style="color: #008080;">:</span>
    boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">uuid</span> m_uuid<span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span><span style="color: #008080;">;</span>
&nbsp;
<span style="color: #0000ff;">static</span> <span style="color: #0000ff;">void</span> factory<span style="color: #008000;">&#40;</span>boost<span style="color: #008080;">::</span><span style="color: #007788;">shared_ptr</span><span style="color: #000080;">&lt;</span>Unique<span style="color: #000080;">&gt;</span><span style="color: #000040;">&amp;</span> impl<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    impl <span style="color: #000080;">=</span> boost<span style="color: #008080;">::</span><span style="color: #007788;">shared_ptr</span><span style="color: #000080;">&lt;</span>Unique<span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span>
        <span style="color: #0000dd;">new</span> Unique<span style="color: #008000;">&#40;</span>boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">nil_uuid</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008000;">&#41;</span> <span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #0000ff;">int</span> argc, <span style="color: #0000ff;">char</span><span style="color: #000040;">*</span> argv<span style="color: #008000;">&#91;</span><span style="color: #008000;">&#93;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    thunk<span style="color: #008080;">::</span><span style="color: #007788;">lazy_loader</span><span style="color: #000080;">&lt;</span>Unique<span style="color: #000080;">&gt;</span> loader<span style="color: #008000;">&#40;</span><span style="color: #000040;">&amp;</span>factory<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    <span style="color: #0000ff;">const</span> boost<span style="color: #008080;">::</span><span style="color: #007788;">uuids</span><span style="color: #008080;">::</span><span style="color: #007788;">uuid</span><span style="color: #000040;">&amp;</span> u <span style="color: #000080;">=</span> loader<span style="color: #000040;">-</span><span style="color: #000080;">&gt;</span>uuid<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span>
&nbsp;
    std<span style="color: #008080;">::</span><span style="color: #0000dd;">cout</span><span style="color: #000080;">&lt;&lt;</span><span style="color: #FF0000;">&quot;uuid: &quot;</span><span style="color: #000080;">&lt;&lt;</span>boost<span style="color: #008080;">::</span><span style="color: #007788;">lexical_cast</span><span style="color: #000080;">&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">string</span><span style="color: #000080;">&gt;</span><span style="color: #008000;">&#40;</span>u<span style="color: #008000;">&#41;</span><span style="color: #000080;">&lt;&lt;</span>std<span style="color: #008080;">::</span><span style="color: #007788;">endl</span><span style="color: #008080;">;</span>    
&nbsp;
    <span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span><span style="color: #008080;">;</span>
<span style="color: #008000;">&#125;</span></pre></div></div>

</p>
<p>I am still working on a better method for initializing with a <i>n-argument</i> constructor. I have made my current progress available on my <a href="http://github.com/THUNKbrightly/lazy_loader">Github.com repository</a> available for use with the standard three-clause BSD license. If you have any questions or bugfixes please feel free to submit them through <a href="http://github.com/">Github</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://thoughtlessbanter.com/2010/08/22/c-generic-lazy-loader-implementation/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://thoughtlessbanter.com/2010/08/22/c-generic-lazy-loader-implementation/</feedburner:origLink></item>
		<item>
		<title>Digg 4 Alpha</title>
		<link>http://feedproxy.google.com/~r/thoughtlessbanter-com/~3/OVps2rb6sbk/</link>
		<comments>http://thoughtlessbanter.com/2010/07/02/digg-4-alpha/#comments</comments>
		<pubDate>Fri, 02 Jul 2010 18:00:40 +0000</pubDate>
		<dc:creator>jb</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Digg 4]]></category>

		<guid isPermaLink="false">http://thoughtlessbanter.com/?p=647</guid>
		<description><![CDATA[The guys over at Digg have been gracious enough to invite me as one of the first people to use the new Digg 4 alpha. Let me say, the design and speed of the new Digg is simply amazing. It really shows how awesome a Cassandra backend can be. I&#8217;m glad to be choosing a [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/7J19PoUmee0aieMoR04PJ8zrM_k/0/da"><img src="http://feedads.g.doubleclick.net/~a/7J19PoUmee0aieMoR04PJ8zrM_k/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/7J19PoUmee0aieMoR04PJ8zrM_k/1/da"><img src="http://feedads.g.doubleclick.net/~a/7J19PoUmee0aieMoR04PJ8zrM_k/1/di" border="0" ismap="true"></img></a></p><p><a href="http://thoughtlessbanter.com/wp-content/uploads/2010/07/Screen-shot-2010-07-02-at-2.01.07-PM.png"><img src="http://thoughtlessbanter.com/wp-content/uploads/2010/07/Screen-shot-2010-07-02-at-2.01.07-PM.png" alt="" title="Screen shot 2010-07-02 at 2.01.07 PM" width="204" height="145" class="alignleft size-full wp-image-650" /></a>The <a href="http://digg.com">guys over at Digg</a> have been gracious enough to invite me as one of the first people to use the new <a href="http://new.digg.com">Digg 4 alpha</a>. Let me say, the design and speed of the new Digg is simply amazing. It really shows how awesome a Cassandra backend can be. I&#8217;m glad to be choosing a NoSQL option for <a href="http://typealoud.com">my upcoming project</a>. </p>
<p>Also, in order to add this feed I need to post this bad boy up &#8211; db998ce11c694408adff259cf458c5c4 &#8211; have a good holiday!</p>
]]></content:encoded>
			<wfw:commentRss>http://thoughtlessbanter.com/2010/07/02/digg-4-alpha/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://thoughtlessbanter.com/2010/07/02/digg-4-alpha/</feedburner:origLink></item>
		<item>
		<title>Getting A Job As A Programmer</title>
		<link>http://feedproxy.google.com/~r/thoughtlessbanter-com/~3/SGMotyIgT90/</link>
		<comments>http://thoughtlessbanter.com/2010/06/19/getting-a-job-as-a-programmer/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 13:13:34 +0000</pubDate>
		<dc:creator>jb</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Blog]]></category>

		<guid isPermaLink="false">http://thoughtlessbanter.com/?p=642</guid>
		<description><![CDATA[My buddy, and fellow NJIT graduate, noble prize laureat, open source developer, Kenny Katzgrau wrote up a great post on How To Get A Job As A Programmer. Anyone that may be interested in computer science as a major in college (or if you are already sitting in classes) that thinks they want to be [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/8OMqsKee55qo6Q8Rw1_ndH3xwSo/0/da"><img src="http://feedads.g.doubleclick.net/~a/8OMqsKee55qo6Q8Rw1_ndH3xwSo/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/8OMqsKee55qo6Q8Rw1_ndH3xwSo/1/da"><img src="http://feedads.g.doubleclick.net/~a/8OMqsKee55qo6Q8Rw1_ndH3xwSo/1/di" border="0" ismap="true"></img></a></p><p>My buddy, and fellow <a href="http://njit.edu">NJIT graduate</a>, noble prize laureat, open source developer, <a href="http://twitter.com/_kennyk_">Kenny Katzgrau</a> wrote up <a href="http://codefury.net/2010/06/how-to-get-a-job-as-a-programmer/">a great post on <em>How To Get A Job As A Programmer</em></a>. </p>
<p>Anyone that may be interested in computer science as a major in college (or if you are already sitting in classes) that thinks they want to be a programmer may want to go read his little tidbit. If you&#8217;re in college to become a programmer I am personally of the opinion that you&#8217;ve already missed your calling. Switch majors immediately. You should love this craft before you decide to make it a career. </p>
]]></content:encoded>
			<wfw:commentRss>http://thoughtlessbanter.com/2010/06/19/getting-a-job-as-a-programmer/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://thoughtlessbanter.com/2010/06/19/getting-a-job-as-a-programmer/</feedburner:origLink></item>
		<item>
		<title>Bouncing A Database With Rails</title>
		<link>http://feedproxy.google.com/~r/thoughtlessbanter-com/~3/hDqWKa-BE6U/</link>
		<comments>http://thoughtlessbanter.com/2010/06/19/bouncing-a-database-with-rails/#comments</comments>
		<pubDate>Sat, 19 Jun 2010 12:54:31 +0000</pubDate>
		<dc:creator>jb</dc:creator>
				<category><![CDATA[Programming]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://thoughtlessbanter.com/?p=636</guid>
		<description><![CDATA[After work each night for the past couple of months I have been getting my hands dirty with Ruby/Rails development. I can imagine that most developers out there grow to love rake, but for the life of me I literally hate executing a series of commands on a regular basis. The programmer in me loves [...]]]></description>
			<content:encoded><![CDATA[
<p><a href="http://feedads.g.doubleclick.net/~a/QEDOOVyDs7O0wR4xtYr28WEWqdE/0/da"><img src="http://feedads.g.doubleclick.net/~a/QEDOOVyDs7O0wR4xtYr28WEWqdE/0/di" border="0" ismap="true"></img></a><br/>
<a href="http://feedads.g.doubleclick.net/~a/QEDOOVyDs7O0wR4xtYr28WEWqdE/1/da"><img src="http://feedads.g.doubleclick.net/~a/QEDOOVyDs7O0wR4xtYr28WEWqdE/1/di" border="0" ismap="true"></img></a></p><p>After work each night for the past couple of months I have been getting my hands dirty with Ruby/Rails development. I can imagine that most developers out there grow to love rake, but for the life of me I literally hate executing a series of commands on a regular basis. The programmer in me loves automation, and while in development I find myself dropping, re-creating and migrating the database constantly. Why should I have to issue <em>three</em> commands?</p>
<pre language="bash">rake db:drop
rake db:create
rake db:migrate
</pre>
<p>After a little bit of searching I found that this can be accomplished in two commands.</p>
<pre language="bash">rake db:reset
rake db:migrate
</pre>
<p>Welp, that&#8217;s not enough for me because I am just that damn lazy. So, a simple rake task to bounce a database.</p>
<pre language="ruby">namespace :db do
  desc "Drop, create and migrate the current database"
  task :bounce => :environment do
    Rake::Task['db:reset'].invoke
    Rake::Task['db:migrate'].invoke
  end
end
</pre>
<p>I hope you enjoy it as much as I do.</p>
<pre>rake db:bounce</pre>
]]></content:encoded>
			<wfw:commentRss>http://thoughtlessbanter.com/2010/06/19/bouncing-a-database-with-rails/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<feedburner:origLink>http://thoughtlessbanter.com/2010/06/19/bouncing-a-database-with-rails/</feedburner:origLink></item>
	</channel>
</rss><!-- Dynamic page generated in 0.364 seconds. --><!-- Cached page generated by WP-Super-Cache on 2010-08-26 23:31:46 -->
