Tag: web applications
How to get pdf version of “Build Your Own Ruby on Rails Web Applications”?
by on Feb.16, 2011, under Ruby and Rails
You all must be aware that Sitepoint.com was offering their book “Build your own Ruby on Rails Web Applications” free for 60 Days and the offer got expired only on 1st
If anyone has downloaded this book, could you please send it to me at abhishekasthana29@rediffmail.com
I am a newbee and found the preview chapters very useful.
How to get pdf version of “Build Your Own Ruby on Rails Web Applications”?
10 Awesome Ruby on Rails Techniques to Get You Started
by on Aug.13, 2010, under Ruby and Rails
Rails has seemingly set the web development world on fire these past few years. Popular web applications like Basecamp and Twitter have pushed Rails into the limelight as an excellent framework that any programmer (or even non-programmer) can quickly use to create applications.
One of the most popular aspects of Rails is how easy and intuitive it is to start using right out of the box. here are 10 tips that beginners can use to help with getting started with the powerful framework.
1. Utilize Source Annotations
If you’re a beginning programmer, you’ll soon realize that a major part of writing code is correctly writing source annotations and comments. while this tip isn’t necessarily Rails specific, it sure does pertain to solid rails coding. if you’re going to annotate your code, use these aptly named keywords:
- TODO – Used to show code that is incomplete or needs some work
- FIXME – Used to show code that is broken or buggy
- OPTIMIZE – Used where further optimizations need to be done
Using these function while programming Rails is especially helpful as Rails allows for adding rake tasks that help you search the code for all the occurrences and prints them out with the file name, line number, and the description.
rake notesapp/controllers/contacts_controller.rb: * [ 3] [TODO] factor out model verification to a filter * [ 4] [OPTIMIZE] optimize this * [ 5] [FIXME] it’s broken
Perfect for finding those little things that need some TLC within your code.
2. Monitor your Apps!
As your Rails applications start to become more complex, you’ll start to notice that some processes might need a tad more TLC in terms of optimization. In order to find those little bugs and errors in your code, try using the excellent Relic RPM to monitor your applications. Relic RPM gives you a chance to monitor all of the processes of your application, and gives you visual graphs and other helpful information to really get a handle on the processes that are causing slowness in your app.
The RailsTips blog has an excellent review of Relic RPM. Analytics are indispensable for developing successful and efficient Rails applications.
3. Group Operations in a Transaction
ActiveRecord is the handy persistence engine that allows you to do many cool things with data and logic. One of the really handy things that ActiveRecord allows you to do is to group multiple inserts in a single transaction. Zen and the Art of Computing gives an excellent example of this technique.
my_collection.each do |q| Quote.create({:phrase => q}) endQuote.transaction do my_collection.each do |q| Quote.create({:phrase => q}) endend
or for rolling back the whole transaction if any insert fails, use:
Quote.transaction do my_collection.each do |q| quote = Quote.new({:phrase => q}) quote.save! endend4. Sift through Page Elements with RJS
One of the incredibly useful aspects of Rails is the built-in support for Javascript and AJAX integrations. They even include a templating language for Javascript called RJS templates. RJS allows the programmer to easily update multiple elements of the page with AJAX.
To take the example a step further, you can use RJS to iterate through page elements and dynamically change them using AJAX. you can even change the elements on the page through CSS queries. For example, you could do something like:
page.select(‘#cssid li’).each { |item| item.hide }
Nifty, eh? Sifting through the elements can be incredibly powerful to use inside your application’s interface.
5. Cache Unchanging Data at Application Startup
Performance may not be a huge issue in the development stages of learning Rails, but eventually you’ll want to reach a point where your app is running quickly and smoothly. Caching is an excellent way to speed up an application. RubyInside has an excellent tip on how to cache data that isn’t changed often.
“If you have data that doesn’t change between application restarts, cache it in a constant somewhere. For example, you might have a YAML or XML file in /config that stores application configuration data, and you could load it into a constant in environment.rb, making lookups quick and easy application-wide.”
6. Practice to become a Rails Ninja
While it’s easy to get started with Rails, it takes work to become a pro. Many times beginning programmers believe that frameworks like Rails take out that learning curve, allowing them to quickly become experts. It never works that way. the Framework is only a tool to help you overcome many of the repetitive tasks associated with Ruby.
Jay Fields knows that mastering Rails isn’t easy. In fact he goes on to say the following:
“The screencasts and pictures don’t lie. It is easy to learn Rails and quickly become productive. however, the dirty little secret is that it’s very hard to be come an expert at utilizing Rails.
“Rails provides many helpers that make your life easy. but, you can’t entirely hide the fact that you’ll need to be proficient with Ruby, JavaScript, YAML, and SQL. Just like Rails, getting started with any of the above languages is easy, it’s mastering them that takes time and effort.
“You should always remember that the biggest aspect of becoming an expert is time and practice. Rails is a great framework, but it can only help you so far without doing any extra learning.”
7. move JavaScript to the Bottom
This is actually a great rule of thumb for just about any language, and it’s good to remember if you’re just getting started with Rails as well. Moving the Javascript includes to the bottom of the template (right before the
Rails 3 nears with release candidate availability
by on Jul.28, 2010, under Ruby and Rails
David Heinemeier Hansson, the creator of the Ruby on Rails web framework, has announced the availability of the first release candidate of Ruby on Rails 3, noting over 842 commits by 125 authors made to the code since the most recent beta. The release candidate, originally promised in June, was delayed for a fourth beta release and more testing.
Many of the fixes have focussed on bringing the performance up to Rail 2.3 levels with improvements to start up speeds and faster development cycles. Rails 3 is a major revision of Rails, bringing together the Rails and Merb frameworks to create a slimmer and faster platform for web applications written in Ruby. an early version of the release notes is available which covers the changes in architecture in the framework.
Heinemeier Hannson says that in use Basecamp, 37Signals flagship application, “went from insufferable to about 2.3 levels of enjoyment”. he did note though that Active Record performance still needed work and that the developers aimed to get it back to “at least 2.3 levels before release”. other changes in the Rails 3 release candidate include support for the MySQL2 gem, support for shallow routes (for shorter URLs), fixes to auto-loading and web encoding issues and a change which allows the rails command to work “even when you’re in a subdirectory”.
The details of the changes are available in the change logs for the ActionPack, ActiveModel, ActiveRecord and ActiveSupport components or in intricate detail in the commit history. Rails is available under an MIT licence and can be installed by running gem install rails –pre on a system with Ruby and RubyGems installed. The current stable release of Rails is version 2.3.8 and instructions for installing it are available on the Ruby on Rails web site.
(djwm)
<a href="http://www.h-online.com/open/news/item/Rails-3-nears-with-release-candidate-availability-1045806.htmltag:news.google.com,2005:cluster=http://www.h-online.com/open/news/item/Rails-3-nears-with-release-candidate-availability-1045806.htmlTue, 27 Jul 2010 10:22:38 GMT 00:00″>Rails 3 nears with release candidate availability
The Future of Web Development
by on Jun.12, 2010, under Ruby and Rails
“Ruby on Rails is a breakthrough in lowering the barriers of entry to programming.
Powerful web applications that formerly might have taken weeks or months
to develop can be produced in a matter of days.”
-Tim O’Reilly, Founder of O’Reilly Media
Read more quotes
“Rails is the most well thought-out web development framework I’ve ever used.
And that’s in a decade of doing web applications for a living. I’ve built my
own frameworks, helped develop the Servlet API, and have created more than
a few web servers from scratch. Nobody has done it like this before.”
-James Duncan Davidson, Creator of Tomcat and Ant
Read more quotes
“It is impossible not to notice Ruby on Rails. it has had a huge effect both in
and outside the Ruby community… Rails has become a standard to which even
well-established tools are comparing themselves to.”
-Martin Fowler, Author of Refactoring, PoEAA, XP explained
Read more quotes
“What sets this framework apart from all of the others is the preference for
convention over configuration making applications easier
to develop and understand.”
-Sam Ruby, ASF board of directors
Read more quotes
“Before Ruby on Rails, web programming required a lot of verbiage, steps and time.
Now, web designers and software engineers can develop a website
much faster and more simply, enabling them to be more productive
and effective in their work.”
-Bruce Perens, Open Source Luminary
Read more quotes
“After researching the market, Ruby on Rails stood out as the best choice.
We have been very happy with that decision. We will continue
building on Rails and consider it a key business advantage.”
-Evan Williams, Creator of Blogger and ODEO
Read more quotes
“Ruby on Rails is astounding. Using it is like watching a kung-fu movie,
where a dozen bad-ass frameworks prepare to beat up the little newcomer
only to be handed their asses in a variety of imaginative ways.”
-Nathan Torkington, O’Reilly Program Chair for OSCON
Read more quotes
“Rails is the killer app for Ruby.”
Yukihiro Matsumoto, Creator of Ruby
Read more quotes