Tags

The following entries are tagged with “ruby”:

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

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

Yay! YouTube API Now Supports Upload!

We're currently working on a project where we handle a lot of images and videos. Rather than handle these ourselves, we wanted to make use of the heavyweight's infrastructure where possible - this meant Flickr for images and YouTube for video.. but there was one snag - we couldn't upload video via the API. There were 'hacks' available, but we don't like to build solutions on unsupported features.

Read more of this entry

Recent entries

Archives

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

Tags

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

Flickr snaps