YouTube - Elbow - Starlings
February 14th, 2010 / No Comments » / by admin
February 14th, 2010 / No Comments » / by admin
February 14th, 2010 / No Comments » / by admin
The case for embedding jruby-complete into your application | Atomic Spin
Why in the world would you want to embed JRuby into your application instead of relying on a regular Ruby or JRuby installation? I can think of three reasons.
Developing Sites With AJAX: Design Challenges and Common Issues - Smashing Magazine
What Is AJAX?
After the main HTML document has loaded, AJAX loads content from the server and replaces parts of the document with that content rather than reload the main document. It’s as simple as that. AJAX stands for “Asynchronous JavaScript and XML” and was meant to load only XML documents, but we soon used it to load everything under the sun, and so the XML part was quickly forgotten. The asynchronous part is the killer feature; but what is it?
DailyJS: Park your Horse, Code Cowboy: Professional JavaScript Workflows, Part 1
When it comes to professional practices, is your JavaScript always stuck with the short end of the stick?
Take this simple quiz to find out. Do you…
* Break up and organize your code into small, easily digestible files?
* Keep only one canonical copy of third-party libraries?
* Use a deployment workflow, to concatenate and minify automatically?
* Automatically generate documentation?
* Unit test your business logic?
Pivot.new - Redefine a method from a module like a Gentleman
I was recently presented the problem of appending to the initialize method from a module that was being included. To do this it would need to override the class’s initialize method with my own but keep the functionality of the original initialize method.
Whenever I need to do something in Ruby that I know will require some experimentation I like to move outside of my application and reproduce the problem in a simple way. For this problem I created a Person class that mixes in a Teacher module.
WebFinger libraries emerge - The Changelog - Open Source moves fast. Keep up.
Less than 24 hours after Google broke the news on WebFinger, its 21st century take on the Unix finger command, enterprising developers are releasing native libraries for the service.
In case you missed it, WebFinger is a way to get profile information for a user of a service based solely on their email address.
Terminal junkies rejoice! Now you can use Cucumber to test your command line interfaces just like you do for your web apps. Aruba from Cucumber creator Aslak Hellesøy provides familiar step definitions for testing output, exit statuses, and file system commands.
Unit Testing Sphinx | Pathfinder Development | Software Developers | Blogs
Sphinx (and its rails plugin thinking-sphinx) is my choice of search engine on ruby/rails project. It is powerful yet super easy to setup.
However, testing Sphinx code is not easy at first. Since Sphinx works by leverging database commit hooks, it cannot be tested within the bounds of unit testing framework that rails provides. This is understandable because, in rails testing, a transaction is started before each test that is bound to rollback after the test is finished. Since the test data is never committed, sphinx doesn’t get a chance to index anything and cannot be tested.
Riding Rails: Plugin Authors: Toward a Better Future
Some of the biggest changes in Rails 3 involve how Rails expects plugins to behave.
<3! — Testing your dependencies with RSpec
I’m finding that managing my projects’ code dependencies is smelling worse and worse as time goes on. Code bases get bigger and acquire libraries as they grow; a part of your project sits untouched for a few months and its particulars leave your medium-term memory, and so on.
In Rails, we can freeze lots of stuff to our vendor directories. I do that as much as possible—gems that I only use for Rails apps get frozen to vendor/gems and then uninstalled system-wide; I use the gemsonrails plugin for this. If the little gem bits aren’t necessary, you can just pistonize a repository. Old news.
That’s not going to fly for platform-compiled gems, or even compiled libraries that aren’t gems at all (since you’re possibly running several different platforms between development and production). So I’ve been cooking up ways to keep myself sane:
PaulBarry.com - Node.js Presentation
Barking Iguana: Keeping the software on your Ubuntu server up-to-date
There are two things that you as a server operator need to know how to do to stay up-to-date with the software on your server and make sure that it’s always supported. One is upgrading installed packages, and one is upgrading to the next release of Ubuntu. I’ll cover them both one at a time, but first we’ll do a little setup to make sure that both operations are nice and fast.
Monitoring Delayed Job with Bluepill and Capistrano | Plataforma Tecnologia Blog
So, you already did the right choice of using Delayed Job for your background processing, great! But, how are you going to be certain that your background processing will still be happening while you are sleeping? And if your Delayed Job process goes down, are you going to wake up in the dawn e restart it manually? I wouldn’t do that, I really appreciate my sleep. So, what’s the solution?
As rubyists and railers, we already know there are solutions, like God, that do this job for us. However, there are another solutions, like Bluepill. Bluepill is a process monitoring tool like God, but, unlike God, it doesn’t have memory leak, according to its authors.
MetaSkills.net Synchronizing Core Data With Rails (3.0.0.pre)
This is my presentation to our local @757rb/@757objc users group this past Tuesday. Hope some find it useful.
Lessons learned from building HomeMarks native iPhone application to synchronize Core Data with a RESTful backend built using rails 3.0.0.pre. This covers a previous design methodology called the AJAX head pattern which decouples rails applications from the views they present which allowed an easy API foundation for the iPhone application and data sync methods.
Quick and easy static pages in Rails | Ruby On Rails Blog
Sometimes you have a Rails app, the core functionality is not a CMS, and you need to add some static pages to your app that don’t get changed often, eg, an about us page, privacy policy, etc.
This post shows you a quick and easy way to do that in about 60 seconds, without using a database model or having to write any sort of CMS.
Ruby Metaprogramming Course – Start Thinking in Ruby
After the huge success of the first two “Ruby Metaprogramming” batches, RubyLearning now announces the third official batch from 6th Mar. 2010.
litany against fear ¤ by nick quaranto ¤ The Rails Module (in Rails 3)
So, you may have noticed this in the Rails 3 Changelog…
Railties now deprecates:
RAILS_ROOT in favour of Rails.root,
RAILS_ENV in favour of Rails.env, and
RAILS_DEFAULT_LOGGER in favour of Rails.logger.
Great…but why? Better alternatives have existed for a while in Rails core (some since 2.1.0), and it’s about damn time you start using them properly. There’s also some other helpful methods on the Rails module we’ll explore in this post.
Getting Up To Speed With Rails 3
I’m proud to announce that darwinweb.net is now running Rails 3.0-pre. I undertook the project as part of Bugmash last weekend, but it turned out to be a very deep rabbit hole; a two-day bugmash was too short to really dig into the meat of Rails 3 which is in ample supply.
The scope of changes to Rails is astonishing. There’s a lot of new blood contributing and brilliant ideas are popping left and right. The result is that Rails 3 represents a major maturation inflection point. It’s graduating from the scrappy, opinionated upstart to a very modular and full-featured framework containing what may once have been considered a disturbing amount of enterprise-readiness. It’s bittersweet and perhaps a bit ironic that the internals have acquired so many moving parts, but as a professional Rails developer the new flexibility and modularity is far too awesome to denounce in any way.
How to upgrade plugins to Rails 3.0 / Boldr
Rails 3.0 beta is out and it’s now time to upgrade all the plugins available. To show you how to do it I’ve decided to create a small plugin compatible with Rails 2.x and Rails 3.0. It’s a wrapper around Rack::Cache to insert it automatically in a Rails application.
Bulletproof backups for MySQL | Carsonified
has_many :bugs, :through => :rails: Signed and Permanent cookies in Rails 3
David added a very cool feature to Rails recently – Signed cookies and permanent cookies This lets you set permanent and/or signed cookies very easily.
prefuse | interactive information visualization toolkit
The Building Blocks of Ruby « Katz Got Your Tongue?
Let’s cut to the chase and use a better example of the utility of Ruby blocks.
omgbloglol - The Path to Rails 3: Greenfielding new apps with the Rails 3 beta
PythonLearn - Self-paced learning Python
**Note that the book doesn’t yet have any chapters relating to informatics at this point.
ryanb’s importex at master - GitHub
This Ruby gem helps import an Excel document into a database or some other format. Just create a class defining the columns and pass in a path to an “xls” file. It will automatically format the columns into specified Ruby objects and raise errors on bad data.
This is extracted from an internal set of administration scripts used for importing products into an e-commerce application. Rather than going through a web interface or directly into an SQL database, it is easiest to fill out an Excel spreadsheet with a row for each product, and filter that through a Ruby script.
Rails3 compatible plugins so far
Rails 3.0 Beta: 36 Links and Resources To Get You Going
Whenever something’s a really “big deal” in the Ruby world, we cover it - even if it makes more sense on Rails Inside (which is now switching to a user contributions model). Given that, we’ve gone through all the latest and greatest Rails 3.0 related links and put together a ton of them to help you on your way with the recently released Rails 3.0 beta. Enjoy!
Railscasts - Rails 3 Beta and RVM
Get started with Rails 3.0 Beta and install Ruby 1.9.1 using RVM: Ruby Version Manager. Stay tuned to the end for a challenge on giving back to open source.
The making of the NYT’s Netflix graphic – The Society for News Design
One of The Times’ recent graphics, “A Peek Into Netflix Queues,” ended up being one of our more popular graphics of the past few months. (A good roundup of what people wrote is here). Since then, there have been a few questions about the how the graphic was made and Tyson Evans, a friend and colleague, thought it might interest SND members. (I bother Tyson with questions about CSS and Ruby pretty regularly, so I owe him a few favors.)
DealNews: Scaling for Traffic Spikes | Scalable web architectures
Last year Dealnews.com unexpectedly got listed dealnews.comon the front page of yahoo.com for a couple of hours. No matter how optimistic one is, unexpected events like these can take down a regular website with almost no effort at all. What is your plan if you get slashdotted ? Are you ok with a short outage ? What is the acceptable level of service for your website anyway.
One way to handle such unexpected traffic is having multiple layers of cache. Database query cache is one, generating and caching dynamic content is another way (may be using a cronjob). Tools like memcached, varnish, squid can all help to reduce the load on application servers.
lindsaar.net A Different View…
Bundler rocks, but you need to think differently about how to start and run your Rails app.
Rails 3 Blog Club - Week 1 on Vimeo
Hashrocket discussing rails3 blog posts
Rails 3 Beta is Out — A Retrospective | Engine Yard Blog
The Rails team has finally released the Rails 3 beta, after more than a year since the Rails and Merb teams started working on this release. You can read all about it at the official Rails blog, but I figured I’d take the opportunity to share my take on the release.
Coding considerately means doing your absolute best to make sure your styles don’t mess about with parts of the page that you have no business messing about with. Let’s start with includes.
SafeBuffers and Rails 3.0 « Katz Got Your Tongue?
As you may have read, Rails adds XSS protection by default in Rails 3. This means that you no longer have to manually escape user input with the h helper, because Rails will automatically escape it for you.
However, it’s not as simple as all that.
Bundler 0.9: Heading Toward 1.0 « Katz Got Your Tongue?
As we approach the release of Bundler 1.0, which we hope to ship along with Rails 3.0 final, we took the opportunity to take a look at all the feedback people have sent so far.
Having done so, we’re proud to announce Bundler 0.9 with radically improved workflows that fit our needs and the needs of those who have contributed feedback and patches.
Live Coding Rails 3 Upgrade | Free PeepCode Blog
For several months people have wondered, “Where can I download a video that features a developer stumbling through an upgrade of a Rails 2 app to Rails 3?”
I’m proud to say that an answer is now available!
In only 25 minutes, I convert my news screenshot site from Rails 2.x to Rails 3 (prerelease, from source).
Running a Ruby application with jruby-complete | Atomic Spin
Check out this other post for a discussion of my reasons for locking down your JRuby runtime. In summary, embedding jruby-complete gives you complete control of your Ruby runtime. That’s a good thing. The downside is that discovering and executing commands through jruby-complete can be a pain. The rest of this post describes how to ameliorate the pain.
Setting up virtualization on Ubuntu with KVM - redemption in a blog
With KVM gaining official support from Ubuntu as the virtualization solution, I ended up ditching Xen and switching to KVM for these new servers on Karmic. The rest of the entry is a step-by-step guide on setting up KVM VMs on a Ubuntu server; I’m putting this down because like all wikis, the Ubuntu KVM wiki has grown a little too organically to be useful.
SD Ruby - Episode 077: Building Your Own Hosting Environment
Nic Benders will show you what’s needed for building a hosting environment for production applications. The focus will be on selecting server hardware, picking a Linux Distro, and getting your Rails app running.
Sass 2.4 will now be Sass 3.0 : Nex3
Because of this surge of energy, the goals for the next version of Sass have shifted dramatically. When we released version 2.2, we were expecting the biggest addition to version 2.4 to be some output-optimization features. Now those have been pushed to a later release in favor of much more major improvements. I’ve talked about some of these improvements already, such as a much more powerful way of dealing with colors and auto-compilation of CSS files. And there are even bigger, more exciting ones in the works.
Since we’re making such huge changes – ones that will in some ways reshape the face of Sass - a minor change from 2.2 to 2.4 feels inadequate. Thus, the next release of Sass will be version 3.0.
Change the look and behavior of a Rails app on mobile devices. Also use jQTouch to build a native-looking interface.
Introducing GMoney – A RubyGem for Interacting with the Google Finance API » Justin Spradlin
The Google Finance API allows users to interact with Google Finance and can help developers programmatically “request a list of a user’s portfolios, retrieve performance and return statistics on an existing portfolio, query the positions and transactions in a portfolio, and create new portfolios and transactions.”
GMoney is a wrapper for this API and allows developers to take advantage of the API’s functionality using the Ruby programming language. To minimize the learning curve I tried to give GMoney an interface similar to that of ActiveRecord so that developers would have a familiar starting point.
Commit 2ebea1c02d10e0fea26bd98d297a8f4d41dc1aff to rails’s rails - GitHub
Classic commit
Emphasized Insanity - Find all online users with Authlogic
Assuming you want to find all the users that are currently online when you use Authlogic, you might find it’s a little tricky at first since you can’t really access the sessions table from UserSession.
Depending on your SessionStore configuration, you can theoretically access the storage directly (the Sessions table, or memcached for example), but assuming you don’t want to add some unnecessary code or models to your app, you can simply use one of Authlogic’s Magic columns.
Return false with prudence - Code in the hole - David Winterbottom
One irritating programming idiom — especially common to PHP programmers — is to use a return value of FALSE to indicate that something has gone wrong, or that no valid return value could be found. Unless the only other possible return value is TRUE, this is almost always wrong.
Why your Javascript apps need more structure @ Bamboo Blog
There are several aspects to building javascript UIs, and you need to do a bit of planning beforehand if you want them to be successful. 2010 is set to be the year of Javascript’s ascendancy, and you can’t ignore it. You also need to start using it properly (if you aren’t already). We have evolved beyond the level of chucking event handlers inline in views and it is not possible to just hope for the best as things get more complicated.
Dissecting the web with Ruby and Hpricot | blog.mostof.it
Let me introduce you to an old friend of mine: Hpricot
Hpricot has saved my life many times when I had to parse (x)html documents and extract information programatically. It features a very nice ruby-ish syntax and a blazingly fast xpath-based parser. Combine it with open-uri, and you’re in for a fun ride creating a data-extracting web spider.
Ruby Best Practices - Weekend Reading: RBP Chapter 1
If you’re reading this blog, you probably know that the Ruby Best Practices book exists. Even if you haven’t read it, you might have a sense for the sort of topics we cover based on the content you’ve seen on this blog. But now, everyone is going to get a chance to read RBP the way its meant to be read: as a conversation.
For the next 8 weeks, I will post a chapter from RBP every Friday. You don’t need to pay me a cent if you download it, but what I do want you to do is leave a comment here sharing your thoughts once you’ve finished reading. This way, we can use RBP’s content as a jumping off point for conversation, rather than treating it like some sort of static rulebook. Through this process, we can discover what our common practices really are. Over time, I will incorporate these ideas back into the manuscript, helping to keep the book up to date and relevant.
Testing terminology | Atomic Spin
The terms I prefer (and generally what Atomic developers use as well, though I’m sure we have some internal variation) are useful in the context of an agile development process. They’re also meaningful in more traditional testing cultures, though it’s quite likely that dedicated testers or “QA engineers” are performing the testing.
I have a simple taxonomy for the sorts of tests that developers create: unit, integration, and system. My friend and former colleague Paul Jorgensen taught this to me years ago and it’s worked quite well.
lindsaar.net A Different View…
Action Mailer has long been the black sheep of the Rails family. Somehow, through many arguments, you get it doing exactly what you want. But it takes work! Well, we just fixed that.
Action Mailer now has a new API.
From Zero to Rails3 on Windows in 600 seconds
From Zero to Rails3 on Windows in 600 seconds
StackOverflow cool Ruby questions 3 - Khaled alHabache’s official blog
Welcome to the third post of this series. Just before diving into the new questions’ set, I want to mention a little script that I wrote to notify the user when a new question is posted on Stackoverflow, it works on Mac and uses growl.
Now let’s proceed to questions:
Two practical examples of Rack middleware in Rails | Floorplanner Tech Blog
After Rails moved to Rack as server interface, the ability the use Rack middleware was one of the most touted advantages. At first, it wasn’t very clear to me why this was such a big deal. However, I have applied Rack middleware in the last month on several occasions. I thought it might be interesting for other Rails developers to see some practical examples of middleware, to see where they can be applied.
it’s barley a task manager « processi
Barley is a [for fun] task manager. It takes its name from the barely repeatable processes, of course, it can’t compare with the excellent Thingamy work processor.
Barley is a Sinatra web application wrapping a ruote workflow engine. Ruote can run many process instances issued from different process definitions, but barley’s processes are all instantiated from a single process definition.
duncanbeevers’ dweebd » Subdomains in development using ghost
Using subdomains with Rails is kind of a pain. The only official support for subdomains is as asset hosts, as described in the AssetTagHelper documentation.
Matthew Hollingworth’s subdomain_routes covers most of the gaps in dealing with subdomains in Rails, including; generating subdomain routes, scoping resources to subdomains, and exposing subdomain information to controllers.
What I want to talk about is how I deal with subdomains in a development-environment context.
Conversational and short URLs on Rails | Carsonified
A recent project of mine got me thinking a step further than these friendly links. I wanted the URL to be conversational. Not just English, something more like an English sentence.
Iteration Shouldn’t Spin Your Wheels! | Engine Yard Blog
Ruby is a rich language that believes there should be more than one way to express yourself—the many ways of counting and iterating are no exception.
Ruby wrapper for the Delicious v2 API using the OAuth gem
I couldn’t find any examples of anyone doing this using Ruby, so I decided to have a go using the OAuth gem. It was a bit of a painful process due to a lack of decent documentation, but I got there in the end. I thought I’d share the code in case it saves anyone else a bit of time.
danwebb.net - Put that data-* attribute away, son…You might hurt someone
However, back then I explained why there is no good reason to add unsemantic configuration data into your HTML and now that we have standards-approved carte-blanche to do this I’d like to reiterate that it’s still not the way forward. If you’ve not read that article then its worth a quick read before you go on.
By all means, use data-* attributes to add semantically valuable data to your HTML but if you are just using it to prop up a script you are writing think again.
January 26th, 2010 / No Comments » / by admin
Flvorful Bloggage : A Simple Pattern for Ruby’s inject method
Ruby’s inject is an often misunderstood method, but you would be surprised at how much it can help you clean up your code. I see many developers skipping over this method in favor of the non-injectified way, mainly because they dont get how to use inject properly. So we’ll take a look at some common examples and then you will be able to see the pattern that allows you to take advantage of inject.
4294967295 and MySQL INT(20) Syntax Blows - Laughing Meme
If you’re ever debugging a problem and you see the number 42-mumble-mumble-mumble-7295 you’ve run out of 32-bit storage. If you see 2-mumble-mumble-mumble-647 (2147483647) you’ve run out of signed 32-bit storage. 167-mumble-mumble-15 (16777215) you’ve run out of 24-bits and 65-mumble-mumble-35 (65535) you’ve run out of 16-bits of integers.
Chargify: Rails Powered Recurring Billing Service With An ActiveResource API
Over the last couple of months, a new billing and subscription company - Chargify - have been popping up around the Web 2.0, SaaS, and Rails scenes. Notably, Chargify’s CEO is Lance Walley, co-founder of Rails hosting company Engine Yard. Rails developers are a pretty entrepreneurial lot and Chargify have a lot to offer Rails developers who need to set up billing systems.
Pagetest - where web sites go to get FAST!
Welcome. Pagetest allows you to provide the URL of a webpage to be tested. The test will be conducted from the location specified and you will be provided a waterfall of your page load performance as well as a comparison against an optimization checklist. Please visit the PageTest wiki page for more information. Sample results for AOL.com can be seen here.
This tool lets you test web pages that are directly accessible as an URL from the Internet. If you need to test a page inside of a firewall or something more complicated than a web page (an authenticated product like webmail for example) please download the desktop version of PageTest which this is based on.
Tips For Sending Valid E-mails From Websites
E-mails are one of the key elements of a website/web application. They are used in contact forms, sign-ups, notifications, newsletters, etc.
It is a common experience that sometimes e-mails sent from websites go to the junk folders or never reach.
Although it is not always possible to detect the reasons for this, there are several things that we can do to minimize the risk. Here they are:
The Chris O Show: Gravatar default images - a better way
Hey, so at Harmonypark we decided to put gravatars into one of our applications (which is so easy it’s not funny) – and when the time came to select the default images for the gravatar I piped up: “I know how to fix this!” and pointed to a blog post I wrote about it long ago: (You can read it here.)
My colleague Ebony came up with a great solution: “Why not use another gravatar as the default image.”
Which is an utterly brilliant idea – that way the default image gravatar will scale correctly, and we wouldn’t have to mess around with having different image sizes for the different scaled default images. Here’s how we did it:
Find The Right JavaScript Solution With A 7-Step Test - Smashing Magazine
# How stable is the solution?
Is a good alternative available if this one doesn’t work?
# How easy is it to customize?
Do you need to be a JavaScript expert to modify the widget?
# How usable and accessible is it?
Are users who don’t have a mouse or are on a mobile browser blocked?
# Do you understand what’s going on?
Would you be able to fix a problem and explain it to others?
# Is it a contained solution?
Will other scripts be able to interfere with it, or would it contaminate the document?
# How dedicated is the developer?
Will the solution be maintained in the future?
# What is supported, and how can you extend functionality?
A new browser and client request is always around the corner?
In this interview, Yukihiro Matsumoto talks about programming languages design and decisions he had to take while designing Ruby. He also discusses other programming languages including Haskell, Scala, Python and Clojure. While talking about Ruby language and functional programming, Matz explores opportunities of integrating some of FP into Ruby and imagines a purer IO approach for it.
“Tainted” objects are those that have come from some type of user input. Either from a file, the keyboard or the network, unless the object is a literal in the program or created by the program directly, it will be tainted. The tainted flag is always there on your objects, all you have to do is check it before you do anything unsafe. If you’ve confirmed that the data is indeed safe, you can then untaint the object.
Agile: In A Flash: Refactoring Inhibitors
With the need to avoid degradation, it’s important to recognize anything that might prevent a team from refactoring as much as they must. This card provides some inhibitors to refactoring that you should watch for.
Several things will now happen, because we contributed back to the open-source library, instead of keeping this “addition” to ourself (and the client):
* other developers facing this same problem can now leverage our code when they use geokit
* other developers can now submit even more functionality, fixes or enhancements to our code, and even better support for problems we may have one day, meaning that we will eventually benefit from this too
* our client now knows that the code they relied on us to develop now has even more developers eyeing it, making sure it works
* our client (through us) is contributing to open-source, and can feel good about using open-source technologies, having fulfilled their part of the agreement they implicitly made, by leveraging the gains (and price) o
alex blabs - UTC vs Ruby, ActiveRecord, Sinatra, Heroku and Postgres
Now that I’m starting to use DelayedJob to perform jobs in the future in my Heroku Sinatra app, its important that they happen at the scheduled time. But unless you pay attention, you’ll find that times get mysteriously changed — in my case, since I’m in San Francisco in the wintertime, by +/-8 hours — which means that some conversion to or from UTC is being attempted, but it’s only working halfway.
Trying to keep a handle on which libraries are attempting, and which are failing, to convert times is a losing battle, so I’m trying to do the right thing and save all my times in the database in UTC, and convert them to and from the user’s local time as close to the UI as possible. Unfortunately, a variety of gotchas in Ruby and ActiveRecord and PostgreSQL makes this trickier than it should be. Here’s a little catalog of my workarounds.
nirvdrum’s Weblog :: On Amazon EC2 Spot Instances
A couple months ago Amazon announced support for EC2 spot instances. In a nutshell, a spot instance is an EC2 instance that you bid on and that Amazon creates and destroys based upon whatever spare capacity is available in a given EC2 availability zone (i.e., supply) and your maximum bidding price versus the current spot instance price (i.e., demand). A spot instance is less flexible than an on-demand or reserved instance is in terms of lifecycle, but could be significantly cheaper if your application can handle that volatility.
This post summarizes my experience with spot instances and how I make use of them.
has_many :bugs, :through => :rails: Active Record Query Interface 3.0
I’ve been working on revamping the Active Record query interface for the last few weeks ( while taking some time off in India from consulting work, before joining 37signals ), building on top of Emilio’s GSOC project of integrating ARel and ActiveRecord. So here’s an overview of how things are going to work in Rails 3.
Rails 3 Reading Material | Medium eXposure
Rails 3 is going to bring a lot of new stuff to the table. Wouldn’t hurt to organize some reading material in categorized and chronological order. So here goes whatever I scavenged so far. Leave comments so I can add more links or if I should mark something as obsolete.
Episode 104: Something New | Rails Envy
Episode #104: Something new. I’m sad to say that this will be the last episode of the Rails Envy podcast. I’m happy to say that Dan and I will be doing The Ruby Show which will follow the same general flow of Rails Envy. There’s no need to update your feeds (though you can if you’d like) because the feed will redirect for the foreseeable future. We’ve also got some other fun stuff planned so stay tuned!
Getting Up To Speed With Rails 3
I’m proud to announce that darwinweb.net is now running Rails 3.0-pre. I undertook the project as part of Bugmash last weekend, but it turned out to be a very deep rabbit hole; a two-day bugmash was too short to really dig into the meat of Rails 3 which is in ample supply.
The scope of changes to Rails is astonishing. There’s a lot of new blood contributing and brilliant ideas are popping left and right. The result is that Rails 3 represents a major maturation inflection point. It’s graduating from the scrappy, opinionated upstart to a very modular and full-featured framework containing what may once have been considered a disturbing amount of enterprise-readiness. It’s bittersweet and perhaps a bit ironic that the internals have acquired so many moving parts, but as a professional Rails developer the new flexibility and modularity is far too awesome to denounce in any way.
How to Make a Heatmap – a Quick and Easy Solution | FlowingData
In case you don’t know what a heatmap is, it’s basically a table that has colors in place of numbers. Colors correspond to the level of the measurement. Each column can be a different metric like above, or it can be all the same like this one. It’s useful for finding highs and lows and sometimes, patterns.
On to the tutorial.
Step 0. Download R
When should you store serialized objects in the database? | MySQL Performance Blog
A while back Friendfeed posted a blog post explaining how they changed from storing data in MySQL columns to serializing data and just storing it inside TEXT/BLOB columns. It seems that since then, the technique has gotten more popular with Ruby gems now around to do this for you automatically.
Perfection kills » Optimizing HTML
Mister Bleigh - Rails Quick Tip: Readable Conditional Validation
This is something that many may already use as a best practice, but if not it’s something simple and convenient to add to your repertoire. Sometimes you may have a model that requires additional information if a certain condition is met. For example, I may require a user to add more information about themselves if they wish to be listed publicly, whereas I would not if they do not wish to be listed. By combining ActiveSupport’s Object#with_options and ActiveRecord’s conditional validations, we can implement this behavior in a straightforward and readable manner (assuming here that there is a boolean field called “listed” in the database that is exposed as a checkbox or similar to the user):
PostageApp - Benefits & Features
Josh, The Rails Guy - Ruby, Rails & 5 Ways to Improve Performance
When I was speaking last night at the BIMA & Ultraspeed Virtualisation event on virtualisation and web application development, I was surprised to find that not a lot of people know about the simple ways that you can improve performance without much development or systems administration time at all.
In fact, most of the techniques that I’m going to go over aren’t new, and are pretty well publicised. Both Google and Yahoo! both go over them in tonnes of detail.
This post is kicking off a series that I’m doing about moving your skills and migrating your code to Rails 3. I’ll be sharing some practical insights and covering some pretty in-depth topics as we go along (I’ve got some notes for entries about upgrading plugins, taking advantage of new features like the agnosticism, migrating applications, and so on), but before I go into a lot of specifics, I thought it might be useful to go over some of the high-level philosophical and architectural changes that have gone on in the Rails code between versions 2 and 3.
LukeW | Development Tools From An Event Apart
The An Event Apart conference in San Francisco, CA last month introduced me to a lot of interesting projects, frameworks, and tools for Web development. Though some of these have been around for a while, seeing them all together (compiled across all the speaker’s presentations) got me really excited about what can be done online. So you can share in that excitement too, here’s the list.
Sometimes It’s The Little Things « Grumpy Old Programmer
From time to time I trawl through my blog subscriptions: some are defunct while others may have changed their feed details sufficently that they’re no longer being picked up. I have about 270 subscriptions, which makes the job a chore and hence it doesn’t get done very frequently. The upshot is, for the case where the blog hasn’t just died, I sometimes miss something.
What should we do with tedious manual activities? Automate! I went and did some investigation.
Wait till I come! » How I build my data.gov.uk mashup – UK-House-Prices.com
UK-House-Prices.com is a web site to see how the prices in a certain area changed over the years using a data set released by the UK government as part of the data.gov.uk initiative.
ActiveWarehouse: Extract-Transform-Load Tool
The ActiveWarehouse ETL component provides a means of getting data from multiple data sources into your data warehouse. The links in the side bar provide additional information on ETL.
How To Create an IE-Only Stylesheet | CSS-Tricks
If you read this blog, there is a 99% chance you’ve had a hair-pulling experience with IE. But if you are worth your salt as a CSS coder, you should be able to deal with it. I am of the opinion that you can handle anything IE can throw at you without the use of hacks. Hacks are dangerous, since they are based on non-standard exploits, you can’t predict how they are going to behave in future browsers. The tool of choice for fighting IE problems is the conditional stylesheet. IE provides comment tags, supported all the way up to the current IE 8 to target specific versions, as well as greater-than/less-than stuff for targeting multiple versions at once.
Free Website Uptime Monitor: Uptime Robot
Uptime Robot is a totally free service which monitors your websites every 5 minutes & alerts you if they go down.
It allows you to monitor up to 50 websites & alerts can be received via e-mail or SMS
UK Launches Open Data Site; Puts Data.gov to Shame
A new website dedicated to making non-personal data held by the U.K. government available for software developers has launched today with the help of Sir Tim Berners-Lee, the inventor of the World Wide Web. Data.gov.uk is being slammed with traffic but six months after the U.S. government opened its Data.gov site the U.K. site already has more than three times as much data than the U.S. site offers today.
Ruby on Windows: Connecting to One of Many Open Documents
word = WIN32OLE.connect(’Word.Application’)
That works great if you have just one instance of the application running, with one or multiple documents open. But suppose you have multiple instances of the application running? How can you be sure that you connect to the instance with Document B, and not the instance with Document A?
nvie.com » Blog Archive » A successful Git branching model
In this post I present the development model that I’ve introduced for all of my projects (both at work and private) about a year ago, and which has turned out to be very successful. I’ve been meaning to write about it for a while now, but I’ve never really found the time to do so thoroughly, until now. I won’t talk about any of the projects’ details, merely about the branching strategy and release management.
ThinkingSphinx exits, enters ActsAsSolrReloaded | Diego Carrion
Annoyed with the situation of the project, I decided to fork the fork I liked the most and created a new repository called acts_as_solr_reloaded, with new features. This way, I hope the project gets easier to be found and that it gives more trust. I’m also compromising myself to keep the repository up to date and to pull contributions.
As today, the new features acts_as_solr_reloaded comes with are:
* support for dynamic attributes
* geo-localization or geo-spatial search
* integration with acts-as-taggable-on
* highlighting
* relevance ranking
jQuery Lint is a simple script you can download and use with jQuery. It works over the top of jQuery and diligently reports errors and any incorrect usage of jQuery. It will also, to some extent, offer guidance on best practices and performance concerns.
Unlike JSLint, jQuery Lint is a runtime reporter.
Web Security: Are You Part Of The Problem? - Smashing Magazine
Website security is an interesting topic and should be high on the radar of anyone who has a Web presence under their control. Ineffective Web security leads to all of the things that make us hate the Web: spam, viruses, identity theft, to name a few.
pivotal’s refraction at master - GitHub
Luke Melia » Redis in Practice: Who’s Online?
Redis is one of the most interesting of the NOSQL solutions. It goes beyond a simple key-value store in that keys’ values can be simple strings, but can also be data structures. Redis currently supports lists, sets and sorted sets. This post provides an example of using Redis’ Set data type in a recent feature I implemented for Weplay.
Weplay members were told us they wanted to be able to see which of their friends were online, so we decided to add the feature. Let’s look at how Redis was instrumental in this functionality.
Should You Use JavaScript Library CDNs? « Lickity Split
JavaScript Library CDNs seem like a performance no brainer. Use the service, your site is loads faster and consumes less bandwidth. This post will explore if and under what conditions does a JavaScript Library CDN actually improve web performance.
Importing Legacy Data in Rails - blah blah woof woof | tim riley
ur current work project is a long-overdue rebuild of a critical business system as a modern Rails web app. We’re building this thing according to agile practices to the best of our ability. Each week we provide a new, working release that is an incremental improvement on the last. We’re not looking to replace the current system in a single swoop, and expect the new system to work alongside the old one for quite a while.
This means that we’ll need to maintain the same data in both systems for the duration of their lives together. We don’t want the new Rails app to access the data directly from the old app’s database, since this would prevent us from following the conventions that makes working with Rails so pleasant. Instead, we’ve come up with a way to import the legacy data into a new database.
airblade’s paper_trail at master - GitHub - sconover-code
PaperTrail lets you track changes to your models’ data. It’s good for auditing or versioning. You can see how a model looked at any stage in its lifecycle, revert it to any version, and even undelete it after it’s been destroyed.
Simple named_scope Searching | Viget Extend
One of the coolest aspects of named_scopes in ActiveRecord is their ability to chain together. One can chain a number of named_scopes onto each other, and the result is a single SQL query. Using this feature, I’ve come up with an easy way to do some simple searching.
jQuery 1.4 Released: The 15 New Features you Must Know | Nettuts+
jQuery 1.4 was recently released. This wasn’t simply a maintenance release as some had speculated; there are many new features, enhancements and performance improvements included in 1.4! This post covers the new features and enhancements that you may find beneficial.
Nginx Development Script for Passenger | Free PeepCode Blog
But even with the minimal configuration needed to create a new Passenger app, it’s inconvenient for spontaneous apps or small demos. If I want to try out a Rails 3 application with Passenger, I don’t want to configure a new virtual host for just a few minutes of experimentation.
At RailsCamp 6, PeepCode author Pat Allan showed a beautiful solution. It’s a script that starts Nginx from any directory3 using a shared configuration file. I modified it ever so slightly and posted a screencast above with a walkthrough.
On-the-fly image handling with Dragonfly @ Bamboo Blog
Dragonfly, a Rack-based ruby gem for processing/encoding on the fly.
Making Friends with FFI | Atomic Spin
Make friends. If you want your C code to play nicely with the other VMs out there, then FFI (foreign function interface) is the answer. FFI is built-in to JRuby and MacRuby; MRI requires a compiled gem for FFI access. After a night of experimentation, I was able to get C code from the Chipmunk Physics library running in Ruby via FFI (chipmunk-ffi). Just tell FFI what function to attach, what arguments it takes, what the return type is, and it will take care of the rest. FFI is a great tool that any Ruby developer should have in their tool belt and consider against writing a C extension.
Ruby FFI wrapper to the “magic” library, that determines content type and encoding of files and strings. The library does three types of tests: filesystem tests, magic number tests, and language tests. The first test that succeeds causes the file type to be returned.
Using Geokit with Searchlogic - Binary Logic
For those of you that don’t know, geokit is a great little gem that allows you to geocode addresses. It adds in very easy to use options in the ActiveRecord find method. Ex:
# will return all venues within 10 miles of the 10018 zip code
Venue.find(:all, :origin => “10018″, :within => 10)
The problem is that you can’t use geokit options in a named scope. Since searchlogic is named scope driven this presented a problem. So I wrote a little module that transfers geokit options from named scopes to the actual arguments of the method:
How to Create Facebook Style Footer Admin Panel | Web Resources | WebAppers
Trend All the Fucking Time (TRAFT?) | James on Software
My new years resolution was to measure more. For a while now, I’ve wanted to get a better picture of our systems and our business, and hopefully, how they relate.
So, my first day back at work after the holidays, I started looking for the right tool to gather data with. After investigating some of the options, I wound up settling on munin.
I say settling because I was quite dissatisfied with the available options. I tried everything from collectd to reconnoiter and found all of the solutions horribly lacking in some way. This is an enormous market just waiting for a startup to revolutionize it.
In any event, we were already using munin to trend our system metrics. So, now it was just a matter of figuring out how to get our business metrics in there. Here’s how we did
Powerful Color Manipulation with Sass : Nex3
There’s a lot of exciting stuff coming down the pipeline for Sass 2.41. I want to keep folks up-to-date on what they have to look forward to, so I’m starting a series of blog posts detailing the new features I’ve been working on.
New Color Functions
One of the new features I’m most excited about is a huge expansion in the color-manipulation capabilities of Sass. Sass has always supported arithmetic with colors, allowing them to be added, subtracted, and even multiplied. For example, #f00 + #00f = #f0f in Sass.
Ruby 1.9 character encoding field notes · Fingertips
As you probably already know the String class became encoding aware in Ruby 1.9. This makes it possible to manipulate strings on the character level instead of on byte level. However, it’s still a general purpose API which means writing a few lines of code to get stuff done.
It’s common to choose one internal representation for character data in an application and convert all incoming strings to this representation. For example, in modern applications strings are often encoded in UTF-8 or UTF-16. I took some time to figure out how to do this in Ruby 1.9.
ActiveModel: Make Any Ruby Object Feel Like ActiveRecord « Katz Got Your Tongue?
Rails 2.3 has a ton of really nice functionality locked up in monolithic components. I’ve posted quite a bit about how we’ve opened up a lot of that functionality in ActionPack, making it easier to reuse the router, dispatcher, and individual parts of ActionController. ActiveModel is another way we’ve exposed useful functionality to you in Rails 3.
zerosum dirt(nap) - Resque Mailer
Following in the footsteps of DelayedJobMailer, ResqueMailer allows you to shift processing of your existing mailers to an async Resque worker without doing pretty much anything. Just install the gem in your Rails project (via Gemcutter) and then mix the Resque::Mailer module into your mailer.
Website Performance: What To Know and What You Can Do - Smashing Magazine
The good news (and hard truth) about performance is that 80 to 90% of poor performance happens in the front end. Once the browser gets the HTML, the server is done and the back-end developer can do nothing more. The browser then starts doing things to our HTML, and we are at its mercy. This means that to achieve peak performance, we have to optimize our JavaScript, images, CSS and HTML, as well as the back end.
Phusion Passenger 2.2.9 released « Phusion Corporate Blog
Phusion Passenger is under constant maintenance and development. We are pleased to announce Phusion Passenger version 2.2.9.
Fixed compatibility with Rails 3.
What’s up with the Gem Bundler?
Fixed support for ActiveRecord subclasses that connect to another database.
[Nginx] Fixed PCRE URL.
January 20th, 2010 / No Comments » / by admin
January 13th, 2010 / No Comments » / by admin
MR. FRIEDMAN: I think that issue is entirely orthogonal to the issue here because the Commonwealth is acknowledging -
CHIEF JUSTICE ROBERTS: I’m sorry. Entirely what?
MR. FRIEDMAN: Orthogonal. Right angle. Unrelated. Irrelevant.
CHIEF JUSTICE ROBERTS: Oh.
JUSTICE SCALIA: What was that adjective? I liked that.
MR. FRIEDMAN: Orthogonal.
CHIEF JUSTICE ROBERTS: Orthogonal.
MR. FRIEDMAN: Right, right.
JUSTICE SCALIA: Orthogonal, ooh.
January 12th, 2010 / No Comments » / by admin
POLICE RETRIEVE £500,000 WORTH OF CANNABIS AT AN INDUSTRIAL UNIT IN SMETHWICK
POLICE in Smethwick have recovered an estimated £500,000 worth of cannabis from an industrial unit on the Bridge Industrial Estate in Bridge Street North.
Retrieved and recovered? I wish these stoners would learn English. It would also be pretty nice if their web devs could ‘discover’ title elements.
We have not only taken a massive amount of drugs off our streets but we have also shown the local community we have listened to their concerns and acted rapidly.
I doubt I could pass up the chance to say that West Midlands police had taken massive amounts of street drugs either.
January 9th, 2010 / No Comments » / by admin
At flickr, there are quite a few photos and you can browse the site in 8 different languages, including Korean and Chinese. Common metadata such as title, description and tags can be pre-populated based on information contained in the image itself, using what is commonly called EXIF information. So, it makes sense to implement this with respect to language and, above all, alphabet/character encodings.
Code: Flickr Developer Blog » A Chinese puzzle: Unicode and EXIF metadata parsing.
January 8th, 2010 / No Comments » / by admin
Ruby/Rails: Loading Seed Data for Tests | Pathfinder Development | Software Developers | Blogs
Rails 2.3.4 includes a new rake task for loading seed data called db:seed. It suggests keeping all seed data as a ruby code inside of db/seeds.rb file. The issue with this is this is not DRY. You have duplicate set of representation for seed data: one side of seeds.rb and one in fixture files (.yml). Keeping them in sync is a pain and all the other disadvantages that come with not having single source of truth.
BBC - Web Developer: Always read the label
Text fields in forms need to have labels, so that people know what they’re meant to enter into them. Next to a username field, for example, it’ll say something like “Enter your username”. The HTML you’d use for this would involve a label tag, with id and for attributes tying everything together. The association between label and input lets the browser know which hint applies to which field.
Mocking and Stubbing can be evil - Rails Freak
Lately I’ve been seeing some things that make me worry. Mocking and stubbing can be very helpful tools when you use them right, but I am not seeing them used right!
Tipsy is a jQuery plugin for creating a Facebook-like tooltips effect based on an anchor tag’s title attribute.
rgrove’s sanitize at master - GitHub
Sanitize is a whitelist-based HTML sanitizer. Given a list of acceptable elements and attributes, Sanitize will remove all unacceptable HTML from a string.
Using a simple configuration syntax, you can tell Sanitize to allow certain elements, certain attributes within those elements, and even certain URL protocols within attributes that contain URLs. Any HTML elements or attributes that you don’t explicitly allow will be removed.
Because it’s based on Nokogiri, a full-fledged HTML parser, rather than a bunch of fragile regular expressions, Sanitize has no trouble dealing with malformed or maliciously-formed HTML. When in doubt, Sanitize always errs on the side of caution.
Subdomains and sessions to the rescue! | Plataforma Tecnologia Blog
We have been working on an application that allows administrators to create accounts for their users. Each account will be accessible under a subdomain, so we needed to setup a subdomain environment inside our application, and also in our development machine. In addition, we must be able to let the users signed in among several subdomains, as a user can access other accounts when allowed.
After some research we decided to go with the subdomain-fu gem, which is great to give your application the ability of handling subdomains. Another great resource we have used is Ryan Bates’ screencast about the subject. But they did not solve our problem completely, so here we are going to document a few steps to help you get up and running easily with subdomains and sessions.
Strangest language feature - Stack Overflow
A bunch of examples of the principle of most surprise.
Recently I found myself wanting to use Rails validations semantics outside the context of saving an object. It wasn’t enough to force save without validations because I actually wanted to have some validations applied to the life-cycle of the object, and other validations for various other purposes including user feedback and control flow of other object modifications.
I ran a few searches on Github and came up with a few interesting projects including soft_validations, validation_groups, validation_scenarios (the closest to what I was looking for), and partially_valid. However none of these really hit the nail on the head. Either they didn’t expose enough of validations goodness, or the syntax just didn’t fit what I was looking for.
Confreaks: RubyConf 2009 Post-mortem
No doubt many of you are wondering why the RubyConf and JRubyConf videos are taking so long to release this time around. We felt it was important to share a few more details about some of the challenges we’ve been facing this time around.
Rails 3 beta eyed for late January release | Developer World - InfoWorld
Ruby on Rails 3, an upgrade to the popular Web development framework that merges Rails with the alternative Merb framework, is due to be offered as a beta release by the end of this month, the founder of Rails said on Monday afternoon.
If it is not out by the end of this month, then the feature-complete beta will be out in February, said David Heinemeier Hansson, founder of Rails. General release of the completed Rails 3 framework is targeted for the first quarter of 2010. With the beta release, builders of Rails seek to ensure backward compatibility with previous versions of Rails and want live applications running on the upgrade.
Christmas Gem: Redcar 0.3.0dev at Redcar
Redcar is an open-source programmers’ text editor for Ruby, written in Ruby. It is designed to be compatible with Textmate bundles (a work in progress) and run cross-platform on JRuby. Redcar is currently in the middle of begin ported to JRuby, please subscribe to get updates on our progress.
How Not To Sort By Average Rating
PROBLEM: You are a web programmer. You have users. Your users rate stuff on your site. You want to put the highest-rated stuff at the top and lowest-rated at the bottom. You need some sort of “score” to sort by.
WRONG SOLUTION #1: Score = (Positive ratings) - (Negative ratings)
Why it is wrong: Suppose one item has 600 positive ratings and 400 negative ratings: 60% positive. Suppose item two has 5,500 positive ratings and 4,500 negative ratings: 55% positive. This algorithm puts item two (score = 1000, but only 55% positive) above item one (score = 200, and 60% positive). WRONG.
Gravatars: why publishing your email’s hash is not a good idea
There is a piece of information which must be made public, though. It’s this 32 char string which serves as a token for your web browser to retrieve the right image. How much information are we leaking to the bad people inhabiting the internet? Can that key be used to retrieve our email?
The email’s hash gives a quick way to check whether a certain email is the one associated to your profile. Given a list of emails, you can check whether the user has registered with one of them.
Rackamole: Rack-Based Monitoring For Your Ruby Web Apps
Rackamole (GitHub repo) is a Rack application that lets you to monitor the interactions between users and your own Rack-based application (e.g. any Rails or Sinatra app). As well as pumping out information to the console or a log file, there’s a Web interface called Wackamole to give you the skinny on your app activity.
gist: 268192 - Rails 2.3.5 on App Engine- GitHub
We assumed Rails 2 would never work without rubygems, and we committed to gem bunlder for JRuby on App Engine, so we were waiting for Rails 3. Fortunately, Takeru Sasaki was able to patch the Rails 2.3.5 calls to rubygems, and now we have it working. Rails 2.3.5 currently spins up several seconds faster than Rails 3, and just a few seconds behind Sinatra.
Cryptic Ruby Global Variables and Their Meanings | Purify Blog
How many times have you looked at some ruby code and found strange variable names (eg. $0, $:, etc) and wondered what they meant? Below is a list of cryptic global variable names in ruby and their meanings.
‘Re: Why Git is so fast (was: Re: Eric Sink’s blog - notes on git,’ - MARC
So. Yes, its practical to build Git in a higher level language, but you just can’t get the same performance, or tight memory utilization, that C Git gets. That’s what that higher level language abstraction costs you. But, JGit performs reasonably well; well enough that we use internally at Google as a git server.
Debian/Ruby Extras - Dear Upstream Developers
Dear developer,
Your library/application is very good, and we would like to integrate it into our favorite distribution, so many more people would benefit easily from it. However, it would be great if you could make our work as easy as possible by following those guidelines.
Distribute your software as a source code archive
RubyGems is a useful tool for developers, but isn’t a good tool for the general distribution of your software (see this page for more information).
Distribute your software as a .tar.gz archive. .tar.gz is the most widely used archive format on Linux. Using other formats (.tar.bz2, for example) is discouraged, as it requires additional steps for the packager. A .zip file could be provided for Windows users.
Including the version of the software in the name of the archive is also a very good idea.
I <3 ruby-warrior - Steve's Blog
Every Saturday, I take some time out from my normally crazy schedule and work on XOmB, the operating system my friends and I have been working on. It’s usually a really nice break from my usually crazy schedule, hanging out with good friends and working on something completely different from what I’m normally working on. Pitt’s finals are coming up soon, and so most of the team is preparing. So rather than work on XOmB, I decided to take the week off and play around with something I heard about at the Pittsburgh Ruby Brigade’s meeting this week: ruby-warrior.
Adam Lowe: VIM Destroys All Other Rails Editors
Now that I have your attention, I’ve come across quite a few blog and forum posts from people looking for “the best” text editor or IDE to use for Ruby on Rails development. I was fortunate enough to meet Tim Pope soon after I got interested in Rails and was subsequently introduced to the awesomeness that Vim is capable of. It took some ramp up time to get comfortable with modal editing but now I find myself frustrated when I don’t have all the power that comes from Vim’s modal mindset.
A simple way to make birthday queries easier and faster at Xaprb
Queries to “find all birthdays in the next week” and similar are always a nightmare to write. If you want to see a bunch of examples, go look at the user-contributed comments on the MySQL date and time function reference. This post is about a slightly saner way to do that. There’s still some nasty math involved, but a) a lot less of it, and b) at least the query will be able to use indexes[1].
So here’s my tip: instead of storing the user’s full birthdate, just store the month and day they were born. Try it. You’ll love it!
Diving deep into user behavior with Google Analytics, Event Tracking, and jQuery
In a default Google Analytics setup, the information you have about your users’ navigation behaviors and preferences is limited to which pages they viewed and where they came from. But what does that really tell you about how your users behave inside your web pages? Not much, and that’s where all the juicy behavioral insight comes from.
alexjsharp.com Bundler is the new hotness: deploying rails apps with bundler and capistrano
This post is a compilation of useful tidbits I’ve learned from a few different sources as I’ve moved a rails app over to the new gem dependency hotness, bundler. There are a few steps involved here, and seeing that I’ve done the legwork in figuring them out, I figured I’d share what I’ve learned.
The Perils of 3rd Party APIs - ReadWriteStart
You never believe your home is going to be damaged by an earthquake, but for some it happens. If you build on a platform you don’t control, is this akin to laying your foundation on a fault line?
win32console 1.3.0 prerelease – DEV_MEM.dump_to(:blog) - Multimedia systems blog
I mentioned in previous post that I was working in a updated version of win32console.
So, just pushed to Gemcutter the prerelease version (_beta1_) so you guys can test with your current Cucumber/RSpec scenarios.
Paypal Adaptive Ruby Gem Released | Tommy Chheng
I have been tinkering with the new Paypal Adaptive Payments API and created a simple ruby gem to interface with it. Still pretty new but I’m using it with little problems so far. Submit bug reports if found. See the code at github
0×1fff: 35 Google open-source projects that you probably don’t know
Google is one of the biggest companies supporting OpenSource movement, they released more than 500 open source projects(most of them are samples showing how to use their API). In this article I will try to write about most interesting and free releases from Google, some of them might be abandoned.
Wandering Freelancer : Freelancing Gods
At a recent Melbourne Ruby meet, I was asked to speak about my travelling freelancer lifestyle, and the talk was recorded. I feel a little self-conscious about the topic, but perhaps you’ll find it interesting.
2009 Ruby survey results - GIANT ROBOTS SMASHING INTO OTHER GIANT ROBOTS
Here are the results as we head into 2010.
There are result reports linked to from within each section, and this post does not comprehensively list all the results, so click through if you’re interested.
SD Ruby - Episode 072: MongoDB
Scott Motte introduces us to the document-oriented database MongoDB and shows how to use MongoDB as an alternative to MySQL and ActiveRecord using the MongoMapper gem.
Sanity-check features in MySQL at Xaprb
MySQL has a couple of sanity-check features to help keep you from doing dumb things.
* max_join_size is a configuration option for the mysqld server program. It throws an error if you write a query that the optimizer estimates will examine more than this number of rows.
* –safe-updates is a command-line option to the mysql client program. It throws an error if you write an UPDATE or DELETE without a) a WHERE clause that refers to an indexed column or b) a LIMIT clause. It also sets the max_join_size and select_limit variables.
Interesting technologies in a new Rails application | Atomic Spin
About three weeks ago Ryan and I started a brand new Rails project. That in and of itself isn’t interesting, but some of the technologies we’ve pulled in are: * bundler * git-deploy * cancan * gritter * culerity
I like Unicorn because it’s Unix
Eric Wong’s mostly pure-Ruby HTTP backend, Unicorn, is an inspiration. I’ve studied this file for a couple of days now and it’s undoubtedly one of the best, most densely packed examples of Unix programming in Ruby I’ve come across.
Unicorn is basically Mongrel (including the fast Ragel/C HTTP parser), minus the threads, and with teh Unix turned up to 11. That means processes. And all the tricks and idioms required to use them reliably.
MonoDevelop is an IDE primarily designed for C# and other .NET languages. MonoDevelop enables developers to quickly write desktop and ASP.NET Web applications on Linux, Windows and Mac OSX. MonoDevelop makes it easy for developers to port .NET applications created with Visual Studio to Linux and to maintain a single code base for all platforms.
Inside Ruby on Rails: Benchmarking your Ruby scripts – Simone Carletti’s Blog
Rails comes with a benchmark core extension built-in that extends the default benchmark Ruby library introducing the ms method. Unfortunately, the code doesn’t appear to be documented in the Rails API so you need to browse the source code to read its implementation.
Rails and Merb Merge: The Anniversary (Part 1 of 6) | Engine Yard Blog
A year ago today, we announced that Rails and Merb would merge. At the time, there was much skepticism about the likelihood of the success of this endeavor. Indeed, The most common imagery invoked by those who learned about our plans was a unicorn. At RailsConf last year (well into the effort), both DHH and I used unicorns in our talks, poking fun at the vast expectations we’d set, and the apparent impossibility of achieving everything we’d said we wanted to achieve for 3.0.
So we just went through this humongous (believe me!) effort of upgrading the technical platform for one of our existing Rails applications that was running Rails 2.1, Ruby 1.7 and Mongrel cluster. The goal was to upgrade to Rails 2.3, Enterprise Ruby 1.8.6 and Passenger. It all started out as well as you would think. Updating the Rails gem, Ruby version, installing/configuring Passenger and updating relevant gems was pretty quick and smooth. Some quick and dirty testing of the application did not reveal any major problems or issues. Great! You are thinking the upgrade is mostly done att this point before you move on to the tests in the application!
Generating Thousands of PDFs on EC2 with Ruby « Rails Dog
For about two months, we’ve been working on a static website that exposes the results of complicated economics model to non-economists. We decided to make the site static because of the overhead involved in computing the results and the proprietary nature of the model. We would simply pre-generate the output for all valid permutations of the inputs. The visitor could then choose her inputs from a questionnaire, click a button and immediately be shown the results.
The caveat of this decision is that in addition to the numerical outputs, three graphs and a summary (both in HTML and PDF) would need to be generated for each permutation. Since there were 3600 permutations, this would amount to 18000 files in total. Initial local runs of our generation process took about 30 seconds for each permutation, mostly due to embedding the graph images into the PDF. On a single machine, that would take 30 hours of uninterrupted processing! Clearly, this was a job for “the cloud”.
Easy Accessibility Testing with the NVDA Screen Reader (Yahoo! Developer Network Blog)
Among the various testing environments, screen readers remain one of the gray areas for many developers. There are a few reasons for this: sometime people ask why do they need to bother. But perhaps many of you ask “where do I get one?” or complain, “I don’t know what to do with this thing.” I hope this article will answer the last two concerns. Perhaps I’ll try to persuade you why you should bother in another article. Hopefully, though, you already know why accessibility is important for web development.
Dealing With Gem Development Dependencies | Atomic Spin
I have been working on a DataMapper adapter for a RESTful JSON web service. I put together a gem that includes the adapter implementation, as well as a few DataMapper::Resource classes that can be used as a starting point. I did not want to install my gem’s dependencies globally while developing it, so I ended up trying a couple of different things to manage my development environment.
Code: Flickr Developer Blog » Flickr Engineers Do It Offline
It seems that using queuing systems in web apps is the new hottness . While the basic idea itself certainly isn’t new, its application to modern, large, scalable sites seems to be. At the very least, it’s something that deserves talking about — so here’s how Flickr does it, to the tune of 11 million tasks a day.
Kartar.Net » Yes Mum, I’ll Behave: Beginning Behaviour Driven Infrastructure
So can we apply Behaviour Driven Development to our infrastructure to test that it is behaving correctly? Enter Behaviour Driven Infrastructure. Behavioural Driven Infrastructure or BDI applies the principles of Behavioural Driven Development to the management of infrastructure.
Ordering and comparing text in Rails and MySQL · Fingertips
Ordering and comparing text is a lot trickier than a lot of people expect, computer scientists even came up with a complicated name for it: collation. There are two groups of problems associated with collation: cultural and technical. Today we’re not going to focus on technical problems, but rather how the cultural problems influence the technical solution.
An example of a cultural difference is letter ordering in a language, in Swedish the Ä is ordered after the z and in German it follows the letter a. You can also discuss whether the ä is an alternative form of the a or if it’s a completely different character, this is relevant when implementing search. When searching for ‘nächste’ you might also be interested in text containing ‘nachste’.
Announcing Appsta 1.1.0 - Elliott J Draper - Freelance Developer
Appsta is at its core a library of helper methods for use in Rails templates, to help you build useful Rails app creation scripts that can cut down the amount of time it takes for you to get a new Rails app up and running with your standard setup. Everyone makes some initial modifications every time they break out the “rails” command, and by encapsulating this in a Rails template, you can save some time. Appsta added helper methods for setting up projects on GitHub, and setting up hosting environments on Heroku, amongst other things.
mycheckpoint is an open source monitoring utility for MySQL, with strong emphasis on user accessibility to monitored data.
It is SQL oriented: charts, reports and advances metrics are generated on the fly with views. There is no need for an external program to diagnose the data. In fact, mycheckpoint’s main duty is to to a one-time creation of a special purpose schema.
Recording of data is performed via a single INSERT command, which takes measurements from GLOBAL VARIABLES, GLOBAL STATUS, MASTER STATUS and SLAVE STATUS. There is no requirement that this measurement is taken by mycheckpoint itself.
Hey, welcome to my collection of why the lucky stiff links. Everything _why has published on the internet should be accessible from here. It works sort of like a museum that sells maps. Many of his abandoned writings are mirrored locally here, and everything else is through external links. I’m not sure who I’m talking to, so I’ll leave it at that.
Crowdsourced document analysis and MP expenses
As you may have heard, the UK government released a fresh batch of MP expenses documents a week ago on Thursday. I spent that week working with a small team at Guardian HQ to prepare for the release. Here’s what we built:
http://mps-expenses2.guardian.co.uk/
It’s a crowdsourcing application that asks the public to help us dig through and categorise the enormous stack of documents—around 30,000 pages of claim forms, scanned receipts and hand-written letters, all scanned and published as PDFs.
Tender Lovemaking » Blog Archive » Writing Ruby C extensions: Part 1
I like writing C extensions for Ruby. In this series of blog posts we’re
going to explore writing C extensions. I will cover topics including setting
up the development environment, TDD, debugging techniques, dealing with
Ruby’s garbage collector, cross compiling for windows, and more.
Rails Envy Podcast – Episode #103 | Rails Envy
Rails Envy Podcast – Episode #103
Why I think Mongo is to Databases what Rails was to Frameworks // RailsTips by John Nunemaker
Wait till I come! » cURL – your “view source” of the web
What is cURL?
OK, here goes. cURL is your “view source” tool for the web. In essence it is a program that allows you to make HTTP requests from the command line or different language implementations.
gotascii’s metaprogramming at master - GitHub
Intro to Ruby Meta-Programming
A collection of notes, codes and various further readings that accompanied the December 12th Hackday event.
SteamCode: Ruby and Simple Dynamic Programming
I’ve been reading”Ruby Best Practices” by Gregory T. Brown and it’s well worth checking out for anyone interested in Ruby. I’m in the middle of Chapter 3, “Mastering the Dynamic Toolkit” and thought I’d share a some simple bits of code that actually use dynamic programming.
We actually make use of the fact that with Ruby you can add a method_missing method to any class that allows you to capture calls to any method that are … well missing. Here’s a simple example that shows how it works.
Nati Shalom’s Blog: The Common Principles Behind the NOSQL Alternatives
A few weeks ago during my Qcon presentation, I went through the patterns of building a scalable twitter application, and obviously one of the interesting challenges that we discussed is the database scalability challenge. To answer that question I tried to draw the common pattern behind the various NOSQL alternatives, and show how they address the database scalability challenge. In this post I’ll try to outline these common principles.
Changelog - Episode 0.0.7 - Mike Dirolf from 10gen and MongoDB
Adam and Wynn spoke with Mike Dirolf from 10gen about their fast-growing MongoDB project. Mike gave us insight on how MongoDB came about, design decisions, and the future of this cool NoSQL server.
Changelog - Episode 0.0.6 - Steven Bristol from LessEverything and weekly news
Episode 0.0.6 - Steven Bristol from LessEverything and weekly news
In this episode, Adam, Wynn, and Steven Bristol of LessEverything fame discuss Erlang, Javascript on the server, Lighthouse, Docsplit, Rackamole/whackamole, unfollowing under-performing Twitter peeps, and suing domain squatters.
James on Software | Introducing Friendly: NoSQL With MySQL in Ruby
To make a long story short, we decided to fall back to MySQL. It’s battle hardened. We know its production characteristics and limitations. Backups are a science. We know we can count on it.
But, we have a lot of data, and adding fields and indexes was starting to get painful. Flexible schemas are one of the things that attracted me to NoSQL in the first place. Then, I remembered this article about How FriendFeed uses MySQL to store schema-less data. So, I decided to implement the system they describe in the article.
Since we put Friendly in to production, we’ve seen a significant increase in site performance. Friendly’s built-in caching has achieved a hit rate of 99.8%. We’re pretty happy with things so far.
Everything Sysadmin: How to make a product “sysadmin-friendly”?
At the most recent conference I moderated a panel of system administrators who had been in the audience watching the first day of presentations. It was our turn to “speak up” about what we had seen.
One of the useful things that came out of this panel was a list of “signs that a product was designed to be easy for system administrators to install and maintain.”
Here is a short version of the list:
NoSQL with MySQL in Ruby - Friendly
Store schema-less data in MySQL.
Evolve your data model without feeling the pain of migrations.
Build indexes offline
Building an index can take hours with a lot of data. Stay agile without taking your app offline.
Write-through and read-through caching baked right in.
Fast websites make more money. The 99.8% cache hit rate we see in production is a one-liner with Friendly.
Inside Ruby on Rails: Delegate – Simone Carletti’s Blog
If your project includes ActiveSupport, and every Rails project does, you have a more clean and easy way to implement the delegation pattern: the Module#delegate extension. It provides a delegate module you can use in your class or in your modules to delegate a specific method to an associate object.
Saving Arrays, Hashes, and Other Objects In Text Columns Using Active Record | Integrum
Have you ever wanted to store an array, hash or object in a database column? Using Active Record and YAML makes this completely painless. To do so, you must specify this with a call to the class method serialize. This makes it possible to store arrays, hashes, and other non-mappable objects without doing any additional work.
January 1st, 2010 / No Comments » / by admin
Number 2 on the list of the Greatest Canadians
December 30th, 2009 / No Comments » / by admin