Answer the question
In order to leave comments, you need to log in
What is the correct way to pass the WinSCP command?
Hello. I want to automate the work of uploading files using WinSCP. Wrote a little code:
import subprocess
opencom='"open scp://[email protected]/'
hostkey='-hostkey=""ssh-XXXXX XXXXXXXXXXXXXXXXXXXXXXXXXXXXXX""'
privatekey='-privatekey=""C:\Users\User\.ssh\key.ppk""'
passphrase='-passphrase=""key"""'
args = ["C:\\Program Files (x86)\\WinSCP\\WinSCP.com", "/ini=nul", "/command", opencom, hostkey, privatkey, passphrase]
subprocess.Popen(args)
Answer the question
In order to leave comments, you need to log in
as an option, if you are loading something, via ajax, then you can use this
$.ajax({
beforeSend: function () {
preloader.fadeIn(); //функция начала загрузки
},
success: function(){
preloader.fadeOut(); // функция конца загрузки
}
});
The easiest way is to simulate the download progress. First load the block with a stub and loading, for example: getbootstrap.com/components/#progress-animated
then in js after full load or when ready do display:none; for a stub. The loading progress indicator can theoretically be tied to large photos, for example. Through:
$('селектор_крупной_фотки').load(function(){
$('селектор_индикатора').css('width','80%');
});
Hello!
In my opinion, there is no point in making the preloader a percentage, since it is impossible to determine what to take as a percentage unit of a given progressbar. Number of pictures, scripts? If you do a progressbar as Sergey Suntsev suggested , then there will only be positions in the progressbar, which does not make sense (as part of the page load). If you do as Alexander Aksentiev suggested , i.e. the number of scripts is taken as 100%, then in general the progressbar will show the left number. Uploading (maybe 1000) css files, pictures, fonts will not be counted. And, if some script does not load, this does not mean that the page has not loaded.
I think the best option is to hide the content until the page is fully loaded, and show the preloader until it loads.
There is no way to do this.
Especially if you use loadable modules with dependencies.
If the number of scripts is fixed, you can of course set 100% as the number of all scripts and add a callback to each script that it has loaded.
And build progress on this, but this is far from automatic, and it will come out quite gemorno.
The only place where I met a real percentage-based loading bar of a site is a flash site.
Only for this (website on flash) ... hmm. This is bad.
In the case of loading resources in the classical way, as far as I know, there is no such adequate possibility.
You can do this if you load resources with some kind of library that can do a callback on loading a single element (I remember yepnope and head.js for js and css, for pictures it probably also exists). In this case, you will have to measure manually (in advance) and put the sizes of each element into an array (for example, {logo.css: 33kb, libs.js: 11kb, img01.jpg: 123kb}). Thus, you will know in advance the volume of all information and the contribution of each element, and by loading individual parts you will receive percentage readiness.
If this is not automated, then every time the file size is changed, the array will have to be updated, in addition, such a page looks strange in the eyes of the search engine (because everything in it is loaded by JS).
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question