PDA

View Full Version : Variables going out of scope and performance



SpringBox
2014-04-07, 08:34
Hi Guys

We have experienced an issue with App Center Beta 9 where global variables, defined as PUBLIC in the app INIT() work fine in development but go out of scope (vanish) when deployed and used in the App Center.

When we save to mem file & look at the contents, the memvars from the currently executing prg are there but the previously defined memvars have gone. Understandably this causes an error.

The memvars are not being redefined or released. Any thoughts?

Also, we are coming across performance issues when (normally at page change), Lianja App Center just seems to freeze (windows reports not responding) and then 10-15 seconds later it wakes up again and carries on. No error, just freezing.

We are trying to find out where it is freezing - we suspect it is at save.

Any comments would be much appreciated. Downloading Beta 10 now, hoping that may help.

Cheers

SpringBox

barrymavin
2014-04-07, 08:50
I will look into the RESTORE FROM .mem file -- probably to do with runtime not having compilation enabled anymore.

"We are trying to find out where it is freezing - we suspect it is at save."... Can you explain what you mean "at save".

barrymavin
2014-04-07, 09:58
Sorry I misread the post, Did that issue with public variables occur in v1.1beta8?

i will need to have a zipped up copy if your app and data to investigate the issue you mention re changing pages. Please email to support.

SpringBox
2014-04-07, 10:29
Hi Barry

It was v1.1 Beta 9

When a user navigates away from multi section page where each section is in editmode, we call a prg which saves each section in turn - eg :

Lianja.showDocument("page:Page1Name.section1?action=save")
Lianja.showDocument("page:Page1Name.section2?action=save")
Lianja.showDocument("page:Page1Name.section3?action=save")
Lianja.showDocument("page:Page1Name.section4?action=save")

** then put the next page in to edit mode

Lianja.showDocument("page:Page2Name.section1?action=editmode")
Lianja.showDocument("page:Page2Name.section2?action=editmode")
Lianja.showDocument("page:Page2Name.section3?action=editmode")
Lianja.showDocument("page:Page2Name.section4?action=editmode")

Lianja.Get("Page2Name").Refresh()

** then display page

showdocument("page:Page2?action=show") && switch to next page

As you can see we haven't worked out how to use the "Full Page edit" property on the pages or how to call it & we don't understand what the "primary section " is. Maybe we could get a performance increase by using this?

Hope that clarifies.

Cheers

SpringBox

SpringBox
2014-04-07, 10:31
Hi Barry

We put a <save to memfilename> in our code purely so that on the APP center, we could capture what was going on & confirm that the previously declared PUBLIC variables were missing.

Will try it on Beta 10 & see if that makes any difference.

Thanks

SpringBox

barrymavin
2014-04-07, 10:32
There were changes made in beta9 where the app init, load and ready procs need to be in a custom library.

Try recreating your init delegate and placing the code you had in it. This will be the issue.

barrymavin
2014-04-07, 10:36
Ok that's the issue as a save operation in full page edit will call save on all sections in that page now.

just set the full page edit attribute on the page and remove those calls you make to save each section. You don't need to do that anymore. Just save the top section and all will be saved.

SpringBox
2014-04-07, 11:49
Hi Barry

Thanks - both of those 2 make sense. Will try the app center in a bit.

If we have Full page edit AND Refresh when activated both ticked, is it still sensible to call our (albeit now just the top section each time) EDIT function on Page.Activate and our SAVE function on Page.Deactivate or are we going to be "treading on our own feet"?

Thanks

SpringBox

SpringBox
2014-04-07, 12:27
Hi Barry

Cant't get that to work & selecting Full page edit often crashes Lianja.

With Full page edit selected, when we editmode the top section only the top section is set to editmode, the other sections are unaffected.

Lianja.showDocument("page:PageName.TopSectionName?action=editmode")


Issuing a save (now of just the top section)
Lianja.showDocument("page:PageName.TopSectionName?action=save")

saves only the top section. We have reloaded the pages.

Re performance - it seems to be the save.

Page has 9 sections & 96 fields

table has 2 records & 218 fields. Table is part of database. Table has 1 index.

A save takes on average 24 seconds on a fast PC - there must be something wrong !!

There is nothing going on other than a save. We are missing something.

Hope this helps

Cheers

SpringBox

barrymavin
2014-04-07, 20:20
There is a full page edit example in the distro and it works just fine, I explained about the save. So I need to take a look at your app and investigate what you are doing that is causing this behavior.

You probably still have some legacy delegates in somewhere that are not playing well with full page edit and full page save across multiple sections.

barrymavin
2014-04-07, 20:23
One save is enough as I previously explained.

barrymavin
2014-04-07, 20:27
You edit the page not the section. It's full page edit. So you just issue the edit on a page using showDocument()

barrymavin
2014-04-07, 21:32
I have made some changes in Beta11 that should resolve this. Try that later today and let me know.

I am assuming you resolved your issue with the app.init() delegate creating public variables?

barrymavin
2014-04-07, 21:41
The "Full page edit App" included as an example shows this in operation. It is working fine. I suspect this issue is fixed in the next v1.1beta11 build. When I release betas they are a snapshot of development at that point. This is close to release so I need to make sure I have fixed this issue that you are experiencing calling delegates when operations are in progress. I have taken care of this scenario now.

634

SpringBox
2014-04-08, 07:24
Hi Barry

Yes, the variables going out of scope works great now - thank you. INIT(), LOAD() and READY() are now all procs in a custom library.

INIT() defines the PUBLIC variables
LOAD() opens the database and tables
READY() sets the public variables to their values, read from the tables or hard coded

Not quite sure what you meant by "some legacy delegates". All our delegates call either procs in custom libraries or call the prgs created automatically by Lianja. Do we need to do anything else?

We are going to spread the sections over more pages as the pages have got too big.

Thanks for the heads up about Page edit.

I guess we should be issuing showdocument("page:PageName?action=editmode")

and then

showdocument("page:PageName?action=save").

Will try Beta 11 & report back.

Thanks for your prompt reply - much appreciated.

Cheers

SpringBox

SpringBox
2014-04-08, 07:40
Hi Barry

Have tried the full page edit in Beta 10 - edit now works great, but same issue with the save performance. In this app, we don't "save" from the UI, we always call "save" in code - normally when the user switches pages.

As soon as Beta 11 is up, will try that & let you know.

Thanks

SpringBox

barrymavin
2014-04-08, 07:50
Yes v1.1Beta11 is currently on its way.

FYI the App delegates was the only place where we were creating separate files -- which was wrong -- and it caused issues in the web/mobile so I changed it.

These now work in web/mobile when you have JavaScript App delegates. So the delegate handling is now consistent across App, Pages, Sections and FormItems. Thats why it was changed.

SpringBox
2014-04-08, 09:05
Hi Barry

Beta 11 - what a difference !! Fast, slick & just as it should be - thank you :cool:

The Page edits / saves work perfectly & the whole app is much faster.

Cheers

SpringBox

barrymavin
2014-04-08, 09:07
Thats good. Close to release now.