Showing posts with label rails. Show all posts
Showing posts with label rails. Show all posts

Wednesday, June 04, 2008

Ruby on Rails article

Just a quick mention that part 1 of my article series on using Rails to write iPhone apps is online at IBM Developerworks.

Parts 2 and 3 will be published sometime in the rather near future.

In other notes, Pathfinder has updated the company blog URL to http://www.pathf.com/blogs. Individual authors now have unique pages, I'm http://www.pathf.com/blogs/noel rappin.

Recent pieces there include a quick welcome to RailsConf, and a two-part article on HTML and code markup in Rails, available here and here.

Monday, May 05, 2008

Rails Development for iPhone with rails_iui

iphone_sim.jpg

I've been doing some web development for iPhone and Mobile Safari lately, not least because of a series of articles that will be showing up in IBM DeveloperWorks soon.

I was using the iUI toolkit, which contains a number of CSS styles and JavaScript event handlers to make iPhone Web apps look and feel somewhat like native iPhone applications. As I was working with iUI, I realized I was building up a library, so I converted everything to a Rails plugin: rails_iui.

Get the plugin from github: git://github.com/noelrappin/rails-iui.git

Right now the plugin is primarily interested in doing a few things:

It contains a rake task to download iUI, move it's files to the Rails public directories, and change the CSS image URL's accordingly.

There's a controller class method acts_as_iphone_controller, calling that sets up a before filter that captures the Mobile Safari user agent string and sets the request format to iphone for use in respond_to blocks. For testing purposes you can call the method as acts_as_iphone_controller(true), and all calls will be treated as iPhone requests.

There is a module of helper methods that are wrapper methods or combinations of iUI CSS classes. Included are:

  • A method for creating the iPhone toolbar at the top of the view.

  • Methods for creating the iPhone list structures from a list of elements that know their associated URLs, including a grouped list in the style of the iPod application

  • Rounded rectangle classes

  • A form helper for the iPhone toggle button, as seen in the settings page.

  • A method to specify an Ajax callback when the phone changes orientation

The short term goals for the project are to tighten the code a bit and improve documentation and testing. Longer term goals are to augment iUI's JavaScript handlers with something a bit friendlier with Rails, particularly in handling history and back behavior.

So take it for a spin, let me know what you think. Hope you find it useful.


Please check out my book, Professional Ruby on Rails.

Wednesday, April 23, 2008

Quick Program Notes

A couple of updates on book and article news...

  1. It looks like the screencast/video thing is going to happen, thanks to Jim Minatel. The main constraint is that they'd like the videos to be about five minutes long. I think the first one will be setting up a Rails project in Subversion (chapter 2 of the book, essentially), and I'd do a remix of that chapter using Git if there's interest. Wiley would like several of these, so I'm open to any topic ideas.

  2. At one point, I think I mentioned here that a .pdf version of the book would be available about six weeks after initial launch. Obviously that hasn't happened yet, and I'm not sure when that might come together.

  3. I'm going to have another series up at IBM Developerworks sometime in the relatively near future on developing iPhone web applications in Rails. More on that as it gets closer.

  4. I'll be attending (but not, alas, presenting at) RailsConf this year in Portland. Since it's an O'Reilly run conference, there won't be an official Wiley presence, but I'm hoping to have some book-related activity there.

Monday, April 21, 2008

Two Parter on Hide And Seek

Two articles on the Pathfinder blog on adding show and hide toggles to a Rails application:

http://blogs.pathf.com/agileajax/2008/04/hide-and-go-see.html

http://blogs.pathf.com/agileajax/2008/04/hide-seek-and-s.html

Wednesday, April 16, 2008

Video Still Working On Killing The Radio Star

Annnddd... This, of course, is what I get for posting anything about Wiley late at night without checking. Jim Minatel from Wiley added the following comment:

Noel: I'm interested in getting Wrox authors to to videos related to their books.... I can tell you what's involved and see what we can do.

So, contacting in progress. Further bulletins as events warrant. Or as events don't warrant, I think further bulletins are inevitable.

Thanks, random blog commenter, for pushing me forward on this.

Monday, March 03, 2008

Using Active Record For Migrations

New post on the pathfinder blog:

Using ActiveRecord to Migrate Legacy Data

Enjoy!

Tuesday, February 26, 2008

Buy My Book! (Please?)

223888 cover_df.pdf (3 pages).jpgThis week, my book Professional Ruby on Rails will be officially released. You can see sample chapters here, and you can buy the book at Amazon (affiliate link).

This book is designed to meet the needs of an intermediate to advanced Ruby on Rails user. The first wave of Rails books could not assume that the user had any pre-existing knowledge of Rails. As a result, they spent a lot of time covering the basics. The target reader for this book is somebody who has already read one of the basic books and now has to apply this knowledge to building a complete web site all the way from conception to deployment.

Written over the summer and fall, all the sample code in the book uses Rails 2.x, specifically including RESTful structures, respond_to, new migrations, cookie-based sessions, and other new features.

The book covers the kinds of tasks that nearly every site needs to handle -- user models, database performance, time zones and internationalization, creating common JavaScript navigation elements, REST web services, and graphics. Where there are commonly used plugins to support those features, the book covers those as well.

In addition to the application itself, there are other parts of the Rails life cycle. The book covers many of these issues including how to manage a Subversion repository, how to use Rake to simplify common tasks, Capistrano for deployment, RailsBench and profiling tools, generators, and plugins.

I wanted to include comprehensive and integrated coverage of automated testing. In addition to a chapter dedicated to advanced testing tools, nearly all of the sample code in the book is presented with its associated tests first. I believe this promotes the use of test-driven development and gives examples of how to test complex Rails code.

I had a lot of fun writing this book. If you are a Rails programmer, this book will improve your programs, and hopefully save you time and effort. If you're interested, please check out the samples, and buy the book. Thanks.

Technorati Tags:,

Monday, February 11, 2008

Hey, Free Book Samples!

As I've mentioned here a few times, I have a book coming out, "Professional Ruby on Rails", available later this month.

If you'd like a sneak peek, Wrox has put some samples online as PDF files. You can also just buy the book.

  • Chapter 1 -- This sets up the sample project used in the book, and talks about the new REST features in Rails.

  • Table of Contents -- Take a look at this to see if your favorite topic is covered.

  • Index -- A more detailed way to see if your favorite topic is covered. Also, maybe you collect indexes...

I'm not sure if the publisher plans on adding more sample content -- if so, I'll update this post.

Sunday, January 13, 2008

Publication And Other Updates

First off, several pathfinder blog posts to catch up on...

In Rails book news, I'm now proofreading the final PDF versions of the chapters, which is the first time I get to see the pages in the actual final book layout. Which is pretty cool. I'm correcting them for obvious typos, a couple of things that have changed in the last month since I last proofed the chapters, and code layout issues. Should be back to the publisher by Jan. 18th, and they claim to have the book in their warehouse by about Feb. 12th.

You can still buy your copy in advance -- that's an affiliate link, in case you care.

In other books, I just got the wxPython statement for the quarter ending Sep, 2007. About 400 net sales, which was about what I predicted, bring it to a total of around 7200.

I also just got a Jython statement, same quarter, with 160 net sales on it, literally the highest it's been in years (a couple of quarters ago, the net sales were 2). I wonder if the fact that the Jython project has started moving forward again had something to do with that. Anyway, this makes it almost plausible that I might actually get a royalty on that book at some time ever.

Thursday, January 03, 2008

Versions: Another promotion from the comments

Somebody anonymous asks:

As most of the currently available books cover Rails 1.2, are you providing the code in the books also as Rails 1.2?

The sample example in the book is Rails 2.0, which was Edge Rails when I started, and I just validated all the tests against 2.0.2 last week when I turned in the finished code samples. Where there's a significant change between 1.2 and 2.0, I tried to note it in the text, but I would want to claim that I got all of them.

That said, most of the techniques in the book are applicable to 1.2 applications, although some tweaking may be needed.

There are a number of reasons for this, but mostly it boils down to a) differentiating from books that are already on the shelf and b) giving the book as long a life span as possible. Maintaining two separate versions of the sample application was not feasible given the time constraints.

Ruby version, for what it's worth, is 1.8.6 -- I felt that 1.9 was too experimental to be working with during most of the writing.

Sunday, December 30, 2007

Professional Rails Online?

In response to the commenter who asked if there was going to be a beta book.

UPDATE: Clearly I should ask about these things before I post. Jim Minatel from Wrox added the following in comments:

  • There will be a PDF about six weeks after the print book, meaning end of March or thereabouts. There will also be an Amazon Kindle version, eventually.

  • Also after 6 weeks, the book will be available via Wrox's online subscription service: http://wrox.books24x7.com.

  • It won't be on Safari, apparently Wrox books aren't part of the deal there (which I actually was kind of wondering about). Meaning I still haven't placed a book there)

I now return you to my earlier, ill-informed, blather...

Unfortunately, I'm pretty sure the answer is no. Not only doesn't Wrox tend to do that kind of thing, at this point, the book is do to go to press in about two weeks, so the amount of time to get feedback would be sharply limited.

At one point, I was told that sample chapters would be available online before release, but I don't have any information on whether there will be an e-book available. I don't think there will be a direct purchase of a PDF, but it seems as though Wiley just joined the Safari book store, and the book might be available there. I'll try and find out for sure this week.

Tuesday, December 25, 2007

Another Publication Update

Just got the next version of the book chapters for my examination. I'm not 100% sure exactly where these fit in the process. It looks like they've had a good look-see from a copyeditor, largely for style, clarity, and consistency. (Any lingering "we" sentences seem to have been pruned, for example).

They produced a book-specific style guide, which is a listing of canonical forms for things like plugin names, capitalization of commands or tools and the like. It's kind of interesting to see if I can remember where each name or command was used.

Anyway, I'm supposed to have these turned around by Jan 2, so I'm reasonably sure we're still good to go to press in mid-January, and be released in mid-February.

Sunday, December 09, 2007

Things I Learned

Some things I learned about Rails and writing while working on this book:

  • The great benefit of working on a project like this book is that it enabled me to compress about two years worth of research into Ruby and Rails tools into six months. In my case, this was a great opportunity to really dig into some tools to find that I've only been using a fraction of their power and also really get a sense of how elegant and flexible the tools are.

  • Ever since I learned how to type back on an actual typewriter in the mid 80s, I've always followed the old-time typographical convention of two spaces following a period. Which was burned into my fingers despite multiple people telling me that was a silly and counterproductive thing to do in the brave new world of proportional fonts. In fact, on the wx book, I actually did a global search and replace for a period followed by two spaces to get the manuscript to correspond with the publisher's expected conventions. Somehow, I managed to break that habit while writing this book.

  • The hardest stylistic thing for me to get around was avoiding using "we" and "us". In other books and articles, I tend to introduce examples by saying things like "Now we should type the following" or "Let's see how that's implemented". Wiley/Wrox house style, though is to avoid "we" and write the examples as "Now you should type the following" or "I'll show you how that's implemented". Even more preferred is avoiding the pronoun altogether with "Here's how that's implemented" or "type the following". I'm not saying one way is better or worse -- I find the "we" style to be conversational, the Wiley editors clearly disagree. It did take some getting used to, though.

Thursday, November 29, 2007

We're In Production Now...

I turned in the last chapter of Author Review on Monday, and Professional Ruby On Rails is now in production. Target release date is still mid-February, final page count will be in the range of 450.

I was able to keep the test-first nature of the code going through nearly all of it, which I'm really happy with.

The table of contents looks something like this (in theory, still subject to change...)

Chapter 1: Setting up a new Rails project using REST

Chapter 2: Using Subversion on a Rails project

Chapter 3: Users, secure logins, email authorization, etc...

Chapter 4: Rake, writing build tasks, and using CruiseControl.rb

Chapter 5: Navigation elements, including menus, tagging, search, and pagination

Chapter 6: Database topics, including legacy databases, relationships, and security

Chapter 7: Testing tools: RCov, RSpec, ways to test views and helpers, and so on.

Chapter 8: Rails and JavaScript. Using Rails and Ajax plugins for some common tasks. RJS. Testing RJS.

Chapter 9: ActiveResource, generating and reading XML data, including RSS feeds

Chapter 10: Time and Space. Managing time and time zones, using Globalize for internationalization

Chapter 11: RMagick, ImageMagick, MiniMagick, and other graphic tools. Gruff and Sparkline charts.

Chapter 12: Deployment with Capistrano and Mongrel

Chapter 13: Performance benchmarking and optimization

Chapter 14: Using Ruby metaprogramming in your Rails application

Chapter 15: Using and creating plugins. Testing plugins and generators

Chapter 16: ERB replacements and JRuby

Appendix A: Things to download

Appendix B: Other tools inspired by or similar to Rails

Saturday, November 10, 2007

Heads Up

Wow, I haven't been here for a while. Sorry about that. Here's the deal...

The Rails book initial draft went in about a week ago, more or less on time. (Well, on time for a slightly revised schedule). My understanding of the current schedule is that the author review phase will continue through November. After that, it goes to production, where I get another crack at revising thing that have changed. It goes to press toward the end of January for publication mid-February. If everything continues smoothly.

I'm pretty happy with how it turned out. I think I said almost everything I was hoping to. The main constraint was the tight schedule -- I'm hoping to get some newer features and plugins in during author review.

Oh, and I had another Pathfinder blog entry a few weeks ago. This one is about the CDBaby Rails/PHP thing that was kind of a flap way back then.

That's all for now, I'll try to get back updating the Twitter feed and get back to writing here and on the Pathfinder blog more regularly... Thanks.

Monday, September 24, 2007

Quick Book Update

Couple quick things while I have a minute...

  • Just turned in Chapter 10 (of 16) of the Rails book. Still mostly on schedule for a turn in on October 26, not quite sure what that implies for a print date

  • As I write this, the wxPython book is at 11 thousand and change on Amazon, the highest I've seen in months, which is probably a fluke. Weirdly Amazon says it's the #15 book on "Website Architecture & Usability", which would be great if it was, you know, actually about website architecture usability...

  • New article up on the Pathfinder blog. This one is about Rails RJS templates and how to test them. It's partially a book preview, but really only an overlap of subject mat

There's more, but I'll get it when I have a chance.

Thursday, August 30, 2007

The Rails Edge

I was fortunate enough to attend Pragmatic's Rails Edge mini-conference here in Chicago last week. I have two blog posts up on this at Pathfinder, the first is made up of quotes from my notebook, and the second is some general thoughts. Enjoy.

Pro Rails Book Related Things

A few things I forgot to put in the last book update:

  • The Amazon listing has the book at 600 pages. That's almost certainly optimistic. The contract calls for 400-500.

  • As far as the schedule goes, I'm currently hoping to turn the complete draft in on October 26th, which is about ten days after the original date. The publisher says that pushes publication out to April, six to eight weeks after the original date. I don't quite understand the math, but I suspect that it has to do with the logistics of availability of printing equipment and the like.

  • Chapter Seven appears to be on track to be delivered this week, which makes the book just a smidge less than halfway done.

Sunday, August 19, 2007

Book Update

Here's a couple notes on the current status of the Rails book and life in general.

  • The Rails book is presently just about 30% done -- first payment triggered (yay!). I'm reasonably happy about it so far, though definitely too close to it at the moment to have a clear sense of its quality. I do like the way the test integration is working out -- it seems to help my descriptions of functionality to have the tests there.


  • The book is now available for preorder on Amazon. Here's the 10 print "hello" affiliate link, which will conveniently linger in the sidebar of this blog forever.


  • I don't think I ever mentioned this, but the last results I got on the wxPython book (for Q1 2007), showed that sales were starting to slump. Although the data was weird -- US sales were down to about 1/3 of the previous quarter, and US returns were way up, such that net sales were almost zero. At the same time, international sales were way up, with the total affect being a drop to about 1/2 or slightly less from the previous quarter. We've now passed the 6700 mark in total sales.


  • Apple fanboy stuff: One of the nice features of my new job is that my work computer is now a MacBook Pro. Very nice machine, well designed, very fast. Battery life is decent. Lots of the little design details you've come to expect -- I particularly like the magnetic power cord. Now if only I could use the thing without wearing oven mitts, I think I'd be in business.