How to measure download speed and progress using requests?

see here: Python progress bar and downloads i think the code would be something like this, it should show the average speed since start as bytes per second: import requests import sys import time def downloadFile(url, directory) : localFilename = url.split(“https://stackoverflow.com/”)[-1] with open(directory + “https://stackoverflow.com/” + localFilename, ‘wb’) as f: start = time.clock() r = … Read more

Backgroundworker won’t report progress

You need to break your DoWork method down into reportable progress and then call ReportProgress. Take for example the following: private void Something_DoWork(object sender, DoWorkEventArgs e) { // If possible, establish how much there is to do int totalSteps = EstablishWorkload(); for ( int i=0; i<totalSteps; i++) { // Do something… // Report progress, hint: … Read more

Using Bash to display a progress indicator (spinner) [duplicate]

In this example using SCP, I’m demonstrating how to grab the process id (pid) and then do something while that process is running. This displays a simple spinnng icon. /usr/bin/scp [email protected]:file somewhere 2>/dev/null & pid=$! # Process Id of the previous running command spin[0]=”-” spin[1]=”\\” spin[2]=”|” spin[3]=”https://stackoverflow.com/” echo -n “[copying] ${spin[0]}” while [ kill -0 … Read more

JavaScript loading progress of an image

With this, you add 2 new functions on the Image() object: Image.prototype.load = function(url){ var thisImg = this; var xmlHTTP = new XMLHttpRequest(); xmlHTTP.open(‘GET’, url,true); xmlHTTP.responseType=”arraybuffer”; xmlHTTP.onload = function(e) { var blob = new Blob([this.response]); thisImg.src = window.URL.createObjectURL(blob); }; xmlHTTP.onprogress = function(e) { thisImg.completedPercentage = parseInt((e.loaded / e.total) * 100); }; xmlHTTP.onloadstart = function() { … Read more

Custom Progress Bar in Android? [closed]

As shown here you can use image views to get custom scroll bar like effect. The layout XML for custom progress bar in that example is: <RelativeLayout android:id=”@+id/RelativeLayout01″ android:layout_width=”fill_parent” xmlns:android=”http://schemas.android.com/apk/res/android” android:gravity=”center” android:layout_height=”wrap_content” android:paddingLeft=”30sp” android:paddingRight=”30sp”> <ImageView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”https://stackoverflow.com/questions/4581812/@drawable/progress_1″ android:id=”@+id/imgOne” android:tag=”1″></ImageView> <ImageView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”@drawable/progress_2″ android:id=”@+id/imgTwo” android:layout_toRightOf=”@id/imgOne” android:tag=”2″></ImageView> <ImageView android:layout_width=”wrap_content” android:layout_height=”wrap_content” android:src=”@drawable/progress_3″ android:id=”@+id/imgThree” android:layout_toRightOf=”@id/imgTwo” android:tag=”3″></ImageView> <TextView … Read more

preload with percentage – javascript/jquery

I recommend this plugin. Its amazing download from http://demo.inwebson.com/download/jpreloader.zip see in action here http://www.inwebson.com/demo/jpreloader/ <script type=”text/javascript” src=”https://stackoverflow.com/questions/4999703/js/jpreLoader.js”></script> <script type=”text/javascript”>// <![CDATA[ $(document).ready(function() { $(‘body’).jpreLoader(); }); // ]]></script> here are the links to new version jpreloader 2.1 http://demo.inwebson.com/download/jpreloader-v2.zip http://www.inwebson.com/demo/jpreloader-v2/