How might I pass text data from the ruby console into my clipboard without saving to a file?

You can just echo it instead if there are no newline characters in the string; otherwise, use the IO class. Using echo: system “echo #{stringdata} | pbcopy” OR `echo #{stringdata} | pbcopy` Ruby will then just rip the text from memory, inject it into the shell command which opens a pipe between the echo and … Read more

Ruby Net::HTTP – following 301 redirects

301 redirects are fairly common if you do not type the URL exactly as the web server expects it. They happen much more frequently than you’d think, you just don’t normally ever notice them while browsing because the browser does all that automatically for you. Two alternatives come to mind: 1: Use open-uri open-uri handles … Read more

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

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