EzDevInfo.com

progress.js

ProgressJs is a JavaScript and CSS3 library which help developers to create and manage progress bar for every objects on the page. Progress.js - Themeable progress bar library

Progress during large file copy (Copy-Item & Write-Progress?)

Is there any way to copy a really large file (from one server to another) in Powershell AND display it's progress?

There are solutions out there to use Write-Progress in conjunction with looping to copy many files and display progress. However I can't seem to find anything that would show progress of a single file.

Any thoughts?


Source: (StackOverflow)

CSS Progress Circle [closed]

I have searched this website to find progress bars, but the ones I have been able to found show animated circles that go to the full 100%

I would like that stop at certain percentages like the screenshot below, is there anywhere I can find this?

http://s7.postimage.org/dvix8wngb/Untitled.png


Source: (StackOverflow)

Advertisements

How to custom circular progress bar' color?

I am using circular progress bar on Android. I wish to change the color of this. I am using

"?android:attr/progressBarStyleLargeInverse" 

style. So how to change the color of progress bar.

How to custom the style?? Furthermore, what is the definition of the style??

Thanks in advance.


Source: (StackOverflow)

Android: Show progress circle like Google does in their apps

I'm using an AsyncTask to download Images for my Listview, because I dont want the download of the Images to block my UI-Thread. While the images are being loaded, I want to show an animated progress circle in the spot, where the image will be.

But I cant find an Image of the progress circle. What is the Ressource-Id? Or is there any other way? Does someone has a link to this image?


Source: (StackOverflow)

Text Progress Bar in the Console

Is there a good way to do the following?

I wrote a simple console app to upload and download files from an FTP server using the ftplib.

Each time some data chunks are downloaded, I want to update a text progress bar, even if it's just a number.

But I don't want to erase all the text that's been printed to the console. (Doing a "clear" and then printing the updated percentage.)


Source: (StackOverflow)

Ruby progression path: from apprentice to guru

I saw this post about increasing your python proficiency from apprentice to guru and would love the same advice but for Ruby (the language I use for personal project and hope to use professionally someday).

Where I am now: I can create and implement basic sites in RoR and get most done on a small scale. I am sure a Ruby guru would facepalm at half of the stuff I am doing but that's why I am asking. When I am done with the beginner stuff what is the next step to getting to guru status?

I've seen the responses for improving my programming generically so I am looking for responses more about getting more deeply acquainted with Ruby.

(the rest of this question is shamelessly ripped from the original poster, credit)

Let me sum up what I do NOT want to ask first ;)

  • I don't want to know how to QUICKLY learn Ruby
  • Nor do I want to find out the best way to get acquainted with the language
  • Finally, I don't want to know a 'one trick that does it all' approach.

What I do want to know your opinion about, is:

What are the steps YOU would recommend to a Ruby journeyman, from apprenticeship to guru status (feel free to stop wherever your expertise dictates it), in order that one IMPROVES CONSTANTLY, becoming a better and better Ruby coder, one step at a time. Some of the people on SO almost seem worthy of worship for their Ruby prowess, please enlighten us :)

The kind of answers I would enjoy (but feel free to surprise the readership :P ), is formatted more or less like this:

  • Read this (eg: ruby tutorial), pay attention to that kind of details
  • Code for so manytime/problems/lines of code
  • Then, read this (eg: this or that book), but this time, pay attention to this
  • Tackle a few real-life problems
  • Then, proceed to reading Y.
  • Be sure to grasp these concepts
  • Code for X time
  • Come back to such and such basics or move further to...
  • (you get the point :)

Source: (StackOverflow)

Simple progress indication in console

What is the easiest way to indicate the work progress in console? Outputting the percentage will be enough, progress bar is not necessary.

Using just print will produce lot's of lines, I want just a single changing string in a terminal.


Source: (StackOverflow)

Android - updating notification progress bar, properly

I am still really new to Android and I am trying to improve my notification's progress bar to be smoother, not fire a million updates to my Pebble and do it the "right way". This code works "fine" as in when I am using it, the notification draws and the progress bar completes as expected.

It became an issue to me when I set my Pebble watch to accept my app's notifications. Which causes it to vibrate about 50 times per image that uploads depending on how fast the upload speed is.

Being a beginner I assume I am doing this all wrong and there is a much better way to do what I am trying to do.

My notification's progress bar is updated with the following code:

private int upload_progress;
private Long time_previous_progress = Calendar.getInstance().getTimeInMillis();

protected void onProgressUpdate(Integer... progress) {
    Long time_now = Calendar.getInstance().getTimeInMillis();
    if(
       ((time_now - time_previous_progress) < 55) // 55ms minimum delay
       || (progress[0] < 0 && progress[0] > 100)  // progress >0 && <100
       || progress[0].equals(upload_progress)     // progress changed
       || ! App.getStatus()                       // watcher is running
       )
    {
        return;
    }
    time_previous_progress = time_now;
    upload_progress = progress[0];
    int upload_counter = getUploadCounter();
    int upload_total = db.getReadyImagesCount();
    NotificationHandler.notify(context, upload_progress, upload_counter, (upload_total + upload_counter));
}

The notification is then generated with this code:

public static int notify(Context context, Integer progress, Integer upload_count, Integer upload_total)
{
    Bitmap bm = BitmapFactory.decodeResource(context.getResources(), R.drawable.ic_launcher);
    String notif_title = context.getResources().getString(R.string.instant_upload_title);

    String notif_progress = context.getResources().getString(R.string.instant_upload_progress);
    String notif_ticker = String.format(notif_progress, upload_count, upload_total);
    String notif_msg = String.format(notif_progress, upload_count, upload_total);

    Intent intent_swipe = new Intent(context, NotifyReceiver.class);
    intent_swipe.setAction("notification_cancelled");
    PendingIntent pendingIntent_swipe = PendingIntent.getBroadcast(context, 0, intent_swipe, PendingIntent.FLAG_CANCEL_CURRENT);

    Intent intent_click = new Intent(context, Settings.class);
    intent_click.putExtra("notification_clicked", true);
    PendingIntent pendingIntent_click = PendingIntent.getActivity(context, 0, intent_click, PendingIntent.FLAG_CANCEL_CURRENT);

    int pro_max = 100;
    int pro_cur = 0;
    if(progress < 100)
    {
        pro_cur = progress;
    }else{
        pro_cur = pro_max = 0;
    }

    //new NotificationCompat.Builder(context)
    NotificationCompat.Builder builder = new NotificationCompat.Builder(context) //PixelRelayApplication.getNotificationBuilder()
        .setTicker(notif_ticker)
        .setContentTitle(notif_title)
        .setContentText(notif_msg)
        .setNumber(upload_count)
        .setSmallIcon(R.drawable.ic_launcher)
        .setLargeIcon(bm)
        .setContentIntent(pendingIntent_click)
        .setDeleteIntent(pendingIntent_swipe)
        .setAutoCancel(true)
        .setOngoing(true)
        .setWhen(Calendar.getInstance().getTimeInMillis())
        .setProgress(pro_max, pro_cur, false);

    Notification notification = builder.build();

    // Put the auto cancel notification flag
    notification.flags |= Notification.FLAG_AUTO_CANCEL | Notification.FLAG_ONLY_ALERT_ONCE;
    NotificationManager notificationManager = (NotificationManager) context.getSystemService(context.NOTIFICATION_SERVICE);
    notificationManager.notify(NOTIFY_ME_ID, notification);
    return NOTIFY_ME_ID;
}

Source: (StackOverflow)

Java SAX parser progress monitoring

I'm writing a SAX parser in Java to parse a 2.5GB XML file of wikipedia articles. Is there a way to monitor the progress of the parsing in Java?


Source: (StackOverflow)

Show javascript execution progress

I have some javascript functions that take about 1 to 3 seconds. (some loops or mooML templating code.)

During this time, the browser is just frozen. I tried showing a "loading" animation (gif image) before starting the operation and hiding it afterwords. but it just doesnt work. The browser freezes before it could render the image and hides it immediately when the function ends.

Is there anything I can do to tell the browser to update the screen before going into javascript execution., Something like Application.DoEvents or background worker threads.

So any comments/suggestions about how to show javascript execution progress. My primary target browser is IE6, but should also work on all latest browsers


Source: (StackOverflow)

Animate drawing of a circle

I'm looking for a way to animate the drawing of a circle. I have been able to create the circle, but it draws it all together.

Here is my CircleView class:

import UIKit

class CircleView: UIView {
  override init(frame: CGRect) {
    super.init(frame: frame)
    self.backgroundColor = UIColor.clearColor()
  }

  required init(coder aDecoder: NSCoder) {
    fatalError("init(coder:) has not been implemented")
  }


  override func drawRect(rect: CGRect) {
    // Get the Graphics Context
    var context = UIGraphicsGetCurrentContext();

    // Set the circle outerline-width
    CGContextSetLineWidth(context, 5.0);

    // Set the circle outerline-colour
    UIColor.redColor().set()

    // Create Circle
    CGContextAddArc(context, (frame.size.width)/2, frame.size.height/2, (frame.size.width - 10)/2, 0.0, CGFloat(M_PI * 2.0), 1)

    // Draw
    CGContextStrokePath(context);
  }
}

And here is how I add it to the view hierarchy in my view controller:

func addCircleView() {
    let diceRoll = CGFloat(Int(arc4random_uniform(7))*50)
    var circleWidth = CGFloat(200)
    var circleHeight = circleWidth
    // Create a new CircleView
    var circleView = CircleView(frame: CGRectMake(diceRoll, 0, circleWidth, circleHeight))

    view.addSubview(circleView)
}

Is there a way to animate the drawing of the circle over 1 second?

Example, part way through the animation it would look something like the blue line in this image:

partial animation


Source: (StackOverflow)

preload with percentage - javascript/jquery

I did a Google search and I cannot find a way to do a loading with percentage. Anyone know how I can find an example of that?

I need a preload for a website from 0-100 without bar, before show the content, but I cannot find any example.


Source: (StackOverflow)

Backgroundworker won't report progress

I have a background worker running a long database task. i want to show the progress bar while the task is running. Somehow the background worker won't report the progress of the task.

This is what i have:

BackgroundWorker _bgwLoadClients;

_bgwLoadClients = new BackgroundWorker();
_bgwLoadClients.WorkerReportsProgress = true;
_bgwLoadClients.DoWork += new DoWorkEventHandler(_bgwLoadClients_DoWork);
_bgwLoadClients.RunWorkerCompleted += new RunWorkerCompletedEventHandler(_bgwLoadClients_RunWorkerCompleted);
_bgwLoadClients.ProgressChanged += new ProgressChangedEventHandler(_bgwLoadClients_ProgressChanged);
_bgwLoadClients.RunWorkerAsync(parms);

private void _bgwLoadClients_DoWork(object sender, DoWorkEventArgs e)
{
    DataTable dt = getdate();
    e.Result = dt;
}

void _bgwLoadClients_ProgressChanged(object sender, ProgressChangedEventArgs e)
{
    progressBar1.Value = e.ProgressPercentage;
}

I am doing this in WPF, but i guess it won't make a difference.

Thanks in advance


Source: (StackOverflow)

Uploading HTTP progress tracking

I've got WPF application I'm writing that posts files to one of social networks. Upload itself working just fine, but I'd like to provide some indication of how far along I am with the uploading.

I tried a bunch of ways to do this:

1) HttpWebRequest.GetStream method:

using (
 var FS = File.Open(
  localFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
    long len = FS.Length;
    HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
    request.Method = "POST";
    request.ProtocolVersion = HttpVersion.Version11;
    request.ContentType = "multipart/form-data; boundary=--AaB03x";
    //predata and postdata is two byte[] arrays, that contains
    //strings for MIME file upload (defined above and is not important)
    request.ContentLength = predata.Length + FS.Length + postdata.Length;
    request.AllowWriteStreamBuffering = false;
    using (var reqStream = request.GetRequestStream())
    {
        reqStream.Write(predata, 0, predata.Length);
        int bytesRead = 0;
        int totalRead = 0;
        do
        {
            bytesRead = FS.Read(fileData, 0, MaxContentSize);
            totalRead += bytesRead;
            reqStream.Write(fileData, 0, bytesRead);
            reqStream.Flush(); //trying with and without this
            //this part will show progress in percents
            sop.prct = (int) ((100*totalRead)/len);
        } while (bytesRead > 0);
        reqStream.Write(postdata, 0, postdata.Length);
    }
    HttpWebResponse responce = (HttpWebResponse) request.GetResponse();
    using (var respStream = responce.GetResponseStream())
    {
        //do things
    }
}

2) WebClient way (much shorter):

void UploadFile (url, localFilePath)
{
    ...
    WebClient client = new WebClient();
    client.UploadProgressChanged += new UploadProgressChangedEventHandler(UploadPartDone);
    client.UploadFileCompleted += new UploadFileCompletedEventHandler(UploadComplete);
    client.UploadFileAsync(new Uri(url), localFilePath);
    done.WaitOne();

    //do things with responce, received from UploadComplete
    JavaScriptSerializer jssSer = new JavaScriptSerializer();
    return jssSer.Deserialize<UniversalJSONAnswer>(utf8.GetString(UploadFileResponce));
    //so on...
    ...
}

void UploadComplete(object sender, UploadFileCompletedEventArgs e)
{
    UploadFileResponce=e.Result;
    done.Set();
}

void UploadPartDone(object sender, UploadProgressChangedEventArgs e)
{
    //this part expected to show progress
    sop.prct=(int)(100*e.BytesSent/e.TotalBytesToSend);
}

3) Even TcpClient way:

using (
 var FS = File.Open(
  localFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
    long len = FS.Length;
    long totalRead = 0;
    using (var client = new TcpClient(urli.Host, urli.Port))
    {
        using (var clearstream = client.GetStream())
        {
            using (var writer = new StreamWriter(clearstream))
            using (var reader = new StreamReader(clearstream))
            {
                //set progress to 0
                sop.prct = 0;
                // Send request headers
                writer.WriteLine("POST " + urli.AbsoluteUri + " HTTP/1.1");
                writer.WriteLine("Content-Type: multipart/form-data; boundary=--AaB03x");
                writer.WriteLine("Host: " + urli.Host);
                writer.WriteLine("Content-Length: " + (predata.Length + len + postdata.Length).ToString());
                writer.WriteLine();
                //some data for MIME
                writer.Write(utf8.GetString(predata));
                writer.Flush();
                int bytesRead;
                do
                {
                    bytesRead = FS.Read(fileData, 0, MaxContentSize);
                    totalRead += bytesRead;
                    writer.BaseStream.Write(fileData, 0, bytesRead);
                    writer.BaseStream.Flush();
                    sop.prct = (int) ((100*totalRead)/len);
                } while (bytesRead > 0)
                writer.Write(utf8.GetString(postdata));
                writer.Flush();
                //read line of response and do other thigs...
                respStr = reader.ReadLine();
                ...
            }
        }
    }
}

In all cases the file was successfully sent to the server. But always progress looks like this: for a few seconds it runs from 0 to 100 and then waits until file actually uploading (about 5 minutes - file is 400MB).

So I think the data from a file is buffered somewhere and I'm tracking not uploading, but buffering data. And then must wait until it's uploaded.

My questions are:

1) Is there any way to track actual uploading data? That the method Stream.Write() or Flush() (which as I read somewhere, does not work for NetworkStream) did not return until it receives confirmation from the server that the TCP packets received.

2) Or can I deny buffering (AllowWriteStreamBUffering for HttpWebRequest doesn't work)?

3) And does it make sense to go further "down" and try with Sockets?

updated:

To avoid any doubts in the way of progress displaying on UI, I rewrote the code to log a file. so, here is code:

using (var LogStream=File.Open("C:\\123.txt",FileMode.Create,FileAccess.Write,FileShare.Read))
using (var LogWriter=new StreamWriter(LogStream))
using (var FS = File.Open(localFilePath, FileMode.Open, FileAccess.Read, FileShare.Read))
{
    long len = FS.Length;
    HttpWebRequest request = (HttpWebRequest) WebRequest.Create(url);
    request.Timeout = 7200000; //2 hour timeout
    request.Method = "POST";
    request.ProtocolVersion = HttpVersion.Version11;
    request.ContentType = "multipart/form-data; boundary=--AaB03x";
    //predata and postdata is two byte[] arrays, that contains
    //strings for MIME file upload (defined above and is not important)
    request.ContentLength = predata.Length + FS.Length + postdata.Length;
    request.AllowWriteStreamBuffering = false;
    LogWriter.WriteLine(DateTime.Now.ToString("o") + " Start write into request stream. ");
    using (var reqStream = request.GetRequestStream())
    {
        reqStream.Write(predata, 0, predata.Length);
        int bytesRead = 0;
        int totalRead = 0;
        do
        {
            bytesRead = FS.Read(fileData, 0, MaxContentSize);
            totalRead += bytesRead;
            reqStream.Write(fileData, 0, bytesRead);
            reqStream.Flush(); //trying with and without this
            //sop.prct = (int) ((100*totalRead)/len); //this part will show progress in percents
            LogWriter.WriteLine(DateTime.Now.ToString("o") + " totalRead= " + totalRead.ToString() + " / " + len.ToString());
        } while (bytesRead > 0);
        reqStream.Write(postdata, 0, postdata.Length);
    }
    LogWriter.WriteLine(DateTime.Now.ToString("o") + " All sent!!! Waiting for responce... ");
    LogWriter.Flush();
    HttpWebResponse responce = (HttpWebResponse) request.GetResponse();
    LogWriter.WriteLine(DateTime.Now.ToString("o") + " Responce received! ");
    using (var respStream = responce.GetResponseStream())
    {
        if (respStream == null) return null;
        using (var streamReader = new StreamReader(respStream))
        {
            string resp = streamReader.ReadToEnd();
            JavaScriptSerializer jssSer = new JavaScriptSerializer();
            return jssSer.Deserialize<UniversalJSONAnswer>(resp);
        }
    }
}

and here is result (I cut the middle):

2011-11-19T22:00:54.5964408+04:00 Start write into request stream. 
2011-11-19T22:00:54.6404433+04:00 totalRead= 1048576 / 410746880
2011-11-19T22:00:54.6424434+04:00 totalRead= 2097152 / 410746880
2011-11-19T22:00:54.6434435+04:00 totalRead= 3145728 / 410746880
2011-11-19T22:00:54.6454436+04:00 totalRead= 4194304 / 410746880
2011-11-19T22:00:54.6464437+04:00 totalRead= 5242880 / 410746880
2011-11-19T22:00:54.6494438+04:00 totalRead= 6291456 / 410746880
.......    
2011-11-19T22:00:55.3434835+04:00 totalRead= 408944640 / 410746880
2011-11-19T22:00:55.3434835+04:00 totalRead= 409993216 / 410746880
2011-11-19T22:00:55.3464837+04:00 totalRead= 410746880 / 410746880
2011-11-19T22:00:55.3464837+04:00 totalRead= 410746880 / 410746880
2011-11-19T22:00:55.3464837+04:00 All sent!!! Waiting for responce... 
2011-11-19T22:07:23.0616597+04:00 Responce received! 

as you can see program thinks that it uploaded ~400MB for about 2 seconds. And after 7 minutes file actually uploads and I receive responce.

updated again:

Seems to this is happening under WIndows 7 (not shure about x64 or x86). When I run my code uder XP everything works perfectly and progress is shown absolute correctly


Source: (StackOverflow)

IProgress how often to report progress

When using IProgress<T> to report progress, should it be

  • the responsibility of the code reporting progress to limit its progress reports to a frequency that is "reasonable", -or-
  • the responsibility of the specific implementation of IProgress<T> to be aware that the reporting of progress might be at a higher frequency than is reasonable for the way it will be presenting this progress.

The context of the question is I have some code which uses IProgress<T> to report progress, and it reports progress at a very high rate. I want to display progress with a UI progress bar. If I use the provided Progress<T> implementation (which posts progress to the UI SyncronizationContext), then it causes the UI to be unresponsive (i.e. there are so many messages sent to the message queue, that the user can't even click the "Cancel" button on the dialog).

So,

  • I could fix this by reporting less, but what if I had an IProgress<T> implementation that just wrote progress to a log file (and could handle the high reporting frequency). -or-
  • I could fix this by creating my own specific IProgress<T> implementation that limited how often I processed/reported progress. Presumably, this implementation would record the latest progress on a non-UI thread, and then (perhaps) the UI would updated based on a timer.

Source: (StackOverflow)