rb's blog

Some tricks to use S3 in your web application

After the post on my dojo.io.bind experience, here's what I learned in using S3. I'm using the S3 library for Ruby published by Amazon.


When you save an entry with a file attached in MyOwnDB, the Rails action handling the form checks the size of the file. If it is within the limits allowed for the account, it saves the information needed locally in the database (let's say in the table "files"), and then saves the file on S3.

Famfamfam Silk icons used

I've deployed new icons in the application. These are Famfamfam Silk icons, a collection if 1000(!!) free (under the Creative Commons license) icons of really high quality, with very broad coverage. If you're looking for icons in your web application, you know where to go from now on. Note that the Silk icons are not the only ones available.

File uploads to Amazon S3 the AJAX way thanks to Dojo

File uploads are finally deployed! You can now specify in MyOwnDB that a detail of your entity is of the type "file". This will let you attach a file to an entry, and subsequently replace or delete it. This required some changes in the application, more specifically in the way the forms are submitted back to the server. For a file upload to work fine, you have to send it with the enctype attribute set to "multipart/form-data". But that's not all! You cannot just serialize the form in javascript like you can do with other input types because you cannot access the file from Javascript.

Use of Yahoo UI's tooltip and overlay

Monday has seen a big update of the signup code, with, amongst other changes, the use of the Yahoo UI libs. Although prototype is well integrated with rails, Yahoo's extensive documentation and the praise it got from some leading javascript developers got me interested, and I must say I wasn't disappointed. When you download the distribution and uncompress it, you get a directory structure.

Sending HEAD requests using Amazon's S3 Ruby lib

After some usage of Amazon's S3 storage service from Ruby, I'm quite happy with the result obtained.

Testing Rails controllers communicating with external web services

As I was writing the code to accept payments through Paypal for MyOwnDB, I kept wondering how I could write functional tests to validate it. All those methods initiate or react to communications with Paypal, and although there's a sandbox available, you cannot predict the id assigned to the transactions and that must be returned to Paypal (see below for how this validation works)., This clearly limited the scope of the tests I could write.

Google sitemap for Ruby on Rails website

I was building a Google site map for http://www.myowndb.com using their generator (in python). Using the generator is very easy: just edit the config file according to the comments included the example. You can configure the generator to analyze access logs of your webserver to extract URLs to put in the sitemap.

Rails and Paypal's Payment Data Transfer

When you use Paypal to get payments, you can configure a return URL to which the payer will be redirected. When you activate Payment Data Transfer, you get some information about the payment that redirected to your site. The paypal gem (more info at leetsoft, although the doc you'll find there is out of date) doesn't work with Payment Data Transfer, but only with Instant Payment Notification (notification made separately by Paypal making a post request to your server).

Microsoft sponsors Firefox ads streaming

Yes, you read it well. As MyOwnDB is developed mainly with advanced browsers in mind, it's good to see Firefox promotion being alive and kicking. And it gets funny when you see that when you watch submissions to the Firefox Flicks on news.com, you get them through a streaming that is sponsored by Microsoft, and that is in the flash format.

Eating my own dogfood with public forms

There's a feature in MyOwnDB that was there from the start, but maybe not publicised enough: you can publish a entry form for each of your tables. And in this form, you get all data validation! No bogus email will make it in your database! (well, email validation is regexp based, so it's not 100% safe, but it'll limit the errors). And I'm using this functionality in the contact page at http://www.myowndb.com/info/presentation/contact.
Syndicate content