{"id":21,"date":"2005-11-27T15:25:21","date_gmt":"2005-11-27T20:25:21","guid":{"rendered":"http:\/\/blog.elharo.com\/blog\/?p=21"},"modified":"2015-12-09T06:53:17","modified_gmt":"2015-12-09T11:53:17","slug":"birds-on-rails-part-1","status":"publish","type":"post","link":"https:\/\/www.elharo.com\/blog\/software-development\/web-development\/2005\/11\/27\/birds-on-rails-part-1\/","title":{"rendered":"Birds on Rails, Part 1"},"content":{"rendered":"<p>I&#8217;ve been working on reimplementing a web application for tracking bird reports in something modern. The current app is held together with Interbase, Delphi, payware e-mail libraries, and variety of handgrown scripts. There aren&#8217;t even any input forms that talk directly to the database. Instead you have to e-mail your reports in. The site is uploaded to the server after being statically generated from the database every five minutes or so. This was state of the art in 1995, I suppose. It&#8217;s a little questionable today, and the current maintainer\/inventor wants to give it up. One of the problems with these sorts of applications is that they&#8217;re unmanageable by anybody other than the person who wrote them. Thus it seemed like time to reimplement all this in a slightly more standard manner.<\/p>\n<p>I began by setting up the database tables in MySQL. The lack of foreign key constraints feels a little wrong since I have lots of detail tables in this app. However, it does make the initial data entry a little easier than it might otherwise be.<\/p>\n<p>I tried writing some PHP pages, but that was more difficult than I expected so I thought I&#8217;d take a day and see if Ruby on Rails was all it was cracked up to be. I&#8217;d looked at it initially, but decided against it because IBiblio doesn&#8217;t yet support Ruby. But I&#8217;m prototyping this on my desktop Mac, and if Ruby makes my job a lot easier, I could find a different host. <!--more--><\/p>\n<p>First step was installing RubyGems. (Ruby is either installed by default on Mac OS X, or I had installed it previously. I&#8217;m not sure which.) That required sudo but was otherwise uneventful.<\/p>\n<pre>$sudo  ruby setup.rb<\/pre>\n<p>Next I used gem to install rails:<\/p>\n<pre>$ gem install rails --remote<\/pre>\n<p>This needs some dependencies installed (rake) and it looks like that requires root access too. OK. Let&#8217;s redo that, but with sudo this time:<\/p>\n<pre>$ sudo gem install rails --remote<\/pre>\n<p>There seem to be a half dozen required dependencies. gem should probably just install them, but in any case I typed &#8220;Y&#8221; for each one:<\/p>\n<pre>~$ sudo gem install rails --remote\r\nAttempting remote installation of 'rails'\r\nUpdating Gem source index for: http:\/\/gems.rubyforge.org\r\nInstall required dependency rake? [Yn]  Y\r\nInstall required dependency activesupport? [Yn]  Y\r\nInstall required dependency activerecord? [Yn]  Y\r\nInstall required dependency actionpack? [Yn]  Y\r\nInstall required dependency actionmailer? [Yn]  Y\r\nnstall required dependency actionwebservice? [Yn]  Y\r\nSuccessfully installed rails-0.14.3\r\nSuccessfully installed rake-0.6.2\r\nSuccessfully installed activesupport-1.2.3\r\nSuccessfully installed activerecord-1.13.0\r\nSuccessfully installed actionpack-1.11.0\r\nSuccessfully installed actionmailer-1.1.3\r\nSuccessfully installed actionwebservice-0.9.3\r\nInstalling RDoc documentation for rake-0.6.2...\r\nInstalling RDoc documentation for activesupport-1.2.3...\r\nInstalling RDoc documentation for activerecord-1.13.0...\r\n\r\nlib\/active_record.rb:73:64: Skipping require of dynamic string: \"active_record\/connection_adapters\/#{adapter}_adapter\"\r\nInstalling RDoc documentation for actionpack-1.11.0...\r\n\r\nlib\/action_controller\/assertions.rb:4:69: Skipping require of dynamic string: \"#{File.dirname(__FILE__)}\/vendor\/html-scanner\/html\/document\"\r\nInstalling RDoc documentation for actionmailer-1.1.3...\r\nInstalling RDoc documentation for actionwebservice-0.9.3...\r\n<\/pre>\n<p>Fast this isn&#8217;t, but hopefully I only have to do this once. Ok. That&#8217;s Done. Onto Rails.<\/p>\n<p>I begin by creating the web site:<\/p>\n<pre>~\/web sites$ rails bbr\r\n      create  \r\n      create  app\/controllers\r\n      create  app\/helpers\r\n      create  app\/models\r\n      create  app\/views\/layouts\r\n      create  config\/environments\r\n      create  components\r\n      create  db\r\n      create  doc\r\n      create  lib\r\n      create  lib\/tasks\r\n      create  log\r\n      create  public\/images\r\n      create  public\/javascripts\r\n      create  public\/stylesheets\r\n      create  script\/performance\r\n      create  script\/process\r\n      create  test\/fixtures\r\n      create  test\/functional\r\n      create  test\/mocks\/development\r\n      create  test\/mocks\/test\r\n      create  test\/unit\r\n      create  vendor\r\n      create  vendor\/plugins\r\n      create  Rakefile\r\n      create  README\r\n      create  app\/controllers\/application.rb\r\n      create  app\/helpers\/application_helper.rb\r\n      create  test\/test_helper.rb\r\n      create  config\/database.yml\r\n      create  config\/routes.rb\r\n      create  public\/.htaccess\r\n      create  config\/boot.rb\r\n      create  config\/environment.rb\r\n      create  config\/environments\/production.rb\r\n      create  config\/environments\/development.rb\r\n      create  config\/environments\/test.rb\r\n      create  script\/about\r\n      create  script\/breakpointer\r\n      create  script\/console\r\n      create  script\/destroy\r\n      create  script\/generate\r\n      create  script\/performance\/benchmarker\r\n      create  script\/performance\/profiler\r\n      create  script\/process\/reaper\r\n      create  script\/process\/spawner\r\n      create  script\/process\/spinner\r\n      create  script\/runner\r\n      create  script\/server\r\n      create  script\/plugin\r\n      create  public\/dispatch.rb\r\n      create  public\/dispatch.cgi\r\n      create  public\/dispatch.fcgi\r\n      create  public\/404.html\r\n      create  public\/500.html\r\n      create  public\/index.html\r\n      create  public\/favicon.ico\r\n      create  public\/robots.txt\r\n      create  public\/javascripts\/prototype.js\r\n      create  public\/javascripts\/effects.js\r\n      create  public\/javascripts\/dragdrop.js\r\n      create  public\/javascripts\/controls.js\r\n      create  doc\/README_FOR_APP\r\n      create  log\/server.log\r\n      create  log\/production.log\r\n      create  log\/development.log\r\n      create  log\/test.log\r\n~\/web sites$ \r\n<\/pre>\n<p>That was fast. Now let&#8217;s run the server:<\/p>\n<p>~\/web sites$ ruby scriptserver<br \/>\nruby: No such file or directory &#8212; scriptserver (LoadError)<\/p>\n<p>Hmm. That&#8217;s weird. Am I following Windows instructions? Yes, and I&#8217;m in the wrong directory to boot. (That backslash should have been a red flag.) One more time:<\/p>\n<pre>~\/web sites$ cd bbr    \r\n~\/web sites\/bbr$ ruby script\/server\r\n=> Booting WEBrick...\r\n=> Rails application started on http:\/\/0.0.0.0:3000\r\n=> Ctrl-C to shutdown server; call with --help for options\r\n[2005-11-26 07:02:54] INFO  WEBrick 1.3.1\r\n[2005-11-26 07:02:54] INFO  ruby 1.8.2 (2004-12-25) [powerpc-darwin8.0]\r\n[2005-11-26 07:02:55] INFO  WEBrick::HTTPServer#start: pid=3036 port=3000<\/pre>\n<p>Now let&#8217;s see if the server is up by browsing to http:\/\/localhost:3000\/<\/p>\n<p>Yep. It&#8217;s working. Here&#8217;s the first page:<\/p>\n<blockquote>\n<h1>Congratulations, you&#8217;ve put Ruby on Rails!<\/h1>\n<p><b>Before you move on<\/b>, verify that the following conditions have been met:<\/p>\n<ol>\n<li>The log and public directories must be writable to the web server (<code>chmod -R 775 log<\/code> and <code>chmod -R 775 public<\/code>).\n  <\/li>\n<li>\n    The shebang line in the public\/dispatch* files must reference your Ruby installation. <br \/>\n    You might need to change it to <code>#!\/usr\/bin\/env ruby<\/code> or point directly at the installation.\n  <\/li>\n<li>\n    Rails on Apache needs to have the cgi handler and mod_rewrite enabled.  <br \/>\n    Somewhere in your httpd.conf, you should have:<br \/>\n    <code>AddHandler cgi-script .cgi<\/code><br \/>\n    <code>LoadModule rewrite_module     libexec\/httpd\/mod_rewrite.so<\/code><br \/>\n    <code>AddModule mod_rewrite.c<\/code><\/p>\n<\/li>\n<\/ol>\n<p>Take the following steps to get started:<\/p>\n<ol>\n<li>Create empty development and test databases for your application.<br \/>\n    <small>Recommendation: Use *_development and *_test names, such as basecamp_development and basecamp_test<\/small><br \/>\n    <small>Warning: Don&#8217;t point your test database at your development database, it&#8217;ll destroy the latter on test runs!<\/small><\/p>\n<\/li>\n<li>Edit config\/database.yml with your database settings.\n  <\/li>\n<li>Create controllers and models using the generator in <code>script\/generate<\/code> <br \/>\n    <small>Help: Run the generator with no arguments for documentation<\/small>\n  <\/li>\n<li>See all the tests run by running <code>rake<\/code>.\n  <\/li>\n<li>Develop your Rails application!\n  <\/li>\n<li>Setup Apache with <a href=\"http:\/\/www.fastcgi.com\">FastCGI<\/a> (and <a href=\"http:\/\/raa.ruby-lang.org\/list.rhtml?name=fcgi\">Ruby bindings<\/a>), if you need better performance\n  <\/li>\n<li>Remove the dispatches you don&#8217;t use (so if you&#8217;re on FastCGI, delete\/move dispatch.rb, dispatch.cgi and gateway.cgi)<\/li>\n<\/ol>\n<p>\n  Trying to setup a default page for Rails using Routes? You&#8217;ll have to delete this file (public\/index.html) to get under way. Then define a new route in <tt>config\/routes.rb<\/tt> of the form:\n  <\/p>\n<pre>  map.connect '', :controller =&gt; 'wiki\/page', :action =&gt; 'show', :title =&gt; 'Welcome'<\/pre>\n<p>\n  Having problems getting up and running? First try debugging it yourself by looking at the log files. <br \/>\n  Then try the friendly Rails community <a href=\"http:\/\/www.rubyonrails.org\">on the web<\/a> or <a href=\"http:\/\/www.rubyonrails.org\/show\/IRC\">on IRC<\/a><br \/>\n  (<a href=\"irc:\/\/irc.freenode.net\/#rubyonrails\">FreeNode#rubyonrails<\/a>).\n<\/p>\n<\/blockquote>\n<p>Seems like there&#8217;s a lot of work to do. Let&#8217;s get started. <\/p>\n<p>Step 1. Change the permissions. Done. You would think the installer could have set the permissions properly on the directories it itself created.<\/p>\n<p>Step 2. Set the shebang line in the three dispatch files. Those are set to #!\/usr\/bin\/ruby. That seems to work. At least I have a \/usr\/bin\/ruby. (Again, the installer should have been able to figure this out automatically, and adjust it if necessary.)<\/p>\n<p>Step 3. I&#8217;m not running this on Apache just yet, but let&#8217;s check anyway:<\/p>\n<pre>~\/web sites\/bbr\/public$ grep cgi \/private\/etc\/httpd\/httpd.conf\r\nLoadModule cgi_module         libexec\/httpd\/mod_cgi.so\r\nAddModule mod_cgi.c\r\n    ScriptAlias \/cgi-bin\/ \"\/Library\/WebServer\/CGI-Executables\/\"\r\n    #AddHandler cgi-script .cgi\r\n# Format: Action media\/type \/cgi-script\/location\r\n# Format: Action handler-name \/cgi-script\/location\r\n#ErrorDocument 404 \/cgi-bin\/missing_handler.pl\r\n# support\/phf_abuse_log.cgi.\r\n#&lt;Location \/cgi-bin\/phf*>\r\n#    ErrorDocument 403 http:\/\/phf.apache.org\/phf_abuse_log.cgi\r\n~\/web sites\/bbr\/public$ grep rewrite \/private\/etc\/httpd\/httpd.conf\r\nLoadModule rewrite_module     libexec\/httpd\/mod_rewrite.so\r\nAddModule mod_rewrite.c\r\n&lt;ifmodule mod_rewrite.c><\/pre>\n<p>Rewriting is turned on. .cgi handling isn&#8217;t. I&#8217;ll need to fix that if I&#8217;m trying to integrate this with Apache, but for now I can skip that step.<\/p>\n<p>Now to connect to my databases. First, Rails wants me to create separate production, test, and development databases. That seems like a good idea regardless, so let&#8217;s do that. The production database is named bbr:<\/p>\n<pre>$ mysqldump -u root -p  bbr &gt; bbr.sql\r\n~\/backups$ mysql -u root -p\r\nEnter password: \r\nWelcome to the MySQL monitor.  Commands end with ; or g.\r\nYour MySQL connection id is 117 to server version: 5.0.16-standard\r\n\r\nType 'help;' or 'h' for help. Type 'c' to clear the buffer.\r\n\r\nmysql> create database bbr_test;\r\nQuery OK, 1 row affected (0.01 sec)\r\n\r\nmysql> use bbr_test;\r\nDatabase changed\r\nmysql> source bbr.sql;\r\n...\r\nmysql> create database bbr_development;\r\nQuery OK, 1 row affected (0.01 sec)\r\n\r\nmysql> use bbr_development;\r\nDatabase changed\r\nmysql> source bbr.sql;\r\n\r\nQuery OK, 0 rows affected (0.00 sec)\r\n...\r\nmysql> quit\r\nBye<\/pre>\n<p>Now I have to setup database.yml. Looking inside it figured out most things automatically. (I wonder how it knew which database to use? It probably guessed from the name of the directory I&#8217;d created to hold the site.)<\/p>\n<pre>development:\r\n  adapter: mysql\r\n  database: bbr_development\r\n  username: root\r\n  password:\r\n  socket: \/tmp\/mysql.sock\r\n\r\n  # Connect on a TCP socket.  If omitted, the adapter will connect on the\r\n  # domain socket given by socket instead.\r\n  #host: localhost\r\n  #port: 3306\r\n  \r\n# Warning: The database defined as 'test' will be erased and\r\n# re-generated from your development database when you run 'rake'.\r\n# Do not set this db to the same as development or production.\r\ntest:\r\n  adapter: mysql\r\n  database: bbr_test\r\n  username: root\r\n  password:\r\n  socket: \/tmp\/mysql.sock\r\n\r\nproduction:\r\n  adapter: mysql\r\n  database: bbr_production\r\n  username: root\r\n  password: \r\n  socket: \/tmp\/mysql.sock<\/pre>\n<p>I just need to change the name of the production database to bbr, add the passwords, and delete the lines for the databases I&#8217;m not using.<\/p>\n<p>Time to start writing pages. Let&#8217;s put the main page at <em>\/bbr<\/em> (One thing I like a lot about Rails is that it let&#8217;s you organize according to a natural URL structure. My PHP apps always have much too large query strings.  WordPress works around that, but it requires a lot of mod_rewrite Voodoo.) First let&#8217;s navigate to \/bbr (even though the page doesn&#8217;t exist yet) and <strong>Whammo!<\/strong> I just found the first major flaw in Rails: <\/p>\n<p><img decoding=\"async\" src=\"\/blog\/images\/setcookie.png\" alt=\"Rails setting session ID\" width='481' height='242'\/><\/p>\n<p>It&#8217;s trying to set a cookie for no reason whatsoever, even for a page that doesn&#8217;t exist! What&#8217;s worse, it&#8217;s a session ID! This is completely contrary to the web architecture, and a very common mistake made by developers who are mired in 1980s style of applications and have never understood the Web, and probably never will. My PHP version and the existing site I&#8217;m replacing are completely cookie-free. This is not a good sign, and does not leave me with a warm-and-fuzzy feeling; but let&#8217;s deny the setting of the cookie, proceed onward, and see what happens.<\/p>\n<p>We get a routing error as expected because there&#8217;s no such page. Let&#8217;s go ahead and generate that page:<\/p>\n<pre>~\/web sites\/bbr$ script\/generate controller bbr   \r\n      exists  app\/controllers\/\r\n      exists  app\/helpers\/\r\n      create  app\/views\/bbr\r\n      exists  test\/functional\/\r\n      create  app\/controllers\/bbr_controller.rb\r\n      create  test\/functional\/bbr_controller_test.rb\r\n      create  app\/helpers\/bbr_helper.rb\r\n<\/pre>\n<p>Now the page shows <\/p>\n<blockquote>\n<h1>Unknown action<\/h1>\n<p>No action responded to index<\/p>\n<\/blockquote>\n<p>So I have to edit the controller script for bbr:<\/p>\n<p>$ bbedit app\/controllers\/bbr_controller.rb<\/p>\n<p>It initially looks like this:<\/p>\n<pre>class BbrController < ApplicationController\r\nend<\/pre>\n<p>Now I define an index method like so:<\/p>\n<pre>class BbrController &lt; ApplicationController\r\n\r\n  def index\r\n    render_text \"Hello Birds!\"\r\n  end \r\n\r\nend<\/pre>\n<p>Save it, reload the page, and we see the text &#8220;Hello Birds&#8221;. Cool. Next let&#8217;s fill it with HTML instead. Trying the simplest thing that could possibly work, I pasted a bunch of HTML into the index method. However, that produced a syntax error. Hmm, there has to be a simpler way to do this than printing all the strings? <\/p>\n<p>Or maybe not. Ruby lets me put line breaks in string literals, so maybe I just have to paste it into the string literals. How do I escape double quotes in string literals in Ruby? As usual, Google comes to the rescue, and tells me to use a backslash. OK. That worked. Ugly but functional. there&#8217;s probably a smarter way to do this I just don&#8217;t know yet, but that will suffice for now.<\/p>\n<p>Now let&#8217;s see if we can pull some data out of the database and put it in the page. The Rails examples I&#8217;ve seen have all been quite flat databases. Mine&#8217;s more complex; but let&#8217;s start with something flat: making a list of all the sites in the sites table and putting it in an unordered list. First I generate the model and the controller:<\/p>\n<pre>~\/web sites\/bbr$ script\/generate model Site\r\n      exists  app\/models\/\r\n      exists  test\/unit\/\r\n      exists  test\/fixtures\/\r\n      create  app\/models\/site.rb\r\n      create  test\/unit\/site_test.rb\r\n      create  test\/fixtures\/sites.yml\r\n~\/web sites\/bbr$ script\/generate controller Site  \r\n      exists  app\/controllers\/\r\n      exists  app\/helpers\/\r\n      create  app\/views\/site\r\n      exists  test\/functional\/\r\n      create  app\/controllers\/site_controller.rb\r\n      create  test\/functional\/site_controller_test.rb\r\n      create  app\/helpers\/site_helper.rb\r\n<\/pre>\n<p>Since the model is named Site, Rails looks for a table named &#8220;sites&#8221;. Allegedly, it understands English plurals and the difference between upper and lower case.<\/p>\n<p>At this point I seem to be going off script. I just want to get a list of the sites in the database, and Rails wants me to create a new page with the ability to insert new sites. This is a common criticisim of Rails. It works great if you do what it wants you to, and not so well if you deviate from the approved path.<\/p>\n<p>Let&#8217;s edit the controller:<\/p>\n<pre>class SiteController &lt; ApplicationController\r\nend<\/pre>\n<p>to<\/p>\n<pre>class SiteController &lt; ApplicationController\r\n  scaffold :site\r\nend<\/pre>\n<p>When I try to connect to http:\/\/127.0.0.1:3000\/site\/list it refuses user@localhost with no password. I wonder if I need to restart the web server to get it to pick up the config changes that included the username and password? Nope, that didn&#8217;t do it. Or a problem with old style passwords? Doesn&#8217;t seem likely. I&#8217;m using the latest version of MySQL 5. Maybe it&#8217;s this:<\/p>\n<pre>sudo gem install mysql -- --with-mysql-dir=\/usr\/local\/mysql<\/pre>\n<p>I skipped this step the first time through because I thought it wsas sintalling mysql which I already have, but apparently gem only installs the Ruby bindings for MySQL. Nope. Restarted the web server. Same problem. Let&#8217;s try<\/p>\n<p>sudo gem install mysql &#8212; &#8211;with-mysql-dir=\/usr\/local\/mysql-standard-5.0.16-osx10.4-powerpc-64bit<\/p>\n<p>instead. Nope same problem. Wait, I just noticed something. The error message is <\/p>\n<p><code>Access denied for user ''@'localhost' (using password: NO)<\/code><\/p>\n<p>It&#8217;s not user@localhost, it&#8217;s the user empty string at localhost. Perhaps a clue?<\/p>\n<p>Ah. OK. It looks like gem did not properly install the MySQL connector. Let&#8217;s see if we can fix that. Hmm, after much futzing this may compile it:<\/p>\n<pre>\/usr\/lib\/ruby\/gems\/1.8\/gems\/mysql-2.7$ sudo ruby extconf.rb -- --with-mysql-config\r\nPassword:\r\nchecking for mysql_ssl_set()... no\r\nchecking for mysql.h... yes\r\ncreating Makefile\r\n\/usr\/lib\/ruby\/gems\/1.8\/gems\/mysql-2.7$ make\r\ngcc -fno-common -arch i386 -arch ppc -g -Os -pipe -fno-common -arch i386 -arch ppc -pipe -pipe -fno-common  -I. -I\/usr\/lib\/ruby\/1.8\/powerpc-darwin8.0 -I\/usr\/lib\/ruby\/1.8\/powerpc-darwin8.0 -I. -DHAVE_MYSQL_H  -I\/usr\/local\/mysql\/include -Os -arch ppc64 -fno-common -c mysql.c\r\ngcc: cannot read specs file for arch `i386'\r\nmake: *** [mysql.o] Error 1\r\n\/usr\/lib\/ruby\/gems\/1.8\/gems\/mysql-2.7$ h | grep gcc\r\n  512  sudo gcc_select 3.3\r\n  518  gcc -version\r\n  519  gcc --version\r\n  540  gcc -version\r\n  541  gcc --version\r\n  556  h | grep gcc\r\n\/usr\/lib\/ruby\/gems\/1.8\/gems\/mysql-2.7$ sudo gcc_select 4.0\r\nDefault compiler has been set to:\r\ngcc version 4.0.0 (Apple Computer, Inc. build 5026)\r\n\/usr\/lib\/ruby\/gems\/1.8\/gems\/mysql-2.7$ sudo make\r\ngcc -fno-common -arch i386 -arch ppc -g -Os -pipe -fno-common -arch i386 -arch ppc -pipe -pipe -fno-common  -I. -I\/usr\/lib\/ruby\/1.8\/powerpc-darwin8.0 -I\/usr\/lib\/ruby\/1.8\/powerpc-darwin8.0 -I. -DHAVE_MYSQL_H  -I\/usr\/local\/mysql\/include -Os -arch ppc64 -fno-common -c mysql.c\r\ncc  -dynamic -bundle -undefined suppress -flat_namespace  -L\"\/usr\/lib\" -o mysql.bundle mysql.o  -arch ppc64 -L\/usr\/local\/mysql\/lib -lmysqlclient -lz -lm  -lpthread -ldl -lobjc  \r\nld64 warning: in \/usr\/lib\/libz.dylib, file does not contain requested architecture\r\nld64 warning: in \/usr\/lib\/libobjc.dylib, file does not contain requested architecture<\/pre>\n<p>Hmm, maybe the problem is that bit about -arch i386? or the duplicated flags? Let me try to edit that manually. Hmm. Same warning. However after installing it there&#8217;s finally some effect. The error message in Ruby has changed to &#8220;uninitialized constant Mysql&#8221;.<\/p>\n<p>Maybe it&#8217;s because I&#8217;m using the 64-bit version of MySQL? Switching to the 32-bit version does seem to make a difference. I can now run the mysql-ruby tests and avoid link errors. The tests fail but I can run them. <\/p>\n<pre>~\/downloads\/mysql-ruby-2.7.1$ ruby .\/test.rb localhost root\r\nLoaded suite .\/test\r\nStarted\r\n.........................................................FFF......F.................F.........................\r\nFinished in 0.470085 seconds.\r\n\r\n  1) Failure:\r\ntest_fetch_bigint(TC_MysqlStmt2) [.\/test.rb:799]:\r\n&lt;[-1]> expected but was\r\n&lt;[9223372036854775807]>.\r\n\r\n  2) Failure:\r\ntest_fetch_bigint_unsigned(TC_MysqlStmt2) [.\/test.rb:812]:\r\n&lt;[-1]> expected but was\r\n&lt;[0]>.\r\n\r\n  3) Failure:\r\ntest_fetch_binary(TC_MysqlStmt2) [.\/test.rb:1009]:\r\n&lt;[\"abc\"]> expected but was\r\n&lt;[\"abc\u00ef\u00bf\u00bd00\u00ef\u00bf\u00bd00\u00ef\u00bf\u00bd00\u00ef\u00bf\u00bd00\u00ef\u00bf\u00bd00\u00ef\u00bf\u00bd00\u00ef\u00bf\u00bd00\"]>.\r\n\r\n  4) Failure:\r\ntest_fetch_double(TC_MysqlStmt2) [.\/test.rb:860]:\r\n&lt;-1.79769313486232e+308> expected but was\r\n&lt;-1.79769313486232e+308>.\r\n\r\n  5) Failure:\r\ntest_fetch_timestamp(TC_MysqlStmt2) [.\/test.rb:950]:\r\n&lt;[#&lt;Mysql::Time:2037-12-31 23:59:59>]> expected but was\r\n&lt;[#&lt;Mysql::Time:0000-00-00 00:00:00>]>.\r\n\r\n110 tests, 344 assertions, 5 failures, 0 errors\r\n<\/pre>\n<p>Finally making progress. Now I get a different error message:<\/p>\n<pre> Mysql::Error in Site#list\r\n\r\nAccess denied for user 'root'@'localhost' (using password: YES)<\/pre>\n<p>But at least this time it recognizes the user as root. Hmm, maybe the problem is that the new 32-bit database doesn&#8217;t yet have a password; and that seems to be it. Finally! Now it&#8217;s working, and I can move forward. <\/p>\n<p>I&#8217;m not sure exactly where the problem lies. However, the error messages could certainly have been more helpful. Tomorrow I&#8217;ll try to get back to actually building the application. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;ve been working on reimplementing a web application for tracking bird reports in something modern. The current app is held together with Interbase, Delphi, payware e-mail libraries, and variety of handgrown scripts. There aren&#8217;t even any input forms that talk directly to the database. Instead you have to e-mail your reports in. The site is [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[410],"class_list":["post-21","post","type-post","status-publish","format-standard","hentry","category-web-development","tag-flash"],"_links":{"self":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/21","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/comments?post=21"}],"version-history":[{"count":1,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/21\/revisions"}],"predecessor-version":[{"id":1005187,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/posts\/21\/revisions\/1005187"}],"wp:attachment":[{"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/media?parent=21"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/categories?post=21"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.elharo.com\/blog\/wp-json\/wp\/v2\/tags?post=21"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}