Cutting Edge – Bleeding Edge

We’re a Rails shop. We like new technologies. Especially ones that save us on development time. But riding on the cutting edge of technology can sometimes have the rather undesired effect of cutting yourself and bleeding a little. So let me save you some pain by introducing you to a set of tools indispensable when developing Ruby on Rails web applications:

  • Firefox Web Developer – This excellent toolbar is more than meets the eye. At first you might think that it’s just a regular toolbar with a bunch of buttons whcih serve as shortcuts. Sure it does that but there is so much more. Some of my favourite tools that come with this utility are:

    • Validate Speed Report – this little gem submits the URL of the current page to a site which evaluates the speed with which the given page loads. It gives you a comparison between dial-up and various flavours of broadband. It warns you if you have too many script files or images.

    • Resize – ever wondered what would your page look like at 800×600? Any other res? Not a problem, this tool resizes Firefox window to any resolution you pick.

    • Outline – how many times have you put “border: 1px solid red;” into your CSS to see the outlines of your container elements? Now this essential function is just a mouse click away. You can show outlines of pretty much anything, including tables.

  • Firefox FireBug – this extension is simply indispensable when you’ve got a lot of JavaScript in your web application. So what do you get?

    • You get an interactive JS console which lets you execute arbitrary JS expressions including methods on your objects.

    • You get an interactive JS debugger. The console has a bunch of really useful features, such as the ability to track and report all XMLHTTPRequest objects. This is simply indispensable when you’re developing AJAX applications.

    • You get a DOM inspector. Switch into interactive inspect mode and as you mouse-over your page the appropriate part of the DOM tree gets highlighted. Or you can go through the tree manually and select the node of interest.

  • Firefox HTML ValidatorHTML Validator is a Mozilla extension that adds HTML validation inside Firefox and Mozilla. The number of errors of a HTML page is seen on the form of an icon in the status bar when browsing. The details of the errors are seen when looking at the HTML source of the page. You can evan tell it to fix your page at which point you will get a copy of your page with all validation errors resolved the best that they can be resolved.

  • Rails script/console – I think that many people don’t know about this, don’t understand this tool or simply forget about it. Yet this is one of the more useful tools wehn writing a Rails app. Basically what you get is an interactive Ruby console (IRB) which hooks into the guts of your application and lets you interact with yourmodels. You can create new instances, inspect existing instances and run any method on any model instance. And if you runthe console with —sandbax argument all database changes will be rolled back on exit.

    Here’s another goodie, press TAB to auto-complete method names. If you type in something like “User.” and then press TAB you will get all the methods for the User class.

    This command Dispatcher.reset_application! allows you to reload all your model definitions.

    I saved the best till last. Once you’re in the console the application object is is available as app. Once you know this, you can do really useful things like:

    app.url_for :controller => 'some_controller', :action => 'some_action'
    

    or how about this:

    >> helper.pluralize 2, "foo"
    => "2 foos"
    

    There is so much more. I urge you to just play with it. Experiment. Learn. Enjoy.

  • tail -f log/development.logtail is a UNIX shell command which lets you monitor contents of a file as it grows. The development log contains all sorts of really useful information about the execution of your application, such as SQL queries being executed, which controller actions are being called with what parameters and of course error messages

This is a long post but I really wanted to list all those tools in one place because they all complement each other. Happy development!

Leave a Reply


http://www.canakkaleruhu.org http://www.vergimevzuati.org http://www.finansaldenetci.com http://www.securityweb.org http://www.siyamiozkan.org http://www.fatmaozkan.com http://www.sgk.biz.tr http://www.denetci.gen.tr http://www.bagimsizdenetim.biz.tr http://www.mevzuat.biz.tr http://www.security.biz.tr http://www.sorgulatr.com http://www.kanunlar.biz http://www.prsorgu.net http://www.sirabul.com http://www.emekliol.org http://www.coklupagerank.com http://www.coklupagerank.net http://www.coklupagerank.org http://www.prsorgu.org http://www.scriptencode.com http://www.sirabul.net http://www.sirabul.org http://www.sitenizanaliz.com http://www.seoisko.com http://www.seomavi.com http://www.scriptencode.net http://www.scriptencode.org