Tags

The following entries are tagged with “rails”:

Fixed! Image uploads to Flickr with flickr_fu

One of the projects we’re working on needs to be able to publish images to Flickr. Rather than re-invent the wheel a quick search on RubyForge and GitHub turned up a number existing Flickr libraries for Ruby. After considering future requirements, we decided to go with flickr_fu.

There was just one teeny tiny problem: uploads to Flickr within flickr_fu were broken, as we discovered when we looked at the comments in the Flickr::Uploader class:

# NOT WORKING ... FILE UPLOADS IN NET::HTTP IS TEH SUCK 

A fork, a clone and a few tweaks later and we’ve got uploads working. The changes are currently in our fork but I’ll also be submitting them upstream after a little more testing.

Discuss this entry

And our survey says…

There are currently a couple of web-based surveys being carried out that you may want to take a look at. First up is the survey for people who make websites 2008 aimed at anyone involved in web development from designers to Ruby coders from the guys at A List Apart.

A List Apart Survey Banner Nearly 33,000 people took part in 2007 and it will be interesting to see what has changed and what has remained the same in terms of salary, experience, education and working conditions over the last year.

The second comes from HAML creator Hampton Catlin in the form of the more Ruby-centric Hampton’s Ruby Survey 2008. At the time of writing over 900 people have responded, so if you haven’t already, now’s the time to get your entry in.

The survey covers Ruby and Javascript frameworks, testing, interpreters and in a bizarre twist ends with religious beliefs. It will certainly be interesting to discover if the Ruby community is big on new-age spirituality or is just a godless bunch of coders!

Discuss this entry

Roll your own pagination links with will_paginate

Mislav’s will_paginate plugin (and Gem) has become the de facto standard for pagination in Rails, replacing the often derided classic pagination from the dark days before Rails 2.0. If you haven’t used will_paginate before then Ryan Bates’ RailsCast is a good introduction, although be warned that it is just over a year old and there have been a number of changes to the plugin in that time (the current version is 2.3.2).

Read more of this entry

A tamper-proof cookie jar for Rails

When the default session store for Rails was changed to use cookies last year it caused quite a furore: "It’s not secret! It’s not safe!" The truth is it was never meant to be: in most circumstances you shouldn’t really be storing data in cookies that need to be protected so strongly. But I don’t really want to re-open that can of worms! Instead I want to look at a different cookie-related situation that arose during some optimisation work I’ve been doing on an existing Rails application.

No cookie monstersThe scenario is straightforward enough: the application stores a numeric record ID in a persistent cookie that, while perfectly safe to be seen by users, shouldn’t be changed by them. The solution currently used in the application is equally straightforward: the data is encrypted (using the EzCryto gem and AES encryption) before being written to the cookie, and then decrypted when the data is read back in.

In situations where cookie contents really shouldn’t be seen by users then encryption is the way to go (unless of course you can find a way of not using a cookie at all), however for a simple numeric ID where tampering is the only thing we need to protect against then it seems like overkill. A better solution is to take inspiration from the Rails cookie session store and use a HMAC.

Read more of this entry

Rails 2.1: now with better integrated caching

Rails 2.1 has just been out a week and so far something that seems to have passed most people by is that it now includes much better caching capabilities, including built-in support for memcached.

Last week I reached the point with an application where I needed to cache some models in memory to get a performance boost and decided to check out the current status of plugins like cache_fu and CachedModel to make sure they’d work with Rails 2.1. It was completely by accident that I stumbled across this innocent looking commit by DHH from start of this year and realised that Rails already had everything I needed!

Read more of this entry

Unsigned integers for MySQL on Rails

Ok, so I’m starting a new Rails application, I’ve spent some time refining my database, I’ve considered storage requirements and performance when choosing the data types for my fields and now I’m ready to create some migrations to implement my design.

And then I’m reminded that, lovely though Rails migrations are, there are two things that really bug me about them: they create signed primary keys and they don’t allow me to easily create unsigned integer columns.

It’s been discussed before, dismissed as an ‘uncommon requirement’ (probably because MySQL is, as far as I know, the only database that uses unsigned integers) and, as far as I can tell, not a lot more has happened. So, while sat out in the garden, enjoying a sunny Saturday afternoon, I grabbed edge Rails from GitHub and decided I’d see if I could do something about it (how’s that for geekyness?!)

Read more of this entry

Another plugin for the toolbox

Following on from Rob's Rails plugin round-up a few months back then another plugin has repeatedly found it's way into our projects - sql_logging.

Read more of this entry

Error fields with a Hpricot twist

The default Rails behaviour for highlighting form fields with errors is to wrap them in a div, so:

<div>
  <%= f.label(:email) %>
  <%= f.text_field(:email, :size => '30') %>
</div>

Becomes:

<div>
  <div class="fieldWithErrors"><label for="user_email">Email</label></div>
  <div class="fieldWithErrors"><input id="user_email" name="user[email]" size="30" type="text" value="" /></div>
</div>

This is great when knocking together a quick prototype but as your site evolves you’ll probably want to customise it. This can be done very easily by using ActionView::Base.field_error_proc, assign a Proc to it either in your environment.rb or, if you’re a modern thinker, in an initializer and you’re good to go.

Read more of this entry

Persistent Storage for Amazon EC2 Is On It's Way..

Good news - persistent storage for EC2 is on it's way - it's already in private beta and will be 'publicly available later this year'.

Read more of this entry

Sponsoring Open Source - Crazy Ideas or a Fresh Way of Thinking?

About a month ago Gregory Brown created a buzz with his blog post about working on open source projects for money. Gregory opens with a "Here’s a crazy idea" - but then outlined an idea that was pretty fresh, and not crazy at all (in my book!). This evolved into a wiki around the subject - an interesting read.

As is usual, it created a lot of discussion on blog sites and also fed into talks of a similar nature that had been happening at TheWebFellas HQ.

Read more of this entry

Recent entries

Archives

  1. August 2008
  2. July 2008
  3. June 2008
  4. May 2008
  5. April 2008
  6. March 2008
  7. February 2008
  8. January 2008
  9. December 2007
  10. November 2007

Tags

  1. actionview
  2. active messaging
  3. activesupport
  4. actverecord
  5. aes
  6. aggregation
  7. akismet
  8. amazon
  9. amazon sqs
  10. apache
  11. api
  12. apr
  13. apr-util
  14. async
  15. attachment_fu
  16. attr_accessible
  17. autotest
  18. availability
  19. aws
  20. backgroundrb
  21. beanstalkd
  22. bindings
  23. bj
  24. branding
  25. bug
  26. cache
  27. centos
  28. cloud
  29. clusters
  30. community
  31. company name
  32. compiler
  33. composed_of
  34. consultancy
  35. controller
  36. cookies
  37. css
  38. database
  39. defensio
  40. deployment
  41. design
  42. development
  43. dhtml
  44. docrails
  45. documentation
  46. donations
  47. drdb
  48. ebs
  49. ec2
  50. elastic
  51. elastic block store
  52. encryption
  53. erb
  54. error
  55. events
  56. ezcrypto
  57. fckeditor
  58. feedburner
  59. feeds
  60. filter
  61. flickr
  62. flickr api
  63. flickr_fu
  64. fuse
  65. geekup
  66. geocode
  67. git
  68. github
  69. god
  70. growl
  71. hacker
  72. haml
  73. helper
  74. hmac
  75. holiday
  76. hosting
  77. hpricot
  78. html
  79. identity
  80. imagescience
  81. infiniteftp
  82. init.d
  83. italy
  84. javascript
  85. leeds media
  86. linux
  87. logo
  88. mac
  89. markaby
  90. mass-assignment
  91. memcached
  92. mephisto
  93. messaging
  94. migration
  95. model
  96. mod_rails
  97. mod_ruby
  98. mongrel
  99. mongrel_cluster
  100. monit
  101. monitoring
  102. mq
  103. mysql
  104. neon
  105. new site
  106. nginx
  107. observer
  108. open source
  109. opensolaris
  110. openssl
  111. optimisation
  112. passenger
  113. patch
  114. performance
  115. persistence
  116. persistent storage
  117. persistentfs
  118. php
  119. phusion
  120. plugin
  121. plugins
  122. prototype
  123. queues
  124. rails
  125. rails development
  126. rails patch
  127. rails plugin
  128. rails-doc
  129. refresh
  130. renderer
  131. rich text editor
  132. rmagick
  133. ruby
  134. ruby on rails
  135. rubyinline
  136. rvideo
  137. s3
  138. s3fs. elasticdrive
  139. schema
  140. security
  141. services
  142. snarl
  143. social
  144. solaris
  145. spam filter
  146. sparrow
  147. sql
  148. sql_logging
  149. starling
  150. starter kit
  151. storage
  152. subversion
  153. survey
  154. svn
  155. swig
  156. sysadmin
  157. tamper
  158. templates
  159. the webfellas
  160. time zone
  161. tinymce
  162. to-done
  163. transcoding
  164. tzinfo
  165. uk
  166. uk rails
  167. unsigned
  168. validation
  169. video
  170. view
  171. webfellas
  172. webfellows
  173. wedding
  174. welcome
  175. widgeditor
  176. will_paginate
  177. win32
  178. windows
  179. wysiwyg
  180. xen
  181. xhtml
  182. xvm
  183. youtube
  184. zentest
  185. zfs

Flickr snaps