More Where Clause goodness.

Posted by ezmobius Wed, 04 Jan 2006 23:44:00 GMT


I have been working on the where plugin some more trying to make the syntax a bit more natural ruby. Here is what the latest version looks like to use:

Model.find_with_conditons( :all, :limit => ..., :order => ... ) do 
  foo == 'bar'       # ["foo = ?", 'bar]
  baz <=> (1..100)   # ["baz BETWEEN ?AND ?", 1,100]
  woo =~ 'substri%'  # ["woo LIKE ?", 'substri%']
  id === (1..4)      # ["id IN (?)", [1,2,3,4]]
  fiz < 10           # lt, gt, leq, geq, etc., should all "just work" 
end

I like this because now it really just looks like ruby. Gotta love using the spaceship operator <=> to sugnify a [BETWEEN ? and ?, 1, 10]! The =~ or regex match operatpr in ruby gets converted into a LIKE query in the db. Also just added IN (?) support using the === operator. And you can still use :limit, :order and :joins plus :all or :first and it just works. I still need to convert the tests to use the new syntax so that will be done this weekend.

You can get the development version here if you want to play now. Or wait until the weekend when I add a few more features like the ability to use OR instead of AND for arbitrary items in the :conditions clause.

http://OpenSVN.csie.org/ezra/rails/plugins/ez_where

Posted in ,  | 6 comments

A symbol is an object with a name.

Posted by ezmobius Wed, 28 Dec 2005 06:24:32 GMT

Jim Weirich has a great post here about symbols and how they are not just immutable strings. This question comes up for most newbies to rails because of the heavy use of symbols for option hash constructs.

Posted in ,  | 5 comments

A community effort book

Posted by ezmobius Tue, 20 Dec 2005 23:07:00 GMT


So i am busy writing my book over here. It’s a ton of work let me tell you. But it is going to be very rewarding.

The book is turning out to be a community effort of sorts. I have a few of my favorite and most respected rails developers writing parts of the book(topfunky & technoweenie) and the author of the great lighttpd webserver is going to personally cover the configuration of lighty in detail.

So if you don’t see me on the rails list or on #rubyonrails as much anymore you know where I went ;-)

Posted in , , , ,  | Tags , , , ,  | 5 comments

Rails One Point Oh Yeah!

Posted by ezmobius Wed, 14 Dec 2005 18:21:00 GMT


Well Rails 1.0 was released yesterday to much fanfare. Three cheers for the whole core team and everyone else involved!

It has been a great ride for me to see rails grow into such a thriving community. I have been ‘on’ rails for 14 months now and let me tell you, it’s come a long way baby! The quality of coding that goes on in this circle has brought the life and fun back into web development for me and many other refugees from other P & J languages.

And to top it off, my biggest raisl project to date, The YakimaHerald.com Website made it onto the new Raisl 1.0 web page in the featured applications area. Sweet!

Once again I tip my hat to you DHH and to everyone else working on or with rails for a better future.

Posted in ,  | no comments

The book is a go!

Posted by ezmobius Wed, 14 Dec 2005 18:12:00 GMT


So I have great news! I am going to be writing a book for the Pragmatic Programmers. This is such a great chance for me that there was no way I could pass on it.

Thank you for all the support and people who commented that they would like to have this book written. Its definitely one area where the rails docs are not sufficient as well as being very fragmented and hard to decipher which way is the way to go.

Now I must buckle down and write the thing! But I am totally looking forward to this book and I have some great people working on it with me. It looks like there will be 3 people writing a chapter on two on things they know a lot about. I can’t say just yet who they are but when the time comes I will let on.

I am so honored that the Pragmatic Programmers are giving me this opportunity. And I will be working on the book with some of the rails devs that I most respect.

So check back often and i will give updates as things get closer to beta. Thanks for all the support. I hope that this book will be an valuable asset to rails programmers that are ready to step things up to the next level.

Posted in , , , ,  | Tags , , , ,  | 17 comments

Rails Deployment Configuration Book

Posted by ezmobius Fri, 09 Dec 2005 18:31:00 GMT


EDIT: This book has been picked up by the pragmatic programmers. It will be available as a beta book pdf for download in March. Then the final printed version should be available in early summer. Thanks for all the interest and stay tuned for more announcements.


I’m thinking about writing a small sized book on rails development and production environment configuration. Sometimes it seems like every other question on the rails mailing list and on #rubyonrails is about fcgi or server setup or some issue with deploying or installing rails and friends.

I have spent a great deal of my time with rails on getting the configuration of the server and underlying architecture running just right. And it seems that most information about this stuff is spread out over the rails wiki and hundreds of other blogs out there.

I already have quite a bit of this stuff written in my notes and I have written a few detailed tutorials here on my blog as well. But I have started organizing this stuff in a high level overview and have written the first few chapters of this book already.

My question is this: Would you be interested in purchasing a book like this? It will most likely be released as a DRM Free PDF only at first unless I get a publisher interested. I have sent a proposal to the wonderful PragmaticProgrammers.com for me to write one of their Pragmatic Friday PDF’s. I hope they will take me up on it ;-)

I think this is one area of rails development that gets swept to the wayside and doesn’t get nearly enough attention. And the info that is available is fragmented and contradictory at best.

Here is a very preliminary table of contents:

  • Intro to rails environments and overview of what we will cover in the book.
  • Installation of your development environment on all the major platforms(OSX, Linux, BSD, Windows)
  • Practical techniques for development on your own or working with other developers remotely.
  • Migrations
  • Production Environment Theory
  • Apache/FastCGI or SCGI
  • Lighttpd/FastCGI or SCGI
  • Daedalus/Daemon Tools and friends for keeping your servers running no matter what.
  • Switchtower
  • Other Helpful Tools for Your Arsenal.
  • Shared Hosting.
  • VPS or Dedicated Hosting.
  • Stories of Successful Rails Applications Already Running in the Real World.
  • The Impact of Ajax Techniques on Your Server Load
  • Code Snippets and Samples for Accomplishing Things the “Rails Way” and Making Sure You Make Sane Decisions that Will Scale Later.
  • But Can Rails Scale? ;-)
  • Wrapup and Discussion of High Level System Overviews.

    So please leave comments about anything I might be missing that you would like to see in a book like this. And if anyone want to help out and thinks they could write a chapter or two on something they know a lot about I am all ears. And do you folks think this would be a good idea and worth spending a significant amount of my time on?

    Thank you for any suggestions or comments.

Posted in , , , ,  | Tags , , , , , , , , ,  | 107 comments

RubyConf Files resurrected!

Posted by ezmobius Thu, 01 Dec 2005 18:15:00 GMT

I have rescued the rubyconf audio and video files from the depths of a hacked server and I post them here for future reference. Sorry for the interruption in service. This will hopefully be a little more permanent home for these files.

Click through for the list of links…

Read more...

Posted in ,  | Tags , ,  | 12 comments

Rails/Lighttpd Hosting Panel.

Posted by ezmobius Wed, 30 Nov 2005 16:31:00 GMT

I have started work on a pet project to build a lightweight hosting control panel for rails/lighttpd servers. I am interested to see if there is interest in a project like this.

I plan on making it so you can create rails projects and start and stop lighttpd and your fcgi processes. Basically a web based panel similar to Locomotive.

So my questions are… What other features would people like to see in a set up like this? I’m thinking of also letting you run your rake tasks and get them pretty printed to the interface and also allow switchtower commands.

Thoughts?

Also this is a call to arms for anyone who would like to join this project to help out. Interface design or ruby/rails skills would be most welcome. Or leave a comment if you want to help test as well.

Posted in , , , ,  | 9 comments

The Perfect Lightweight Rails/Lighttpd/Debian install

Posted by ezmobius Sun, 13 Nov 2005 07:31:00 GMT


OK folks, I have finished my write up of an install of the perfect stack on a rimuhosting.com xen VPS. But keep in mind that you can use these instructions to install the rails stack on debian on a dedicated host or a box in your closet. It will work for wherever the box is. So without further ado, I present you with instructions for installing a stack of software as follows:


Ruby
Gems
Rails
ImageMagick
Rmagick
mysql
mysql-ruby bindings
sshd
sftp
fastcgi-dev kit
fastcgi-ruby bindings
perl-compat-regex(for lighttpd)
lighttpd 1.4.7 with fastcgi
subversion client and server
postfix email server with
Webmin Control Panel set up with a bunch of modules for ssh 
and postfix as well as webmail.
Whatever else is needed 
along the way as dependencies

Ed: I have reformatted the tutorial with the help of Sean Schertell. It's much better looking and easier to read now. I also want to make it clear that The Imagemagick and RMagick that get installed with my instructions are fully functional. I have tested it with .jpg, .gif, .png and .tiff files by resizing and converting between all those formats and it works perfectly.

If anyone has suggestions for things to add to the setup to make it even better, please leave suggestions in the comments and I will try to add it to the tutorial.

The Perfect Rails VPS

Posted in , , ,  | 26 comments

Rails VPS servers at rimuhosting.com

Posted by ezmobius Fri, 11 Nov 2005 23:51:00 GMT



I have been setting up VPS servers at rimuhosting.com. These guys have really nice prices on Xen based virtual private servers. This blog runs on one of them. I am putting together some documentation on setting up your own debian sarge based VPS for rails/lighttpd development and deployment.

There is a need for rails hosting like this as rails does not lend itself very well to run on shared hosting plans. Textdrive is a great example of this. They are a great host and I like them in general but their uptime lately is dreadful. I have clients with lifetime accounts that are upset that its impossible to run a production site on TextDrive.

The two servers that I am familiar with are Gilford and Nelson. Both of these seem to go offline multiple times a week. Argg! Can’t have that and keep clients happy.

So the best solution I have come up with is to use either VPS or dedicated servers for raisl work. Xen performance is truly a thing of beauty. It comes close to a dedicated solution. And I have a great system for setting up a minimal debian system with just the essentials:

ruby, gems, rails, mysql or postgresql, postfix, subversion, lighttpd, fcgi and all the goodies to tie all those packages together. With this set up you end up with a lean and mean rails machine!

I have found that with this setup the $29 plan at rimu will happily run an install of typo and about 2 -3 other decent sized rails apps and some other static html sites or what-have-you. And it will do so very fast. Lighty really shines in this environment since it is so light on resources. So I don’t even install apache and all its bloat so it doesn’t sit there eating RAM.

Mysql or postgresql are the most memory intensive parts of the whole equation. So hand tuning these db engines to run well on a memory restrictive VPS is a little bit of a challenge but well worth the rewards.

Stay tuned for a detailed write up of the complete setup process of a rimu VPS from scratch. I will be taking notes on an install this weekend and will post them here shortly.

Posted in , ,  | 7 comments

Older posts: 1 2