repeat

How can I make a random array with no repeats?

£可爱£侵袭症+ 提交于 2019-11-29 16:16:30
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', '240', '210', '180', '150', '120', '90', '60', '30']; var Spinner1 = sym.$('Spinner1'); Spinner1.click

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

≯℡__Kan透↙ 提交于 2019-11-29 15:15:57
This question already has an answer here: Replicate each row of data.frame and specify the number of replications for each row 7 answers 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? You can achieve this using base R (i.e. avoiding data.tables), with the following code: df <- 'chr start end

xPages repeat control with scoped variable as data source

最后都变了- 提交于 2019-11-29 14:52:46
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 should contain e.g. two computed fields one is bind to value1, another to value2... Or give me an

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

一个人想着一个人 提交于 2019-11-29 14:27:34
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 repeating bits inside of the larger block, so it doesn't help to just look for the first instances of

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

岁酱吖の 提交于 2019-11-29 12:11:28
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 training application with far fewer documents, on the same server always responds even when the main copy if

repeatedly applying a function until the result is stable

旧街凉风 提交于 2019-11-29 10:55:27
问题 I want to repeatedly apply a function simplify' until the result is "stable" (i.e. simplify'(x) == x ): simplify :: Expr -> Expr simplify expr = let iterations = iterate simplify' expr neighbours = zip iterations (tail iterations) simplified = takeWhile (\(a, b) -> a /= b) neighbours in snd $ last ((expr, expr) : simplified) simplify' :: Expr -> Expr This seems to be a common problem to me. Is there a more elegant solution? Update: I found a much simpler solution, but I'm still looking for a

Bitmap repeat + rounded corners

痴心易碎 提交于 2019-11-29 10:25:27
I am trying to create rectangle with rounded corners and background as repeated bitmaps. I am writing like this, but getting bitmaps in the corners. Could anyone help out? background.xml <?xml version="1.0" encoding="utf-8"?> <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item> <shape> <stroke android:width="1dp" android:color="#FFFFFF" /> <corners android:radius="50dp" /> </shape> </item> <item> <bitmap android:src="@drawable/carbon_4" android:tileMode="repeat" /> </item> </layer-list> As I understand the goal: have a tiled background image with some curved corners.

make string of N characters

一曲冷凌霜 提交于 2019-11-29 09:05:03
Say I have a number=20 and a $value=7 . If I want to make a string of 20 7's using PHP. what's the quickest way to make this? So output like: $a='77777777777777777777'; Any functions to make this easier? $a=str_repeat($value,$number); You can use str_repeat() , e.g. $a=str_repeat('7', 20); Use str_repeat() : $a = str_repeat('7', 20); str_repeat is pretty easy $a = str_repeat('7', 20); $a = str_repeat('7', 20); str_repeat() ...or maybe: $a = str_pad('', 20, '7'); str_pad() 来源: https://stackoverflow.com/questions/9010712/make-string-of-n-characters

How to have a handler to repeat UIView animateWithDuration?

血红的双手。 提交于 2019-11-29 08:45:41
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. 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 the "id" with whatever class type you actually have. - (void)startAnimation { [UIView animateWithDuration:1.0

Preforming scheduled tasks in C# .NET MVC Application

南笙酒味 提交于 2019-11-29 08:13:50
I'm trying to implement a logic for my .NET MVC application where I would trigger scheduled tasks in my application on a following basis: First scheduled task to run from 00 am to 1 am in the morning Second scheduled task to run from 1:10 am to 08:00 am in the morning Third scheduled task to run from 8:15 am to 11:15 pm every 1 hour This would repeat every day 365 days a year... Which mechanism in .NET or external library could I use to implement this the easiest way with little code? I was trying to implement it with Quartz.NET library but I didn't like it at all, I had two scheduled tasks