[lnkForumImage]
TotalShareware - Download Free Software

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


 

Forums >

comp.lang.ruby

Yet Another... wait. This is my first Wee Example. :-

Joao Pedrosa

2/19/2005 7:19:00 AM

Hi,

While studying Wee for the last 5 days, I was joined by a friend
(Caio) and we created an example of Wee that has a mini-blog, a table
editor for the blog, a country/state/city table editor and an about
that shows the code behind the scenes in my preferred syntax colors.
:-)

Besides an annoying bug which had an alternative approach, Wee and
WEBrick faired very well.

In case the example URL changes, I will update the URL in my blog:
http://sinsalabintrix.blogspot.com/2005/02/wee-web-framework-put-to...

The Wee example URL:
http://201.9.180...

I have thanked a lot of guys in the last few days, but I should have
mentioned the creator of WEBrick. Thank you, TAKAHASHI Masayoshi. You
know how important WEBrick has become to a lot of us. :-)

Cheers,
Joao


5 Answers

Michael Neumann

2/19/2005 10:59:00 AM

0

Joao Pedrosa wrote:
> Hi,
>
> While studying Wee for the last 5 days, I was joined by a friend
> (Caio) and we created an example of Wee that has a mini-blog, a table
> editor for the blog, a country/state/city table editor and an about
> that shows the code behind the scenes in my preferred syntax colors.
> :-)

Thanks for the nice examples! For some reason the DBButtons do not work
using Konqueror as browser. But in Firefox they work.

> Besides an annoying bug which had an alternative approach, Wee and
> WEBrick faired very well.

But no bug in Wee or WEBrick, right? What was it exactly? Maybe we can
put a FAQ together, so that other people can avoid those bugs too.

One source of error is:

for i in [...]
end

vs.

[...].each do |i|
end

You should use the second for (#each), if you use callbacks, as the
first one (for i in) does not create a new scope for variable "i".

Regards,

Michael


Joao Pedrosa

2/19/2005 1:54:00 PM

0

Hi,

On Sat, 19 Feb 2005 19:58:53 +0900, Michael Neumann <mneumann@ntecs.de> wrote:
> Joao Pedrosa wrote:
> > Hi,
> >
> > While studying Wee for the last 5 days, I was joined by a friend
> > (Caio) and we created an example of Wee that has a mini-blog, a table
> > editor for the blog, a country/state/city table editor and an about
> > that shows the code behind the scenes in my preferred syntax colors.
> > :-)
>
> Thanks for the nice examples! For some reason the DBButtons do not work
> using Konqueror as browser. But in Firefox they work.

Thanks for the info.

> > Besides an annoying bug which had an alternative approach, Wee and
> > WEBrick faired very well.
>
> But no bug in Wee or WEBrick, right? What was it exactly? Maybe we can
> put a FAQ together, so that other people can avoid those bugs too.
>
> One source of error is:
>
> for i in [...]
> end
>
> vs.
>
> [...].each do |i|
> end
>
> You should use the second for (#each), if you use callbacks, as the
> first one (for i in) does not create a new scope for variable "i".

Nice guess!

That is the "bug" that had bitten me. I used callback in a loop and
was wondering why it wouldn't work. Later I was reading the code of
Wee and I remembered of the other option which did work. :-)

BTW, it would be good to expose the head tag somewhere so we could add
tags to it, like the link_css. :-) And add the <DOCTYPE> to the
beginning of the HTML. Anyway of doing this?

Cheers,
Joao


Caio Tiago Oliveira

2/20/2005 1:46:00 AM

0

Joao Pedrosa, 19/2/2005 10:53:
> BTW, it would be good to expose the head tag somewhere so we could add
> tags to it, like the link_css. :-) And add the <DOCTYPE> to the
> beginning of the HTML. Anyway of doing this?

;)

BTW: is impossible to make valid code without it.
The link tag shouldn't be used in the body, its place is the head.
Doctype is also a lot important.



Michael Neumann

2/20/2005 3:47:00 PM

0

Caio Tiago Oliveira wrote:
> Joao Pedrosa, 19/2/2005 10:53:
> > BTW, it would be good to expose the head tag somewhere so we could add
>
>> tags to it, like the link_css. :-) And add the <DOCTYPE> to the
>> beginning of the HTML. Anyway of doing this?
>
>
> ;)
>
> BTW: is impossible to make valid code without it.
> The link tag shouldn't be used in the body, its place is the head.
> Doctype is also a lot important.

Could you send me a sample DOCTYPE?

Note that it's easy to do this yourself (nevertheless I'd like to add
this to Wee):

def render
r << "<!DOCTYPE...>"
r.html {
r.head {
...
}
r.body {
...
}
}
end

Regards,

Michael


Caio Tiago Oliveira

2/20/2005 4:59:00 PM

0

Michael Neumann, 20/2/2005 12:47:
> Caio Tiago Oliveira wrote:
>
>> Joao Pedrosa, 19/2/2005 10:53:
>> > BTW, it would be good to expose the head tag somewhere so we could add
>>
>>> tags to it, like the link_css. :-) And add the <DOCTYPE> to the
>>> beginning of the HTML. Anyway of doing this?
>>
>>
>>
>> ;)
>>
>> BTW: is impossible to make valid code without it.
>> The link tag shouldn't be used in the body, its place is the head.
>> Doctype is also a lot important.
>
>
> Could you send me a sample DOCTYPE?
>
> Note that it's easy to do this yourself (nevertheless I'd like to add
> this to Wee):
>
> def render
> r << "<!DOCTYPE...>"
> r.html {
> r.head {
> ...
> }
> r.body {
> ...
> }
> }
> end

There are some here:
http://www.w3.org/TR/html4/struct/global.html#ve...

and some I think more apropriateds here:
http://www.w3.org/TR/xhtml1/...

Thanks for the doctype help.