аЯрЁБс>ўџ >@ўџџџ=џџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџџьЅСM №ПФbjbjт=т= 8€W€WЁ"џџџџџџl$$$$$$$8   8B N48Ÿ*ŽŽЄЄЄЄЄЄ      $Щ щdD$ЄЄЄЄЄDЮ$$ЄЄYЮЮЮЄŒ$Є$ЄЮЄЮќЮЪ$$ЪЄ‚ р€ОјппС8в 0LЪЪTo0ŸЪM|RMЪЮ88$$$$йProgress Bar for nhCreateDb (or any other ascii/console app). Joe Kuefler 10-Apr-2002. This meeting came about because, having just installed eHealth on solaris, I commented about the lack of a progress bar for the Oracle installer portion of INSTALL.NH. Among the database group there seemed to be an immediate agreement and a request for me to share my approach with our group and a handful of other Concord folks. Q. How would one add a progress bar to a thing like nhCreateDb, as called by INSTALL.NH? A. The simplest way that I can think of is to make a simple modification to INSTALL.NH (not nhCreateDb) as follows. Currently INSTALL.NH invokes nhCreateDb (at around line 9181) like this: display \ "Database will now be created and can be watched in ${LOG_FILE}" ${NH_HOME}/bin/nhCreateDb -S doit >> ${LOG_FILE} 2>&1 I would simply “slip” a filter in between nhCreateDb and its log file which “taps” the traffic going by and uses this traffic to pump a progress bar (kind of like a hydroelectric generator on a river). The only thing that would be hardcoded in this case, is the approximate number of total lines expected in the log file. I admit its simplistic (since not all log lines are created equally and a “create tablespace” statement is going to take a LOT longer than “create view”, but since there is current NO progress bar at all, its still a huge improvement). Currently, I count about 33,676 lines in the solaris nhCreateDb output. display \ "Database will now be created and can be watched in ${LOG_FILE}" ${NH_HOME}/bin/nhCreateDb -S doit | CreateDbFilter ${LOG_FILE} 2>&1 The ksh function CreateDbFilter would look something like this: CreateDBFilter () { LogFile=”$1” Expected=33676 # ( hardcoded expected lines of nhCreateDb output SoFarNow=0 pbar START $Expected # ( start progress bar while read line do SoFarLast=$SoFarNow SoFarNow=$(expr $SoFarNow + 1) pbar ADD $Expected $SoFarLast $SoFarNow # ( output possible tick[s] echo “$line” >> $LogFile # ( send nhCreateDb to log file done pbar END $Expected $SoFar # ( end progress bar } # CreateDbFilter The only thing in the CreateDbFilter function that is specific to nhCreateDb is the hardcoded number of lines which will be flying by (set to 33676 above). If this were passed in as $2 to the function, we could make a general purpose ksh function and call it something like: ProgressBarWhileLogging (or whatever). % pbar pbar -- general purpose 'stateless' progress bars for ascii (console) apps usage: pbar [...args...] This command-line utility supports two completely different types of progress bar: PBAR and SLIDER. PBAR : is used for progress bars that are intermingled with other output, or for when you have the luxury of repositioning the cursor to the same location (through libcurses or your own escape sequences). [||||||||||||||||||:::::::::::::::] SLIDER : is used when you can suppress (or redirect) extraneous output so that the *only* thing being output is the progress bar itself. Because the slider is stateless, it needs to know both the 'current progress' *and* the 'last progress' so it can compute the 'progress delta.' v_________________________________v ||||||||||||||||||||||||||| | command line help: pbar PBAR help -or- pbar SLIDER help history: Apr 2002 : jkuefler created % pbar PBAR help usage: pbar PBAR [ [ []]] where: PBAR : tells pbar to produce an entire bar (not a SLIDER) : total steps expected (unsigned int up to 2147483647) : steps encountered (percent done is SoFar / Expected) : total width that the bar is restricted to (defaults to 75) : character used to display the 'done' portion of bar : character used to display the 'non-done' portion of bar example command line invocations: pbar PBAR 200 50 25 [||||||::::::::::::::::::] pbar PBAR 200 120 25 [||||||||||||||::::::::::] pbar PBAR 200 150 25 [||||||||||||||||||::::::] live simulation: pbar PBAR DEMO [ []] % pbar SLIDER help SLIDER usage: pbar START [ []] pbar ADD [ []] pbar END [] where: : is either START, ADD or END (see below) START : outputs the leader row: v____...____v and an opening bar ADD : outputs zero or more 'ticks,' depending the progress delta END : pads out the rest of the slider and closes it with a bar : total steps expected (unsigned int up to 2147483647) : steps encountered (percent done is SoFar / Expected) : total width that the bar is restricted to (defaults to 75) : character used to display the 'done' portion of bar example command line invocations: v_________________________v pbar START 200 25 | pbar ADD 200 0 50 25 ||||||| pbar ADD 200 120 150 25 ||||||||||||||||||| pbar END 200 150 25 ||||||||||||||||||| | live simulation: pbar SLIDER DEMO [ []] FYI: I wrote “pbar” in c and ported it to solaris, hpux and win32: -rw-rw-r-- 1 jkuefler software 14203 Apr 9 10:29 pbar.cpp -rwxrwxr-x 1 jkuefler software 28672 Apr 9 10:29 hpux/pbar* -rwxrwxr-x 1 jkuefler software 19192 Apr 9 10:29 solaris/pbar* -rwxrwxr-x 1 jkuefler software 53760 Apr 9 10:30 win32/pbar.exe* The source code and executables are located in: /home/eng/jkuefler/src/misc pbar jkuefler page -  PAGE 3 XN k В ж й ѕ і Q R х ц   b c t u Š Ÿ Ж ЁЖЗНОПРУФјѓјѓјѓјујујујујујѓјѓјѓмймбмѓ0JmHnHu0J j0JU jп№5OJQJ\mHnHuOJQJ5OJQJ\XYЄЅўџНОаWXб в н & p q Б В Х Ш з % 2 3 f g ђ№№№№№№№№№№№№№№№№№№№№№№№№№№№ $-D MЦ џ a$ЁУ§§g y ~ • З џ < C D u v Š ‹ Ц Ч Щ а б ?@…ЄЅч+rœ§§§§§§§§§§§§§§§§§§§§§§§§§§§§§ф&jЖр  IJSqrstuvwx‰Šжзо!fЋ§§§§§§§§§§§§§§ѓѓѓѓэ§§§§§§§§ ЦрР! $dNЦџЋі:‚ƒЅнMN_“”–—ЊЋЌКэ7ijqЉђ=†Ы§§§§§§§§§§§§§§§§§§§§§§§§§§§§§[Ÿ р2jЊЋМёђѓєѕіїјљњ=>~СMN§§§§§§§§§§§§§§§§§ѓ§§§§§§§§§§ $dNЦџNOP€Ÿ ЁСТУФ§§§§§§є§§§  Ц рР!Ьж) Аа/ Ар=!Аа"Аа# $ %А i0@ёџ0 Normal_HmH sH tH <A@ђџЁ< Default Paragraph Font,@ђ, Header  ЦрР!, @, Footer  ЦрР!&)@Ђ& Page NumberФ 8 џџџџXYЄЅўџНОаWXбвн&pqБВХШз%23fgy~•Зџ<CDuvŠ‹Ц Ч Щ а б   ? @ … Є Ѕ ч + r œ  ф & j Ж р  I J S q r s t u v w x ‰ Š ж з о !fЋі:‚ƒЅнMN_“”–—ЊЋЌКэ7ijqЉђ=†Ы[Ÿ р2jЊЋМёђѓєѕіїјљњ=>~СMNOP€Ÿ ЁСХ˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜@0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€˜0€€š@0€€ !!!$Фg ЋNФУ$!Tџ•€*/—›Ђйу[e‘›0:>B‚Œ@IюјЖНОШ;EIMP^ux‚ГСЪбї'/59ŠŒ”˜ ЃЇЉБКОЮзйс%/FJZ_{‰ЁЏЭзпшv y Ÿ Ж Ы Я б е  $ ( 6 : I R М п $ % ) 8 < z ~  ƒ ‘ • – š Ї Ќ А И М Ф Ш б є ј PSin™žЎЖљ=FЇЋЌАпуфш aefjqvz‚†™НСенсщ№є'+3:>QZ^fЕИЮгў^fФптц 48lpОТаейсхэ $+-1?Fu}€‡ЖПТЩј–žЁЅТХЦЭ™ПRWЄЇгк59in{}КО>BFJѓўЫ Я б е  " …  Ѕ Ћ ч э + - ‹ š  Ѕ ф ц j s М Н  $ J Q Y _ z ~ Š  з м р э ,0nuЖКFIƒŠЇЋпуNRae™НС№є:>joz€ЋИє?L‘•гкfj Їтц 48lpЋЏОТ?A€‡ТЩЁЅТХ3333333333333333333333333333333333333333333333333333333333333333333333E+1WiЁ ЁЖРХџџJoseph Kuefler]C:\WINNT\Profiles\jkuefler\Application Data\Microsoft\Word\AutoRecovery save of Document2.asdJoseph KueflerK:\jkuefler\src\misc\pbar.docJoseph KueflerK:\jkuefler\src\misc\pbar.docJoseph KueflerK:\jkuefler\src\misc\pbar.docJoseph KueflerK:\jkuefler\src\misc\pbar.docJoseph KueflerK:\jkuefler\src\misc\pbar.docJoseph KueflerK:\jkuefler\src\misc\pbar.docв&pі$RectХнннннннннџ@€ДЉ… ФА@џџUnknownџџџџџџџџџџџџG‡z €џTimes New Roman5€Symbol3& ‡z €џArial71Courier;€Wingdings"qˆ№аhАJdFKdFJEЈ '$№ЅРДД€20щ2ƒ№пџџQJoseph KueflerJoseph Kueflerўџр…ŸђљOhЋ‘+'Гй0t˜ЄАШдр№  0 < HT\dlфQssJoseph KuefleroseoseNormalKJoseph Kuefler6seMicrosoft Word 9.0@