So apparently pass phrases are the new ‘secure password’ - kinda the step you get to when you finally accept that your users are going to use something like ‘password’ for their account password. The natural step here is to reinforce a secure password strategy by requiring x numbers, x special characters and a certain length - but I find...
Recently, I’ve been implementing an admin interface for a system that I want to make more secure than the main application. The way I’ve chosen to do this is to run some models that relate solely to the admin application (Authentication and Authorization in particular), on a different database - let’s call it ‘login’. This seems to be a reasonably...
This post is probably something more experienced RVM users will already know, but I wanted to post this as it’s definitely my discovery of the week. When throwing an .rvmrc file into a project, it’s a nice thing to do to write the script correctly so that it will just work for other developers (As well as telling you what...
This is cross-posted from a tweet I posted a while back - I think it’s a nice bit of advice, and I wanted to store it in a more persistent form Installing ImageMagick is one of the things that Rails developers need to do reasonably often when provisioning new servers - basically, if you’re doing any sort of image processing...
RSpec 2 has supported integration tests for a while now, and I’ve chosen to use these for a project I’m working on at the moment instead of Cucumber (I don’t feel that I need the verbosity and English-like structure Cucumber provides given that it a more complex process to write tests). A bit of a problem I’ve come across recently is...
You could use SQL’s random function (RAND() or RANDOM() depending on database
engine) - but this isn’t database agnostic, so isn’t really very quick.
Instead you can use @nzkoz’s suggested method:
Widget.first(:offset => Widget.count)
…. the count() method is fast, and the first() method will limit it to the
first result in the SQL as well.
I’ve been working on an image processor class for work, and recently ran into this issue. I thought I would post it up here as normally I need to be quite desperate before I start trawling through email mirrors - hopefully somebody comes across this post first. If you use ImageMagick (in particular, in conjunction with MiniMagick), then you may...
I’ve just added a nice unobtrusive scroll to top feature to my blog, and learnt an interesting tip in the process I thought I would share, originating from one of the many problems Twitter has had with it’s jQuery fanciness. The scroll to top stuff isn’t overly complicated - just detect when the user has scrolled x pixels down the...
I can tell that this title alone will irritate a lot of developers out there. It irritated me as well, until I figured out that sometimes, doing things the ‘wrong’ way is the best/only way. But let me get on with things. Every now and then, you will come across a scenario where you need to access something in the...
Just a quick tip I’ve come across while browsing through the comments on a Railscast_I’ve_been_watching. It looks like the I18n gems that get automatically installed with Rails 3 have a teensy bug. When storing a translation to the backend (be it YAML, Redis, whatever), there is an :escape option that can be passed to enable (or prevent) the key from...