Posts

HTML 5, a complete guideline to startup

Image
Today I was rambling in my web world on HTML 5 . Wondering about the great features offered. I think you also would like to start working on HTML 5 right now. So here are few things that will help to boost up your learning over this. http://diveintohtml5.org/ . [A detail discussion over HTML 5 with lots of techniques for diagnosis] http://diveintohtml5.org/introduction.html . [Have an basic idea] http://diveintohtml5.org/detect.html . [Learn the techniques for detecting supports from your browser for HTML 5] http://diveintohtml5.org/canvas.html . [ Meet the canvas of HTML 5 ] http://diveintohtml5.org/storage.html#methods . [The local storage provided by HTML 5]. See also  storage.html#halma ,  storage.html#future http://diveintohtml5.org/forms.html . [Form elements are having more comprehensive options. See the iPhone web browser trick for a usability] Here is  all available tags  in a glance. Take preview on HTML 5 here. http://html5demos.com/ . [...

Try the "try" method and get rescued

Have you ever used 'try' method in Ruby on Rails ( yes it is provided by rails not ruby ). I started loving this method so much. As the method name implies you will try to do something. If anyhow it fails it doesnt get fired on you by throwing any ugly exceptions. Look at the documentation . You may have already guessed the idea. But still lets work with a simple example. User.admins.first.try(:address).try(:reset) instead of User.admins.first.address.reset Here we are finding the first admin. Then accessing his/her address and then try to reset it. But what if that admin doesnt really have any address. I mean User.admins.first.address.first.address is nil. Then a NoMethodError for nil class would be waiting for you. But with the try you are safe. WHY? Actually try does nothing but invoking the Object#send method with the function name and the passed parameters. You can even pass a block through try. And apart from this Object#try method, you will have a N...

Highcharts for Agile development

Image
Did you ever try Highcharts for showing any kind chart data in your web application? Its great! Recently they released a newer version with lot more performance improvement and new features. Im talking about the version 2.0.0. Find it at http://www.highcharts.com/download . By the time you are reading this article if you find more upgraded version of highcharts, then of course it will be of more fun. Share it through comments :D Courtesy by Highcharts.com Just look at the Demo page of it. You will find lots of different kind of charts over there. Choose anyone according to your need. The first reason why I like Highchart is it totally based on javascript. Earlier I used openflash chart(OFC)  which is really slow by its process of data showing. As OFC is based on flash, you will need the flash embed code first, then this flash code will request for the data to your server and then it will show the chart. Maladroit huh !! But here with the help of Highcharts you will be...

Design Pattern in Ruby 1: Decorator pattern

Image
Decorator pattern , something that gives you two type of things A plain vanilla cake and  Cream, cheery etc to decorate the cake :D How does it sounds? Mouth watering design pattern right? Anyway, dont get too excited!! we're gonna dive into the code shortly 8( You might have already known all the nuts and bolts about this pattern, but I was really wondering about the implementation of this pattern in Ruby.  Here I will work with the example given in Head first design patterns (Chapter 3) . There they gave the example of a coffee house. Like our plain vanilla cake, the coffee house also have two different type of things: Beverages: HouseBlend, DarkRoast, Espresso and Decaf Condiments: Milk, Mocha, Soy and Whip So that you can have a DarkRoast with some Mocha and Soy :) However, I think we should have a look at the class diagram first Notice that, here all concrete beverages are inherited from the abstract class Beverage . And all concrete cond...

Shoulda test macro for acts_as_state_machine

In this post I will talk about shoulda macro for state_machine to facilitate TDD. So lets get familiar with these at first (want to skip the intro! ok, just  jump to code  ;) Acts_as_state_machine : A really powerful plugin to incorporate state machine in rails application. In scrumpad we are using this plugin and it made the implementation such a fun that everyone here just love to take this work 8). You can  take a look  to see how this plugin makes everything for you in a blink of eye. Shoulda : "The Shoulda gem makes it easy to write elegant, understandable, and maintainable Ruby tests"- Thoughtbot Community . Yes, shoulda really makes your test codes speak. You will be able to define your every test cases exactly in the way that you would probably state to someone. TDD : Firstly programming without test code, impossible!! And, if your application is written in any dynamic language(e.g: ruby, php) then TDD is the must. In TDD practice at first you...

Selenium RC 1.0.1 with Firefox 3.6

The last day I get stuck while I was writing my automated test codes with selenium but using firefox 3.6 . Selenium was failing to open the firefox browser session because selenium RC 1.0.1 does not support firefox 3.6 by default. You know what I did? I did nothing but some googling as everyone does :) and found an excellent post on describing this problem. Here it is [ http://www.qaautomation.net/?p=15 ]. Well you will have a lot of commands to read there. But in a nutshell all you need to do is modify the firefox version in following 5 files in the selenium-server.jar archive. ./customProfileDirCUSTFF/extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf ./customProfileDirCUSTFF/extensions/readystate@openqa.org/install.rdf ./customProfileDirCUSTFFCHROME/extensions/{503A0CD4-EDC8-489b-853B-19E0BAA8F0A4}/install.rdf ./customProfileDirCUSTFFCHROME/extensions/{538F0036-F358-4f84-A764-89FB437166B4}/install.rdf ./customProfileDirCUSTFFCHROME/extensions/readystate@openqa.org/...

Writing test code for ApplicationController

Did you ever try to write functional test code for ApplicationController? You might have faced such situations where you needed to test some methods of your application controller. Well when you will start testing a method of your ApplicationController, you would probably have a "aha" moment - "If I had a view file for that method!!". Yes the problem is template missing error.  Usually the methods in ApplicationController dont have a corresponding template. Therefore, sending test request to those methods will definitely raise an ActionView::MissingTemplate error. So what you need to do is just tell the ApplicationController - "Please dont raise any template missing exception. I am testing your methods :)". But how will you tell this? Simple, just override the rescue_action method and raise nothing!! Just like the following: class ApplicationController def rescue_action(e) end end Yes, this will keep all the exceptions away from you. Howev...