我正在尝试将jQuery UI进度条分成几个部分.
有人知道我会怎么做吗?
示例:(2 - 视觉设计:03 http://wiki.jqueryui.com/w/page/12138028/Progressbar)
(我目前正在使用背景图片,但这不实用.)
是否有可能使用jQuery ajax获取具有非常大的文本字段的表单的上传进度?我认为客户端知道已经发送了多少字节,但是当我使用Google时,我只能使用服务器站点代码找到文件上传的解决方案.
这是我的ajax请求:
$.ajax({
type: "POST",
url: "index.php?action=saveNewPost",
data: {textbox1: textbox1,textbox2: textbox2},
contentType: "application/x-www-form-urlencoded;charset=UTF-8",
success: function(){
//
}
});
Run Code Online (Sandbox Code Playgroud)
我希望有一个类似"onProgress"的东西,其参数包含已发送的字节数量...
找到了解决方案
$.ajax({
xhr: function() {
var req = $.ajaxSettings.xhr();
if (req) {
req.upload.addEventListener('progress', function(event) {
if (event.lengthComputable) {
$('#ajaxFeedbackDiv').html(event.loaded); // = 'test'; //event.loaded + ' / ' + event.total;
}
}, false);
}
return req;
},
type: "POST",
url: "index.php?action=saveNewPost",
data: {textbox1: textbox1,textbox2: textbox2},
contentType: "application/x-www-form-urlencoded;charset=UTF-8"
}
});
Run Code Online (Sandbox Code Playgroud)
这似乎有效,尽管还有
2个问题:
我使用ffmpeg的选择过滤器扫描输入视频以提取某些帧。该选择基于复杂的条件,并且无法预测提取的帧数(我正在进行场景检测,但这可能有所不同-例如选择所有I帧等)。
我需要显示扫描(解码)视频的百分比(例如10%或90%)。
我尝试了几种方法来解析控制台输出,就像人们在处理编码时通常所做的那样,但这对扫描进度没有帮助(例如ffmpeg可以显示进度条吗?还是ffmpeg进度条-PHP中的编码百分比)
ffmpeg -progress sceneProgr.txt -i input.wmv -vsync passthrough -an -vf select='gt(scene\,0.2)',showinfo scene%%05d.png
Run Code Online (Sandbox Code Playgroud)
产生的输出如下:
<..>
frame= 0 fps=0.0 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A
n:0 pts:16550 pts_time:16.55 pos:4205325 fmt:rgb24 sar:0/1 s:640x480 i:P iskey:1 type:I checksum:95895BC9 plane_checksum:[95895BC9]
frame= 1 fps=0.7 q=0.0 size=N/A time=00:00:00.00 bitrate=N/A
n:1 pts:24591 pts_time:24.591 pos:6685325 fmt:rgb24 sar:0/1 s:640x480 i:P iskey:0 type:P checksum:FF4CC015 plane_checksum:[FF4CC015]
'frame=...' and 'n:...' lines are repeated for each of the extracted frames.
Run Code Online (Sandbox Code Playgroud)
双方frame=... …
我试图上传和下载使用(在相同的请求)发送到服务器HttpWebRequest中C#,并由于数据的大小相当大(考虑网速),我想展示如何工作的远做的用户又有多少是离开(不是几秒钟,而是百分比).
我已经阅读了几个尝试实现这一点的例子,但没有一个显示任何进度条.它们都只是用来async在上传/下载时不阻止UI.而且他们主要关注上传/下载,没有人尝试将它们都包含在同一个请求中.
由于我使用.Net 4作为我的目标框架,我async自己无法实现一个方法.如果您要建议任何异步,请使用Begin...方法而不是await关键字!谢谢.
我的应用程序,当我进入活动时,我正在显示一个计时器视图(看起来像一个进度条),它根据服务器的计时器值运行.在开始时(例如40秒),计时器将为绿色,中间(例如25秒)变为黄色,最后变为红色(例如10秒),以下是我正在使用的代码
public class TimerView extends View
{
private LinearInterpolator mInterpolator;
private Transformation mTransformation;
private AlphaAnimation mAnimation;
int orange = Color.rgb(255, 153, 0);
private int green = Color.rgb(107, 155, 21);
private int red = Color.rgb(194, 21, 30);
private int yellow = Color.rgb(225, 170, 0);
private RectF rect;
private Integer mTimerVal = 0;
private Paint tmrPaint;
private Paint txtPaint;
private float mDensity = 1.0f;
public TimerView(Context context, AttributeSet attrs) {
super(context, attrs);
init();
}
private void init() {
mDensity = getResources().getDisplayMetrics().density;
txtPaint …Run Code Online (Sandbox Code Playgroud) 我需要使用循环处理一长串图像.运行所有内容需要相当长的时间,因此我想跟踪进度.
这是我的循环:
files.list <- c("LC82210802013322LGN00_B1.TIF", "LC82210802013322LGN00_B10.TIF",
"LC82210802013322LGN00_B11.TIF", "LC82210802013322LGN00_B2.TIF",
"LC82210802013322LGN00_B3.TIF", "LC82210802013322LGN00_B4.TIF",
"LC82210802013322LGN00_B5.TIF", "LC82210802013322LGN00_B6.TIF",
"LC82210802013322LGN00_B7.TIF", "LC82210802013322LGN00_B8.TIF",
"LC82210802013322LGN00_B9.TIF", "LC82210802013322LGN00_BQA.TIF",
"LC82210802013354LGN00_B1.TIF", "LC82210802013354LGN00_B10.TIF",
"LC82210802013354LGN00_B11.TIF", "LC82210802013354LGN00_B2.TIF",
"LC82210802013354LGN00_B3.TIF", "LC82210802013354LGN00_B4.TIF",
"LC82210802013354LGN00_B5.TIF", "LC82210802013354LGN00_B6.TIF",
"LC82210802013354LGN00_B7.TIF", "LC82210802013354LGN00_B8.TIF",
"LC82210802013354LGN00_B9.TIF", "LC82210802013354LGN00_BQA.TIF",
"LC82210802014021LGN00_B1.TIF", "LC82210802014021LGN00_B10.TIF",
"LC82210802014021LGN00_B11.TIF", "LC82210802014021LGN00_B2.TIF",
"LC82210802014021LGN00_B3.TIF", "LC82210802014021LGN00_B4.TIF",
"LC82210802014021LGN00_B5.TIF", "LC82210802014021LGN00_B6.TIF",
"LC82210802014021LGN00_B7.TIF", "LC82210802014021LGN00_B8.TIF",
"LC82210802014021LGN00_B9.TIF", "LC82210802014021LGN00_BQA.TIF",
"LC82210802014037LGN00_B1.TIF", "LC82210802014037LGN00_B10.TIF",
"LC82210802014037LGN00_B11.TIF", "LC82210802014037LGN00_B2.TIF",
"LC82210802014037LGN00_B3.TIF", "LC82210802014037LGN00_B4.TIF",
"LC82210802014037LGN00_B5.TIF", "LC82210802014037LGN00_B6.TIF",
"LC82210802014037LGN00_B7.TIF", "LC82210802014037LGN00_B8.TIF",
"LC82210802014037LGN00_B9.TIF", "LC82210802014037LGN00_BQA.TIF",
"LC82210802014085LGN00_B1.TIF", "LC82210802014085LGN00_B10.TIF",
"LC82210802014085LGN00_B11.TIF", "LC82210802014085LGN00_B2.TIF",
"LC82210802014085LGN00_B3.TIF", "LC82210802014085LGN00_B4.TIF",
"LC82210802014085LGN00_B5.TIF", "LC82210802014085LGN00_B6.TIF",
"LC82210802014085LGN00_B7.TIF", "LC82210802014085LGN00_B8.TIF",
"LC82210802014085LGN00_B9.TIF", "LC82210802014085LGN00_BQA.TIF"
)
for (x in files.list) { #loop over files
# Tell about progress
cat('Processing image', x, …Run Code Online (Sandbox Code Playgroud) 有没有办法UIWebView从标准中获取从Swift中加载的页面的百分比@IBOutlet?
@IBOutlet var webView: UIWebView!;
Run Code Online (Sandbox Code Playgroud) 我想建立一个具有我的PHP脚本状态的progess栏.我已经读过可以使用session.upload_progress来完成它.
我正在使用laravel Homestead,并且在php.ini中,所有的requerements都是活跃的.
这是我的HTML
{!! Form::open(['route' => 'gebruikers_upload', 'class' => 'form-horizontal import', 'enctype' => 'multipart/form-data', 'target' => 'hidden_iframe']) !!}
<input type="hidden" value="myForm" name="{{ini_get("session.upload_progress.name")}}">
<input type="file" name="file" id="the-file"/>
<button class="btn btn-sm btn-info btn_import" type="submit">Importeer</button>
<button class="btn btn-sm btn-danger" type="button">Cancel</button>
{!! Form::close() !!}
{{--End Form--}}
<iframe id="hidden_iframe" name="hidden_iframe" src="about:blank"></iframe>
<div class="progress">
<div class="progress-bar progress-bar-striped active" role="progressbar" aria-valuenow="25"
aria-valuemin="0" aria-valuemax="100" style="width: 45%">
<span class="">45% Complete</span>
</div>
</div>
Run Code Online (Sandbox Code Playgroud)
提交te路线时:
Route::get('dashboard/gebruikers/upload_status', 'UserController@uploadStatus');
Run Code Online (Sandbox Code Playgroud)
并且在方法uploadStatus的控制器UserController中我有这个
public function uploadStatus(Request $request)
{
session_start();
echo '<pre>';
print_r($_SESSION);
echo '</pre>';
} …Run Code Online (Sandbox Code Playgroud) 我正在制作一个图像上传器,我想显示一个进度条,一旦选择了一个文件就会开始递增.
我正在使用Axios访问后端,并将其设置如下:
const BASE_URL = 'http://localhost:3000';
function uploadImage(data, listingId) {
const url = `${BASE_URL}/listings/${listingId}/images`;
let config = {
onUploadProgress(progressEvent) {
var percentCompleted = Math.round((progressEvent.loaded * 100) /
progressEvent.total);
return percentCompleted;
},
};
return axios.post(url, data, config).
then(x => x.request.response).
catch(error => error);
}
Run Code Online (Sandbox Code Playgroud)
如何percentCompleted从下面的Vue侧访问?
inputDidChange(e) {
let inputData = e.target.files[0];
var formData = new FormData();
formData.append('image', inputData);
uploadImage(formData, this.listingId).
then((x) => {
var xParsed = JSON.parse(x);
this.newFile = xParsed.image.image.url;
this.files.push(this.newFile);
console.log('success');
});
},
Run Code Online (Sandbox Code Playgroud) 我对JavaScript不太熟悉,很难招募服务人员。
我想使用服务人员使整个Web应用程序脱机使用,以在页面加载时缓存必要的文件。尽管这是可行的,但要花很多时间才能将所有文件下载到磁盘上,这会使浏览器无响应,并且用户不耐烦。
我想知道,当服务人员不断努力时,显示进度的最佳方法是什么?以“下载文件25 of 100”的方式。
客户如何知道服务人员的进度?由于工作人员没有DOM访问权限。我必须在工作人员和客户端之间使用消息吗?
这是我在这里的第一个问题,希望我清楚自己,不要发布重复的内容(找不到任何东西)并遵守所有规则。
在此先感谢您的帮助或指导。