repeat

How would I tell a bash script to start over from the top?

浪尽此生 提交于 2019-11-28 11:35:40
For example, in the below script startover starts back from the top: ########################################################################## ## CHECK TIME ########################################################################## time=$(date +%k%M) if [[ "$time" -ge 1800 ]] && [[ "$time" -le 2200 ]];then echo "Not a good time to transcode video!" && exit 0 else echo "Excellent time to transcode video!" && echo "Lets get started!" fi ########################################################################## ## CHECK TIME #######################################################################

Javascript: Random number out of 5, no repeat until all have been used

為{幸葍}努か 提交于 2019-11-28 09:31:30
I am using the below code to assign a random class (out of five) to each individual image on my page. $(this).addClass('color-' + (Math.floor(Math.random() * 5) + 1)); It's working great but I want to make it so that there are never two of the same class in a row. Even better would be if there were never two of the same in a row, and it also did not use any class more than once until all 5 had been used... As in, remove each used class from the array until all of them have been used, then start again, not allowing the last of the previous 5 and the first of the next 5 to be the same color.

Repeat the rows in a data frame based on values in a specific column [duplicate]

余生长醉 提交于 2019-11-28 09:21:18
问题 This question already has answers here : Repeat each row of data.frame the number of times specified in a column (7 answers) Closed last year . I would like to repeat entire rows in a data-frame based on the samples column. My input: df <- 'chr start end samples 1 10 20 2 2 4 10 3' df <- read.table(text=df, header=TRUE) My expected output: df <- 'chr start end samples 1 10 20 1-10-20-s1 1 10 20 1-10-20-s2 2 4 10 2-4-10-s1 2 4 10 2-4-10-s2 2 4 10 2-4-10-s3' Some idea how to perform it wisely?

xPages repeat control with scoped variable as data source

感情迁移 提交于 2019-11-28 09:03:41
问题 I need to build repeat control or (view or data table) that uses scoped variable as data source. And the scoped variable should be an array.. Or even just javaScript array.. scoped variable: viewScope.MY_TEST = new Array(); viewScope.MY_TEST.push("Test1"); viewScope.MY_TEST.push("Test2"); or array: var my_arr = new Array(); my_arr.push("Test1"); my_arr.push("Test2"); or even an object/two dimensional array: viewScope.MY_TEST = []; viewScope.MY_TEST .push([value1, value2]); so repeat control

Finding a repeating sequence at the end of a sequence of numbers

冷暖自知 提交于 2019-11-28 08:03:06
问题 My problem is this: I have a large sequence of numbers. I know that, after some point, it becomes periodic - that is, there are k numbers at the beginning of the sequence, and then there are m more numbers that repeat for the rest of the sequence. As an example to make this more clear, the sequence might look like this: [1, 2, 5, 3, 4, 2, 1, 1, 3, 2, 1, 1, 3, 2, 1, 1, 3, ...], where k is 5 and m is 4, and the repeating block is then [2, 1, 1, 3]. As is clear from this example, I can have

XPages performance - 2 apps on same server, 1 runs and 1 doesn't

旧巷老猫 提交于 2019-11-28 05:54:56
问题 We have been having a bit of a nightmare this last week with a business critical XPage application, all of a sudden it has started crawling really badly, to the point where I have to reboot the server daily and even then some pages can take 30 seconds to open. The server has 12GB RAM, and 2 CPUs, I am waiting for another 2 to be added to see if this helps. The database has around 100,000 documents in it, with no more than 50,000 displayed in any one view. The same database set up as a

How can I make a random array with no repeats?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 05:41:59
问题 I've been searching around for some answers to this issue, but nothing seems to work when I try to find a solution. What I'm trying to achieve is to make a spinner in Javascript & Adobe Edge that randomly spins on a number , and does not repeat that number again until all numbers have been spinned. I know this should be fairly easy to do for a decent coder, but I'm not that experienced yet. This is what I have so far, but it is unfinished and buggy: var myArray = ['360', '330', '300', '270',

do-while loop in R

时光毁灭记忆、已成空白 提交于 2019-11-28 05:11:47
I was wondering about how to write do-while-style loop? I found this post : you can use repeat{} and check conditions whereever using if() and exit the loop with the "break" control word. I am not sure what it exactly means. Can someone please elaborate if you understand it and/or if you have a different solution? Pretty self explanatory. repeat{ statements... if(condition){ break } } Or something like that I would think. To get the effect of the do while loop, simply check for your condition at the end of the group of statements. See ?Control or the R Language Definition: > y=0 > while(y <5){

How to have a handler to repeat UIView animateWithDuration?

我与影子孤独终老i 提交于 2019-11-28 02:07:47
问题 I'm using UIView class method animateWithDuration for repeating my view animation. How can I have a handler that could be used to stop this animation later? For example, repeated animation starts in one method and I need to stop it later from another method. 回答1: You could do something like this assuming you have created a canceled property. As noted in the comments the completion block's startAnimation call needs to be wrapped in an async call to avoid a stack overflow. Be sure to replace

PHP: Most frequent value in array

徘徊边缘 提交于 2019-11-27 22:57:16
So I have this JSON Array: [0] => 238 [1] => 7 [2] => 86 [3] => 79 [4] => 55 [5] => 92 [6] => 55 [7] => 7 [8] => 254 [9] => 9 [10] => 75 [11] => 238 [12] => 89 [13] => 238 I will be having more values in the actual JSON file. But by looking at this I can see that 238 and 55 is being repeated more than any other number. What I want to do is get the top 5 most repeated values in the array and store them in a new PHP array. $values = array_count_values($array); arsort($values); $popular = array_slice(array_keys($values), 0, 5, true); array_count_values() gets the count of the number of times each