Logo

Diplaying the List Column header in Vertival mode

11 months ago | Abhishek Dharga: Learning and sharing

Some time we need to display the column header in vertical mode.
You can rotate the text 90 degrees by using the TextFlow & Justification property for the column titles and set the Writing Mode to "Top to Bottom, Left to Right" You will find this by clicking on the column title in the report and then scrolling down in the Properties for the title on the left hand side.

Rails3 application with Jruby

11 months ago | Arun Agrawal: Ruby Rockers

If you are living on edge and you are using Rails3 then you need follow this. Rails3 With JRuby   Hi All, Recently i have started a Rails3 application which will use Jruby. I have gone through some of the steps for that application up and running. If you are using RVM then it’s easy [...]

If at all you need to Uninstall MySQL 5.5 from OSx

11 months ago | Amit Kumar: RubyizednRailified

https://gist.github.com/887350

Approach for Oracle view unit testing with Rspec

11 months ago | Niranjan Sarade: InLoveWithNature

A View in Oracle and in other database systems is simply the representation of a SQL statement (select query). It provides access to a subset of columns from one or more tables.

In a rails migration, when you incorporate a view definition which represents data from multiple tables with multiple joins and multiple conditions, how will you ensure that the view is fetching the data that it is supposed to fetch? How will you test the view logic?

And here, Unit Testing plays a very important role. Today, I am going to tell you the simple approach that we can follow for unit testing the view definition with Rspec.

First, with rails convention, you will create the model class (which maps to the view name) extending ActiveRecord::Base.
You will then set up the test data as you generally set for testing other model methods. (You can use factory_girl or simple model methods)
The purpose is to unit test each and every column data of the view according to the joins and the conditions. It all depends on the view logic that you have written according to your business requirement. The view definition can include decode statements, group by/ order by clauses, oracle aggregator functions e.g. sum, max, etc., function calls from the view sql, if-else logic to name a few.

With this, you have all the unit level requirement specs ready for your view which you can validate by running your Rspecs. Simple but succinct ! Isn't it ?

development on Windows deploying to Linux with cruise and bundler?

11 months ago | Gourav Tiwari: easy_software = Agile.find(ruby_on_rails)

In my previous post, I set-up bundler with rails-2.2.2 application. Soon after that, I found myself in another trouble.

When I set-up bundler, I had to create Gemfile for the gems required by my rails application. Also, when I run bundle install command, it creates Gemfile.lock file, this file holds various information:
  • Gem repositories (sources)
  • Which version of gem the application is using (gem specification)
  • If there is any dependency of any gem, then what they are
  • Platform details
In my current project, I use Windows 7 as development machine, there is a cruise server on linux machine, I am committing my code to a subversion repository and once the build passes on cruise it deploys to a linux server. Every time I run bundle install, it creates a Gemfile.lock with windows version of gems and platform details for windows. If I commit Gemfile and Gemfile.lock, it fails the build and I have to manually login to cruise box and remove those files and re-run bundle install command, so that it generates the Gemfile and Gemfile.lock for linux environment, so that on integration and production servers, the Gemfile and Gemfile.lock will remain with linux version and there is no failures there. This was a pain.

I wrote a ruby script to do this job for me. With this script, I removed everything windows specific in Gemfile and Gemfile.lock I can think of. Here is what I did (look at: https://github.com/gouravtiwari/windows_linux_fix_for_bundler for source code)
  • I extended cruise:init rake task(created fix.rake in lib), to include my ruby script.
  • In the script, I am removing windows traces, updating the platform details, running bundle command and then committing the latest Gemfile and Gemgfile.lock toSVN.
This way, if by mistake I am committing Gemfile and Gemfile.lock to SVN, I don't need to go to cruise and re-generate Gemfile and Gemfile.lock.

uninitialized constant Mysql::Error - OSx snow leopard

11 months ago | Amit Kumar: RubyizednRailified

You will run into this issue if you are using:

Mysql -> 5.5.x

rake db:create --trace
(in /Users/toamitkumar/development/rails_apps/mongotimeline)
** Invoke db:create (first_time)
** Invoke db:load_config (first_time)
** Invoke rails_env (first_time)
** Execute rails_env
** Execute db:load_config
** Execute db:create
rake aborted!
uninitialized constant Mysql::Error

spent 2 hours to figure out the issue is with 64 bit architecture on OSx. It is not able to find dynamic library libmysqlclient. Making the following entry in .bashrc file and then installing the mysql gem again solved the problem.

export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"

$ sudo env ARCHFLAGS="-arch x86_64"

$ gem install
--no-rdoc --no-ri mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config


Rock on !!

jStat: Advanced Statistics using Javascript

11 months ago | Lalatendu Das: Interpretations of Technorealism

While 'R' is getting enterprise ready, it's no longer the only open source option for advanced statistical programming. jStat.js is the new kid on the block.

Things in favor of jStat:

  • Based on Javascript, jQuery - future is assured
  • Light-weight
  • Ability to visualize data using flot (jQuery plugin)
Still no match for 'R' yet (complete API documentation is yet to come out), but certainly a bright prospect in application which require basic statistical analysis and data visualization (where 'R' is an overkill).

Possibilities  with jStat.js - check this out



Thinking out loud..
Node.js + jStat.js ...=..=!=..=... RIP 'R' ??

A quick look at Cricket World Cup 2011

11 months ago | Prasoon Sharma: Enterprise Software Does not Have to Suck


Preliminary rounds are over. Top 8 teams have qualified to quarter finals. No surprises there. No one doubted Australia, England, India, New Zealand, Pakistan, South Africa, Sri Lanka and West Indies to miss the cut.

So what's next?

A lot of action. Upcoming games are must-watch as the minnows are gone and now top teams battle in knock-out rounds and results could be surprising. So find a good excuse, a comfortable couch and your best buddies to watch the teams fight it out. There’s a lot of cricket played these days. This is the cup that matters.



Here are the players and teams to watch...

BATSMEN
  • AB de Villiers: At his peak performance since ICC Batsman of the Year award in 2009.
  • Sehwag is fired-up and is dangerous when he spends more time in the middle than in the dressing room.
  • Tendulkar has already scored two excellent centuries and should score his 100th ton in ODI and Tests during this World Cup.
  • Sangakkara is slow but steady. Not flamboyant but successful. Watch out for his contributions.
Aussie batsmen haven't scored big yet and their form remains a worry. Top Sri Lankan, Indian and South African batsmen have all found some form and are likely to score big in upcoming matches.



Indian and West Indian tails have been frail and collapsed often. Get ready for a world cup that might be decided by how the tail-enders use their bats.



BOWLERS: Spinners lead the bowling chart, with Afridi leading the pack. He’s the new Kumble. Aussies are missing their lethal bowling attack but Brett Lee is playing his last world cup like a champion.




ALL ROUNDERS: All rounder performance has been key to many world cups.
  • Viv Richards in 1979 for West Indies' victory
  • Mohinder Amarnath, Kapil Dev and Madan Lal in 1983 for India's victory
  • Steve Waugh in 1987 for Australia's victory
  • Imran Khan in 1992 for Pakistan's victory
  • Jayasuriya and Arvind de Silva in 1996 for Sri Lanka's victory
World Cups in 1999, 2003 and 2007 were decided by Australia's strong batting and bowling performance. Their batting (Ponting, Gilchrist, Waugh brothers, Bevan, Hayden) and bowling (McGrath, Warne, Lee) was superior compared to everyone else. 

In this World Cup, Yuvraj decided to prove those wrong who claimed that India is going into the World Cup without a genuine all rounder. His all round performance has been key in a couple of victories already. Kallis, the best all rounder in current ODI era, hasn’t wowed yet. Australia is known for great all rounders but notice the lack of all round performance from Aussies in this world cup (no yellow in chart below).





TEAMS

It is difficult to predict the winner as the top 4 teams (Australia, India, South Africa, Sri Lanka) are more or less equal, as seen in preliminary rounds where no team was invincible and no team dominated completely. So get ready to cheer a surprise winner. Its not who you think it is!

This world cup will be decided by all rounders and tail-end batsmen (to bat 50 overs). Batting and bowling strengths of top teams are more or less equal. Some have stars like Dale Steyn or Brett Lee while others have good pairs like Zaheer Khan and Harbhajan Singh.


Use selenium as a script

11 months ago | Arun Agrawal: Ruby Rockers

Hey All, I came with a situation where i need to test things from browser. It nothing to do with the different browsers. It just to check some validations, some messages with some existing data with me. I can’t touch the code base. It’s something like QA work. I am not very much aware about [...]

Installing windows platform specific gem libxml-ruby with Bundler

11 months ago | Niranjan Sarade: InLoveWithNature

I was facing some issue in installing 'libxml-ruby' gem on my windows machine with bundler. The entry in the Gemfile was :-

gem 'libxml-ruby', '1.1.3', :require => 'libxml'

This works perfect on unix machines, but fails on windows machine (which is my local development platform) during building native libraries.

The DevKit has already been set up on my machine. So I tried doing gem install first :-


So, I mentioned the platform while doing gem install and it worked as below :-

D:\>gem install libxml-ruby -v=1.1.3 --platform x86-mswin32-60
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
Successfully installed libxml-ruby-1.1.3-x86-mswin32-60
1 gem installed
Installing ri documentation for libxml-ruby-1.1.3-x86-mswin32-60...
Installing RDoc documentation for libxml-ruby-1.1.3-x86-mswin32-60...
D:\>


However, with bundle install, it gave the same error on the windows machine : ERROR: Failed to build gem native extension.
I tried specifying Gemfile :platforms option - 'mswin', 'mingw' for Windows platform, but it did not work.

Finally, the :path parameter rescued me out of the pain. With :path parameter, you can specify that a gem is located in a particular location on the file system. The ':path' option requires that the directory in question either contains a '.gemspec' for the gem, or that you specify an explicit version that bundler should use. So the bundler uses the gem from the source specified in the path and it resolved my issue with installing libxml-ruby gem with bundler on windows machine. The steps that I followed :-

(1) Download the libxml-ruby-1.1.3-x86-mswin32-60.gem gem from http://rubyforge.org/frs/?group_id=494 and do gem install
OR
gem install libxml-ruby -v=1.1.3 --platform x86-mswin32-60

(2)From app_root>gem unpack libxml-ruby-1.1.3-x86-mswin32-60

(3) Gemfile.lock :-

gem 'libxml-ruby-1.1.3-x86-mswin32-60', '1.1.3', :require => 'libxml', :path => 'vendor/gems/libxml-ruby-1.1.3-x86-mswin32-60'

(4) Now, when you execute bundle install, it will bundle the gem from the source specified in the :path -

Using libxml-ruby-1.1.3-x86-mswin32-60 (1.1.3) from source at vendor/gems/libxml-ruby-1.1.3-x86-mswin32-60

Gem 1.5 with Rails 2.3

11 months ago | Arun Agrawal: Ruby Rockers

You may fall down into the situation where you don’t have RVM and your system gem is upgraded for using latest things. And your old application is still running on older version of rails. This is just a workaround of using Gem > 1.3.7 in Rails 2.3 Applications. I have tested this solution with Rails [...]

11 months ago | Amit Kumar: RubyizednRailified

Bundler is a great tool which helps to manage your application dependencies. It is very simple to use, just drop it and you are good to go with one command -> bundle install

Check out: http://gembundler.com/, if you care.

The problem occurs when it fails to install a gem. It does not have a way to show the trace of stack calls like rake --trace.

Let me tell you the problem - I was moving a Rails 2.3.9 project to use bundler. The application is using libxml-ruby for XML parsing (yes I know nokogiri fans - @tenderlove did a wonderful job).

The Gemfile entry:

gem 'libxml-ruby'


$ bundle install

and bundler tries to install the native extension (dependencies on zlib, libxml, iconv). I downloaded all the .dll's and copied them to Devkit.

$ bundle install

The same failure.

The nice bundle.config command:

$ bundle config build.libxml-ruby -- --with-zlib-dir=/path/to/zlib --with-zlib-include=/path/to/zlib/include --with-zlib-lib=/path/to/zlib/lib --with-iconv-dir=/path/to/iconv --with-iconv-lib=/path/to/iconv/lib --with-iconv-include=/path/to/iconv/include --with-xml2-dir=/path/to/libxml --with-xml2-lib=/path/to/libxml/lib --with-xml2-include=/path/to/libxml/include

$ bundle install

and I started to see the gem building, and then NOOOOO, version mismatch of the DLLs. I spent hours figuring out which are the compatible versions.

And then,

@niranjan suggested: this entry

$ bundle install

all worked, sweet !!

Redis key-value store

11 months ago | Arun Agrawal: Ruby Rockers

Redis is really cool and lightweight key-value store. If you are looking for something in which you can store some string, hashes, lists, sets. The Redis is the best. If you are a Ruby developer then you must try out this with a redis-rb gem. Very easy to configure, very easy to store things. Following is [...]

Bundler Usage — Installing Gems

11 months ago | Arun Agrawal: Ruby Rockers

Every time you change your Gemfile then you might adding/removing any dependancies in your application. Just bundle install will install gems for you. The output may look like $ bundle install Fetching git://github.com/rails/rails.git Fetching source index for http://rubygems.org/ Using rake (0.8.7) Installing abstract (1.0.0) Your bundle is complete! Use `bundle show [gemname]` to see where [...]

Moving on to Bundler to manage my Rails 2.3.9 app's gem dependencies

11 months ago | Niranjan Sarade: InLoveWithNature

Recently I faced some gem dependency issues on one of our servers where we have a good amount of rails applications. (more Rails 2.3.x apps as compared to a couple of Rails 3.0.x apps). (This was a cruise box used by all apps to execute rspecs and generate metric_fu reports after you commit your code - Continuous Integration concept :-)

My app was using Rails 2.3.9, and due to some reason, I did not get a chance earlier to move my application to use Bundler for managing all the gem dependencies. Finally, I made it :-)

I followed 2 links :-
http://gembundler.com/
http://gouravtiwari.blogspot.com/2011/03/bundler-with-rails-222.html

Since then, I have not faced any gem dependency issues on any of the boxes.
So what are you waiting for ? If you haven't done it till date, do it now ... or you will spend (waste?) time in resolving weird gem dependency issues ... :-)

A good learning for me !

Demystifying the financial Crisis

12 months ago | Lalatendu Das: Interpretations of Technorealism

A small presentation I prepared to explain the Causes of the Subprime led Financial Crisis.


Please feel free to give feedback.

The travels of a T-Shirt in the global economy

12 months ago | Lalatendu Das: Interpretations of Technorealism



Read an interesting book "The travels of a T-Shirt in the global economy". Author Piethra Rivoli traces the travels of an ubiquitous T-Shirt, from the cotton fields of western Texas to the manufacturing bases in china, back to the US market and then to continetal Africa. In the process she introduces the complex labyrinth of market forces in place, global trade, protectionism and power.

A bit detailed at times, but still interesting read if you want to understand global trades..

Seth Godin on Leadership

12 months ago | Lalatendu Das: Interpretations of Technorealism

"Say what you believe, see who follows."

Inspiring!

Exclusive interview with Seth Godin from GiANT Impact on Vimeo.

View Mapper for Rails 3: ScaffoldHub

12 months ago | Pat Shaughnessy: Pat Shaughnessy - Home

Back in 2009 I wrote a gem called View Mapper which created different variations on the standard Rails scaffolding user interface. This was cool because it could show you how to use a certain plugin or gem, and it even worked with existing models and their associations.

This year I’ve been thinking about how to upgrade View Mapper to work with Rails 3 properly… and in the end I decided not to upgrade View Mapper at all but instead to create something entirely new: ScaffoldHub

Avoid oracle sequence during ActiveRecord model record insert

12 months ago | Niranjan Sarade: InLoveWithNature

I was writing rspecs for one ActiveRecord model in my project and was connecting to different schema in which the corresponding mapping table was defined. The schema object (tables) definition was a legacy code, what I meant to say is I used the already existing object definition from that schema which was not using oracle sequence. There was no primary key for that table as well.

I was setting up the data for that table in my rspec using ActiveRecord insert.

e.g. AnotherSchema::TableObject.create(:ts => 123, :proj_code => "ABC", ...)

But, in Rails, when you try to insert the record with ActiveRecord Model, it always looks for a sequence, either a default one (Table_Object_seq) or explicitly defined one with set_sequence_name in the Model class.

So, it threw error as expected :-
OCIError: ORA-02289: sequence does not exist: select "Table_Object_seq
".nextval id from dual

I could have defined a sequence on this table only in the test database, but I googled around for a way to avoid oracle sequence in a model and I got this link :-
http://www.dixis.com/?p=127

I followed the suggestion and it worked for me :-)

What I did was :-

Monkeypatching OracleEnhanced Adapter's next_sequence_value method :-


and adding set_sequence_name to the Model class :-

set_sequence_name 'autogenerated'

It avoided the default oracle sequence look up while inserting new records with Rails ActiveRecord methods which solved my problem.

Bundler with rails-2.2.2

12 months ago | Gourav Tiwari: easy_software = Agile.find(ruby_on_rails)

I am working on a rails application, which is on rails-2.2.2. I have used bundler on rails-3 application, but never tried bundler for rails-2.2.2. The benefit of bundler is huge, it is gem manager for rails application. So, now no pain of vendoring/localizing gems in rails application.

gembundler.com gives step-by-step process on how to install/configure bundler for rails-2.3.x and rails-3.x applications. So, I wanted to find out how does it work with rails-2.2.2 application.

So, here is how I did.
  • First of all I have installed bundler
    gem install bundler // installed bundler 1.0.10
  • Updated rubygems
    gem update --system // rubygems > 1.3.6
  • Created config/preinitializer.rb file with below content:
    begin
      require "rubygems"
      require "bundler"
    rescue LoadError
      raise "Could not load the bundler gem. Install it with `gem install bundler`."
    end

    if Gem::Version.new(Bundler::VERSION) <= Gem::Version.new("0.9.24")
      raise RuntimeError, "Your bundler version is too old for Rails 2.3." +
       "Run `gem install bundler` to upgrade."
    end

    begin
      # Set up load paths for all bundled gems
      ENV["BUNDLE_GEMFILE"] = File.expand_path("../../Gemfile", __FILE__)
      Bundler.setup
    rescue Bundler::GemNotFound
      raise RuntimeError, "Bundler couldn't find some gems." +
        "Did you run `bundle install`?"
    end
     
  • Created Gemfile with something similar:
    require 'rubygems'
    source 'http://rubygems.org'
    source 'http://gemcutter.org'
    source 'http://gems.github.com'

    gem 'rails', '2.2.2'
    gem 'hpricot', '0.6.0'
    gem "composite_primary_keys", '1.0.8'
    gem 'javan-whenever', '0.3.7'
    gem 'mysql', '2.8.1'
    gem 'activerecord-oracle_enhanced-adapter', '1.1.9'
    gem 'ruby-oci8', '1.0.3'

    group :test do
      gem 'mocha', '0.9.5'
      gem 'rspec',             '1.3.1', :require => 'spec'
      gem 'rspec-rails',       '1.3.3'
      gem 'database_cleaner',  '0.5.0'
      gem 'capybara'
      gem 'ruby-debug'
      gem 'factory_girl'
    end
  • From the application root, I ran:
    bundle install
That is it and I have my application up and running with bundler. Once I tested my application, I removed gems folder from /vendor (no need for localized version of gems now.)

Give others and yourself an 'A' today !

12 months ago | Rohan Daxini: void TechFuels()

Came across this nice article with stories on rewarding others and yourself an 'A' in advance.
Article - Give yourself an 'A' today! It makes a difference.

This makes sense and I must admit that directly or indirectly I was using this before too without any thought or doubt of weighing this as a good or bad practice despite having fairly above average results in both professional and personal life. Well quite debatable as it gets sometimes, but worth a try to experience first hand.

Go for Just Enough

12 months ago | Riju Kansal: Riju's Thoughts Captured...

Is being really successful inevitably a matter of being the best,highest,youngest,richest,smartest and prettiest on every scale you know that is,celebrity winner-take-all Such standards are maximised forms of accomplishment.Simply put,maximisation is any form of going for the extreme: genius intelligence,superhuman effort,the best house,the unique lifestyle,and the most profit possible But even if you are drawn to the positive aspects of maximisation as your standard,most peoples sense of success demands high scores in many differing categories.Sometimes,these goals contradict each other: wealth and best friends who love you for yourself,not your money.A generous nature and being in the top position.Leading a team and being able to do everything your way.Before you anchor your ambitions on the outer limits,think of the Roman and British empires.Rome continually pushed its borders in a political philosophy of limitless power only to discover it had to build a wall to keep the invaders out before it could really build and protect its roads.The British set up a legal and bureaucratic system in each of its colonial territories,but the idea of limitless exploitation became the empires undoing.If you wish to live with a continually-renewing sense of success you have to give up the standards of maximization.


By LAURA NASH
http://www1.lite.epaper.timesofindia.com/mobile.aspx?article=yes&pageid=16&edlabel=ETM&mydateHid=03-03-2011&pubname=&edname=&articleid=Ar01608&format=&publabel=ET&max=true

Why learn R?

12 months ago | Prasoon Sharma: Enterprise Software Does not Have to Suck

I'm introducing R to a few colleagues this week and want to share why learning a software like R is important... Here are a few articles that explain it well... Other reasons?

Importance of data science
- Couple years ago Google's Chief Economist Hal Varian said that the sexy job in the next ten years will be statisticians. Read the full article (requires registration)
The ability to take data - to be able to understand it, to process it, to extract value from it, to visualize it, to communicate it's going to be a hugely important skill in the next decades, not only at the professional level but even at the educational level for elementary school kids, for high school kids, for college kids. Because now we really do have essentially free and ubiquitous data. So the complimentary scarce factor is the ability to understand that data and extract value from it.
I think statisticians are part of it, but it's just a part. You also want to be able to visualize the data, communicate the data, and utilize it effectively. But I do think those skills - of being able to access, understand, and communicate the insights you get from data analysis - are going to be extremely important. Managers need to be able to access and understand the data themselves.
- Rise of data scientists

- Becoming a data scientist

- Essential skills for a data scientist

Where R fits?
R provides an environment for all tools needed for data science (see the data science process below from Benjamin Fry's thesis).




- R is ideal for small data analysis i.e. data that fits in a computer's RAM e.g. data < 10GB. Whereas SQL and search techniques seem good for larger data sets that can fit in one machine and techniques like Hadoop are good for BIG data sets that cannot fit in one machine.

- NY times article on R you ready for R?

- NY times article on R

- R is becoming popular


Tipping point by Malcolm Gladwell

12 months ago | Lalatendu Das: Interpretations of Technorealism

Just completed reading 'Tipping Point: How little things can make a big difference' by Malcolm Gladwell.

The book primarily covers three basic rules that apply to spread of any epidemic. Those are [sic]:

  1. Law of the few: There are always Early adopters for any new idea. Success of the idea depends on the work and influence of the Early adopters. Typically Early adopters can be one of the following categories a) Mavens - One who accumulates knowledge b) Connectors- Who knows a lot of people c) Salesmen - People who can influence others 
  2. Stickiness Factor: There is a simple way to package information that, under the right circumstances, can make it irresistible. All you have to do is to find it.
  3. Power of Context: Human beings are a lot more sensitive to their environment than they may seem.
While the author discusses the above mentioned points in the context of epidemics in general, in hindsight, these laws have profound application in Managing Organizational Change. I would certainly apply these rules, when I plan next to introduce a new process in the organization.