[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Sinatra : size of variable '@data' ? Bug ?

B. Randy

4/24/2009 1:51:00 PM

Hi,
I'm working under Windows XP and ruby 1.8.6 patch 227.

My application display a 'SELECT' HTML to let choose
a number. The list of number must be build : extracted
from a database. I've also other 'SELECT'

There is no problem in LOCAL (Ruby + Firefox in the
same PC) but the list of number can't be displayed
in REMOTE mode then other shorter lists are displayed
in the SELECT.

I've tried Webrick and Mongrel, there is no difference.

Three SELECT are build, only one can't be seen. There
are 234 line of option and 3120 bytes. The length of
two others are : 4539 and 450 bytes, there is no
problem with them.

The difference and the first and two other is the
number of lines.

Below my code.

Why I can't the data in REMOTE mode ?

Thanks.

Randy

########################################################
# HTML code used with 'erb'
<SELECT name="start" >
<OPTION > </OPTION>
<%= @start_choice =>
</SELECT>
########################################################

########################################################
# My 'helpers'
helpers do
# Build the HTML code from an array of option for
#'SELECT'.
def html_select(array)
option=String.new()
array.each {|opt| option << "<OPTION>#{opt}</OPTION>"}
option
end
end
########################################################
--
Posted via http://www.ruby-....

8 Answers

Brian Candler

4/24/2009 7:05:00 PM

0

B. Randy wrote:
> Why I can't the data in REMOTE mode ?

Firstly, look at the HTML in both cases. Use 'view source' or equivalent
in both browsers; and/or save the HTML from each browser to a file and
then compare the files.

If the files are different, then you need to work out why your
application is sending different data to different clients.

But if the files are identical, then my suspicion is that you are
generating invalid (X)HTML - and therefore one of the browsers is
processing it differently to the other.

For example, you might have mismatched start and end tags in your
template. Or it might be that one of your select options contains a HTML
special character, since you're not escaping them. That is,

<%= @start_choice =>

should really be

<%=h @start_choice %>

Similarly, your html_select helper should be escaping the options in the
array.

I'd use the tool xmllint under Linux to check for well-formedness. There
are probably other options for Windows. At worst you can upload the
content to an online checker service, or you can parse it in Ruby using
REXML::Document

From your posting subject line, I'm not sure what is the @data that
you're talking about, but as for "bug?" - yes, it probably is a bug in
your code.

Good luck,

Brian.
--
Posted via http://www.ruby-....

B. Randy

4/27/2009 10:29:00 AM

0

Brian,

Thanks for the ideas. I'll use It.

When I've checked my HTML code like you wrote it, I found
MY error. It's not Sinatra the problem.

I use a helper but in this helper I use a session variable
like 'session[:my_data]'. The helper's method is called in my
HTML code and the session variable is not evaluated.

So, be careful when using var. in helper's method.
--
Posted via http://www.ruby-....

Dave Kelly

11/15/2011 4:38:00 PM

0


"Schizo_BoY" <invaild12345@aol.com> wrote in message

>> Uh...Scooter....that "Building" was actually a Porta-Potty from the
>> road construction they did on Route 29 back in the summer of 1973.
>>
> According to whom? You?

You didn't find it odd that Pops Weirdo kept insisting
those urinal cakes were really complimentary breath mints?
How you and your 2 utterely dysfunctional parents slept in that
tiny porta potty for the weekend continues to amaze us.


wereo_boy

11/16/2011 8:54:00 AM

0

"sweetbac" <sweetbac@sbcglobal.net> wrote in message
news:j9u4hl$jnu$1@dont-email.me...
>
> "Schizo_BoY" <invaild12345@aol.com> wrote in message
>
>>> Uh...Scooter....that "Building" was actually a Porta-Potty from the
>>> road construction they did on Route 29 back in the summer of 1973.
>>>
>> According to whom? You?
>
> You didn't find it odd that Pops Weirdo kept insisting
> those urinal cakes were really complimentary breath mints?
> How you and your 2 utterely dysfunctional parents slept in that
> tiny porta potty for the weekend continues to amaze us.
>
>

At least I had parents. Unlike you-handmade by gorillas in Scotch Plains,
New Jersey.


Dave Kelly

11/16/2011 4:27:00 PM

0


"Schizo_BoY" <invaild12345@aol.com> medicated in message

> At least I had parents. Unlike you-handmade by gorillas in Scotch Plains,
> New Jersey.

I hold your parents somewhat culpable...ya gotta remember,
in the 60's and 70's, schizophrenia still had a stigma about it
( I guess it still does) and most families wouldn't get it diagnosed.
< I'm positive Ma n' Pa Weirdo had they own mental issues>
So Scott never got the help he needed...and descended into the
fantasy world he still inhabits...spending his days at the Bronx
library posting to all 362 newsgroups he spams daily with the
delusional ramblings of his unhinged mind....I find it amusing.
But Scott has to remember....everytime he spams this chatgroup,
his cancer gets a LITTLE more inoperable.
Your future is in your hands, Ree-Tod.


wereo_boy

11/16/2011 4:32:00 PM

0

"sweetbac" <sweetbac@sbcglobal.net> wrote in message
news:ja0o8b$vtm$1@dont-email.me...
>
> "Schizo_BoY" <invaild12345@aol.com> medicated in message
>
>> At least I had parents. Unlike you-handmade by gorillas in Scotch Plains,
>> New Jersey.
>
> I hold your parents somewhat culpable...ya gotta remember,
> in the 60's and 70's, schizophrenia still had a stigma about it
> ( I guess it still does) and most families wouldn't get it diagnosed.
> < I'm positive Ma n' Pa Weirdo had they own mental issues>
> So Scott never got the help he needed...and descended into the
> fantasy world he still inhabits...spending his days at the Bronx
> library posting to all 362 newsgroups he spams daily with the
> delusional ramblings of his unhinged mind....I find it amusing.
> But Scott has to remember....everytime he spams this chatgroup,
> his cancer gets a LITTLE more inoperable.
> Your future is in your hands, Ree-Tod.
>

You were handmade by gorillas in Scotch Plains, New Jersey.



Dave Kelly

11/16/2011 4:40:00 PM

0


"Schizo_BoY" <invaild12345@aol.com> hallucinated in message

> You were handmade by gorillas in Scotch Plains, New Jersey.

Ya see....your cancer has just gotten a teensy bit worse.
I warned ya, Scott.
<shakes head>


avebury1

11/16/2011 8:21:00 PM

0

On Nov 16, 11:26 am, "sweetbac" <sweet...@sbcglobal.net> wrote:
> "Schizo_BoY" <invaild12...@aol.com> medicated in message
>
> > At least I had parents. Unlike you-handmade by gorillas in Scotch Plains,
> > New Jersey.
>
> > But Scott has to remember....everytime he spams this chatgroup,
> his cancer gets a LITTLE more inoperable.
> Your future is in your hands, Ree-Tod.

Ouch.