loop

Typescript Loop with Delay

匿名 (未验证) 提交于 2019-12-03 01:46:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I'm trying to create a metronome with Typescript. I have this javascript code: ( function theLoop ( i ) { setTimeout ( function () { metronome . play (); if (-- i ) { theLoop ( i ); } }, 3000 ); // interval set to 3000 })( 10 ); // play it 10 times And I wanted to convert it into Typescript code. Unfortunately I don't know how to do this (espacially regarding the last line => })(10); Can someone help me with this? 回答1: As everyone said, typescipt is a superset of javascript so your code is valid typescript, but here's how to do it

R - Loop in matrix

匿名 (未验证) 提交于 2019-12-03 01:41:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I have two variables, the first is 1D flow vector containing 230 data and the second is 2D temperature matrix (230*44219). I am trying to find the correlation matrix between each flow value and corresponding 44219 temperature. This is my code below. Houlgrave_flow_1981_2000 = window(Houlgrave_flow_average, start = as.Date("1981-11-15"),end = as.Date("2000-12-15")) > str(Houlgrave_flow_1981_2000) ‘zoo’ series from 1981-11-15 to 2000-12-15 Data: num [1:230] 0.085689 0.021437 0.000705 0 0.006969 ... Index: Date[1:230], format: "1981-11-15"

gstreamer appsrc test application

匿名 (未验证) 提交于 2019-12-03 01:39:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I am trying to learn gstreamer appsrc plugin to play AV from a transport stream demultiplexer that I wrote (I know plugins are already available, I wanted to do it myself to learn). I have extracted audio and video elementary streams from the MPEG transport stream; now I have to push it to the appsrc plugin and play it using a gst pipeline (this part is not yet clear to me: as to which plugins to use - any tips will be highly appreciated). I found a sample code on using appsrc , but when I run that, there is no output. I verified that start

How to count min,max in loop (java) [closed]

匿名 (未验证) 提交于 2019-12-03 01:27:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I have problem with coding 1 app for toomorow lectures. So, That program ask user for numbers, on typed "100" it's stops, and it shows: -average -min -max I know what kind of loop, i need to use (do-while right?). But how i'm suppoused to count average,min,max without using arrays ? 回答1: this is shorthand pseudo code because you have to code this yourself: min = max = total = user_input count = 0 do { count ++ input = get_input total += input min or max maybe = input } while ( input != 100 ) average = total / count print stuff good

R: if statements in loop

匿名 (未验证) 提交于 2019-12-03 01:26:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: Basically a followup on this question. I'm still trying to get a grasp of R's vectorising while trying to speed up a coworkers' code. I've read R inferno and Speed up the loop operation in R . My aim is to speed up the following code, the complete dataset contains ~1000columns by 10.000-1.000.000 rows: df3 <- structure(c("X", "X", "X", "X", "O", "O", "O", "O", "O", "O", "O", "O", "O", "O", "O", "O"), .Dim = c(2L, 8L), .Dimnames = list( c("1", "2"), c("pig_id", "code", "DSFASD32", "SDFSD56", "SDFASD12", "SDFSD56342", "SDFASD12231",

Self referencing loop detected in ASP.NET Core [duplicate]

匿名 (未验证) 提交于 2019-12-03 01:23:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: This question already has an answer here: JSON.NET Error Self referencing loop detected for type 15 answers When I try to serialize some domain objects using ASP.NET Core Newsoft JSON.NET it is throwing an exception because it is detecting a self referencing loop. In ASP.NET 4 we used to fix it globally this way: JSON.NET Error Self referencing loop detected for type How can we fix this in ASP.NET Core? 回答1: There is no difference in the way self-referencing loops are handled in ASP.NET 4 compared to ASP.NET Core (previously Asp

How to declare New-Signal-Slot syntax in Qt 5 as a parameter to function

匿名 (未验证) 提交于 2019-12-03 01:18:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: How can I pass signal or slot (member-function, new syntax in Qt 5) as a parameter to function and then call connect ? e.g. I want to write a function that waits for a signal. Note : It is not compile - PointerToMemberFunction is my question. bool waitForSignal(const QObject* sender, PointerToMemberFunction??? signal, int timeOut = 5000/*ms*/) { if (sender == nullptr) return true; bool isTimeOut = false; QEventLoop loop; QTimer timer; timer.setSingleShot(true); QObject::connect(&timer, &QTimer::timeout, [&loop, &isTimeOut]() { loop.quit();

Java Jlayer Mp3 Player - how to repeat and stop song

匿名 (未验证) 提交于 2019-12-03 01:08:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: I'm sorry for my bad English :) I have problem with mp 3 player. I'm using jLayer. This is my code private void formWindowOpened(java.awt.event.WindowEvent evt) { new Thread (){ public void run(){ try { Player prehravac; FileInputStream buff = new FileInputStream(Okno.filename); prehravac = new Player(buff); prehravac.play(); if (prehravac != null) { prehravac.play(); } } catch(Exception e) { } } }.start(); } In my application i need to play song from the beginning to the end. So when song ends I need to start it again and when window closes

ItemReader reader() in infinite loop

匿名 (未验证) 提交于 2019-12-03 00:56:02
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 由 翻译 强力驱动 问题: I implemented ItemReader with JdbcTemplate . The problem is that read() is being invoked in infinite loop. public class MyReader implements ItemReader < Col >, InitializingBean { private JdbcTemplate jdbcTemplate ; private RowMapper < Col > rowMapper ; private String sql ; private DataSource dataSource ; public Col read () throws Exception , UnexpectedInputException , ParseException , NonTransientResourceException { Col col = jdbcTemplate . queryForObject ( sql , null , rowMapper ); return col ; } } Spring batch configuration:

Linux bash script for loop

匿名 (未验证) 提交于 2019-12-03 00:45:01
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试): 问题: i have 1.txt 2.txt and script.php 1.txt: a b c d 2.txt www rrr ttt yyy i want bash file to do this command in Linux: ./script.php -n a -j www>>n_j.txt ./script.php -n a -j rrr>>n_j.txt ./script.php -n a -j ttt>>n_j.txt ./script.php -n a -j yyy>>n_j.txt ./script.php -n b -j www>>n_j.txt ./script.php -n b -j rrr>>n_j.txt ./script.php -n b -j ttt>>n_j.txt . . i have a bat code working with wondows cmd..i wanna a code like it to work with Linux command line @ECHO OFF FOR /F "tokens=1 delims= " %%I IN (1.txt) DO FOR /F "tokens=1 delims= " %%E IN