* Progress Bar and Search and Return Result Set Plug

For users to report plugin bugs and request plugin enhancements; and for authors to test new/new versions of plugins, and to discuss plugin development (in the Programming Technicalities sub-forum). If you want advice on choosing or using a plugin, please ask in General Usage or an appropriate sub-forum.
Post Reply
User avatar
Jane
Site Admin
Posts: 8441
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Progress Bar and Search and Return Result Set Plug

Post by Jane » 22 Oct 2012 17:54

I have been using some of the new techniques on the progress bar snippet and the search and return result set.

Progress Bar
https://www.dropbox.com/s/h05sqsocymgk9 ... ess.fh_lua


Search and Return Result Set
https://www.dropbox.com/s/sel0am57ywoco ... Set.fh_lua

Before I upload the latter to the store please could some one check I have not done anything stupid with it.

Also thoughts on the Progress Bar appreciated.

ID:6545
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27079
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Progress Bar and Search and Return Result Set Plug

Post by tatewise » 23 Oct 2012 11:23

I have started looking at these two.

Progress Bar
The concept seems fine, but I would like to add some refinements.

1) See my Run Time & Memory Use Advice ~ Progress Bar.
I would like to encapsulate this feature in the prototype function, and will update the code appropriately.

2) I prefer the gauge to show elapsed time as well as percentage, but this also has a run time impact.
Is there a way of choosing one of two alternative Step functions when the closure function is constructed?
I will experiment with some ideas.

3) I have some other refinements of the IUP dialogue, such as button colour, and window positioning.
I will update the code appropriately.

Search and Return Result Set
I am struggling a little with the lack of comments, but here goes:

1) On line 113 should pWhole be pmWhole?
If so, the lines 115 & 116 can be deleted.
On line 127 strReplaceWith3 is undefined (as it was in V1.3) and I think can be deleted.
The rest of the code looks and runs OK, except as noted below, but I have not inspected it in depth.

2) If the Search For: string is 'popular' like the letter e and the GEDCOM is moderately large, the Plugin can take a long time, and FH says (Not Responding).
The old V1.3 does not have this problem!!!
Making the corrections in 1) above seems to fix the problem.

3) V1.4 is finding significantly less matches than V1.3.
I am investigating why ... found it!
V1.4 is not finding trailing matches.
Line 111 should be strSearch = nocase(strSearch)
In the next few lines the right-hand sides should use strSearch instead of strSearchFor

4) Neither version copes with 'magic' characters in Plain Text Search mode.
(Also V1.3 does not work with Case Sensitive ticked)
V1.4 line 108 needs if pmPlain == 1 then strSearch = strPlainText(strSearch) end inserting.

5) Debugging Closure Prototype Functions is not supported!
For example in v1.4 put a break point inside the anonymous function inside newSearch.
None of the variable such as iPos,iPos2,iPos3 appear in the Variables pane bottom right.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8441
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Progress Bar and Search and Return Result Set Plug

Post by Jane » 23 Oct 2012 12:14

I have tweaked both, the links should be the same.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27079
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Progress Bar and Search and Return Result Set Plug

Post by tatewise » 23 Oct 2012 13:02

I will look at that revised Progress Bar.

I cannot detect any changes to Return Result Set.
Also you may not have noticed the extra comments edited into my posting above.
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8441
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Progress Bar and Search and Return Result Set Plug

Post by Jane » 23 Oct 2012 15:36

Debugging Closure Prototype Functions is not supported!
It will be in the next release. In the meantime print() is your friend.

Thanks for looking, I have updated both, if you don't get the revised version of the search (with local escape function), let me know and I'll build another link in dropbox.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27079
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Progress Bar and Search and Return Result Set Plug

Post by tatewise » 23 Oct 2012 23:48

Got both revised versions.

Return Result Set
Works fine but thought escape(s) function might use s:gsub('(%W)','%%%1') from StrPlainText Code Snippet?

Progress Bar
The idea of checking percent to improve performance is brilliant - wish I had thought of it.
Just need to make end users aware that on very long runs the progress will only step each 1% increase.
i.e. If run time is 1 hour, each step will occur every 36 seconds, but in between will appear to have stopped.

I have added an optional table parameter to pass parameters, as for the Soundex prototype function.
The button function should NOT return iup.CLOSE because I found that it sometimes closes the main GUI!
I prefer a 99% HH : MM : SS display all on one line.
The Step function also has a dlgGauge.bringfront='YES' to prevent bar being hidden.
Is the Message function still really needed?
The functions with parameters all cope with any parameter missing.
e.g. ProgressBar.Start() and ProgressBar.Step() both work OK.

I have applied my own coding and naming style.

ProgressBar:
http://www.users.freenetname.co.uk/~mik ... Bar.fh_lua
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8441
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Progress Bar and Search and Return Result Set Plug

Post by Jane » 24 Oct 2012 08:12

I found the plain text function escaped more than it needed, as all non alphanumerics were escaped.

For my use the Message function is useful, as it means I can put out more detailed information if needed, eg the name of the record being processed, (which might be handy when doing a long run).
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

User avatar
tatewise
Megastar
Posts: 27079
Joined: 25 May 2010 11:00
Family Historian: V7
Location: Torbay, Devon, UK
Contact:

Progress Bar and Search and Return Result Set Plug

Post by tatewise » 24 Oct 2012 12:44

Search and Return Result Set
Does escaping more than is needed impact the run time of the searches?
If not, then s:gsub('(%W)','%%%1') is much easier to understand.
If there is a significant run time impact, then the Plain Text Substitution (code snippet) should use your alternative pattern.

I guess the gsub('%z','%%z') is just in case a pasted search string contains zero code chars.

Progress Bar
The link above provides an updated version, that reinstates the Message function.

It also adds a few more defensive and other tweaks:
The external Font parameter now affects the whole dialogue.
The width of the Stop button is adjusted according to the length of strTitle.
The dialogue controls all have tool tips.
The Step function adapts to fast and slow progress by using intScale, so that the Bar is updated every 1% or about every 1 sec, whichever is the sooner.
Note that the window position is remembered from one run to the next in the parameter table.

Shall I add this version to the Progress Bar (code snippet) as Code Version 2, similar to Soundex, with various examples of use?
Mike Tate ~ researching the Tate and Scott family history ~ tatewise ancestry

User avatar
Jane
Site Admin
Posts: 8441
Joined: 01 Nov 2002 15:00
Family Historian: V7
Location: Somerset, England
Contact:

Progress Bar and Search and Return Result Set Plug

Post by Jane » 24 Oct 2012 16:39

Please feel free to add the progress bar as a second option. May be put it as the primary and the other as another example.

The latest version of Search and Return Result Set is in the plugin store.
Jane
My Family History : My Photography "Knowledge is knowing that a tomato is a fruit. Wisdom is not putting it in a fruit salad."

Post Reply