How to write columns header to a csv file with Ruby?

I would recommend to use the CSV-library instead: require ‘csv’ CSV.open(‘test.csv’,’w’, :write_headers=> true, :headers => [“numerator”,”denominator”,”calculation”] #< column header ) do|hdr| 1.upto(12){|numerator| 1.upto(12){ |denominator| data_out = [numerator, denominator, numerator/denominator.to_f] hdr << data_out } } end If you can’t use the w option and you really need the a+ (e.g., the data isn’t available all at … Read more

What is Ruby 1.9 standard CSV library?

Ruby 1.9 has adopted FasterCSV as its built-in CSV library. However, it’s in the standard library rather than Ruby 1.9’s core, so you need to manually require it in your application. After adding a require ‘csv’ to your code, you can then do things such as CSV.parse(“this,is,my,data”) See Ruby 1.9’s standard library CSV documentation for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)