Pages

Thursday 27 September 2012

THINKING OUT OF BOX : INNOVATION

This one is also based on another poster on my office wall. Actually I was struggling hard to write something since few days and it was generic. Just like every student who undergoes engineering preparation can't make it into IITs or NITs, every engineer also can't be a writer like Chetan Bhagat in spite a lot of preparation. But today while coming to office, I was asked about my next blog by some one. And all know, when someone write something forcefully that too not knowing what to write, then the result is either innovative or useless . :) previously I was thinking what to write and now I am writing how to think.

Oh. Seems too much advising and boring too.Now a days in our country it is told “To be richest in life either think like Steve jobs or copy like Chinese”its true because growth is certain in either ways. We all keep hearing everyday that China copied this.. china copied that .. so much that i feel someday someone will come to me and say "HI. I am also Tapan but made in China!".Chinese are also innovators.. They innovated efficiency in the manufacturing floor.. they reinvented lean manufacturing lines.. so even though layman feels they copy.. they copy artistically.. hence even though i phones are made in china.. you still love it :) .  My point is something when created from innovative thoughts, always become best in the market. Because there is a value addition to it. Others may copy that but still original is ORIGINAL.

But how to get that innovation . Now please don't suggest like my relatives do that by doing yoga, one will become concentrated and get that innovation. If that were true then swami Seshdev would have been running Apple's or any other company's R&D. I agree that it increases concentration, but what the use of too much concentration if we will not use it in thinking at all.

Let me tell you one nice experience. When we were given some questions in the selection procedure of company, one of the question was, “How will you use the wind energy produced by constant swinging of a dog's tail?”. My first impression was have the HR's gone out of mind? How they are going to judge me from this type of dumb questions. But today I realize that the motive was to see just the lateral thinking capacity of any candidate. Sometime to answer such crazy questions one have to think out of box. That box is materialist world, the world of possibility. Whatever has been invented by any scientist till today was not in the process of general thinking. It is in the process of thinking out of box. The biggest idiot box of human is his own mind which limits his thoughts. To go beyond that limit is simply called “Innovation”.

Now its time to decide which factor the Innovation depends on. Of course the prime factor is freedom. Freedom to think independently and apply that thought.If Albert Einstein had listened to his relatives no doubt he would not have been great in front of us like he is now, except in his family :).

So after all it depends on us to be Steve jobs or to be Copycats. Finally this blog is not to offense any one especially any Chinese, it is just for humor . So i hope China will not send Jackie Chan for me :) .


Wednesday 23 November 2011

Setting Up a Rails 3 Project wit Cucumber

 Start by generating a new Rails app:
$ rails new showtime

This creates a showtime directory and generates the skeleton for a Rails
app inside it. Now cd into that directory, and take a look around:

$ cd showtime

One of the generated files is the Gemfile we use to configure the gems
we want bundled with our app using Bundler. Open the Gemfile, and
modify it as follows:



gem 'mysql'
gem 'therubyracer'

group :development, :test do
gem "rspec-rails", ">= 2.0.0"
gem "cucumber-rails", ">= 0.3.2"
gem "webrat", ">= 0.7.2"
end


We add these to the :development group so that their generators and
rake tasks are available without having to type RAILS_ENV=test. We add
them to the :test group to make sure that their code is available when
running in the test environment.

Now we’ll use Bundler to install those gems and all of their dependen-
cies:
$ bundle


Now we’ll use the rspec:install generator to install a few files we’ll need in
the app:

$ rails g rspec:install
create .rspec
create spec
create spec/spec_helper.rb
create autotest
create autotest/discover.rb

Here’s a description of each file and directory that was generated:
• spec: The directory where you place specs for your Rails app.
• .rspec: Add options to this file that you want rspec to utilize when
running any of the rake spec tasks.
• spec/spec_helper.rb: This file is used to load and configure rspec.
It is also where you would require and configure any additional
helpers or tools that your project utilizes when running specs.
• autotest/discover.rb: Used by Autotest to discover what type of Auto-
test class to load.

Now we’ll use the cucumber:install generator to install files Cucumber
needs:
$ rails g cucumber:install
create config/cucumber.yml
create script/cucumber
chmod script/cucumber
create features/step_definitions
create features/step_definitions/web_steps.rb
create features/support
create features/support/env.rb
create features/support/paths.rb
exist lib/tasks
create lib/tasks/cucumber.rake
gsub config/database.yml
gsub config/database.yml
force config/database.yml


Cucumber adds a few more files than RSpec does. Let’s take a look at
each one:
• config/cucumber.yml: Used to store profiles that provide control
over what features and scenarios to run. See Section 18.9, Con-
figuration, on page 280.
• script/cucumber: The command-line feature runner.
• features/step_definitions: All of your step definitions will go in this
directory.
• features/step_definitions/web_steps.rb: Contains step definitions that
are commonly used with web apps. We’ll learn more about this file
in Chapter 21, Simulating the Browser with Webrat, on page 298.
• features/support: This directory holds any Ruby code that needs to
be loaded to run your scenarios that are not step definitions, like
helper methods shared between step definitions.
• features/support/env.rb: Bootstraps and configures the Cucumber
runner environment.
• features/support/paths.rb: Support for mapping descriptive page
names used in scenario steps to their URLs.

• lib/tasks/cucumber.rake: Adds the rake cucumber task, which pre-
pares the test database and runs all of your application’s features.
And that’s it!

To make sure everything is wired up correctly, run these
commands:

$rake db:migrate
$rake db:test:prepare
$rake spec
$rake cucumber

You should see output like this when you run rake spec:2
No examples matching ./spec/**/*_spec.rb could be found
And you should see output like this when you run rake cucumber:
0 scenarios
0 step

Tuesday 15 November 2011

HOW SIMPLE FANCYBOX IS IN RAILS 3 ?


gem 'jquery-rails'
gem 'fancybox-rails'

Then run bundle install to update your application's bundle.

Now you need to edit your app/assets/javascripts/application.js file and add the following line:

//= require jquery
//= require fancybox

And then edit your app/assets/stylesheets/application.css file to look something like:

/*
 *= require_self    # it may be present previously , so if system crash remove it
 *= require fancybox
 *= require_tree .
 */



Then in the view page where you want to add  fancy box design just add the following function within head in script tag

<script type = "text/javascript">
$(document).ready(function() {

/* This is basic - uses default settings */

$("a.flickr_photo").fancybox({'type': 'image'});/*a.flickr_photo is for creating flickr_photo class that too within  fancybox*/
$("a.flickr_ajax").fancybox();/* in the same way , flickr_ajax is another class , */
/*we ll create different class and ll reference to those class where we want

 });
</script>


then in the link add some code
<a class='flickr_photo' href="/assets/product/<%=prod.image%>">
we add the above line before image tag