A Little Noise

24Jul/090

Who’s there?

While playing under the dining room table:

Eden (squeaky voice): You can't come in!
Eden (deep voice): Why not?
Eden (squeaky voice): Because you're a monster!
Eden (deep voice): Oh. Ok.

Filed under: Kids No Comments
24Jul/092

Careful with those required files in Ruby

Getting Ruby to talk to MySQL was pretty easy in irb:

C:\>irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'mysql'
=> true
irb(main):003:0> db = Mysql.connect('localhost', 'root', 'password', 'test')
=> #<Mysql:0x2cc5270>
irb(main):004:0>

But then I tried the very same code from a file:

C:\>ruby mysql.rb
./mysql.rb:3: uninitialized constant Mysql (NameError)
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
        from C:/Ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `require'
        from mysql.rb:2

That require 'mysql' line looks in the current directory first ... and I'd used the name mysql.rb for the file I was coding ... so my code just included itself, and not the gem I wanted. Doh!

Filed under: MySQL Gotchas 2 Comments
9Jul/090

Workbench loses its crutches

When MySQL Workbench was still in alpha and beta stages, some dark murmurs in the community suggested that the OSS (free) version was crippleware, part of an evil plot to make you pony up $99 if you wanted to get any real benefit. Closed source and profits and bears, oh my!

The new GA release of Workbench gets some of those "crippled" features back. In particular, the OSS version now allows connections to a live server, so you can reverse and forward engineer without having to go through a dump file. I also have it on good authority that the OSS version will be able to print diagrams directly, instead of you having to export an image.

If you see any merit in a visual diagram of your database, but you wrote off Workbench based on earlier experiences, give it another try now.

Filed under: MySQL No Comments