A Must-Have Rails Plugin: strip_attributes

Posted by Scott on Dec 2nd, 2007

I recently discovered that my Rails model validations could be easily bypassed or broken by adding whitespace to the beginning or end of strings as they are entered in forms. For example, if your user account system is based on the uniqueness of email addresses, “joe@example.com” and ” joe@example.com” would validate as unique. This is something that nearly every webapp I can think of would want to avoid.

Fortunately there is a simple Rails plugin, strip_attributes, which will take care of this easily and efficiently. You can enable it on a per-model or per-field basis if you need fine-grained control. See the Rails wiki for more details.

In other news, there will be no December meeting of the NH Ruby and Rails User Group. Enjoy the holidays!

CAPTCHA Usability Improves

Posted by Scott on Sep 4th, 2007

I just noticed a major usability improvement regarding the use of CAPTCHA images for login verification. Namely, don’t show one until you’ve received a failed login attempt. NewEgg does this, and a colleague tells me Google has been doing it, too. It makes perfect sense – give your user the benefit of the doubt the first time around, and then enforce use of the CAPTCHA if you suspect you might be the target of a brute-force attack.

NHRuby July Meeting: Live Coding Session

Posted by Scott on Jul 17th, 2007

Tonight’s NHRuby.org meeting in Portsmouth should be a blast. Nick Plante and I will be coding up a web application from scratch, as decided upon by members of our email list. As we develop the app, we will explain how and why we’re doing what we’re doing. We want this to be a collaborative group discussion, not just a presentation. So head on down to RMC Research tonight at 7pm and take part in the development of this web app! For more details, see our wiki site.

Book Review of Beginning CSS Web Development

Posted by Scott on Apr 22nd, 2007

This is a review of the book Beginning CSS Web Development: From Novice to Professional, by Simon Collison. Published by Apress. ISBN: 1-59059-689-7.

Let me start by saying I never really considered myself a CSS beginner when I picked up this book. I’ve successfully used CSS for text formatting comfortably for a couple of years. But when it came to using CSS for positioning and layouts, I’d run into frustrating problems immediately, and always found floats to be counter-intuitive. I’ve read many CSS positioning tutorials on the web and none of them ever fully resolved the conceptual blocks I’ve had. Given the fact that I’ve been entirely self-taught when it comes to web development, I figured a book with a title like Beginning CSS Web Development seemed appropriate to fill in the gaps of my understanding.

The first four chapters of this book covered the basics of CSS and went over text styling techniques I was already familiar with. Even so, I found the writing exceptionally clear and learned a few more subtle techniques that were immediately helpful in improving some of my web designs. Simon Collison isn’t just writing a series of lessons on CSS – he also offers general guidelines about web design issues, such as recommendations on how to organize your CSS files, and tips for picking an appropriate font. This I feel is especially useful for readers who want to get a good foundation in general, modern web development principles.

The chapter on styling forms was very handy, as it discussed three different ways forms are often laid out on the web, and answered questions I had on the pros and cons of each. By the time I had finished reading Part 1 of the book – which I had assumed would simply be a remedial overview of CSS – I had found numerous ways my practical, working knowledge of CSS had been improved.

The two most valuable chapters to me were chapters 10 and 11. Chapter 10 included concise and easy to understand explanations of float-based positioning, when it can be necessary to use spacer divs, and the way clearing floated elements should be done. This was the book I needed to clean up my spotty understanding of CSS positioning, and I immediately obtained results I applied in some of my web designs. Chapter 11 also provided a good reference for common two- and three-column layouts, and a short, but good explanation of the CSS box model.

The chapter on web accessibility was fairly minimal, which is to be expected in a beginner-oriented book, but I did find some of the tips on making CSS available to embedded devices insightful. The final chapter is a start-to-finish walkthrough of a CSS-based web page that brought together many of the lessons taught earlier. A CSS reference and good index round out the remainder of this 448-page book.

I could not find any significant copy editing errors in this book, and would highly recommend it for anyone with a background in CSS like my own. I also feel this is an excellent book for newcomers to CSS who want a good foundation in modern best practices from a book that is both practical and readable.

You can buy the book at Bookpool (this is not an affiliate link).

« Prev

Blog Badges

[FSF Associate Member]