<?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>Transcending Frontiers &#187; Simple Database Export and Import With Character Encoding Conversion</title>
	<atom:link href="http://blog.thefrontiergroup.com.au/author/aaron/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.thefrontiergroup.com.au</link>
	<description>Your peek inside the collective mind of The Frontier Group</description>
	<lastBuildDate>Mon, 02 Apr 2012 04:32:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
		<item>
		<title>Simple Database Export and Import With Character Encoding Conversion</title>
		<link>http://blog.thefrontiergroup.com.au/2011/05/simple-db-export-and-import-with-character-encoding-conversion/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/05/simple-db-export-and-import-with-character-encoding-conversion/#comments</comments>
		<pubDate>Wed, 25 May 2011 12:31:56 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1575</guid>
		<description><![CDATA[There is a gem called ydd that offers really simple import and export of smallish databases. It exports to YAML and then imports to whatever database Rails can connect to. After using YDD a few times I&#8217;ve found it easier to pinpoint the cause of problems that occur using taps. It doesn&#8217;t handle character encodings [...]]]></description>
			<content:encoded><![CDATA[<p>There is a gem called <a href="https://github.com/YouthTree/ydd">ydd</a> that offers really simple import and export of smallish databases. It exports to YAML and then imports to whatever database Rails can connect to. After using YDD a few times I&#8217;ve found it easier to pinpoint the cause of problems that occur using <a href="https://github.com/ricardochimal/taps">taps</a>.</p>
<p>It doesn&#8217;t handle character encodings though so I went about adding that. With the handy rchardet gem and IConv, detecting the character encoding of the incoming string and converting it to UTF-8 was pretty simple. I&#8217;ve created a <a href="https://github.com/YouthTree/ydd/pull/3">pull request</a> for the gem that will hopefully be accepted.</p>
<p>The essential code is below, and revolves mainly around the detection and conversion. Using //TRANSLIT causes IConv to try and convert the incoming character code to something that exists in the UTF8 character set, and then //IGNORE will ignore any characters that don&#8217;t exist in the UTF8 character set. Chaining //TRANSLIT and then //IGNORE will make IConv try a conversion first and then ignore anything it cannot convert.</p>
<p><script src="https://gist.github.com/990410.js?file=changes.rb"> </script></p>
<p>I used this gem after the above changes to convert about 400,000 records of text data with ASCII, windows-1252, IBM866 and other character encodings from an old SQLite installation to a new postgres database without any issues.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/05/simple-db-export-and-import-with-character-encoding-conversion/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/05/simple-db-export-and-import-with-character-encoding-conversion/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
		</item>
		<item>
		<title>Allowing Multiple Users to Use The Pivotal Tracker Gem</title>
		<link>http://blog.thefrontiergroup.com.au/2011/05/allowing-multiple-users-to-use-the-pivotal-tracker-gem/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/05/allowing-multiple-users-to-use-the-pivotal-tracker-gem/#comments</comments>
		<pubDate>Tue, 03 May 2011 07:39:52 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[Pivotal Tracker]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1348</guid>
		<description><![CDATA[I&#8217;ve been using the Pivotal Tracker gem by Justin Smestad on a project to do various things but I ran into a problem using it with multiple API keys. The gem would create a single connection object and continue to mimic the user the first connection was made with, even when you&#8217;d updated the token [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been using the <a href="https://github.com/jsmestad/pivotal-tracker">Pivotal Tracker gem</a> by <a href="https://github.com/jsmestad">Justin Smestad</a> on a project to do various things but I ran into a problem using it with multiple API keys. The gem would create a single connection object and continue to mimic the user the first connection was made with, even when you&#8217;d updated the token to different user&#8217;s token. The Tracker API relies on you passing your API key for access to the projects and stories your account has access to, so I had the problem that the first user to use my app would determin access for everyone using the app. Not good!</p>
<p>After checking out the project the change was pretty simple but it highlighted an issue that I&#8217;ve seen in plenty of code where caching is done too broadly. In this case the cacheing (or memoization) was performed without taking into account the variable that was sent to establish the connection in the first place. The offending method looked like this :</p>
<p class="gist-block" data-gist-id="965963" data-gist-file="multiple-users-1.rb" id="gist-965963">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/965963">View it on Github!</a></p>
<p>This was set on the class and as such @connection would never be created after the first call, whether the token was reset or not. I just changed it so that the connection is cached for each @token the system uses. For us it&#8217;s a small number or users, but in a larger context of course you&#8217;d need to implement some invalidation protocols to stop the following code from (slowly) swallowing the world :</p>
<p class="gist-block" data-gist-id="965973" data-gist-file="multiple-users-2.rb" id="gist-965973">Can&rsquo;t see this Gist? <a rel="nofollow" href="http://gist.github.com/965973">View it on Github!</a></p>
<p>NoToken is just a class inheriting from StandardError that I chucked in there, the only thing that makes the gem now work properly come afterwards. I setup a hash and then store a new connection for each new incoming token, the connection is keyed by the token in the @connections hash. All pretty simple.</p>
<p>I&#8217;ve created a <a href="https://github.com/jsmestad/pivotal-tracker/pull/29">pull request</a> that will hopefully be accepted soon, I think it fixes an unexpected problem with the gem.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/05/allowing-multiple-users-to-use-the-pivotal-tracker-gem/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/05/allowing-multiple-users-to-use-the-pivotal-tracker-gem/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Accessing ActiveRecord and ActiveModel Callback Chains in Rails 3</title>
		<link>http://blog.thefrontiergroup.com.au/2011/03/accessing-activerecord-and-activemodel-callback-chains-in-rails-3/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/03/accessing-activerecord-and-activemodel-callback-chains-in-rails-3/#comments</comments>
		<pubDate>Mon, 28 Mar 2011 11:34:18 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Tips and Tricks]]></category>
		<category><![CDATA[ActiveModel]]></category>
		<category><![CDATA[ActiveRecord]]></category>
		<category><![CDATA[Rails 3]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1244</guid>
		<description><![CDATA[It seems that access to the ActiveRecord callback chain has changed recently, however the documentation still contains the following : To list the methods and procs registered with a particular callback, append _callback_chain to the callback name that you wish to list and send that to your class from the Rails console. This used to [...]]]></description>
			<content:encoded><![CDATA[<p>It seems that access to the ActiveRecord callback chain has changed recently, however the documentation still contains the following :</p>
<blockquote><p>To list the methods and procs registered with a particular callback, append _callback_chain to the callback name that you wish to list and send that to your class from the Rails console.</p></blockquote>
<p>This used to work in Rails 2.3.x and I&#8217;d used it a few times before, however trying to use it in Rails 3 gave me problems :</p>
<p><code><br />
HourEntry.before_save_callback_chain<br />
NoMethodError: undefined method `before_save_callback_chain' for #<br />
</code></p>
<p>After some digging around ActiveRecord then ActiveModel and ActiveSupport I figured I could just access the _#{type}_callbacks method and then reject and select these arrays to get what was required. This is what I came up with to get the before_save callbacks that I was interested in.</p>
<p><code><br />
HourEntry._save_callbacks.select { |callback| callback.kind.eql?(:before) }<br />
</code></p>
<p>This returns me the array of callback objects that are chained before I call save on the HourEntry model. If I want to check for a particular proc being in that chain then I can do :</p>
<p><code><br />
HourEntry._save_callbacks.select { |callback| callback.kind.eql?(:after) }.collect(&amp;:filter).include?(:archive_if_no_users)<br />
</code></p>
<p>It&#8217;s not optimal chaining a number of enumerable methods but I think it seems pretty readable.</p>
<p>I am hoping that the callback_chain methods return at some point (though I only used them sparingly) but more than that I&#8217;m hoping someone might be able to set me straight on how I&#8217;m going about getting around the callback chains on ActiveRecord and ActiveModel.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/03/accessing-activerecord-and-activemodel-callback-chains-in-rails-3/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/03/accessing-activerecord-and-activemodel-callback-chains-in-rails-3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Composing Scopes On Multiple Models with Rails 3</title>
		<link>http://blog.thefrontiergroup.com.au/2011/03/composing-scopes-on-multiple-models-with-rails-3/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/03/composing-scopes-on-multiple-models-with-rails-3/#comments</comments>
		<pubDate>Tue, 22 Mar 2011 11:30:25 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Featured]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[AREL]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1239</guid>
		<description><![CDATA[Today I had some knowledge delivered straight to the top of my dome, by Darcy. The issue was I had two models that I wanted to join and then apply scopes to. I wanted to retrieve Story objects that were joined to HourEntry objects, that were from this week. However when I tried to use [...]]]></description>
			<content:encoded><![CDATA[<p>Today I had some knowledge delivered straight to the top of my dome, by Darcy. The issue was I had two models that I wanted to join and then apply scopes to. I wanted to retrieve Story objects that were joined to HourEntry objects, that were from this week. However when I tried to use the Time scope on the query it was attempting to call those methods on Story.</p>
<pre>ree-1.8.7-2011.02 :132 &gt; Story.joins(:hour_entries).this_week
NoMethodError: undefined method `this_week' for #</pre>
<p>The problem was that the .this_week call was being sent to Story rather than to HourEntry. Here&#8217;s where Darcy chimed in with the scoped.merge call. It went a little something like this :</p>
<pre>Story.scoped.merge HourEntry.this_week</pre>
<p>This successfully merged the scope defined by Story with the scope defined by the HourEntry.this_week call and I get all the stories that have HourEntry objects that are returned by the .this_week scope.</p>
<p>The final stage for this call was :</p>
<pre>Story.scoped.merge HourEntry.worked_on_by(user).this_week</pre>
<p>This then returns all the stories you&#8217;ve worked on this week. Add a bit of grouping/distinct and it&#8217;s done and done. The additional nice part about this is composing these scopes will allow me to do a lot more in the future, very quickly.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/03/composing-scopes-on-multiple-models-with-rails-3/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/03/composing-scopes-on-multiple-models-with-rails-3/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Reloading Factory Girl Factories in the Rails 3 Console</title>
		<link>http://blog.thefrontiergroup.com.au/2011/03/reloading-factory-girl-factories-in-the-rails-3-console/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/03/reloading-factory-girl-factories-in-the-rails-3-console/#comments</comments>
		<pubDate>Thu, 03 Mar 2011 06:44:46 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://blog.thefrontiergroup.com.au/?p=1221</guid>
		<description><![CDATA[Updated : August 2011 to work with Factory Girl 2.0.5 It&#8217;s been annoying me for some time that when I hit reload! in the Rails console my factories stop working, or point to the wrong class. This wasn&#8217;t a real issue until I started using Devise. Devise uses a mapping between classes and routes, so [...]]]></description>
			<content:encoded><![CDATA[<p>Updated : August 2011 to work with Factory Girl 2.0.5</p>
<p>It&#8217;s been annoying me for some time that when I hit reload! in the Rails console my factories stop working, or point to the wrong class. This wasn&#8217;t a real issue until I started using <a href="https://github.com/plataformatec/devise">Devise</a>. </p>
<p>Devise uses a mapping between classes and routes, so when a factory built object comes through to Devise after a console reload, or a class redefinition then it will fail. This is commonly the case in development and test environments. </p>
<p>I sat down with a colleague today (thanks <a href="http://twitter.com/sutto">Darcy</a>) and we found the appropriate place to reload Factories to have it all work. </p>
<p>This is the code we put into my application.rb : </p>
<pre>
    ActionDispatch::Callbacks.after do
      # Reload the factories
      return unless (Rails.env.development? || Rails.env.test?)

      unless FactoryGirl.factories.blank? # first init will load factories, this should only run on subsequent reloads
        FactoryGirl.factories.clear
        FactoryGirl.find_definitions
      end

    end
</pre>
<p>After that everything just worked and I can hit reload! in the console without any issue. </p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/03/reloading-factory-girl-factories-in-the-rails-3-console/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/03/reloading-factory-girl-factories-in-the-rails-3-console/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
		<item>
		<title>How to Get All Associations for an Activerecord Model</title>
		<link>http://blog.thefrontiergroup.com.au/2011/01/how-to-get-all-associations-for-an-activerecord-model/</link>
		<comments>http://blog.thefrontiergroup.com.au/2011/01/how-to-get-all-associations-for-an-activerecord-model/#comments</comments>
		<pubDate>Wed, 05 Jan 2011 02:54:16 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Reflection]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/2011/01/how-to-get-all-associations-for-an-activerecord-model/</guid>
		<description><![CDATA[There was a question that was asked on our IRC channel today about how to get all the associations for an Activerecord model. I&#8217;m assuming it was to do some debugging or something, in any case I did a bit of digging around in the Rails docs and it turns out the answer isn&#8217;t that [...]]]></description>
			<content:encoded><![CDATA[<p>There was a question that was asked on our IRC channel today about how to get all the associations for an Activerecord model. I&#8217;m assuming it was to do some debugging or something, in any case I did a bit of digging around in the Rails docs and it turns out the answer isn&#8217;t that hard. </p>
<p>Doing something like : </p>
<pre>
    Model.reflect_on_all_associations
</pre>
<p>Will give you all the associations for that model, it&#8217;s pretty dirty though and so an easy way to tidy it up is : </p>
<pre>
    Model.reflect_on_all_associations.collect{ |association|
        association.name.to_s.classify
    }
</pre>
<p>So, as usual with Rails it was easy as pie, I just am putting this here for future use :) </p>
<p>Edit : Thanks to Darcy for tidying up my previous mess :P</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2011/01/how-to-get-all-associations-for-an-activerecord-model/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2011/01/how-to-get-all-associations-for-an-activerecord-model/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Entry to Graduate Medicine : The GAMSAT Day</title>
		<link>http://blog.thefrontiergroup.com.au/2010/11/studying-for-entry-to-graduate-medicine-the-gamsat/</link>
		<comments>http://blog.thefrontiergroup.com.au/2010/11/studying-for-entry-to-graduate-medicine-the-gamsat/#comments</comments>
		<pubDate>Tue, 09 Nov 2010 02:26:43 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[gamsat]]></category>
		<category><![CDATA[medicine]]></category>
		<category><![CDATA[study]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/?p=682</guid>
		<description><![CDATA[The Frontier Group is a collection of rag tag men, brought together from every corner, nook and cranny of the globe with the one common, purposeful consciousness. Usually this force is brought to bear on developing software that makes people cry less, and generally smile a lot more. Sometimes it&#8217;s just to win boat races [...]]]></description>
			<content:encoded><![CDATA[<p>The Frontier Group is a collection of rag tag men, brought together from every corner, nook and cranny of the globe with the one common, purposeful consciousness. Usually this force is brought to bear on developing software that makes people cry less, and generally smile a lot more. Sometimes it&#8217;s just to win boat races at bucks parties. It&#8217;s a pretty well rounded and multi skilled force.</p>
<p>In any case, Frontiersmen (a term coined by one of our newest Frontiersmen) come from varied walks of life and experience and so besides working at The Frontier Group we also have outside interests. We place a high importance on learning and research and currently have a number of our staff undertaking post graduate and undergraduate studies. We have people donating their time to develop for charities and not for profits and those that act, DJ and all manner of other activities. We don&#8217;t just hire great people, we hire great people that are interested in being better tomorrow than they are right now.</p>
<p>So I decided that I wanted to be a doctor.</p>
<p>Last year I decided that instead of saying I&#8217;d like to be a doctor, I&#8217;d take the necessary steps to make it happen. I&#8217;d undergone something of a seachange in my life about six years ago and was starting to question if computing and IT was really what I wanted to do for the rest of my life. With that in mind and realising that for as long as I could remember I&#8217;d always wanted to help people, I started researching what I&#8217;d need to do to make it happen.</p>
<p>It turned out that with my engineering degree in hand I could actually sit a special test called the GAMSAT (Graduate Australian Medical School Admission Test) and after jumping through another half dozen hoops wearing a tutu, reciting some old english nursery rhymes, I could be a doctor four (short) years later. Slick!</p>
<p><strong>GAMSAT Day</strong></p>
<p>I sat the GAMSAT part way through March, and I thought I&#8217;d recount what it was like for the benefit of others. There isn&#8217;t a lot of information out there for people that want to know what how the GAMSAT day actually goes. Maybe it&#8217;s different from venue to venue, but I&#8217;ll just recount what happened to me.</p>
<p>The venue opened at about 8:15am for registrations. I&#8217;d heard this component could be a bit of a nightmare and upon rocking up and seeing about 400 people there I thought it was going to be terrible. However everyone there is nervous and wanting the same things you are. I think everyone was just in the zone and wanted to get in, and get settled. Registration was quick.</p>
<p>I stood in line for a while and shuffled through. I moved to the signup desk for my last name, handed over my admission ticket and some ID. The woman checked me off and gave me a card that said my desk number and room number on it. I then went and found a space to sit and just tried to relax. Mentally I felt relaxed, but physically I was in full stress mode.</p>
<p>I probably waited about 20 minutes before we moved into the room. You put your bags at the front of the room and keep your ID on you (you&#8217;ll need this a few times during the day) and get your pencils, pens and so on ready. I took a mechanical pencil, two pens an eraser and a 17 year old calculator; Many of the people sitting the test were about four to five years older.</p>
<p>You get a booklet of questions and an answer sheet you have to fill in with your name and some other details. Everything is very strict and they read a blurb about something and what you can and cannot do. Next thing you know you have 110 minutes to answer 75 questions about cartoons, pieces of text, poems, and so on. This stuff is hard. Like hair splitting hard. You really have to read the nuances of sometimes a couple of words used in a paragraph to choose between two very similar possibilities in the multiple choice options available.</p>
<p>In any case I finished the first section with about 15 minutes spare. It gave me time to change a couple of answers and just generally chill out a bit.</p>
<p>There were many times I could actually feel my heart pounding. Your head is so engrossed in just doing the test you don&#8217;t have time to feel the emotion of stress but your body definitely has all the time in the world to make it happen.</p>
<p>Straight after the first section is the essay component. I thought this would be my weakest area as you have limited time and space to get your writing done and I like to waffle a bit. I actually finished with about 20 minutes spare. The first part (it&#8217;s a two part section) was on censorship, the second was on self esteem and it&#8217;s relation to happiness and health. They were both right up my alley and I felt I did pretty well.</p>
<p>At this point you&#8217;ve been at it for just over three hours, so they give you a one hour lunch break. I went to my car, ate my lunch and relaxed for a bit. Lots of people had books out they were studying from but I just sat in the sun and tried to think about nothing. I figured an hour of study was less important than relaxing my mind. I was pretty drained already.</p>
<p>My suggestion though, bring your own food, drink and everything. The cafe still had a massive line by the end of the lunch break. The last thing you want is the stress of wondering whether you&#8217;re going to get anything to eat, or to go into the second part of the day without eating anything.</p>
<p>After lunch you sign in again and go back to your desk. The last part is three hours of multiple choice chemistry, physics and biology. By the end of this my mind was absolutely numbed.</p>
<p>In any case like I said most of the questions give you the back story, so for an organic chemistry process they&#8217;ll describe and show what happens and then ask you to extrapolate this to other reactions, or explain what might happen for longer chains and other reactions. You need some back knowledge and to know about most of the functional groups from first year chemistry but I found these questions to be absolutely fine. </p>
<p>The biology stuff relied on a tiny bit of anatomy knowledge and mostly understanding processes. You have to interpret a lot of graphics, figures and tables and sometimes also relate multiple figures to develop an outcome. You need to be able to store a lot of context about a situation. However I found the biology questions to be pretty easy and involved a mix of stats, logical interpretation and understanding the relationships between multiple diagrams or graphs. </p>
<p>The physics is really basic stuff, usually lenses or kinematic stuff. I felt like it was about as complex as some of the basic physics in upper high school so it wasn&#8217;t a challenge. I hadn&#8217;t studied any physics really except to familiarise myself with basic formulae and this was probably a wise choice. </p>
<p>I walked out feeling that this second science section was my weaker section because of the chemistry but I still thought I&#8217;d done okay. I just finished it in time and probably left with a few questions not complete.</p>
<p>At the end it&#8217;s actually quite anti-climactic. I&#8217;d studied a lot for the past couple of months, culminating in this day and now, after eight hours of stress it was all over, but I think I was just mentally exhausted. I went home, rang a friend, talked for an hour, did some shopping at the local grocer, ate dinner and went to bed.</p>
<p>So there it is, the GAMSAT. Results come in about six to eight weeks, but it was worth it for the experience. I think it&#8217;s like marathons for me, I&#8217;ve prepared for one and I&#8217;ve lined up for one but I&#8217;m not interested in doing any of the prep or event again if it doesn&#8217;t work out.</p>
<p><strong>Results and Application</strong><br />
My results came in and the exam seemed to go better than I&#8217;d expected. My score put me in around the top 10% of people sitting the test which was surprising but cool. It&#8217;s a good start for gaining entrance into a medicine degree but it&#8217;s not the be all and end all, they take into account your previous university scores as well. Most courses now have a minimum university grade and a minimum GAMSAT score before they combine them to come up with your rank from the applicant pool. </p>
<p>Although my score in the exam was more than adequate, my previous Uni scores definitely weren&#8217;t. I applied to Notre Dame and UWA which both have minimum score requirements from your previous studies and I didn&#8217;t expect to get accepted to either programme. I got my results from applications some time in September and I was turned down for the courses I&#8217;d applied to. It was less of a let down than I&#8217;d assumed it would be, I think primarily because my job isn&#8217;t a bad one. I wasn&#8217;t running away from my job to study medicine, I was just being pulled towards the idea of being a doctor and taking care of people. </p>
<p>So that&#8217;s the journey of the GAMSAT. The study coming up to it is a whole other story, but that&#8217;s covered quite well elsewhere, I just thought some people may run across this post at some point and it would help them prep for the day itself. </p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2010/11/studying-for-entry-to-graduate-medicine-the-gamsat/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2010/11/studying-for-entry-to-graduate-medicine-the-gamsat/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>How to Get Firebug, Capybara and Selenium Working Together</title>
		<link>http://blog.thefrontiergroup.com.au/2010/11/how-to-get-firebug-capybara-and-selenium-working-together/</link>
		<comments>http://blog.thefrontiergroup.com.au/2010/11/how-to-get-firebug-capybara-and-selenium-working-together/#comments</comments>
		<pubDate>Mon, 08 Nov 2010 06:07:26 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[capybara]]></category>
		<category><![CDATA[Cucumber]]></category>
		<category><![CDATA[Firebug]]></category>
		<category><![CDATA[firefox]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/?p=1058</guid>
		<description><![CDATA[I had an issue whereby a label I thought was fine wasn&#8217;t being picked up on my Cucumber tests. It turned out that the test environment was of course running our compiled javascript and I hadn&#8217;t compiled it since my change. The labels didn&#8217;t have the &#8216;for&#8217; attribute specified so Selenium was whinging it couldn&#8217;t [...]]]></description>
			<content:encoded><![CDATA[<p>I had an issue whereby a label I thought was fine wasn&#8217;t being picked up on my Cucumber tests. It turned out that the test environment was of course running our compiled javascript and I hadn&#8217;t compiled it since my change. The labels didn&#8217;t have the &#8216;for&#8217; attribute specified so Selenium was whinging it couldn&#8217;t find the element I wanted to find. </p>
<p>In any case I couldn&#8217;t find an explanation of how to get Firebug working with Selenium and Capybara but after some doc reading I got my solution working so I thought I&#8217;d post it here. </p>
<p>In my env.rb file I have : </p>
<pre>
Capybara.register_driver :selenium do |app|
  Capybara::Driver::Selenium
  profile = Selenium::WebDriver::Firefox::Profile.new
  profile.add_extension(File.expand_path("features/support/firebug.xpi"))

  Capybara::Driver::Selenium.new(app, { :browser => :firefox, :profile => profile })
end
</pre>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2010/11/how-to-get-firebug-capybara-and-selenium-working-together/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2010/11/how-to-get-firebug-capybara-and-selenium-working-together/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Specjour with Custom Bundler and Database Setup</title>
		<link>http://blog.thefrontiergroup.com.au/2010/06/specjour-with-custom-bundler-and-database-setup/</link>
		<comments>http://blog.thefrontiergroup.com.au/2010/06/specjour-with-custom-bundler-and-database-setup/#comments</comments>
		<pubDate>Fri, 25 Jun 2010 05:51:27 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Code]]></category>
		<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[ruby]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Specjour]]></category>
		<category><![CDATA[Testing]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/?p=811</guid>
		<description><![CDATA[We have a test suite here that now is rapidly approaching 2 hours using a single core. Let me just repeat that. A developer realistically would have to leave their machine testing overnight to see if the suite is working. That&#8217;s really not good enough. Specjour has been a bit of a turn-key miracle worker [...]]]></description>
			<content:encoded><![CDATA[<p>We have a test suite here that now is rapidly approaching 2 hours using a single core. Let me just repeat that. A developer realistically would have to leave their machine testing overnight to see if the suite is working. That&#8217;s really not good enough.</p>
<p><a href="http://github.com/sandro/specjour">Specjour</a> has been a bit of a turn-key miracle worker with our RSpec suite, however lately we&#8217;ve started to require some custom database setup that we do in a seeds.rb file as well as some custom bundler install parameters as most of our devs don&#8217;t have MySQL installed. Both of our needs were being nicely stomped on by Specjour so I thought it was time to look elsewhere.</p>
<p>I took a trip down <a href="http://wiki.github.com/ngauthier/hydra/">Hydra</a> lane and while getting to the point of having a working, local, dual runner system was a piece of cake, getting something working remotely via SSH took me hours of pain. Debugging the remote SSH workers was a nightmare and I spent a couple of hours running through code before deciding it was probably better to update our existing solution rather than tooling up a brand new one.</p>
<p>Back to the Specjour code. Specjour includes a rails directory inside which is an init.rb which Rails will run at initialisation (it&#8217;s part of what Rails does) but the Specjour initialiser will always just run the default database setup task no matter what initialiser you&#8217;ve got setup. We had a specjour initialiser that runs if ENV['PREPARE_DB'] was populated, which it is by Specjour, the problem was that the Specjour initialiser ran in the Rails <code>after_initialization</code> hook and therefore stomped all over our database setup.</p>
<p>The first step was just to have our initialiser write to another ENV element and then to have the Specjour <code>after_initialize</code> handler respect this. This isn&#8217;t too hard to implement as the <code>after_initialize</code> handler is just a block that is attached and so inside of this block you just need to check that ENV element. In my case I created a new ENV['DB_PREPPED'] element when my database setup had completed and then when the <code>after_initialize</code> block runs it checks for ENV['DB_PREPPED'] and will do nothing if that&#8217;s been set to true.</p>
<p>Easy. I now had Specjour respecting our database setup task.</p>
<p>The next step was to try and test this outside of a Rails application, not only that but to test the operation of a block (anonymous function?). To do this I setup a stub on a mock Rails class and let it capture the <code>after_initialize</code> block and then I ran a number of specs against this block.</p>
<pre>module Specjour
  module DbScrub
  end
end

DO_NOT_REQUIRE = true

describe "Rails Initialiser" do
  before :all do
    ENV['PREPARE_DB'] = "true"

    stub(Specjour::DbScrub).scrub

    class Rails
      class &lt;&lt; self; attr_accessor :configuration; end
      class &lt;&lt; self; attr_accessor :test_block; end
    end

    config = Object.new
    stub(config).after_initialize { |args|
      object = Object.new
      Rails.test_block = args
      object
    }
    Rails.configuration = config

    require 'rails/init'
  end

... tests ...</pre>
<p>This code essentially mocks up Rails.configuration and then stubs the <code>after_initialize</code> method. This stub then places the block that <code>after_initialize</code> yields to into Rails.test_block. When I <code>require 'rails/init'</code> it sequentially processes the file (as with all Ruby) and the stub will capture the block. After this is a bunch of tests I run an whether the <code>Specjour::DbScrub.scrub</code> method is called or not, so it&#8217;s nothing special.</p>
<p>I felt like at this stage I had fairly well tested the main aspects of the database setup.</p>
<p>The next issue was with how bundler was being handled. We have a situation where we would like to install sometimes without some gems. Some of the gems we use and have written use applications we&#8217;d rather not maintain in development and get tested in our staging and production environments. We generally will run a bundle install in development without the production or metrics groups so I wanted to have the ability to pass through a custom bundler command. That&#8217;s pretty easy now with my gem. Inside .specjour/bundler.yml there is a command property. I think this is more complex than what&#8217;s required, but I can foresee us needing a number of custom rake tasks and shell scripts so this bundler.yml should have probably started life as a settings/commands/something_generic.yml</p>
<p>To test this part of my changes was pretty simple. I basically just stubbed the system calls to bundler to give certain return values and checked to make sure the correct program flow happened.</p>
<pre>describe ".bundle_install" do
    let :manager do
      stub.instance_of(Specjour::Manager).project_path { "/tmp" }

      stub(Dir).chdir(anything) { |args|
        args.last.call # This yields to the block for Dir.chdir()
      }

      manager = Specjour::Manager.new
      stub(manager).project_path { "blah" }
      mock(manager).system('bundle lock')

      manager
    end

    it "should perform a bundle lock" do
      stub(manager).system('bundle check &gt; /dev/null') { true }

      manager.bundle_install
    end

    it "should check if there are gems required" do
      mock(manager).system('bundle check &gt; /dev/null') { true }

      manager.bundle_install
    end

    context "when gems are required" do
      before :each do
        # Not a before :all as it needs to hook into the let hook above

        stub(manager).system('bundle check &gt; /dev/null') { false }
      end

      context "and there is a bundler YAML file" do
        before :each do
          config_file = ".specjour/bundler.yml"

          mock(File).exists?(config_file) { true }
          mock(File).read(config_file) { "" }
          mock(YAML).load(anything) {
            { 'command' =&gt; "do it" }
          }
        end

        it "should get the bundle command from the YAML file" do
          mock(manager).system('do it &gt; /dev/null')
          manager.bundle_install
        end
      end

      context "and there is no bundler YAML file" do
        before :each do
          mock(File).exists?(".specjour/bundler.yml") { false }
        end

        it "should perform a bundle install" do
          mock(manager).system('bundle install &gt; /dev/null')
          manager.bundle_install
        end
      end
    end
  end</pre>
<p>You can see that I stubbed our the <code>Dir.chdir</code> block to just yield directly to the call, otherwise it&#8217;ll throw an exception. Then I stubbed and mocked out the <code>Kernel.system</code> calls as necessary. Kernel methods are generally included into Ruby objects so you don&#8217;t stub Kernel, you stub the object that has the Kernel methods. Most of the testing is pretty basic, but I&#8217;d be keen to hear if I&#8217;m doing anything incorrectly!</p>
<p>This was my first major venture into adding functionality to a public project and it was good fun. I think it made me do a little better work than I might normally, it&#8217;s a great motivation to potentially have peers look at how you do things.</p>
<p>After bundling it all up and testing it here with over a dozen developers and even more machines I&#8217;m pretty happy with how it functions. I&#8217;ve made a pull request back to the original gem creator and hopefully he&#8217;ll like what I&#8217;ve done. In the meantime if you want to check it out then my Specjour is available on <a href="http://github.com/ozzyaaron/specjour">Git Hub</a>.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2010/06/specjour-with-custom-bundler-and-database-setup/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2010/06/specjour-with-custom-bundler-and-database-setup/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Parallel RSpec Performance Testing</title>
		<link>http://blog.thefrontiergroup.com.au/2010/06/parallel-rspec-performance-testing/</link>
		<comments>http://blog.thefrontiergroup.com.au/2010/06/parallel-rspec-performance-testing/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 02:24:01 +0000</pubDate>
		<dc:creator>Aaron</dc:creator>
				<category><![CDATA[Inside TFG]]></category>
		<category><![CDATA[rspec]]></category>
		<category><![CDATA[Ruby on Rails]]></category>
		<category><![CDATA[Specjour]]></category>

		<guid isPermaLink="false">http://thefrontiergroup.com.au/blog/?p=821</guid>
		<description><![CDATA[We&#8217;re currently deciding on hardware to build a bit of a testing cluster on which we&#8217;ll run whatever the current best remote testing package we can find. At the moment, for us, that&#8217;s ended up being Specjour. We ended up pitting one of our i7 iMacs against a $400 Acer box we bought. We installed [...]]]></description>
			<content:encoded><![CDATA[<p>We&#8217;re currently deciding on hardware to build a bit of a testing cluster on which we&#8217;ll run whatever the current best remote testing package we can find. At the moment, for us, that&#8217;s ended up being Specjour. We ended up pitting one of our i7 iMacs against a $400 Acer box we bought. We installed Ubuntu&#8217;s REE 1.8.7 on the Acer machine and RVM and REE 1.8.7 on the iMac.</p>
<p><strong>i7 iMac &#8211; Quad Core Hyperthreading</strong></p>
<p>real	11m14.131s<br />
user	0m0.776s<br />
sys	0m0.348s</p>
<p><strong>Acer &#8211; E5200 Dual Core E5200</strong></p>
<p>real  35m56.658s<br />
user 0m0.870s<br />
sys   0m2.500s</p>
<p>It seems like the little Acer box offers slightly better value for money in this case. I&#8217;d like to see how we&#8217;d do with some virtualisation sitting on top this, but I think the included memory will be quite limiting in this regard. I wonder whether the processor resources are actually being fully utilised.</p>
<script src="http://feeds.feedburner.com/~s/TranscendingFrontiers?i=http://blog.thefrontiergroup.com.au/2010/06/parallel-rspec-performance-testing/" type="text/javascript" charset="utf-8"></script>]]></content:encoded>
			<wfw:commentRss>http://blog.thefrontiergroup.com.au/2010/06/parallel-rspec-performance-testing/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

