Is Ruby good for web applications?

TextDrive (textdrive.com) is truly excellent. I'm running the Ruby Quiz
site there (with some Ruby CGI), a Rails application (with FastCGI from
lighttpd), and an Instiki web. This is typical daily stuff for them and
I found out how to set everything up from their forums.

···

-----Original Message-----
From: James Edward Gray II [mailto:james@grayproductions.net]
Sent: Friday, April 15, 2005 4:48 PM
To: ruby-talk ML
Subject: Re: Is Ruby good for web applications?

On Apr 15, 2005, at 3:41 PM, Chris Mueller wrote:

The biggest problem I've faced so far writing web apps in Ruby is
finding a webhost that supports ruby!

----------------------------

I'm also hosting with textdrive and find them great. Furthermore 50% of
the profits go back into Rails development :wink:

--Tony

I'm trying to write an interface to the Ruby regular expressions engine using a C dll, but I'm neither a Ruby nor C wiz. Can someone tell me what's wrong with the following:

#include <ruby.h>
#include <windows.h>

typedef struct RRegexp RegExp;

int regExMatch(int pos, char *pattern, char *text)
{
    RegExp *re = RREGEXP(rb_reg_new(pattern, 0, 1));
    result = rb_funcall(re, rb_intern("match"), 1, *text);
    // re will be a Ruby nil if no match is found.
    return RTEST(result);
}

I get a GPF on the first line of regExMatch.

I just need a C method equivalent of Regexp.match that I can export in a dll. Is this even the best way to go about such a thing or is there something better?

Dave

[some stuff]

Please don't hijack threads by using your reply button and replacing the subject. Sensible mailers such as yours add In-Reply-To and References headers that cause responses to your hijacking attempt to be intermixed with the original thread.

Modern mailers have 'new' buttons and address books for a reason.

PGP.sig (194 Bytes)

···

On 15 Apr 2005, at 15:53, Dave Sims wrote:

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Dave Sims <davsims@gmail.com> writes:

I'm trying to write an interface to the Ruby regular expressions
engine using a C dll, but I'm neither a Ruby nor C wiz. Can someone
tell me what's wrong with the following:

#include <ruby.h>
#include <windows.h>

typedef struct RRegexp RegExp;

int regExMatch(int pos, char *pattern, char *text)
{
    RegExp *re = RREGEXP(rb_reg_new(pattern, 0, 1));
    result = rb_funcall(re, rb_intern("match"), 1, *text);
    // re will be a Ruby nil if no match is found.
    return RTEST(result);
}

Your compiler should probably have given you a good number of
warnings/errors. `result' is undeclared, for instance. Did you
actually compile this code?

This worked for me:

  int regExMatch(int pos, char *pattern, char *text)
  {
    VALUE re, str, result;
    re = rb_reg_new(pattern, strlen(pattern), 1);
    str = rb_str_new2(text);
    result = rb_funcall(re, rb_intern("match"), 2, str, INT2NUM(pos));
    // re will be a Ruby nil if no match is found.
    return RTEST(result);
  }

I get a GPF on the first line of regExMatch.

How are you using it? If you use anything in the ruby API, you'll
probably need to have the ruby interpreter initialized (ruby_init())
before doing so. I don't know if you can use the regexp engine on its
own.

I just need a C method equivalent of Regexp.match that I can export in
a dll. Is this even the best way to go about such a thing or is there
something better?

If you just want to use regexps in C code, it seems overkill to link
the whole ruby library. A regexp library like libpcre may suffice.

HTH.

Eric,

To be honest, this is tiresome and unfriendly to users -- especially new users.

Modern mailers -- obviously not yours -- also don't just blindly use
the In-Reply-To or References field to determine threading. Indeed,
while a mailer should clear IRT if certain conditions are met, a
sensible mailer should also ignore IRT if it doesn't make sense. This
is usually the case when the subject of the message changes.

-austin

···

On 4/16/05, Eric Hodel <drbrain@segment7.net> wrote:

On 15 Apr 2005, at 15:53, Dave Sims wrote:
[some stuff]
Please don't hijack threads by using your reply button and replacing
the subject. Sensible mailers such as yours add In-Reply-To and
References headers that cause responses to your hijacking attempt to be
intermixed with the original thread.

Modern mailers have 'new' buttons and address books for a reason.

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

George Ogata wrote:

Your compiler should probably have given you a good number of
warnings/errors. `result' is undeclared, for instance. Did you
actually compile this code?

This worked for me:

int regExMatch(int pos, char *pattern, char *text)
{
   VALUE re, str, result;
   re = rb_reg_new(pattern, strlen(pattern), 1);
   str = rb_str_new2(text);
   result = rb_funcall(re, rb_intern("match"), 2, str, INT2NUM(pos));
   // re will be a Ruby nil if no match is found.
   return RTEST(result);
}

Yes, it compiled -- I didn't include all of the declarations for brevity's sake.

And you were right about the ruby_init() call -- that was the (very newbie) problem.

much thanks,

Dave

The only mailer I know of in common use that has this misfeature is Outlook (whose threading support is so dismal that it is unusable). I won't buy into the culture of Outlook, where we have to drop to the lowest common denominator. I've more frequently seen the subject change when branching off from an existing thread's topic than to ask a new question.

In-Reply-To and References are not something new (RFC 822 as of 1982). People are just being lazy when they abuse their reply buttons, and they need to stop that.

Besides, if you look back, you'll find that most of the time people reply, change the subject and ask a new question they get no answers...

PGP.sig (194 Bytes)

···

On 16 Apr 2005, at 17:14, Austin Ziegler wrote:

On 4/16/05, Eric Hodel <drbrain@segment7.net> wrote:

On 15 Apr 2005, at 15:53, Dave Sims wrote:
[some stuff]
Please don't hijack threads by using your reply button and replacing
the subject. Sensible mailers such as yours add In-Reply-To and
References headers that cause responses to your hijacking attempt to be
intermixed with the original thread.

Modern mailers have 'new' buttons and address books for a reason.

Eric,

To be honest, this is tiresome and unfriendly to users -- especially new users.

Modern mailers -- obviously not yours -- also don't just blindly use
the In-Reply-To or References field to determine threading. Indeed,
while a mailer should clear IRT if certain conditions are met, a
sensible mailer should also ignore IRT if it doesn't make sense. This
is usually the case when the subject of the message changes.

--
Eric Hodel - drbrain@segment7.net - http://segment7.net
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Austin Ziegler <halostatue@gmail.com> writes:

[some stuff]
Please don't hijack threads by using your reply button and replacing
the subject. Sensible mailers such as yours add In-Reply-To and
References headers that cause responses to your hijacking attempt to be
intermixed with the original thread.

Modern mailers have 'new' buttons and address books for a reason.

Eric,

To be honest, this is tiresome and unfriendly to users -- especially
new users.

And hijacking threads is tiresome to regulars here, which have to cope
with large volumes of mail in an effective way.

BTW, "Outlook" quoting (TOFU style) is even more annoying, use inline
quoting as every sane person does. And please don't fullquote a 512
line article just to respond with 8 lines.

···

On 4/16/05, Eric Hodel <drbrain@segment7.net> wrote:

On 15 Apr 2005, at 15:53, Dave Sims wrote:

-austin

--
Christian Neukirchen <chneukirchen@gmail.com> http://chneukirchen.org

Austin Ziegler wrote:

···

On 4/16/05, Eric Hodel <drbrain@segment7.net> wrote:

On 15 Apr 2005, at 15:53, Dave Sims wrote:
[some stuff]
Please don't hijack threads by using your reply button and replacing
the subject. Sensible mailers such as yours add In-Reply-To and
References headers that cause responses to your hijacking attempt to be
intermixed with the original thread.

Modern mailers have 'new' buttons and address books for a reason.

Eric,

To be honest, this is tiresome and unfriendly to users -- especially new users.

Modern mailers -- obviously not yours -- also don't just blindly use
the In-Reply-To or References field to determine threading. Indeed,
while a mailer should clear IRT if certain conditions are met, a
sensible mailer should also ignore IRT if it doesn't make sense. This
is usually the case when the subject of the message changes.

-austin

Thunderbird.app is not a modern mailer?
Give me a hint what to use on Mac os X then.

(I got Ruby good for web applications, Newbie Ruby and C question and newbie needs help Thead all in one thread??!)

Sure, they're being lazy. But your one man "crusade" isn't going to
help anything. MUAs should be more intelligent. Generally, if I
reply to something and change the subject more than a particular
percentage (maybe with Levenshtein distance), I'm *probably* not
going to want it to be in the same thread. On the other hand, an
receiving MUA could use the same sort of logic to determine whether
a message should be part of an existing thread, or whether IRT and
References should be honoured.

I know how old References and IRT are -- I've argued long and hard
with an MUA developer on the need to properly respect them, but also
on the need to be smarter than your MUA is apparently being.

I, for one, use Gmail. I don't notice these "bad" threads.

-austin

···

On 4/17/05, Eric Hodel <drbrain@segment7.net> wrote:

On 16 Apr 2005, at 17:14, Austin Ziegler wrote:

To be honest, this is tiresome and unfriendly to users --
especially new users.

Modern mailers -- obviously not yours -- also don't just blindly
use the In-Reply-To or References field to determine threading.
Indeed, while a mailer should clear IRT if certain conditions are
met, a sensible mailer should also ignore IRT if it doesn't make
sense. This is usually the case when the subject of the message
changes.

The only mailer I know of in common use that has this misfeature
is Outlook (whose threading support is so dismal that it is
unusable). I won't buy into the culture of Outlook, where we have
to drop to the lowest common denominator. I've more frequently
seen the subject change when branching off from an existing
thread's topic than to ask a new question.

In-Reply-To and References are not something new (RFC 822 as of
1982). People are just being lazy when they abuse their reply
buttons, and they need to stop that.

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Austin Ziegler <halostatue@gmail.com > writes:
And hijacking threads is tiresome to regulars here, which have to cope
with large volumes of mail in an effective way.

The effective way is to get a smarter MUA that deals with how people
use email. If the MUA isn't helping you manage your email, then
there's something wrong with it. MUAs that blindly use network
standards for presentation purposes are, quite simply, stupid.

BTW, "Outlook" quoting (TOFU style) is even more annoying, use inline
quoting as every sane person does. And please don't fullquote a 512
line article just to respond with 8 lines.

Whatever. Let me know when you've got a smarter MUA.

-austin

···

On 4/17/05, Christian Neukirchen <chneukirchen@gmail.com> wrote:
--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

In many ways, no, it isn't. (Don't get me started on how long it took
for them to implement a single tree view. Really don't get me started
on the BS reasons that they gave for not implementing it.) No,
Thunderbird isn't exactly a modern mailer. It still holds to solid
early to mid-90s UI design and (for the most part) features. It often
forces a particular user interface because that's the way the spec
reads -- even if the spec is there for the benefit of the network
computer and not the ultimate user.

As I said in a different post, what is shown and what is stored may be
different things entirely. The TB team has made a step in the right
direction with virtual folders (something that appeared much earlier
in Outlook), but just because References and In-Reply-To are set
doesn't mean that the intent of the sender is to keep the message in
the thread. There are relatively clear heuristics (that I've also
outlined) that would allow the MUA to display these items "smarter".

TB is a step ... sideways ... in UI design for mail clients, if not a
step backwards. I don't use TB because it's particularly good, but
because it's more usable than anything else on Windows. TB is the
worst email client out there ... except for all the others.

Most of my email these days, by the way, is done through GMail. It has
some other problems with threading/grouping, and neither GMail nor
Thunderbird allow for the one thing that would help fix the problem
easily: reparenting. But GMail gets the thread ("conversation") right
more often than not. Believe it or not.

-austin

···

On 4/19/05, Jonas Hartmann <Mail@jonas-hartmann.com> wrote:

Austin Ziegler wrote:
Thunderbird.app is not a modern mailer?
Give me a hint what to use on Mac os X then.

--
Austin Ziegler * halostatue@gmail.com
               * Alternate: austin@halostatue.ca

Eric and Christian...the thread subject was original to me, sui
generis. Apparently there is a nearly identically-named thread, but I
couldn't have known that since I posted before I recieved anything
from the list. Sorry for the inconveniance -- it was unintentional.

Dave

I usually avoid entanglement in these sorts of holy wars, but I have
one concern to bring up with respect to In-Reply-To / References and
hijacked threads. This mailing list, and many others of the sort, are
synced with a usenet newsgroup (in this case comp.lang.ruby) through a
Usenet <-> ML gateway. I don't care how sophisticated your mailing
agent is or isn't, posts threading needs to respect whatever the
gateway expects to:

A) Prevent threads from breaking (a post that should belong to a
thread doesn't), and

B) Prevent threads from being hijacked (a post that shouldn't belong
in a thread does)

A large portion, possible even a majority (though I don't know the
actual statistics), of the users of this list are using it through
usenet. Let's not break it for them.

Jacob Fugal