repeat

Add UIToolBar to all keyboards (swift)

若如初见. 提交于 2019-12-02 17:37:53
I'm trying to add a custom UIToolBar to all of my keyboards with as little repetition. The way I'm currently doing it requires me to add the code to all my viewDidLoads and assign every textfield's delegate to the viewController I'm using. I have tried creating my own UIToolBar subclass but I find that I can't really do that when the target for my "Done" and "cancel" buttons are the self view. Does anyone have any suggestions for creating an easily reusable toolbar? Thanks in advance. override func viewDidLoad() { super.viewDidLoad() var toolBar = UIToolbar() toolBar.barStyle = UIBarStyle

Emacs repeat string n times

自古美人都是妖i 提交于 2019-12-02 17:13:21
I'm learning the basics of navigating/editing in Emacs and I'm curious how one could accomplish the following task: Repeat the string 'bla ' n times in normal text editing mode. Let's say I want to repeat it five times to generate 'bla bla bla bla bla '. I tried... C-u 5 bla ...but the command executes after the 'b' is entered, and I only get 'bbbbb'. I'm sure there's some basic command that can help me here...would somebody be kind enough to enlighten me :)? One way is via a keyboard macro : C-x ( bla C-x ) C-u 4 C-x e You can also just insert the repeat count before the macro termination: C

Repeating sound from one Instance

别等时光非礼了梦想. 提交于 2019-12-02 12:59:41
问题 I've been reading about the different ways of programming sound into a c# XNA game. I've decided on using a sound instance for the volume controls, but while playing a .wav, I've realised that the sound will only play again after it's completed, whereas just using a Sound Effect .Play() (rather than an instance) will cause it to play multiple copies of themselves, should it be asked to. So my question is, in a scenario where holding down a button will cause a single sound effect to play

Repeat different elements of an array different amounts of times

南笙酒味 提交于 2019-12-02 12:45:09
问题 Say I have an array with longitudes, lonPorts lonPort =np.loadtxt('LongPorts.txt',delimiter=',') for example: lonPort=[0,1,2,3,...] And I want to repeat each element a different amount of times. How do I do this? This is what I tried: Repeat =[5, 3, 2, 3,...] lonPort1=[] for i in range (0,len(lenDates)): lonPort1[sum(Repeat[0:i])]=np.tile(lonPort[i],Repeat[i]) So the result would be: lonPort1=[0,0,0,0,0,1,1,1,2,2,3,3,3,...] The error I get is: list assignment index out of range How do I get

How to prevent this query from printing same results twice?

谁说胖子不能爱 提交于 2019-12-02 11:36:46
I managed to create a query that fit my need. But now I am running into issues where given the current way of displaying results the query repeats each and every result twice. How can i make it work correctly where it shows it once. Code: $sql = "SELECT DISTINCT contacts.contact_id, user_accounts.full_name, contact_notes.note_name, contact_notes.type, contact_notes.note_id, contact_posts.why_post, contact_posts.type, contact_posts.post_id FROM contacts, user_accounts, contact_notes, contact_posts WHERE (contacts.system_id = '$sid' AND contacts.contact_id = user_accounts.system_id AND contact

How to Repeat a piece of code a certain amount of times in python

扶醉桌前 提交于 2019-12-02 11:12:46
so basically what Im trying to do is to write a piece of code about making a cup of tea(school homework) so basically here is my code print ("Making A Cup Of Tea") a=input("How many for Tea") print ("there are",a,"People for tea") b=input ("Would you like Sugar? YES/NO") if (b) == ("YES"): c=input("How many sugars?") elif (b) == ("NO"): print ("Okay No sugar") e=input("How Much Milk Would You Like? SMALL/MEDIUM/LARGE") print ("YOUR ORDER IS BEING PROCESSED PLEASE WAIT...") if (a) == ("1"): print("There is",a,"Order with",c,"sugar(s),with",e,"amount of milk") elif (a) >= ("2"): print("There is"

SDWebImage repeating images in cell instead of waiting to load.

大憨熊 提交于 2019-12-02 11:02:46
问题 I am using SDWebImage for fetching images from server to my table view app in IOS. But the problem is that when I scroll down in table view instead of waiting for the images to load it put the images downloaded in the first few rows of table view and repeat those images till the end row and when it downloads the images it changes those repeated images to the actual image for that row. NSURL * url = [NSURL URLWithString:string]; SDWebImageManager *manager = [SDWebImageManager sharedManager];

Python - Repeating code with a while loop

浪子不回头ぞ 提交于 2019-12-02 10:58:56
So here is my question. I have a chunk of input code that I need to repeat in case the input is wrong. So far this is what I have (note that this is just an example code, the actual values I have in print and input are different: input_var_1 = input("select input (1, 2 or 3)") if input_var_1 == ("1"): print ("you selected 1") elif input_var_1 == ("2") print ("you selected 2") elif input_var_1 == ("3") print (you selected 3") else: print ("please choose valid option") What do I add after the ELSE so that all the code between the first IF and last ELIF gets repeated until the input is valid?

SDWebImage repeating images in cell instead of waiting to load.

£可爱£侵袭症+ 提交于 2019-12-02 05:58:12
I am using SDWebImage for fetching images from server to my table view app in IOS. But the problem is that when I scroll down in table view instead of waiting for the images to load it put the images downloaded in the first few rows of table view and repeat those images till the end row and when it downloads the images it changes those repeated images to the actual image for that row. NSURL * url = [NSURL URLWithString:string]; SDWebImageManager *manager = [SDWebImageManager sharedManager]; [manager downloadImageWithURL:url options:0 progress:^(NSInteger receivedSize, NSInteger expectedSize) {

Repeat different elements of an array different amounts of times

不羁的心 提交于 2019-12-02 05:48:27
Say I have an array with longitudes, lonPorts lonPort =np.loadtxt('LongPorts.txt',delimiter=',') for example: lonPort=[0,1,2,3,...] And I want to repeat each element a different amount of times. How do I do this? This is what I tried: Repeat =[5, 3, 2, 3,...] lonPort1=[] for i in range (0,len(lenDates)): lonPort1[sum(Repeat[0:i])]=np.tile(lonPort[i],Repeat[i]) So the result would be: lonPort1=[0,0,0,0,0,1,1,1,2,2,3,3,3,...] The error I get is: list assignment index out of range How do I get rid of the error and make my array? Thank you! You can use np.repeat() : np.repeat(a, [5,3,2,3]) Example