[SOLVED] Almost there just need a global progress bar

Heya,
There's no man page for bar so I have looked at the code a bit. I am trying to have a progress bar to copy a folder with many files including symbolic links (unfortunately pycp does not support them yet). With the -s parameter, I can specify the approximate size of what I am copying but it works only if it is a single file.
I have also tried pv, pipemeter, orphan advcp, ecp, scp and I am now desperate.
Would someone be kind enough to help me ?
[tamikana@archlinux ~]$ cat /usr/bin/bar
#! /bin/sh
# bar
# 'cat' with ASCII progress bar
# (c) Henrik Theiling
BAR_VERSION=1.4
# Synopsis:
# 'bar' works just like 'cat', but shows a progress bar in ASCII art on stderr.
# The script's main function is meant to be usable in any Bourne shell to be
# suitable for install scripts without the need for any additional tool.
# Shell Script Usage: bar [options] [files]
# Options:
# -h displays help
# Examples:
# Normal pipe:
# : bar mypack.tar.bz2 | tar xjpf -
# Individual pipe for each file:
# : bar -c 'tar xjpf -' mypack1.tar.bz2 mypack2.tar.bz2
# Individual pipe, using ${bar_file} variable:
# : bar -c 'echo ${bar_file}: ; gzip -dc | tar tvf -' \
# : -e .tar.gz \
# : file1 file2 file3 file4 file5 \
# : > package-list.txt
# Programs and shell commands:
# Required (otherwise this fails):
# if, then, else, fi, expr, test, cat, eval, exec
# shell functions
# test:
# a = b
# a -lt b
# a -gt b
# a -le b
# -f a
# -n a
# -z a
# expr:
# a + b
# a - b
# a '*' b
# a / b
# a : b
# Optional (otherwise this does not show the bar):
# grep, dd, echo, ls, sed, cut
# ls:
# must output the file size at fifth position.
# The command line interface also uses:
# awk
####>-SCHNIPP-<########################################################
bar_cat()
# Use this shell function in your own install scripts.
# Options:
# Width of the bar (in ten characters). The default is 76 characters.
test -z "${BAR_WIDTH}" && test -n "${COLUMNS}" && BAR_WIDTH=${COLUMNS}
# Check syntax:
( expr "${BAR_WIDTH}" + 0 >/dev/null 2>&1 ) || BAR_WIDTH=0
BAR_WIDTH=`expr ${BAR_WIDTH} + 0` || BAR_WIDTH=0
test "x${BAR_WIDTH}" = x0 && BAR_WIDTH=76
# Maximal block size to use for dd.
test -n "${BAR_BS}" || BAR_BS=1048567
# BEGIN PERC
# Whether to show a percentage.
test -n "${BAR_PERC}" || BAR_PERC=1
# END PERC
# BEGIN ETA
# Whether to show estimated time of arrival (ETA).
test -n "${BAR_ETA}" || BAR_ETA=1
# END ETA
# Width of the trace display:
# BEGIN TRACE
test -n "${BAR_TRACE_WIDTH}" || BAR_TRACE_WIDTH=10
# END TRACE
# The command to execute for every given file. Each file
# is piped into this command individually. By default, the
# files are simply dumped to stdout.
test -n "${BAR_CMD}" || BAR_CMD=cat
# The characters to be used in the bar
test -n "${BAR_L}" || BAR_L='['
test -n "${BAR_R}" || BAR_R=']'
test -n "${BAR_C0}" || BAR_C0='.'
test -n "${BAR_C1}" || BAR_C1='='
# Additional extension to add to each file:
#BAR_EXT=${BAR_EXT-}
# Whether to clear bar after termination. Otherwise keep the full bar.
#BAR_CLEAR=${BAR_CLEAR-0}
# Unless switched off by user, use the bar by default:
test -n "${BAR_OK}" || BAR_OK=1
BAR_WIDTH=`expr ${BAR_WIDTH} - 3`
bar_trace=''
# BEGIN TRACE
if test "x${BAR_TRACE}" = x1
then
BAR_WIDTH=`expr ${BAR_WIDTH} - ${BAR_TRACE_WIDTH}`
bar_lauf=${BAR_TRACE_WIDTH}
bar_t_space=''
bar_t_dot=''
while test "${bar_lauf}" -gt 1
do
bar_t_space="${bar_t_space} "
bar_t_dot="${bar_t_dot}."
bar_lauf=`expr ${bar_lauf} - 1`
done
bar_trace="${bar_t_space} "
fi
# END TRACE
bar_eta=''
BAR_GET_TIME='echo'
# BEGIN ETA
( expr 1 + ${SECONDS} >/dev/null 2>&1 ) || BAR_ETA=0
if test "x${BAR_ETA}" = x1
then
BAR_GET_TIME='( echo ${SECONDS} )'
BAR_WIDTH=`expr ${BAR_WIDTH} - 6`
bar_eta='--:-- '
fi
# END ETA
bar_perc=''
# BEGIN PERC
if test "x${BAR_PERC}" = x1
then
BAR_WIDTH=`expr ${BAR_WIDTH} - 5`
bar_perc=' 0% '
fi
# END PERC
BAR_GET_SIZE='( ls -l "${BAR_DIR}${bar_file}${BAR_EXT}" | sed "s@ *@ @g" | cut -d " " -f 5 ) 2>/dev/null'
# portable?
# check features:
( ( echo a ) >/dev/null 2>&1 ) || BAR_OK=0
( ( echo a | dd bs=2 count=2 ) >/dev/null 2>&1 ) || BAR_OK=0
( ( echo a | grep a ) >/dev/null 2>&1 ) || BAR_OK=0
( ( echo a | sed 's@ *@ @g' ) >/dev/null 2>&1 ) || BAR_OK=0
( ( echo a | cut -d ' ' -f 1 ) >/dev/null 2>&1 ) || BAR_OK=0
# check ranges:
test "${BAR_WIDTH}" -ge 4 || BAR_OK=0
BAR_ECHO='echo'
BAR_E_C1=''
BAR_E_C2=''
BAR_E_NL='echo'
# Does echo accept -n without signalling an error?
if echo -n abc >/dev/null 2>&1
then
BAR_E_C1='-n'
fi
# Check how to print a line without newline:
if ( ( ${BAR_ECHO} "${BAR_E_C1}" abc ; echo 1,2,3 ) | grep n ) >/dev/null 2>&1
then
# Try echo \c:
if ( ( ${BAR_ECHO} 'xyz\c' ; echo 1,2,3 ) | grep c ) >/dev/null 2>&1
then
# Try printf:
if ( ( printf 'ab%s' c ; echo 1,2,3 ) | grep abc ) >/dev/null 2>&1
then
BAR_ECHO='printf'
BAR_E_C1='%s'
else
BAR_ECHO=':'
BAR_E_C1=''
BAR_E_NL=':'
BAR_OK=0
fi
else
BAR_E_C1=''
BAR_E_C2='\c'
fi
fi
# prepare initial bar:
bar_shown=0
if test "${BAR_OK}" = 1
then
bar_lauf=0
bar_graph=''
while test `expr ${bar_lauf} + 5` -le "${BAR_WIDTH}"
do
bar_graph="${bar_graph}${BAR_C0}${BAR_C0}${BAR_C0}${BAR_C0}${BAR_C0}"
bar_lauf=`expr ${bar_lauf} + 5`
done
while test "${bar_lauf}" -lt "${BAR_WIDTH}"
do
bar_graph="${bar_graph}${BAR_C0}"
bar_lauf=`expr ${bar_lauf} + 1`
done
${BAR_E_C2}" 1>&2_eta}${bar_perc}${BAR_L}${bar_graph}${BAR_R}
bar_shown=1
fi
# for shifting large numbers so that expr can handle them:
# Assume we can compute up to 2147483647, thus 9 arbitrary digits.
# We must be able to do + of two numbers of 9 digits length. Ok.
# BEGIN LARGE
( ( test 1999999998 = `expr 999999999 + 999999999` ) >/dev/null 2>&1 ) || BAR_OK=0
bar_large_num="........."
bar_div=""
# END LARGE
bar_numsuff=""
# find size:
bar_size=0
if test -n "${BAR_SIZE}"
then
bar_size=${BAR_SIZE}
# BEGIN LARGE
while expr "${bar_size}" : "${bar_large_num}" >/dev/null 2>&1
do
bar_div="${bar_div}."
bar_numsuff="${bar_numsuff}0"
bar_size=`expr "${bar_size}" : '\(.*\).$'`
done
# END LARGE
BAR_GET_SIZE="echo '${BAR_SIZE}'"
else
for bar_file
do
bar_size1=0
if test -f "${BAR_DIR}${bar_file}${BAR_EXT}"
then
bar_size1=`eval "${BAR_GET_SIZE}"`
# BEGIN LARGE
# divide and upround by pattern matching:
if test -n "${bar_div}"
then
bar_size1=`expr "${bar_size1}" : '\(.*\)'${bar_div}'$'` || bar_size1=0
fi
# adjust if still too large:
while expr "${bar_size1}" : "${bar_large_num}" >/dev/null 2>&1
do
bar_div="${bar_div}."
bar_numsuff="${bar_numsuff}0"
bar_size1=`expr "${bar_size1}" : '\(.*\).$'`
bar_size=`expr "${bar_size}" : '\(.*\).$'` || bar_size=0
done
# upround if necessary:
if test -n "${bar_div}"
then
bar_size1=`expr "${bar_size1}" + 1`
fi
# END LARGE
# add to total size:
bar_size=`expr ${bar_size} + ${bar_size1}`
# BEGIN LARGE
# adjust if still too large:
while expr "${bar_size}" : "${bar_large_num}" >/dev/null 2>&1
do
bar_div="${bar_div}."
bar_numsuff="${bar_numsuff}0"
bar_size=`expr "${bar_size}" : '\(.*\).$'`
done
# END LARGE
else
BAR_OK=0
fi
done
fi
bar_quad=`expr ${BAR_WIDTH} '*' ${BAR_WIDTH}`
test "${bar_size}" -gt "${bar_quad}" || BAR_OK=0
if test "${BAR_OK}" = 0
then
# For some reason, we cannot display the bar. Thus plain operation:
for bar_file
do
if test "${bar_file}" = "/dev/stdin"
then
eval "${BAR_CMD}"
else
eval "${BAR_CMD}" < "${BAR_DIR}${bar_file}${BAR_EXT}"
fi
done
else
# Compute wanted bytes per step:
bar_want_bps=`expr ${bar_size} + ${BAR_WIDTH}`
bar_want_bps=`expr ${bar_want_bps} - 1`
bar_want_bps=`expr ${bar_want_bps} / ${BAR_WIDTH}`
# Compute block count per step to keep within maximum block size:
bar_count=1
if test "${bar_want_bps}" -gt "${BAR_BS}"
then
bar_count=`expr ${bar_want_bps} + ${BAR_BS}`
bar_count=`expr ${bar_count} - 1`
bar_count=`expr ${bar_count} / ${BAR_BS}`
fi
# Compute block size for given count:
bar_wc=`expr ${BAR_WIDTH} '*' ${bar_count}`
bar_bs=`expr ${bar_size} + ${bar_wc}`
bar_bs=`expr ${bar_bs} - 1`
bar_bs=`expr ${bar_bs} / ${bar_wc}`
# Compute bs * count, the bytes per step:
bar_bps=`expr ${bar_bs} '*' ${bar_count}`
# Compute bytes per hundredth:
bar_bph=`expr ${bar_size} + 99`
bar_bph=`expr ${bar_bph} / 100`
# Run loop:
bar_pos=0
bar_graph="${BAR_L}"
bar_cur_char=0
bar_t0=`eval "${BAR_GET_TIME}" 2>/dev/null` || bar_t0=0
for bar_file
do
# BEGIN TRACE
if test "x${BAR_TRACE}" = x1
then
bar_trace=`expr "${bar_file}" : '.*/\([^/][^/]*\)$'` || bar_trace="${bar_file}"
bar_trace=`expr "${bar_trace}${bar_t_space}" : '\('${bar_t_dot}'\)'`
bar_trace="${bar_trace} "
fi
# END TRACE
# Initial character position in bar for file:
bar_char=`expr ${bar_pos} / ${bar_want_bps}` || bar_char=0
while test "${bar_char}" -gt `expr ${bar_cur_char} + 4`
do
bar_graph="${bar_graph}${BAR_C1}${BAR_C1}${BAR_C1}${BAR_C1}${BAR_C1}"
bar_cur_char=`expr ${bar_cur_char} + 5`
done
while test "${bar_char}" -gt "${bar_cur_char}"
do
bar_graph="${bar_graph}${BAR_C1}"
bar_cur_char=`expr ${bar_cur_char} + 1`
done
# Get file size. This must work now (we checked with test -f before).
bar_size1=`eval "${BAR_GET_SIZE}" 2>/dev/null` || bar_size1=0
# BEGIN LARGE
# Divide and upround by pattern matching:
if test -n "${bar_div}"
then
bar_size1=`expr "${bar_size1}" : '\(.*\)'${bar_div}'$'` || bar_size1=0
bar_size1=`expr "${bar_size1}" + 1`
fi
# END LARGE
# loop:
bar_total=0
exec 6>&1
exec 5<"${BAR_DIR}${bar_file}${BAR_EXT}"
while test "${bar_total}" -lt "${bar_size1}"
do
dd bs="${bar_bs}" count="${bar_count}${bar_numsuff}" <&5 >&6 2>/dev/null
bar_total=`expr ${bar_total} + ${bar_bps}`
if test "${bar_total}" -gt "${bar_size1}"
then
bar_total="${bar_size1}"
fi
bar_pos1=`expr ${bar_pos} + ${bar_total}`
bar_proz=`expr ${bar_pos1} / ${bar_bph}` || bar_proz=0
# BEGIN PERC
if test "x${BAR_PERC}" = x1
then
bar_perc=" ${bar_proz}% "
bar_perc=`expr "${bar_perc}" : '.*\(.....\)$'`
fi
# END PERC
# BEGIN ETA
if test "x${BAR_ETA}" = x1
then
bar_diff=`eval "${BAR_GET_TIME}" 2>/dev/null` || bar_diff=0
bar_diff=`expr ${bar_diff} - ${bar_t0} 2>/dev/null` || bar_diff=0
bar_100p=`expr 100 - ${bar_proz}` || bar_100p=0
bar_diff=`expr ${bar_diff} '*' ${bar_100p}` || bar_diff=0
bar_diff=`expr ${bar_diff} + ${bar_proz}` || bar_diff=0
bar_diff=`expr ${bar_diff} - 1` || bar_diff=0
bar_diff=`expr ${bar_diff} / ${bar_proz} 2>/dev/null` || bar_diff=0
if test "${bar_diff}" -gt 0
then
bar_t_unit=":"
if test "${bar_diff}" -gt 2700
then
bar_t_uni="h"
bar_diff=`expr ${bar_diff} / 60`
fi
bar_diff_h=`expr ${bar_diff} / 60` || bar_diff_h=0
if test "${bar_diff_h}" -gt 99
then
bar_eta=" ${bar_diff_h}${bar_t_unit} "
else
bar_diff_hi=`expr ${bar_diff_h} '*' 60` || bar_diff_hi=0
bar_diff=`expr ${bar_diff} - ${bar_diff_hi}` || bar_diff=0
bar_diff=`expr "00${bar_diff}" : '.*\(..\)$'`
bar_eta=" ${bar_diff_h}${bar_t_unit}${bar_diff} "
fi
bar_eta=`expr "${bar_eta}" : '.*\(......\)$'`
fi
fi
# END ETA
bar_char=`expr ${bar_pos1} / ${bar_want_bps}` || bar_char=0
while test "${bar_char}" -gt "${bar_cur_char}"
do
bar_graph="${bar_graph}${BAR_C1}"
${bar_trace}${bar_eta}${bar_perc}${bar_graph}${BAR_E_C2}" 1>&2
bar_cur_char=`expr ${bar_cur_char} + 1`
done
done
) | eval "${BAR_CMD}"
bar_pos=`expr ${bar_pos} + ${bar_size1}`
done
# ${BAR_ECHO} "${BAR_E_C1}" "${BAR_R}${BAR_E_C2}" 1>&2
fi
if test "${bar_shown}" = 1
then
# BEGIN TRACE
test "x${BAR_TRACE}" = x1 && bar_trace="${bar_t_space} "
# END TRACE
# BEGIN ETA
test "x${BAR_ETA}" = x1 && bar_eta=' '
# END ETA
if test "x${BAR_CLEAR}" = x1
then
# BEGIN PERC
test "x${BAR_PERC}" = x1 && bar_perc=' '
# END PERC
bar_lauf=0
bar_graph=''
while test `expr ${bar_lauf} + 5` -le "${BAR_WIDTH}"
do
bar_graph="${bar_graph} "
bar_lauf=`expr ${bar_lauf} + 5`
done
while test "${bar_lauf}" -lt "${BAR_WIDTH}"
do
bar_graph="${bar_graph} "
bar_lauf=`expr ${bar_lauf} + 1`
done
${BAR_E_C2}" 1>&2_eta}${bar_perc} ${bar_graph}
else
# BEGIN PERC
test "x${BAR_PERC}" = x1 && bar_perc='100% '
# END PERC
bar_lauf=0
bar_graph=''
while test `expr ${bar_lauf} + 5` -le "${BAR_WIDTH}"
do
bar_graph="${bar_graph}${BAR_C1}${BAR_C1}${BAR_C1}${BAR_C1}${BAR_C1}"
bar_lauf=`expr ${bar_lauf} + 5`
done
while test "${bar_lauf}" -lt "${BAR_WIDTH}"
do
bar_graph="${bar_graph}${BAR_C1}"
bar_lauf=`expr ${bar_lauf} + 1`
done
${bar_trace}${bar_eta}${bar_perc}${BAR_L}${bar_graph}${BAR_R}${BAR_E_C2}" 1>&2
${BAR_E_NL} 1>&2
fi
fi
####>-SCHNAPP-<########################################################
BAR_AWK_0=''
# Command line interface:
while test -n "$1"
do
case "$1" in
-o|-c|-w|-0|-1|-e|-d|-b|-s|-\[\]|-\[|-\]|-T)
if test -z "$2"
then
echo "$0: Error: A non-empty argument was expected after $1" 1>&2
fi
BAR_ARG="$1"
BAR_OPT="$2"
shift
shift
-o*|-c*|-w*|-0*|-1*|-e*|-d*|-b*|-T*)
BAR_ARG=`expr "$1" : '\(-.\)'`
BAR_OPT=`expr "$1" : '-.\(.*\)$'`
shift
-h|-n|-p|-D|-D-|-q|-V|-t|-E|-L)
BAR_ARG="$1"
BAR_OPT=""
shift
--) shift
break
-*) echo "$0: Error: Unrecognized option: $1" 1>&2
exit 1
break
esac
case "${BAR_ARG}" in
-h) echo 'Usage: bar [-n] [-p] [-q] [-o FILE] [-c CMD] [-s SIZE] [-b SIZE]'
echo ' [-w WIDTH] [-0/1/[/] CHAR] [-d DIR] [-e EXT] [Files]'
echo ' bar -V'
echo ' bar -D'
echo ' bar -D-'
echo 'Options:'
echo ' -h displays help'
echo ' -o FILE sets output file'
echo ' -c CMD sets individual execution command'
echo ' -e EXT append an extension to each file'
echo ' -d DIR prepend this prefix to each file (a directory must end in /)'
echo ' -s SIZE expected number of bytes. Use for pipes. This is a hint'
echo ' only that must be greater or equal to the amount actually'
echo ' processed. Further, this only works for single files.'
echo ' -b SIZE maximal block size (bytes) (default: 1048567)'
echo ' -w WIDTH width in characters (default: terminal width-3 or 76)'
echo ' -0 CHAR character for empty bar (default: .)'
echo ' -1 CHAR character for full bar (default: =)'
echo ' -[ CHAR first character of bar (default: [)'
echo ' -] CHAR last character of bar (default: ])'
echo ' -n clears bar after termination'
echo ' -t traces (=displays) which file is processed'
echo ' -T WIDTH no of characters reserved for the file display of -t'
echo ' -p hides percentage'
echo ' -E hides estimated time display'
echo ' -q hides the whole bar, be quiet'
echo ' -D tries to dump the bar_cat() shell function, then exit.'
echo ' Here, -t, -p, -E remove the corresponding feature completely.'
echo ' Further, -L removes large file support from the code.'
echo ' -D- same as -D, but dumps the function body only'
echo ' -V displays version number'
echo ' -- end of options: only file names follow'
exit 0
-n) BAR_CLEAR=1
-L) BAR_LARGE=0
BAR_AWK_0="${BAR_AWK_0} /END *LARGE/ {x=1} ;"
BAR_AWK_0="${BAR_AWK_0} /BEGIN *LARGE/ {x=0} ;"
-t) BAR_TRACE=1
BAR_AWK_0="${BAR_AWK_0} /END *TRACE/ {x=1} ;"
BAR_AWK_0="${BAR_AWK_0} /BEGIN *TRACE/ {x=0} ;"
-T) BAR_TRACE_WIDTH="${BAR_OPT}"
-q) BAR_OK=0
-p) BAR_PERC=0
BAR_AWK_0="${BAR_AWK_0} /END *PERC/ {x=1} ;"
BAR_AWK_0="${BAR_AWK_0} /BEGIN *PERC/ {x=0} ;"
-E) BAR_ETA=0
BAR_AWK_0="${BAR_AWK_0} /END *ETA/ {x=1} ;"
BAR_AWK_0="${BAR_AWK_0} /BEGIN *ETA/ {x=0} ;"
-V) echo "bar v${BAR_VERSION}"
exit 0
-D) echo "BAR_VERSION=${BAR_VERSION}"
awk "${BAR_AWK_0}"'{sub(/ *#.*$/,"")} ; /^bar_cat/ {x=1} ; {sub(/^ */,"")} ; /./ {if(x)print} ; /^}/ {x=0}' "$0"
exit 0
-D-) echo "BAR_VERSION=${BAR_VERSION}"
awk "${BAR_AWK_0}"'{sub(/ *#.*$/,"")} ; /^}/ {x=0} ; {sub(/^ */,"")} ; /./ {if(x)print} ; /^{/ {x=1}' "$0"
exit 0
-o) exec 1>"${BAR_OPT}"
-c) BAR_CMD="${BAR_OPT}"
-b) BAR_BS="${BAR_OPT}"
if BAR_RAW=`expr "${BAR_BS}" : '\(.*\)k$'`
then
BAR_BS=`expr ${BAR_RAW} '*' 1024`
elif BAR_RAW=`expr "${BAR_BS}" : '\(.*\)M$'`
then
BAR_BS=`expr ${BAR_RAW} '*' 1048567`
fi
-s) BAR_SIZE="${BAR_OPT}"
if BAR_RAW=`expr "${BAR_SIZE}" : '\(.*\)k$'`
then
BAR_SIZE=`expr ${BAR_RAW} '*' 1024`
elif BAR_RAW=`expr "${BAR_SIZE}" : '\(.*\)M$'`
then
BAR_SIZE=`expr ${BAR_RAW} '*' 1048567`
fi
if test "$#" -gt 1
then
echo "Error: -s cannot be specified for multiple input files." 1>&2
exit 1
fi
-e) BAR_EXT="${BAR_OPT}"
-d) BAR_DIR="${BAR_OPT}"
-0) BAR_C0="${BAR_OPT}"
-1) BAR_C1="${BAR_OPT}"
-\[) BAR_L="${BAR_OPT}"
-\]) BAR_R="${BAR_OPT}"
BAR_L="${BAR_OPT}"
BAR_R="${BAR_OPT}"
-w) BAR_WIDTH="${BAR_OPT}"
esac
done
# Invoke main function:
if test "$#" = 0
then
bar_cat /dev/stdin
else
bar_cat "$@"
fi
EDIT: solved https://bbs.archlinux.org/viewtopic.php … 85#p498885
It seems like I have not tried every potential packages after all
Last edited by tamikana (2011-10-30 16:04:46)

This might help http://www.dwcourse.com/dreamweaver/ten-commandments-spry-menubars.php#one
Also, if you use DW CS5 click on Live Code and Live View. Then when clicking on the menu items in Live View, watch the changes in classes that occur. This mifgt give you a clue of what to do.
Cheers,
Gramps

Similar Messages

  • Need to use progress bar in my application

    hello friends,
    Actually i m using jsp filedownload and I am gettting my file in byte array and need to implement a progress bar while downloading file (as IE showing in status bar downloading file size ..% of total file size)...no fake progress bars and no stop gap solutions as like a gif moving with sign "plz wait ..file is downloading "
    plz help how to get this done
    My code
    HashMap result = (HashMap)request.getAttribute("requestParams");
         String type = request.getParameter("type");
         boolean isFile = false;
              if(result != null){
              String successFlag = (String) result.get("");
              String sFileName = null;
              byte[] bFile = null;
              String sContentType = null;
              if(successFlag != null && successFlag.equals("true")){
                   for(int i=0;i<result.size();i++){
                        sFileName = (String) result.get("FILENAME");
                        bFile = (byte[]) result.get("FILEDATA");
                        sContentType = (String) result.get("CONTENTTYPE");
                   response.reset();
                   if(null!=bFile) {
                        if(bFile.length>0){
                             if(sContentType == null || sContentType.equals("")){
                                  response.setContentType( "application/octet-stream" );
                             else response.setContentType(sContentType);
                             response.setHeader("Accept-Ranges", "bytes");
                             isFile = true;
                             response.setHeader("Content-Length", Integer.toString(bFile.length, 10));
                             if(null!=sFileName){
                                  if("view".equals(type)){
                                       if(null!=sFileName)response.setHeader("Content-Disposition","inline; filename=\""+sFileName+"\"");
                                  else{
                                       response.setHeader("Content-Disposition","attachment; filename=\""+sFileName+"\"");
                             ServletOutputStream outs = response.getOutputStream();
                             if(null!=bFile)outs.write(bFile);
                             outs.flush();
                             outs.close();
                             out.clear();
                             out = pageContext.pushBody();
                                       }

    You should get your keyboard fixed. There's a lot of letters missing from what you type and it makes it very hard for other people to read. It looks extremely inelegant.
    Anyway, your JSP isn't in control of the download. (You shouldn't have all that Java code in a JSP either but that's a separate issue.) All it does is to send the data to the browser, which is in charge of the download. And in all the browsers I use, there's a box which tells you how far the download has proceeded. No real need for a progress bar, even if you could persuade the browser to make one. Which you can't.

  • Almost there, still need email php help!

    Hey there everyone,
    I posted my issue earlier but the thread seems to be dead.  I have been researching php syntax and looked at some other examples online, and I think I almost have it.  I just need a little extra assistance to get there.
    I had my php page partially working earlier, and I was receiving emails from my form submission, but all the data I got was subject and phone number.  I didn't get my thank you page to come up either.  My form has fields for name, email, phone, 3 comment fields and 3 reference fields.  Not sure why I wasn't getting all of the data so I tried redoing my code.
    Now, after redoing the code, I get my thank you page to come up, but I don't get any email notification with the submitted data anymore.  I am not sure why.  I had some code syntax errors but I fixed them through process of elimination and I have no syntax errors now.
    Would someone be able to take a look at my files and tell me what I am doing wrong?  I am always ready to put in work and test through trial and error, but I just am not sure where to start.  I am so close!!!
    Thanks for reading and for any advice, I really appreciate it!
    Jayson

    David, thank you!  It works!  You are my new hero!
    Well, through it all I learned a lot about syntax, headers, form security, etc etc  Very helpful!  Even learned about bare LF's lol.
    I am trying to also have the thank you page redirect to the manufacturer's page after 5 seconds, and I did some reading about redirect code through meta and php.  Not sure if it matters which one I use, and I am also confused about where to put it.
    These are what I found:
    <head>
    <meta http-equiv="refresh" content="5; URL=thankyou.htm">
    </head>
    <?php
    header("refresh: 5; thankyou.htm";
    ?>
    If I use the meta tag, does it go directly in the code on the thank you page?  And if I use the pgp code, where does that go?  I tried it but the page was having trouble redirecting.
    Thanks again for all of your help, and if you feel generous enough to help me with this too I would really appreciate it!
    Jayson

  • Almost there! Need a little help with CSS Menu

    Hi folks,
    I am almost there with a menu system.  The problems I discovered were mostly to do with layout.css nav elements interfering with my custom code.   http://bendannie2.businesscatalyst.com/flexi2.html 
    Here are the problems I can't seem to resolve.
    There appears a red diamond list element and I can't seem to remove it or find it in the Inspector on any css link
    the secondary menus blink and are hard to select on hover over tertiary menus (see On Sale>Cartier> )
    the tertiary menus are a little crowded towards the secondary menus.
    the css classes in inspector seem to repeat ad infinitum
    Any help most deeply appreciated...
    BTW, it works better on a smart phone!
    Jeff

    Thanks, Don't know why I didn't see that... 
    I'm stil having a problem with the hover area for selecting sub menus... The problem appears to be the js, I think!, I'm not qualified to analyze jquery. 
    The behaviors are as follows:
    The On Sale submenus stay active even when you roll off that menu and select another.
    The hover area after the first scrollover appears to be below the existing text of the top level and not on the text itself.
    there is something going on as you scroll down  through the submenus where they are blinking on and off as you pass each sub tab...   This uses jQuery 1.7.2, so if that has been fixed in a later edition, I don't know... 
    Perhaps it is the way I set the CSS but I didn't, to my knowledge, change a hover/selection area for the menus...
    TIA,
    JEff

  • Need very simple ''progress bar'' or a ''Please wait notice'' in javascript

    I have a JSF portlet app, made in JSC. It uses remote EJB calls and some calls take a long time to finish. E.g. User clicks a button, some data are gathered, sent to an EJB and the app. is waiting for reply.
    For the user it looks like this: Click ... Internet Explorer progress bar flashes, nothing happens for 30s, then the progress bar starts from zero again and loads the next page in 15s.
    So I need a very simple notice in the middle of the screen, that will just say "Take a break, don't click the button again, please! ... " and animate a clock, a bar or whatever, maybe disabling the window so the user will not be able to push buttons. (The users are annoying folk!)
    The message should dissapear as soon as the next (or the same) page loads.
    I've never did javascript, so if anybody has a simple example code, I will be grateful and give him a duke or two. (And I really don't need the AJAX super-components)

    Martin, best of luck, i fought this same problem last year.
    Even when I got a progress bar on my page, it would not "animate" as IE apparently does not animate gifs after a form is submitted (and before the page is destroyed). I think I eventually got around this by adding an onclick event to my form submit that reset the image.
    Best of luck.
    Ideally, is there anyway that we can get this IE behavior (page loads, waits for X times, page loads again correctly) fixed? This is highly confusing to my clients.

  • Need help with progress bar !!!!!!!

    Is ther anyway to display the progress of functions, which I created in my application, through a progress bar ... while the results are being computed with my alogs..
    They are quite long and it takes quite sometime for the results to generate and user shud see that something is working ... while he waits and shud feel that nothing is happening ....
    The progress shudnt necessarily be measurable ... a non measurable progress bar will also do .... Jst want to show that some activity is goin on at the back ...
    My algo consist of functions :
    for (i = 0 ; i < = 6 ; i++)
    my function 1 (my parameters) {} - called 10 times each time the i increments with different parameters
    my function 2() {} - called 10 times ....
    my functions 3() {}   - called 10 times IF somebody know how to do it ... please help meee......... its urgent

    Are you posting this on your cell phone? There seems to be something horribly wrong with your keyboard or your auto complete for your words, as it is, I could barely understand what you were asking. If that is the way you actually spell, then I doubt anyone could help you, maybe you should just step away from the keyboard or what ever device it is your are using to input, because it's correct operation seems to escape you--will you actually be able to comprehend a solution if it is presented?
    But on the outside chance that you may be a savant, and just cannot form sentences and words properly, here is an idea...
    Ages ago, long before you were ever an itch in your parents'... you get the picture...
    They used to say: "Hey, I'm going to be doing a lot of processing or repetitive tasks and maybe between each task I should do something to let the user know the process is running and not just locked up."
    Even a status bar needs you to do something between each process, you have to make it do something between executions of tasks.

  • How to solve mountain lion not start downloading(white progress bar)?

    Dear All,
    I cannot install Mountain Lion with this error "This Copy of the Install OS X Mountain Lion Application can’t be verified"
    Then I delete it and redownload and downloading never start. In App Store->Purchase tab, "DOWNLOADED" is shown for mountain lion.
    But in Luanchpad, the white progress bar at Mountain Lion icon is shown.
    Please help. Thanks in advance.

    Restart your modem and router. If you can connect with an ethernet cable, try that.
    If there is an icon in LaunchPad, hold down the option key and click the x over it.
    Then, try to download again.

  • Aggregated planning in SNP...almost there but need more guidance...

    Gurus, 
    I am working on Aggregated SNP for our company.
    1. I have created a Loc Prod hierarchy. The hierarchy has 1 real Location under a pseuso Location and has 6 real products under pseudo header product.It looks like the screenshot below.
    2. I do not have a PPM hierarchy or a Resource hierarchy
    3. I run the Location heuristic for the header AGG_MFIBER@ Location 1010. I get the correct Pl orders for the header product. The Source Determination is set to Only Sub level.
    4. I am able to disaggregate the header values to the sub-products fine.
    5. But when I look at the Planned orfders for the sub products I see that there is no source of supply even though I have the PPMs for them.
    Do I need to create a PPM hierarchy and then disaggregate it for the system to get the lower level PPMs?
    I will work on it next week but if I can get some help it will save me a great deal of time.
    Thanks in advance,
    Subash

    Hi Cyrille,
    How are you? It has been long....
    This may end up in a long exchange....
    1. I struggled for sometime before I was able to set up the LOC Hier and PROD Hier and generate the LOCPROD Hier, as my screenshots show.
    2. I was able to run SNP for AGG_MFIBER and then disaggregate it to sub products. That is when I found the source of supply issue. I saw that the Header product did not have a SOS and created an SNP PPM manually. This is just after I posted the message.
    3. After that I tried to create a SNP PPM Hierarchy. I was able to add AGG_MFIBER to level for header PPM. After that I added all the sub products in the above LOCPROD Hierarchy and was able to save the same. I went to the edge table /SAPAPO/RELDHPPM and saw 57 entries.
    4. After that I ran SNP for AGG_MFIBER with Source Determination at 'Only Sublevel', the system created planned orders to cover the requirements but it still did not pick up the source of supply for AGG_MFIBER.
    5. Then I changed the Source Determination from 'Only Sublevel' to 'Only Header level' and executed SNP. This time it put ONE planned order only for the header material in the second period but it did pick up the Source of Supply.
    Still trying to understand the logic...
    Any ideas here as I try to get further...
    Thanks again,
    Subash
    Message was edited by: Subash Nanjangud
    Cyrille,
    After working thru the day on this issue I have been able to make things work...I will update the details tomorrow morning..
    Thanks,
    Subash

  • Now that I've installed Yosemite, my computer keeps telling me that iPhoto needs to be upgraded.  When it starts "upgrading the database", it gets almost to the end of the progress bar, then sits and spins.  It  won't finish.

    My computer is an iMac that was made in late 2009, and was purchased by me in 2010.  It has a 3.06 GHz Intel Core 2 Duo processor.  I have more than 800 GB of storage available.  Last week I installed the Yosemite OS.  I'm having trouble with the upgrading of iPhoto.  When it says it's upgrading the database, it never finishes.  I've started the process a few times, and the progress line always gets to the same place when it sits and spins for hours at a time without any more progress.  I thought about putting some of my 10,000 + pictures on discs to see if that would help, but I can't open iPhoto to get at them.  Would that help, anyway?  My son thinks this computer is too old to accept all updates.  The hard drive was replaced 2 years ago.
    Thanks for any help.

    Option 1
    Back Up and try rebuild the library: hold down the command and option (or alt) keys while launching iPhoto. Use the resulting dialogue to rebuild. Choose to Repair Database. If that doesn't help, then try again, this time using Rebuild Database.
    If that fails:
    Option 2
    Download iPhoto Library Manager and use its rebuild function. (In early versions of Library Manager it's the File -> Rebuild command. In later versions it's under the Library menu.)
    This will create an entirely new library. It will then copy (or try to) your photos and all the associated metadata and versions to this new Library, and arrange it as close as it can to what you had in the damaged Library. It does this based on information it finds in the iPhoto sharing mechanism - but that means that things not shared won't be there, so no slideshows, books or calendars, for instance - but it should get all your events, albums and keywords, faces and places back.
    Because this process creates an entirely new library and leaves your old one untouched, it is non-destructive, and if you're not happy with the results you can simply return to your old one.  
    Regards
    TD

  • Home share almost there, but need HELP!

    I have one Win7 laptop and one XP laptop.  Setup home share on each (share is setup on both computers, authorized both, same local net).  XP laptop sees the other computer's share and when I click on it I see the songs/files just as expected.  However, on the Win7 I can see share name of the XP computer but when I click on it, it does not show anything only acts like its loading then positions the cursor back on the music tab.  nothing showing under the share.
    Any ideas?  I've turned off my virus protection (Security Essentials), rebooted, stopped and started the share, plugged directly into my router.....no change.
    I was previsouly on version 9+ on both systems and it did not work and now I'm on the latest version of Itunes for both systems.
    Help!

    However, on the Win7 I can see share name of the XP computer but when I click on it, it does not show anything only acts like its loading then positions the cursor back on the music tab.  nothing showing under the share.
    Hmmmm. Experimental advice, but perhaps have a check through the following document. (In principle, a LSP issue might stuff up Home Sharing, although I've not met an example of it in the wild yet.)
    Apple software on Windows: May see performance issues and blank iTunes Store

  • Global Variable in Progress Bar

    I have an existing labview code that is comprised of a main vi, which is the user GUI, and several (approx 70) sub vi's. I am trying to add a progress bar to the front screen (User GUI) that will immediately increment after it hits certain sections of code. I am doing this using a global variable to store the value of the current progress, and then attempting to write to the progress bar on the main screen after each incrementation. Is there a way to link the value of the main progress bar to the global variable so that it updates as soon as the value is incremented? The problem I am facing is that when I update the global variable in a subvi, the progress bar takes the value of the subvi after it is completed, skipping all the numbers in between. I realize this is because I am not correctly writing to the progress bar, but I am unsure how to do so. If this isn't a good method, does anyone have any suggestions?  
    For Example:
    Main Vi           SubVi1        SubVi2
    (1-4)                (5-8)             (8-12)
    Progress Bar: 1 2 3 4 8 12
    (I did try the Progress Bar Library NI provides, but I need a progress bar on the Front Panel, not a pop up, so I can debug while the code runs)
    Thanks- Adam
    Solved!
    Go to Solution.

    I'd go with a Action Engine to update the progress bar VIA vi server referance.  Here's an example using a AE I have for just this type of progress bar.
    If you haven't read Ben action engine nugget, it should be required, you can find it here
    By constructing a "resource module" (a special AE that holds a referance to the resource to act on)  after initializint the AE you can call any "method" on the resorce from any location in the application instance.  These babys really let you do some interesting things to the GUI from wherever the real actions is taking place.
    Jeff
    Attachments:
    Ex AE Slider.vi ‏15 KB
    Progress.vi ‏26 KB
    Progress Meth.ctl ‏11 KB

  • How can i use Progress bar in IR Report

    Hi ,
    I have created IR Report based on the View so, it's been taking 10-15 mins of time to execute the IR Report. Here user want to see the Progress bar while executing the IR Report. How can i use Progress bar in IR Report.
    Anybody have idea on Progress bar please help me.
    Regards
    Narender B

    Hi ,
    Thanks for your information.
    I am new to the APEX.*i need to show Progress bar while opening the each page* then user can know some process is happening from the backside and i don't know where i need to add and call the below function.could you please provide the steps for the progress bar.
    In my application there are almost 100 pages are there so, i need to show progress bar on each page while opening .could you please provide Global function to call on each page.
    function html_url_Progress(pThis){ 
    $x_Show('AjaxLoading');
    window.setTimeout('$s("AjaxLoading",$x("AjaxLoading").innerHTML)', 100);
    //doSubmit('APPLY_CHANGES');
    redirect(pUrl);
    Regards
    Narender B

  • Progress bar ref mismatch

    Hi all,
    On the attachment, the BD on left called the BD on right.  Notice that I have a broken wire on left, and I don't understand why.  It says that there is a conflict in class.  Do any of you know why?  The intension of the left BD is to get the main VI reference and loop through each control and indicator on the front panel of that VI.  Would what I am doing just give me the conrols but not the indicators?  Thanks
    Kudos and Accepted as Solution are welcome!
    Solved!
    Go to Solution.
    Attachments:
    Progress bar ref.PNG ‏224 KB

    You need to cast your reference to a more specific class of slide.
    Your wire is of the more generic Control Reference (as seen by the class listed at the top of the property node) and you are trying to feed that into the slide reference (as seen by the reference control and the property node in your subVI)

  • White screen and progress bar on login screen

    Hi
    I recently upgraded my Mac Air 2012 to Yosemite. That went fine with no issues. I then turned on FileVault and left the computer to encrypt and optimize the system drive overnight. I woke up this morning to find that the computer had crashed and automatically restarted sometime during the night. The FileVault screen in System Preferences says that FileVault is on for System. I am hoping that this means the the encryption and optimization process completed before the crash.
    I only ask as now, whenever I login to my Apple Air, the login screen is blank white. When I enter my password a progress bar appears beneath the password box. When this progress bar has reached its conclusion, the computer logins in to my account and I can use it without issue.
    I know that this white screen should not be there as I recently upgraded my Macbook Pro to Yosemite and activated FileVault. I can now login to that computer on a screen with a blurred image of my desktop behind it. Once the password has been entered, there is no progress bar, I am just immediately logged onto the desktop.
    Any idea what might of happened and how this can be solved?
    Ta.

    Having spoken to Jigsaw 24 Tech support have solved the problem - just needed the PRAM resetting.

  • Progress Bar - HttpServletResponse

    Hi,
    My Setup:
    - Windows XP Pro
    - Jakarta-Tomcat-3.2.4
    - J2SE1.4.1_02
    - IE 6
    I would like to know if there is a way to 'emulate/plug into' the progress bar on IE.
    I have a couple of web-apps running on tomcat, and I would like to implement a global progress bar. All the examples I've seen works with
    threads and you need to update the status of the progress bar.
    I need something that picks up the status/progress of the Response
    itself.

    Thanks for the replies,
    I want to track the progress of the response from the server without
    having to implement code on all servers (web services). My testing is
    done on IE with the response being written to the browser. In this case
    IE probably tracks the loading of the page/html code, like when opening
    a new url.
    My question is, is there a clever way of measuring the response for different clients. I have seen the response.isCommitted() method which
    returns true if the server has finished, but this is only useful if
    you want to display a "indeterminate" bar(like with JProgressBar).
    The simplest way to state this problem is:
    (1) Can one measure the total length of time it will take to respond to
    a request?
    (2) Can one pick up the current status of the response so that you can compare it to the total?

Maybe you are looking for

  • Why isnt my ipod 4th generation not charging?

    hey guys, i got my ipod for christmas this year so its only been like 7 months or something\and it stoped charging and its pluged in i think the wires down were the charger connects either broke off or are bent or somethings in there... but heres the

  • BDC for XK02 getting problem in table control.....

    hello i want to migrate data for vendor from flat file to SAP.i want to update VAT date and VAT number. but i m not getting how to handle index of table control? coz when we scroll down index get changed...... pls guide me......

  • Zen Micro - two more problems...... oye

    So last week I received my replacement Zen Micro (the headphone jack was faulty in the old one..... etc etc). Since the new one arri'ved, I've had two problems: )There is a constant ringing coming out of the player when it is switched on, like a buzz

  • Re: Report of tickets created by department

    Thanks David

  • Freezing scroll bar in list box

    Hello, I want the user to be able to read the list while I add new items to it. the problem is that whenever a new item is added to the list the scroll jumps up - I want it to stay where ever it was (in case the user scrolled it...) thanks