News for hackers. Stuff that matters.
Re:How to write a command line application in Node.js by chrsstrm on Friday August 09, 2013 @07:49PM (#6189327)
Depends on the job. I'm writing a command line app in Node right now to automate a couple thousand SQL queries for a db I'm working with. Node wasn't my first choice, but I looked at how to connect both Ruby and Python to MySQL and it seemed like more trouble than it was worth for a one-time use utility. Node was just 'npm install mysql'. Might not be the best way, but I only need to use it once.
Re:How to write a command line application in Node.js by FooBarWidget on Friday August 09, 2013 @08:00PM (#6189372)
Isn't Ruby just 'gem install mysql'?
Re:How to write a command line application in Node.js by chrsstrm on Friday August 09, 2013 @08:18PM (#6189456)
I don't recall the instructions I looked at, but I know what I read was much more than a gem install. Correct me if I'm wrong, I actually wanted to use Ruby first.
Re:How to write a command line application in Node.js by jrumbut on Saturday August 10, 2013 @06:08AM (#6190582)
Sorry if this is off topic, but I remember having this exact issue when I was learning Ruby, maybe I can provide some clarity.

For raw access to your MySQL database, the gem 'mysql2' is preferred (github with a simple tutorial: https://github.com/brianmario/mysql2).

mysql2 seems to have taken it's interface design from Perl's DBI, which is cool if you're used to that but might feel a little foreign.

If you'd like something that gives you a little more help, or there's substantial business logic in your script, take a look at ActiveRecord. This StackOverflow question (http://stackoverflow.com/questions/16683903/sinatra-mysql-an...) has a nice example of how you might set up your script to use AR.

My email's in my profile if you'd like any future help.

Re:How to write a command line application in Node.js by chrsstrm on Sunday August 11, 2013 @04:43AM (#6194358)
Thanks. Appreciate the info.