Rails and Mysql on Windows 7 running smoothly.

Is rails hanging whenever you try and connect to the mysql database?

Well, like many I had some trouble getting this to work.  The problem for me was twofold.  Sometimes, I seem to fall into the rut, that just googling for and answer is the solution.  We do have to THINK as well.  Finally when I engaged my brain, some insight came.

TWO different complicated problems.  When you get ruby to work stand alone, you’re getting close!

1.  Make it work on ruby first.  I really use Ruby on Rails.  Sure I have do to some ruby, but it’s easy to forget that everything you can do in rails can be done directly in ruby.  Here is how to connect to a mysql database in ruby.
require “mysql”

con = Mysql.real_connect(‘localhost’, ‘root’, ‘password’, ‘dealer_nauvou_development’)

res =  con.query(“select * from users;”)

puts res.class

res.each do |row|

puts row.join(” “)



I tested this by starting “irb” that is interactive ruby, and pasting this code into the window.  If you cannot make this work with your database, then rails will never work.

For me, the problem was that I had multiple mysql gems installed.

gem list mysql

gem uninstall mysql

I had to get rid of ruby-mysql!

gem list mysql

gem install mysql

All was good for me.  This guy,  http://stackoverflow.com/questions/2591794/issues-while-connecting-to-mysql-using-ruby had it almost right.  Another fellow working the same problem.  http://stackoverflow.com/questions/4036130/ruby-mysql-crashing

ruby-mysql did not work for me on windows!


2.  So I was feeling good, but rails still did not work.  On to the second problem, making rails work now.

The installed version of libmysql.dll is defective!

Replace your libmysql.dll with InstantRails. one.  The link takes you to a download for the file that you need.  By the time that I got to this point, I had several copies of ruby, happens I’m using 1.9.2, and I replaced the libmysql.dll in the directory c:\ruby\193\bin.


That link was a perfect answer, so short that I almost did not try it.

Good luck, and remember THINK, don’t just google.


Arduino Mega 168 with ENC28J60 Ethernet Shield

Wow, who would have thought it would be so hard.

I purchased a cheap Chinese Mega 168 on ebay, along with one of the many ENC28J60 Ethernet cards.  For my project, I needed all of the IO that the Mega supported.  This is my first Arduino project, so I’m new to the Arduino world.  I had no problem whipping together my analog circuitry, and even made it work using the USB serial libraries.  Then I got into the Ethernet game, bought some 75′ long Ethernet cables and thought I would be good to go.  Well, it took a while, but I have made it work.  Here is what I did to get all of those wonderful analog IO ports up on Ethernet.

There are really 2 issues that you must deal with.

1.  Hardware is not compatable

2. Libraries assume that the SPI interface is on pins 10-13

The first problem is that the hardware is not compatible.  The SPI interface on the Mega is different than other boards.  When I started, I just plugged the Ethernet shield into the Mega. The symptom was that initialization never returned.  I found this by adding serial output to the web server example, and moving a print statement down through the code until the serial output failed.



to your setup function.


Serial.println(“got to line x”)

Start at the top of setup and just move it down until you don’t get any print.

When I had the hardware problem, this is the line that failed for me.


To fix this hardware compatibility problem:

Bend pins 10,11,12,13 out your Ethernet shield.  The ports that they connect to on the Mega are not compatible.

Run a jumper wire from pin 10 on the Ethernet Shield to pin 53 on the Mega.

Run a jumper wire from pin 11 on the Ethernet Shield to pin 51 on the Mega.

Run a jumper wire from pin 12 on the Ethernet Shield to pin 50 on the Mega.

Run a jumper wire from pin 13 on the Ethernet Shield to pin 52 on the Mega.

You have finished the hardware problem.  More detailed instructions can be found here:


Now it gets a little interesting.  This fix is for the “standard” Ethernet shield.  So we must adapt it to our ENC28J60 Ethernet Shield.

The best (only) working library that I have found is here:


with the download that I used here:


BUT, we are not home yet.  This library assumes that we are running on a duemilanove processor.  So we will have to make some modifications to Andy’s library analogous to what mcukits.co.uk did with the standard library.

I am running Ubuntu 10.10, although this fix should work for whatever system you are running.  On my system Andy’s code is installed at


In the file:


You will find the definitions for the SPI interface.  They are near the top line 28 for me.  Change the ports to be as follows:

#define DEFAULT_ENC28J60_CONTROL_CS             53
#define SPI_MOSI 51
#define SPI_MISO 50
#define SPI_SCK 52

Now you are ready to implement Andy’s web server demo.  It worked first time for me.  He also added ping support to the base library.  Test with ping first, it’s quick and easy, you can leave it running on your PC until the Mega begins to respond.

Good Luck!

6 Primary Web Functions Manufacturers Need to Properly Support Customers

When you are newly in business, it’s hard to get a handle on everything that must be done to succeed in business. Building and selling your product have to come first, after that, how much energy do you have to devote to other issues? Supporting your end users needs to be on the list! Using the Internet is one way to maximize the value of your efforts.

  1. Provide Documentation/Manuals.Somehow it always happens that when the user needs a manual it’s not to be found. You can minimize your customers frustrations by providing PDF copies of your users manuals on the Internet. Keep your on-line version up-to-date, and provide every version that a customer might need. It’s easy, cheap, and provides great value. When you refer to a manual, be sure that you reference the correct version, and mention where that version can be found.
  2. Warranty Registration.If you let your customers enter their name, address, model, serial number, point of purchase, etc, over the web then you don’t have to keep up with those stupid cards. No more filing, and your customer does the data entry. You also get a great source of leads for upgrades, and a nice list of names to market to.
  3. Replacement Parts Ordering.Your customers have registered their warranty, read their manual, but still sometimes parts just wear out. You can send your customers to a retail store, or sell your own genuine parts on-line. If you want to sell through on-line retailers, you and at least provide links to your preferred dealers.
  4. Frequently asked Questions.You know what they are, everyone does. That same question that comes through your switchboard 10 times a day. Nip that in the bud. Provide a well organized interview, where the system asks 3-5 questions shows relevant SOLUTIONS. Then offer…
  5. Questions Answered.Let your customer type their question into your web page. From that web page generate an email to your support people (maybe you). Then make it easy for your support people to update the list of frequently asked questions.
  6. Warranty Claims.Lets go all modern and let the customer file a warranty claim over the Internet. Why make it to hard? Clearly something is wrong, you need to make it right. Perhaps if you have a good enough software company, you can complete the negotiations without ever talking on the phone. This is especially important if your customers are not in the same country as you.

With these functions, you’ve covered the basics of what on-line customer support means for a small manufacturer.

Eugene Jones is a principal at http://www.nauvou.com. Nauvou is building the next generation of web based customer support systems for small to medium sized manufacturers. If you want to be a part of next generation web solutions, you can reach Eugene at ejones@nauvou.com , or by calling 501-223-2100.