PhD student at Warsaw University of Technology, uses Ruby to write my dissertation’s code on implementation of finite state machines in FPGA devices. Talk is based on the experiences with PhD codebase and whether choosing Ruby for a computation-intensive application is a sane thing to do.
Patrick Hüsler - Hacking together small OSX apps with MacRuby
Patrick is a computer enthusiast and the proud owner of huesler informatik which is based in his home country Switzerland. Wanting to work abroad and travel from city to city he got stock in Berlin(because he loves it there), where he has been working on several different Rails projects for the last two years. When he is not writing Ruby code or working on web projects, he plays around with new technologies and dreams of surfing waves all around the globe.
Rocky Bernstein is the current maintainer of ruby-debug and related gems. All of the IDEs for Ruby debuggers, such as Eclipse, Aptana, and Netbeans/JRuby, use some portion of this code. He has also written debuggers for a number of other systems including bash, ksh, zsh, Python and GNU Make. Many OS distributions provide packages for some set of these.
Yehuda Katz is a member of the Ruby on Rails core team, and lead developer of the Merb project. He is a member of the jQuery Core Team, and a core contributor to DataMapper. He contributes to many open source projects, like Rubinius and Johnson, and works on some he created himself, like Thor.
Marcin Bunsch - Scripting Mac applications with Ruby
Marcin Kulik lives in Cracow and is a senior developer at Lunar Logic Polska. He breathes HTTP. He was dealing with wide variety of web and distributed applications for several years, in various languages like Ruby, Python, Java and PHP. He’s experienced web developer with tens of web applications developed and deployed on various setups. He also has experience in developing distributed, high-availability server-side apps. Marcin always tries to use right tool for right job and that’s why he likes to try out new technologies.
José Valim - DSL or NoDSL? - The power is in the middle
Couldn’t find a video for this one. Anyone? Bueller? Bueller?
Elliot is a developer for Eden Development in the UK, and specialises in Ruby on Rails and UX work. Seeking asylum in the Ruby community after fleeing the world of .NET, he gives back where he can, and works to improve the libraries he loves. An eclectic learner, Elliot feels ideas from disciplines such as architecture, psychology and economics can improve the way we write code and interact with our users.
Tim Lossen works as Ruby backend developer at social gaming startup wooga. He fell in love with Ruby in 2005 and is an active member of “rug-b.de” (Ruby User Group Berlin). Tim lives in Berlin with his girlfriend and two small daughters. In his spare time he likes to work on secret hardware projects down in the basement.
Florian Hanke - Building a search engine with Ruby
Karel Minařík is as a freelance designer and developer of web applications, consultant, software architect and Ruby, Rails and Git evangelist. He lives in Prague with his wife and two daughters.
Speakers:
Patrick - Choctop - Packaging and Deployment for Cocoa
Bernard Potocki - Socky - Websocket Push Server for Ruby on Rails
Michał Czyż - Cucumber Feature Manager
Unnamed Speaker - Documention - Rails Guides like project documentation
Yehuda Katz & Jose - Muse -A library that can create HTML or PDF books from an extended Markdown format
Day 1 - 29th May 2010
Mislav Marohnić - Getting and loading code: current state of packaging & best practices
Ruby programmer since 2004 and (together with some friends) running the largest Bulletin Board/Wiki for Ruby in Germany. Nowadays, is exclusively using Ruby 1.9 to good results. Since 2007 (Vienna), attends EuRuKo, usually holding a lightning talk (Prague: Patterns, Barcelona: A blues in doc minor).
Elise Huard - Evaluating quality of Rails codebase
After her studies in metallurgy, Elise realized job in that area were not her cup of tea, and she looked for jobs in an earlier interest, software. Since then, she’s been rolling through jobs in C, C++, Java, a master in AI, before falling in love with Ruby and going freelance. 10 years of software have helped her get a firm understanding on what works, what doesn’t, and what will make you cry bloody tears on nights before deadlines. She’s a jack of all trades, loves reading, tinkering, food, travel, learning, and people out of the ordinary.
Talk about the Ruby Community’s Values from the creator of Ruby.
Scott Chacon - Gittin’ down to the plumbing
Scott Chacon is a Git evangelist and developer working at GitHub.com. He is the author of the Pro Git book by Apress (progit.org), the Git Internals Peepcode PDF as well as the maintainer of the Git homepage (git-scm.com) and the Git Community Book. Scott has presented at LinuxConf.au, OSCON, RuPy, Symfony Live, Ruby Kaigi, RailsConf, RubyConf, Scotland on Rails and a number of local groups and has done corporate training on Git across the country.
Tomasz Stachewicz - Putting the static back into Ruby
Tomasz is a full-time rubyist since early 2007. Besides working with Ruby, evangelizing Ruby and building Warsaw Ruby community, he also follows the world of compiled languages in search for inspiring tools and methods. Recently he’s been exploring how much can be squeezed out of Ruby using static code analysis and other methods less-than-popular in the Ruby world.
Sven Fuchs is the author of the I18n gem which is shipped with Rails to provide internationalization support. The gem is built in a modular way to make it easy for you to pick optional and add your own features. In this talk we will go over the architecture of the I18n gem and the advanced, optional features it comes with. We will also cover a few external extensions that are useful for building internationalized Rails applications.
Marcin Kulik lives in Cracow and is a senior developer at Lunar Logic Polska. He breathes HTTP. He was dealing with wide variety of web and distributed applications for several years, in various languages like Ruby, Python, Java and PHP. He’s experienced web developer with tens of web applications developed and deployed on various setups. He also has experience in developing distributed, high-availability server-side apps. Marcin always tries to use right tool for right job and that’s why he likes to try out new technologies.
Nicolás Sanguinetti - Continuous Integration and why you need it
foca has been hacking and building stuff since he first got his hands on a computer. About 6 years ago he started doing some web development, and then when rails came out he fell in love and started playing with it immediately. He loves learning new things on his own and making sure that he’s doing things “the best way possible,” and is a huge board game geek
Neil Straford and Jason Goecke - Tropo.com - Voice, IM and SMS enable your application
Jason is the operationalizer, organizer, co-pilot, co-evangelist and lead business developer of Adhearsion. He brings extensive experience in telecoms and enterprise call centers having been an original employee of the leading CTI company, Genesys, where he is an inventor on multiple patents. He enjoys his family, sailing and of course all that is technology.
UPDATE: Now that I have finished this I find a much nicer site with all this. Oh well. I guess I’ll just have to be a redunce and post this anyway in case the other resource goes away.
Get more done by giving each task a finite duration. Simply choose a number of minutes and a website or search, and enter them in your browser address bar, or use the Start Timer link below.
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.
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?
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.
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.
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.
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:
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.
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.
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.
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.
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.
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.
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.
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.
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.
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!
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.
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.)
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.
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.
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.
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.
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).
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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:
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.
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
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.
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.
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 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. 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!
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.
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.
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.
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):
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.
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.
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.
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.
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.
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.
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.
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?
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.
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:
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.
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.
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.
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.
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.
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.
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 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.
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.
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.
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
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:
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
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.
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.
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.
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.
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.
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.
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.
I am a Canadian expat living in the UK. Born in Montreal, grew up in Misssissauga,
lived in Guelph, London and Ottawa before moving to Birmingham, UK. Married
to Kimberly Quinn. I program things and lately I have been using Ruby and Rails to
get 'er done.