ODBC app in Ruby - I don't believe it

Rails originally started out as being (very) opinionated (not so much
nowadays, esp. since v3). You used the stack it provided and built
your app in a certain way. That has changed quite a bit now, but much
of it still applies. That's where the thing about 'legacy' databases
comes from. If you're using a database that doesn't fit the Rails
mould it's most likely to be an old, legacy database. If you
intentionally don't use the Rails mould and create a db in *your*
mould, then there's not a lot of point in using Rails because its
strength is in its opionionatedness and it's probably worth
investigating the alternatives.

This interview with DHH gives some insight into this thinking:

Charles

···

On 6 October 2010 08:40, Dave Howell <groups.2009a@grandfenwick.net> wrote:

Now, everything comes in pieces, and you have to snap it together yourself, and there's just so much more opportunity for things to not fit together correctly.

Thanks for the extensive reply Dave. I certainly appreciate it.

I spent a lot of time last night looking at all the pieces that need to
be 'snapped together' to get, what I think should be, a simple db cgi
app to work and I just can't figure out how it can be worth it. I
appreciate your's and everyone else's sentiments but I need to create a
working project that is stable and supportable. It needs to work with
databases where a Ruby api will never exist for them, because they're
not mainstream enough. I would like to test it against other more
mainstream dbs though, so a project like dbi with odbc seems
appropriate. But, I also need to be sure, when the client comes to me
after only six months needing an update, that one of those 'snapins'
isn't gonna be considered a 'dead project'. I don't see how people can
work like this. It's unacceptable to say that Windows is a difficult
development platform. Over 90% of all businesses are small businesses
and most small businesses don't have the budget or knowledge to setup
and maintain a linux backend. I don't wanna get into an OS war here,
there's no point to it. Small businesses use Windows, period. 90% is a
number that is too huge to ignore.

I will do as you suggest and explain what I'm trying to do instead of
talking about what I've done and maybe I'll get some suggestions. At
this moment though, I think Ruby and I are a 'dead project'

Thanks again to everyone.

···

--
Posted via http://www.ruby-forum.com/.

My current web-app environment is PostgreSQL for the database, Apache &/or
Mongrel &/or WeBrick for the web server (I really don't understand that
part yet). The ODBC driver has been replaced with some postgres libraries
and the pg gem. Tango has been replaced with Ramaze&Sequel&(mumble).
"Mumble" was originally HAML, but in the end I just scrapped the entire
idea of using a templating engine because I couldn't stand the
limitations, so now (mumble) is some custom code I wrote for myself.

What limitations? I'm curious.

And, did you try Erector, or something similar? I prefer Haml, but if I was
finding it "limiting", I think that's where I'd go next.

I then spent yet another whole day trying to get Rails to work. I'd heard
such glowing praise for Rails that it took me that long to realize that it
was utterly unsuitable for my web app.

Again, I'm curious -- both about what the app was, and when this was. Rails
has come a long way.

I looked at Sequel,
ActiveRecord, and at least two other ORMs (after figuring out what the
heck an ORM was in the first place and why I would care).

DataMapper?

Either I have to make Ramaze quit playing around with this
stupid Mongrel gizmo and hook directly into Apache,

Trivial -- look into Passenger. But I'm trying to answer the "what, not how"
questions below.

so I can put muliple
websites on the same (*$*)%&@#@ port, by which I mean, port EIGHTY!

...why?

Assuming this is a requirement, the most flexible approach seems to be some
sort of reverse proxy. Apache can do it, nginx makes it simple and
lightweight, fairly trivial to just say "Any URL that starts with this gets
forwarded to this port on localhost."

The cool part is that you're then no longer tied to any one webserver, or even
any one machine.

The annoying part is that it's maybe more work than it should be to get a dev
environment setup.

or
Mongrel (or Ramaze, or Innate, or maybe WeBrick, I really haven't a clue
whose fault this is) has to quit f**king up my redirect URLs by sticking
:7000 at the end, which contaminates the proxy/reverse proxy URL rewrites

Probably Ramaze, or you. Generate relative URLs, or absolute URLs that start
with / instead of a domain, or hardcode the domain instead of detecting the
port. I don't know enough about Ramaze to know how difficult this is.

It would probably be possible to fix this at a lower level, like Rack or the
webserver itself, to fool Ramaze into thinking it's running somewhere else,
but you want the freedom to be able to tell Ramaze what kind of URLs it should
generate.

···

On Wednesday, October 06, 2010 02:40:38 am Dave Howell wrote:

Ed Reed wrote:

I spent a lot of time last night looking at all the pieces that need to
be 'snapped together' to get, what I think should be, a simple db cgi
app to work and I just can't figure out how it can be worth it. I
appreciate your's and everyone else's sentiments but I need to create a
working project that is stable and supportable.

That, to me, is the *benefit* of going with the Rails opinionated
design. Any other Rails developer who comes along to your project in 6
months time will have a head-start on how your code is structured. But I
guess you could say the same about any application design environment.

It needs to work with
databases where a Ruby api will never exist for them, because they're
not mainstream enough.

But they do have an ODBC connector? Then I'd have thought that ruby-odbc
should work, and there's a standard plugin
(activerecord-sqlserver-adapter)

It's unacceptable to say that Windows is a difficult
development platform.

Well I'm sorry, but it is. It's a total pain. Stuff which is just a
"./configure && make" away in Linux is an absolute nightmare to get
working under Windows.

Over 90% of all businesses are small businesses
and most small businesses don't have the budget or knowledge to setup
and maintain a linux backend. I don't wanna get into an OS war here,
there's no point to it. Small businesses use Windows, period. 90% is a
number that is too huge to ignore.

Then you are free to find a tool which is more suitable to your
environment - MS Access perhaps?

Nobody on this list is really going to give you a hard sell on Rails,
because this is not a Rails mailing list anyway :slight_smile: And finding a
technology which you are comfortable with is obviously a choice which
depends on your particular circumstances.

Regards,

Brian.

···

--
Posted via http://www.ruby-forum.com/\.

My current web-app environment is PostgreSQL for the database, Apache &/or
Mongrel &/or WeBrick for the web server (I really don't understand that
part yet). The ODBC driver has been replaced with some postgres libraries
and the pg gem. Tango has been replaced with Ramaze&Sequel&(mumble).
"Mumble" was originally HAML, but in the end I just scrapped the entire
idea of using a templating engine because I couldn't stand the
limitations, so now (mumble) is some custom code I wrote for myself.

What limitations? I'm curious.

I think mostly I would go to the template, and then discover that I'd need some logic to get it to come out right, so I'd mix that in (which really clutters things up), and then I'd realize I needed to loop it, and so I'd move that whole chunk back to the controller. The deal-breaker came when I found it was apparently impossible to emit HAML *from the controller* and have it processed. If I move this chunk of template back to the controller because of the need to change the output based on the data, then I had to emit HTML, then convince HAML not to escape it. So I just went back to HTML in the first place, and cut down on the number of languages I had to deal with.

And, did you try Erector, or something similar? I prefer Haml, but if I was
finding it "limiting", I think that's where I'd go next.

I didn't find Erector when I was looking. It was mentioned to me recently, and look at first glance rather a lot like what I built for myself, so I intend to give it a very close look sometime soon.

I then spent yet another whole day trying to get Rails to work. I'd heard
such glowing praise for Rails that it took me that long to realize that it
was utterly unsuitable for my web app.

Again, I'm curious -- both about what the app was, and when this was. Rails
has come a long way.

It's a program for a pharmaceutical company to track their products, processing, and inventory. My PostgreSQL schema uses a custom data type ('percentage' which is a numeric(5,2) that cannot be set above 100.00 or below 0.00), uses UUIDs for the primary keys of most tables, and takes advantage of PostgreSQL's "array" datatype to let me eliminate five or six linking tables, to just name a couple things off the top of my head that were completely un-create-able from within Rails and ActiveRecord.

I had to add code to Sequel to support UUIDs and arrays as well, but at least I could figure out HOW.

I looked at Sequel,
ActiveRecord, and at least two other ORMs (after figuring out what the
heck an ORM was in the first place and why I would care).

DataMapper?

That sounds familar. Yea, I think so.

Either I have to make Ramaze quit playing around with this
stupid Mongrel gizmo and hook directly into Apache,

Trivial -- look into Passenger. But I'm trying to answer the "what, not how"
questions below.

so I can put muliple
websites on the same (*$*)%&@#@ port, by which I mean, port EIGHTY!

...why?

Assuming this is a requirement, the most flexible approach seems to be some
sort of reverse proxy. Apache can do it, nginx makes it simple and
lightweight, fairly trivial to just say "Any URL that starts with this gets
forwarded to this port on localhost."

You'd think so. I need it because I *am* using a reverse proxy. However, the redirect _attaches the port number_, which the reverse proxy commands of Apache do not strip back off. The primary webserver is running Apache, but this site is on a different machine, and the main machine redirects traffic to it. So from the outside, they go to 'specific domain,' which goes to the primary webserver, port 80, with the target domain in the header, which reverseproxies it to the other machine on port 7000 (for the production site) or 7010 (for the demo/test site). And then the redirect occurs, and the client's web browser is now trying to get to "http://domain.com:7000/path/to/whatever&quot; which obviously fails.

I've tried adding URL rewrite rules in apache to fix them, but the interaction with the reverse proxy has utterly confounded me.

···

On Oct 8, 2010, at 0:12 , David Masover wrote:

On Wednesday, October 06, 2010 02:40:38 am Dave Howell wrote:

Brian Candler wrote:

Then you are free to find a tool which is more suitable to your
environment - MS Access perhaps?

Come on, you know that wasn't my point. Name me five of the top DBs that
don't have Windows as a primary platform. If the services run there why
should it not be expected that the development tools run there as well?

···

--
Posted via http://www.ruby-forum.com/\.

> What limitations? I'm curious.

I think mostly I would go to the template, and then discover that I'd need
some logic to get it to come out right, so I'd mix that in (which really
clutters things up), and then I'd realize I needed to loop it, and so I'd
move that whole chunk back to the controller.

Except Haml has looping constructs. There's also a pretty neat idiom where you
call a partial from a loop, so you keep your templates small. Unless your
loops are particularly bizarre, you'd still be looping over something that
came from your controller, so I don't think it's too much code in your
templates. Even if it was, I certainly don't see how abandoning the idea of
separating logic from presentation wholesale is better.

The deal-breaker came when I
found it was apparently impossible to emit HAML *from the controller* and
have it processed.

I'm pretty sure that's not true, though it's probably a bad idea and the code
would likely be ugly.

> And, did you try Erector, or something similar? I prefer Haml, but if I
> was finding it "limiting", I think that's where I'd go next.

I didn't find Erector when I was looking. It was mentioned to me recently,
and look at first glance rather a lot like what I built for myself, so I
intend to give it a very close look sometime soon.

It's basically a next-generation Markaby, and I'm guessing that existed when
you were looking. Ah, well...

>> I then spent yet another whole day trying to get Rails to work. I'd
>> heard such glowing praise for Rails that it took me that long to
>> realize that it was utterly unsuitable for my web app.
>
> Again, I'm curious -- both about what the app was, and when this was.
> Rails has come a long way.

It's a program for a pharmaceutical company to track their products,
processing, and inventory. My PostgreSQL schema uses a custom data type
('percentage' which is a numeric(5,2) that cannot be set above 100.00 or
below 0.00),

Huh. DataMapper does support custom, user-defined types, though I'm not sure
how easy it is to do that with an existing adapter. (To give you an idea,
there is currently a working DataMapper adapter for Google App Engine.)

uses UUIDs for the primary keys of most tables,

Should work. I'm fairly sure I did this with ActiveRecord, too, at one point,
though i don't remember how.

and takes
advantage of PostgreSQL's "array" datatype to let me eliminate five or six
linking tables,

App Engine also has a list type. Support for it is currently workable but not
great, but I do have plans to implement associations through arrays of ids at
some point, for example.

> Assuming this is a requirement, the most flexible approach seems to be
> some sort of reverse proxy. Apache can do it, nginx makes it simple and
> lightweight, fairly trivial to just say "Any URL that starts with this
> gets forwarded to this port on localhost."

You'd think so. I need it because I *am* using a reverse proxy. However,
the redirect _attaches the port number_,

Yeah, it shouldn't do that. Either Rails doesn't, or nginx does strip that
(unlikely), because I've hosted production Rails apps in exactly this
environment -- nginx listening on example.com, forwarding to multiple Mongrels
on various ports, not necessarily on the same machine.

So, probably somewhere in Ramaze.

I've tried adding URL rewrite rules in apache to fix them, but the
interaction with the reverse proxy has utterly confounded me.

I don't remember how, but I know that one thing Apache's rewrite rules can do
is pipe URLs to an external program. It's a trivial protocol (it sends the URL
on stdin, you give it the new URL on stdout), and that external program is a
long-running one, so you could even write that in Ruby.

But it seems like it should be much easier to fix this at the source.

···

On Tuesday, October 12, 2010 08:51:21 pm Dave Howell wrote:

On Oct 8, 2010, at 0:12 , David Masover wrote:

Postgres, Oracle, DB2, MySQL, Informix, SAP ERP.

···

On Fri, Oct 8, 2010 at 9:09 PM, Ed Reed <joebananas10@gmail.com> wrote:

Brian Candler wrote:

Then you are free to find a tool which is more suitable to your
environment - MS Access perhaps?

Come on, you know that wasn't my point. Name me five of the top DBs that
don't have Windows as a primary platform.

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

The development tools provided by the DB vendors *do* work on the
platforms they support, including Windows. However, those particular
development tools do *not* include Ruby, Rails, or the gems that
interface with those DBs. Is there something that lead you to believe
otherwise?

-Jeremy

···

On 10/08/2010 02:09 PM, Ed Reed wrote:

Brian Candler wrote:

Then you are free to find a tool which is more suitable to your
environment - MS Access perhaps?

Come on, you know that wasn't my point. Name me five of the top DBs that
don't have Windows as a primary platform. If the services run there why
should it not be expected that the development tools run there as well?

The deal-breaker came when I
found it was apparently impossible to emit HAML *from the controller* and
have it processed.

I'm pretty sure that's not true, though it's probably a bad idea and the code
would likely be ugly.

It might be possible, but I spent three or four hours trying, and failed. More about this in a following paragraph.

I certainly don't see how abandoning the idea of
separating logic from presentation wholesale is better.

Neither did the people on the Sequel list. But I should say that I didn't abandon separating logic from presentation. It was my MODEL that ended up having to handle most of the presentation that kept climbing out of Haml.

It's a program for a pharmaceutical company to track their products,
processing, and inventory. My PostgreSQL schema uses a custom data type
('percentage' which is a numeric(5,2) that cannot be set above 100.00 or
below 0.00),

Huh. DataMapper does support custom, user-defined types, though I'm not sure
how easy it is to do that with an existing adapter. (To give you an idea,
there is currently a working DataMapper adapter for Google App Engine.)

I found all kinds of indications that even ActiveRecord *could* do what I wanted. But in the end, whether or not something is *possible* is completely irrelevant in the face of "can *I* make it do that in a reasonable amount of time?"

IIRC, DataMapper and Sequel both seemed to have fairly similar capabilities based on various people's descriptions, and I think both of them were recommended to me a couple of times. Sequel's documentation kicks titanic ass, though: far and away the best I've ever gotten with any Ruby-related thingamabob. Well written and well organized RDoc-y parts, AND extensive walk-throughs, examples, and discussions, all installed right on my system, plus a developer whom I've seen easily answer questions that made my eyes cross.

HAML's documentation *looked* really good at first, but that's because it's good at telling you what it thinks you should know. It was completely silent on how to make it process the contents of a variable as HAML, or to otherwise get it inserted *before* interpretation. Nor could whichever list I asked on provide a workable answer. (feature I cannot find or use) == !(feature)

You'd think so. I need it because I *am* using a reverse proxy. However,
the redirect _attaches the port number_,

Yeah, it shouldn't do that. Either Rails doesn't, or nginx does strip that
(unlikely), because I've hosted production Rails apps in exactly this
environment -- nginx listening on example.com, forwarding to multiple Mongrels
on various ports, not necessarily on the same machine.

So, probably somewhere in Ramaze.

I think it's probably in Innate, but I'm not really clear on how Innate and Ramaze are related. Alas, Ramaze's docs are rather scattered and not entirely up to date.

···

On Oct 13, 2010, at 14:46 , David Masover wrote:

Phillip Gawlowski wrote:

Postgres, Oracle, DB2, MySQL, Informix, SAP ERP.

There's no need to be a smart ass, you knew exactly what I was talking
about.

From their own websites...

Postgres
"Binary packages
Pre-built binary packages are available for a number of different
operating systems: FreeBSD · Linux · Mac OS X · Solaris · Windows"

Oracle
"(11.2.0.1.0)
Download Microsoft Windows (32-bit) File 1, File 2 (2GB) See All
Download Microsoft Windows (x64) File 1, File 2 (2GB) See All
Download Linux x86 File 1, File 2 (2GB) See All
Download Linux x86-64 File 1, File 2 (2GB) See All
Download Solaris (SPARC) (64-bit) File 1, File 2 (2GB) See All
Download Solaris (x86-64) File 1, File 2 (2GB) See All
Download HP-UX Itanium File 1, File 2 (2GB) See All
Download HP-UX PA-RISC (64-bit) File 1, File 2 (2GB) See All
Download AIX (PPC64) File 1, File 2 (2GB) See All"

DB2
"Software DB2 for Linux, UNIX, and Windows"

MySQL
"MySQL Community Server 5.1.51
Select Platform:

Windows (x86, 32-bit), MSI Installer 5.1.51 105.9M
Download
(mysql-5.1.51-win32.msi) MD5: 1eccd54da2caa09dbf4d65e3012c23df
Windows (x86, 32-bit), MSI Installer
Essentials - Recommended"

Informix
"Operating systems supported: AIX, HP Unix, Linux, Macintosh, Sun
Solaris, Windows"

···

--
Posted via http://www.ruby-forum.com/\.

Jeremy Bopp wrote:

The development tools provided by the DB vendors *do* work on the
platforms they support, including Windows. However, those particular
development tools do *not* include Ruby, Rails, or the gems that
interface with those DBs. Is there something that lead you to believe
otherwise?

It's useless to argue about semantics on this issue in a forum like
this. I'm talking about the thirty thousand foot view of things. If a db
runs on a particular platform and a development tool runs on a the same
platform. I should be able to develop something with that tool and have
it run on that platform.

Don't start a flame war because you want to pick at a point. It goes
back to what I said earlier, 90% is a number that is too big to ignore.
You can shout all you want about the 10% and you may be absolutely right
about the 10% but it doesn't change the numbers.

···

--
Posted via http://www.ruby-forum.com/\.

> I certainly don't see how abandoning the idea of
>
> separating logic from presentation wholesale is better.

Neither did the people on the Sequel list. But I should say that I didn't
abandon separating logic from presentation. It was my MODEL that ended up
having to handle most of the presentation that kept climbing out of Haml.

To be honest, that sounds even worse. I push most of the logic back into the
model and most of the presentation into the view, leaving controllers mostly
for routing requests and authentication.

>> It's a program for a pharmaceutical company to track their products,
>> processing, and inventory. My PostgreSQL schema uses a custom data type
>> ('percentage' which is a numeric(5,2) that cannot be set above 100.00 or
>> below 0.00),
>
> Huh. DataMapper does support custom, user-defined types, though I'm not
> sure how easy it is to do that with an existing adapter. (To give you an
> idea, there is currently a working DataMapper adapter for Google App
> Engine.)

I found all kinds of indications that even ActiveRecord *could* do what I
wanted. But in the end, whether or not something is *possible* is
completely irrelevant in the face of "can *I* make it do that in a
reasonable amount of time?"

I absolutely agree. However...

Sequel's documentation kicks titanic
ass, though: far and away the best I've ever gotten with any Ruby-related
thingamabob. Well written and well organized RDoc-y parts, AND extensive
walk-throughs, examples, and discussions, all installed right on my
system, plus a developer whom I've seen easily answer questions that made
my eyes cross.

In terms of developers, I've seen the same with DataMapper...

Anyway, getting to the point:

HAML's documentation *looked* really good at first, but that's because it's
good at telling you what it thinks you should know. It was completely
silent on how to make it process the contents of a variable as HAML, or to
otherwise get it inserted *before* interpretation.

So, I hate to say it, but...

These things are open source. The source is open. More than that, Haml has a
decent test suite, which is always a good place to look when you want to know
how to use some code. It took me about three minutes to find this:

http://github.com/nex3/haml/blob/master/test/haml/template_test.rb

In particular, this line:

Haml::Engine.new(File.read(File.join(TemplateTest::TEMPLATE_PATH,
"_#{name}.haml"))).render(self, locals)

Seems to me that you'd just replace the "File.read" part with the source of
whatever you're trying to render. Note that this will likely be _much_ more
efficient if you can keep the Engine object around, and that's true for any
template system, which is probably why it makes more sense for you to take
whatever you were going to do here and put it in a partial...

Now, granted, that should only ever be a stopgap solution. After getting that
working, the immediate next thing would be to bother the list with, "Hey, I
got this working, is this likely to continue to work? If not, how can I get it
working?"

But the point is, while good docs are a good thing, I think working and
readable code is at least as important. If the docs are almost completely
comprehensive, but the code is shitty, I'm screwed as soon as I manage to ask
a question the docs can't answer. If the docs are a good starting point, but
the code is solid, I have confidence that I can answer _any_ question. If the
docs are absolutely worthless, I can't even get started.

So it seems to me like the ideal amount of documentation is enough to get
started, and more only if people have time, or where the code is particularly
unclear.

By the way, I generally only allow this excuse for libraries. If I'm
programming in Ruby, I'd better be able to read Ruby code. The same is NOT
true if I'm a user -- I should NEVER have to dig into the code of nginx.

···

On Wednesday, October 13, 2010 07:03:04 pm Dave Howell wrote:

On Oct 13, 2010, at 14:46 , David Masover wrote:

I'm seriously not trying to pick a fight. Honest. I'm really curious
what lead you to believe that there is a complete Ruby solution for
these DBs and Windows that had any promise of long term support. You
seem to have approached this whole effort with the expectation that
there is a large vendor providing some kind of professional solution
akin to .NET from Microsoft when in fact there is no such beast (at
least not yet).

A 30k foot view of things may lead to misunderstandings by itself but so
can poor or misleading documentation and erroneous Internet memes. If
you can give us an idea of what lead to your misconceptions, maybe we
can try to address those things. That's all I'm saying.

-Jeremy

···

On 10/08/2010 05:46 PM, Ed Reed wrote:

Jeremy Bopp wrote:

The development tools provided by the DB vendors *do* work on the
platforms they support, including Windows. However, those particular
development tools do *not* include Ruby, Rails, or the gems that
interface with those DBs. Is there something that lead you to believe
otherwise?

It's useless to argue about semantics on this issue in a forum like
this. I'm talking about the thirty thousand foot view of things. If a db
runs on a particular platform and a development tool runs on a the same
platform. I should be able to develop something with that tool and have
it run on that platform.

Don't start a flame war because you want to pick at a point. It goes
back to what I said earlier, 90% is a number that is too big to ignore.
You can shout all you want about the 10% and you may be absolutely right
about the 10% but it doesn't change the numbers.

[snip list o'vendors]

You should also check the programming language bindings these vendors
supply. You'll find that Ruby is lacking in pretty much all of them
(Oracle provided a package for Ruby, but I don't think it's still
supported; it's hard to find, anyway), leaving it to the Ruby
community to provide support. And since the Ruby community is
predominantly *NIX oriented, you can't expect Windows support
automatically.

If Ruby doesn't fit within your set of constraints (Win7 +ODBC + Web),
move on, and pick something that does (e.g. Win7 + ASP.NET + SQL
Server Express).

···

On Sat, Oct 9, 2010 at 12:38 AM, Ed Reed <joebananas10@gmail.com> wrote:

Phillip Gawlowski wrote:

Postgres, Oracle, DB2, MySQL, Informix, SAP ERP.

There's no need to be a smart ass, you knew exactly what I was talking
about.

From their own websites...

--
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

So, I hate to say it, but...

These things are open source. The source is open. More than that, Haml has a
decent test suite, which is always a good place to look when you want to know
how to use some code.

I don't know why you hate to say that.

But the point is, while good docs are a good thing, I think working and
readable code is at least as important.

I would agree with that.

But reading the code fundamentally tells you WHAT the code does. I look to the documentation to find out WHY?

There was nothing in the Sequel documentation that told me how I could get it to start identifying UUID codes as "type uuid" instead of pretending they were strings. But the code was fairly readable, and after following a few class definitions back up into the code, I eventually found a section that had a case statement regarding db types and Ruby types. and I figured out what to add to get it to give me UUIDs. There were still a few parts where I was scratching my head and going "What does this part do?"

It's quite possible that the answer on how to get Haml to interpret stuff was staring me in the face at some point, and I missed it. I'm afraid that doesn't change my point at all.

"I couldn't make the Frobulator fricassee."
"Oh, the Frobulator can definitely fricassee."
"I couldn't find any information about it in the documentation."
"Well, it's not in the documentation as such, unless you already know that fricassee is just a special case of fricolating a tri-fold array. But it's easy to find in the source code."
"I haven't been able to figure out how this code works."

Whether I'm too ignorant to figure out from the source code how to fricassee, or the source code's so poorly written that most people can't figure it out, or the docs fail to explain it, or it just can't do that in the first place, the end result is the same: no fricassee-ing.

I could tell pretty early on that my biggest problem with finding a good ORM was not that there were very few that were *capable* of doing what I wanted, but that very few of the people who'd written the documentation were describing their ORM's capabilities from the point of view that I had: from the database, instead of from the middleware. I kept finding tutorials that would say "or you can edit the blahblah file to work with an existing legacy database." However, I couldn't even *get* a blahblah file to edit from either Rails or Ramaze, because all the tutorials and documentation took it for granted that I was interested in making a new web site from scratch, and didn't really care all that much about the details of data storage.
  Sinatra (or rather, the ORM that came bundled with Sinatra) had a tool that was supposed to build me a class/object ORM file from my schema, but it couldn't handle UUID primary keys, so it only created about 33% of the material I needed.
  I then had to decide if it would be more efficient to just walk through the whole tutorial, learning about scaffolding and migrations, knowing that I would not have any use whatsoever for knowledge related to migrations, until I finally knew enough about the whole system that I would have the background needed to understand the code well enough to be able to figure out how to make it do what I wanted, OR would it be a better use of my time to start over with some other ORM or library or whatever, where I would be able to get started sooner by being able to take better advantage of my existing knowledge? I chose the latter route, although I would not be able to prove to somebody if it was the better choice or not.

The better I get at reading other people's Ruby code, the less I'll need to rely on good documentation.
There is a nebulous point of diminishing returns, where "better" (aka "more) documentation becomes a waste of time; there is a certain amount of knowledge that the user/programmer can be expected to know. For example, the Sequel documentation takes it for granted that I am totally familiar with SQL; most of the docs explain what the code does in terms of the equivalent SQL code. Should there be even more docs for people trying to use Sequel who've never worked directly with a SQL database before? It *would* make Sequel even more accessible to more programmers, but it's probably not worth the effort it would take for somebody to create that much more documentation.

Certainly my inability to get Haml to work for me does not mean that its documentation sucks, or that it sucks. It just didn't work for me.

It took me about three minutes to find this:

http://github.com/nex3/haml/blob/master/test/haml/template_test.rb

In particular, this line:

Haml::Engine.new(File.read(File.join(TemplateTest::TEMPLATE_PATH,
"_#{name}.haml"))).render(self, locals)

Seems to me that you'd just replace the "File.read" part with the source of
whatever you're trying to render. Note that this will likely be _much_ more
efficient if you can keep the Engine object around, and that's true for any
template system, which is probably why it makes more sense for you to take
whatever you were going to do here and put it in a partial...

Honestly, I have no idea what you just said. I certainly don't see a clear path between a code fragment in a test suite to, I guess, embedding "Haml::Engine.new(@varWithMyHamlCodeInIt)" inside a Haml template. If you do, please do NOT tell me. I'm not using Haml, and at this point can't imagine any benefit I could derive that would pay back the cost of switching my existing code base over to it.

But this, in the end, is all nit-picky detail. My original discussion was all about how the current cacophony of Ruby-based middleware was actually quite cool and powerful, but that the original poster's to make something that is so often described as "really easy" to work at all was not some giant Ruby conspiracy or a massive delusion on our part, but reflected the fact that, like myself, his background and knowledge base were not the assumed default, and I believe that this was one of the reasons why he found the whole process so unexpectedly unproductive.

···

On Oct 14, 2010, at 23:18 , David Masover wrote:

Yeah, Ed does have a point in that creating a web app that runs on
Windows 7 and talks to multiple ODBC data sources is apparently not a
great experience with Ruby. But that does beg the question: who said
it *would* be a great experience? Ruby is a great programming
language, but it is by no means perfect. Lacklustre Windows support
has long been a problem, but this is gradually improving thanks to the
efforts of the open source community. The trouble is, open source is
usually just a bunch of people scratching itches and because the Ruby
community is very *nix based, progress on Windows is often slow. In
only 2007, Luis Lavena took over maintenance of the 1-Click Installer
(now RubyInstaller), and he and the team have made great
transformational strides, but they can't do everything and therein
lies the rub: folk such as Ed come along and try something, get
frustrated, then go away. But the Ruby community *needs* experienced
Windows developers in order to help improve the tools on Windows.

Ed, compare this post:
http://blog.mmediasys.com/2008/03/06/is-windows-a-supported-platform-for-ruby-i-guess-not/

to this one:
http://blog.mmediasys.com/2010/09/23/rubyinstaller-what-where-when-1/

Things are getting better, but there's still a long way to go. Ed, if
you do persevere and manage to hook things up, it would be
tremendously helpful if you could share your solution so that others
may benefit. I would certainly find it very useful indeed to be able
to run an internal webapp that connects to multiple ODBC databases on
Windows.

Charles

···

On 8 October 2010 23:54, Jeremy Bopp <jeremy@bopp.net> wrote:

A 30k foot view of things may lead to misunderstandings by itself but so
can poor or misleading documentation and erroneous Internet memes. If
you can give us an idea of what lead to your misconceptions, maybe we
can try to address those things. That's all I'm saying.

It would be interesting to know how Python fares with these
constraints - it's been around a bit longer and seems to have better
Windows support.

Charles

···

On 9 October 2010 16:58, Phillip Gawlowski <cmdjackryan@googlemail.com> wrote:

If Ruby doesn't fit within your set of constraints (Win7 +ODBC + Web),

FWIW, this is one of the reasons that I recently switched to using JRuby as my default Ruby implementation - it lets you use the standard JDBC drivers from proprietary database vendors with a Ruby database library like Sequel or Active Record. Setup is painless and JRuby has excellent support for Windows. I'm now a big fan.

···

On Sat, Oct 9, 2010 at 12:38 AM, Ed Reed <joebananas10@gmail.com> wrote:

Phillip Gawlowski wrote:

Postgres, Oracle, DB2, MySQL, Informix, SAP ERP.

There's no need to be a smart ass, you knew exactly what I was talking
about.

From their own websites...

[snip list o'vendors]

You should also check the programming language bindings these vendors
supply. You'll find that Ruby is lacking in pretty much all of them
(Oracle provided a package for Ruby, but I don't think it's still
supported; it's hard to find, anyway), leaving it to the Ruby
community to provide support. And since the Ruby community is
predominantly *NIX oriented, you can't expect Windows support
automatically.

---
Stuart Ellis
stuart@stuartellis.eu

Reading source code is good. But in order to use something you
shouldn't need to reverse engineer an implementation, that's a waste
of time in my view. It might be equivalent for small libs, but
generally speaking it is better that you get the stuff digested, and
presented as only the experience and motivations of the author can do.

If you pick AWDwR you have a very balanced perspective on everything
Rails in a few hours of reading. You have a teacher that has prepared
the material properly. If you want to get the same knowledge by
yourself reverse engineering Rails, good luck with that.

···

On Sat, Oct 16, 2010 at 1:57 AM, Dave Howell <groups.2009a@grandfenwick.net> wrote:

The better I get at reading other people's Ruby code, the less I'll need to rely on good documentation.