Hey,
I have a task that may take longer to execute (several minutes), so I felt I got to have a fancy progress bar on the command line to entertain me.
No progress bar though, found this in the archives: https://mailman.uni-konstanz.de/pipermail/basex-talk/2020-November/015845.ht...
So this is the closest I got (running BaseX from an Ant task):
xquery_update_db: [echo] XQuery Update (Database) wird ausgeführt: xquery/basex.reduce.xquery [apply] EXPORTER: omit-xml-declaration=no [apply] Database 'DEBUGX' was opened in 113.62 ms. [apply] "FORTSCHRITT: 0%" [apply] "FORTSCHRITT: *****5%" [apply] "FORTSCHRITT: **********10%" [apply] "FORTSCHRITT: ***************15%" [apply] "FORTSCHRITT: ********************20%" [apply] "FORTSCHRITT: *************************25%"
While I am happy enough with this (it is quite accurate and I like the dramatically mounting effect), can anyone say what might be needed to implement this as a module?
Daniel
Hi Daniel,
can anyone say what might be needed to implement this as a module?
Looks interesting! I hope our Wiki article on creating and installing modules is helpful [1].
Cheers, Christian
[1] https://docs.basex.org/wiki/Repository
Daniel
Thanks, I was hoping there might be some way to update the output result instead of simply adding to output. I just ran a 420 minutes regular expressions query, which I might be going to optimize now because there is not much visible progress anymore :-P
-----Ursprüngliche Nachricht----- Von: Christian Grün christian.gruen@gmail.com Gesendet: Donnerstag, 9. März 2023 17:25 An: Zimmel, Daniel D.Zimmel@ESVmedien.de Cc: basex-talk@mailman.uni-konstanz.de Betreff: Re: [basex-talk] Progress bar (again)
Hi Daniel,
can anyone say what might be needed to implement this as a module?
Looks interesting! I hope our Wiki article on creating and installing modules is helpful [1].
Cheers, Christian
[1] https://docs.basex.org/wiki/Repository
Daniel
Thanks, I was hoping there might be some way to update the output result instead of simply adding to output. I just ran a 420 minutes regular expressions query, which I might be going to optimize now because there is not much visible progress anymore :-P
Sorry, now I got it. You could try something like this:
for $i in 1 to 100 let $string := string-join(( (: yields 
, and jumps to the beginning of the current line :) string:cr(), 'FORTSCHRITT: ', (1 to $i idiv 5) ! '.', $i, '%' )) return ( prof:sleep(50), (: calls System.err.println($string) :) Q{java.lang.System}err() => Q{java.io.PrintStream}print($string) )
I think we won’t offer a built-in function for that, as the result of functions like fn:trace, prof:dump, etc. will be sent to different output channels, some of which won’t allow the overwriting of output that has previously been sent.
Hope this helps, Christian
Yes, this works great in the console! However I can see why it is better to stick to the standard functions. In my case, this does not work when running via an Ant apply task, since Ant has its own loggers and is doing something internally which prevents jumping to the start of the line. Perhaps there is a way to do this with Ant, but I do not think this is a good idea for portability...
Thanks for the insight, Daniel
-----Ursprüngliche Nachricht----- Von: Christian Grün christian.gruen@gmail.com Gesendet: Mittwoch, 15. März 2023 17:37 An: Zimmel, Daniel D.Zimmel@ESVmedien.de Cc: basex-talk@mailman.uni-konstanz.de Betreff: Re: [basex-talk] Progress bar (again)
Thanks, I was hoping there might be some way to update the output result instead of simply adding to output. I just ran a 420 minutes regular expressions query, which I might be going to optimize now because there is not much visible progress anymore :-P
Sorry, now I got it. You could try something like this:
for $i in 1 to 100 let $string := string-join(( (: yields 
, and jumps to the beginning of the current line :) string:cr(), 'FORTSCHRITT: ', (1 to $i idiv 5) ! '.', $i, '%' )) return ( prof:sleep(50), (: calls System.err.println($string) :) Q{java.lang.System}err() => Q{java.io.PrintStream}print($string) )
I think we won’t offer a built-in function for that, as the result of functions like fn:trace, prof:dump, etc. will be sent to different output channels, some of which won’t allow the overwriting of output that has previously been sent.
Hope this helps, Christian
basex-talk@mailman.uni-konstanz.de