Answer the question
In order to leave comments, you need to log in
How to get rid of Running Gradle task 'assembleDebug' when launching a downloaded project?
When creating a new app in Android Studio everything starts up fine. But if you download some example, then the application does not start and shows an endless download, how to fix it? That is, I downloaded the finished project, I try to run it and I am shown the Running Gradle task 'assembleDebug' and nothing else happens. But if I create a new project myself, then it starts. Could this be because I didn't install Dart and Flutter separately? and installed them through Android Studio and use
Answer the question
In order to leave comments, you need to log in
var x = parseInt(new Date().getTime()/1000);
// x нигде больше не используется, почему сразу не присвоить now_time?
var a = a; // эти строки вообще не нужны
var b = b;
var c = c;
var d = d;
var now_time = x;
if(c>0){
if(b > 0 && a > 0){
if(c>0 && b > 0 && a > 0){
or even if(a && b && c)
if they are not negative. function calc_sum(a, b, c, d, N) {
if (a && b && c) {
var now_time = parseInt(new Date().getTime()/1000);
var timer = c < now_time ? now_time - c : 0;
var per_sec = (a / 3600 / d).toFixed(10);
$('#countSum'+N).html((per_sec * b * timer).toFixed(2));
}
}
function calc_sum(a, b, c, d, N) {
if (a && b && c) {
var now_time = parseInt(new Date().getTime()/1000);
$('#countSum'+N).html(((a / 3600 / d).toFixed(10) * b * (c < now_time ? now_time - c : 0)).toFixed(2));
}
}
but it's quite mosk endures.
Somehow shortened it (by creating an auxiliary func):
function IDbeSum(a,b,c,d,e){
setInterval(calc_sum,1000,a,b,c,d,e);
}
IDbeSum(<?=$cfg["pf1"]?>,<?=$usdat["fa1"]?>,<?=$usdat["sbor"]?>,24,1);
IDbeSum(<?=$cfg["pf2"]?>,<?=$usdat["fa2"]?>,<?=$usdat["sbor"]?>,24,2);
IDbeSum(<?=$cfg["pf3"]?>,<?=$usdat["fa3"]?>,<?=$usdat["sbor"]?>,24,3);
IDbeSum(<?=$cfg["pf4"]?>,<?=$usdat["fa4"]?>,<?=$usdat["sbor"]?>,24,4);
IDbeSum(<?=$cfg["pf5"]?>,<?=$usdat["fa5"]?>,<?=$usdat["sbor"]?>,24,5);
Why are constructions like var a=a needed and why should the current time be first assigned to x and then transferred to now_time? It is possible to place at once in now_time.
You can also combine conditions: c>0 && a>0 && b>0
You can also use such a thing as a closure (closure) if you know how to do it, although it will not give much reduction here.
And setInerval can be called in a regular for loop:
<?php for ($i=0; $i<5; $i++) echo 'setInterval(calc_sum,1000,"'.$cfg['pf'.$i].'",".$usdat['fa'.$i].'","'.$usdat['sbor'].'",24,"'.$i.'");'; ?>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question