<?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>MacAdie Web Blog</title>
	<atom:link href="http://www.MacAdie.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.MacAdie.net</link>
	<description>Notes on Ruby and Java: Until The Moon Turns Red and The Screens Turn Blue</description>
	<lastBuildDate>Thu, 17 May 2012 20:38:48 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Twitter Weekly Updates for 2012-05-13</title>
		<link>http://www.MacAdie.net/2012/05/13/twitter-weekly-updates-for-2012-05-13/</link>
		<comments>http://www.MacAdie.net/2012/05/13/twitter-weekly-updates-for-2012-05-13/#comments</comments>
		<pubDate>Sun, 13 May 2012 21:40:00 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[Tweets]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/2012/05/13/twitter-weekly-updates-for-2012-05-13/</guid>
		<description><![CDATA[Want to learn more about me? Check out http://t.co/cP3dSJKU and sign up for your own at http://t.co/jdsytvcu # More notes on #Java #Concurrency &#8211; lectures by @venkat_s at @nofluff http://t.co/OwKGwXnR # Several weeks late, here are @CodeAcademy week 8 notes: http://t.co/G9ZxXvr6 #Ruby #Rails # @puredanger Thanks for the follow # @cardoni I wish my life [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F13%2Ftwitter-weekly-updates-for-2012-05-13%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F13%2Ftwitter-weekly-updates-for-2012-05-13%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<ul class="aktt_tweet_digest">
<li>Want to learn more about me? Check out <a href="http://t.co/cP3dSJKU" rel="nofollow">http://t.co/cP3dSJKU</a> and sign up for your own at <a href="http://t.co/jdsytvcu" rel="nofollow">http://t.co/jdsytvcu</a>  <a href="http://twitter.com/EMacAdie/statuses/200448987839463425" class="aktt_tweet_time">#</a></li>
<li>More notes on #<a href="http://search.twitter.com/search?q=%23Java" class="aktt_hashtag">Java</a> #Concurrency &#8211; lectures by @<a href="http://twitter.com/venkat_s" class="aktt_username">venkat_s</a> at @<a href="http://twitter.com/nofluff" class="aktt_username">nofluff</a> <a href="http://t.co/OwKGwXnR" rel="nofollow">http://t.co/OwKGwXnR</a>  <a href="http://twitter.com/EMacAdie/statuses/200594659968421888" class="aktt_tweet_time">#</a></li>
<li>Several weeks late, here are @<a href="http://twitter.com/CodeAcademy" class="aktt_username">CodeAcademy</a> week 8 notes: <a href="http://t.co/G9ZxXvr6" rel="nofollow">http://t.co/G9ZxXvr6</a> #<a href="http://search.twitter.com/search?q=%23Ruby" class="aktt_hashtag">Ruby</a> #Rails  <a href="http://twitter.com/EMacAdie/statuses/200594917586767873" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/puredanger" class="aktt_username">puredanger</a> Thanks for the follow  <a href="http://twitter.com/EMacAdie/statuses/200596453469597696" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/cardoni" class="aktt_username">cardoni</a> I wish my life was more like yours  <a href="http://twitter.com/EMacAdie/statuses/200666576217849856" class="aktt_tweet_time">#</a></li>
<li>I am using the great pry gem (<a href="https://t.co/1LhNoK8v" rel="nofollow">https://t.co/1LhNoK8v</a>) that I found out about at last night&#039;s @<a href="http://twitter.com/ChicagoRuby" class="aktt_username">ChicagoRuby</a> hack night  <a href="http://twitter.com/EMacAdie/statuses/200666721491763201" class="aktt_tweet_time">#</a></li>
<li>Great page on #<a href="http://search.twitter.com/search?q=%23Ruby" class="aktt_hashtag">Ruby</a> loops and iterators <a href="http://t.co/C0U4QaYY" rel="nofollow">http://t.co/C0U4QaYY</a>  <a href="http://twitter.com/EMacAdie/statuses/200667106981838850" class="aktt_tweet_time">#</a></li>
</ul>
<p class="aktt_credit">Powered by <a href="http://alexking.org/projects/wordpress">Twitter Tools</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/05/13/twitter-weekly-updates-for-2012-05-13/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Notes From No Fluff Just Stuff November 2011</title>
		<link>http://www.MacAdie.net/2012/05/10/notes-from-no-fluff-just-stuff-november-2011/</link>
		<comments>http://www.MacAdie.net/2012/05/10/notes-from-no-fluff-just-stuff-november-2011/#comments</comments>
		<pubDate>Thu, 10 May 2012 14:29:19 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[Concurrency]]></category>
		<category><![CDATA[Java]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/?p=1013</guid>
		<description><![CDATA[I attended the No Fluff Just Stuff conference here in Chicago back in November 2011. I took  a few notes on some of the lectures. Here are my notes on some of the lectures on concurrency. I may post in a while with notes from more lectures, as well as some more thoughts on concurrency. [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F10%2Fnotes-from-no-fluff-just-stuff-november-2011%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F10%2Fnotes-from-no-fluff-just-stuff-november-2011%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I attended the <a title="http://nofluffjuststuff.com/home/main" href="http://nofluffjuststuff.com/home/main" target="_blank">No Fluff Just Stuff</a> conference here in Chicago back in November 2011. I took  a few notes on some of the lectures. Here are my notes on some of the lectures on concurrency. I may post in a while with notes from more lectures, as well as some more thoughts on concurrency.</p>
<p>Venkat: concuurrency without pain in pure Java<br />
Why Concurrency?<br />
Java gave us a consistent API for multi-threading<br />
Errors are worse on multi-core machines &#8211; multiple levels of cache in application<br />
To get concurrency correct, you have to be God.<br />
That model is the synchronize and suffer model<br />
2 other models: Software Transaction Memory and Actors</p>
<pre class="brush: java; gutter: true">public class Account {
    private int balance;
    public Account
}</pre>
<p>Synchronized helps you cross the memory barrier synchronizing main and working memory<br />
Locking and race condition is only part of the story<br />
Do not synchronize the accounts, synchronize the transactions<br />
You should also synchronize in the class using the Account classes</p>
<pre class="brush: java; gutter: true">synchronized(from) {
    synchronized(to) {
        // do stuff
    }
}</pre>
<p>There could be livelock or deadlock<br />
But you could wait a long time.<br />
But you cannot tell synchronized() to timeout.</p>
<p>So instead in Account, use a ReentrantLock<br />
in Account.deposit method, use ReentrantLock.tryLock(long, TimeUnit)</p>
<p>This makes code more complex. synchronized blocks are pretty easy.<br />
Don&#8217;t forget to call Reentrant.unlock()<br />
But what if there is an exception before that? Put it in a finally.<br />
This is why we don&#8217;t use raw JDBC</p>
<p>Deadlock: I have lock on A, I need a lock on B. You have a lock on B, you need a lock on A.<br />
You could impose an order<br />
If someone introduces a new method, all your locking could be ruined. It&#8217;s like a bathroom with a lot of doors. You got to lock every one.<br />
Concurrency on JDK is like a mother-in-law: It&#8217;s waiting for you to fail.<br />
95% of Java is broken for concurrency, and we don&#8217;t know it yet.</p>
<p>STM: Software Transaction Memory<br />
Everything is immutable (almost everything)<br />
Managed Mutable Identity is also in Clojure<br />
Sharing is good, mutability is good, shared mutability is bad<br />
Separates state from identity<br />
identity points to state<br />
Like stock price: $600 at 1:00 PM, $610 at 1:10<br />
The price at 1PM on November 11, 2011 will always be $600<br />
We can flip a switch to point identity to a new value<br />
Immutability means no locks</p>
<p>the problem is not that it is failing, but that it is misbehaving quietly and you do not know it.<br />
MMI fails loudly if you mess with it outside of a transaction<br />
transaction thread runs in a cone of silence<br />
final change is visible to outside world</p>
<p>If there is a collision, a transaction could repeat<br />
Clojure is written in Java &#8211; it&#8217;s another JAR, and you can use it in Java</p>
<p>change int in Account to clojure.lang.Ref</p>
<pre class="brush: java; gutter: true">private Ref balance
public Account(final int initialBalance) {
    balance = new Ref( initialBalance );
}</pre>
<p>int will be replaced with java.lang.Integer<br />
You can only put immutable stuff in there.<br />
Also</p>
<pre class="brush: java; gutter: true">public void deposit(final int amount) {
    LockingTransaction.runInTransaction( new Callable&lt; Void &gt;() {
        public Void call() throws Exception() {
        if (amount &gt; 0) { balance.set( getBalance() + amount ) }
        return null;
        }
    });
}
public int getBalance()   { return (Integer) balance.deref(); }</pre>
<p>Clojure:</p>
<pre class="brush: clojure; gutter: true">(def balance (ref 0))
(println @balance)
(dosynch (ref-set balance 1) )
(println @balance)</pre>
<p>You could still have race conditions. The AccountService that does the transfer still needs a transaction to wrap around the transactions in the Account classes<br />
A transaction in STM could repeat 100,000 times &#8211; so do not print, send email</p>
<p>STM: we don&#8217;t see any locks (so no deadlocks)<br />
2 drawbacks:<br />
1. STM requires state be immutable &#8211; greate for Clojure &#8211; the only language where concurrency is safe<br />
2. Code could ge slow or fail due to retries<br />
Hard to be functional in Java<br />
Another option: Isolated mutability &#8211; only one thread can touch it at a time<br />
Actors and active objects<br />
An actor can receive many messages at once, but they only work on one at a time<br />
Akka library &#8211; now we use Scala&#8217;s implementation<br />
Akka gives us STM and Actors</p>
<pre class="brush: java; gutter: true">ActorRef ratcliff = Actors.actorOf(HollywoodActor.class).start();
ratcliff.sendOneWay( &quot;Potter&quot; );
ratcliff.stop();

HollywoodActor extends UntypedActor() {
    public void onReceive( final Object message )
}</pre>
<p>So we passed a message. We did not call a method directly.<br />
Actors do not hold Threads hostage<br />
Actors could fail<br />
Each Actor is sequential<br />
Could deadlock with 2-way messaging</p>
<p>JDK concurrency APIs are assembly language of concurrency<br />
&#8212;<br />
But can Java web developers do this?</p>
<p>Ted Neward Guava:<br />
Get rid of mutable state</p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/05/10/notes-from-no-fluff-just-stuff-november-2011/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Thoughts On Rails Generators</title>
		<link>http://www.MacAdie.net/2012/05/08/thoughts-on-rails-generators/</link>
		<comments>http://www.MacAdie.net/2012/05/08/thoughts-on-rails-generators/#comments</comments>
		<pubDate>Tue, 08 May 2012 22:44:00 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/?p=1010</guid>
		<description><![CDATA[A few people I know tweeted to a Rails commit on Github that &#8220;Added a generator option to remove the public/index.html file when generating a new Rails application.&#8221; The people that tweeted about it said it was about time that this was included. I think a good option for the scaffold generator would be to [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F08%2Fthoughts-on-rails-generators%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F08%2Fthoughts-on-rails-generators%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>A few people I know tweeted to a Rails <a title="https://github.com/rails/rails/commit/5c1109a68e098188803a6232be55dfff1e5e12eb" href="https://github.com/rails/rails/commit/5c1109a68e098188803a6232be55dfff1e5e12eb" target="_blank">commit</a> on Github that &#8220;Added a generator option to remove the public/index.html file when generating a new Rails application.&#8221; The people that tweeted about it said it was about time that this was included.</p>
<p>I think a good option for the scaffold generator would be to explicitly list the routes for each of the created actions in the controller instead of just adding</p>
<pre class="brush: ruby; gutter: true">resources :things</pre>
<p>to the config/routes.rb  file.</p>
<p>It would generate this in the config/routes.rb file:</p>
<pre class="brush: ruby; gutter: true">  get &#039;/things&#039; =&gt; &#039;things#index&#039;, :as =&gt; &#039;things&#039;
  post &#039;/things&#039; =&gt; &#039;things#create&#039;
  get &#039;/things/new&#039; =&gt; &#039;things#new&#039;, :as =&gt; &#039;new_thing&#039;
  get &#039;/things/:id/edit&#039; =&gt; &#039;things#edit&#039;, :as =&gt; &#039;edit_thing&#039;
  get &#039;/things/:id&#039; =&gt; &#039;things#show&#039;, :as =&gt; &#039;thing&#039;
  put &#039;/things/:id&#039; =&gt; &#039;things#update&#039;
  delete &#039;/things/:id&#039; =&gt; &#039;things#destroy&#039;</pre>
<p>I ran rake routes with each, and they matched.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/05/08/thoughts-on-rails-generators/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code Academy Week 8 Notes</title>
		<link>http://www.MacAdie.net/2012/05/08/code-academy-week-8-notes/</link>
		<comments>http://www.MacAdie.net/2012/05/08/code-academy-week-8-notes/#comments</comments>
		<pubDate>Tue, 08 May 2012 22:22:55 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[CA Notes]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/?p=947</guid>
		<description><![CDATA[2012-02-28_08.18.14 undefined method `model name` for NilClass:Class Means there is a problem with the model So instantiate it in the controller from the session How to override application.html.erb for a controller or action For orders controller, app/views/layouts/order.html.erb To specify layout: in controller: layout &#039;application&#039;, nly =&#62; :index or in def new: def new    @cart [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F08%2Fcode-academy-week-8-notes%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F08%2Fcode-academy-week-8-notes%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>2012-02-28_08.18.14<br />
undefined method `model name` for NilClass:Class<br />
Means there is a problem with the model<br />
So instantiate it in the controller from the session</p>
<p>How to override application.html.erb for a controller or action</p>
<p>For orders controller, app/views/layouts/order.html.erb<br />
To specify layout:<br />
in controller:</p>
<pre class="brush: ruby; gutter: true">layout &#039;application&#039;, <img src='http://www.MacAdie.net/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly =&gt; :index</pre>
<p>or in def new:</p>
<pre class="brush: ruby; gutter: true">def new
   @cart = Cart.find(session[:cart_id])
   @order = Order.new
   render :layout =&gt; &#039;orders&#039;
 end</pre>
<p>we need to encrypt the credit card number. Look in config/application.rb<br />
We will look at<br />
config.filter_parameters +=[:password]<br />
This will filter password out of the log<br />
So we can add to the array<br />
config.filter_parameters +=[:password, :card_number]</p>
<p>asset pipeline: We will talk about it throughout the week. Look in the assets folder. Images, javascript and stylesheets.<br />
It takes all the javascript and puts it in one file, so the browser only has to make one request<br />
Same for css<br />
For css, you should go to application.css and specify files and/or directories</p>
<pre class="brush: css; gutter: true">*= require_self
 *= require_tree</pre>
<p>require_tree will do everything aplhabetically. You can put them in your own order.</p>
<pre class="brush: scss; gutter: true">*= require brands
 *= require products
 *= require reviews
 *= require scaffolds
 *= require users</pre>
<p>In development mode, there is no asset pipeline. You use it in production.</p>
<p>In config/environments/development.rb</p>
<pre class="brush: ruby; gutter: true">config.assets.debug=false</pre>
<p>if you set that to false, you won&#8217;t see the GET requests in the logs for EVERY js and css file</p>
<p>Jeff can get to other order pages as well as his own<br />
We have authentication. What about authorization?<br />
In orders controller:</p>
<pre class="brush: ruby; gutter: true">def show
   @order = @user.orders.find(params[:id])
 end</pre>
<p>WHat if that ID is not in the order table?</p>
<pre class="brush: ruby; gutter: true">def show
   @order = @user.orders.find(params[:id])
   if order.nil?
     redirect_to root_url, :notice =&gt; &quot;Nice try&quot;
   end
 end</pre>
<p>You could do this:</p>
<pre class="brush: ruby; gutter: true">redirect_to root_url, :notice =&gt; &quot;Nice try&quot; if order.nil?</pre>
<p>But then it looks like redirect is the default.<br />
Or</p>
<pre class="brush: ruby; gutter: true">redirect_to root_url, :notice =&gt; &quot;Nice try&quot; unless order</pre>
<p>Moving this to a one-liner could make it a but confusing<br />
You could also do</p>
<pre class="brush: ruby; gutter: true">if order.blank?
   redirect_to root_url, :notice =&gt; &quot;Nice try&quot;
 end</pre>
<p>or</p>
<pre class="brush: ruby; gutter: true">unless @order
   redirect_to root_url, :notice =&gt; &quot;Nice try&quot;
 end</pre>
<p>Stay at same level of abstraction throughout the html.erb files<br />
if you have render tags with low-level html, that could look bad</p>
<p>Class method that makes an ActiveRecord call<br />
Use the scope facility<br />
Instead of:</p>
<pre class="brush: ruby; gutter: true">def self.most_recent
   order(&quot;updated_at desc&quot;).limit(3)
 end</pre>
<p>&nbsp;</p>
<pre class="brush: ruby; gutter: true">scope :most_recent, order(&quot;updated_at desc&quot;).limit(3)</pre>
<p>scope creates a class-level method, and returns rows<br />
You cannot just return one row</p>
<p>Maybe we want to pass a param from the view to the class-level method or scope</p>
<p>Easy for method.<br />
For a scope:</p>
<pre class="brush: ruby; gutter: true">create a lambda: create an unnamed method on-the-fly
 scope :most_recent, lambda { |n| order(&quot;updated at desc&quot;).limit(n) }</pre>
<p>Orders Controller:<br />
We have a before_filter<br />
We have model callbacks in cart_item.rb<br />
Those are sort of like lambdas as well.<br />
We do not call it, Rails calls it for us at some point.</p>
<p>Let&#8217;s do a scope on price for products:</p>
<pre class="brush: ruby; gutter: true">scope :expensive, where(&#039;price &gt; 50&#039;)</pre>
<p>Then in the view you could chain the scopes</p>
<p>Lambda with a default value for min:</p>
<pre class="brush: ruby; gutter: true">scope :expensive, lambda { |min=80| where(&#039;price &gt; #{min}&#039;) }</pre>
<p>Getting the data you want:</p>
<pre class="brush: ruby; gutter: true">.find
 .find_by_*
 .where(hash)
 .where(&quot;SQL&quot;)
 .where(&quot;SQL&quot;, ....)
.where(&quot;color = BLUE&#039;&#039;&quot;) # sql syntax - single = sign is comparison
 .where(&quot;color like &#039;BLUE&#039;&quot;)</pre>
<p>You can also use % for wildcards</p>
<pre class="brush: ruby; gutter: true">.where(&quot;name like &#039;M%&#039;&quot;)
 .where(&quot;name like ?&quot;, &quot;M%&quot;)</pre>
<p>In Products Controller:</p>
<pre class="brush: ruby; gutter: true">@products = Product.where(&quot;name like &#039;#{params[:search]}&#039;&quot;)</pre>
<p>or</p>
<pre class="brush: ruby; gutter: true">@products = Product.where(&quot;name like &#039;#{params[:search]}%&#039;&quot;)</pre>
<p>So why not do this? Jeff will explain<br />
You could get SQL injection<br />
So do this:</p>
<pre class="brush: ruby; gutter: true">a = params[:search]
 @products = Product.where(&quot;name like &#039;%#a%&#039;&quot;)</pre>
<p>Use the question mark placeholder</p>
<pre class="brush: ruby; gutter: true">@products = Product.where(&quot;name like ?&quot;, params[:search])</pre>
<p>ActiveRecord will create the SQL for you<br />
Fuzzy search:</p>
<pre class="brush: ruby; gutter: true">@products = Product.where(&quot;name like ?&quot;, &quot;%#{params[:search]}%&quot;)</pre>
<p>Then in the controller you could chain the methods</p>
<pre class="brush: ruby; gutter: true">@products = @products.limit(1000).order(&#039;name asc&#039;)</pre>
<p>It is not until you get to the @products.each (or a .all) in the view that you run the query</p>
<p>Should you use the products controller for searching, or make a search controller?<br />
the form_tag goes to &#8216;/products&#8217; with a get, which will go to the index action<br />
&#8212;-<br />
New app:<br />
User Story Analysis<br />
1. Identify resources<br />
2. Create Models<br />
3. Implement business rules<br />
4. Create User Interface</p>
<p>Some people go in the opposite order</p>
<p>Air Academy User story<br />
1. As a visitor, list the flights</p>
<p>In Rails 3.2, when you generate model, if you do not specify the types it will assume that it is a string<br />
rails g model Airport code:string city:string<br />
ericm@finance:~/ruby/ca_files/air$ more db/migrate/20120228174012_create_airports.rb</p>
<pre class="brush: ruby; gutter: true">class CreateAirports &lt; ActiveRecord::Migration
  def change
    create_table :airports do |t|
      t.string :code
      t.string :city

      t.timestamps
    end
    add_index :airports, :code
  end
end</pre>
<pre class="brush: ruby; gutter: true">rails g model Airport code:string city:string</pre>
<p>emacsnw db/migrate/20120228174012_create_airports.rb</p>
<p>For flights, we need two airports, not just one departure_airport_id, arrival_airport_id</p>
<pre class="brush: ruby; gutter: true">class Flight
  belongs_to :departure_airport, :class_name =&gt; &#039;Airport&#039;
  belongs_to :arrivale_airport, :class_name =&gt; &#039;Airport&#039;
end</pre>
<p>If you say belongs_to :blah, the table needs a column blah_id<br />
If that is the only belongs_to, Rails will assume there is a Blah model</p>
<pre class="brush: bash; gutter: true">rails g model Flight departure_airport_id:integer, arrival_airport_id:integer number:string distance:integer duration:integer departs_at:time</pre>
<p>2012-03-01_08.38.49<br />
Pagination:<br />
Kaminari, Will_paginate, roll your own</p>
<p>User story: As a user, I want to make a reservation<br />
As opposed to doing something &#8220;as a visitor&#8221;<br />
Different permissions, etc<br />
So for &#8220;As a user&#8221; that user story needs an account<br />
User story analysis<br />
1. Identify resources<br />
2. Create models<br />
3. Implement business rules<br />
4. Create user interface</p>
<p>reservation model has user, a flight, chosen departure date, credit card number<br />
Associations:<br />
user can have many reservations<br />
flight has many reservations<br />
reservation belongs to flight and belongs to user</p>
<pre class="brush: bash; gutter: true">rails g scaffold Reservation user_id:integer flight_id:integer credit_card_number:string departs_on:date</pre>
<p>departs_on for dates, departs_at for times</p>
<p>How to decide to model or scaffold? How much of scaffold will you use?</p>
<p>add_index on the reservation table<br />
add_index is outside the create_table block</p>
<pre class="brush: ruby; gutter: true">add_index :reservations, :user_id
 add_index :reservations, :flight_id</pre>
<p>Good to have indexes for foreign keys<br />
Then run</p>
<pre class="brush: bash; gutter: true">rake db:migrate</pre>
<p>rake db:migrate:reset will drop database and recreate tables<br />
rake db:seed<br />
You could do</p>
<pre class="brush: bash; gutter: true">rake db:migrate:reset db:seed</pre>
<pre class="brush: bash; gutter: true">rails g model User first last email passwod_digest</pre>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Now JC from DevMynd is talking<br />
database: structured set of data on a computer, accessible in various ways<br />
five categories: relational, graph, key-value, document, column family databases<br />
Relational database: built around relational theory (first-order predicate calculus), schema defined in tables of columns and rows, data is related through matching keys<br />
Graph: based on graph theory. These DBs use nodes, properties and edges to describe a &#8220;web&#8221; of data. They can be powerful for complex ancestral queries (Amazon: People who bought X bought Y)<br />
Key-value: primary way of retrieving objects is by a single key. What can be stored as a value varies.<br />
Redis is used for queing systems<br />
Document database: storing document-oriented, semi-structured data. Normally within a loose schema and the ability to store/retrieve nested structures<br />
Column-family database: inverse of relational model. Big table.<br />
Choosing data store can be pretty complex.<br />
Considerations: indexing, querying, scaling, modeling, mapping, analyzing, recovering<br />
Indexes: a parallel description of your data optimized for fast lookup<br />
If you will ever do an order_by or a conditional query<br />
Finding by department and last name is different than index that finds by last name and first name<br />
Querying: getting info from db. Do we use a template object, a query language, or a string key?<br />
Mongo can use query syntax, or you can pass in a template doc<br />
scaling: scale up (faster, bigger hardware) or out (distributing data, indices and queries across more machines, aggregating the results)<br />
mongo can shard well, so can redis<br />
modeling: is your schema fixed or flexible? a few large things, lots of small things<br />
Mapping (ORM) &#8211; ActiveRecord for RDBMS, Mongoid for MongoDB, Redis ruby driver<br />
how will you interact with db?<br />
analysis: what does the database provide?<br />
recovery: relational: replication, push log to another system<br />
Mongo: backup and restore tools<br />
Heroku, other cloud backups are not that great</p>
<p>optimization: this is usually the first bottleneck<br />
universal: careful indexing, duplication<br />
relational: de-normalization, pivoting, materlialized views<br />
normalized: each concept in a different table, less repetition<br />
pivot: making rows into columns, and vice versa<br />
materialized views:<br />
non-relational: nest relationships, parallel queries<br />
downside of indexing: it can take a LOT of space, plus index might be held in memory instead of disk<br />
Put query logic in your model, not your controller<br />
So if you change the datastore, you can just change it in the model class<br />
relational tables good for complex joins<br />
Think carefully about uniqueness and nullability early on</p>
<p>&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Back to Jeff<br />
For flight page, give some info about flight<br />
the user is part of the session<br />
reservation for<br />
So in reservation controller, in new method: @user = User.find(session[:user_id])<br />
You could do it from show page for a flight<br />
@user = User.find()<br />
Get stuff from flight show page<br />
Reuse the flight_details partial</p>
<p>But we could get a Nil<br />
So in the reservations controller<br />
We will do something in def new<br />
We could have a link from flight show page<br />
@flight.id) %&gt;<br />
So in new,</p>
<pre class="brush: ruby; gutter: true">@flight = Flight.find(params[:flight_id])</pre>
<p>So we want to put that link in an if on the flight show page<br />
Put a filter on the reservations new controller</p>
<pre class="brush: ruby; gutter: true">before_filter :require_login, <img src='http://www.MacAdie.net/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> nly =&gt; :new
   def require_login
   if session[:user_id].blank?
     redirect_to root_url, notice: &quot;Get your act together&quot;
   end
 end</pre>
<p>@flight.id) %&gt;</p>
<p>In reservation form:</p>
<p>in reservation controller.new:</p>
<pre class="brush: ruby; gutter: true">@reservation.flight = @flight</pre>
<p>validation on reservations:</p>
<p>create method in reservationcontroller:</p>
<pre class="brush: ruby; gutter: true">def create
   @reservation = Reservation.new()
   @reservation.user = User.find(session[:user_id])
 end</pre>
<p>Sending email in Rails &#8211; it could depend on your host</p>
<pre class="brush: bash; gutter: true">rails g mailer ReservationMailer
 rails g mailer ReservationMailer</pre>
<p>In our reservation controller, we will use this in respond_to block</p>
<pre class="brush: ruby; gutter: true">email = ReservationMailer.confirmation(@reservation)
 email.deliver</pre>
<p>in ReservationMailer</p>
<pre class="brush: ruby; gutter: true">def confirmation(reservation)
   @reservation = reservation
   mail(:subject =&gt; &quot;Thanks for your reservation&quot;,
   :from =&gt; &quot;reservations@academyair.com&quot;,
   :to =&gt; reservation.user.email )
 end</pre>
<p>So in app/views/reservation_mailer/confirmation.text.erb<br />
Hello, ,<br />
Thanks for sending us $300.</p>
<p>Flight details<br />
&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;<br />
Flight number:</p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/05/08/code-academy-week-8-notes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates for 2012-05-06</title>
		<link>http://www.MacAdie.net/2012/05/06/twitter-weekly-updates-for-2012-05-06/</link>
		<comments>http://www.MacAdie.net/2012/05/06/twitter-weekly-updates-for-2012-05-06/#comments</comments>
		<pubDate>Sun, 06 May 2012 21:40:00 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[Tweets]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/2012/05/06/twitter-weekly-updates-for-2012-05-06/</guid>
		<description><![CDATA[@tomordonez I will probably post about it later in the week &#8211; I would say things are looking good for Rails # @devmyndsoftware Thanks for the follow # @rails_apps Thanks for the follow # @karmajunkie Thanks for the follow # Just once I would like to boot up my Win7 laptop and NOT be asked [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F06%2Ftwitter-weekly-updates-for-2012-05-06%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F05%2F06%2Ftwitter-weekly-updates-for-2012-05-06%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<ul class="aktt_tweet_digest">
<li> @<a href="http://twitter.com/tomordonez" class="aktt_username">tomordonez</a> I will probably post about it later in the week &#8211; I would say things are looking good for Rails  <a href="http://twitter.com/EMacAdie/statuses/197072132667211776" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/devmyndsoftware" class="aktt_username">devmyndsoftware</a> Thanks for the follow  <a href="http://twitter.com/EMacAdie/statuses/197072269405716481" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/rails_apps" class="aktt_username">rails_apps</a> Thanks for the follow  <a href="http://twitter.com/EMacAdie/statuses/197072324585996290" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/karmajunkie" class="aktt_username">karmajunkie</a> Thanks for the follow  <a href="http://twitter.com/EMacAdie/statuses/197072374716317696" class="aktt_tweet_time">#</a></li>
<li>Just once I would like to boot up my Win7 laptop and NOT be asked to  install another Adobe update  <a href="http://twitter.com/EMacAdie/statuses/197120248653160449" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/ryanbriones" class="aktt_username">ryanbriones</a>  @<a href="http://twitter.com/TheTakeaway" class="aktt_username">TheTakeaway</a> is a daily news podcast with short segments &#8211; I like some of Bloomberg&#039;s stuff as well  <a href="http://twitter.com/EMacAdie/statuses/197122433034092544" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/cardoni" class="aktt_username">cardoni</a> @dhh It was a great keynote  <a href="http://twitter.com/EMacAdie/statuses/197122696771936257" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/CodeAcademy" class="aktt_username">CodeAcademy</a> I met @<a href="http://twitter.com/mhartl" class="aktt_username">mhartl</a> of @<a href="http://twitter.com/railstutorial" class="aktt_username">railstutorial</a> at #<a href="http://search.twitter.com/search?q=%23RailsConf" class="aktt_hashtag">RailsConf</a> <a href="http://t.co/9dt5NXBP" rel="nofollow">http://t.co/9dt5NXBP</a> I told him we all do his tutorial  <a href="http://twitter.com/EMacAdie/statuses/197123496147558400" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/ryanbriones" class="aktt_username">ryanbriones</a> I was thinking of @<a href="http://twitter.com/BloombergNews" class="aktt_username">BloombergNews</a> <a href="http://t.co/UuB1FmdP" rel="nofollow">http://t.co/UuB1FmdP</a>  Media company started by Mayor Mike before he became mayor of NYC  <a href="http://twitter.com/EMacAdie/statuses/197315825605156864" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/RailsConf" class="aktt_username">RailsConf</a> presentation by @<a href="http://twitter.com/JEG2" class="aktt_username">JEG2</a> now online: <a href="http://t.co/hIecbbTO" rel="nofollow">http://t.co/hIecbbTO</a>  <a href="http://twitter.com/EMacAdie/statuses/197797074216026112" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/rubygeekdotcom" class="aktt_username">rubygeekdotcom</a> Thanks for the tip  <a href="http://twitter.com/EMacAdie/statuses/197797414994845699" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/devmyndsoftware" class="aktt_username">devmyndsoftware</a> Thanks for the follow  <a href="http://twitter.com/EMacAdie/statuses/197797540253544448" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/damon" class="aktt_username">damon</a> Thanks for the follow &#8211; will you be at Lone Star Ruby Conf this year? I might go  <a href="http://twitter.com/EMacAdie/statuses/197798331441889280" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/rubygeekdotcom" class="aktt_username">rubygeekdotcom</a> Is there a Flash player alternative for Windows?  <a href="http://twitter.com/EMacAdie/statuses/197798718555160576" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/RailsConf" class="aktt_username">RailsConf</a> presentations: <a href="http://t.co/1eQk6Q6l" rel="nofollow">http://t.co/1eQk6Q6l</a>  <a href="http://twitter.com/EMacAdie/statuses/197799143127789569" class="aktt_tweet_time">#</a></li>
<li>Watch this link for the great @<a href="http://twitter.com/RailsConf" class="aktt_username">RailsConf</a> presentation by @<a href="http://twitter.com/karmajunkie" class="aktt_username">karmajunkie</a>: <a href="http://t.co/Tsj77iob" rel="nofollow">http://t.co/Tsj77iob</a>  <a href="http://twitter.com/EMacAdie/statuses/197800702054121472" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/rubygeekdotcom" class="aktt_username">rubygeekdotcom</a> Where are you moving to? Are you leaving Austin, or are you just moving further south in Austin?  <a href="http://twitter.com/EMacAdie/statuses/198144231473283072" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/RudyOnRails" class="aktt_username">RudyOnRails</a> Is that @<a href="http://twitter.com/briankung" class="aktt_username">briankung</a> backflipping?  <a href="http://twitter.com/EMacAdie/statuses/198145746036473857" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/briankung" class="aktt_username">briankung</a> The force is strong with you  <a href="http://twitter.com/EMacAdie/statuses/198260352809578497" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/cardoni" class="aktt_username">cardoni</a> Is your company using MySQL? it seems like PostGeSQL is gaining in the Ruby world  <a href="http://twitter.com/EMacAdie/statuses/198261156471783425" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/arvindang" class="aktt_username">arvindang</a> Not to be pedantic, but I must point out that if @<a href="http://twitter.com/briankung" class="aktt_username">briankung</a> were a ninja, there would be no picture.  <a href="http://twitter.com/EMacAdie/statuses/198266162310676482" class="aktt_tweet_time">#</a></li>
</ul>
<p class="aktt_credit">Powered by <a href="http://alexking.org/projects/wordpress">Twitter Tools</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/05/06/twitter-weekly-updates-for-2012-05-06/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates for 2012-04-29</title>
		<link>http://www.MacAdie.net/2012/04/29/twitter-weekly-updates-for-2012-04-29/</link>
		<comments>http://www.MacAdie.net/2012/04/29/twitter-weekly-updates-for-2012-04-29/#comments</comments>
		<pubDate>Sun, 29 Apr 2012 21:40:00 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[Tweets]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/2012/04/29/twitter-weekly-updates-for-2012-04-29/</guid>
		<description><![CDATA[I am in Austin for #RailsConf # @timtyrrell I am in town for #RailsConf &#8211; we should get together while it&#039;s on # @hashrocket @BohConf @RailsConf @joshuadavey Can anyone show up to BohConf? # @RayHightower Are you in Austin for #RailsConf # @redsquirrel @ryanbriones &#8211; I am in Austin for #RailsConf &#8211; how many Groupon [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F29%2Ftwitter-weekly-updates-for-2012-04-29%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F29%2Ftwitter-weekly-updates-for-2012-04-29%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<ul class="aktt_tweet_digest">
<li>I am in Austin for #<a href="http://search.twitter.com/search?q=%23RailsConf" class="aktt_hashtag">RailsConf</a>  <a href="http://twitter.com/EMacAdie/statuses/194215423217106944" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/timtyrrell" class="aktt_username">timtyrrell</a> I am in town for #<a href="http://search.twitter.com/search?q=%23RailsConf" class="aktt_hashtag">RailsConf</a> &#8211; we should get together while it&#039;s on  <a href="http://twitter.com/EMacAdie/statuses/194216950036037632" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/hashrocket" class="aktt_username">hashrocket</a> @BohConf @<a href="http://twitter.com/RailsConf" class="aktt_username">RailsConf</a> @joshuadavey Can anyone show up to BohConf?  <a href="http://twitter.com/EMacAdie/statuses/194217412239958016" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/RayHightower" class="aktt_username">RayHightower</a> Are you in Austin for #<a href="http://search.twitter.com/search?q=%23RailsConf" class="aktt_hashtag">RailsConf</a>   <a href="http://twitter.com/EMacAdie/statuses/194224230609600514" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/redsquirrel" class="aktt_username">redsquirrel</a> @ryanbriones &#8211; I am in Austin for #<a href="http://search.twitter.com/search?q=%23RailsConf" class="aktt_hashtag">RailsConf</a> &#8211; how many Groupon people are here?  <a href="http://twitter.com/EMacAdie/statuses/194252189957492736" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/cardoni" class="aktt_username">cardoni</a> congrats on the job at @<a href="http://twitter.com/RECSOLU" class="aktt_username">RECSOLU</a>  <a href="http://twitter.com/EMacAdie/statuses/194583749789360128" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/vcabansag" class="aktt_username">vcabansag</a>  Are you going to get your pic taken with BC?  <a href="http://twitter.com/EMacAdie/statuses/194587757513932801" class="aktt_tweet_time">#</a></li>
<li>Hanging with the @<a href="http://twitter.com/hashrocket" class="aktt_username">hashrocket</a> guys at #<a href="http://search.twitter.com/search?q=%23RailsConf" class="aktt_hashtag">RailsConf</a>  <a href="http://twitter.com/EMacAdie/statuses/194587902863351808" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/briankung" class="aktt_username">briankung</a> said &quot;@codeacademy students are all smarter than me!&quot; &#8211; Is that a growth-mindset statement, or a fixed-mindset statement?  <a href="http://twitter.com/EMacAdie/statuses/194592575972323328" class="aktt_tweet_time">#</a></li>
<li>The WiFi at #<a href="http://search.twitter.com/search?q=%23RailsConf" class="aktt_hashtag">RailsConf</a> is not the best network I have ever been on. I know there are a lot of people here, but still, it&#039;s a dev conf!  <a href="http://twitter.com/EMacAdie/statuses/194602972045508608" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/umtrey" class="aktt_username">umtrey</a> Why not ask them?  <a href="http://twitter.com/EMacAdie/statuses/194606576194162688" class="aktt_tweet_time">#</a></li>
<li>Working on @<a href="http://twitter.com/rails_apps" class="aktt_username">rails_apps</a> while at #<a href="http://search.twitter.com/search?q=%23RailsConf" class="aktt_hashtag">RailsConf</a> <a href="http://t.co/kYlvweHH" rel="nofollow">http://t.co/kYlvweHH</a> with mentions of @<a href="http://twitter.com/karmajunkie" class="aktt_username">karmajunkie</a> @JEG2 and @<a href="http://twitter.com/blowmage" class="aktt_username">blowmage</a>  <a href="http://twitter.com/EMacAdie/statuses/195004285442994179" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/timtyrrell" class="aktt_username">timtyrrell</a> I may join you &#8211; are you going to the EngineYard/CabForward drinkup tonight?  <a href="http://twitter.com/EMacAdie/statuses/195249928451276800" class="aktt_tweet_time">#</a></li>
<li>Thanks to @<a href="http://twitter.com/karmajunkie" class="aktt_username">karmajunkie</a> for getting me back into my laptop  <a href="http://twitter.com/EMacAdie/statuses/195250217640132608" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/JaretManuel" class="aktt_username">JaretManuel</a> Thanks for the link  <a href="http://twitter.com/EMacAdie/statuses/195251195835727873" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/vcabansag" class="aktt_username">vcabansag</a> I shook his hand back in 2007 &#8211; I saw Bill and Hillary in Iowa. I got a couple of pix but none of me with them  <a href="http://twitter.com/EMacAdie/statuses/195251617644281856" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/tomordonez" class="aktt_username">tomordonez</a> No stickers. I am too busy loading up on shirts. Maybe next year.  <a href="http://twitter.com/EMacAdie/statuses/195251793645674498" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/cardoni" class="aktt_username">cardoni</a> @tomordonez when/where was this taken?  <a href="http://twitter.com/EMacAdie/statuses/195361139180306433" class="aktt_tweet_time">#</a></li>
<li>Here I am with Hartl of @<a href="http://twitter.com/RailsTutorial" class="aktt_username">RailsTutorial</a> at @<a href="http://twitter.com/RailsConf" class="aktt_username">RailsConf</a> in #<a href="http://search.twitter.com/search?q=%23Austin" class="aktt_hashtag">Austin</a> <a href="http://t.co/9dt5NXBP" rel="nofollow">http://t.co/9dt5NXBP</a>  <a href="http://twitter.com/EMacAdie/statuses/195362245268602880" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/timtyrrell" class="aktt_username">timtyrrell</a> Maybe I would see you in August at Lone Star Ruby Conf  <a href="http://twitter.com/EMacAdie/statuses/195362322699657216" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/tomordonez" class="aktt_username">tomordonez</a> I told @<a href="http://twitter.com/mhartl" class="aktt_username">mhartl</a> that everyone at @<a href="http://twitter.com/CodeAcademy" class="aktt_username">CodeAcademy</a>  does @<a href="http://twitter.com/RailsTutorial" class="aktt_username">RailsTutorial</a> &#8211; more than once  <a href="http://twitter.com/EMacAdie/statuses/195363271728037888" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/briankung" class="aktt_username">briankung</a> Good to know I am not the only non-Apple Rails guy in Chicago  <a href="http://twitter.com/EMacAdie/statuses/196599228070510595" class="aktt_tweet_time">#</a></li>
</ul>
<p class="aktt_credit">Powered by <a href="http://alexking.org/projects/wordpress">Twitter Tools</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/04/29/twitter-weekly-updates-for-2012-04-29/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Update From RailsConf In Austin</title>
		<link>http://www.MacAdie.net/2012/04/24/update-from-railsconf-in-austin/</link>
		<comments>http://www.MacAdie.net/2012/04/24/update-from-railsconf-in-austin/#comments</comments>
		<pubDate>Wed, 25 Apr 2012 04:15:19 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/?p=997</guid>
		<description><![CDATA[I will probably post more about RailsConf when I get back. So far I like the presentations that I have been to. Here are thoughts on a few presentations. One of the best was &#8220;Use the Source, Luke: High fidelity data with event sourcing&#8221;, by Keith Gaddis (Twitter account here). Here is the synopsis: Ever [...]]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F24%2Fupdate-from-railsconf-in-austin%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F24%2Fupdate-from-railsconf-in-austin%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I will probably post more about <a title="http://railsconf.com/" href="http://railsconf.com/" target="_blank">RailsConf</a> when I get back. So far I like the presentations that I have been to. Here are thoughts on a few presentations.</p>
<p>One of the best was &#8220;Use the Source, Luke: High fidelity data with event sourcing&#8221;, by <a title="http://karmajunkie.com/" href="http://karmajunkie.com/" target="_blank">Keith Gaddis</a> (Twitter account <a title="https://twitter.com/#!/karmajunkie" href="https://twitter.com/#!/karmajunkie" target="_blank">here</a>). Here is the synopsis:</p>
<p><em>Ever run into a really gnarly data problem and wished you had a do-over? Tired of wrestling with ActiveRecord to model a really complex domain? Looking for a good way to echo state changes to external systems? Then grab a cup of joe and settle in for a look at event-sourcing your data.</em></p>
<p><em>Event-sourced data uses Plain Old Ruby Objects (POROs) to model your data and exclusively uses events to mutate state on those objects. By serializing the events, the state of your data can be recreated for any point in time, and outside listeners can create specialized purposeful datastores of the data, enabling complex business requirements with fewer hassles. We&#8217;ll also touch on other architectural patterns like DCI and CQRS that play well with this idea</em></p>
<p>Someone afterward said that it was the best presentation they saw at the conference. People were still asking him questions and discussing the topic 30 minutes later. I will certainly look for the slides and video for this one.</p>
<p>Another good one was &#8220;Presenters and Decorators: A Code Tour&#8221; by <a title="http://blowmage.com/" href="http://blowmage.com/" target="_blank">Mike Moore</a> (look at his <a title="https://twitter.com/#!/blowmage" href="https://twitter.com/#!/blowmage" target="_blank">Twitter account</a>). The idea is that you use presenters and decorators when you have a lot of if statements in your views and templates.</p>
<p>I also liked &#8220;Ten Things You Didn&#8217;t Know Rails Could Do With Rails&#8221; (with 32 bonus stuff) by the always-entertaining <a title="http://blog.grayproductions.net/" href="http://blog.grayproductions.net/" target="_blank">James Edward Gray</a> (Twitter account <a title="https://twitter.com/#!/JEG2" href="https://twitter.com/#!/JEG2" target="_blank">here</a>).</p>
<p>I just spent an hour doing one of the apps at <a title="https://github.com/RailsApps" href="https://github.com/RailsApps">RailsApps</a> (Twitter account <a title="https://twitter.com/#!/rails_apps" href="https://twitter.com/#!/rails_apps">here</a>).</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/04/24/update-from-railsconf-in-austin/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates for 2012-04-22</title>
		<link>http://www.MacAdie.net/2012/04/22/twitter-weekly-updates-for-2012-04-22/</link>
		<comments>http://www.MacAdie.net/2012/04/22/twitter-weekly-updates-for-2012-04-22/#comments</comments>
		<pubDate>Sun, 22 Apr 2012 21:40:00 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[Tweets]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/2012/04/22/twitter-weekly-updates-for-2012-04-22/</guid>
		<description><![CDATA[@briankung So how do you change your mindset? # I will be in Austin next week for @railsconf http://t.co/la0s9rVO # @ryanmcoon @bryonfinke Do you really think that GRPN is doomed? Would that be bad for the Chicago Rails community? # Powered by Twitter Tools]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F22%2Ftwitter-weekly-updates-for-2012-04-22%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F22%2Ftwitter-weekly-updates-for-2012-04-22%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<ul class="aktt_tweet_digest">
<li> @<a href="http://twitter.com/briankung" class="aktt_username">briankung</a> So how do you change your mindset?  <a href="http://twitter.com/EMacAdie/statuses/192000628095074304" class="aktt_tweet_time">#</a></li>
<li>I will be in Austin next week for @<a href="http://twitter.com/railsconf" class="aktt_username">railsconf</a> <a href="http://t.co/la0s9rVO" rel="nofollow">http://t.co/la0s9rVO</a>  <a href="http://twitter.com/EMacAdie/statuses/193727328935870464" class="aktt_tweet_time">#</a></li>
<li> @<a href="http://twitter.com/ryanmcoon" class="aktt_username">ryanmcoon</a> @bryonfinke Do you really think that GRPN is doomed? Would that be bad for the Chicago Rails community?  <a href="http://twitter.com/EMacAdie/statuses/193727724177727489" class="aktt_tweet_time">#</a></li>
</ul>
<p class="aktt_credit">Powered by <a href="http://alexking.org/projects/wordpress">Twitter Tools</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/04/22/twitter-weekly-updates-for-2012-04-22/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>I Will Be in Austin For RailsConf</title>
		<link>http://www.MacAdie.net/2012/04/21/i-will-be-in-austin-for-railsconf/</link>
		<comments>http://www.MacAdie.net/2012/04/21/i-will-be-in-austin-for-railsconf/#comments</comments>
		<pubDate>Sat, 21 Apr 2012 15:45:07 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/?p=994</guid>
		<description><![CDATA[I will be in Austin for a week for RailsConf. There may not be too many posts. I may do some tweets. I will have a few hours after I get there to post the night before the conference. Perhaps I will post on RSpec.]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F21%2Fi-will-be-in-austin-for-railsconf%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F21%2Fi-will-be-in-austin-for-railsconf%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<p>I will be in Austin for a week for <a title="http://railsconf.com/" href="http://railsconf.com/" target="_blank">RailsConf</a>. There may not be too many posts. I may do some tweets. I will have a few hours after I get there to post the night before the conference. Perhaps I will post on RSpec.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/04/21/i-will-be-in-austin-for-railsconf/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Twitter Weekly Updates for 2012-04-15</title>
		<link>http://www.MacAdie.net/2012/04/15/twitter-weekly-updates-for-2012-04-15/</link>
		<comments>http://www.MacAdie.net/2012/04/15/twitter-weekly-updates-for-2012-04-15/#comments</comments>
		<pubDate>Sun, 15 Apr 2012 21:40:00 +0000</pubDate>
		<dc:creator>Eric MacAdie</dc:creator>
				<category><![CDATA[Tweets]]></category>

		<guid isPermaLink="false">http://www.MacAdie.net/2012/04/15/twitter-weekly-updates-for-2012-04-15/</guid>
		<description><![CDATA[@RudyOnRails Why are you going to EIU? # @railstutorial Is the 3.2 version finalized online? # Powered by Twitter Tools]]></description>
			<content:encoded><![CDATA[<div class="tweetmeme_button" style="float: right; margin-left: 10px;">
			<a href="http://api.tweetmeme.com/share?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F15%2Ftwitter-weekly-updates-for-2012-04-15%2F"><br />
				<img src="http://api.tweetmeme.com/imagebutton.gif?url=http%3A%2F%2Fwww.MacAdie.net%2F2012%2F04%2F15%2Ftwitter-weekly-updates-for-2012-04-15%2F&amp;style=normal&amp;b=2" height="61" width="50" /><br />
			</a>
		</div>
<ul class="aktt_tweet_digest">
<li>@<a href="http://twitter.com/RudyOnRails" class="aktt_username">RudyOnRails</a> Why are you going to EIU? <a href="http://twitter.com/EMacAdie/statuses/191305055557783552" class="aktt_tweet_time">#</a></li>
<li>@<a href="http://twitter.com/railstutorial" class="aktt_username">railstutorial</a> Is the 3.2 version finalized online? <a href="http://twitter.com/EMacAdie/statuses/191305904560422912" class="aktt_tweet_time">#</a></li>
</ul>
<p class="aktt_credit">Powered by <a href="http://alexking.org/projects/wordpress">Twitter Tools</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.MacAdie.net/2012/04/15/twitter-weekly-updates-for-2012-04-15/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

