Does Ruby generate WINDOWS and dialog boxes?

Odds are it Just Won’t unless you only
render in IE with high security privileges and abuse ActiveX with
reckless abandon.

A client’s WindowsXP machine, for the purpose of running a Rails-based
app, will have Firefox running and invoke the app with
http://localhost:3000, which will be serviced by WEBrick, a Ruby-based
web server, supported by a publicly available database like MySQL. No
ActiveX nor security risks.

As I’m generally not a fan of the heinous crimes commited in the name of
Ajax, I’d have to see the result for that to happen.

I’ll have an example on my website in a month. Send me an email
inviting me to contact you when it’s ready if you’re interested in
seeing it.

Most of the
in-browser desktop mockups make me ask why not use Java Web Start /
ClickOnce / Flex anyway?

IMHO, Ruby + Rails is a far superior way to build both desktop and web
apps. Java is, too my taste, a lousy C++, which I felt is the most
elegant programming language ever. But I’ve come to see that Ruby is
the most economical yet powerful (in terms of programmer effort)
languages ever. Of course, I’m not really qualified to make such
judgments, despite 40+ years of professional programming experience
with IBM mainframe assembler, Fortran, and Cobol to desktop Visual C++.

I see by your disdain of some aspects of the current state of affairs
that you’ve thought a lot about some of these issues, so I’m
interested in knowing whether you’re more sanguine about the
Ruby-Rails-WEBrick-MySQL environment.

Best wishes,
Richard Muller

Odds are it Just Won’t unless you only
render in IE with high security privileges and abuse ActiveX with
reckless abandon.

A client’s WindowsXP machine, for the purpose of running a Rails-based
app, will have Firefox running and invoke the app with
http://localhost:3000, which will be serviced by WEBrick, a Ruby-based
web server, and supported by a publicly available database-server like
MySQL. No
ActiveX nor security risks. But plenty of Ajax.

As I’m generally not a fan of the heinous crimes committed in the name of
Ajax, I’d have to see the result for that to happen.

I’ll have an example on a website in a month.

Most of the
in-browser desktop mockups make me ask why not use Java Web Start /
ClickOnce / Flex anyway?

IMHO, Ruby + Rails is a far superior way to build both desktop and web
apps. Java is, too my taste, a lousy C++, which I felt is the most
elegant programming language ever. But I’ve come to see that Ruby is
the most economical yet powerful (in terms of programmer effort)
languages ever. Of course, I’m not really qualified to make such
judgments, despite 40+ years of professional programming experience
with IBM mainframe assembler, Fortran, and Cobol to desktop Visual C++.

I see by your disdain of some aspects of the current state of affairs
that you’ve thought a lot about some of these issues, so I’m
interested in knowing whether you’re more sanguine about the
Firefox-Ruby-Rails-WEBrick-MySQL environment.

As I said, I’ll have a sample app up in a month or so housed on a
website that supports Ruby-Rails-MySQL apps. If you wish, send me an
email indicating your interest and I’ll respond with URL, user-name
and password when it’s ready. Right now I’m toying with the idea of
posting a small reward to anyone who can crack the web app and email me
selected content from it (sort of a poor man’s way of tests done on the
DES, as I recall).

Best wishes,
Richard Muller

David V. wrote:

The namedropped (in a snarky way) experience is ad verecundiam, a
logical fallacy. To respond to it any more would be stooping down to the
same level.

Still, I’m glad to see I’m not the only programmer with 40+ years of
experience that likes Ruby and is still spending some time every day
writing code. :slight_smile:

I’ll have to
disclaim though that I’m far from a security expert, so the above are to
an extend half-educated guesses.

The fundamental principles of security are simple:

  1. Trust nobody, even yourself. :slight_smile:
  2. Satisfy the Congress, the attorneys and accountants first, then your
    business partners, then your customers. If you have anything left over,
    satisfy your employees… :slight_smile:
  3. Back everything up! And stress-test your disaster recovery
    mechanisms!


M. Edward (Ed) Borasky, FBG, AB, PTA, PGS, MS, MNLP, NST, ACMC(P)
http://borasky-research.blogspot.com/

If God had meant for carrots to be eaten cooked, He would have given
rabbits fire.

M. Edward (Ed) Borasky wrote:

  1. Trust nobody, even yourself. :slight_smile:

The seedy looking punk behind the window in the bathroom is ME?!

David V.

Richard wrote:

with IBM mainframe assembler, Fortran, and Cobol to desktop Visual C++.

For the client-side logic, you’re still stuck to HTML and Javascript,
which are both flawed in their way. While web frameworks help with that,
it’s still artificially shifting logic that could as well be done
client-side (validation which only requires checking against the data
the client is already operating on already, paginating content,
formatting data, etc.) I mentioned the above technologies because they
exist, while I’m not aware of any way to easily keep a Ruby-based client
program up-to-date conveniently, or even deliver it cross-platform
easily because of the dependency on native extensions.

I’m not very sure how Rails would be suitable to make desktop
applications, the framework doesn’t seem to have a discernable core for
action processing that would be unaware of web idiosyncracies. I might
be wrong.

The namedropped (in a snarky way) experience is ad verecundiam, a
logical fallacy. To respond to it any more would be stooping down to the
same level.

I see by your disdain of some aspects of the current state of affairs
that you’ve thought a lot about some of these issues, so I’m
interested in knowing whether you’re more sanguine about the
Ruby-Rails-WEBrick-MySQL environment.

Ruby is fine if you can juggle the complexity, but it requires more
programmer competence and dilligence for the software to be robust - a
quality that grows with importance the closer to end users you get.

I’m past my “Oooh, shiny!” Rails phase. Scaffolding is nice, yet in a
way just smoke and mirrors, ActiveRecord is just way too basic as an ORM
solution and not much simpler to use once enough of its assumptions on
the data model and physical DB schema don’t hold. Convention over
configuration gets hairy in complex deployment scenarios - table names
changing (having to accomodate to a weird naming convention between
prototype and production) mean a recode, and generally the magic becomes
harmful if you need to separate the object model from the tables and
columns. I don’t think this applies to your scenario though.

WEBrick is a development server. Probably Good Enough for a one server -
one user scenario, but I don’t think it’s meant to handle more.

As for MySQL, I more or less share the attitude of Austin Z. on it.
Most of MySQL users are mentally stuck with v3.x and make data schemas
that would make an onion cry. Mentioning “no security risks” if you let
arbitrary clients access your database is debatable though, I thought
you’re supposed to keep production data storage behind a firewall.
Giving end-users write-access credentials sounds like way too much
potential for a malicious user to do damage to me, unless you only allow
write access through secured stored procedures, or bend your model
backwards for table-level restrictions to be sufficient. I’ll have to
disclaim though that I’m far from a security expert, so the above are to
an extend half-educated guesses.

As for the whole environment, my work experience so far has been in
scenarios where that would blow up on data schema brittleness, or the
generations-of-maintaining-interns syndrome. As for any such solution
template, there are assumptions that must hold before the solution can
be an effective one. The “we have a hammer, now every problem is a nail”
approach is a very destructive self-delusion (to wit: J2EE’s rap of
being overcomplex after hype led to it being used for the wrong range of
problems.) Since I don’t know your problem, and the umpty other factors
that have to be considered when creating a software system’s
architecture (the target audience, the deployment requirements, the
performance requirements, how well does the domain model map to being
handled over the web), I can’t judge whether the approach you outlined
is a good fit. This is hugely digressing from the original topic
though.

David V.

Not to attempt to bring this back on topic or anything, but I needed
this
information as well. I’d played with TK and it was, um, ugly. I can’t
very
well bring this to my supervisor and say “we should look into Ruby” if I
can’t impress the hell out of him. I looked up VisualuRuby and followed
the
first google link. I found plenty of good examples after following a
few
links (Project VisualuRubyitemp-namejSample scripts).
Just an FYI, the author states that his environment is win98, but I’m
running them on winxp sp2 fully patched. Everything seems to work as
intended for win98.
C:\ruby\programs>ruby --version
ruby 1.8.4 (2005-12-24) [i386-mswin32]

This caught my eye: http://vruby.sourceforge.net/sample/traytest.rb
It adds a system tray icon, modifies one, deletes the one created, among
other things. There’s a comment in there about the added task tray icon
not
automagically deleting itself upon the window closing. What I’m
uncertain
of, is how to go about fixing that. Some of the other programs I was
able
to make minor changes too in order to make it look how I wanted, but
this
problem eludes me. Can anyone suggest a way to modify the program in
order
to automagically check for task bar icons before closing the program?
The
bug isn’t serious at all - apparently if you simply move your mouse
cursor
over the icon it disappears, so that’s no big deal. That said it annoys
me. Also, I’m a firm believer in the “give a man a fire and he’s warm
for a
day, set him on fire and he’s warm for life” theory, so if anyone can
recommend further documentation that will point me towards an answer,
I’d be
happy to read that as opposed to simply being given a solution. Though
I’ll
take either.

One other question, I didn’t see any samples of how to control tabbing
through the various components. Does anyone have any info on that?

This has been one of the most informative ruby threads I’ve followed
since I
started reading the mailing list. Thanks to all the contributors from a
nuby :slight_smile:

On Mon, 2006-18-12 at 04:50 +0900, Richard wrote:

IMHO, Ruby + Rails is a far superior way to build both desktop and web
apps. Java is, too my taste, a lousy C++, which I felt is the most
elegant programming language ever.

Wow! Someone used the words “C++” and “elegant” in the same sentence
without a negative in between and with no hint of irony.


Michael T. Richter
Email: [email protected], [email protected]
MSN: [email protected], [email protected]; YIM:
michael_richter_1966; AIM: YanJiahua1966; ICQ: 241960658; Jabber:
[email protected]

“I have no purpose, directly or indirectly, to interfere with the
institution of slavery in the States where it exists.” --Abraham Lincoln

Disclaimer: All my assertions about Ruby, Rails, WEBrick and MySQL are
based on a few months of experience with these products.

David V. wrote:

For the client-side logic, you’re still stuck to HTML and Javascript,
which are both flawed in their way. While web frameworks help with that,
it’s still artificially shifting logic that could as well be done
client-side (validation which only requires checking against the data
the client is already operating on already, paginating content,
formatting data, etc.) I

The app structure I outlined, Firefox+Ruby+Rails+WEBrick+MySQL, all
runs on the client’s machine (except for the database server). The
user machine(s) need not be connected to the Internet, though it/they
needs a LAN connection to a database server. So everything except the
data-store is “client-side”. Do you agree?

Secondly, the kind of apps I’ve worked on (and plan to continue working
on) all need robust user interfaces. Raw HTML is no doubt inferior to,
say, Microsoft’s MFC or Java’s Swing. However, Rails code is run
through Extended Ruby (erb) which programmatically generates repetitive
HTML, so it’s pretty nice to use even absent a drag-n-drop GUI
builder.

I’m not aware of any way to easily keep a Ruby-based client
program up-to-date conveniently

Ruby supports Test Driven Development in a very rich way (which I never
did before). Likewise, it supports automated programming
documentation in pretty convenient way (never did that either). Add
the fact that it supports database development with an abstraction that
offers independence from variations of SQL implementations. I’m
optimistic that maintenance will be easier on these projects than any
I’ve been on before.

or even deliver it cross-platform
easily because of the dependency on native extensions.

Rails is based on Ruby. Ruby is based on C. And C is widely viewed as
a hardware abstraction layer. So that stuff is already ported anywhere
I’m likely to want to go.

I’m not very sure how Rails would be suitable to make desktop
applications, the framework doesn’t seem to have a discernable core for
action processing

It implements an MVC architecture in a very neat way. The model
house/enforces the business logic. The views present data from the
models to the client, and pass back client actions as appropriate. The
controllers oversee the traffic between those layers. I haven’t done
much of this yet, so it remains for me to see how well that works.

that would be unaware of web idiosyncracies. I might
be wrong.

That’s a good point to consider. What sort of idiosynchrasies might
adversely affect this scheme, noting that we’re planning for apps on
isolated machines (except for the dataset connection)?

The namedropped (in a snarky way) experience is ad verecundiam, a
logical fallacy.

I didn’t intend to offend anyone. I forgot why I mentioned it.
(Unfortunately, I deleted my posted msg). I think I was making it
clear that I’ve had a lot of experience in a variety of software
development environments. I intended, but failed, to make it clear at
the outset that I was new to Ruby, Rails and web development. I can’t
see that constitutes “the fallacy of making an illicit appeal to
authority”. But, as you say, it’s not worth pursuing.

Ruby is fine if you can juggle the complexity, but it requires more
programmer competence and diligence for the software to be robust - a
quality that grows with importance the closer to end users you get.

Isn’t that true regardless of the language?

I’m past my “Oooh, shiny!” Rails phase. Scaffolding is nice, yet in a
way just smoke and mirrors.

Any large application requires decisions about how the code should be
factored. Rails gives you one-liners that puts stuff in the “right”
place so it will be found by other pieces and by the developer.
Wouldn’t you credit that as more than smoke and mirrors. Particularly
that they’ve built in this scheme of “helpers” that help
developer’s factor their code that IMHO is a natural way.

ActiveRecord is just way too basic as an ORM
solution and not much simpler to use once enough of its assumptions on
the data model and physical DB schema don’t hold.

If you use Active Record Migration, the SQL database schema would
always be in synch, wouldn’t it? And don’t you value that Rails
automatically maintains a history of migrations so you can easily back
up to an earlier version if necessary; likewise for matching back up
with the program code so long as version control, e.g. Subversion that
Rubyists like.

Convention over
configuration gets hairy in complex deployment scenarios - table names
changing (having to accommodate to a weird naming convention between
prototype and production) mean a recode, and generally the magic becomes
harmful if you need to separate the object model from the tables and
columns. I don’t think this applies to your scenario though.

As I understand it, only the database name changes between
development, test and production, not any of the table-names nor any
code except doe some external symbol indicating which one is targeted.

An important service Rails provides, and that I love, is in generating
single and two-way linkages for one-to-many and many-to-many
relationships with one-liners and simple column-name standards for
keys. I’ve only used one database system that might be an ORM:
Documentum. But all my database past and anticipated needs have been
and I expect will be satisfied E. F. Codd’s style of database:
Oracle, SQL Server, DB2 and little old MySQL.

WEBrick is a development server. Probably Good Enough for a one server -
one user scenario, but I don’t think it’s meant to handle more.

Great: that fits my target scenario.

As for MySQL, I more or less share the attitude of Austin Z. on it.
Most of MySQL users are mentally stuck with v3.x and make data schemas
that would make an onion cry.

I’ve been using ver. 5 and the schemas Rails generates from migrations
seem OK to me. I particularly like the fact that this version supports
transactions … IMHO a “must” for app relying on database support.

Mentioning “no security risks” if you let
arbitrary clients access your database is debatable though, I thought
you’re supposed to keep production data storage behind a firewall.
Giving end-users write-access credentials sounds like way too much
potential for a malicious user to do damage to me, unless you only allow
write access through secured stored procedures, or bend your model
backwards for table-level restrictions to be sufficient. I’ll have to
disclaim though that I’m far from a security expert, so the above are to
an extend half-educated guesses.

That’s something I have to work on. My first thought is that the
MySQL server has to be on a machine whose physical security is
maintained. Then it needs network authentication for users and user
machines hitting on it. MySQL seems to support user security pretty
well with access levels and encrypted passwords. That encryption
scheme could be used on critically sensitive data if performance allows
it. If the LAN connecting the database to users has any Internet
connection, then the database server machine will need a firewall, too,
as you said.

It’s been nice using this thread to think through some of these
issues and having the opportunity to try to “sell” my ideas and
consider the weaknesses they may suffer. So this exercise has been
good for me. Thanks for your enthusiastic participation.

Best wishes,
Richard

Richard wrote:

Disclaimer: All my assertions about Ruby, Rails, WEBrick and MySQL are
based on a few months of experience with these products.

David V. wrote:

For the client-side logic, you’re still stuck to HTML and Javascript,
which are both flawed in their way. While web frameworks help with that,
it’s still artificially shifting logic that could as well be done
client-side (validation which only requires checking against the data
the client is already operating on already, paginating content,
formatting data, etc.) I

The app structure I outlined, Firefox+Ruby+Rails+WEBrick+MySQL, all
runs on the client’s machine (except for the database server). The
user machine(s) need not be connected to the Internet, though it/they
needs a LAN connection to a database server. So everything except the
data-store is “client-side”. Do you agree?

Secondly, the kind of apps I’ve worked on (and plan to continue working
on) all need robust user interfaces. Raw HTML is no doubt inferior to,
say, Microsoft’s MFC or Java’s Swing. However, Rails code is run
through Extended Ruby (erb) which programmatically generates repetitive
HTML, so it’s pretty nice to use even absent a drag-n-drop GUI
builder.

I’m not aware of any way to easily keep a Ruby-based client
program up-to-date conveniently

Ruby supports Test Driven Development in a very rich way (which I never
did before). Likewise, it supports automated programming
documentation in pretty convenient way (never did that either). Add
the fact that it supports database development with an abstraction that
offers independence from variations of SQL implementations. I’m
optimistic that maintenance will be easier on these projects than any
I’ve been on before.

or even deliver it cross-platform
easily because of the dependency on native extensions.

Rails is based on Ruby. Ruby is based on C. And C is widely viewed as
a hardware abstraction layer. So that stuff is already ported anywhere
I’m likely to want to go.

I’m not very sure how Rails would be suitable to make desktop
applications, the framework doesn’t seem to have a discernable core for
action processing

It implements an MVC architecture in a very neat way. The model
house/enforces the business logic. The views present data from the
models to the client, and pass back client actions as appropriate. The
controllers oversee the traffic between those layers. I haven’t done
much of this yet, so it remains for me to see how well that works.

that would be unaware of web idiosyncracies. I might
be wrong.

That’s a good point to consider. What sort of idiosynchrasies might
adversely affect this scheme, noting that we’re planning for apps on
isolated machines (except for the dataset connection)?

The namedropped (in a snarky way) experience is ad verecundiam, a
logical fallacy.

I didn’t intend to offend anyone. I forgot why I mentioned it.
(Unfortunately, I deleted my posted msg). I think I was making it
clear that I’ve had a lot of experience in a variety of software
development environments. I intended, but failed, to make it clear at
the outset that I was new to Ruby, Rails and web development. I can’t
see that constitutes “the fallacy of making an illicit appeal to
authority”. But, as you say, it’s not worth pursuing.

Ruby is fine if you can juggle the complexity, but it requires more
programmer competence and diligence for the software to be robust - a
quality that grows with importance the closer to end users you get.

Isn’t that true regardless of the language?

I’m past my “Oooh, shiny!” Rails phase. Scaffolding is nice, yet in a
way just smoke and mirrors.

Any large application requires decisions about how the code should be
factored. Rails gives you one-liners that puts stuff in the “right”
place so it will be found by other pieces and by the developer.
Wouldn’t you credit that as more than smoke and mirrors. Particularly
that they’ve built in this scheme of “helpers” that help
developer’s factor their code that IMHO is a natural way.

ActiveRecord is just way too basic as an ORM
solution and not much simpler to use once enough of its assumptions on
the data model and physical DB schema don’t hold.

If you use Active Record Migration, the SQL database schema would
always be in synch, wouldn’t it? And don’t you value that Rails
automatically maintains a history of migrations so you can easily back
up to an earlier version if necessary; likewise for matching back up
with the program code so long as version control, e.g. Subversion that
Rubyists like.

Convention over
configuration gets hairy in complex deployment scenarios - table names
changing (having to accommodate to a weird naming convention between
prototype and production) mean a recode, and generally the magic becomes
harmful if you need to separate the object model from the tables and
columns. I don’t think this applies to your scenario though.

As I understand it, only the database name changes between
development, test and production, not any of the table-names nor any
code except doe some external symbol indicating which one is targeted.

An important service Rails provides, and that I love, is in generating
single and two-way linkages for one-to-many and many-to-many
relationships with one-liners and simple column-name standards for
keys. I’ve only used one database system that might be an ORM:
Documentum. But all my database past and anticipated needs have been
and I expect will be satisfied E. F. Codd’s style of database:
Oracle, SQL Server, DB2 and little old MySQL.

If I understand correctly:

WEBrick is a development server. Probably Good Enough for a one server -
one user scenario, but I don’t think it’s meant to handle more.

Great: that fits my target scenario.

We have a one-user application…

That’s something I have to work on. My first thought is that the
MySQL server has to be on a machine whose physical security is
maintained. Then it needs network authentication for users and user
machines hitting on it. MySQL seems to support user security pretty
well with access levels and encrypted passwords.

And lots of baggage if we use a system for multi-user applications…

That encryption
scheme could be used on critically sensitive data if performance allows
it. If the LAN connecting the database to users has any Internet
connection, then the database server machine will need a firewall, too,
as you said.

And security concerns about data leaking from the user’s machine…

Might I suggest:

  • use WEBrick on a firewalled port that is accessible only from the
    local machine 0.0.0.0

  • use the SQLite3 (http://wiki.rubyonrails.org/rails/pages/SQLite)
    because it stores data in normal (binary) files on the machine it’s
    running on. For example, if your Rails app is located in /foo/bar, then
    the DB files will be in /foo/bar/db/

  • for concerns about upgrading (i.e. it’s easier to update one central
    server than updating many individual machines), you could have each user
    check-out your whole rails app from a version control system. Then, when
    you do maintainance updates to your DB schema and so on, the user would
    simply update their check-out and run “rails migrate”. Done!

Hi Michael,

Wow! Someone used the words “C++” and “elegant” in the same sentence
without a negative in between and with no hint of irony.

I know you meant that in a light-hearted way. Yet, I wonder whether
you agree that there have been a lot of books sold on that topic? And
that most of those by people under no duress?

If you agree with the foregoing, you’ll likely concede there are (or
at least, were) a good number of other that at least that the language
to be “good”. And do you think it’s possible a few them even would add
“elegant”?

Then I wonder whether you read Stroustrup’s “The Design and Evolution
of C++”? It strikes me as a great engineering example. Do you agree.
(For that matter, do you think the development of C was great
engineering?)

Do you a good opinion of any of the high-level general-purpose
languages? Any that you find elegant?

How about Ruby? Rails? Do you find either of them elegant?

Is it all just a matter of taste?

Best wishes,
Richard

Suraj K. wrote:

when
you do maintainance updates to your DB schema and so on, the user would
simply update their check-out and run “rails migrate”. Done!

That should be “rake migrate” not “rails migrate”.

Ahh, sorry, I forgot to cut out the irrelevant text at the top of the
message. :frowning:

Jason M. wrote:

This caught my eye: http://vruby.sourceforge.net/sample/traytest.rb
It adds a system tray icon, modifies one, deletes the one created, among
other things. There’s a comment in there about the added task tray icon
not
automagically deleting itself upon the window closing. What I’m uncertain
of, is how to go about fixing that. Some of the other programs I was able
to make minor changes too in order to make it look how I wanted, but this
problem eludes me. Can anyone suggest a way to modify the program in order
to automagically check for task bar icons before closing the program?

Trap SIGINT in the UI setup? The closure should make this fairly
automagical if you don’t mind the memory leak.

Also, no idea about vruby, but some other GUI toolkits I worked with
provide a window close hook. Search through the documentation for some
sort of “on close” event to handle on the main application window?
(Where you’d likely keep a reference to the tray icon.)

David V.

Suraj K. wrote:

If I understand correctly:

No :stuck_out_tongue_winking_eye: The database is shared between the users, only the webserver runs
locally.

David V.

Richard wrote:

The app structure I outlined, Firefox+Ruby+Rails+WEBrick+MySQL, all
runs on the client’s machine (except for the database server). The
user machine(s) need not be connected to the Internet, though it/they
needs a LAN connection to a database server. So everything except the
data-store is “client-side”. Do you agree?

Yes. However, there’s still the HTTP request divisor in the middle, with
no / hacked push in the WEBrick -> Firefox direction. At least as far as
I know, prototype.js, the Javascript library Rails uses for Ajax
support, doesn’t try to support any form of pub/sub messaging or
anything close to sane event support in the push direction. Of course,
it might be possible your application only needs to pull data.

Secondly, the kind of apps I’ve worked on (and plan to continue working
on) all need robust user interfaces. Raw HTML is no doubt inferior to,
say, Microsoft’s MFC or Java’s Swing. However, Rails code is run
through Extended Ruby (erb) which programmatically generates repetitive
HTML, so it’s pretty nice to use even absent a drag-n-drop GUI
builder.

I don’t actually find Swing superior to setup a UI, HTML, while flawed,
mirrors the UI layout in its structure, which is a good thing. However,
for me that is offset by having fine-grained data binding - for complex
UIs, it rubs me in a better way than bending my code to be essentially
request / (partial) response.

or even deliver it cross-platform
easily because of the dependency on native extensions.

Rails is based on Ruby. Ruby is based on C. And C is widely viewed as
a hardware abstraction layer. So that stuff is already ported anywhere
I’m likely to want to go.

I didn’t mean work in the first place. I meant keeping an up-to-date
version on all the users’ machines. Last time there was a thread on the
subject of distributing whole applications with rubygems, I think there
were quite a few gotchas mentioned. But you might want to search the
archives for that to see if the approach is viable / what you’d have to
work around.

I’m not very sure how Rails would be suitable to make desktop
applications, the framework doesn’t seem to have a discernable core for
action processing

It implements an MVC architecture in a very neat way. The model
house/enforces the business logic. The views present data from the
models to the client, and pass back client actions as appropriate. The
controllers oversee the traffic between those layers. I haven’t done
much of this yet, so it remains for me to see how well that works.

No / weak / coarse-grained push from the model to the view would be a
showstopper for me for the sort of problems where’d I use a rich GUI.

that would be unaware of web idiosyncracies. I might
be wrong.

That’s a good point to consider. What sort of idiosynchrasies might
adversely affect this scheme, noting that we’re planning for apps on
isolated machines (except for the dataset connection)?

Nothing that’s really a showstopper from this point of view, just the
request / response / sessions clutter that’s not really essential to the
way I would model a rich GUI application. For me, it would involve
working around those, maybe you have an architectyre / model in mind
where the mapping is straightforward.

Ruby is fine if you can juggle the complexity, but it requires more
programmer competence and diligence for the software to be robust - a
quality that grows with importance the closer to end users you get.

Isn’t that true regardless of the language?

Not on a quantitative level. Easily accessible metaprogramming
facilities are a potential complexity explosion, and need competence and
/ or restraint to avoid abstraction leak between modules. (For example
introducing a method to a class at a scope where it clutters in modules
that probably won’t use the functionality “because it’s convenient that
way”.)

If creating a database schema from scratch, unless you hit some of the
more obscure deficiencies of AR (2PC and the like), in your scenario
it’s probably fine.

While migrations are indeed sexy, using them means you pretty much
eschew the magic of AR, at which point it becomes only incrementally
more convenient as an ORM solution rather than revolutionary.

An important service Rails provides, and that I love, is in generating
single and two-way linkages for one-to-many and many-to-many
relationships with one-liners and simple column-name standards for
keys.

This I consider unforgivable brain-damage, AR should have supported
database metadata investigation and looking at foreign key constraints
out of the box. Same goes for migrations-generated schemas (I haven’t
really seen those, I admit.).

As for MySQL, I more or less share the attitude of Austin Z. on it.
Most of MySQL users are mentally stuck with v3.x and make data schemas
that would make an onion cry.

I’ve been using ver. 5 and the schemas Rails generates from migrations
seem OK to me. I particularly like the fact that this version supports
transactions … IMHO a “must” for app relying on database support.

And only decades after all the competition. Currently, I don’t see much
of a reason why not to use MySQL in a general scenario (before
concurrency handling considerations and load tests come into play),
however I also don’t see much of a reason to do so - I’ll stay with
religious opinions and stick to the featurefullness of Postgres.

David V.

I wrote some text above the quoted text in your message, saying:

If I understand correctly:

WEBrick is a development server. Probably Good Enough for a one server -
one user scenario, but I don’t think it’s meant to handle more.

Great: that fits my target scenario.

We have a one-user application…

So, whatever I wrote below, it was under the assumption that only one
user would access the database (i.e. each user has their own DB).

Richard wrote:

That’s something I have to work on. My first thought is that the
MySQL server has to be on a machine whose physical security is
maintained. Then it needs network authentication for users and user
machines hitting on it. MySQL seems to support user security pretty
well with access levels and encrypted passwords.

And lots of baggage if we use a system for multi-user applications…

You think MySQL 5.0 server version is not good for multi-user
applications?

It is fine. However, my software engr. professor said PostgreSQL is
better because MySQL doesn’t handle concurrency issues very well.

And security concerns about data leaking from the user’s machine…

Might I suggest:

  • use WEBrick on a firewalled port that is accessible only from the
    local machine 0.0.0.0

I’m planning to use WEBrick server on each user’s machine, as well as
on the database server/development machine/version-control repository.
Everybody will access their own copy of the web-server at
localhost:3000. where localhost=127.0.0.1.

Is 0.0.0.0 superior to that, and why?

I used to think 0.0.0.0 was better (somebody told me so, long ago), but
I’ve just read up on it again and there really doesn’t seem to be any
difference. Thus, I would just use “localhost” because it is more human
readable.

  • use the SQLite3 (http://wiki.rubyonrails.org/rails/pages/SQLite)
    because it stores data in normal (binary) files on the machine it’s
    running on. For example, if your Rails app is located in /foo/bar, then
    the DB files will be in /foo/bar/db/

Right now, I have MySQL 5.0 running on my development machine, and it
stores the data the data sub-directory of its installation directory.
I imagine it’s easy to configure it to store data wherever I wish to
target it.

Yes, that is fine.

  • for concerns about upgrading (i.e. it’s easier to update one central
    server than updating many individual machines), you could have each user
    check-out your whole rails app from a version control system. Then, when
    you do maintainance updates to your DB schema and so on, the user would
    simply update their check-out and run “rails migrate”. Done!

(I noted your “rake migrate” correction)

If confused about one thing here. Since the databases and development
environment are on one machine, shouldn’t I:

  • run “rake migrate” only on this machine
  • update the Rails app to relating to the changes in the database
  • update my test suite to test those changes (or write the tests first
    to satisfy some purists)
  • run my entire test suite until all tests pass
  • submit my Rails app to the version control system
  • broadcast a message to all users that the should update their version
    of app by getting the latest and greatest version?

Yes, that is correct.

However, this brings up another issue. Since each user’s local copy of
your Rails app has write access to your central DB, you could lose all
your data on the central DB if a user runs

rake migrate VERSION=0

It’s kinda silly, but possible.

Good luck.

Hi David,

I think we’re converging to a solution.

The app structure I outlined … Do you agree?

Yes. However, there’s still the HTTP request divisor in the middle, with
no / hacked push in the WEBrick -> Firefox direction. …Of course,
it might be possible your application only needs to pull data.

OK, we’ll have to wait and see on that, 'cause I don’t know.

Secondly, the kind of apps I’ve worked on (and plan to continue working
on) all need robust user interfaces. …

… However,
for me that is offset by having fine-grained data binding - for complex
UIs, it rubs me in a better way than bending my code to be essentially
request / (partial) response.

OK, another thing to wait on.

… So that stuff is already ported anywhere
I’m likely to want to go.
I didn’t mean work in the first place. I meant keeping an up-to-date
version on all the users’ machines. Last time there was a thread on the
subject of distributing whole applications with rubygems, I think there
were quite a few gotchas mentioned. But you might want to search the
archives for that to see if the approach is viable / what you’d have to
work around.

Gotcha. I just posed the question about handling upgrades to the app.
I didn’t think about Ruby gems. I thought I’d make the database server
machine server as the developer machine as well as the config. mgmt
machine. So when a database schema change is required, I thought I’d
shutdown access to users and:

  • run “rake migrate” only on this machine
  • update the Rails app to relating to the changes in the database
  • update my test suite to test those changes (or write the tests first
    to satisfy some purists)
  • run my entire test suite until all tests pass
  • submit my Rails app to the version control system
  • broadcast a message to all users that the should update their version
    of app by getting the latest and greatest version?

What do you think of that?

… weak / coarse-grained push from the model to the view would be a
showstopper for me for the sort of problems where’d I use a rich GUI.

I don’t understand. I think this process works this way: The
controller tells the model to cook up some data, suitably filtered and
ordered, and keep it available for access by the appropriate view.
Then the contoller tells the appropriate view to do its thing with the
data, namely produce HTML with the data suitable tagged plus embedded
Ruby and send that amalgam to the web-server. The web-server invokes
Extended Ruby to process the “enriched” HTML and send the resulting
vanilla HTML to the browser.

Is my description of the process OK? Does “push” refer to the
“web-server to browser” step?

That’s a good point to consider. What sort of idiosynchrasies might
adversely affect this scheme …
Nothing that’s really a showstopper from this point of view, just the
request / response / sessions clutter that’s not really essential to the
way I would model a rich GUI application.

Gotcha. But all the request/response stuff is on a single box, so the
processing time should be a few milliseconds, don’t you think?

For me, it would involve
working around those, maybe you have an architectyre / model in mind
where the mapping is straightforward.

I’ve anticipating a dozen, maybe two dozen, tables with lots of
one-to-many and many-to-many relations, somewhat complex updates which
would be unpleasant to program were it not for transaction service for
the DBMS. However, the amount of data in any transaction will be
small. And the data transfers for display will be small, too, because
all tables will be paged.

Ruby is fine if you can juggle the complexity …
Isn’t that true regardless of the language?
Not on a quantitative level. Easily accessible metaprogramming
facilities are a potential complexity explosion, and need competence and
/ or restraint to avoid abstraction leak between modules. (For example
introducing a method to a class at a scope where it clutters in modules
that probably won’t use the functionality “because it’s convenient that
way”.)

I don’t plan to intoduce that kind of complexity myself. I’m sure
Rails itself employs some metaprogramming, but I’m confident that
works well, requiring no meddling by me.

ActiveRecord is just way too basic as an ORM …
If you use Active Record Migration, the SQL database schema would
always be in synch, wouldn’t it? …
If creating a database schema from scratch, unless you hit some of the
more obscure deficiencies of AR (2PC and the like), in your scenario
it’s probably fine.

Cool!

While migrations are indeed sexy, using them means you pretty much
eschew the magic of AR, at which point it becomes only incrementally
more convenient as an ORM solution rather than revolutionary.

I plan to use mostly generated screens funtil I’ve got concept approval
from clients. So I can use AR to painlessly regenerate any of them
affected by DB changes. However, I also anticipate a number of
screens with one or more tables with column-by-column table-sorting and
filtering functionality. But most of that involves passing parameters
in links that invoke a package that produces the required effect. I’ve
got a demo of that working – I just need to figure out how to package
it.

An important service Rails provides, and that I love, is in generating
single and two-way linkages for one-to-many and many-to-many
relationships with one-liners and simple column-name standards for
keys.

This I consider unforgivable brain-damage, AR should have supported
database metadata investigation and looking at foreign key constraints
out of the box.

Yea, but its only a few lines here and there. To me, it’s really
painless, especially considering what I’ve had to do with Oracle and
SQL Sever using VC++.

I’ve been using ver. 5 and the schemas Rails generates from migrations
seem OK to me. …
And only decades after all the competition. Currently, I don’t see much
of a reason why not to use MySQL in a general scenario (before
concurrency handling considerations and load tests come into play),
however I also don’t see much of a reason to do so - I’ll stay with
religious opinions and stick to the featurefullness of Postgres.

I’m planning to look into the final choice of DBMS in the final stage
of my current project. Concurrency handling and response times are
certainly issues I’ll want to address.

Thanks for your ideas.

Best wishes,
Richard

Hi Suraj,

Thanks for responding.

That’s something I have to work on. My first thought is that the
MySQL server has to be on a machine whose physical security is
maintained. Then it needs network authentication for users and user
machines hitting on it. MySQL seems to support user security pretty
well with access levels and encrypted passwords.

And lots of baggage if we use a system for multi-user applications…

You think MySQL 5.0 server version is not good for multi-user
applications?

And security concerns about data leaking from the user’s machine…

Might I suggest:

  • use WEBrick on a firewalled port that is accessible only from the
    local machine 0.0.0.0

I’m planning to use WEBrick server on each user’s machine, as well as
on the database server/development machine/version-control repository.
Everybody will access their own copy of the web-server at
localhost:3000. where localhost=127.0.0.1. Is 0.0.0.0 superior to
that, and why?

  • use the SQLite3 (http://wiki.rubyonrails.org/rails/pages/SQLite)
    because it stores data in normal (binary) files on the machine it’s
    running on. For example, if your Rails app is located in /foo/bar, then
    the DB files will be in /foo/bar/db/

Right now, I have MySQL 5.0 running on my development machine, and it
stores the data the data sub-directory of its installation directory.
I imagine it’s easy to configure it to store data wherever I wish to
target it.

  • for concerns about upgrading (i.e. it’s easier to update one central
    server than updating many individual machines), you could have each user
    check-out your whole rails app from a version control system. Then, when
    you do maintainance updates to your DB schema and so on, the user would
    simply update their check-out and run “rails migrate”. Done!

(I noted your “rake migrate” correction)

If confused about one thing here. Since the databases and development
environment are on one machine, shouldn’t I:

  • run “rake migrate” only on this machine
  • update the Rails app to relating to the changes in the database
  • update my test suite to test those changes (or write the tests first
    to satisfy some purists)
  • run my entire test suite until all tests pass
  • submit my Rails app to the version control system
  • broadcast a message to all users that the should update their version
    of app by getting the latest and greatest version?

Regards,
Richard

David V. wrote:

Suraj K. wrote:
No :stuck_out_tongue_winking_eye: The database is shared between the users, only the webserver runs
locally.

Right on David. But Suraj’s comments make me wonder: if I create a
new migration on the MySQL server, wouldn’t I almost surely make some
changes in the Rails app? Otherwise, what would be the point?

That leads me to thing that the machine housing the MySQL server should
be my development machine. There I make my changes targeting the test
db, run all my tests (including new ones specifically to cover the
changes), put all the Rails-app changes into version control.
Finally, I broadcast to all users to update their local copy of the
Rails app.

Make sense?

Regards,
Richard

Richard wrote:

  • broadcast a message to all users that the should update their version
    of app by getting the latest and greatest version?

Mind the “should”. It’s a bit too late at night for me to try to go over
such scenarios in my head, but there’s always users that can’t be
bothered (me, on any occasion I can get away with it, for instance), and
you run the risk of someone with a version that’s not up-to-date
thrashing the data. Somehow. Just a point to watch out for. Either keep
more stringent checks on the DB-side, or make sure that updates to users
happen automatically, transparently, and preferrably fast - depending on
how controlled your user base is, you might or might not get away with
the app “calling home”.

Of course, odds are that’s just me being paranoic and that wouldn’t
really happen with a proper data model design in the first place.

“web-server to browser” step?

No. With a webapp, the process is always initiated by the web browser,
and it’s a pull. The produced HTML is the current state of the view for
a user, and if the user doesn’t poll for changes, it will go stale if a
relevant part of the model changes. The “hack” around this is having the
browser regularly poll for updates (in a JS loop), and more or less cook
your own event loop using Ajax, as-known-from-GUIs. (Which you do if, in
fact, you expect asynchronous changes rendering someone’s view state
obsolete and that is an undesirable thing.) The one problem there is
lag, HTTP has bad performance characteristics for this - otherwise it’s
semantically the same you do in GUIs, except you have to implement it
yourself (or look into an Ajax support library for help). So I’d take
frequency of necessary updates and the connection quality into account
too, if you need either more “realtime” behaviour, or you want to
service sluggish connections, you might want to do something against it.
Comet comes to mind if that’s the case.
[http://alex.dojotoolkit.org/?p=545]. I’m not sure if Rails /
Prototype.js support that though, so you might end up having to use
Dojo, which Rails didn’t have special support for last time I checked.

Nothing that’s really a showstopper from this point of view, just the
request / response / sessions clutter that’s not really essential to the
way I would model a rich GUI application.

Gotcha. But all the request/response stuff is on a single box, so the
processing time should be a few milliseconds, don’t you think?

Yes. It’s just clutter from the elegance point of view, not a
performance one.

[Stuff I didn’t have anything to add to snipped.]

David V.