Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Progress monitoring for a console app

Reply
Thread Tools

Progress monitoring for a console app

 
 
Roedy Green
Guest
Posts: n/a
 
      01-26-2006
What sorts of trick have you used in console-only apps to let the user
know the program is still alive without filling up screens full of
junk?

For guis, see http://mindprod.com/jgloss/progress.html
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
 
 
 
IchBin
Guest
Posts: n/a
 
      01-26-2006
Roedy Green wrote:
> What sorts of trick have you used in console-only apps to let the user
> know the program is still alive without filling up screens full of
> junk?
>
> For guis, see http://mindprod.com/jgloss/progress.html


For the HSQLDB product, in the package
org.hsqldb.util.DatabaseManagerSwing class I could not add a progress
bar because it did not make sense for this app. I added a panel at the
bottom of the screen with a button(with Icon) and a JLabel as my output
status message area. Then wrote a method so other methods could set the
status icon(red or Green) and message based on processing mode. So
visually you would know the states and what it was or was not doing.

If you do not have the product I have some screenshots here:
http://weconsultants.servebeer.com/JHackerAppManager/Portal?xpc=1$@5

To setup the status panel it went something like this..

jStatusLine = new JLabel();
iReadyStatus = new JButton(new
ImageIcon(CommonSwing.getIcon("StatusReady")));
iReadyStatus.setSelectedIcon(
new ImageIcon(CommonSwing.getIcon("StatusRunning")));
pStatus = new JPanel();
pStatus.setLayout(new BorderLayout());
pStatus.add(iReadyStatus, BorderLayout.WEST);
pStatus.add(jStatusLine, BorderLayout.CENTER);
fMain.getContentPane().add(pStatus, "South");

The source for the HSQLDB project can be found at their website if you
want to look at...either download the jar file or look at it cvs
http://hsqldb.org/

Thanks in Advance...
IchBin, Pocono Lake, Pa, USA
http://weconsultants.servebeer.com/JHackerAppManager
__________________________________________________ ________________________

'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
Reply With Quote
 
 
 
 
Gordon Beaton
Guest
Posts: n/a
 
      01-26-2006
On Thu, 26 Jan 2006 02:45:52 GMT, Roedy Green wrote:
> What sorts of trick have you used in console-only apps to let the
> user know the program is still alive without filling up screens full
> of junk?


This is a classic mechanism:

static char spins[] = { '-', '\\', '|', '/' };
static int pos = 0;

static void spinner() {
System.out.print(spins[pos] + "\r");
pos = (pos + 1) % 4;
}

Call spinner() occasionally while doing your work. It gives the user
an indication that the program hasn't died as well as some idea of the
rate it's progressing.

You get a similar effect with "bubbles" instead:

static char bubbles[] = { '.', 'o', 'O', 'o', '.' };

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
Reply With Quote
 
jcsnippets.atspace.com
Guest
Posts: n/a
 
      01-26-2006
"Gordon Beaton" <> wrote in message
news:43d8817d$...
> On Thu, 26 Jan 2006 02:45:52 GMT, Roedy Green wrote:
> > What sorts of trick have you used in console-only apps to let the
> > user know the program is still alive without filling up screens full
> > of junk?

>
> This is a classic mechanism:
>
> static char spins[] = { '-', '\\', '|', '/' };
> static int pos = 0;
>
> static void spinner() {
> System.out.print(spins[pos] + "\r");
> pos = (pos + 1) % 4;
> }
>
> Call spinner() occasionally while doing your work. It gives the user
> an indication that the program hasn't died as well as some idea of the
> rate it's progressing.


I was going to suggest calculating the percentage of work that still needs
to be done, and writing that to the screen. If 1% of the work would take a
long time, the user still wouldn't have a clue whether or not the program
had died.

Very nice classic!

Kind regards,

JC
--
http://jcsnippets.atspace.com
a collection of source code, tips and tricks


 
Reply With Quote
 
Roedy Green
Guest
Posts: n/a
 
      01-27-2006
On 26 Jan 2006 08:59:57 +0100, Gordon Beaton <> wrote,
quoted or indirectly quoted someone who said :

>static char spins[] = { '-', '\\', '|', '/' };
> static int pos = 0;
>
> static void spinner() {
> System.out.print(spins[pos] + "\r");
> pos = (pos + 1) % 4;
> }

I have gussied this up a bit and written test harness.

This code won't work in Eclipse or Macs.

see http://mindprod.com/jgloss/progress.html#CONSOLE
--
Canadian Mind Products, Roedy Green.
http://mindprod.com Java custom programming, consulting and coaching.
 
Reply With Quote
 
Gordon Beaton
Guest
Posts: n/a
 
      01-30-2006
On Fri, 27 Jan 2006 00:27:40 GMT, Roedy Green wrote:
> On 26 Jan 2006 08:59:57 +0100, Gordon Beaton <> wrote,
> quoted or indirectly quoted someone who said :
>
>>static char spins[] = { '-', '\\', '|', '/' };
>> static int pos = 0;
>>
>> static void spinner() {
>> System.out.print(spins[pos] + "\r");
>> pos = (pos + 1) % 4;
>> }

> I have gussied this up a bit and written test harness.


Too bad a plugin is required to see that.

> This code won't work in Eclipse or Macs.


Try \b instead of \r, which should work on more platforms and has the
added advantage that you can use the spinner at the *end* of a line
with some text explaining what's going on:

Please wait while your disk is reformated...

(you get the idea).

/gordon

--
[ do not email me copies of your followups ]
g o r d o n + n e w s @ b a l d e r 1 3 . s e
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem with Assembly.LoadFrom with web app, not unit test console type app. pkellner ASP .Net 0 04-27-2007 03:34 PM
Progress bar to show the progress of a task Charlie Zhang Java 3 08-16-2004 05:53 PM
console app w/o seeing console? Kris Rudin ASP .Net Datagrid Control 1 11-11-2003 10:23 PM
Re: console mp3->wav decoder for $indows or GUI one which supports console Egor Bolonev Python 0 06-30-2003 10:43 AM
Re: console mp3->wav decoder for $indows or GUI one which supports console Ben Finney Python 2 06-30-2003 05:43 AM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57