progress

Tracking file load progress in Python

左心房为你撑大大i 提交于 2020-01-24 10:39:06
问题 A lot of modules I use import entire files into memory or trickle a file's contents in while they process it. I'm wondering if there's any way to track this sort of loading progress? Possibly a wrapper class that takes a callback? 回答1: I would do by this by determining the size of the file, and then simply dividing the total by the number of bytes read. Like this: import os def show_progress(file_name, chunk_size=1024): fh = open(file_name, "r") total_size = os.path.getsize(file_name) total

CSS3简单写个圆形进度条动画

萝らか妹 提交于 2020-01-17 22:29:19
圆圈转动完整代码 html <div id="wrap"> <div class="box-left"> <div class="circle-left"></div> </div> <div class="box-right"> <div class="circle-right"></div> </div> </div> css #wrap{ width: 200px; height: 200px; margin: 200px auto; position: relative; border-radius: 50%; } /*底部圆圈*/ #wrap::before{ content: ""; position: absolute; width: 100%; height: 100%; box-sizing: border-box; left: 0; top: 0; border: 10px solid rgba(255,255,255,0.5); border-radius: 50%; } /*左右两个盒子里面各放着一个半圆圈,主要overflow*/ .box-left, .box-right{ width: 50%; height: 100%; box-sizing: border-box; position: absolute; top: 0; overflow:

PHP file upload progress

大憨熊 提交于 2020-01-17 05:48:16
问题 Has anybody been able to implement this functionality? http://php.net/manual/en/session.upload-progress.php The tl;dr is that when POSTing a form containing a file, if you include an input with the "name" attribute set to the value of session.upload_progress.name in php.ini, then PHP will populate $_SESSION with data about the status of the upload. Form: <form action="upload.php" method="POST" enctype="multipart/form-data"> <input type="hidden" name="<?php echo ini_get("session.upload

Firefox XHR not firing upload progress events

别等时光非礼了梦想. 提交于 2020-01-11 07:44:12
问题 Pretty straight-forward HTML/JS that: Takes a Base64-encoded PNG Converts it to a blob Sets an img.src to verify that it's a valid PNG Uploads it via XHR after setting event handlers In Firefox 12 I get the " loadstart " and " loadend " events but no " progress " events. In Chrome 20 everything works fine. This file is named "image.html" so it just uploads to itself for testing. I also tried setting a content-legnth header but that didn't change the results in Firefox so I commented it out.

How to display upload progress using C# HttpClient PostAsync

我怕爱的太早我们不能终老 提交于 2020-01-10 09:12:48
问题 A am creating a file upload app for Android and iOS using Xamarin PCL and i have managed to implement file upload and some sort of progress bar, but it is not working properly. I saw some answers on stack overflow for displaying download progress, but i want to notify my users about upload progress and did not find any solution. Here is my code: public static async Task<string> PostFileAsync (Stream filestream, string filename, int filesize) { var progress = new System.Net.Http.Handlers

Android控件学习(五)——ProgressBar

谁说胖子不能爱 提交于 2020-01-09 19:29:12
本文继续 《Android控件学习(四)——ImageView》 的代码。 Progress 在界面上显示一个进度条 一、代码示例 < ProgressBar android: id = " @+id/progress_bar " android: layout_width = " match_parent " android: layout_height = " wrap_content " /> 二、运行实例 会有一个一直旋转的圆形进度条在旋转: 那么,怎么样让进度条在数据加载完时消失呢?这就涉及到一个知识点: 三、可见属性 所有的 Android 都有这个属性,可以通过 android:visibility 指定,可选值有三种: visible :默认值,表示控件可见 invisible :控件不可见,但是仍然占据着原来的位置和大小 gone :不可见,且不占用屏幕空间 可以通过 serVisibility() 方法传入 View.VISIBLE , View.INVISIBLE , VIew.GONE 三种值 四、代码示例 控制出现的代码: public void onClick ( View v ) { switch ( v . getId ( ) ) { case R . id . button : if ( progressBar . getVisibility (

Printing an ASCII spinning “cursor” in the console

╄→尐↘猪︶ㄣ 提交于 2020-01-09 17:00:47
问题 I have a Ruby script that does some long taking jobs. It is command-line only and I would like to show that the script is still running and not halted. I used to like the so called "spinning cursor" in the old days and I managed to reproduce it in Ruby under Windows. Question: does this work in the other OS's? If not, is there an OS-independent way to accomplish this? No IRB solutions please. 10.times { print "/" sleep(0.1) print "\b" print "-" sleep(0.1) print "\b" print "\\" sleep(0.1)

《动手实现一个网页加载进度loading》

岁酱吖の 提交于 2020-01-08 03:14:33
loading随处可见,比如一个app经常会有下拉刷新,上拉加载的功能,在刷新和加载的过程中为了让用户感知到 load 的过程,我们会使用一些过渡动画来表达。最常见的比如“转圈圈”,“省略号”等等。 网页loading有很多用处,比如页面的加载进度,数据的加载过程等等,数据的加载loading很好做,只需要在加载数据之前(before ajax)显示loading效果,在数据返回之后(ajax completed)结束loading效果,就可以了。 但是页面的加载进度,需要一点技巧。 页面加载进度一直以来都是一个常见而又晦涩的需求,常见是因为它在某些“重”网页(特别是网页游戏)的应用特别重要;晦涩是因为web的特性,各种零散资源决定它很难是“真实”的进度,只能是一种“假”的进度,至少在逻辑代码加载完成之前,我们都不能统计到进度,而逻辑代码自身的进度也无法统计。另外,我们不可能监控到所有资源的加载情况。 所以页面的加载进度都是“假”的,它存在的目的是为了提高用户体验,使用户不至于在打开页面之后长时间面对一片空白,导致用户流失。 既然是“假”的,我们就要做到“仿真”才有用。仿真是有意义的,事实上用户并不在乎某一刻你是不是真的加载到了百分之几,他只关心你还要load多久。所以接下来我们就来实现一个页面加载进度loading。 首先准备一段loading的html: 1 <!DOCTYPE

写一个网页进度loading

╄→尐↘猪︶ㄣ 提交于 2020-01-07 22:12:13
转自: http://www.jianshu.com/p/4c93f5bd9861 loading随处可见,比如一个app经常会有下拉刷新,上拉加载的功能,在刷新和加载的过程中为了让用户感知到 load 的过程,我们会使用一些过渡动画来表达。最常见的比如“转圈圈”,“省略号”等等。 网页loading有很多用处,比如页面的加载进度,数据的加载过程等等,数据的加载loading很好做,只需要在加载数据之前(before ajax)显示loading效果,在数据返回之后(ajax completed)结束loading效果,就可以了。 但是页面的加载进度,需要一点技巧。 页面加载进度一直以来都是一个常见而又晦涩的需求,常见是因为它在某些“重”网页(特别是网页游戏)的应用特别重要;晦涩是因为web的特性,各种零散资源决定它很难是“真实”的进度,只能是一种“假”的进度,至少在逻辑代码加载完成之前,我们都不能统计到进度,而逻辑代码自身的进度也无法统计。另外,我们不可能监控到所有资源的加载情况。 所以页面的加载进度都是“假”的,它存在的目的是为了提高用户体验,使用户不至于在打开页面之后长时间面对一片空白,导致用户流失。 既然是“假”的,我们就要做到“仿真”才有用。仿真是有意义的,事实上用户并不在乎某一刻你是不是真的加载到了百分之几,他只关心你还要load多久

Text Progress Bar in Console w/ title above

半世苍凉 提交于 2020-01-07 05:07:06
问题 I am using this answer to print a progress bar but want it to print what exactly it is doing while it is progressing. I added a parameter called "current_task" to print_progress() and now would like it to perform as follows. How do I do this? FYI: I'm on on a Unix system: macOS Sierra print_progress(7,10,...remaining params..., "downloading contacts") should print this Currently downloading contacts Progress |████████████████████████████████---------------------| 70% Complete the subsequent