How to start an image with PORT parameter

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
43 messages Options
123
Reply | Threaded
Open this post in threaded view
|

jQuery html replace

Robert Sirois
I wish there was an easy way to show this, but I'll try to describe it well...

I'm using this statement...

(html jQuery: '#display') html: [:r | r render: (self renderResultsOn: html)].

... in order to render the results of a survey. On the page I have a simple select menu and a button that let's you pick between the available surveys. What is happening is the page is being loaded fine, I can select the survey fine, hit the button, the results display fine, but then the original div with the dropdown and button is also added to the bottom of the #display div (see above). The display div is simply:

html div
    id: 'display'.

I've tried taking the div out of the #with: statement where the select box and button are also in, but that does not seem to help. There are a couple other places I have been using the jQuery replace code, and it appears to be working correctly in those instances.

Thanks,
RS


Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery html replace

Lukas Renggli
> I've tried taking the div out of the #with: statement where the select box
> and button are also in, but that does not seem to help. There are a couple
> other places I have been using the jQuery replace code, and it appears to be
> working correctly in those instances.

Are you sure the DIV is still there when you perform the action?
jQuery simply ignores actions on queries that do not match anything,
that's sometimes quite confusing.

If that's not the problem, then FireBug should tell you more in form
of an error message.

Lukas

--
Lukas Renggli
http://www.lukas-renggli.ch
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery html replace

Robert Sirois
<div id="surveySelect" class="questionDisplay">
<select>
Selects the survey
</select>
<br/>
<button>
View this survey.
</button>
<div id="display">

<div>
a result
</div>
<div>
a result
</div>

...

<div id="surveySelect" class="questionDisplay">
also contains select and button
</div>
</div>
</div>

I don't think I'm getting any errors from FireBug (I'm not sure what they look like either). The div is there, though, or the results wouldn't been rendered at all. Nothing would happen when you click the button. Somehow, it's getting a copy of the containing div in there with it as well.

RS

> Date: Mon, 20 Jul 2009 10:19:35 +0200
> Subject: Re: [Seaside] jQuery html replace
> From: [hidden email]
> To: [hidden email]
>
> > I've tried taking the div out of the #with: statement where the select box
> > and button are also in, but that does not seem to help. There are a couple
> > other places I have been using the jQuery replace code, and it appears to be
> > working correctly in those instances.
>
> Are you sure the DIV is still there when you perform the action?
> jQuery simply ignores actions on queries that do not match anything,
> that's sometimes quite confusing.
>
> If that's not the problem, then FireBug should tell you more in form
> of an error message.
>
> Lukas
>
> --
> Lukas Renggli
> http://www.lukas-renggli.ch
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery html replace

Paul DeBruicker
While I'm no expert, I found this Firebug tutorial helpful:

http://code.google.com/apis/ajaxsearch/articles/firebug.html





On Mon, Jul 20, 2009 at 10:29 AM, Robert Sirois<[hidden email]> wrote:

> <div id="surveySelect" class="questionDisplay">
> <select>
> Selects the survey
> </select>
> <br/>
> <button>
> View this survey.
> </button>
> <div id="display">
>
> <div>
> a result
> </div>
> <div>
> a result
> </div>
> ...
>
> <div id="surveySelect" class="questionDisplay">
> also contains select and button
> </div>
> </div>
> </div>
> I don't think I'm getting any errors from FireBug (I'm not sure what they
> look like either). The div is there, though, or the results wouldn't been
> rendered at all. Nothing would happen when you click the button. Somehow,
> it's getting a copy of the containing div in there with it as well.
>
> RS
>
>> Date: Mon, 20 Jul 2009 10:19:35 +0200
>> Subject: Re: [Seaside] jQuery html replace
>> From: [hidden email]
>> To: [hidden email]
>>
>> > I've tried taking the div out of the #with: statement where the select
>> > box
>> > and button are also in, but that does not seem to help. There are a
>> > couple
>> > other places I have been using the jQuery replace code, and it appears
>> > to be
>> > working correctly in those instances.
>>
>> Are you sure the DIV is still there when you perform the action?
>> jQuery simply ignores actions on queries that do not match anything,
>> that's sometimes quite confusing.
>>
>> If that's not the problem, then FireBug should tell you more in form
>> of an error message.
>>
>> Lukas
>>
>> --
>> Lukas Renggli
>> http://www.lukas-renggli.ch
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> ________________________________
> Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery html replace

Robert Sirois
That is a nice little concise tutorial. I guess I didn't have the console enabled :p

I do get this error:

parent.dap_Resize is not a function
<img src="chrome://firebug/content/blank.gif" title="Break on this error" class="errorBreak">    if(typeof(inDapIF) != "undefined"){paren...ap_Resize(document.body.id, 120, 60);}

That seems to be unrelated, though.

RS


> Date: Mon, 20 Jul 2009 10:40:06 -0400
> Subject: Re: [Seaside] jQuery html replace
> From: [hidden email]
> To: [hidden email]
>
> While I'm no expert, I found this Firebug tutorial helpful:
>
> http://code.google.com/apis/ajaxsearch/articles/firebug.html
>
>
>
>
>
> On Mon, Jul 20, 2009 at 10:29 AM, Robert Sirois<[hidden email]> wrote:
> > <div id="surveySelect" class="questionDisplay">
> > <select>
> > Selects the survey
> > </select>
> > <br/>
> > <button>
> > View this survey.
> > </button>
> > <div id="display">
> >
> > <div>
> > a result
> > </div>
> > <div>
> > a result
> > </div>
> > ...
> >
> > <div id="surveySelect" class="questionDisplay">
> > also contains select and button
> > </div>
> > </div>
> > </div>
> > I don't think I'm getting any errors from FireBug (I'm not sure what they
> > look like either). The div is there, though, or the results wouldn't been
> > rendered at all. Nothing would happen when you click the button. Somehow,
> > it's getting a copy of the containing div in there with it as well.
> >
> > RS
> >
> >> Date: Mon, 20 Jul 2009 10:19:35 +0200
> >> Subject: Re: [Seaside] jQuery html replace
> >> From: [hidden email]
> >> To: [hidden email]
> >>
> >> > I've tried taking the div out of the #with: statement where the select
> >> > box
> >> > and button are also in, but that does not seem to help. There are a
> >> > couple
> >> > other places I have been using the jQuery replace code, and it appears
> >> > to be
> >> > working correctly in those instances.
> >>
> >> Are you sure the DIV is still there when you perform the action?
> >> jQuery simply ignores actions on queries that do not match anything,
> >> that's sometimes quite confusing.
> >>
> >> If that's not the problem, then FireBug should tell you more in form
> >> of an error message.
> >>
> >> Lukas
> >>
> >> --
> >> Lukas Renggli
> >> http://www.lukas-renggli.ch
> >> _______________________________________________
> >> seaside mailing list
> >> [hidden email]
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> > ________________________________
> > Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Bing™ brings you maps, menus, and reviews organized in one place. Try it now.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery html replace

Julian Fitzell-2
In reply to this post by Robert Sirois
I may be misunderstanding your problem but shouldn't that be:

(html jQuery: '#display') html: [:r | self renderResultsOn: r]

?

It looks pretty weird to me that you are trying to render the return
value of a rendering method...

Julian

On Sun, Jul 19, 2009 at 7:57 PM, Robert Sirois<[hidden email]> wrote:

> I wish there was an easy way to show this, but I'll try to describe it
> well...
>
> I'm using this statement...
>
> (html jQuery: '#display') html: [:r | r render: (self renderResultsOn:
> html)].
>
> ... in order to render the results of a survey. On the page I have a simple
> select menu and a button that let's you pick between the available surveys.
> What is happening is the page is being loaded fine, I can select the survey
> fine, hit the button, the results display fine, but then the original div
> with the dropdown and button is also added to the bottom of the #display div
> (see above). The display div is simply:
>
> html div
>     id: 'display'.
>
> I've tried taking the div out of the #with: statement where the select box
> and button are also in, but that does not seem to help. There are a couple
> other places I have been using the jQuery replace code, and it appears to be
> working correctly in those instances.
>
> Thanks,
> RS
>
> ________________________________
> Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery html replace

Robert Sirois
Heh that worked perfectly :p So, 'html' is what is bein passed into that block?

RS

> Date: Mon, 20 Jul 2009 08:12:05 -0700
> Subject: Re: [Seaside] jQuery html replace
> From: [hidden email]
> To: [hidden email]
>
> I may be misunderstanding your problem but shouldn't that be:
>
> (html jQuery: '#display') html: [:r | self renderResultsOn: r]
>
> ?
>
> It looks pretty weird to me that you are trying to render the return
> value of a rendering method...
>
> Julian
>
> On Sun, Jul 19, 2009 at 7:57 PM, Robert Sirois<[hidden email]> wrote:
> > I wish there was an easy way to show this, but I'll try to describe it
> > well...
> >
> > I'm using this statement...
> >
> > (html jQuery: '#display') html: [:r | r render: (self renderResultsOn:
> > html)].
> >
> > ... in order to render the results of a survey. On the page I have a simple
> > select menu and a button that let's you pick between the available surveys.
> > What is happening is the page is being loaded fine, I can select the survey
> > fine, hit the button, the results display fine, but then the original div
> > with the dropdown and button is also added to the bottom of the #display div
> > (see above). The display div is simply:
> >
> > html div
> >     id: 'display'.
> >
> > I've tried taking the div out of the #with: statement where the select box
> > and button are also in, but that does not seem to help. There are a couple
> > other places I have been using the jQuery replace code, and it appears to be
> > working correctly in those instances.
> >
> > Thanks,
> > RS
> >
> > ________________________________
> > Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Windows Live™ Hotmail®: Search, add, and share the web’s latest sports videos. Check it out.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery html replace

Julian Fitzell-2
Erm... not sure what you mean.

The rendering block needs to be invokable later, long after the page
has been rendered and the original canvas (in the method parameter
'html') has been cleaned up. In order to make this work, the rendering
block gets passed a new canvas each time it is invoked (via the block
parameter 'r'). So you need to make sure that you only use the new
renderer and not the old renderer from within that block (not that the
Slime package provides Lint tests that will catch this for you).

Also, remember that the #render: method expects a "renderable" object.
This could be a Component, a Block, or any number of other things. I
assume your #renderResultsOn: method was returning self and that was
causing the whole Component to be rendered again each time the block
was called.

Julian

On Mon, Jul 20, 2009 at 9:01 AM, Robert Sirois<[hidden email]> wrote:

> Heh that worked perfectly :p So, 'html' is what is bein passed into that
> block?
>
> RS
>
>> Date: Mon, 20 Jul 2009 08:12:05 -0700
>> Subject: Re: [Seaside] jQuery html replace
>> From: [hidden email]
>> To: [hidden email]
>>
>> I may be misunderstanding your problem but shouldn't that be:
>>
>> (html jQuery: '#display') html: [:r | self renderResultsOn: r]
>>
>> ?
>>
>> It looks pretty weird to me that you are trying to render the return
>> value of a rendering method...
>>
>> Julian
>>
>> On Sun, Jul 19, 2009 at 7:57 PM, Robert Sirois<[hidden email]>
>> wrote:
>> > I wish there was an easy way to show this, but I'll try to describe it
>> > well...
>> >
>> > I'm using this statement...
>> >
>> > (html jQuery: '#display') html: [:r | r render: (self renderResultsOn:
>> > html)].
>> >
>> > ... in order to render the results of a survey. On the page I have a
>> > simple
>> > select menu and a button that let's you pick between the available
>> > surveys.
>> > What is happening is the page is being loaded fine, I can select the
>> > survey
>> > fine, hit the button, the results display fine, but then the original
>> > div
>> > with the dropdown and button is also added to the bottom of the #display
>> > div
>> > (see above). The display div is simply:
>> >
>> > html div
>> >     id: 'display'.
>> >
>> > I've tried taking the div out of the #with: statement where the select
>> > box
>> > and button are also in, but that does not seem to help. There are a
>> > couple
>> > other places I have been using the jQuery replace code, and it appears
>> > to be
>> > working correctly in those instances.
>> >
>> > Thanks,
>> > RS
>> >
>> > ________________________________
>> > Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
>> > _______________________________________________
>> > seaside mailing list
>> > [hidden email]
>> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> >
>> >
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> ________________________________
> Windows Live™ Hotmail®: Search, add, and share the web’s latest sports
> videos. Check it out.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

RE: jQuery html replace

Robert Sirois
Hmm... I'll have to think about that when I get back to this after work. I'm pretty much throwing myself into this and going with what works. I really need to sit down and read and understand what it is that's going on behind all these different methods and whatnot, but I am finding it hard to read through some of this code for some reason. The comments and stuff help sometimes... I guess I am just more of a hands-on learner :)

Thanks for the help!
RS

> Date: Mon, 20 Jul 2009 09:14:20 -0700
> Subject: Re: [Seaside] jQuery html replace
> From: [hidden email]
> To: [hidden email]
>
> Erm... not sure what you mean.
>
> The rendering block needs to be invokable later, long after the page
> has been rendered and the original canvas (in the method parameter
> 'html') has been cleaned up. In order to make this work, the rendering
> block gets passed a new canvas each time it is invoked (via the block
> parameter 'r'). So you need to make sure that you only use the new
> renderer and not the old renderer from within that block (not that the
> Slime package provides Lint tests that will catch this for you).
>
> Also, remember that the #render: method expects a "renderable" object.
> This could be a Component, a Block, or any number of other things. I
> assume your #renderResultsOn: method was returning self and that was
> causing the whole Component to be rendered again each time the block
> was called.
>
> Julian
>
> On Mon, Jul 20, 2009 at 9:01 AM, Robert Sirois<[hidden email]> wrote:
> > Heh that worked perfectly :p So, 'html' is what is bein passed into that
> > block?
> >
> > RS
> >
> >> Date: Mon, 20 Jul 2009 08:12:05 -0700
> >> Subject: Re: [Seaside] jQuery html replace
> >> From: [hidden email]
> >> To: [hidden email]
> >>
> >> I may be misunderstanding your problem but shouldn't that be:
> >>
> >> (html jQuery: '#display') html: [:r | self renderResultsOn: r]
> >>
> >> ?
> >>
> >> It looks pretty weird to me that you are trying to render the return
> >> value of a rendering method...
> >>
> >> Julian
> >>
> >> On Sun, Jul 19, 2009 at 7:57 PM, Robert Sirois<[hidden email]>
> >> wrote:
> >> > I wish there was an easy way to show this, but I'll try to describe it
> >> > well...
> >> >
> >> > I'm using this statement...
> >> >
> >> > (html jQuery: '#display') html: [:r | r render: (self renderResultsOn:
> >> > html)].
> >> >
> >> > ... in order to render the results of a survey. On the page I have a
> >> > simple
> >> > select menu and a button that let's you pick between the available
> >> > surveys.
> >> > What is happening is the page is being loaded fine, I can select the
> >> > survey
> >> > fine, hit the button, the results display fine, but then the original
> >> > div
> >> > with the dropdown and button is also added to the bottom of the #display
> >> > div
> >> > (see above). The display div is simply:
> >> >
> >> > html div
> >> >     id: 'display'.
> >> >
> >> > I've tried taking the div out of the #with: statement where the select
> >> > box
> >> > and button are also in, but that does not seem to help. There are a
> >> > couple
> >> > other places I have been using the jQuery replace code, and it appears
> >> > to be
> >> > working correctly in those instances.
> >> >
> >> > Thanks,
> >> > RS
> >> >
> >> > ________________________________
> >> > Windows Live™ SkyDrive™: Store, access, and share your photos. See how.
> >> > _______________________________________________
> >> > seaside mailing list
> >> > [hidden email]
> >> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >> >
> >> >
> >> _______________________________________________
> >> seaside mailing list
> >> [hidden email]
> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> > ________________________________
> > Windows Live™ Hotmail®: Search, add, and share the web’s latest sports
> > videos. Check it out.
> > _______________________________________________
> > seaside mailing list
> > [hidden email]
> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> >
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


Bing™ brings you maps, menus, and reviews organized in one place. Try it now.
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: jQuery html replace

Julian Fitzell-2
It's not your fault at all. This stuff can get confusing (and if
nothing else it's different). The comments don't always do a good job
of making it clearer. I wonder if I could do a blog post on the scope
of renderers... I'll think about it.

Asking here is exactly the right thing to do and it helps us see where
the confusion is so we can prioritize our efforts to make things
better. If you see specific places methods or classes where better
comments would have helped you, please let us know.

Julian

On Mon, Jul 20, 2009 at 9:24 AM, Robert Sirois<[hidden email]> wrote:

> Hmm... I'll have to think about that when I get back to this after work. I'm
> pretty much throwing myself into this and going with what works. I really
> need to sit down and read and understand what it is that's going on behind
> all these different methods and whatnot, but I am finding it hard to read
> through some of this code for some reason. The comments and stuff help
> sometimes... I guess I am just more of a hands-on learner :)
>
> Thanks for the help!
> RS
>
>> Date: Mon, 20 Jul 2009 09:14:20 -0700
>> Subject: Re: [Seaside] jQuery html replace
>> From: [hidden email]
>> To: [hidden email]
>>
>> Erm... not sure what you mean.
>>
>> The rendering block needs to be invokable later, long after the page
>> has been rendered and the original canvas (in the method parameter
>> 'html') has been cleaned up. In order to make this work, the rendering
>> block gets passed a new canvas each time it is invoked (via the block
>> parameter 'r'). So you need to make sure that you only use the new
>> renderer and not the old renderer from within that block (not that the
>> Slime package provides Lint tests that will catch this for you).
>>
>> Also, remember that the #render: method expects a "renderable" object.
>> This could be a Component, a Block, or any number of other things. I
>> assume your #renderResultsOn: method was returning self and that was
>> causing the whole Component to be rendered again each time the block
>> was called.
>>
>> Julian
>>
>> On Mon, Jul 20, 2009 at 9:01 AM, Robert Sirois<[hidden email]>
>> wrote:
>> > Heh that worked perfectly :p So, 'html' is what is bein passed into that
>> > block?
>> >
>> > RS
>> >
>> >> Date: Mon, 20 Jul 2009 08:12:05 -0700
>> >> Subject: Re: [Seaside] jQuery html replace
>> >> From: [hidden email]
>> >> To: [hidden email]
>> >>
>> >> I may be misunderstanding your problem but shouldn't that be:
>> >>
>> >> (html jQuery: '#display') html: [:r | self renderResultsOn: r]
>> >>
>> >> ?
>> >>
>> >> It looks pretty weird to me that you are trying to render the return
>> >> value of a rendering method...
>> >>
>> >> Julian
>> >>
>> >> On Sun, Jul 19, 2009 at 7:57 PM, Robert Sirois<[hidden email]>
>> >> wrote:
>> >> > I wish there was an easy way to show this, but I'll try to describe
>> >> > it
>> >> > well...
>> >> >
>> >> > I'm using this statement...
>> >> >
>> >> > (html jQuery: '#display') html: [:r | r render: (self
>> >> > renderResultsOn:
>> >> > html)].
>> >> >
>> >> > ... in order to render the results of a survey. On the page I have a
>> >> > simple
>> >> > select menu and a button that let's you pick between the available
>> >> > surveys.
>> >> > What is happening is the page is being loaded fine, I can select the
>> >> > survey
>> >> > fine, hit the button, the results display fine, but then the original
>> >> > div
>> >> > with the dropdown and button is also added to the bottom of the
>> >> > #display
>> >> > div
>> >> > (see above). The display div is simply:
>> >> >
>> >> > html div
>> >> >     id: 'display'.
>> >> >
>> >> > I've tried taking the div out of the #with: statement where the
>> >> > select
>> >> > box
>> >> > and button are also in, but that does not seem to help. There are a
>> >> > couple
>> >> > other places I have been using the jQuery replace code, and it
>> >> > appears
>> >> > to be
>> >> > working correctly in those instances.
>> >> >
>> >> > Thanks,
>> >> > RS
>> >> >
>> >> > ________________________________
>> >> > Windows Live™ SkyDrive™: Store, access, and share your photos. See
>> >> > how.
>> >> > _______________________________________________
>> >> > seaside mailing list
>> >> > [hidden email]
>> >> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> >> >
>> >> >
>> >> _______________________________________________
>> >> seaside mailing list
>> >> [hidden email]
>> >> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> >
>> > ________________________________
>> > Windows Live™ Hotmail®: Search, add, and share the web’s latest sports
>> > videos. Check it out.
>> > _______________________________________________
>> > seaside mailing list
>> > [hidden email]
>> > http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>> >
>> >
>> _______________________________________________
>> seaside mailing list
>> [hidden email]
>> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
> ________________________________
> Bing™ brings you maps, menus, and reviews organized in one place. Try it
> now.
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>
>
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Mariano Martinez Peck
In reply to this post by Miguel Cobá


2009/7/15 Miguel Enrique Cobá Martinez <[hidden email]>
El mié, 15-07-2009 a las 17:57 -0300, Germán Arduino escribió:
> Tried, but don't works.
>
> I got the same error.
>

I use this script to start a magma image an serveral seaside images:

#!/bin/sh

NOHUP="/usr/bin/nohup"
SQUEAK_VM="/usr/bin/squeakvm"
SQUEAK_OPTS="-mmap 100m -vm-sound-null -vm-display-X11 -headless"
SQUEAK="$SQUEAK_VM $SQUEAK_OPTS"
IMAGES_HOME="/home/miguel/squeak/images/azteca"
SCRIPTS_HOME="/home/miguel/squeak/scripts/azteca"
LOGS_HOME="/home/miguel/squeak/logs/azteca"
START_PORT=8080
END_PORT=8093


# Start the Magma image
echo "Starting Magma image"
$NOHUP $SQUEAK $IMAGES_HOME/magma.image $SCRIPTS_HOME/magma.st >>
$LOGS_HOME/magma.nohup &

# Start the Seaside images
for PORT in `seq $START_PORT $END_PORT`; do
 echo "Starting Seaside image on port: $port"
 $NOHUP $SQUEAK $IMAGES_HOME/seaside.image $SCRIPTS_HOME/seaside.st


Sorry for the offtopic, what I have a question: is there a simple way to kill what you started with nohup?
I mean, I have a similar script to yours called "startApp.sh" but I want to do another called "stopApp.sh".
The only way I saw to do this is to do a killall squeak but I don't know...what happens if I have more than one vm/image ?

Thanks,

Mariano


 
port $PORT >> $LOGS_HOME/seaside.nohup &
done


check the order of the parameters that stablish the port for the seaside
image.

> Cheers.
> Germán.
>
> 2009/7/15, Philippe Marschall <[hidden email]>:
> > 2009/7/14, Germán Arduino <[hidden email]>:
> >
> > > Hi:
> >  >
> >  > As far as I saw on some doc it's possible to start a seaside image in
> >  > the way: "squeakvm seaside.image PORT nnnn". Then, as WAKom check this
> >  > parameter on its #startUp method, is posible to have it running on the
> >  > passed port.
> >
> >
> > Try:
> >
> >
> >  squeakvm seaside.image -- PORT nnnn
> >
> >
> > Squeak is a bit peculiar when it comes to command line arguments.
> >
> >  Cheers
> >  Philippe
> >  _______________________________________________
> >  seaside mailing list
> >  [hidden email]
> >  http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
> >
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Philippe Marschall
2009/7/26 Mariano Martinez Peck <[hidden email]>:

>
>
> 2009/7/15 Miguel Enrique Cobá Martinez <[hidden email]>
>>
>> El mié, 15-07-2009 a las 17:57 -0300, Germán Arduino escribió:
>> > Tried, but don't works.
>> >
>> > I got the same error.
>> >
>>
>> I use this script to start a magma image an serveral seaside images:
>>
>> #!/bin/sh
>>
>> NOHUP="/usr/bin/nohup"
>> SQUEAK_VM="/usr/bin/squeakvm"
>> SQUEAK_OPTS="-mmap 100m -vm-sound-null -vm-display-X11 -headless"
>> SQUEAK="$SQUEAK_VM $SQUEAK_OPTS"
>> IMAGES_HOME="/home/miguel/squeak/images/azteca"
>> SCRIPTS_HOME="/home/miguel/squeak/scripts/azteca"
>> LOGS_HOME="/home/miguel/squeak/logs/azteca"
>> START_PORT=8080
>> END_PORT=8093
>>
>>
>> # Start the Magma image
>> echo "Starting Magma image"
>> $NOHUP $SQUEAK $IMAGES_HOME/magma.image $SCRIPTS_HOME/magma.st >>
>> $LOGS_HOME/magma.nohup &
>>
>> # Start the Seaside images
>> for PORT in `seq $START_PORT $END_PORT`; do
>>  echo "Starting Seaside image on port: $port"
>>  $NOHUP $SQUEAK $IMAGES_HOME/seaside.image $SCRIPTS_HOME/seaside.st
>
>
> Sorry for the offtopic, what I have a question: is there a simple way to
> kill what you started with nohup?

Write the pid into a file?

Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Miguel Cobá
In reply to this post by Mariano Martinez Peck
El dom, 26-07-2009 a las 17:03 -0300, Mariano Martinez Peck escribió:

>
>
> 2009/7/15 Miguel Enrique Cobá Martinez <[hidden email]>
>         El mié, 15-07-2009 a las 17:57 -0300, Germán Arduino escribió:
>         > Tried, but don't works.
>         >
>         > I got the same error.
>         >
>        
>        
>         I use this script to start a magma image an serveral seaside
>         images:
>        
>         #!/bin/sh
>        
>         NOHUP="/usr/bin/nohup"
>         SQUEAK_VM="/usr/bin/squeakvm"
>         SQUEAK_OPTS="-mmap 100m -vm-sound-null -vm-display-X11
>         -headless"
>         SQUEAK="$SQUEAK_VM $SQUEAK_OPTS"
>         IMAGES_HOME="/home/miguel/squeak/images/azteca"
>         SCRIPTS_HOME="/home/miguel/squeak/scripts/azteca"
>         LOGS_HOME="/home/miguel/squeak/logs/azteca"
>         START_PORT=8080
>         END_PORT=8093
>        
>        
>         # Start the Magma image
>         echo "Starting Magma image"
>         $NOHUP $SQUEAK $IMAGES_HOME/magma.image $SCRIPTS_HOME/magma.st
>         >>
>         $LOGS_HOME/magma.nohup &
>        
>         # Start the Seaside images
>         for PORT in `seq $START_PORT $END_PORT`; do
>          echo "Starting Seaside image on port: $port"
>          $NOHUP $SQUEAK $IMAGES_HOME/seaside.image
>         $SCRIPTS_HOME/seaside.st
>
>
> Sorry for the offtopic, what I have a question: is there a simple way
> to kill what you started with nohup?

Are you meaning to kill a given process started with nohup in
unix/linux? You must search its PID and kill that pid with kill PID or,
as Philippe said.

> I mean, I have a similar script to yours called "startApp.sh" but I
> want to do another called "stopApp.sh".
If you are using the script passed to the image on start up that I
posted the other time, you can, in a forked process inside the image to
constantly search for a file in a given path. When found, you call
snapshot on the image and quit. This way, you start the image without
the file on the path and when you need to shut them down, you create an
empty file on the path, the images notice it and shuts down. You can
even give each image a different file name to search for and stop the
images independently.

> The only way I saw to do this is to do a killall squeak but I don't
> know...what happens if I have more than one vm/image ?
>

killall kills all the process named some form. If you have several
processes for example of firefox, a killall firefox will kill all of
them.

Cheers,
Miguel Cobá

> Thanks,
>
> Mariano
>
>
>  
>         port $PORT >> $LOGS_HOME/seaside.nohup &
>         done
>        
>        
>         check the order of the parameters that stablish the port for
>         the seaside
>         image.
>        
>        
>         > Cheers.
>         > Germán.
>         >
>         > 2009/7/15, Philippe Marschall
>         <[hidden email]>:
>         > > 2009/7/14, Germán Arduino <[hidden email]>:
>         > >
>         > > > Hi:
>         > >  >
>         > >  > As far as I saw on some doc it's possible to start a
>         seaside image in
>         > >  > the way: "squeakvm seaside.image PORT nnnn". Then, as
>         WAKom check this
>         > >  > parameter on its #startUp method, is posible to have it
>         running on the
>         > >  > passed port.
>         > >
>         > >
>         > > Try:
>         > >
>         > >
>         > >  squeakvm seaside.image -- PORT nnnn
>         > >
>         > >
>         > > Squeak is a bit peculiar when it comes to command line
>         arguments.
>         > >
>         > >  Cheers
>         > >  Philippe
>         > >  _______________________________________________
>         > >  seaside mailing list
>         > >  [hidden email]
>         > >
>          http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>         > >
>         > _______________________________________________
>         > seaside mailing list
>         > [hidden email]
>         >
>         http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>        
>         _______________________________________________
>         seaside mailing list
>         [hidden email]
>         http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>        
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Mariano Martinez Peck
In reply to this post by Philippe Marschall


On Sun, Jul 26, 2009 at 5:25 PM, Philippe Marschall <[hidden email]> wrote:
2009/7/26 Mariano Martinez Peck <[hidden email]>:
>
>
> 2009/7/15 Miguel Enrique Cobá Martinez <[hidden email]>
>>
>> El mié, 15-07-2009 a las 17:57 -0300, Germán Arduino escribió:
>> > Tried, but don't works.
>> >
>> > I got the same error.
>> >
>>
>> I use this script to start a magma image an serveral seaside images:
>>
>> #!/bin/sh
>>
>> NOHUP="/usr/bin/nohup"
>> SQUEAK_VM="/usr/bin/squeakvm"
>> SQUEAK_OPTS="-mmap 100m -vm-sound-null -vm-display-X11 -headless"
>> SQUEAK="$SQUEAK_VM $SQUEAK_OPTS"
>> IMAGES_HOME="/home/miguel/squeak/images/azteca"
>> SCRIPTS_HOME="/home/miguel/squeak/scripts/azteca"
>> LOGS_HOME="/home/miguel/squeak/logs/azteca"
>> START_PORT=8080
>> END_PORT=8093
>>
>>
>> # Start the Magma image
>> echo "Starting Magma image"
>> $NOHUP $SQUEAK $IMAGES_HOME/magma.image $SCRIPTS_HOME/magma.st >>
>> $LOGS_HOME/magma.nohup &
>>
>> # Start the Seaside images
>> for PORT in `seq $START_PORT $END_PORT`; do
>>  echo "Starting Seaside image on port: $port"
>>  $NOHUP $SQUEAK $IMAGES_HOME/seaside.image $SCRIPTS_HOME/seaside.st
>
>
> Sorry for the offtopic, what I have a question: is there a simple way to
> kill what you started with nohup?

Write the pid into a file?

I am still newbie with *nix. How can I know the PID from a process I started from nohup? Suppose I have this script:

#!/bin/sh
#settings
NOHUP="/usr/bin/nohup"
VM="/home/mariano/squeak/expury/build/squeak"
# Para produccion, como no van a estar las X, tengo que poner el -vm-display-null
VM_PARAMS="-mmap 200m -vm-sound-null"
IMAGE="destinoMochila.image"

#start the vm
$NOHUP "$VM" $VM_PARAMS "$IMAGE" &


And I want to add a line/s at the end of this script that writes to a file called "destinoMochilaPID" the PID of that SqueakVM. How can I do this ?

Thanks for the help!

Mariano
 


Cheers
Philippe
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Randal L. Schwartz
In reply to this post by Miguel Cobá
>>>>> "Miguel" == Miguel Enrique Cobá Martinez <[hidden email]> writes:

Miguel> killall kills all the process named some form. If you have several
Miguel> processes for example of firefox, a killall firefox will kill all of
Miguel> them.

Careful with broad statements like that.  On at least one flavor of unix,
"killall" killed *all* processes, not just ones matching a parameter.  I
forget where to find the anecdote, but it was very disturbing.

[looking with google]

Ahh, here it is:

   http://en.wikipedia.org/wiki/Killall

  The implementation supplied with genuine UNIX System V (including Solaris)
  and with the Linux sysvinit tools (as killall5) is a particularly dangerous
  command that kills all processes that the user is able to kill, effectively
  shutting down the system if run by root.

Heh.  That *would* be surprising.

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Miguel Cobá
In reply to this post by Mariano Martinez Peck
El dom, 26-07-2009 a las 17:54 -0300, Mariano Martinez Peck escribió:

>
>
> On Sun, Jul 26, 2009 at 5:25 PM, Philippe Marschall
> <[hidden email]> wrote:
>         2009/7/26 Mariano Martinez Peck <[hidden email]>:
>        
>         >
>         >
>         > 2009/7/15 Miguel Enrique Cobá Martinez
>         <[hidden email]>
>         >>
>         >> El mié, 15-07-2009 a las 17:57 -0300, Germán Arduino
>         escribió:
>         >> > Tried, but don't works.
>         >> >
>         >> > I got the same error.
>         >> >
>         >>
>         >> I use this script to start a magma image an serveral
>         seaside images:
>         >>
>         >> #!/bin/sh
>         >>
>         >> NOHUP="/usr/bin/nohup"
>         >> SQUEAK_VM="/usr/bin/squeakvm"
>         >> SQUEAK_OPTS="-mmap 100m -vm-sound-null -vm-display-X11
>         -headless"
>         >> SQUEAK="$SQUEAK_VM $SQUEAK_OPTS"
>         >> IMAGES_HOME="/home/miguel/squeak/images/azteca"
>         >> SCRIPTS_HOME="/home/miguel/squeak/scripts/azteca"
>         >> LOGS_HOME="/home/miguel/squeak/logs/azteca"
>         >> START_PORT=8080
>         >> END_PORT=8093
>         >>
>         >>
>         >> # Start the Magma image
>         >> echo "Starting Magma image"
>         >> $NOHUP $SQUEAK $IMAGES_HOME/magma.image
>         $SCRIPTS_HOME/magma.st >>
>         >> $LOGS_HOME/magma.nohup &
>         >>
>         >> # Start the Seaside images
>         >> for PORT in `seq $START_PORT $END_PORT`; do
>         >>  echo "Starting Seaside image on port: $port"
>         >>  $NOHUP $SQUEAK $IMAGES_HOME/seaside.image
>         $SCRIPTS_HOME/seaside.st
>         >
>         >
>         > Sorry for the offtopic, what I have a question: is there a
>         simple way to
>         > kill what you started with nohup?
>        
>        
>         Write the pid into a file?
>
> I am still newbie with *nix. How can I know the PID from a process I
> started from nohup? Suppose I have this script:
>

In a script or a unix shell, you, after executing a command, can use
$! to obtain the PID of the last process and $? to obtain the exit code
of the process. Then you can use this variables to form the name of a
file or to store it on a file to subsecuent use, like killing the
process later. e.g

miguel@laptop:~$ evince &
[1] 13500
miguel@laptop:~$ echo $!
13500
miguel@laptop:~$ echo $?
0
miguel@laptop:~$ echo $! > evince.pid
miguel@laptop:~$ cat evince.pid
13500
miguel@laptop:~$ man kill
miguel@laptop:~$ kill -9 `cat evince.pid `
miguel@laptop:~$

that are backticks around the cat command.

Cheers,
Miguel Cobá


> #!/bin/sh
> #settings
> NOHUP="/usr/bin/nohup"
> VM="/home/mariano/squeak/expury/build/squeak"
> # Para produccion, como no van a estar las X, tengo que poner el
> -vm-display-null
> VM_PARAMS="-mmap 200m -vm-sound-null"
> IMAGE="destinoMochila.image"
>
> #start the vm
> $NOHUP "$VM" $VM_PARAMS "$IMAGE" &
>
>
> And I want to add a line/s at the end of this script that writes to a
> file called "destinoMochilaPID" the PID of that SqueakVM. How can I do
> this ?
>
> Thanks for the help!
>
> Mariano
>  
>        
>        
>        
>         Cheers
>         Philippe
>         _______________________________________________
>         seaside mailing list
>         [hidden email]
>         http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
>        
>
> _______________________________________________
> seaside mailing list
> [hidden email]
> http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Randal L. Schwartz
>>>>> "Miguel" == Miguel Enrique Cobá Martinez <[hidden email]> writes:

Miguel> miguel@laptop:~$ kill -9 `cat evince.pid `

No no no.  Don't use kill -9.

It doesn't give the process a chance to cleanly:

1) release IPC resources (shared memory, semaphores, message queues)

2) clean up temp files

3) inform its children that it is going away

4) reset its terminal characteristics

and so on and so on and so on.

Generally, send 15 (SIGTERM), and wait a second or two, and if that
doesn't work, send 2 (SIGINT), and if that doesn't work, send 1
(SIGHUP).  If that doesn't, REMOVE THE BINARY because the program is
badly behaved!

Don't use kill -9.  Don't bring out the combine harvester just to tidy
up the flower pot.


--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Miguel Cobá
El dom, 26-07-2009 a las 14:15 -0700, Randal L. Schwartz escribió:

> >>>>> "Miguel" == Miguel Enrique Cobá Martinez <[hidden email]> writes:
>
> Miguel> miguel@laptop:~$ kill -9 `cat evince.pid `
>
> No no no.  Don't use kill -9.
>
> It doesn't give the process a chance to cleanly:
>
> 1) release IPC resources (shared memory, semaphores, message queues)
>
> 2) clean up temp files
>
> 3) inform its children that it is going away
>
> 4) reset its terminal characteristics
>
> and so on and so on and so on.
>
> Generally, send 15 (SIGTERM), and wait a second or two, and if that
> doesn't work, send 2 (SIGINT), and if that doesn't work, send 1
> (SIGHUP).  If that doesn't, REMOVE THE BINARY because the program is
> badly behaved!
>
> Don't use kill -9.  Don't bring out the combine harvester just to tidy
> up the flower pot.
>  
He he, yes I know that it is overkill, I was just showing the process
and didn't think much about the implicit consecuences of the precise
command. Even more on unattended servers. Sometimes, you just want to
get rid of a process no matter what, but I agree with you. So Mariano,
listen to Randal.

Cheers,
Miguel Cobá
>

_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Mariano Martinez Peck
In reply to this post by Randal L. Schwartz


2009/7/26 Randal L. Schwartz <[hidden email]>
>>>>> "Miguel" == Miguel Enrique Cobá Martinez <[hidden email]> writes:

Miguel> miguel@laptop:~$ kill -9 `cat evince.pid `

No no no.  Don't use kill -9.

It doesn't give the process a chance to cleanly:

1) release IPC resources (shared memory, semaphores, message queues)

2) clean up temp files

3) inform its children that it is going away

4) reset its terminal characteristics

and so on and so on and so on.

Generally, send 15 (SIGTERM), and wait a second or two, and if that
doesn't work, send 2 (SIGINT), and if that doesn't work, send 1
(SIGHUP).  If that doesn't, REMOVE THE BINARY because the program is
badly behaved!

Ok.....but how can I do this from a script ?

Thanks!

Mariano
 

Don't use kill -9.  Don't bring out the combine harvester just to tidy
up the flower pot.


--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________


_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
Reply | Threaded
Open this post in threaded view
|

Re: How to start an image with PORT parameter

Randal L. Schwartz
>>>>> "Mariano" == Mariano Martinez Peck <[hidden email]> writes:

>> Generally, send 15 (SIGTERM), and wait a second or two, and if that
>> doesn't work, send 2 (SIGINT), and if that doesn't work, send 1
>> (SIGHUP).  If that doesn't, REMOVE THE BINARY because the program is
>> badly behaved!
>>

Mariano> Ok.....but how can I do this from a script ?

kill -15 $PID || exit 0
sleep 2
kill -2 $PID || exit 0
sleep 2
kill -1 $PID || exit 0
sleep 2
kill -9 $PID || exit 0

--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<[hidden email]> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
_______________________________________________
seaside mailing list
[hidden email]
http://lists.squeakfoundation.org/cgi-bin/mailman/listinfo/seaside
123