Master-details

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

Re: Subtle bug on updating WebElements

Alex Baran
2009/4/21 Herbert König <[hidden email]>:
> We should make a separate thread of 6- ??

I think it's better to have separate post. Let me have some time to
understand things deeply before posting.

> Is there an Aida issue tracker?

Well, I know nothing about it's existence.


Alex
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
In reply to this post by Janko Mivšek
Hi Janko,

2009/4/21 Janko Mivšek <[hidden email]>:
> Hi guys,
>
> I'm full-time in preparation of the next beta, so I cannot go deep in
> your problem yet. But I have one idea: what if you prepare SUnit test
> cases for the problem and surrounding stuff?

I will try, but it seems that this is not so simply, but anyway I need
make some thought on it.

>
> We need more tests anyway and also I found helpful to myself to write
> tests down when solving such difficult cases.
>
> Best regards
> Janko
>
>
> Herbert König pravi:
>> Hi Alex,
>>
>> I read your reply in detail and tried your example.
>> To get the messages shorter again:
>> 1- You found a bug in Aida.
>> 2- This bug defeats the purpose of Ajax updates as soon as WebGrid (and
>>    possible user components) are involved.
>> 3- The problem is located in WebForm>>registerIdFor: by using
>>    elementForMethod: to set the id which may result in duplicate id's
>>    for different elements.
>> 4- The other things this thread dealt with are likely to disappear or
>>    get much clearer after 1- is resolved.
>> 5- We'd like Janko's guidance in this.
>>
>> 6- There's a different problem regarding memory leaks which I confirm
>>    and consequences of that where discussed here some time ago.
>>
>> So:
>> Please confirm (or reject) my diagnosis in 3-
>> We should make a separate thread of 6- ??
>> Is there an Aida issue tracker?
>> Don't misunderstand this, all your explanations about Aida workings
>> are valuable to me.
>>
>>
>> Cheers,
>>
>> Herbert                            mailto:[hidden email]
>>
> --
> Janko Mivšek
> AIDA/Web
> Smalltalk Web Application Server
> http://www.aidaweb.si
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
In reply to this post by Rob Rothwell
Hi Rob,

Can you provide more info about you problem. Maybe link.

Alex

2009/4/21 Rob Rothwell <[hidden email]>:

> And...this might sound like it's coming out of left field, but I had (and
> still have) a problem with using WebChart and Ajax...maybe the two are
> actually related to number 2.  Maybe having another place to "look" might
> help as well?
>
> Rob
>
> 2009/4/21 Janko Mivšek <[hidden email]>
>>
>> Hi guys,
>>
>> I'm full-time in preparation of the next beta, so I cannot go deep in
>> your problem yet. But I have one idea: what if you prepare SUnit test
>> cases for the problem and surrounding stuff?
>>
>> We need more tests anyway and also I found helpful to myself to write
>> tests down when solving such difficult cases.
>>
>> Best regards
>> Janko
>>
>>
>> Herbert König pravi:
>> > Hi Alex,
>> >
>> > I read your reply in detail and tried your example.
>> > To get the messages shorter again:
>> > 1- You found a bug in Aida.
>> > 2- This bug defeats the purpose of Ajax updates as soon as WebGrid (and
>> >    possible user components) are involved.
>> > 3- The problem is located in WebForm>>registerIdFor: by using
>> >    elementForMethod: to set the id which may result in duplicate id's
>> >    for different elements.
>> > 4- The other things this thread dealt with are likely to disappear or
>> >    get much clearer after 1- is resolved.
>> > 5- We'd like Janko's guidance in this.
>> >
>> > 6- There's a different problem regarding memory leaks which I confirm
>> >    and consequences of that where discussed here some time ago.
>> >
>> > So:
>> > Please confirm (or reject) my diagnosis in 3-
>> > We should make a separate thread of 6- ??
>> > Is there an Aida issue tracker?
>> > Don't misunderstand this, all your explanations about Aida workings
>> > are valuable to me.
>> >
>> >
>> > Cheers,
>> >
>> > Herbert                            mailto:[hidden email]
>> >
>> --
>> Janko Mivšek
>> AIDA/Web
>> Smalltalk Web Application Server
>> http://www.aidaweb.si
>> _______________________________________________
>> Aida mailing list
>> [hidden email]
>> http://lists.aidaweb.si/mailman/listinfo/aida
>
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
In reply to this post by Herbert König
2009/4/21 Herbert König <[hidden email]>:
> 2- This bug defeats the purpose of Ajax updates as soon as WebGrid (and
>   possible user components) are involved.
> 3- The problem is located in WebForm>>registerIdFor: by using
>   elementForMethod: to set the id which may result in duplicate id's
>   for different elements.

Herbert, would it be possible for you to try some modifications on
your code? In my cases it works, but produce a lot of garbage. I just
want to know if it works in more complicated environment, and delve
into garbage problem later. Modifications is for concept testing only.

Please comment bellow lines in WebForm>>registerIdFor:
        "(anElement method notNil and: [self app session lastRequest isAjaxRequest
                and: [self isRegisteredMethod: anElement method]])
                        ifTrue: [self registerIdFor: anElement instead: (self
elementForMethod: anElement method)]."

This commented lines used to make old-new components replacement. We
will provide another implementation.
Please modify method WebApplication>>respondToAjaxRequest, after line
"e := self ajaxUpdateOfOld: oldElement." add:

        oldElement id isNil ifFalse:
                [e id isNil ifTrue: [ajaxForm registerIdFor: e instead: oldElement]].

This will replace old element with new element without searching by a selector.


Alex
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Herbert König
Hi Alex,


AB> Herbert, would it be possible for you to try some modifications on
AB> your code? In my cases it works, but produce a lot of garbage. I just

it seems to help in your case, which I also have integrated in my app.
No Error within a hundred clicks or so.

In my app I still get the error after at least 10 clicks usually
after three.

I have two tabs. One where I have not yet finished updating the other
elements so I only update the grid itself (with lineGreen...). This
one also seems stable now. I already use updateMany: but the
collection only has one element compared to two grids in the bad case.

AB> want to know if it works in more complicated environment, and delve
AB> into garbage problem later. Modifications is for concept testing only.

Can't dig deeper now but I can afford some more "Do this and tell
result".

Tonight I'll look deeper.


Cheers,

Herbert                            mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
Could you send to me squeak sources of your case?

2009/4/21 Herbert König <[hidden email]>:

> Hi Alex,
>
>
> AB> Herbert, would it be possible for you to try some modifications on
> AB> your code? In my cases it works, but produce a lot of garbage. I just
>
> it seems to help in your case, which I also have integrated in my app.
> No Error within a hundred clicks or so.
>
> In my app I still get the error after at least 10 clicks usually
> after three.
>
> I have two tabs. One where I have not yet finished updating the other
> elements so I only update the grid itself (with lineGreen...). This
> one also seems stable now. I already use updateMany: but the
> collection only has one element compared to two grids in the bad case.
>
> AB> want to know if it works in more complicated environment, and delve
> AB> into garbage problem later. Modifications is for concept testing only.
>
> Can't dig deeper now but I can afford some more "Do this and tell
> result".
>
> Tonight I'll look deeper.
>
>
> Cheers,
>
> Herbert                            mailto:[hidden email]
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Herbert König
Alex,

AB> Could you send to me squeak sources of your case?
my model has several classes with several fields. I try with some
explanations. All three methods from my app are at the end.

The model (self observee abrechnung) has a list of positions, one of
them is held in (self observee selectedPosition) This is the line
below "aktuelle Position" which is displayed by a component used in
several views.

A click on the text in the bottom grid (displayPositionenComponent)
shall update the grid to highlight the line plus the above component
reflecting that line.


Cheers,

Herbert                            mailto:[hidden email]

The view which does it:

viewPositionen

        | e displayPosition |
        e := WebElement new.
        e addTextH1: 'Elling Abrechnung ohne Schwerpunktsweg'.
        e
                addBreak;
                add: self displayTabComponent;
                addBreak;
                addTextH1: 'Abrechnungspositionen (DA53) auswählen';
                addBreak.
        e
                addButtonText: 'Positionen bearbeiten / anlegen' action: #add;
                addBreak.
        e
                addText: 'aktuelle Position:';
                addBreak.
"--------------- This is the one to update besides the grid, source follows --------"
        displayPosition := e add: self displaySelectedPositionComponent.
        e
                addText: 'Liste der Positionen:';
                addBreak.
        e add: (self
"--------------- this one got the on Click Block, which updates itself
and the above displayPosition see src ------"
                                displayPositionenComponent:
                                        (OrderedCollection with: displayPosition)).
        self pageFrameWith: e title: 'REB Elling'



displaySelectedPositionComponent
        "reusable; display the selected position in one line"

        | e aDA53|
        aDA53 := self observee selectedPosition .
        e := WebElement new.
        "The selected position may still be new and not added to the
        Abrechnung in that case show a hint instead of the position"
        (self observee abrechnung containsPositionWithID: aDA53 idString)
                ifTrue:
                        [(e newCell)
                                addText: aDA53 position printString;
                                addNbSp: 3.
                        "where the heck is this changed in the css, it
                        shouldn't be necessary!!"
                        e table style: '{font-size: 10pt;}'.
                        (e newCell)
                                addText: aDA53 index printString;
                                addNbSp: 3.
                        (e newCell)
                                addText: aDA53 positionsText;
                                addNbSp: 3.
                        e newCell addText: (aDA53 vorgabeMasse printShowingDecimalPlaces: 3)]
                ifFalse: [e cell addText: 'Keine Position ausgewählt'.
                                        e table style: '{font-size: 10pt;}'.].
        ^e        




displayPositionenComponent: collectionElementsToUpdate
        | positionsListe |
        collectionElementsToUpdate do: [:each| each registerId].
        positionsListe := WebGrid new.
        positionsListe
                columnNames: #(
                                        'No.'
                                        'Ind.'
                                        'Positionstext'
                                        'Vorgabemasse'
                                );
                columnAlign: #(#left #left #left #left );
                collection: self observee abrechnung positionen;
                columnAspects: #(
                                        #position
                                        #index
                                        #positionsText
                                        #vorgabeMasseText
                                );
                rowGreenIfTrue: [:each | each idString = self observee selectedPosition idString];
                rowBoldIfTrue: [:each | each idString = self observee selectedPosition idString].
        collectionElementsToUpdate add: positionsListe.
        positionsListe
                column: 3
                        addBlock:
                                [:each |
                                (WebText new text: each positionsText)
                                        onClickDo:
                                                [self observee
                                                        selectedPosition: (self observee abrechnung positionWithId: each idString)
                                                "copy"]
                                                                fixTemps
                                        andUpdateMany:
                                                collectionElementsToUpdate].
        ^positionsListe        
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

columns.PNG (17K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
I want to run your case with my modifications. Because your case is
pretty big and fire issues that we are hunting for. So, it would be
nice to have some executable stuff, like package or fileout.

2009/4/21 Herbert König <[hidden email]>:

> Alex,
>
> AB> Could you send to me squeak sources of your case?
> my model has several classes with several fields. I try with some
> explanations. All three methods from my app are at the end.
>
> The model (self observee abrechnung) has a list of positions, one of
> them is held in (self observee selectedPosition) This is the line
> below "aktuelle Position" which is displayed by a component used in
> several views.
>
> A click on the text in the bottom grid (displayPositionenComponent)
> shall update the grid to highlight the line plus the above component
> reflecting that line.
>
>
> Cheers,
>
> Herbert                            mailto:[hidden email]
>
> The view which does it:
>
> viewPositionen
>
>        | e displayPosition |
>        e := WebElement new.
>        e addTextH1: 'Elling Abrechnung ohne Schwerpunktsweg'.
>        e
>                addBreak;
>                add: self displayTabComponent;
>                addBreak;
>                addTextH1: 'Abrechnungspositionen (DA53) auswählen';
>                addBreak.
>        e
>                addButtonText: 'Positionen bearbeiten / anlegen' action: #add;
>                addBreak.
>        e
>                addText: 'aktuelle Position:';
>                addBreak.
> "--------------- This is the one to update besides the grid, source follows --------"
>        displayPosition := e add: self displaySelectedPositionComponent.
>        e
>                addText: 'Liste der Positionen:';
>                addBreak.
>        e add: (self
> "--------------- this one got the on Click Block, which updates itself
> and the above displayPosition see src ------"
>                                displayPositionenComponent:
>                                        (OrderedCollection with: displayPosition)).
>        self pageFrameWith: e title: 'REB Elling'
>
>
>
> displaySelectedPositionComponent
>        "reusable; display the selected position in one line"
>
>        | e aDA53|
>        aDA53 := self observee selectedPosition .
>        e := WebElement new.
>        "The selected position may still be new and not added to the
>        Abrechnung in that case show a hint instead of the position"
>        (self observee abrechnung containsPositionWithID: aDA53 idString)
>                ifTrue:
>                        [(e newCell)
>                                addText: aDA53 position printString;
>                                addNbSp: 3.
>                        "where the heck is this changed in the css, it
>                        shouldn't be necessary!!"
>                        e table style: '{font-size: 10pt;}'.
>                        (e newCell)
>                                addText: aDA53 index printString;
>                                addNbSp: 3.
>                        (e newCell)
>                                addText: aDA53 positionsText;
>                                addNbSp: 3.
>                        e newCell addText: (aDA53 vorgabeMasse printShowingDecimalPlaces: 3)]
>                ifFalse: [e cell addText: 'Keine Position ausgewählt'.
>                                        e table style: '{font-size: 10pt;}'.].
>        ^e
>
>
>
>
> displayPositionenComponent: collectionElementsToUpdate
>        | positionsListe |
>        collectionElementsToUpdate do: [:each| each registerId].
>        positionsListe := WebGrid new.
>        positionsListe
>                columnNames: #(
>                                        'No.'
>                                        'Ind.'
>                                        'Positionstext'
>                                        'Vorgabemasse'
>                                );
>                columnAlign: #(#left #left #left #left );
>                collection: self observee abrechnung positionen;
>                columnAspects: #(
>                                        #position
>                                        #index
>                                        #positionsText
>                                        #vorgabeMasseText
>                                );
>                rowGreenIfTrue: [:each | each idString = self observee selectedPosition idString];
>                rowBoldIfTrue: [:each | each idString = self observee selectedPosition idString].
>        collectionElementsToUpdate add: positionsListe.
>        positionsListe
>                column: 3
>                        addBlock:
>                                [:each |
>                                (WebText new text: each positionsText)
>                                        onClickDo:
>                                                [self observee
>                                                        selectedPosition: (self observee abrechnung positionWithId: each idString)
>                                                "copy"]
>                                                                fixTemps
>                                        andUpdateMany:
>                                                collectionElementsToUpdate].
>        ^positionsListe
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
I already have Squeak 3.9 with Aida 5.6 on my machine, so I can check there.
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Herbert König
In reply to this post by Alex Baran
Alex,

AB> I want to run your case with my modifications. Because your case is
AB> pretty big and fire issues that we are hunting for. So, it would be
AB> nice to have some executable stuff, like package or fileout.

you would also need the data, which you can not enter in the web app
yet. And I never checked if the app runs without the data.

I suggest I send you a zipped up image and changes in private.

Please keep it confidential.

My image is 3.8 but I see no reason that this should make problems.
If needed I first get me a 3.9 image, file in my mcz, file in the data
and send you that image.

In 3.8 I can offer image and changes as 7Zip or Windows .exe of 17 MB
or 31MB of zip file which might be to big for mail.

Or the equivalent in 3.9 which might be shorter as I'd use a fresh
image.

Cheers,

Herbert                            mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
Catched.

The problem is in order of Ajax request issued by browser.
When prototype send request, the first response that come back is
answer. But it can be totally wrong.

a - is first click.
b - is second click.

a1 - is first Ajax request in first click.
a2 - is second request in first click.

b1 - ...
b2 - ...

Lets find events orders that result in duplication of a grid:

Requests order     a1  a2   b1  b2
Responses order   x1  x1  x2   x2

Instead of "x" a or b can be used.

So we have two wrong match that result in duplicated grids.
b1 <- x2
b2 <- x2

To make error constant add two lines to the start of respondToAjaxRequest
respondToAjaxRequest
        Counter inc.
        (Counter counter \\ 2  = 0) ifTrue: [(Delay forSeconds: 2) wait].
        ...

Counter is straightforward and initialized with 1 (NOT zero).

Now I am thinking what to do in such situation.


Alex

2009/4/21 Herbert König <[hidden email]>:

> Alex,
>
> AB> I want to run your case with my modifications. Because your case is
> AB> pretty big and fire issues that we are hunting for. So, it would be
> AB> nice to have some executable stuff, like package or fileout.
>
> you would also need the data, which you can not enter in the web app
> yet. And I never checked if the app runs without the data.
>
> I suggest I send you a zipped up image and changes in private.
>
> Please keep it confidential.
>
> My image is 3.8 but I see no reason that this should make problems.
> If needed I first get me a 3.9 image, file in my mcz, file in the data
> and send you that image.
>
> In 3.8 I can offer image and changes as 7Zip or Windows .exe of 17 MB
> or 31MB of zip file which might be to big for mail.
>
> Or the equivalent in 3.9 which might be shorter as I'd use a fresh
> image.
>
> Cheers,
>
> Herbert                            mailto:[hidden email]
>
> _______________________________________________
> Aida mailing list
> [hidden email]
> http://lists.aidaweb.si/mailman/listinfo/aida
>
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
In reply to this post by Herbert König
Hi again Herbert,

After quick look at your app I think that your app could work without
our last Aida modification. It seems that you don't have grid
recreation, just updating, so it should work with Aida
search-by-selector way. And because you don't recreate grids you
probably will not suffer from garbage. So right now I see 2 problems
for your app:
1. The problem with update of several components.
2. Garbage from registering components that are holders for block. I'm
in the process of looking for solution here.

Alex
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Herbert König
Hi Alex,

AB> After quick look at your app I think that your app could work without
AB> our last Aida modification.

yes I guess. As I have to update many parts of the form anyway the
speed loss by not using Ajax at all (my first solution) wouldn't be
big. I plan to discard the whole navigation to the left and the logo
on top.

AB> So right now I see 2 problems
AB> for your app:
AB> 1. The problem with update of several components.
See above, no problem at all and only a speed problem later.
Or I make one big reusable component which contains everything I need
to update and only send one Ajax request.

AB> 2. Garbage from registering components that are holders for block. I'm
AB> in the process of looking for solution here.

Also no problem for my app. I will keep no user data in the image.
When the user is finished he will download the results via what is
seen under list printing protocol in the DA.. classes. And will upload
for continuing. So my plan is, to fire up a fresh image every night
(only national users). Registered users are kept in external files.

Remember:
For me Engineering is the art....from things you can _get_ :-))

This discussion here from my side is about something completely
different. Aida is open source and we can make it suit our needs. So
it's worth trying to make it better. And onClickDo: andUpdateMany: is
useful in many places.


Cheers,

Herbert                            mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Herbert König
In reply to this post by Alex Baran
Hi,

another data point:
When producing the errors I sometimes get debuggers:
"Error: Attempt to evaluate a block that is already evaluated",
usually more than one.

So I put a 0 halt into the onClickDo: Block and I see I get one
debugger for the halt + one debugger for each Ajax.Updater -1.

This is expected as every Updater fires a request, the first halts and
all subsequent ones try to reenter this halted block.

So do we need some critical: in WebApplication>>respondToAjaxRequest
or in ajaxDoBlock?

BTW my new viewAddPosition now fires 5 Ajax requests.

Cheers,

Herbert                            mailto:[hidden email]
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

EllingWebTabsApp-viewAddPosition.st (2K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
Hi Herbert,

2009/4/23 Herbert König <[hidden email]>:
> Hi,
>
> another data point:
> When producing the errors I sometimes get debuggers:
> "Error: Attempt to evaluate a block that is already evaluated",
> usually more than one.
>
> So I put a 0 halt into the onClickDo: Block and I see I get one
> debugger for the halt + one debugger for each Ajax.Updater -1.

Could you provide your block code?

>
> This is expected as every Updater fires a request, the first halts and
> all subsequent ones try to reenter this halted block.
>
> So do we need some critical: in WebApplication>>respondToAjaxRequest
> or in ajaxDoBlock?

Well, almost, but on client(JavaScript) and without mutex :) I can
describe why I come to such conclusion if you wish, but it can be
boring :)
So 2 points to make Aida and updateMany more stable (in unproven theory :)):
1. To serialize Ajax.Updates in updateMany:
2. To discard Ajax.Update when another Ajax.Update roll. This is
supposed to prevent such kind of errors when you click on element that
don't exists because of previous call.

Lets start with your variant of updateMany. Ajax.Updates have option
sync/async, but by some hidden reasons prototype.js creators don't
recommend to use it[1]. So lets introduce our variant.
1. Serialize many updates. Ajax.Update, (as a subclass of
Ajax.Request) can have onComplete callback. My idea is to use
something like:
Ajax.Update(... {...onComplete : function () {Ajax.Update ...} ...})
In that way inner Ajax.Update will take place only when outer
Ajax.Update complete. We can wrap our collection of Ajax.Updates that
way to make sync updates.
2. Discard user action while we are not finished with Ajax.Update.
I come to such variant:
<head>
   script ---> var inCall = false
</head>
and before every Ajax.Update insert something like
if (!inCall) {inCall = true. Ajax.Update ...}
And to set inCall = false, we can use onComplete collback of Ajax.Update.

So I slightly modify your variant of updateMany. It would be
interested to know how it works in your settings. It seems to work,
duplication goes away, don't see any.

onClickDo: aBlock andUpdateMany: anElementOrIdCollection
        | script |
        script := String new writeStream.
        self dependentInformation: anElementOrIdCollection to: script.
        self registerId;
                otherAt: #onClickBlock put: aBlock;
                onClick: 'if (!inCall) {inCall = true;', script contents, '}'.


dependentInformation: anElementOrIdCollection to: aStream
        "necessary information of elements to update is collected here."
        | url head tail headId parm |
        anElementOrIdCollection ifNil: [^''].
        head := anElementOrIdCollection first.
        tail := anElementOrIdCollection copyFrom: 2 to: anElementOrIdCollection size.
        url := self ajaxCallUrl.
        headId := head isSymbol
                                                ifTrue: [head]
                                                ifFalse:
                                                        [head registerId.
                                                        head id].
        parm := self ajaxCallUrlParametersFor: head.
        self registerId.
        parm := parm , '&amp;blockElementId=' , self id ,
'&amp;blockName=onClickBlock'.
        aStream
                                nextPutAll: 'new Ajax.Updater(''';
                                nextPutAll: headId asString;
                                nextPutAll: ''', ''';
                                nextPutAll: url;
                                nextPutAll: ''', {method: ''post'', postBody: ''';
                                nextPutAll: parm;
                                nextPut: $';
                                nextPutAll: ', onComplete: function() {'.
         tail isEmpty
                        ifTrue: [aStream nextPutAll: ' inCall = false; ']
                        ifFalse:  [self dependentInformation: tail on: aStream].
        aStream
                                nextPutAll: '; }';
                                nextPutAll: ', evalScripts: true});'.


And add this line to WebPage>>initPageHeaderLinks

        self addJavascript: 'var inCall = false;'


All code above is only for onClickDo:andUpdateMany: , I have not yet
modify onClickDo:, it seems like straightforward will try it later.



>
> BTW my new viewAddPosition now fires 5 Ajax requests.

It will be interesting to know how it works with the modification above.



Alex


[1] "Since synchronous usage is rather unsettling, and usually bad
taste, you should avoid changing this. Seriously."
from - http://www.prototypejs.org/api/ajax/options
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
In reply to this post by Herbert König
Herbert,

2009/4/23 Herbert König <[hidden email]>:
> Hi Alex,
>
> AB> After quick look at your app I think that your app could work without
> AB> our last Aida modification.
>
> yes I guess. As I have to update many parts of the form anyway the
> speed loss by not using Ajax at all (my first solution) wouldn't be
> big. I plan to discard the whole navigation to the left and the logo
> on top.

I just want to make it clear, that in that case you will get garbage.
Everything that was registered and later recreated, including grids,
will add to garbage. Of course with your solution of overnight
reloading it can be ok, but it's better to know about such issue.

>
> AB> So right now I see 2 problems
> AB> for your app:
> AB> 1. The problem with update of several components.
> See above, no problem at all and only a speed problem later.
> Or I make one big reusable component which contains everything I need
> to update and only send one Ajax request.

This can be dangerous. First of all you will have grids garbage too.
So your WebForm>>ids will include multiple grids(one actual, others -
garbage). And when you recreate component, new grid can get wrong id
(id of some old grid). It's because when new grid register id it will
make old-new substitution. So the problem of multiple grids can affect
the case with one grid. I need to try that case, but it seems like
possible scenario.

>
> AB> 2. Garbage from registering components that are holders for block. I'm
> AB> in the process of looking for solution here.
>
> Also no problem for my app. I will keep no user data in the image.
> When the user is finished he will download the results via what is
> seen under list printing protocol in the DA.. classes. And will upload
> for continuing. So my plan is, to fire up a fresh image every night
> (only national users). Registered users are kept in external files.
>
> Remember:
> For me Engineering is the art....from things you can _get_ :-))

It's interesting point, the question is in the _get_ part. What we can
built dependents also from what can be found and lately get. And
another part of _get_ is that we need to push our instrument to limit
and beyound just for the sake to know what it can NOT get, even if
possibilities stated in documentation or seems obvious from first
looking.

>
> This discussion here from my side is about something completely
> different. Aida is open source and we can make it suit our needs. So
> it's worth trying to make it better. And onClickDo: andUpdateMany: is
> useful in many places.

I have similiar feelings. So lets game go on :)


Alex
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Herbert König
In reply to this post by Alex Baran
Hi Alex,

AB> Could you provide your block code?

it's atbottom of displayPositionenComponent


AB> Well, almost, but on client(JavaScript) and without mutex :) I can
AB> describe why I come to such conclusion if you wish, but it can be
AB> boring :)

I'm interested but this week I'm so busy I can't reply timely. It
seems that every user working on the same model gets his own app and
as long as the invoked block is defined in the app everything is ok.

But why it's better solving the thing in foreign JS instead of
familiar Smalltalk would be interesting.

AB> So I slightly modify your variant of updateMany. It would be
AB> interested to know how it works in your settings. It seems to work,
AB> duplication goes away, don't see any.

I get a debugger.

AB> onClickDo: aBlock andUpdateMany: anElementOrIdCollection
AB> | script |
AB> script := String new writeStream.
Squeak's  String DNU writeStream so:
     script := WriteStream on: String new
AB> self dependentInformation: anElementOrIdCollection to: script.
AB> self registerId;
AB> otherAt: #onClickBlock put: aBlock;
AB> onClick: 'if (!inCall) {inCall = true;', script contents, '}'.

But this part is not reached because recursion seems to have problems.
See debugger.

Stupid me! I looked at it several times and didn't notice the recursive
call was ...tail on: instead of ....tail to:
Though the debugger said it all I just didn't listen :-))

HK>> BTW my new viewAddPosition now fires 5 Ajax requests.
AB> It will be interesting to know how it works with the modification above.

I get no more errors but everything except the grid itself doesn't
update.  I spent some time bug hunting and I added one more entry to
update not as an inputFieldAspect: but as an addText:

When clicking into the grid the inputs show no change at all but the
text gets cleared. Repeat by refreshing the page and click another
line in the grid.

In case you don't have it handy, Tab "Positionen" has a button on the
top reading: "Position bearbeiten / anlegen" this gets you to the
view.

Changed view at the bottom.
Now I must earn money :-))

Cheers,

Herbert                            mailto:[hidden email]



viewAddPosition
        | e positionstext vorgabemassetext indextext nummertext testtext coll|
        self observee
                selectedPosition: (self observee selectedPosition ifNil: [DA53 new]).
        e := WebElement new.
        e addTextH1: 'Elling Abrechnung ohne Schwerpunktsweg'.
        e
                addBreak;
                add: self displayTabComponent;
                addBreak;
                addTextH1: 'Neue Position eingeben / Bestehende Position ändern';
                addBreak.
        e cell addText: 'Nummer:'.
        e table style: '{font-size: 10pt;}'.
        nummertext := e newCell
                addInputFieldAspect: #position
                for: self observee selectedPosition
                size: 50.
        e newRow.
        e cell addText: 'Index:'.
        indextext := e newCell
                addInputFieldAspect: #index
                for: self observee selectedPosition
                size: 50.
        e newRow.
        e cell addText: 'Positionstext:'.
        positionstext := e newCell
                                addInputFieldAspect: #positionsText
                                for: self observee selectedPosition
                                size: 50.
        e newRow.
        e cell addText: 'TestPosAnzeige:'.
        testtext := e newCell
                                addText: self observee selectedPosition positionsText.
        e newRow.
        e cell addText: 'Vorgabemasse:'.
        vorgabemassetext := e newCell
                                addInputFieldAspect: #vorgabeMasseText
                                for: self observee selectedPosition
                                size: 50.
        e newRow.
        e cell addButtonText: 'Eintrag hinzufügen / ändern ' action: #add.
        e newCell addButtonText: 'Neuer Eintrag' action: #new.
        e newRow.
        e cell addButtonText: 'Abbrechen / Zurück zu Positionen' action: #cancel.
        e newCell addButtonText: 'Angezeigten Eintrag löschen' action: #delete.
        e addBreak.
        e
                addText: 'Liste der Positionen:';
                addBreak.
        coll := (OrderedCollection with: positionstext
                                                with: vorgabemassetext with: indextext with: nummertext ).
        coll add: testtext.
        e add: (self
                                displayPositionenComponent:  coll).
        self pageFrameWith: e title: 'REB Elling'
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida

MessageNotUnderstood# WebText##dependentInformation#on#.png (60K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Nicholas Moore
Herbert /Alex

I am following your envestigations with interest!

I have a similar problem. I want to select an object in my grid and see some attributes of that object displayed by another component. So far I have two phenomena:

1) the details displayed in the second component are always those of the last object in the collection in the grid (as though when the block is executed the last 'each' is used).

2) after selection, the second component disappears - inspection in a debugger shows that the object associated with that component would be the last one described above).

I hope to be able to do some testing this weekend.

Nicholas

� wrote:
Hi Alex,

AB> Could you provide your block code?

it's atbottom of displayPositionenComponent


AB> Well, almost, but on client(JavaScript) and without mutex :) I can
AB> describe why I come to such conclusion if you wish, but it can be
AB> boring :)

I'm interested but this week I'm so busy I can't reply timely. It
seems that every user working on the same model gets his own app and
as long as the invoked block is defined in the app everything is ok.

But why it's better solving the thing in foreign JS instead of
familiar Smalltalk would be interesting.

AB> So I slightly modify your variant of updateMany. It would be
AB> interested to know how it works in your settings. It seems to work,
AB> duplication goes away, don't see any.

I get a debugger.

AB> onClickDo: aBlock andUpdateMany: anElementOrIdCollection
AB> 	| script |
AB> 	script := String new writeStream.
Squeak's  String DNU writeStream so:
     script := WriteStream on: String new
AB> 	self dependentInformation: anElementOrIdCollection to: script.
AB> 	self registerId;
AB> 		otherAt: #onClickBlock put: aBlock;
AB> 		onClick: 'if (!inCall) {inCall = true;', script contents, '}'.

But this part is not reached because recursion seems to have problems.
See debugger.

Stupid me! I looked at it several times and didn't notice the recursive
call was ...tail on: instead of ....tail to:
Though the debugger said it all I just didn't listen :-))

HK>> BTW my new viewAddPosition now fires 5 Ajax requests.
AB> It will be interesting to know how it works with the modification above.

I get no more errors but everything except the grid itself doesn't
update.  I spent some time bug hunting and I added one more entry to
update not as an inputFieldAspect: but as an addText:

When clicking into the grid the inputs show no change at all but the
text gets cleared. Repeat by refreshing the page and click another
line in the grid.

In case you don't have it handy, Tab "Positionen" has a button on the
top reading: "Position bearbeiten / anlegen" this gets you to the
view.

Changed view at the bottom.
Now I must earn money :-))

Cheers,

Herbert                            [hidden email]



viewAddPosition
        | e positionstext vorgabemassetext indextext nummertext testtext coll|
        self observee 
                selectedPosition: (self observee selectedPosition ifNil: [DA53 new]).
        e := WebElement new.
        e addTextH1: 'Elling Abrechnung ohne Schwerpunktsweg'.
        e
                addBreak;
                add: self displayTabComponent;
                addBreak;
                addTextH1: 'Neue Position eingeben / Bestehende Position �ndern';
                addBreak.
        e cell addText: 'Nummer:'.
        e table style: '{font-size: 10pt;}'.
        nummertext := e newCell 
                addInputFieldAspect: #position
                for: self observee selectedPosition
                size: 50.
        e newRow.
        e cell addText: 'Index:'.
        indextext := e newCell 
                addInputFieldAspect: #index
                for: self observee selectedPosition
                size: 50.
        e newRow.
        e cell addText: 'Positionstext:'.
        positionstext := e newCell 
                                addInputFieldAspect: #positionsText
                                for: self observee selectedPosition
                                size: 50.
        e newRow.
        e cell addText: 'TestPosAnzeige:'.
        testtext := e newCell 
                                addText: self observee selectedPosition positionsText.
        e newRow.
        e cell addText: 'Vorgabemasse:'.
        vorgabemassetext := e newCell 
                                addInputFieldAspect: #vorgabeMasseText
                                for: self observee selectedPosition
                                size: 50.
        e newRow.
        e cell addButtonText: 'Eintrag hinzuf�gen / �ndern ' action: #add.
        e newCell addButtonText: 'Neuer Eintrag' action: #new.
        e newRow.
        e cell addButtonText: 'Abbrechen / Zur�ck zu Positionen' action: #cancel.
        e newCell addButtonText: 'Angezeigten Eintrag l�schen' action: #delete.
        e addBreak.
        e
                addText: 'Liste der Positionen:';
                addBreak.
        coll := (OrderedCollection with: positionstext
                                                with: vorgabemassetext with: indextext with: nummertext ).
        coll add: testtext.
        e add: (self 
                                displayPositionenComponent:  coll).
        self pageFrameWith: e title: 'REB Elling'

_______________________________________________ Aida mailing list [hidden email] http://lists.aidaweb.si/mailman/listinfo/aida

--
NJM TSR-i

Nicholas J Moore
Limoges
France



_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Herbert König
Hi Nicholas,


NM> Herbert /Alex

NM> I have a similar problem. I want to select an object in my
NM> grid and seesome attributes of that object displayed by another
NM> component. So far Ihave two phenomena:

yes this should work in the end.

NM> 1) the details displayed in the second component are always
NM> those ofthe last object in the collection in the grid (as though
NM> when the blockis executed the last 'each' is used).

Hmm, I don't know if that has the same cause as my remaining problem
where one field gets cleared and the others not changed at all. Maybe
you have to throw some code and a picture of your app into the
discussion.

NM> 2) after selection, the second component disappears -
NM> inspection in adebugger shows that the object associated with that
NM> component would bethe last one described above).

This is solved with Alex latest changes to onClickDo:andUpdateMany:

Do you use it? If so tell me your system and I send you a fileout or a
text for copy and paste with all changes to Aida 5.6.

NM> I hope to be able to do some testing this weekend.

Cheers,

Herbert                            mailto:[hidden email]

_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
Reply | Threaded
Open this post in threaded view
|

Re: Subtle bug on updating WebElements

Alex Baran
In reply to this post by Herbert König
Hi Herbert,


> Stupid me! I looked at it several times and didn't notice the recursive
> call was ...tail on: instead of ....tail to:

Sorry it was my fault, I modified method name at email and forgot to
rename recursive call.

> I get no more errors but everything except the grid itself doesn't
> update.  I spent some time bug hunting and I added one more entry to
> update not as an inputFieldAspect: but as an addText:

I looked at your code and found that you need separate components for
your fields. Something like
nummertext := e newCell add: self numberComponent.
So I changed it, in 2 places only just to verify concept, and it
started to update.

Aida is designed such way that updates can be possible only if an
element know about method that can recreate/update it.
And, as we already discussed, Aida has two kind of recreate/update methods:
1. That in App. Captured by walking up call stack.
2. That in WebElement (WebGrid is example of such approach). Assigned
by WebElement>>method:
In your case "field method" returned nil.


Alex
_______________________________________________
Aida mailing list
[hidden email]
http://lists.aidaweb.si/mailman/listinfo/aida
1234