<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>lando.blog &#187; Rails</title>
	<atom:link href="http://www.landoweb.com/tag/rails/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.landoweb.com</link>
	<description>The ramblings of an almost madman</description>
	<lastBuildDate>Mon, 28 Jun 2010 09:42:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0</generator>
		<item>
		<title>Starting Your Own Online Business Video &#8211; DHH</title>
		<link>http://www.landoweb.com/2009/07/14/starting-your-own-online-business-video-dhh/</link>
		<comments>http://www.landoweb.com/2009/07/14/starting-your-own-online-business-video-dhh/#comments</comments>
		<pubDate>Tue, 14 Jul 2009 12:19:54 +0000</pubDate>
		<dc:creator>Landon</dc:creator>
				<category><![CDATA[Business]]></category>
		<category><![CDATA[Rantings]]></category>
		<category><![CDATA[Startups]]></category>
		<category><![CDATA[funny]]></category>
		<category><![CDATA[cash]]></category>
		<category><![CDATA[entrepreneur]]></category>
		<category><![CDATA[money]]></category>
		<category><![CDATA[products]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[rich]]></category>
		<category><![CDATA[startup]]></category>
		<category><![CDATA[tech]]></category>
		<category><![CDATA[video]]></category>

		<guid isPermaLink="false">http://www.landoweb.com/?p=351</guid>
		<description><![CDATA[This video was originally recorded in 2008 and I watched it way back when it was first done but I think it is a very good presentation that pushes through the shit and gets down to the basics &#8211; which is to start a business that provides a product that is useful and you can [...]]]></description>
			<content:encoded><![CDATA[<p>This video was originally recorded in 2008 and I watched it way back when it was first done but I think it is a very good presentation that pushes through the shit and gets down to the basics &#8211; which is to start a business that provides a product that is useful and you can actually charge for &#8211; yeah charge for! In the web world that may seem crazy but it&#8217;s what myself and <a title="Carl Crowder" href="http://www.carlcrowder.com/blog" target="_blank">Carl</a> have been banging on about forever now it would seem. People will and should pay for something that is useful for them.</p>
<p>Anyway, find the time to watch this presentation from the Startup School 08 by David Heinemeier Hanson. For those that don&#8217;t know him he created the Rails framework and has some very successful products (basecamp) over at 37Signals. It is also quite a funny presentation.</p>
<p><object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="520" height="276" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"><param name="bgcolor" value="#FFFFFF" /><param name="quality" value="high" /><param name="allowscriptaccess" value="always" /><param name="allowfullscreen" value="true" /><param name="src" value="http://www.omnisio.com/bin/Embed.swf?embedID=bwzZYgCgSr3O1fadbiFy2w" /><embed type="application/x-shockwave-flash" width="520" height="276" src="http://www.omnisio.com/bin/Embed.swf?embedID=bwzZYgCgSr3O1fadbiFy2w" allowfullscreen="true" allowscriptaccess="always" quality="high" bgcolor="#FFFFFF"></embed></object></p>
]]></content:encoded>
			<wfw:commentRss>http://www.landoweb.com/2009/07/14/starting-your-own-online-business-video-dhh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Java Rocks (and Sucks)</title>
		<link>http://www.landoweb.com/2009/05/06/java-rocks-and-sucks/</link>
		<comments>http://www.landoweb.com/2009/05/06/java-rocks-and-sucks/#comments</comments>
		<pubDate>Wed, 06 May 2009 12:58:31 +0000</pubDate>
		<dc:creator>Landon</dc:creator>
				<category><![CDATA[Development]]></category>
		<category><![CDATA[developing Java web apps]]></category>
		<category><![CDATA[django]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[Java Framework]]></category>
		<category><![CDATA[open source]]></category>
		<category><![CDATA[Rails]]></category>

		<guid isPermaLink="false">http://www.landoweb.com/?p=247</guid>
		<description><![CDATA[I have been helping out a friend by creating some software for a business that he is starting. Once again I have been going through the process of choosing a suitable platform but, to be honest I wish I hadn&#8217;t bothered now. I had been trying to convince myself to use Java because I love [...]]]></description>
			<content:encoded><![CDATA[<p>I have been helping out a friend by creating some software for a business that he is starting. Once again I have been going through the process of choosing a suitable platform but, to be honest I wish I hadn&#8217;t bothered now. I had been trying to convince myself to use Java because I love it &#8211; mainly because it is ace, has the potential to rock and because I know it best (perhaps the last one is more of an objective reason). So why is it that I have not yet used it for any of my own web projects? Developing Java web apps? Because I think it is just too much hassle to get going. There is so much stuff to setup even before you actually start coding it puts me off every time. I want to be able to get going immediately with what&#8217;s in my head. The last time I gave Java a chance I got that bored after having set everything up and learning what everything was that I gave up with the project pretty much soon after. I just keep wishing that someone would start a Java framework/platform from the ground up that is not based on JEE (well perhaps just some of the best bits). There are no reasons why Java could not have a framework that would trample all over Rails/Django or in the very least be as enjoyable.</p>
<p>It is worth noting though that if I were writing software that was ultimately critical (such as banking software etc) I would not use anything else (.Net would be suitable but it would take a while for me to get to the same level of experience) because this is where all that configuration and power makes sense and allows applications to scale easily, allowing disparate groups from different locations to easily work on the software. The sheer amount of professional tools available for Java projects is also amazing and I have gotten so use to some of them that when writing in another language I miss them. Eclipse is a god send (Netbeans is not too shabby either) and I miss it greatly when working in other languages. This even includes when an eclipse plugin is available to use. They are just never as polished as the standard Java editor, even though a lot of them are very good (so don&#8217;t take this as some sort of insult).</p>
<p>Let&#8217;s face it, in reality most web applications that you work on these days are relatively simple in nature. Usually you are taking information -&gt; processing -&gt; displaying in some simple fashion. For this kind of use why would you need to be running a JEE server + Spring + Framework(struts et al) + &#8230;.. ? Let&#8217;s face it, most companies ditch the full stack servers and go with a plain servlet engine (tomcat). For most projects it always seems like an overkill. I would prefer to see a very simple (but production capable) web server that is capable of running a variety of simple but powerful frameworks that adhere to some standard (like WSGI on python) all written in Java. I think this would increase the use of Java in the web space by a huge amount. Companies that trust Java would choose it over buzz word frameworks any day of the week and for good reason as well.</p>
<p>By the way, all this moaning does not mean that I am saying that any of the other languages or frameworks are rubbish. Quite contrary actually because they have managed to fill this gap that Java could have so easily filled years ago. In the end I decided to use RoR for my friends business just because I could start work on it immediately and show him results. Everyone seems happy with that. For the kind of app it is, it will never go crazy and need to scale like your facebook or twitter so that&#8217;s one less thing to worry about. The application has already been designed so that nothing is shared from the beginning allowing requests to be forwarded to any server providing enough scale for what it will be used for. Using RoR (would be the same with Django) I have managed to get the main application skeleton (different users, authentication, signups with verification/states/file upload, admin sections and much more) up and running within a week of working in my spare time. The last time I tried using Java it took this long just to get up and running.</p>
<p>Some of you might be shouting that it could be that I am lacking experience developing Java web apps, and you would be both right and wrong. I develop software for Java web applications all day long but, they have already been setup and I just add new functionality and fix bugs etc. But why is it that my most experience is with Java but I find it tiresome developing web apps for it? Yet I had no Ruby/Python experience at the time but found the whole experience developing with Rails/Django a much easier and enjoyable experience??</p>
<p>So what does all this mean?? Well if anybody is perhaps interested in rectifying this situation and working on a Java open source web server and framework then leave a comment expressing your interest. If we can get enough people interested (I am guessing about 3-4 people to start with) we might as well go ahead and do it ourselves. It would be interesting, we will learn loads and it will finally shut me up moaning about Java frameworks all the time.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.landoweb.com/2009/05/06/java-rocks-and-sucks/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
		<item>
		<title>Rails Scales (Or Does it?)</title>
		<link>http://www.landoweb.com/2008/07/13/rails-scales-or-does-it/</link>
		<comments>http://www.landoweb.com/2008/07/13/rails-scales-or-does-it/#comments</comments>
		<pubDate>Sun, 13 Jul 2008 16:40:03 +0000</pubDate>
		<dc:creator>Landon</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Rantings]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>
		<category><![CDATA[scaling]]></category>

		<guid isPermaLink="false">http://www.landoweb.com/?p=65</guid>
		<description><![CDATA[Having developed with Rails for a little bit now I have been eager to find out whether Rails in its current 2+ form will actually scale after having heard so much bad press from different areas. I thought that it might be interesting to jot down in one place my findings. One thing that I [...]]]></description>
			<content:encoded><![CDATA[<p>Having developed with Rails for a little bit now I have been eager to find out whether Rails in its current 2+ form will actually scale after having heard so much bad press from different areas. I thought that it might be interesting to jot down in one place my findings. One thing that I would like to say first though is that I am not a great believer in reinventing the wheel. I find that I lot of things that already work fine are being &#8220;railsified&#8221; just for the sake of it, rather than for any particular reason.</p>
<p>1. Speed and Scalability</p>
<p>Firstly Ruby is slower than some of the other popular languages.  A fact not entirely missing in the world, but as most things it is being worked on as we speak. I remember not to long ago people bitching about the speed of Java, but over the many years it&#8217;s been out it has managed to get faster with each new version. A very good article is <a title="On Ruby on Rails Criticism" href="http://antoniocangiano.com/2007/06/19/on-ruby-and-rails-criticism/" target="_blank">&#8220;On Ruby on Rails Criticism&#8221;</a> is a very good article and should be read. He has a very good discussion based on how communities should embrace honest criticism, allowing them to focus on what should be corrected. <span id="more-65"></span>He correctly states that Ruby is slower than python etc, but at no point does he say that it is slow. Being slower than the others doesn&#8217;t necessarily make it &#8220;slow&#8221; but you should consider this when working out what to use for your app.  I find the following paragraphs sum up his article quite well.</p>
<blockquote><p><span class="fixed_width" style="font-size: 0.9em; font-family: Courier,Monospaced;">&#8220;Sometimes the accusations towards Ruby or Rails are just ridiculous and are factually inaccurate. It is important that as a community we debunk these myths and unjustified criticisms. But it&#8217;s just as wrong to react with denial towards genuine criticism. For example if a blog states for the nth time that the Ruby interpreter is slow, there is no point in saying that&#8217;s not true, and that the <a href="http://shootout.alioth.debian.org/">benchmarks on the language shootout</a> are bogus. Sure they may be considered worthless or not too representative of real world performance by some, but let&#8217;s be honest, we know that Ruby is slower than many other languages, why deny it? I&#8217;ve no problem with recognizing that Haskell is much faster than Python and that Python is faster than Ruby in most scenarios. There is nothing to hide or get upset about; Ruby is a wonderfully designed language whose main implementation is currently suboptimal.</span></p></blockquote>
<blockquote><p><span class="fixed_width" style="font-size: 0.9em; font-family: Courier,Monospaced;">Generally speaking, Ruby&#8217;s shortcomings aren&#8217;t sufficient enough grounds to discredit the language as a whole. Pointing this out in an argument is a better strategy than denying the problem a priori. As a matter of fact, I find Ruby to be fast enough for most tasks (on modern architectures), while still recognizing that an equivalent program in C would most likely be much faster. An even better road to take would be to provide examples of how computationally complex problems can be dealt with efficiently in Ruby, highlighting the best practices and the existing workarounds to deal with Ruby&#8217;s current weaker points.&#8221;</span></p></blockquote>
<p>Penny arcade is a popular site mentioned that does use rails and considering that it is pretty much a customized blog it can cache most things easily, and can probably be run from one server quite easily. One thing that I like is that they don&#8217;t re-invent the wheel by trying to &#8220;railsify&#8221; everything else such as the forums. He uses the trusted and proven vBulletin which is more than capable for the job. A forum, like a blog is something that can be cached quite a lot as well so I doubt would run into many scaling problems.</p>
<p>I have read in many places that <a title="Twitter Scaling Issues" href="http://www.radicalbehavior.com/5-question-interview-with-twitter-developer-alex-payne/" target="_blank">Twitter</a> did have problems scaling with their growth, but considering how quickly they grew I could not have imagined it being different for any other platform. The biggest problem facing any large web application is scaling. Take a look at <a title="highscalability.com/" href="http://www.highscalability.com/" target="_blank">highscalability.com</a> which contains a lot of information about scaling and the issues that have plagued the large sites. To be honest, when talking to anyone about scaling on any platform the first thing they will say is &#8220;throw more computers at it&#8221;. Its the basic answer to the ultimate question. High scalability has recently done a twitter <a title="twitter architecture overview" href="http://highscalability.com/scaling-twitter-making-twitter-10000-percent-faster" target="_blank">architecture</a> overview and an interview with Blaine Cook (Twitters lead architect- NB not anymore) and its definitely worth reading as its more up-to-date than most articles. It turns out that twitter do not blame rails in the least:</p>
<blockquote><p><span class="fixed_width" style="font-size: 0.9em; font-family: Courier,Monospaced;">&#8220;For us, it&#8217;s really about scaling horizontally &#8211; to that end, Rails and Ruby haven&#8217;t been stumbling blocks, compared to any other language or framework. The performance boosts associated with a &#8220;faster&#8221;? language would give us a 10-20% improvement, but thanks to architectural changes that Ruby and Rails happily accommodated, Twitter is 10000% faster than it was in January.&#8221;  &#8211; Blaine Cook. (17/01/2008)</span></p></blockquote>
<p>(I would like to point out that Blaine has since left the company. Some have speculated that he was fired because of scaling problems that he was brought in to fix and others say it wasn&#8217;t. Twitter do not actually say anything anywhere to whether they sacked him or not so I will assume for now that he left of his own accord.)</p>
<p>Blaine also has a <a href="http://video.google.com/videoplay?docid=-7846959339830379167" target="_blank">presentation</a> on Google video entitled &#8220;Rails Scales&#8221; and is worth watching for those that have decided to use it as their web framework. One thing that the original article did not mention though is that twitter ran off one database. No wonder they were worried about more connections from the cluster instances <img src='http://www.landoweb.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  . They do still run off of one database (a beastly 8 core server though) so kudos to them for being able to pull that off. From reading the overview you get that these people were inexperienced (like most of us when it comes to scaling) as twitter had originally been a hobby project that went crazy in a matter of months, also compounded by using Rails which was (and suppose still is) a relatively unproven framework compared to Java or even PHP apps. Their problems were basically down to in-expectant traffic and inexperience of scaling systems. The truth is when you read about all the big companies they all suffered major downtime due to scalability issues. A good book to read is &#8220;Founders at Work&#8221; &#8211; 1590597141. It contains interviews with the founders from Paypal, Hotmail, Excite, Yahoo, Blogger.com, Gmail, del.icio.us, craigslist, Flickr and many more. Every single one say that their biggest problem was scaling and lack of experience with how to deal with it. It is a good read and I would recommend it, as it was recommended to me (thanks Ian). So basically there is no magic formula to scaling any kind of technology. You just have to think smart and learn from those that have suffered in the past.</p>
<p>2. The Rails Community.</p>
<p>An open source project does need a good community to keep it going and I believe that there are very good people on board making it better and better. At the same time there are probably loads of people in the community (like many others) who are a little stupid and get things wrong &#8211; whether it be in articles, comments or quite a lot of smugness. Yes the rails in abundantly smug for some reason that I have yet to find out about. At the moment Rails seems to be the new cool thing so that means that all the followers are going to attach themselves to it, its happended to almost all the other technologies I can think of. There was a heap of smugness about using Perl,  Python and PHP but after a while something new comes out and they move onto something else. It has nothing to do with the project and everything to do with the person. Also hype tends to surround things with a little merit. Whether you like Apple or not, they do make some cool things, whether you like rails/ruby or not it does have some cool features and the same can be said for a lot of things.</p>
<p>Ruby does try to keep you to a standard convention which should lead to good design. If you adhere to this way of coding, such as naming tables, models and controllers a lot of the glue will be done for you. The truth is that the methods for this are totally definable by yourself. In my application I do not need the rails glue for some things so I map it together myself. But be under no illusion, rails is very configurable its just that it is good to stick to best practices which can make your life easier. Anyone that has read a good book on rails  or the API would know that it is very configurable for the times when you need to bend the rules. I was originally going to use a Java framework for my project, mainly because it is what I know best. But after spending a few weeks with them rails just seemed like a breath of fresh air. I can also honestly say that the same &#8220;breath&#8221; could have also been gained from using PHP or Python etc. I always found this <a title="j2ee stack trace" href="http://ptrthomas.wordpress.com/2006/06/06/java-call-stack-from-http-upto-jdbc-as-a-picture/" target="_blank">picture</a> of a j2ee stack trace to be very funny (I found it whilst reading this <a title="distributed workers" href="http://mongrel.rubyforge.org/docs/distributed_worker.html" target="_blank">mongrel article on background workers</a>). I absolutely love Java and always will. In fact I love it so much I have been writing my own Java framework (in my little spare time) and have been basing it on the things that I like in Rails and PHP.</p>
<p>3. Poor Documentation.</p>
<p>Now compared to say Java there is no where near as much documentation, but then again Java has loads more stuff. From what I understand documentation was lacking in the earlier versions, but from Rails version 1.2.4 I found it to be very good and now even better with the release of Rails 2.0. I can honestly say that I have managed to find everything I have needed when looking at the api docs so I cant argue with that.</p>
<p>4. Technical limitations with XML SQL..</p>
<p>I would take a guess that there might be problems with the standard Ruby libraries such as XML, but then again Java&#8217;s implementation was not very good for years (could still be for all I know) and the third party libraries were always the best. That&#8217;s why Rails uses another library for XML instead of the standard ruby one. JSON, XML and YAML are all provided in rails models with the ability to create custom ones using the builders (which will 99% of the time). For an easy example I could do the following to return an object as a JSON string to some javascript:</p>
<div class="geshi no ruby">
<div class="head">Example Converter Method</div>
<ol>
<li class="li1">
<div class="de1">person = &#8230;.</div>
</li>
<li class="li1">
<div class="de1"><span class="me1">person</span>.<span class="me1">to_json</span></div>
</li>
</ol>
</div>
<p>This will convert the person object to a JSON string. The same also exists for XML and YAML. Very useful for applications that are AJAX/JSON&#8217;y. One thing that I know for sure is that there will always be problems with standard libraries and that is not going to change in a hurry. What you do is fix it when you find any. Its like any language really, if you are not happy with the standard implementation then write your own. You are able to do this in Ruby like any other language.</p>
<p>I read a post on <a title="Rails google discussion" href="http://groups.google.com/group/comp.lang.lisp/msg/f2c33661b80ba302" target="_blank">Google</a> discussion and one thing immediately stuck in my face as being total crap:</p>
<blockquote><p><span class="fixed_width" style="font-size: 0.9em; font-family: Courier,Monospaced;">&#8220;This means the important, actually hard stuff like handling the stateless nature of HTTP, or sanitising and escaping the user input is just not adressed at all, and you only learn about them when one day you discover 84 possible XSS injection points (actual number from a Rails app I&#8217;m somewhat famililar with).&#8221;</span></p></blockquote>
<p>Rails has great session management and provides you with multiple options. You can choose from cookie, in memory and database management (as well as some third party modules I believe). And its all done with one line in the config. A rake task will even create the correct tables for you so that its all ready to go. Actually it creates a nice database migration for you so that you are able to revert back changes. Just a little feature that most frameworks do not provide as standard and is very useful.</p>
<p>This guy must not know much about Rails. The main design point with rails is the fact that a model handles all actions relating to that data set, such as any interaction methods and, lets wait for it&#8230; Sanitizing user input. It not only provides a set of validation helpers (of which you can write your own custom ones) but also provides a set of hooks for you to write you own methods for testing more complex items. The methods provided include validate, validate_on_create and validate_on_update. There are so many validation points that you sometimes feel guilty for not using them. Just so you know what I am going on about, here is an example of a simple order model that I stole from Agile Web Development with Rails:</p>
<div class="geshi no ruby">
<div class="head">Example Rails ActiveRecord Class</div>
<ol>
<li class="li1">
<div class="de1"><span class="kw1">class</span> Order <span class="sy0">&amp;</span>lt; <span class="re2">ActiveRecord::Base</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">#&#8230; stuff that makes no difference for this example</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; validates_presence_of <span class="re3">:name</span>, <span class="re3">:address</span>, <span class="re3">:email</span>, <span class="re3">:pay_type</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; validates_inclusion_of <span class="re3">:pay_type</span>, <span class="re3">:in</span> <span class="sy0">=&amp;gt;</span>; PAYMENT_TYPES.<span class="me1">map</span> <span class="br0">&#123;</span><span class="sy0">|</span>disp,value<span class="sy0">|</span> value<span class="br0">&#125;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">#&#8230; some other examples</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; validates_format_of <span class="re3">:name</span>, <span class="re3">:with</span> <span class="sy0">=&amp;gt;</span> <span class="sy0">/</span>^\w<span class="sy0">+</span>$<span class="sy0">/</span>, <span class="re3">:message</span> <span class="sy0">=&amp;gt;</span> <span class="st0">&quot;is missing or invalid&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; validates_uniqueness_of <span class="re3">:name</span>, <span class="re3"> <img src='http://www.landoweb.com/wp-includes/images/smilies/icon_surprised.gif' alt=':o' class='wp-smiley' /> n</span> <span class="sy0">=&amp;gt;</span> <span class="re3">:create</span>, <span class="re3">:message</span> <span class="sy0">=&amp;gt;</span> <span class="st0">&quot;is already being used&quot;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">#.. there are probably about another 12 validation helpers and that is not including the hook points</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="co1">#.. hook point methods for extra custom validation</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> validate</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">unless</span> name <span class="sy0">&amp;</span>amp;<span class="sy0">&amp;</span>amp; name =~ <span class="sy0">/</span>^\w<span class="sy0">+</span>$<span class="sy0">/</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; errors.<span class="me1">add</span><span class="br0">&#40;</span><span class="re3">:name</span>, <span class="st0">&quot;is missing or invalid&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">def</span> validate_on_create</div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">if</span> User.<span class="me1">find_by_name</span><span class="br0">&#40;</span>name<span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; &nbsp; errors.<span class="me1">add</span><span class="br0">&#40;</span><span class="re3">:name</span>, <span class="st0">&quot;is already being used&quot;</span><span class="br0">&#41;</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; &nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1">&nbsp; <span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1"><span class="kw1">end</span></div>
</li>
<li class="li1">
<div class="de1"><span class="co1">#.. no point in doing any more I think you all get the point</span></div>
</li>
</ol>
</div>
<p>If you cant find a point in any of that to sanitize the user input then you seriously need to stop working in the IT industry. Most of the ideas were stolen from Hibernate and that is probably the best ORM library available. For a better look at what is going on it is worth watching <a title="rails blog video" href="http://media.rubyonrails.org/video/rails_take2_with_sound.mov" target="_blank">this video</a> by the creator of rails to see just how much validation you can do with rails. He only provides a simple example and it was with one of the original versions of rails, but it is interesting none the less for seeing its useful features.</p>
<p>Since when has XSS had anything directly to do with the framework? Ensuring that you do not fall prey to these kind of attacks is on the system designer not the framework. The framework can provide you with methods for checking but its up to you to still check the input. XSS occurs because of people placing unscrupulous code in the app and not the framework. One welcome feature in rails 2.0 is that its changed its TextHelper:sanitize method from a black list approach to a whitelist approach making it much easier to keep ahead of new exploits. Another neat feature in 2.0 is that they have now protected cookies from <a title="CSRF Attacks" href="http://en.wikipedia.org/wiki/CRSF" target="_blank">Cross Site Request Forgery</a> so you can be sure that the request is coming from your own application. Again something which is not normally available as standard on any other framework.</p>
<p>5. Uncertain Future</p>
<p>There is without a doubt enough momentum that someone will always carry it on just like any other large open source project. Plus there are too many large systems running on it now so they have a vested interest in its survival. I remember reading this <a title="Derek Civers" href="http://www.oreillynet.com/ruby/blog/2007/09/7_reasons_i_switched_back_to_p_1.html" target="_blank">article </a>on Derek Civers a while ago when I first considered using Rails and thinking &#8220;bloody hell that rails must be bad&#8221;. But after reading you realize that he went into it with the wrong intentions and I don&#8217;t think he ever thought why he was switching in the first place. It seemed to be another &#8220;railsify&#8221; moment. He mentions that they never really got to do much on it because as he quotes:</p>
<blockquote><p><span class="fixed_width" style="font-size: 0.9em; font-family: Courier,Monospaced;">&#8220;To be fair to Jeremy&#8217;s mad skillz: many setbacks were because of tech emergencies that pulled our attention to other internal projects that were not the rewrite itself&#8221;</span></p></blockquote>
<p>One of the things I find is that you will find many stories like this. Everyone that reads this blog is most likely to be a computer guy in some way or fashion and you all must know how many projects fail every year, using the most and least popular choice of languages in the largest and smallest companies in the world. But they seem to carry on regardless, and certainly wouldn&#8217;t be scared of one bad story. After all, one persons failure cannot be reflected upon the whole community. If someone completely messes up a Java project, does that mean that Java is rubbish? Of course not, but on the other hand if most people did then it certainly would be. As always it is down to the ability of the person who is coding. I am sure that an excellent programmer could make something good out of the worst language/framework in the world. As they say &#8220;don&#8217;t blame your tools&#8221;.</p>
<p>If you are going to use shared hosting to actually host your application then don&#8217;t bother with Rails at all. (Update: According to a comment I have received from Hongle Lai he says that <a title="DreamHost Rails Shared Hosting" href="http://rails.dreamhosters.com/" target="_blank">DreamHost</a> now has a very good shared host environment so you may want to look into this) Rails was never really designed for that intention and a lot of the time it shows. If you want to go down the shared hosting path I would recommend PHP as it is very good in this environment. I love PHP and think it started a revolution in the web space. There are so many open source projects in PHP it is unbelievable, and a lot of them are amazing like WordPress (this blog uses it). There are no J2EE shared hosts that I can think of and if there were I would not imagine them being particularly good (that&#8217;s putting it nicely) . I can&#8217;t actually think of many JSP shared hosts either thinking about it but that could be because I have never really looked. For the biggest choice of hosts at the best prices I would personally consider PHP as the best option (as I have for this website).</p>
<p>6. Summary</p>
<p>Basically you have to realize that Rails and Ruby are far from perfect, but then so are all the other solutions I have looked at. No one out there has got the perfect solution and probably never will do. My reasons for choosing rails at the time was the ability to quickly create an application that would take me for ever using something else with the ability to really express my thinking semantically. I like the features in Rails as they just seem to make sense the more that you use it, and I really like that. I may have to get an extra server or two in the future, but honestly couldn&#8217;t care less. After you have completely maxed out the obvious options for scaling on the same hardware like caching, virtual servers etc and there is no more juice to squeeze out of a server the only option is to add more machines, but at least rails is ready for clustering from the start (well at least mongrel is) which can make your life that little bit easier later on. Well that&#8217;s as long as you thought about session management from the beginning.</p>
<p>My advice for anyone is to pull your sleeves up and get your hands dirty and find out for yourself. If you don&#8217;t like it, then fair enough &#8211; at least you have reason. Most of the time it makes sense for people to stick to what they know best if that is an option, because trust me, it is a steep learning curve getting to where you were with the other language. Just remember that old chestnut that &#8220;one mans meat is another mans poison&#8221;.</p>
<p>Thank you for reading.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.landoweb.com/2008/07/13/rails-scales-or-does-it/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
<enclosure url="http://media.rubyonrails.org/video/rails_take2_with_sound.mov" length="54364199" type="video/quicktime" />
		</item>
		<item>
		<title>Merb Rules</title>
		<link>http://www.landoweb.com/2008/01/22/merb-rules/</link>
		<comments>http://www.landoweb.com/2008/01/22/merb-rules/#comments</comments>
		<pubDate>Tue, 22 Jan 2008 23:26:40 +0000</pubDate>
		<dc:creator>Landon</dc:creator>
				<category><![CDATA[Coding]]></category>
		<category><![CDATA[Development]]></category>
		<category><![CDATA[Merb]]></category>
		<category><![CDATA[Rails]]></category>
		<category><![CDATA[Ruby]]></category>

		<guid isPermaLink="false">http://www.landoweb.com/?p=64</guid>
		<description><![CDATA[Well I came across a &#8220;problem&#8221; the other day in Rails. It turns out that Rails is not exactly thread safe at the CGI level. What this really means is that it waits for a file upload to finish before another can happen, which for a busy file uploading site is not actually good. But, [...]]]></description>
			<content:encoded><![CDATA[<p>Well I came across a &#8220;problem&#8221; the other day in Rails. It turns out that Rails is not exactly thread safe at the CGI level.  What this really means is that it waits for a file upload to finish before another can happen, which for a busy file uploading site is not actually good. But, since I have read that this is not as big of a deal as you would have thought if using Mongrel because it magically handles multithreading requests and only offloads the request to Rails once it has finished, meaning that it is only blocked whilst being mime parsed etc, which is not that bad. But whilst thinking oh shit I came across Merb, which is another Ruby framework that is really cool and extremely lightweight meaning its nice and fast. It also allows you to pick from a selection of ORM providers such as Sequel, Datamapper and of course ActiveRecord. The main advantage is that it has its own CGI handlers and effectively handles multiple file uploads concurrently which is big benefit.</p>
<p>This does not mean that I am now going to switch over to Merb &#8211; infact not a chance. Rails is now very very good at what it does and has a million plugins that are very useful (most can also be used in Merb) and it is very useful for the actual application side of the system. It has so many useful features that its hard to explain them all. But it does mean that I can use Merb for all file handling activities. Its fast and allows me to handle multiple files effectively. In fact it was my original plan that we would someday move file handling off the main app to another server just so that the system can run the application so much faster. As it turns out, this is what some very heavy traffic sites have begun to do which means the idea isn&#8217;t totally crazy. You might as well let things do what they are good at hadn&#8217;t you? <img src='http://www.landoweb.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' />  Another good thing is that we can share code between the Rails and Merbs apps. Like I said, Merb lets you use ActiveRecord which means all the models are available in both apps without any code duplication so it makes sense.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.landoweb.com/2008/01/22/merb-rules/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
		</item>
	</channel>
</rss>

<!-- Dynamic page generated in 1.021 seconds. -->
<!-- Cached page generated by WP-Super-Cache on 2010-07-29 22:30:03 -->
