<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.2.3" -->
<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/"
	>

<channel>
	<title>James Crisp &#187; Ruby / Rails</title>
	<link>http://jamescrisp.org</link>
	<description>C#, JRuby, Ruby on Rails, .NET, book reviews, film reviews, mind hacks, Wing Chun and the occasional personal bit.</description>
	<pubDate>Sun, 06 Jul 2008 00:29:34 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.2.3</generator>
	<language>en</language>
			<item>
		<title>Loan Calulator: Monthly repayment and interest breakdown</title>
		<link>http://jamescrisp.org/2008/04/14/loan-calulator-monthly-repayment-and-interest-breakdown/</link>
		<comments>http://jamescrisp.org/2008/04/14/loan-calulator-monthly-repayment-and-interest-breakdown/#comments</comments>
		<pubDate>Mon, 14 Apr 2008 03:27:49 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Finance]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2008/04/14/loan-calulator-monthly-repayment-and-interest-breakdown/</guid>
		<description><![CDATA[Wondering if your loan repayment calculations have been performed correctly this month, taking into account interest rate rises and extra repayments? You might be interested in giving my monthly loan calculator a go.
As my home loan provider doesn&#8217;t show balances online, and only sends statements every 6 months, I like to ring up every month [...]]]></description>
			<content:encoded><![CDATA[<p>Wondering if your loan repayment calculations have been performed correctly this month, taking into account interest rate rises and extra repayments? You might be interested in giving my <a href="http://loancalculator.jamescrisp.org">monthly loan calculator</a> a go.</p>
<p>As my home loan provider doesn&#8217;t show balances online, and only sends statements every 6 months, I like to ring up every month or two to make sure things are on track. I used to calculate interest, new balances etc in a spreadsheet / calculator but spent an afternoon writing a little Rails app to calculate it for me. Hopefully my little <a href="http://loancalculator.jamescrisp.org">monthly loan calculator</a> is of some use to you too.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2008/04/14/loan-calulator-monthly-repayment-and-interest-breakdown/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Sydney BarCamp 3 this Weekend!</title>
		<link>http://jamescrisp.org/2008/04/03/sydney-barcamp-3-this-weekend/</link>
		<comments>http://jamescrisp.org/2008/04/03/sydney-barcamp-3-this-weekend/#comments</comments>
		<pubDate>Thu, 03 Apr 2008 11:33:17 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Talks]]></category>

		<category><![CDATA[JRuby]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2008/04/03/sydney-barcamp-3-this-weekend/</guid>
		<description><![CDATA[BarCamp Sydney is two days long this year, and will span the whole of the coming weekend (5-6 April). I&#8217;ll be there on Saturday. It&#8217;s usually quite a fun event, lots of good sessions and you&#8217;re quite free to move around and find something that interests you. Part of the BarCamp manifesto is that you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.barcampsydney.org/">BarCamp Sydney</a> is two days long this year, and will span the whole of the coming weekend (5-6 April). I&#8217;ll be there on Saturday. It&#8217;s usually quite a fun event, lots of good sessions and you&#8217;re quite free to move around and find something that interests you. Part of the BarCamp manifesto is that you should also contribute as well as listen - I&#8217;ll probably give a JRuby talk and demo. </p>
<p>Hope to see you at BarCamp!</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2008/04/03/sydney-barcamp-3-this-weekend/feed/</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;JRuby: Enterprise 2.0&#8243; Slides</title>
		<link>http://jamescrisp.org/2008/03/07/jruby-enterprise-20-slides/</link>
		<comments>http://jamescrisp.org/2008/03/07/jruby-enterprise-20-slides/#comments</comments>
		<pubDate>Fri, 07 Mar 2008 06:21:45 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Talks]]></category>

		<category><![CDATA[JRuby]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2008/03/07/jruby-enterprise-20-slides/</guid>
		<description><![CDATA[Here&#8217;s the slides from  “JRuby: Enterprise 2.0″ from our recent talks at Sun Tech Day and the ACS Web Technologies SIG.
]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the <a href='http://jamescrisp.org/wordpress/wp-content/uploads/2008/03/jruby-enterprise-20.pdf' title='"JRuby: Enterprise 2.0" Slides'>slides from  “JRuby: Enterprise 2.0″</a> from our <a href="http://jamescrisp.org/2008/02/23/jruby-enterprise-20-presentations/">recent talks</a> at Sun Tech Day and the ACS Web Technologies SIG.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2008/03/07/jruby-enterprise-20-slides/feed/</wfw:commentRss>
		</item>
		<item>
		<title>&#8220;JRuby: Enterprise 2.0&#8243; Presentations</title>
		<link>http://jamescrisp.org/2008/02/23/jruby-enterprise-20-presentations/</link>
		<comments>http://jamescrisp.org/2008/02/23/jruby-enterprise-20-presentations/#comments</comments>
		<pubDate>Sat, 23 Feb 2008 01:27:57 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[JRuby]]></category>

		<category><![CDATA[Talks]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[ThoughtWorks]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2008/02/23/jruby-enterprise-20-presentations/</guid>
		<description><![CDATA[Josh Price and I will be co-presenting at the Melbourne Sun Tech Day and the Sydney ACS Web Technologies SIG. Here&#8217;s the low down:

JRuby: Enterprise 2.0
There&#8217;s a lot of buzz around JRuby in both the Java and Ruby communities, for good reason. This talk will give you a whirlwind introduction to JRuby. We&#8217;ll show you [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.workingwithrails.com/person/8781-josh-price">Josh Price</a> and I will be co-presenting at the Melbourne Sun Tech Day and the Sydney ACS Web Technologies SIG. Here&#8217;s the low down:</p>
<div style="border-left: 2px solid grey; margin-left: 2px; padding-left: 5px;">
<b>JRuby: Enterprise 2.0</b><br />
There&#8217;s a lot of buzz around JRuby in both the Java and Ruby communities, for good reason. This talk will give you a whirlwind introduction to JRuby. We&#8217;ll show you why JRuby is regarded as such a powerful and dynamic development platform. We&#8217;ll also suggest where to use JRuby in product development and the enterprise and how to leverage your existing Java investments.<br />
There will be sample applications, live demos and not many slides.</p>
<p><i>Sun Tech Day Melbourne</i><br />
4 March 2008, 2:30pm<br />
<a href="http://au.sun.com/sunnews/events/2008/techdays/agenda_melbourne.jsp">More info on Sun site&#8230;</a></p>
<p><i>ACS Web Technologies SIG Sydney</i><br />
5 March 2008, 6:15pm<br />
<a href="http://acs.org.au/index.cfm?action=event&#038;area=9001&#038;temID=eventdetails&#038;eveID=10098821082566">More info on ACS site&#8230;</a>
</div>
<p>Hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2008/02/23/jruby-enterprise-20-presentations/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Practical JRuby on Rails (Web 2.0 Projects) by Ola Bini</title>
		<link>http://jamescrisp.org/2007/12/16/practical-jruby-on-rails-web-20-projects-by-ola-bini/</link>
		<comments>http://jamescrisp.org/2007/12/16/practical-jruby-on-rails-web-20-projects-by-ola-bini/#comments</comments>
		<pubDate>Sun, 16 Dec 2007 04:39:37 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[JRuby]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Book Reviews]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/12/16/practical-jruby-on-rails-web-20-projects-by-ola-bini/</guid>
		<description><![CDATA[The fine folk at Apress sent me a copy of Ola Bini&#8217;s new book to review. The full title is &#8220;Practical JRuby on Rails Web 2.0 Projects - Bringing Ruby On Rails to the Java Platform&#8221;. Overall, it was a good read, and extremely valuable to anyone who is developing in JRuby. JRuby information and [...]]]></description>
			<content:encoded><![CDATA[<p>The fine folk at <a href="http://www.apress.com/">Apress</a> sent me a copy of <a href="http://ola-bini.blogspot.com/">Ola Bini</a>&#8217;s new book to review. The full title is <a href="http://www.amazon.com/Practical-JRuby-Rails-Web-Projects/dp/1590598814">&#8220;Practical JRuby on Rails Web 2.0 Projects - Bringing Ruby On Rails to the Java Platform&#8221;</a>. Overall, it was a good read, and extremely valuable to anyone who is developing in JRuby. JRuby information and documentation is scarce and most of the time, a Google trawl does not give you good results on a JRuby related query. Ola&#8217;s is the first, and currently the only JRuby book available, and in my experience, the most valuable resource available to give you an all-round picture of JRuby capabilities and usage.</p>
<p><strong>Audience</strong><br />
Despite comments on the cover, I would suggest that this book is not ideal for people new to Ruby / Rails. Ola jumps in the deep end quite quickly, and being a talented Ruby programmer, makes use of lots of shorthand, procs, code blocks etc which would likely be hard to follow for someone new to Ruby. Although there is a section at the back called &#8220;Ruby for Java programmers&#8221;, I think this would not be sufficient for somebody new to Ruby to understand all the code examples.</p>
<p>To get the most value out of the book, it would be good to have at least a basic understanding of Ruby and Rails (eg, having read <a href="http://www.amazon.com/Agile-Web-Development-Rails-2nd/dp/0977616630">Agile Web Development with Rails</a> or messed around with Ruby/Rails a bit) and a basic understanding of Java syntax, deployment and Java EE.</p>
<p><strong>What&#8217;s Covered?</strong><br />
The book is project based, so as to give context and useful examples of JRuby functionality. There are 4 projects:</p>
<ul>
<li>The Store (Shoplet) - a standard Rails app running under JRuby using Active Record JDBC.</li>
<li>Content management system - general Java integration and using Java libraries for content rendering.</li>
<li>Administration System - using EJBs, JMX and discussion of JRuby deployment options.</li>
<li>Library System - JRuby as the &#8220;glue that never sets&#8221;. Using Java Web service frameworks and JMS from JRuby.</li>
</ul>
<p><strong>The Good</strong></p>
<ul>
<li>Teaches you how to do all those tricky bits which are half-Java and half-Ruby and can&#8217;t be easily found online, such as converting between Ruby and Java types, including JAR files, implementing Java interfaces, etc</li>
<li>Clever and concise Ruby code - I picked up some Ruby tricks reading Ola&#8217;s code.</li>
<li>Complex code snippets are generally well explained in text.</li>
<li>Useful tips on when to use Java libraries and when to use Ruby ones.</li>
<li>Generally good and interesting example projects which justified the use of JRuby and the techniques shown in the book.</li>
<li>Helpful discussion of JDBC and database connectivity options for JRuby.</li>
<li>Nice overview of the many JRuby deployment options.</li>
<li>Helpful &#8220;sidebars&#8221; about Java Enterprise Edition technologies.</li>
<li>Covers the strong areas of JRuby well - web applications and system integration.</li>
<li>Appendices provide useful reference information.</li>
<li>Nice section at the end on how you can get involved in JRuby.</li>
</ul>
<p><strong>The Less Good</strong></p>
<ul>
<li>Example views often contain table layouts, inline styles and other layout information that would be better done in separate CSS files.</li>
<li>Variable names in code could be more descriptive. This would make example code easier to follow.</li>
<li>Occasional odd spelling like &#8220;sur_name&#8221; and use of deprecated Rails features, such as &#8220;start_form_tag&#8221; (to be fair though, Rails API does change very quickly).</li>
<li>The title suggests that the book is about Web 2.0. There is a little token AJAX, and I suppose a content management system is a bit Web 2.0, but overall, buy the book if you want to know about JRuby, not Web 2.0.</li>
<li>Although REST is only mentioned briefly in a little sidebar, and not a focus of the book, I found the description of REST and CRUD a bit misleading, especially when considering <a href="http://www.elharo.com/blog/software-development/web-development/2005/12/08/post-vs-put/">PUT vs POST</a>.</li>
<li>The discussion of JRuby deployment provides a good overview, but more in depth discussion of major options (eg, GoldSpike), and production configurations would be great.</li>
</ul>
<p><strong>Conclusion</strong><br />
As the best and only JRuby reference, I&#8217;d highly recommend you buy a copy if you are working in, or planning to work in JRuby. The book will help you to write JRuby applications which make good use of Ruby, Rails, Java libraries and Java Enterprise Edition features.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/12/16/practical-jruby-on-rails-web-20-projects-by-ola-bini/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Automating MySQL Database Backups</title>
		<link>http://jamescrisp.org/2007/12/09/automating-mysql-database-backups/</link>
		<comments>http://jamescrisp.org/2007/12/09/automating-mysql-database-backups/#comments</comments>
		<pubDate>Sun, 09 Dec 2007 01:37:15 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/12/09/automating-mysql-database-backups/</guid>
		<description><![CDATA[Great, so you&#8217;ve got your web application up and running on some server somewhere, and  thousands of users are hard at work entering their valuable data into your application, and thence to a MySQL database. Now people depend on your system to keep their data safe. What are you going to do about it?
The [...]]]></description>
			<content:encoded><![CDATA[<p>Great, so you&#8217;ve got your web application up and running on some server somewhere, and  thousands of users are hard at work entering their valuable data into your application, and thence to a MySQL database. Now people depend on your system to keep their data safe. What are you going to do about it?</p>
<p>The approach I&#8217;ve taken is to run a backup script on a cron job, which dumps data from the database a few times a daily, compresses it, and emails it off to my GMail account. All those GMail gigabytes have got to be good for something, right :-)?</p>
<p>I started writing a simple backup shell script using mysqldump, gzip and sendmail, but ran into problems on RailsPlayground as sendmail is not supported there. RailsPlayground suggested this <a href="http://worldcommunity.com/opensource/utilities/mysql_backup.txt">perl script for mysql backup</a> (<a href="http://jamescrisp.org/wordpress/wp-content/uploads/2007/12/mysql_backup.txt">mirrored on my server</a>). The script does pretty much what I was looking for, and also supports skipping tables (useful for ignoring things like session tables, which, for my app, are not really worth backing up).</p>
<p>A little more investigation revealed that the script wouldn&#8217;t work out of the box, as RailsPlayground requires SMTP auth. The backup script is not hard to enhance to support SMTP auth. It can be done as follows:</p>
<p>In the configuration section of the file (around line 203), add 2 new variables:</p>
<pre>
$smtp_user           = "my username"
$smtp_password       = "my password"
</pre>
<p>Around line 1200, add in the AuthUser and AuthPass:</p>
<pre>
MIME::Lite->send("$send_method", "$mailprog_or_smtp_host", Timeout=>60,
            AuthUser=>$smtp_user, AuthPass=>$smtp_password);
</pre>
<p>As an aside, this script can also do backups via FTP.</p>
<p>Restore of mysql dump files is pretty easy. You just use the standard client:</p>
<pre>
mysql -uMyUser -p MyDatabaseName < SqlDumpFile.sql
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/12/09/automating-mysql-database-backups/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Hosting at Rails Playground, a review</title>
		<link>http://jamescrisp.org/2007/11/10/hosting-at-rails-playground-a-review/</link>
		<comments>http://jamescrisp.org/2007/11/10/hosting-at-rails-playground-a-review/#comments</comments>
		<pubDate>Sat, 10 Nov 2007 00:10:33 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/11/10/hosting-at-rails-playground-a-review/</guid>
		<description><![CDATA[I&#8217;ve been meaning to write about Rails Playground for a while. I currently use their level 2 developer hosting and I&#8217;ve been very happy with it. I host several domains and subdomains on my account. I run several rails apps (including my online wedding registry site, this blog (WordPress) and a wiki (moin) on it. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been meaning to write about <a href="http://railsplayground.com">Rails Playground</a> for a while. I currently use their <a href="http://www.railsplayground.com/plans/developer/index.html">level 2 developer hosting</a> and I&#8217;ve been very happy with it. I host several domains and subdomains on my account. I run several rails apps (including my <a href="http://yourweddingpresents.com">online wedding registry</a> site, this blog (WordPress) and a wiki (moin) on it. </p>
<p>You get shell access, sFTP and cPanel, MySQL, PostgreSQL and also unlimited subversion repositories. Another neat feature is that you get 2 mongrel instances included. You need to ask Rails Playground staff to set these up for you, but they are quite prompt and friendly. I did have some problems with Mongrel instances dying, but the Rails Playground staff added a cron job to restart them, and this has solved the issue. At currently $12/month (or $9/month if you pay for a year), it is quite economical hosting. </p>
<p>I&#8217;d highly recommend Rails Playground if you&#8217;re a rails developer looking for hosting (with fcgi and mongrels) and subversion, and you don&#8217;t want/need the flexibility/hassle/higher price of a virtual private server.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/11/10/hosting-at-rails-playground-a-review/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Wedding Registries for the Pommies</title>
		<link>http://jamescrisp.org/2007/10/20/wedding-registries-for-the-pommies/</link>
		<comments>http://jamescrisp.org/2007/10/20/wedding-registries-for-the-pommies/#comments</comments>
		<pubDate>Sat, 20 Oct 2007 01:20:57 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[YourWeddingPresents.com]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/10/20/wedding-registries-for-the-pommies/</guid>
		<description><![CDATA[Your Wedding Presents now shows all money amounts in pounds, if you say you are from the United Kingdom. God Save the Queen!
]]></description>
			<content:encoded><![CDATA[<p><a href="http://yourweddingpresents.com">Your Wedding Presents</a> now shows all money amounts in pounds, if you say you are from the United Kingdom. God Save the Queen!</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/10/20/wedding-registries-for-the-pommies/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JRuby on Rails with GoldSpike - Scaling for more users</title>
		<link>http://jamescrisp.org/2007/09/26/jruby-on-rails-with-goldspike-scaling-for-more-users/</link>
		<comments>http://jamescrisp.org/2007/09/26/jruby-on-rails-with-goldspike-scaling-for-more-users/#comments</comments>
		<pubDate>Wed, 26 Sep 2007 07:55:41 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[JRuby]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/09/26/jruby-on-rails-with-goldspike-scaling-for-more-users/</guid>
		<description><![CDATA[The default configuration for running JRuby on Rails using GoldSpike only allows 4 instances of the JRuby runtime. This means that if there are more than 4 simultaneous requests from clients, the web server will respond with a server overloaded error. The easiest way to see what&#8217;s going on is to take a look at [...]]]></description>
			<content:encoded><![CDATA[<p>The default configuration for running JRuby on Rails using GoldSpike only allows 4 instances of the JRuby runtime. This means that if there are more than 4 simultaneous requests from clients, the web server will respond with a server overloaded error. The easiest way to see what&#8217;s going on is to take a look at the &#8216;createObjectPool&#8217; method of <a href="http://www.koders.com/java/fid184901B6B416637DFBFB0F3C30F88647642D988E.aspx">RailsServlet</a>.</p>
<p>With a dedicated production server with 1gig of memory, it is possible to allow a lot more JRuby runtimes, and hence allow for more simultaneous users. A little load testing on a fairly small app suggested that 20 instances of JRuby runtime would fit comfortably under the 1gig ceiling and not overload the processor.</p>
<p>An easy way to change the max number of runtimes is to edit &#8216;web.xml&#8217; in a JRuby application&#8217;s WEB-INF directory. Parameter is set as follows:</p>
<pre>
  &lt;context-param&gt;
    &lt;param-name>jruby.pool.maxActive&lt;/param-name&gt;
    &lt;param-value>20&lt;/param-value&gt;
  &lt;/context-param&gt;
</pre>
<p>It is also worth checking with the web server configuration to ensure that the web server allows more threads than the number of JRuby runtimes specified in &#8216;web.xml&#8217;.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/09/26/jruby-on-rails-with-goldspike-scaling-for-more-users/feed/</wfw:commentRss>
		</item>
		<item>
		<title>YourWeddingPresents.com (wedding registry site) now live!</title>
		<link>http://jamescrisp.org/2007/09/13/yourweddingpresentscom-wedding-registry-site-now-live/</link>
		<comments>http://jamescrisp.org/2007/09/13/yourweddingpresentscom-wedding-registry-site-now-live/#comments</comments>
		<pubDate>Thu, 13 Sep 2007 13:52:44 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[YourWeddingPresents.com]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/09/13/yourweddingpresentscom-wedding-registry-site-now-live/</guid>
		<description><![CDATA[I&#8217;m really pleased to announce that YourWeddingPresents.com (a free, independent, wedding registry site) is now live! 
When my sister was getting married, she had a lot of trouble finding a good free wedding registry that was not tied to any particular shop. I developed the wedding registry site to fill this gap, and also to [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m really pleased to announce that <a href="http://yourweddingpresents.com">YourWeddingPresents.com (a free, independent, wedding registry site)</a> is now live! </p>
<p>When my sister was getting married, she had a lot of trouble finding a good free wedding registry that was not tied to any particular shop. I developed the <a href="http://yourweddingpresents.com">wedding registry site</a> to fill this gap, and also to improve my web programming skills. I&#8217;ve tried to design <a href="http://yourweddingpresents.com">Your Wedding Presents</a> to be really quick to sign up and easy to use. <a href="/contact">Please tell me</a> if there are any problems with the site, or ways the site could be made better.</p>
<p>On the technical side, I developed <a href="http://yourweddingpresents.com">Your Wedding Presents</a> using <a href="http://rubyonrails.org">Ruby on Rails</a>. It is running on an Apache load-balanced Mongrel cluster and data is stored in MySQL. It is hosted on <a href="http://www.railsplayground.com/">Rails Playground</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/09/13/yourweddingpresentscom-wedding-registry-site-now-live/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JRuby, Rails and Statics</title>
		<link>http://jamescrisp.org/2007/09/09/jruby-rails-and-statics/</link>
		<comments>http://jamescrisp.org/2007/09/09/jruby-rails-and-statics/#comments</comments>
		<pubDate>Sun, 09 Sep 2007 07:07:09 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[JRuby]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/09/09/jruby-rails-and-statics/</guid>
		<description><![CDATA[Say you wanted to store some information across different calls to your JRuby/Rails application on the server side. You could use a database, or memcached. However, what if you just want to do something very simple like a basic cache, and you don&#8217;t have a database for your application? Memcached seems like overkill, and would [...]]]></description>
			<content:encoded><![CDATA[<p>Say you wanted to store some information across different calls to your JRuby/Rails application on the server side. You could use a database, or memcached. However, what if you just want to do something very simple like a basic cache, and you don&#8217;t have a database for your application? Memcached seems like overkill, and would complicate your deployment considerably. So, what about just using statics?</p>
<p>Well, you can&#8217;t do it in Ruby, as the Rails integration servlet spawns multiple instances of the JRuby interpreter.</p>
<p>Ruby code in a page view:</p>
<pre>&lt;h1&gt;Ruby global number&lt;/h1&gt;
<% $i ||= 0 %>
<% $i += 1 %>
<%= $i %>

&lt;h1&gt;Ruby obj id&lt;/h1&gt;
<% $o ||= Object.new %>
<%= $o.object_id %>
</pre>
<p>Results between multiple refreshes of the page:</p>
<pre>Ruby global number
1
Ruby obj id
244 

Ruby global number
1
Ruby obj id
256 

Ruby global number
2
Ruby obj id
244 

Ruby global number
2
Ruby obj id
256
</pre>
<p>Our requests seem to be switching between two instances of the Ruby interpreter. </p>
<p>However, we <b>*can*</b> do it in Java. My clever, Java-literate colleagues explained that Java application servers and servlet containers use a single instance of the JVM, but have a class loader for each application. The class loader stores class information and static values. This means that within one application, the static values will be maintained between requests, but a different application on the same server will have its own set of unrelated static values (similar to AppDomains in .NET).</p>
<p>If we add a call to a static method in Java that increments an integer and returns it, our view looks like this:</p>
<pre>&lt;h1&gt;Ruby global number&lt;/h1&gt;
<% $i ||= 0 %>
<% $i += 1 %>
<%= $i %>

&lt;h1&gt;Ruby obj id&lt;/h1&gt;
<% $o ||= Object.new %>
<%= $o.object_id %>

&lt;h1&gt;Java incrementing static integer&lt;/h1&gt;
<%= TestClass.incrementAndReturnNumber() %>
</pre>
<p>Our results now look a lot more useful. The Java static integer is getting incremented each call to the view:</p>
<pre>
Ruby global number
1
Ruby obj id
244
Java number
1 

Ruby global number
1
Ruby obj id
256
Java number
2 

Ruby global number
2
Ruby obj id
244
Java number
3 

Ruby global number
2
Ruby obj id
256
Java number
4
</pre>
<p>From this little experiment, Java statics seem like a possible way to go for storing temporary data on the server side (eg, a cache implemented as a singleton) for JRuby / Rails. Another option may be to use the ServletContext from the JRuby Rails integration servlet - probably an area worth investigating.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/09/09/jruby-rails-and-statics/feed/</wfw:commentRss>
		</item>
		<item>
		<title>BarCamp Sydney this Saturday</title>
		<link>http://jamescrisp.org/2007/08/22/barcamp-sydney-this-saturday/</link>
		<comments>http://jamescrisp.org/2007/08/22/barcamp-sydney-this-saturday/#comments</comments>
		<pubDate>Wed, 22 Aug 2007 12:09:05 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[JRuby]]></category>

		<category><![CDATA[Talks]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/08/22/barcamp-sydney-this-saturday/</guid>
		<description><![CDATA[It is BarCamp in Sydney this Saturday. I haven&#8217;t been to one of these unconference style events before, but I&#8217;ve heard good things about it from my colleagues. I&#8217;m quite excited to go along and see what it is like. 
If you&#8217;re in Sydney and interested in stopping by, details are as follows:
When: Sat 25th [...]]]></description>
			<content:encoded><![CDATA[<p>It is <a href="http://barcampsydney.org/">BarCamp in Sydney</a> this Saturday. I haven&#8217;t been to one of these unconference style events before, but I&#8217;ve heard good things about it from my colleagues. I&#8217;m quite excited to go along and see what it is like. </p>
<p>If you&#8217;re in Sydney and interested in stopping by, details are as follows:</p>
<p><b>When:</b> Sat 25th August 2007 from about 9am<br />
<b>Where:</b> University of Technology, Sydney (Jones St entrance)<br />
<a href="http://barcampsydney.org/?page_id=4">More details&#8230;</a></p>
<p>One of the novel aspects of BarCamp is that all participants are encouraged to present or start a discussion around something that interests them. For my part, depending on what people are interested in, I was thinking of one of the following:</p>
<ul>
<li>new stuff in the .net space (C# 3.0, .NET 3.5, LINQ, WPF, WCF, etc) and showing some demos</li>
<li>giving a bit of a Ruby/JRuby introduction with help from <a href="http://ola-bini.blogspot.com/2007/08/my-presentation-from-javabin.html">Ola&#8217;s  JavaBin slides</a></li>
<li>or, if people are keen, a discussion around JRuby vs C# 3 vs Java vs ?? and their stacks for different situations and problems</li>
<ul>
<p>By the way, the conference is free, and it is not too late to sign up <img src='http://jamescrisp.org/wordpress/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
Hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/08/22/barcamp-sydney-this-saturday/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Slides from &#8216;Learning to live with the static-typing fascist and the dynamic-typing fan-boy in your enterprise…&#8217;</title>
		<link>http://jamescrisp.org/2007/08/15/slides-from-learning-to-live-with-the-static-typing-fascist-and-the-dynamic-typing-fan-boy-in-your-enterprise%e2%80%a6/</link>
		<comments>http://jamescrisp.org/2007/08/15/slides-from-learning-to-live-with-the-static-typing-fascist-and-the-dynamic-typing-fan-boy-in-your-enterprise%e2%80%a6/#comments</comments>
		<pubDate>Wed, 15 Aug 2007 02:03:13 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Talks]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/08/15/slides-from-learning-to-live-with-the-static-typing-fascist-and-the-dynamic-typing-fan-boy-in-your-enterprise%e2%80%a6/</guid>
		<description><![CDATA[Here&#8217;s the slides from Jim&#8217;s and my recent presentation at Tech Ed 07 on the Gold Coast and in Auckland:
LearningToLiveWithTheStaticTypingFascistAndTheDynamicTypingFanboy-TechEd07.pptx  (Powerpoint 2007)
LearningToLiveWithTheStaticTypingFascistAndTheDynamicTypingFanboy-TechEd07.ppt (Powerpoint 2003)
You may also be interested in having a read of the abstract.
]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s the slides from <a href="http://jim.webber.name">Jim</a>&#8217;s and my recent presentation at Tech Ed 07 on the Gold Coast and in Auckland:</p>
<p><a href='http://jamescrisp.org/wordpress/wp-content/uploads/2007/08/LearningToLiveWithTheStaticTypingFascistAndTheDynamicTypingFanboy-TechEd07.pptx' title='LearningToLiveWithTheStaticTypingFascistAndTheDynamicTypingFanboy-TechEd07.ptx'>LearningToLiveWithTheStaticTypingFascistAndTheDynamicTypingFanboy-TechEd07.pptx  (Powerpoint 2007)</a></p>
<p><a href='http://jamescrisp.org/wordpress/wp-content/uploads/2007/08/LearningToLiveWithTheStaticTypingFascistAndTheDynamicTypingFanboy-TechEd07.ppt' title='LearningToLiveWithTheStaticTypingFascistAndTheDynamicTypingFanboy-TechEd07.ppt'>LearningToLiveWithTheStaticTypingFascistAndTheDynamicTypingFanboy-TechEd07.ppt (Powerpoint 2003)</a></p>
<p>You may also be interested in having a read of the <a href="http://jamescrisp.org/2007/08/02/tech-ed-talks/">abstract</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/08/15/slides-from-learning-to-live-with-the-static-typing-fascist-and-the-dynamic-typing-fan-boy-in-your-enterprise%e2%80%a6/feed/</wfw:commentRss>
		</item>
		<item>
		<title>TechEd 07 - Some interesting snippets</title>
		<link>http://jamescrisp.org/2007/08/14/teched-07-some-interesting-snippets/</link>
		<comments>http://jamescrisp.org/2007/08/14/teched-07-some-interesting-snippets/#comments</comments>
		<pubDate>Mon, 13 Aug 2007 22:06:11 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[C#]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/08/14/teched-07-some-interesting-snippets/</guid>
		<description><![CDATA[Silverlight

Silverlight runs on MAC and PC.
There is now a CLR for the Mac.
Microsoft is not currently planning to provide Silverlight for any unix platform (although there is MoonLight).
Silverlight 1.0 is basically a media player. It has hooks for javascript etc and some might say it has similar functionality to the Flash movie player.
Silverlight 1.1 has [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Silverlight</strong></p>
<ul>
<li>Silverlight runs on MAC and PC.</li>
<li>There is now a CLR for the Mac.</li>
<li>Microsoft is not currently planning to provide Silverlight for any unix platform (although there is MoonLight).</li>
<li>Silverlight 1.0 is basically a media player. It has hooks for javascript etc and some might say it has similar functionality to the Flash movie player.</li>
<li>Silverlight 1.1 has the real programming API. All further Silverlight references are to 1.1.</li>
<li>Silverlight will do a (currently undefined) simplified subset of WPF.</li>
<li>Silverlight gives acess to DOM in the browser.</li>
<li>Currently, the alpha allows 1mb local storage per page. In future, the storage is probably going to be shared across a domain rather than on a page by page basis.</li>
<li>Silverlight provides the capability to open a file on disk for read to allow for file uploads etc.</li>
<li>Interop between JavaScript and hosted Silverlight app is quite easy.</li>
<li>Silverlight looks a bit fiddly to set up, requiring javascript and sometimes xaml bootstrap - but being improved.</li>
</ul>
<p><strong>Software Factories</strong></p>
<ul>
<li>Allow solution and project structures to be auto-generated based on wizards.</li>
<li>Can provide code snippets and some (often template-based) code auto-generation.</li>
<li>Comes with documentation in help files and some context specific stuff.</li>
<li>Can include GUI designers that generate code.</li>
<li>People can develop their own domain specific factories.</li>
</ul>
<p><strong>DSLs</strong><br />
Currently, Microsoft&#8217;s take on DSLs is GUI editors, not written language or code. At the Software Factories talk, a GUI tool in Visual Studio for drawing your business entities and relationships was billed as a DSL.</p>
<p><strong>Windows Workflow Foundation (WF)</strong></p>
<ul>
<li>Activity based with GUI designer for connecting and composing activities.</li>
<li>Custom activities and compositions can be developed and inherit from base classes.</li>
<li>Single threaded and mainly queue based, with some events sprinkled through.</li>
<li>Activities can reference data from other activities using a mechanism vaguely like data binding.</li>
<li>Hosted in the CLR, so can be part of a console app, ASP.NET, WinForms etc.</li>
<li>Handles pickling and reconstitution of long running activities.</li>
<li>Base Activity classes provide virtual hooks. Eg, &#8216;Execute&#8217; for doing the work, &#8216;Cancel&#8217;, and &#8216;Compensate&#8217; for handling rollback scenarios.
</ul>
<p><strong>New in the Enterprise Library 3.1</strong></p>
<ul>
<li>Validation Application Block: provides simple, attribute based property validation. Easy integration with standard ErrorProvider on WinForms and WebForms and WPF is possible. Looks ok but somewhat basic - don&#8217;t think it supports warnings for example. It has GUI tool support and also capability to specify related objects which need to be validated.</li>
<li>Policy Injection Application Block: provides aspect oriented programming (AOP) style coding using attributes. All new AOP objects need to be created using the block&#8217;s object factory. Looks useful - there is out of the box support for validation, caching and logging in AOP fashion.</li>
</ul>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/08/14/teched-07-some-interesting-snippets/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tech Ed Talks</title>
		<link>http://jamescrisp.org/2007/08/02/tech-ed-talks/</link>
		<comments>http://jamescrisp.org/2007/08/02/tech-ed-talks/#comments</comments>
		<pubDate>Thu, 02 Aug 2007 06:37:18 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Talks]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Personal]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/2007/08/02/tech-ed-talks/</guid>
		<description><![CDATA[Jim Webber and I will be co-presenting at Tech Ed Australia and Tech Ed New Zealand this year. Here&#8217;s the low down:
Learning to live with the static-typing fascist and the dynamic-typing fan-boy in your enterprise&#8230; 
Gold Coast
Thursday 9 Aug
5pm - 6:15pm
Auckland
Tuesday 14 Aug
2:20pm - 3:35pm
&#8220;What&#8217;s best for your enterprise? Is it the &#8216;glue that never [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jim.webber.name">Jim Webber</a> and I will be co-presenting at <a href="https://aunz.msteched.com/public/ausessions.aspx">Tech Ed Australia</a> and <a href="https://aunz.msteched.com/public/nzsessions.aspx">Tech Ed New Zealand</a> this year. Here&#8217;s the low down:</p>
<div style="border-left: 2px solid grey; margin-left: 2px; padding-left: 5px;"><strong>Learning to live with the static-typing fascist and the dynamic-typing fan-boy in your enterprise&#8230; </strong></p>
<p><em>Gold Coast</em><br />
Thursday 9 Aug<br />
5pm - 6:15pm</p>
<p><em>Auckland</em><br />
Tuesday 14 Aug<br />
2:20pm - 3:35pm</p>
<p>&#8220;What&#8217;s best for your enterprise? Is it the &#8216;glue that never sets&#8217; and flexibility of dynamic languages like Ruby, or the tried and true, hard and fast rules and tool support of static languages like C# 3.0? Are there different trade-offs for green field development and integration?</p>
<p>And more importantly, which is best, the Mac or PC?</p>
<p>In a dynamic, and combative presentation, Jim and James will let their alter-egos run amok and answer these questions from the perspective of a seasoned enterprise architect and a l33t hax0r. By the end of this session you will understand the interplays between the two personality types, have had a few laughs, and picked up a few tips on how to use both technology<br />
sets in harmony in your enterprise. &#8220;</p></div>
<p>Hope to see you there!</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/08/02/tech-ed-talks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Adding a New Rails Project under Subversion</title>
		<link>http://jamescrisp.org/2007/07/01/adding-a-new-rails-project-under-subversion/</link>
		<comments>http://jamescrisp.org/2007/07/01/adding-a-new-rails-project-under-subversion/#comments</comments>
		<pubDate>Sun, 01 Jul 2007 23:21:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=63</guid>
		<description><![CDATA[I generally use Subversion for source control when given the choice. In day to day usage, I like to use Tortoise SVN as it gives you a GUI with tick boxes for files to check in. However, it&#8217;s handy to use the command line tool for project setup and automation.
Often, there is a subversion repository [...]]]></description>
			<content:encoded><![CDATA[<p>I generally use <a href="http://subversion.tigris.org/">Subversion</a> for source control when given the choice. In day to day usage, I like to use <a href="http://tortoisesvn.tigris.org/">Tortoise SVN</a> as it gives you a GUI with tick boxes for files to check in. However, it&#8217;s handy to use the command line tool for project setup and automation.</p>
<p>Often, there is a subversion repository already set up and running on another machine. In this situation, I generally:</p>
<ol>
<li>Check out the repository at the top level into a temporary directory through Tortoise, add a new directory ([appname]) for the new project, and check it in.</li>
<li>Generate the new rails app (rails [appname]).</li>
<li>Check out [appname] from the repository into the local directory [appname] which contains the Rails project.</li>
<li>Add and check in all files through Tortoise.</li>
<li>Run the following commands from the command line to remove logs and tmp from the repository:</li>
</ol>
<pre>svn remove log/*

svn commit -m "removing all log files from subversion"

svn propset svn:ignore "*.log" log/svn update log/

svn commit -m "Ignoring all files in /log/ ending in .log"

svn remove tmp/*

svn propset svn:ignore "*" tmp/

svn update tmp/svn 

commit -m "Ignoring all files in /tmp/"</pre>
<p>There&#8217;s more Rails/Subversion info to be found on the <a href="http://wiki.rubyonrails.org/rails/pages/HowtoUseRailsWithSubversion">Rails wiki</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/07/01/adding-a-new-rails-project-under-subversion/feed/</wfw:commentRss>
		</item>
		<item>
		<title>The Castle Project - Rails for .NET</title>
		<link>http://jamescrisp.org/2007/06/12/the-castle-project-rails-for-net/</link>
		<comments>http://jamescrisp.org/2007/06/12/the-castle-project-rails-for-net/#comments</comments>
		<pubDate>Tue, 12 Jun 2007 13:26:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[C#]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=61</guid>
		<description><![CDATA[The Castle Project is an interesting open source alternative to ASP.NET / ADO.NET. Among other things, the Castle Project provides a Rails-like development framework for .NET. It has an ActiveRecord implementation built on top of NHibernate, a very Rails-like MVC setup called MonoRail, and uses NVelocity for template style views. It&#8217;s worth checking out. This [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.castleproject.org/">The Castle Project</a> is an interesting open source alternative to ASP.NET / ADO.NET. Among other things, the Castle Project provides a <a href="http://www.rubyonrails.org/">Rails</a>-like development framework for .NET. It has an ActiveRecord implementation built on top of <a href="http://www.nhibernate.org/">NHibernate</a>, a very Rails-like MVC setup called MonoRail, and uses <a href="http://nvelocity.sourceforge.net/">NVelocity</a> for template style views. It&#8217;s worth checking out. This <a href="http://hammett.castleproject.org/wp-content/uploads/2007/01/mr%20formvalidation.html">screencast</a> gives a bit of an overview.</p>
<p>There&#8217;s tough competition around the corner though, with <a href="http://msdn2.microsoft.com/en-us/vstudio/aa700831.aspx">Orcas already in beta</a>, providing XAML, LINQ and O-R mapping.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/06/12/the-castle-project-rails-for-net/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Is .NET or Java dying?</title>
		<link>http://jamescrisp.org/2007/06/05/is-net-or-java-dying/</link>
		<comments>http://jamescrisp.org/2007/06/05/is-net-or-java-dying/#comments</comments>
		<pubDate>Tue, 05 Jun 2007 09:52:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=60</guid>
		<description><![CDATA[Are C# and .NET losing ground as Martin Fowler suggests? Or is Java&#8217;s market share dropping? What about Ruby? And what about the Australian market in particular?
Here&#8217;s what I&#8217;ve been able to find.
Job Trends
Which technologies have the most demand for people?
From Indeed.com, which claims to search &#8220;millions of jobs from thousands of job sites&#8221;, but [...]]]></description>
			<content:encoded><![CDATA[<p>Are C# and .NET losing ground as <a href="http://martinfowler.com/bliki/RubyMicrosoft.html">Martin Fowler</a> suggests? Or is <a href="http://www.businessweek.com/technology/content/dec2005/tc20051213_042973.htm">Java&#8217;s market share dropping</a>? What about Ruby? And what about the Australian market in particular?</p>
<p>Here&#8217;s what I&#8217;ve been able to find.</p>
<p><span style="font-weight: bold;">Job Trends</span><br />
Which technologies have the most demand for people?</p>
<p>From <a href="http://www.indeed.com/jobtrends?q=.net%2C+java%2C+c%23%2C+ruby&#038;l=">Indeed.com</a>, which claims to search &#8220;millions of jobs from thousands of job sites&#8221;, but I suspect may have a USA focus:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_TlhwVaDeyBE/RmTGdLuuu0I/AAAAAAAAAW8/Z5uOqrnvNJk/s1600-h/indeed.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_TlhwVaDeyBE/RmTGdLuuu0I/AAAAAAAAAW8/Z5uOqrnvNJk/s400/indeed.png" alt="" id="BLOGGER_PHOTO_ID_5072397284993317698" border="0" /></a></p>
<p><a href="http://www.vision6.com.au/ch/dx8s7z/236720/f5785zrx3.pdf">&#8220;Best Talent Index May 2007&#8243;</a> from <a href="http://best-international.com.au/">Best People Solutions</a>  gives an Australian perspective:</p>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp2.blogger.com/_TlhwVaDeyBE/RmTpGruuu1I/AAAAAAAAAXE/OxDKaQ4KZfY/s1600-h/best.JPG"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp2.blogger.com/_TlhwVaDeyBE/RmTpGruuu1I/AAAAAAAAAXE/OxDKaQ4KZfY/s400/best.JPG" alt="" id="BLOGGER_PHOTO_ID_5072435381353233234" border="0" /></a></p>
<p>Here&#8217;s job counts from the (largest?) primarily Australian job search site <a href="http://www.seek.com.au/">Seek</a> on 5 June 2007, 3pm (today):</p>
<table class="ttable" bordercolordark="#003366" bordercolorlight="#c0c0c0" id="Table2" align="center" border="1">
<tr>
<td><b>Keyword(s)</b></td>
<td><b>Number of positions found</b></td>
</tr>
<tr>
<td>Java</td>
<td>3,414</td>
</tr>
<tr>
<td>&#8220;.NET&#8221; or &#8220;dot net&#8221;</td>
<td>2,744</td>
</tr>
<tr>
<td>&#8220;c#&#8221; or &#8220;c sharp&#8221;</td>
<td>1,722</td>
</tr>
<tr>
<td>ruby</td>
<td>100</td>
</tr>
</table>
<p>As an aside, I remember doing a search on Seek for &#8220;ruby&#8221; about 6 months ago, and getting under 20 jobs mentioning it.</p>
<p><span style="font-weight: bold;">Search Engine Number of Hits</span></p>
<p>Extract from the <a href="http://www.tiobe.com/tiobe_index/index.htm">TIOBE Programming Community Index for June 2007</a>:</p>
<table width="80%" class="ttable" bordercolordark="#003366" bordercolorlight="#c0c0c0" id="Table2" align="center" border="1">
<tbody>
<tr>
<th align="center"> Position<br />
Jun 2007</th>
<th align="center" >Position<br />
Jun 2006</th>
<th align="center" >Delta in Position</th>
<th align="center" >Programming Language</th>
<th align="center" >Ratings<br />
Jun 2007</th>
<th align="center" >Delta<br />
Jun 2006</th>
<th align="center" >Status</th>
</tr>
<tr>
<td align="center">1</td>
<td align="center">1</td>
<td align="center"><img src="http://www.tiobe.com/tiobe_index/images/Same.gif" border="0" /></td>
<td><a href="http://www.tiobe.com/tiobe_index/Java.html">Java</a></td>
<td align="center">20.025%</td>
<td align="center">-1.10%</td>
<td align="left">  A</td>
</tr>
<tr height="25">
<td align="center">2</td>
<td align="center">2</td>
<td align="center"><img src="http://www.tiobe.com/tiobe_index/images/Same.gif" border="0" /></td>
<td><a href="http://www.tiobe.com/tiobe_index/C.html">C</a></td>
<td align="center">15.967%</td>
<td align="center">-2.29%</td>
<td align="left">  A</td>
</tr>
<tr height="25">
<td align="center">3</td>
<td align="center">3</td>
<td align="center"><img src="http://www.tiobe.com/tiobe_index/images/Same.gif" border="0" /></td>
<td><a href="http://www.tiobe.com/tiobe_index/C__.html">C++</a></td>
<td align="center">11.118%</td>
<td align="center">+0.45%</td>
<td align="left">  A</td>
</tr>
<tr height="25">
<td align="center">4</td>
<td align="center">4</td>
<td align="center"><img src="http://www.tiobe.com/tiobe_index/images/Same.gif" border="0" /></td>
<td><a href="http://www.tiobe.com/tiobe_index/%28Visual%29_Basic.html">(Visual) Basic</a></td>
<td align="center">9.332%</td>
<td align="center">-0.85%</td>
<td align="left">  A</td>
</tr>
<tr height="25">
<td align="center">5</td>
<td align="center">5</td>
<td align="center"><img src="http://www.tiobe.com/tiobe_index/images/Same.gif" border="0" /></td>
<td><a href="http://www.tiobe.com/tiobe_index/PHP.html">PHP</a></td>
<td align="center">8.871%</td>
<td align="center">-0.72%</td>
<td align="left">  A</td>
</tr>
<tr height="25">
<td align="center">6</td>
<td align="center">6</td>
<td align="center"><img src="http://www.tiobe.com/tiobe_index/images/Same.gif" border="0" /></td>
<td><a href="http://www.tiobe.com/tiobe_index/Perl.html">Perl</a></td>
<td align="center">6.177%</td>
<td align="center">+0.17%</td>
<td align="left">  A</td>
</tr>
<tr height="25">
<td align="center">7</td>
<td align="center">8</td>
<td align="center"> <img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /> </td>
<td><a href="http://www.tiobe.com/tiobe_index/C_.html">C#</a></td>
<td align="center">3.483%</td>
<td align="center">+0.25%</td>
<td align="left">  A</td>
</tr>
<tr height="25">
<td align="center">8</td>
<td align="center">7</td>
<td align="center"> <img src="http://www.tiobe.com/tiobe_index/images/Down.gif" border="0" /> </td>
<td><a href="http://www.tiobe.com/tiobe_index/Python.html">Python</a></td>
<td align="center">3.161%</td>
<td align="center">-0.30%</td>
<td align="left">  A</td>
</tr>
<tr height="25">
<td align="center">9</td>
<td align="center">10</td>
<td align="center"> <img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /> </td>
<td><a href="http://www.tiobe.com/tiobe_index/JavaScript.html">JavaScript</a></td>
<td align="center">2.616%</td>
<td align="center">+1.16%</td>
<td align="left">  A</td>
</tr>
<tr height="25">
<td align="center">10</td>
<td align="center">19</td>
<td align="center"> <img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /><img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /><img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /><img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /><img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /><img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /><img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /><img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /><img src="http://www.tiobe.com/tiobe_index/images/Up.gif" border="0" /> </td>
<td><a href="http://www.tiobe.com/tiobe_index/Ruby.html">Ruby</a></td>
<td align="center">2.132%</td>
<td align="center">+1.65%</td>
<td align="left">  A</td>
</tr>
</tbody>
</table>
<p><a onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}" href="http://bp0.blogger.com/_TlhwVaDeyBE/RmTxsLuuu2I/AAAAAAAAAXM/Klu2QZtQmEw/s1600-h/tpci_trends.png"><img style="margin: 0px auto 10px; display: block; text-align: center; cursor: pointer;" src="http://bp0.blogger.com/_TlhwVaDeyBE/RmTxsLuuu2I/AAAAAAAAAXM/Klu2QZtQmEw/s400/tpci_trends.png" alt="" id="BLOGGER_PHOTO_ID_5072444821691349858" border="0" /></a><br />
I think this gives a good idea of web buzz, but suggest that most non-IT companies do not publish information about their projects and chosen technologies and languages on the web.</p>
<p><span style="font-weight: bold;">Conclusion</span><br />
The data collected suggests that:</p>
<ul>
<li>Both .NET and Java are major players in the job market with thousands of positions advertised, implying wide industry adoption of both.</li>
<li>Neither .NET nor Java seem to be undergoing any significant decline in jobs.
</li>
<li>Java has much more information about it on the internet, although .NET is slowing gaining ground and Java slowly losing it.
</li>
<li>Ruby is comparatively tiny but growing rapidly in terms of jobs and information on the internet.
</li>
</ul>
<p><span style="font-weight:bold;">Thanks</span><br />
Thanks to <a href="http://jchyip.blogspot.com/">Jason Yip</a> and <a href="http://binkysilhouette.blogspot.com/">Suzi Edwards</a> for their help finding/sourcing information.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/06/05/is-net-or-java-dying/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Can you spot the bug?</title>
		<link>http://jamescrisp.org/2007/05/20/can-you-spot-the-bug/</link>
		<comments>http://jamescrisp.org/2007/05/20/can-you-spot-the-bug/#comments</comments>
		<pubDate>Sun, 20 May 2007 07:04:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=59</guid>
		<description><![CDATA[In a model class which has &#8216;quantity&#8217;, &#8216;quantity_already_taken&#8217; and &#8216;quantity_requested&#8217; properties, I add the following:
def before_save
  quantity = 1 if quantity == 0
  if quantity + quantity_already_taken &#62; quantity_requested
  ......
Tests blow up everywhere with:
TypeError: nil can't be coerced into Fixnum   (on the line with the addition)
Why?
After a little more debugging, [...]]]></description>
			<content:encoded><![CDATA[<p>In a model class which has &#8216;quantity&#8217;, &#8216;quantity_already_taken&#8217; and &#8216;quantity_requested&#8217; properties, I add the following:</p>
<pre>def before_save
  quantity = 1 if quantity == 0
  if quantity + quantity_already_taken &gt; quantity_requested
  ......</pre>
<p>Tests blow up everywhere with:</p>
<pre>TypeError: nil can't be coerced into Fixnum   (on the line with the addition)</pre>
<p>Why?</p>
<p>After a little more debugging, it is clear that &#8216;quantity&#8217; is nil. How could that happen?</p>
<p>The answer lies in the fact that Ruby requires an explicit self reference when using attribute writers (aka, property setters) within the class itself. This feels clunky to me, but for your information, here&#8217;s a <a href="http://www.rubyfleebie.com/use-self-explicitly/">rationalisation of the explicit self requirement</a>.</p>
<p>So, in case you&#8217;re wondering, what happened above is that the &#8216;if&#8217; line created a nil local variable called &#8216;quantity&#8217;! This local variable then had higher scope precedence than the class attribute with the same name. The addition line was then using the local &#8216;quantity&#8217; rather than the class attribute and hence failed with the nil error.</p>
<p>All fixed by explicity referencing self:</p>
<pre>def before_save
  self.quantity = 1 if (quantity == 0)
  if quantity + quantity_already_taken &gt; quantity_requested
  ......</pre>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/05/20/can-you-spot-the-bug/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Tips for Developing Mephisto Plugins with Liquid and Rails</title>
		<link>http://jamescrisp.org/2007/04/11/tips-for-developing-mephisto-plugins-with-liquid-and-rails/</link>
		<comments>http://jamescrisp.org/2007/04/11/tips-for-developing-mephisto-plugins-with-liquid-and-rails/#comments</comments>
		<pubDate>Thu, 12 Apr 2007 04:32:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=56</guid>
		<description><![CDATA[When I was writing a contact form plugin for Mephisto, I had a lot of trouble finding documentation and ended up reading lots of code and experimenting. That was fun, but fairly slow, so I hope this post can save future plugin developers time, and help them avoid some of the gotchas I stumbled over.
Repository [...]]]></description>
			<content:encoded><![CDATA[<p><span style="font-weight: bold;"></span>When I was writing a <a href="http://jamescrisp.org/2007/03/19/contact-feedback-form-plugin-for-mephisto/">contact form plugin</a> for <a href="http://mephistoblog.com/">Mephisto</a>, I had a lot of trouble finding documentation and ended up reading lots of code and experimenting. That was fun, but fairly slow, so I hope this post can save future plugin developers time, and help them avoid some of the gotchas I stumbled over.</p>
<p><span style="font-weight: bold;">Repository Directory Structure</span><br />At the most macro level, your repository needs to have a &#8216;plugins&#8217; directory, and then a directory named after your plugin. Eg,<br />&#8230;/plugins/my_new_plugin/&#8230;<br />If this is not set up correctly, your plugin will not be able to be installed via &#8216;ruby script/install plugin <repository>&#8216; method.</p>
<p></repository><span style="font-weight: bold;">Liquid Plugins Directory and Init.rb</span><br />As you probably know, Mephisto uses <a href="http://home.leetsoft.com/liquid">Liquid</a> for page templates. Liquid can be extended with new tags/blocks. The way to do this in a plugin is to set up a &#8216;mephisto/liquid&#8217; directory with your extensions in it. See <a href="http://mephisto-contact-form-plugin.googlecode.com/svn/plugins/mephisto_contact_form/lib/mephisto/liquid/">example here</a>. So that&#8217;s great, but you also need to register it in init.rb. Here&#8217;s the contact form&#8217;s <a href="http://mephisto-contact-form-plugin.googlecode.com/svn/plugins/mephisto_contact_form/init.rb">init.rb</a> - check out the line about &#8216;register_tag&#8217;.</p>
<p><span style="font-weight: bold;">Mephisto Plugin Class</span><br />Mephisto trunk now has a base class for plugins - Mephisto::Plugin. Inheriting from this allows you to set up routes to brand new controllers you create. See <a href="http://mephisto-contact-form-plugin.googlecode.com/svn/plugins/mephisto_contact_form/lib/plugin.rb">contact form example here</a>.  This opens the door to writing Mephisto plugins which do postback and processing. It is also possible to add in tabs and forms in the administration interface. <a href="http://techno-weenie.net/">Rick</a>&#8217;s <a href="http://svn.techno-weenie.net/projects/mephisto/plugins/mephisto_feedback/lib/plugin.rb">feedback plugin</a> shows how to do this.</p>
<p><span style="font-weight: bold;">Using Liquid Templates from Your Plugin</span><br />One of the trickiest bits was getting the plug-in controller to render a liquid template. This is important if you want your additions to Mephisto to have the same layout and colours as the rest of the site. The way I&#8217;ll outline below works fine, but it is not ideal. Hopefully there is a better way to do this (eg, some sort of Liquid API for Mephisto plugins).. if you know how a better way, please let me know!</p>
<p>I had my plugin controller inherit from the Mephisto ApplicationController to gain access to the method &#8216;render_liquid_template_for&#8217;. You can see the <a href="http://mephisto-contact-form-plugin.googlecode.com/svn/plugins/mephisto_contact_form/lib/controllers/contact_form_controller.rb">code here</a>. However, this led to thorny problems where the plug-in classes were getting loaded only once when the server started, but Mephisto (and the ApplicationController) were getting reloaded for every request. First request worked fine, but nasty errors were spat out on the second and subsequent requests. To resolve this, I removed the plug-in from the &#8216;load_once_paths&#8217;. You can see how to do this in the <a href="http://mephisto-contact-form-plugin.googlecode.com/svn/plugins/mephisto_contact_form/init.rb">init.rb</a>.</p>
<p><span style="font-weight: bold;">Models, Views &#038; Controllers Directories and Init.rb</span><br />Okay, this is open to personal taste. I like to have similar directories in my plugin to a normal app. Eg, separate directories for controllers, model, etc. This causes a bit more work, as you need to add the extra directories to various global path variables. For an example of how to do this, take a look at &#8216;models_path&#8217; and &#8216;controllers_path&#8217; in this <a href="http://mephisto-contact-form-plugin.googlecode.com/svn/plugins/mephisto_contact_form/init.rb">init.rb</a> and the physical directory structure of the <a href="http://mephisto-contact-form-plugin.googlecode.com/svn/plugins/mephisto_contact_form/lib/">contact form&#8217;s lib directory</a>.<br /><span style="font-weight: bold;"><br /></span></p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/04/11/tips-for-developing-mephisto-plugins-with-liquid-and-rails/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Improve Rails Performance Through Eternal Browser Caching of Assets</title>
		<link>http://jamescrisp.org/2007/04/03/improve-rails-performance-through-eternal-browser-caching-of-assets/</link>
		<comments>http://jamescrisp.org/2007/04/03/improve-rails-performance-through-eternal-browser-caching-of-assets/#comments</comments>
		<pubDate>Tue, 03 Apr 2007 13:11:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=55</guid>
		<description><![CDATA[I&#8217;ve been working on a rails app which has got quite a number of pages that share the same two css files and 3 javascript files. However, every time I visited any page of the app, all of javascripts and css files were being loaded from the server. Not good - site was very slow. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been working on a rails app which has got quite a number of pages that share the same two css files and 3 javascript files. However, every time I visited any page of the app, all of javascripts and css files were being loaded from the server. Not good - site was very slow. Mucking around with &#8216;about:cache&#8217; command in Firefox revealed that the css and javascript files had expiry dates set in the past - ie, no caching of them at all. Also, all the links to sylesheets and javascript files generated by rails had ?<long>[some long number] after them. Some <a href="http://www.endikos.com/2007/2/23/rails-asset-id-and-seo">research on the web</a> revealed that this is a new rails feature for caching - the long number is a timestamp for when the asset was last modified.</p>
<p>Okay, so why were these assets not being cached? A quick check with wget &#8211;save-headers revealed that the web server was sending a nocache directive to the browser. This seems to be the default setup for webrick and also for my shared apache hosting on <a href="http://railsplayground.com/">railsplayground</a>. Considering the new rails asset management system with the ?<last>[last modified timestamp] in the URLs, nocache seems wrong. The browser should never expire the cache since rails will handle cache invalidation by updating the asset url with a new timestamp.</p>
<p>So, how can we implement no/very long cache expiry? In apache, you can use mod_expires or mod_headers to do this. My shared hosting does not support mod_expires, so I went for mod_headers in my .htaccess file.</p>
<p>Using mod_headers:</p>
<pre><filesmatch>&lt;FilesMatch &#8220;.*$&#8221;&gt;
Header set Cache-Control &#8220;max-age=29030400&#8243;
&lt;/FilesMatch&gt;</filesmatch></pre>
<p>OR using mod_expires:</p>
<pre>ExpiresActive On
ExpiresDefault "access plus 1 year"</pre>
<p>Either of the the above will set up a cache expiry time of one year for all content (best you only do this for your rails app directories).</p>
<p>With a cache expiry time of one year in place, my rails apps run much much faster.</last></long></p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/04/03/improve-rails-performance-through-eternal-browser-caching-of-assets/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Starting at ThoughtWorks: First Five Weeks</title>
		<link>http://jamescrisp.org/2007/03/26/starting-at-thoughtworks-first-five-weeks/</link>
		<comments>http://jamescrisp.org/2007/03/26/starting-at-thoughtworks-first-five-weeks/#comments</comments>
		<pubDate>Tue, 27 Mar 2007 04:11:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[ThoughtWorks]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=52</guid>
		<description><![CDATA[Well, I&#8217;ve been with ThoughtWorks for just over 5 weeks now, and I thought I&#8217;d write down some thoughts before the hiring and joining process got lost in the misty swamp of my memory.
Hiring processTo cut a long story short, I did a phone screen with HR, a coding test and then some fairly quick [...]]]></description>
			<content:encoded><![CDATA[<p>Well, I&#8217;ve been with <a href="http://www.thoughtworks.com/">ThoughtWorks</a> for just over 5 weeks now, and I thought I&#8217;d write down some thoughts before the hiring and joining process got lost in the misty swamp of my memory.</p>
<p><span style="font-weight: bold;">Hiring process</span><br />To cut a long story short, I did a phone screen with HR, a coding test and then some fairly quick aptitude and personality tests and finally 3 interviews. You have something like a week to do the coding test and then submit your code for review. I had the other tests and interviews on a single day. Although this sounds pretty horrendous, it actually wasn&#8217;t too bad. Tests were pretty quick and the interviewers were astoundingly friendly. I finished by something like 3pm in the afternoon, including a lunch break, and surprisingly didn&#8217;t feel too bad or stressed afterwards.</p>
<p><span style="font-weight: bold;">Induction</span><br />As a fairly impressive start, I had 2 days of induction in Melbourne (I live in Sydney). ThoughtWorks arranged drivers, hotel and flight so it was all very smooth. This was lucky as I was pretty jet lagged and confused - I&#8217;d just flown back from an <a href="http://jamescrisp.blogspot.com/search/label/Travel">overseas holiday</a> not long before. Induction was largely getting a company provided laptop, meeting people and getting an introduction to various internal systems and procedures. As an aside, I&#8217;ve heard that there is now an &#8220;immersion&#8221; process where you get sent to India for a week or two for induction but can&#8217;t comment on that.</p>
<p><span style="font-weight: bold;">A few weeks on the beach</span><br />When you&#8217;re not assigned to a client project, you are &#8220;on the beach&#8221;. This means you go into your local office with your laptop. It&#8217;s really great - there&#8217;s no particular tasks assigned to you, but the opportunity is there to get involved in a lot of interesting stuff. To give you some examples, here&#8217;s some of the stuff I&#8217;ve had the chance to do:
<ul>
<li>Write an <a href="http://jamescrisp.blogspot.com/2007/03/contact-feedback-form-plugin-for.html">open source plug-in for Mephisto</a> for <a href="http://studios.thoughtworks.com/">ThoughtWorks Studios</a></li>
<li>Be involved in scoping out and estimating for a RFI from a new client</li>
<li>Pair with another developer to do code reviews of potential new recruits</li>
<li>Help out briefly with a fun project to develop a <a href="http://sourceforge.net/projects/jcruisemonitor/">driver for a USB build light</a> for continuous integration servers (red for broken build, green for good build, etc)</li>
<li>Help out on client projects - I was asked to whip up a little proof of concept for JRuby and Java integration and <a href="http://jamescrisp.blogspot.com/2007/02/jruby-setup.html">learnt a bit</a> getting this set up</li>
<li>Do a little bit of Google Maps integration</li>
<li>Meet colleagues and learn more about procedures etc</li>
<li>Get invited to lunch with the managing director - this is something that happens for all new hires and I think it&#8217;s really great</li>
<li>Almost go out on a pre-sales call (I&#8217;ve got to go back to Melbourne and will miss this unfortunately)</li>
<li>Catch up on tech reading such as blogs, books etc</li>
<li>Go to a swanky <a href="http://www.thoughtworks.com.au/tech-briefing.html">talk</a> given by Martin Fowler and  Kristan Vingrys</li>
<li>Eat lots of free lunches (usually twice a week) and attend various talks at the office given by other consultants</li>
<li>Drink lots of free coffee (ThoughtWorks has a coffee tab with a local cafe)</li>
</ul>
<p><span style="font-weight: bold;">First project<span style="font-weight: bold;"></span><br /></span>Much fun as it is on the beach, after a few weeks, I was itching to join the big boys and go on a project. Getting assigned to a project is the purview of your professional services manager, and can be pretty changeable. The saying is that &#8220;you don&#8217;t really know what project you&#8217;re on till you walk in the door of the client site&#8221; and I&#8217;ve even heard &#8220;you don&#8217;t really know what project you&#8217;re on till you&#8217;re on the plane home&#8221;. There&#8217;s a grain of truth in these - it can look like you are going to go on a project and then it doesn&#8217;t come through, or some other project becomes more important or whatever. I almost went on several different projects before finally ending up on quite a cool Ruby / Rails project with a startup in Melbourne. So, I got to join the jet set and have been flying down to Melbourne during the week, and back for the weekends. This is a bit tiring, but ThoughtWorks does its best to make things comfortable. I&#8217;m staying in a really nice corporate apartment in Melbourne, flights are arranged and paid for and drivers are scheduled for pickup and drop off to the airport. There&#8217;s also a generous per diem allowance for food. The project is really cool, and I&#8217;m enjoying it, but can&#8217;t say more as it is under a NDA.</p>
<p><span style="font-weight: bold;">Back on the beach.. but only for two days!<br /></span>My first project was two weeks, so after that I returned to the beach. Today is my second day on the beach. However, it turns out that the client was very happy with our first two weeks work and they&#8217;ve invited us back again until Easter. This means I need to fly back to Melbourne tomorrow.  This won&#8217;t continue indefinitely though - when I was discussing the project with my professional services manager, we agreed that I would not need to stay on a Melbourne project for more than 6 weeks. And clearly this is in ThoughtWorks interest as well - it costs a lot more to fly somebody in from Sydney every week and provide accommodation etc. I&#8217;m going to be transitioning off the project by Easter and a Melbourne based consultant is going to take over from me if the project continues further. It&#8217;ll be good to be on a Sydney based project again but I feel it would be unfair not to say that ThoughtWorks has done a really good job in making working in another city as convenient and pleasant as possible.</p>
<p><span style="font-weight: bold;">Various benefits<br /></span>ThoughtWorks is pretty generous in the expenses department. They cover your mobile phone, home internet, per diem when away, give an allowance for training courses and books, etc. There&#8217;s also lots of free lunches, food, coffee and catered events.</p>
<p><span style="font-weight: bold;">Transparency and knowing what&#8217;s going on<br /></span>I&#8217;ve been quite impressed to get a monthly update email that talks about ThoughtWorks plans, goals and financials, headcount etc in significant detail. There&#8217;s also various update meeting where you get to hear how projects are going and what&#8217;s happening with various clients. Personally I&#8217;m really glad to see this type of thing, as at previous jobs, this has been privileged information, and most of the time, I have not really had any idea how well the company is doing financially as a whole, or what the future plans and directions are.</p>
<p><span style="font-weight: bold;">Variety and Unpredictability<br /></span>These are really two faces of the same coin, and depending on your character and experience, I think you might either love or hate this. You really don&#8217;t know what project you&#8217;re going to be working on, what your role will be, what industry the client is in, what type of development they need or for what platform or in what language. In fact, you don&#8217;t even know what city you&#8217;re going to be in during a given week. I&#8217;m enjoying this at this point as my last job was always in the same office, with the same technologies etc. However, I can see it may be trying in the long term, and it does make it difficult to do the shopping or organise things with friends during the week. On the other hand, I have heard that most of the work in Sydney is for big companies like banks and telcos in the city CBD within walking distance to the office, and the majority in Java. So perhaps my short experience so far is not the norm.</p>
<p><span style="font-weight: bold;">In conclusion&#8230;<br /></span>So far, I can honestly say that it&#8217;s been really great working at ThoughtWorks. I&#8217;ve had a chance to do some of the stuff I&#8217;ve wanted to do for ages like work on a bit of open source and do some commercial Ruby on Rails work. My colleagues have been friendly and welcoming, and I&#8217;ve been wowed by the level of care that ThoughtWorks takes of its employees.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/03/26/starting-at-thoughtworks-first-five-weeks/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Contact / Feedback Form Plugin for Mephisto</title>
		<link>http://jamescrisp.org/2007/03/19/contact-feedback-form-plugin-for-mephisto/</link>
		<comments>http://jamescrisp.org/2007/03/19/contact-feedback-form-plugin-for-mephisto/#comments</comments>
		<pubDate>Mon, 19 Mar 2007 11:26:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[ThoughtWorks]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=50</guid>
		<description><![CDATA[Introduction
If you use Mephisto, a content management / blogging system written in Rails, you may well be interested in using this new plug-in. It provides a form that lets visitors to your site leave their contact details and send you messages or feedback via email.
License
This plug-in was developed for the new ThoughtWorks Studios site. As [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://bp1.blogger.com/_TlhwVaDeyBE/Re9LzKIAXII/AAAAAAAAAWg/Ymx_wzpmPdM/s1600-h/plugin.JPG" onblur="try {parent.deselectBloggerImageGracefully();} catch(e) {}"><img src="http://bp1.blogger.com/_TlhwVaDeyBE/Re9LzKIAXII/AAAAAAAAAWg/Ymx_wzpmPdM/s200/plugin.JPG" style="margin: 0pt 0pt 10px 10px; float: right; cursor: pointer" id="BLOGGER_PHOTO_ID_5039329850314218626" border="0" /></a><span style="font-weight: bold">Introduction</span><br />
If you use <a href="http://mephistoblog.com/">Mephisto</a>, a content management / blogging system written in <a href="http://www.rubyonrails.org/">Rails</a>, you may well be interested in using this new plug-in. It provides a form that lets visitors to your site leave their contact details and send you messages or feedback via email.</p>
<p><span style="font-weight: bold">License</span><br />
This plug-in was developed for the new <a href="http://studios.thoughtworks.com/">ThoughtWorks Studios site</a>. As I wrote it at and for work, it is copyright ThoughtWorks, 2007. However, ThoughtWorks, being generous souls, is happy for me to open source it under the <a href="http://www.apache.org/licenses/LICENSE-2.0.html">Apache 2.0 licence</a>, which pretty much means you have free reign to use it as you want.</p>
<p><span style="font-weight: bold">Requirements</span></p>
<ul>
<li>Mephisto Edge (the latest stable 0.7.3 release does not have support for Mephisto plugins)</li>
<li>Rails Edge (required by Mephisto edge)</li>
<li>ActionMailer (comes with Rails) correctly configured with SMTP server etc, so that emails can be delivered. See &#8220;Configuration&#8221; section <a href="http://wiki.rubyonrails.org/rails/pages/HowToSendEmailsWithActionMailer">here</a> for more details.</li>
</ul>
<p><span style="font-weight: bold">Installation</span></p>
<pre>ruby script/plugin install http://mephisto-contact-form-plugin.googlecode.com/svn/plugins/mephisto_contact_form</pre>
<p>or in your vendor/plugins directory for Mephisto:</p>
<pre>svn checkout http://mephisto-contact-form-plugin.googlecode.com/svn/plugins/mephisto_contact_form mephisto_contact_form</pre>
<p>Make sure you restart your web server at this point so that the plugin is loaded.</p>
<p><span style="font-weight: bold">Setup</span><br />
1. Create a new template called &#8216;contact_us.liquid&#8217; though the admin web interface (under the &#8216;Design&#8217; tab).<br />
Paste in the following code:</p>
<pre>
&lt;H1&gt;Contact Us&lt;/H1&gt;
{% contactform %}
&lt;p&gt;{{ form.name }}&lt;label for="author"&gt;&lt;small&gt;Your name&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;{{ form.email }}&lt;label for="email"&gt;&lt;small&gt;Email address&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;{{ form.phone}}&lt;label for="phone"&gt;&lt;small&gt;Phone number (optional)&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;{{ form.subject}}&lt;label for="subject"&gt;&lt;small&gt;Subject&lt;/small&gt;&lt;/label&gt;&lt;/p&gt;
&lt;p&gt;{{ form.body }}&lt;/p&gt;
&lt;p&gt;{{ form.submit }}&lt;/p&gt;
{% endcontactform %}</pre>
<p>Feel free to modify labels, layout etc.</p>
<p>2. Edit</p>
<pre>{MEPHISTO_ROOT}/vendor/plugins/mephisto_contact_form/lib/contact_notifier.rb</pre>
<p>and put in the email address you want contact form submissions to go to.</p>
<p>3. Link to &#8220;/contact_form&#8221; from your site.</p>
<p><span style="font-weight: bold">Any issues / questions / suggestions?</span><br />
Best to post comments on this blog.</p>
<p><span style="font-weight: bold">Technical Info<br />
</span>The contact form plugin is actually a combination of a rails plugin, a liquid block plugin and a Mephisto plugin. See this post about <a href="http://jamescrisp.org/2007/04/11/tips-for-developing-mephisto-plugins-with-liquid-and-rails/">developing Mephisto plugins</a> for more information.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/03/19/contact-feedback-form-plugin-for-mephisto/feed/</wfw:commentRss>
		</item>
		<item>
		<title>_vimrc for Ruby</title>
		<link>http://jamescrisp.org/2007/03/01/_vimrc-for-ruby/</link>
		<comments>http://jamescrisp.org/2007/03/01/_vimrc-for-ruby/#comments</comments>
		<pubDate>Thu, 01 Mar 2007 11:18:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=46</guid>
		<description><![CDATA[In the past I&#8217;ve used gvim for Ruby coding. It&#8217;s been pretty good, especially with the new tabbed editing and omni complete (bit like intellisense in Visual Studio) introduced in vim 7. However, when I downloaded vim at work, I was missing the secret sauce - a good vimrc. Here&#8217;s my usual vimrc for ruby:
set [...]]]></description>
			<content:encoded><![CDATA[<p>In the past I&#8217;ve used gvim for Ruby coding. It&#8217;s been pretty good, especially with the new tabbed editing and omni complete (bit like intellisense in Visual Studio) introduced in vim 7. However, when I downloaded vim at work, I was missing the secret sauce - a good vimrc. Here&#8217;s my usual vimrc for ruby:</p>
<pre>set nocompatible
behave xtermset
selectmode=mouse
set nu
set tabstop=2
set shiftwidth=2
set softtabstop=2
set ai
set columns=100
set lines=70
set guifont=Courier:h10
set expandtab
set smarttab
let g:rubycomplete_rails = 1</pre>
<p>Among other things, it makes the default window size bigger, uses a prettier font, sets up auto indenting ruby style, and turns on omni-complete.</p>
<p>By the way, on windows, assuming a default install, vimrc is to be found here:</p>
<pre>C:\Program Files\Vim\_vimrc</pre>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/03/01/_vimrc-for-ruby/feed/</wfw:commentRss>
		</item>
		<item>
		<title>JRuby Setup</title>
		<link>http://jamescrisp.org/2007/02/26/jruby-setup/</link>
		<comments>http://jamescrisp.org/2007/02/26/jruby-setup/#comments</comments>
		<pubDate>Tue, 27 Feb 2007 04:59:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[JRuby]]></category>

		<category><![CDATA[Java]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=45</guid>
		<description><![CDATA[Recently got a JRuby/Rails system with Java integration up and running. Unfortunately, it took quite a few hours, as most of the docs and code you find through Google are out of date.
If you use JRuby 0.9.2 from Codehaus, you will get an error similar to this when you try to access a rails application:
[2007-02-26 [...]]]></description>
			<content:encoded><![CDATA[<p>Recently got a JRuby/Rails system with Java integration up and running. Unfortunately, it took quite a few hours, as most of the docs and code you find through Google are out of date.</p>
<p>If you use JRuby 0.9.2 from Codehaus, you will get an error similar to this when you try to access a rails application:</p>
<p>[2007-02-26 17:54:59] INFO  WEBrick::HTTPServer start: pid=22540508 port=3000<br />&lt;ArgumentError: Anonymous modules have no name to be referenced by&gt;<br />[&#8221;c:/jruby-0.9.2/lib/ruby/gems/1.8/gems/activesupport-1.4.1/lib/<br />active_support/dependencies.rb:402:in `to_constant_name&#8217;&#8230;</p>
<p>If you&#8217;re stuck in this rut, fear not!  <a href="http://blog.nicksieger.com/">Nick Sieger</a>  has written <a href="http://trac.caldersphere.net/projects/main/wiki/JRubyQuickStart">very helpful instructions</a> which outline how to get and set up the latest development snapshot. Please note that in addition to the instructions, you need to set your JRUBY_HOME environment variable. Under Windows, do something like this:</p>
<p>set JRUBY_HOME=c:\jruby</p>
<p>If you&#8217;d prefer not to use the snapshot, you can get the source code through subversion from: </p>
<p><a href="http://svn.codehaus.org/jruby/trunk/jruby">http://svn.codehaus.org/jruby/trunk/jruby</a></p>
<p>but at the time of this post, you need to run svn checkout or update with &#8220;&#8211;ignore-externals&#8221; to avoid the following error:</p>
<p>Error: URL &#8217;svn://rubyforge.org/var/svn/bfts/bfts/trunk&#8217; doesn&#8217;t exist</p>
<p>Many thanks to <a href="http://blog.nicksieger.com/">Nick Sieger</a> and the <a href="http://archive.jruby.codehaus.org/user">JRuby user mailing list</a> for their help.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/02/26/jruby-setup/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Using floating point variables to represent money =&#62; not a good idea!</title>
		<link>http://jamescrisp.org/2007/02/25/using-floating-point-variables-to-represent-money-not-a-good-idea/</link>
		<comments>http://jamescrisp.org/2007/02/25/using-floating-point-variables-to-represent-money-not-a-good-idea/#comments</comments>
		<pubDate>Sun, 25 Feb 2007 10:59:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Java]]></category>

		<category><![CDATA[C#]]></category>

		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=42</guid>
		<description><![CDATA[I was reading through some code the other day and was surprised to find that it was using doubles to represent  dollar amounts. Reason for the alarm bells is that doubles and floats cannot accurately represent many decimal fractions (eg, 0.1), since doubles and floats internally work with powers of 2 rather than powers [...]]]></description>
			<content:encoded><![CDATA[<p>I was reading through some code the other day and was surprised to find that it was using doubles to represent  dollar amounts. Reason for the alarm bells is that doubles and floats cannot accurately represent many decimal fractions (<span class="blsp-spelling-error" id="SPELLING_ERROR_0">eg</span>, 0.1), since doubles and floats internally work with powers of 2 rather than powers of 10. These inaccuracies are likely to lead to significant errors, especially when performing arithmetic (<span class="blsp-spelling-error" id="SPELLING_ERROR_1">eg</span>, adding up a table of dollar amounts). See this <a href="http://www2.hursley.ibm.com/decimal/decifaq1.html#inexact">IBM article</a> for a more <span class="blsp-spelling-corrected" id="SPELLING_ERROR_2">in depth</span> explanation and examples. The solution is to use types that work with powers of ten internally. In C#, you can use &#8216;decimal&#8217; and in Java or Ruby, &#8216;<span class="blsp-spelling-error" id="SPELLING_ERROR_3">BigDecimal</span>&#8216;, to avoid these problems.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2007/02/25/using-floating-point-variables-to-represent-money-not-a-good-idea/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Thai Ordering and Development Mode vs Production Mode for Rails Apps</title>
		<link>http://jamescrisp.org/2006/11/30/thai-ordering-and-development-mode-vs-production-mode-for-rails-apps/</link>
		<comments>http://jamescrisp.org/2006/11/30/thai-ordering-and-development-mode-vs-production-mode-for-rails-apps/#comments</comments>
		<pubDate>Thu, 30 Nov 2006 11:31:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=29</guid>
		<description><![CDATA[A while back, I wrote a little rails app for Thai food ordering at my work. My colleagues place orders using the system and then bring money to the nominated orderer of the week. Once all orders are in and paid for (this is also tracked in the app), the orderer rings up our favourite [...]]]></description>
			<content:encoded><![CDATA[<p>A while back, I wrote a little rails app for Thai food ordering at my work. My colleagues place orders using the system and then bring money to the nominated <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_0">orderer</span> of the week. Once all orders are in and paid for (this is also tracked in the app), the <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_1">orderer</span> rings up our favourite Thai restaurant (<a href="http://www.laddas.com.au/"><span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_2">Laddas</span></a>) and places the order.</p>
<p>I have the app running from fairly cheap shared hosting. At peak times during the ordering, I guess that they&#8217;d be 15 or so people simultaneously using the app. We&#8217;ve used it many times without problems. Thus, I was quite surprised and displeased (as were my colleagues), when my hosting account was suspended and we couldn&#8217;t see what had been ordered this morning. A hasty email to my hosting provider revealed that my account had been suspended due to high load and &#8220;ruby flooding&#8221;. They were kind enough to <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_4">un</span>-suspend my account and we completed the ordering process.</p>
<p>I remembered seeing something about production mode in &#8216;environment.<span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_5">rb</span>&#8216;. Some googling confirmed my hunch - in development mode, rails apps are much more resource intensive. Caching is not used, and every single file needs to be reloaded every time it is required. After changing my app to production mode, it seemed to run <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-corrected" id="SPELLING_ERROR_6">noticeably</span> faster. <a href="http://here.the.ycros.be/">Michael</a> and I ran &#8216;top&#8217; and it looked like each request used less CPU.</p>
<p>So, should you be in a similar situation, this is how to change your app to production mode on fast-<span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_7">cgi</span> Apache shared hosting:
<ol>
<li>Confirm that &#8216;database.<span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_8">yml</span>&#8216; in your <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_9">app&#8217;s</span> &#8216;<span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_10">config</span>&#8216; directory has a section for production mode, and that it has up to date database connection details.</li>
<li>Edit &#8216;environment.<span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_11">rb</span>&#8216; in your <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_12">app&#8217;s</span> &#8216;<span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_13">config</span>&#8216; directory.</li>
<li>Add this line:
<pre>     <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_14">ENV</span>[&#8217;RAILS_<span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_15">ENV</span>&#8216;] ||= &#8216;production&#8217;</pre>
</li>
<li>Run &#8216;<span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_16">ps</span> -u [your_user_name]&#8217; to find if you have any &#8216;dispatch.<span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_18">fgi</span>&#8216; processes running.</li>
<li>If so, kill all of them (they&#8217;ll restart and use your new <span onclick="BLOG_clickHandler(this)" class="blsp-spelling-error" id="SPELLING_ERROR_19">config</span> settings).</li>
<li>Browse to your app, it should now run faster.</li>
</ol>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2006/11/30/thai-ordering-and-development-mode-vs-production-mode-for-rails-apps/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Rails and the initialize() method</title>
		<link>http://jamescrisp.org/2006/09/10/rails-and-the-initialize-method/</link>
		<comments>http://jamescrisp.org/2006/09/10/rails-and-the-initialize-method/#comments</comments>
		<pubDate>Sun, 10 Sep 2006 13:43:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=21</guid>
		<description><![CDATA[I spent a bit of time this weekend on a pet rails project. I came across a strange error when trying to create new records through the application. Editing was working just fine, but creating a new record just seemed to hang.
Breakpoints came to my rescue. In Ruby, they&#8217;re really handy. You can put a [...]]]></description>
			<content:encoded><![CDATA[<p>I spent a bit of time this weekend on a pet rails project. I came across a strange error when trying to create new records through the application. Editing was working just fine, but creating a new record just seemed to hang.</p>
<p>Breakpoints came to my rescue. In Ruby, they&#8217;re really handy. You can put a &#8216;breakpoint&#8217; call anywhere in your code, and if you have a breakpointer process running (start this with the command &#8216;ruby script/breakpointer&#8217;), you jump straight into an interactive ruby console debug session when the breakpoint is hit.</p>
<p>Using the development log and a few breakpoints, I found the that the error was:</p>
<pre>ArgumentError: wrong number of arguments (1 for 0)</pre>
<p>And that it was caused by a line similar to this:</p>
<pre>@order = order.new(params[:order])</pre>
<p>Ie, the controller was creating a new order from the post parameters.</p>
<p>Then all became clear - some time earlier, I&#8217;d overridden the initialize() method in the order to default some dates. My code was similar to this:</p>
<pre>def initializesuper()
  if (@new_record)
    self.validFrom = Date.today
    self.validTo = 1.year.from_now.to_date
  end
end</pre>
<p>Great for creating new objects in my tests and console sessions where I always just created the object and then set properties. However, the controller was relying on passing in the post parameters in the constructor.</p>
<p>The solution is to accept any number of params and pass these to the base class:</p>
<pre>def initialize(*params)super(*params)
  if (@new_record)
    self.validFrom = Date.today
    self.validTo = 1.year.from_now.to_date
  end
end</pre>
<p>That way, the order can accept the post parameters in its constructor.</p>
<p>I&#8217;m very pleased to say that I can now create new records again!</p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2006/09/10/rails-and-the-initialize-method/feed/</wfw:commentRss>
		</item>
		<item>
		<title>Ruby on Rails Hosting, Setup And Migration</title>
		<link>http://jamescrisp.org/2006/08/19/ruby-on-rails-hosting-setup-and-migration/</link>
		<comments>http://jamescrisp.org/2006/08/19/ruby-on-rails-hosting-setup-and-migration/#comments</comments>
		<pubDate>Sat, 19 Aug 2006 08:18:00 +0000</pubDate>
		<dc:creator>James</dc:creator>
		
		<category><![CDATA[Ruby / Rails]]></category>

		<category><![CDATA[Technical]]></category>

		<guid isPermaLink="false">http://jamescrisp.org/wordpress/?p=13</guid>
		<description><![CDATA[I&#8217;ve been doing a little rails of late.. Here&#8217;s a summary of the stuff that I&#8217;ve learnt.
What hosting should I use in Australia for rails?
NOT JUMBA - SEE UPDATED REVIEW BELOW
I&#8217;m using jumba (http://www.jumba.com.au). Jumba is very cheap (~$30AUD/year), and they give you shell access, mysql etc. However, there was a period of several weeks [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been doing a little rails of late.. Here&#8217;s a summary of the stuff that I&#8217;ve learnt.</p>
<p><span style="font-weight: bold;">What hosting should I use in Australia for rails?</p>
<p><span style="color: rgb(255, 0, 0);">NOT <span class="blsp-spelling-error" id="SPELLING_ERROR_0">JUMBA</span> - SEE UPDATED REVIEW BELOW</span></p>
<p></span>I&#8217;m using <span class="blsp-spelling-error" id="SPELLING_ERROR_1">jumba</span> (http://www.jumba.com.au). <span class="blsp-spelling-error" id="SPELLING_ERROR_2">Jumba</span> is very cheap (~$30<span class="blsp-spelling-error" id="SPELLING_ERROR_3">AUD</span>/year), and they give you shell access, <span class="blsp-spelling-error" id="SPELLING_ERROR_4">mysql</span> etc. However, there was a period of several weeks when they moved me to some server without an install of rails and kept promising to install rails and never did. I finally got them to move me back to their main server which has rails installed. It was a painful process, so I&#8217;m not sure if I would recommend them. That being said, things are going OK at the moment, and I&#8217;ve got a few development apps up and running on their service.<span style="font-weight: bold;"><br /></span><br /><span style="color: rgb(255, 0, 0);"><span style="font-weight: bold;">UPDATE 29 March 2006: </span><span class="blsp-spelling-error" id="SPELLING_ERROR_5">Jumba</span> summarily stopped rails support without notice and was rude when I contacted them about it. I would not recommend <span class="blsp-spelling-error" id="SPELLING_ERROR_6">Jumba</span> for web hosting anything - they have frequent down time, server switches and reboots and their low price is made up for by the amount of time you waste. They used to be OK, but no longer. I&#8217;m in the market for a new host, will post on how it goes.</span></p>
<p><span style="font-weight: bold;">How to set up rails applications in your home directory (in public_html) under a UNIX/Apache/<span class="blsp-spelling-error" id="SPELLING_ERROR_7">cgi</span>/<span class="blsp-spelling-error" id="SPELLING_ERROR_8">fcgi</span> environment</span><span style="font-weight: bold;"></span>
<ol>
<li>Upload or create your application in your home directory. <span class="blsp-spelling-error" id="SPELLING_ERROR_9">Eg</span>, ~/<span class="blsp-spelling-error" id="SPELLING_ERROR_10">MyRailsApp</span>/</li>
<li>In your public_html directory, create a soft link to the public directory of your app. <span class="blsp-spelling-error" id="SPELLING_ERROR_11">Eg</span>,<br /><span class="blsp-spelling-error" id="SPELLING_ERROR_12">ln</span> -s ~/<span class="blsp-spelling-error" id="SPELLING_ERROR_13">MyRailsApp</span>/public ~/public_html/<span class="blsp-spelling-error" id="SPELLING_ERROR_14">MyRailsApp</span></li>
<li>Make sure dispatch.<span class="blsp-spelling-error" id="SPELLING_ERROR_15">fcgi</span> in the ~/<span class="blsp-spelling-error" id="SPELLING_ERROR_16">MyRailsApp</span>/public directory is executable. If not, <span class="blsp-spelling-error" id="SPELLING_ERROR_17">chmod</span> it a+x.</li>
<li>Confirm that dispatch.<span class="blsp-spelling-error" id="SPELLING_ERROR_18">fcgi</span> has a valid path to ruby on the first line. If you&#8217;ve created this project on another machine, you&#8217;ll quite possibly need to update the path. The path is often something like &#8216;#!/<span class="blsp-spelling-error" id="SPELLING_ERROR_19">usr</span>/local/bin/ruby&#8217;, but check what it is under your system with &#8216;which ruby&#8217;. Special note for <span class="blsp-spelling-error" id="SPELLING_ERROR_20">InstantRails</span> users - you&#8217;ll always need to update the path when uploading to <span class="blsp-spelling-error" id="SPELLING_ERROR_21">unix</span> hosting, as instant rails uses a windows style path with the slashes the other way around.</li>
<li>Update your &#8216;database.<span class="blsp-spelling-error" id="SPELLING_ERROR_22">yml</span>&#8216; file (in the &#8216;<span class="blsp-spelling-error" id="SPELLING_ERROR_23">config</span>&#8216; directory of your app) with correct database names, user names and passwords.</li>
<li>Run &#8216;dispatch.<span class="blsp-spelling-error" id="SPELLING_ERROR_24">fcgi</span>&#8216; (in the &#8216;public&#8217; directory of your app). If you see an &#8216;Internal Server Error&#8217; message, you know things are going OK. If you&#8217;ve got the path to ruby wrong on the first line, or some other similar problem, you&#8217;ll find out about it here, where as if you run through the web, you don&#8217;t get these sorts of problems reported in an easy to understand way.</li>
<li>Check out your running system in the browser (<span class="blsp-spelling-error" id="SPELLING_ERROR_25">eg</span>, browse to http://myhostingcompany.com/MyRailsApp/)</li>
</ol>
<p><span style="font-weight: bold;">Tips for trouble shooting rails errors<br /></span>
<ol>
<li>A good place to start is by reading your logs in the &#8216;log&#8217; directory of your rails app. If you&#8217;re running a development configuration, have a read of &#8216;development.log&#8217;.</li>
<li>Try manually running &#8216;dispatch.<span class="blsp-spelling-error" id="SPELLING_ERROR_26">fcgi</span>&#8216; in the &#8216;public&#8217; directory of your app. If you get an &#8216;Internal Server Error&#8217; message printed out on the console, it&#8217;s probably working <span class="blsp-spelling-error" id="SPELLING_ERROR_27">ok</span>. Alternatives to this are reports of missing files and unable to find ruby - often these aren&#8217;t shown when browsing to your web site.</li>
</ol>
<p> <span style="font-weight: bold;"><br />Rails problems and solutions</span><span style=""></p>
<p><span style="font-style: italic;">1. Browser and logs show: Application Error - Rails app failed to start properly </span></span><span style="font-style: italic;">&#8221; </span><span style="font-style: italic;"><br /></span><br />I got this after my app was moved from one <span class="blsp-spelling-error" id="SPELLING_ERROR_28">unix</span> host to another by my hosting company. I tried heaps of stuff to try and resolve this. Eventually I created a brand new dummy project on the <span class="blsp-spelling-error" id="SPELLING_ERROR_29">unix</span> host called &#8216;Test&#8217; and Test worked fine from the browser. I then tried my original project again and suddenly it worked fine! It has been working fine since. I can only imagine that there was some sort of problem in temporary files or similar which got flushed. No good explanation for this currently.<span style="font-style: italic;"><br /></span><span style="font-size:85%;"></p>
<p></span><span style="font-style: italic;">2. in `start_engine&#8217;: undefined method `add_path&#8217; for Controllers:Module (<span class="blsp-spelling-error" id="SPELLING_ERROR_30">NoMethodError</span>)</p>
<p></span>I got this one when migrating a project from rails 1.1 to a later version of rails. The solution is to force update your rails engines:</p>
<p><span style=";font-family:courier new;font-size:85%;"  >script/<span class="blsp-spelling-error" id="SPELLING_ERROR_31">plugin</span> source http://svn.rails-engines.org/plugins</span><span style="font-size:85%;"><br /></span><span style=";font-family:courier new;font-size:85%;"  >script/<span class="blsp-spelling-error" id="SPELLING_ERROR_32">plugin</span> install engines &#8211;force</span><span style="font-size:85%;"><br /></span><span style=";font-family:courier new;font-size:85%;"  >script/<span class="blsp-spelling-error" id="SPELLING_ERROR_33">plugin</span> install <span class="blsp-spelling-error" id="SPELLING_ERROR_34">login</span>_engine &#8211;force</span></p>
<p><span style="font-style: italic;">3. My app works fine if there is a trailing slash on the <span class="blsp-spelling-error" id="SPELLING_ERROR_35">url</span>. Otherwise, I get a &#8216;Bad Request&#8217; error page. <span class="blsp-spelling-error" id="SPELLING_ERROR_36">Eg</span>, &#8216;http://myhost.com/myapp/&#8217; works, but &#8216;http://myhost.com/myapp&#8217; does not work.</p>
<p></span>Add a <span class="blsp-spelling-error" id="SPELLING_ERROR_37">RewriteRule</span> to the .<span class="blsp-spelling-error" id="SPELLING_ERROR_38">htaccess</span> file in your application&#8217;s public folder:<span style="font-style: italic;"><br /></span>    <span class="blsp-spelling-error" id="SPELLING_ERROR_39">RewriteRule</span> ^.*<span class="blsp-spelling-error" id="SPELLING_ERROR_40">myapp</span>$    http://%{HTTP_HOST}/myapp/ [R=301,L]</p>
<p>My basic .<span class="blsp-spelling-error" id="SPELLING_ERROR_41">htaccess</span> rewrites are as follows:<br /><span style=";font-family:courier new;font-size:85%;"  ><span class="blsp-spelling-error" id="SPELLING_ERROR_42">RewriteEngine</span> On</span><span style="font-size:85%;"><br /></span><span style=";font-family:courier new;font-size:85%;"  ><span class="blsp-spelling-error" id="SPELLING_ERROR_43">RewriteRule</span> ^.*<span class="blsp-spelling-error" id="SPELLING_ERROR_44">myapp</span>$ http://%{HTTP_HOST}/myapp/ [R=301,L]</span><span style="font-size:85%;"><br /></span><span style=";font-family:courier new;font-size:85%;"  ><span class="blsp-spelling-error" id="SPELLING_ERROR_45">RewriteCond</span> %{REQUEST_<span class="blsp-spelling-error" id="SPELLING_ERROR_46">FILENAME</span>} !-f</span><span style="font-size:85%;"><br /></span><span style=";font-family:courier new;font-size:85%;"  ><span class="blsp-spelling-error" id="SPELLING_ERROR_47">RewriteRule</span> ^(.*)$ dispatch.<span class="blsp-spelling-error" id="SPELLING_ERROR_48">fcgi</span> [<span class="blsp-spelling-error" id="SPELLING_ERROR_49">QSA</span>,L]</span></p>
<p>I tried removing the <span class="blsp-spelling-error" id="SPELLING_ERROR_50">RewriteCond</span> !-f, and my pages lost their styles. I think the condition allows the rails framework to load .<span class="blsp-spelling-error" id="SPELLING_ERROR_51">css</span> files directly without having the requests go through dispatch.<span class="blsp-spelling-error" id="SPELLING_ERROR_52">fcgi</span>.<br /><span style="font-weight: bold;"></span></p>
]]></content:encoded>
			<wfw:commentRss>http://jamescrisp.org/2006/08/19/ruby-on-rails-hosting-setup-and-migration/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
