LucaMs Expert Licensed User Longtime User Apr 6, 2017 #81 LucaMs said: ... and since I thought this, I wanted tried and it seems that it is not so: a log was executed after StartMessageLoop, I did not wrote StopMessageLoop and I did not stop the server Click to expand... Repeated the test right now... the log after StartMessageLoop was not reached (executed)
LucaMs said: ... and since I thought this, I wanted tried and it seems that it is not so: a log was executed after StartMessageLoop, I did not wrote StopMessageLoop and I did not stop the server Click to expand... Repeated the test right now... the log after StartMessageLoop was not reached (executed)
LucaMs Expert Licensed User Longtime User Apr 6, 2017 #82 This is "funny" Yesterday I tried writing Code: Copy StartMessageLoop Log("Ok") Watching the log tab I saw: Update DuckDNS: OK and glancing, I thought that was my OK (I let myself be influenced by the quiz )
This is "funny" Yesterday I tried writing Code: Copy StartMessageLoop Log("Ok") Watching the log tab I saw: Update DuckDNS: OK and glancing, I thought that was my OK (I let myself be influenced by the quiz )
LucaMs Expert Licensed User Longtime User Apr 6, 2017 #83 Anyway, that quiz shows that you can lose yourself, like in "spaghetti programming". Here you might think that I am criticizing the new features; go with the flow can be hard but to have a simulated multi-thread can be helpful. Last edited: Apr 6, 2017
Anyway, that quiz shows that you can lose yourself, like in "spaghetti programming". Here you might think that I am criticizing the new features; go with the flow can be hard but to have a simulated multi-thread can be helpful.
Erel B4X founder Staff member Licensed User Longtime User Apr 6, 2017 #84 The confusing part of the quiz was actually related to StartMessageLoop / StopMessageLoop. Most developers never need to deal with the message loop as it is only related to non-ui projects and in most cases it ends with a simple call to StartMessageLoop.
The confusing part of the quiz was actually related to StartMessageLoop / StopMessageLoop. Most developers never need to deal with the message loop as it is only related to non-ui projects and in most cases it ends with a simple call to StartMessageLoop.
Erel B4X founder Staff member Licensed User Longtime User Apr 6, 2017 #85 More "real world" example of using the new Wait For feature to get information from a remote database using jRDC2: The standard way to send a request with jRDC2: 1. Call req.ExecuteQuery. 2. Handle JobDone event and call Manager.HandleJobAsync. 3. Handle the Result event. All the results are handled by the same two subs so you use the Tag parameter to distinguish between different requests. It becomes more and more complicated when you add more types of requests. With the new Wait For feature everything can be handled locally inside the sub. Note that it can be called multiple times safely. Code: Copy Sub GetRecord (id As Int) Dim req As DBRequestManager = CreateRequest Dim cmd As DBCommand = CreateCommand ("select", Array(id)) Dim j As HttpJob = req.ExecuteQuery(cmd, 0) Wait For (j) JobDone(j As HttpJob) '<---- catch the relevant JobDone event here If j.Success Then req.HandleJobAsync(j) Wait For (req) Result(res As DBResult) '<---- catch the relevant Result event here Log ("Result for id: " & id) req.PrintTable(res) Else Log("ERROR: " & j.ErrorMessage) End If j.Release End Sub No need to use tags or to use any global variable to understand which request has returned.
More "real world" example of using the new Wait For feature to get information from a remote database using jRDC2: The standard way to send a request with jRDC2: 1. Call req.ExecuteQuery. 2. Handle JobDone event and call Manager.HandleJobAsync. 3. Handle the Result event. All the results are handled by the same two subs so you use the Tag parameter to distinguish between different requests. It becomes more and more complicated when you add more types of requests. With the new Wait For feature everything can be handled locally inside the sub. Note that it can be called multiple times safely. Code: Copy Sub GetRecord (id As Int) Dim req As DBRequestManager = CreateRequest Dim cmd As DBCommand = CreateCommand ("select", Array(id)) Dim j As HttpJob = req.ExecuteQuery(cmd, 0) Wait For (j) JobDone(j As HttpJob) '<---- catch the relevant JobDone event here If j.Success Then req.HandleJobAsync(j) Wait For (req) Result(res As DBResult) '<---- catch the relevant Result event here Log ("Result for id: " & id) req.PrintTable(res) Else Log("ERROR: " & j.ErrorMessage) End If j.Release End Sub No need to use tags or to use any global variable to understand which request has returned.
Widget Well-Known Member Licensed User Longtime User Apr 6, 2017 #86 Erel, keep those examples coming because it stimulates our brain cells. Could it also be used to fill a CustomListView (from SQLite or remotely) in the background when the user scrolls in that direction? If there is a large database table of 100k rows, ideally only around 200 entries in the CustomListView needs to be filled at any one time in order to conserve memory and save time loading the data. As he scrolls to the end of the loaded data, new data is added to that end of the CustomListView and the older CLV entries are removed.
Erel, keep those examples coming because it stimulates our brain cells. Could it also be used to fill a CustomListView (from SQLite or remotely) in the background when the user scrolls in that direction? If there is a large database table of 100k rows, ideally only around 200 entries in the CustomListView needs to be filled at any one time in order to conserve memory and save time loading the data. As he scrolls to the end of the loaded data, new data is added to that end of the CustomListView and the older CLV entries are removed.
Erel B4X founder Staff member Licensed User Longtime User Apr 7, 2017 #87 See this example: https://www.b4x.com/android/forum/threads/35761/#content I don't think that resumable subs will help in this case. They can help if you want to load many items and show a progress bar while they load (as a good / working alternative to DoEvents).
See this example: https://www.b4x.com/android/forum/threads/35761/#content I don't think that resumable subs will help in this case. They can help if you want to load many items and show a progress bar while they load (as a good / working alternative to DoEvents).
S susu Well-Known Member Licensed User Longtime User Apr 9, 2017 #88 I need this Resumable Sub badly as I'm facing problem to get all results from Httpjob. https://b4x.com/android/forum/threads/http-server-with-httpjob-is-not-sync.78206/ I wish Erel could release it tomorrow
I need this Resumable Sub badly as I'm facing problem to get all results from Httpjob. https://b4x.com/android/forum/threads/http-server-with-httpjob-is-not-sync.78206/ I wish Erel could release it tomorrow
LWGShane Well-Known Member Licensed User Longtime User Apr 9, 2017 #89 @susu - I'm in agreement. I have a big project planned and these features would do wonders for the project.
@susu - I'm in agreement. I have a big project planned and these features would do wonders for the project.
Erel B4X founder Staff member Licensed User Longtime User Apr 9, 2017 #90 The B4J implementation is almost ready to be released as a beta. It will probably be released in two weeks.
The B4J implementation is almost ready to be released as a beta. It will probably be released in two weeks.
S susu Well-Known Member Licensed User Longtime User Apr 9, 2017 #91 Erel said: The B4J implementation is almost ready to be released as a beta. It will probably be released in two weeks. Click to expand... And how about B4A?
Erel said: The B4J implementation is almost ready to be released as a beta. It will probably be released in two weeks. Click to expand... And how about B4A?
LWGShane Well-Known Member Licensed User Longtime User Apr 9, 2017 #92 susu said: And how about B4A? Click to expand... Probably like this: B4J: Beta: April/May - GM: May/June B4A: Beta: May/June - GM: June/July You get the idea. Note that "GM" means "Golden Master".
susu said: And how about B4A? Click to expand... Probably like this: B4J: Beta: April/May - GM: May/June B4A: Beta: May/June - GM: June/July You get the idea. Note that "GM" means "Golden Master".
S susu Well-Known Member Licensed User Longtime User Apr 10, 2017 #93 How about: B4J: Beta: Today - GM: Today+1 B4A: Beta: Tomorrow - GM: Tomorrow+1 Just kidding, I know Erel is super-man but he need to take a rest before continue to save our world
How about: B4J: Beta: Today - GM: Today+1 B4A: Beta: Tomorrow - GM: Tomorrow+1 Just kidding, I know Erel is super-man but he need to take a rest before continue to save our world
Erel B4X founder Staff member Licensed User Longtime User Apr 10, 2017 #94 It will take some time until the B4A implementation is ready. B4i will probably be available before.
XbNnX_507 Active Member Licensed User Longtime User Apr 14, 2017 #95 Code: Copy Sub Resumable sql.ExecQueryAsync(eventSQL, QUERY, Null) wait for eventSQL_QueryComplete (Success As Boolean, Crsr As ResultSet) ' <- is this method gonna be IDE automcompleted or we have to know it beforehand? End Sub
Code: Copy Sub Resumable sql.ExecQueryAsync(eventSQL, QUERY, Null) wait for eventSQL_QueryComplete (Success As Boolean, Crsr As ResultSet) ' <- is this method gonna be IDE automcompleted or we have to know it beforehand? End Sub
Erel B4X founder Staff member Licensed User Longtime User Apr 14, 2017 #96 It will be auto completed, just like with event subs (space followed by tab).
ilan Expert Licensed User Longtime User Apr 27, 2017 #97 i just downloaded b4j beta and tried the resumeablesub function. before i downloaded b4j beta i was wondering if i could use the Sleep function in games inside a timer_tick or any game engine update event. and i was surprised that it worked. the tick event kept working and the code after the sleep function was called after the chosen time. so thumbs up for that! great work erel i hope the b4i update is near
i just downloaded b4j beta and tried the resumeablesub function. before i downloaded b4j beta i was wondering if i could use the Sleep function in games inside a timer_tick or any game engine update event. and i was surprised that it worked. the tick event kept working and the code after the sleep function was called after the chosen time. so thumbs up for that! great work erel i hope the b4i update is near
Erel B4X founder Staff member Licensed User Longtime User Apr 27, 2017 #98 ilan said: i hope the b4i update is near Click to expand... It is.