[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Is Ruby good for web applications?

Tony Targonski

4/15/2005 10:06:00 PM

-----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!

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.
----------------------------

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

--Tony



13 Answers

Dave Sims

4/15/2005 10:54:00 PM

0

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





Eric Hodel

4/16/2005 7:46:00 PM

0

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 Hodel - drbrain@segment7.net - http://se...
FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04

Austin Ziegler

4/17/2005 12:15:00 AM

0

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
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca



Eric Hodel

4/17/2005 7:43:00 AM

0

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.

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...

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

George Ogata

4/17/2005 7:59:00 AM

0

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.



Christian Neukirchen

4/17/2005 10:12:00 AM

0

Austin Ziegler <halostatue@gmail.com> writes:

> 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.

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.

http://www.golyr.de/Dan-Bern/songtext/283104_Fascist...

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


Austin Ziegler

4/17/2005 3:54:00 PM

0

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.

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
--
Austin Ziegler * halostatue@gmail.com
* Alternate: austin@halostatue.ca



Austin Ziegler

4/17/2005 4:03:00 PM

0

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



Dave Sims

4/18/2005 2:41:00 PM

0

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



Dave Sims

4/18/2005 3:22:00 PM

0

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