repeat

Print header/footer on all pages (Print Mode)

纵饮孤独 提交于 2019-11-28 18:42:59
<div id="header">header</div> <div id="content"> content spanning several pages... </div> <div id="footer">Footer - Fixed at the bottom of each page</div> I want to print #header and #footer on every page in print mode. I searched a lot but nothing seems to work, even position:fixed doesn't work as expected. Pat If you're willing to switch over to tables for your layout (not necessarily ideal), you can do it with the <thead> and <tfoot> elements. They'll print at the top and bottom of every page: <table> <thead> <!-- Will print at the top of every page --> </thead> <tbody> <!-- Page content --

Initializing a vector of vectors having a fixed size with boost assign

我的梦境 提交于 2019-11-28 16:23:15
Having a vector of vector with a fixed size, vector<vector<int> > v(10); I would like to initialize it so that it has in all elements a one dimensional vector with initialized value (for example 1). I have used Boost Assign as follows v= repeat(10,list_of(list_of(1))); and I've got a compilation error error: no matching function for call to ‘repeat(boost::assign_detail::generic_list<int>)’ Could you please tell me how to do that. Thanks in advance This doesn't use boost::assign but does what you need: vector<vector<int>> v(10, vector<int>(10,1)); This creates a vector containing 10 vectors of

Repeating background image in native iPhone app

白昼怎懂夜的黑 提交于 2019-11-28 15:05:16
Short of putting a UIWebView as the back-most layer in my nib file, how can I add a repeating background image to an iPhone app (like the corduroy look in the background of a grouped UITableView)? Do I need to create an image that's the size of the iPhone's screen and manually repeat it using copy and paste? Apparently a UIColor is not necessarily a single color, but can be a pattern as well. Confusingly, this is not supported in Interface Builder. Instead you set the backgroundColor of the view (say, in -viewDidLoad) with the convenience method +colorWithPatternImage: and pass it a UI Image.

Find String Inside Outermost Parenthesis

旧时模样 提交于 2019-11-28 14:36:00
Say that I have a string which contains both multiple sets and nesting of parenthesis. I want to extract only the string in the first parenthesis encountered, including whatever nested parenthesis it contains. For example: this (is(maybe)) a test (and maybe not) I want to extract: is(maybe) I believe this can be accomplished without the use of regexes, by which I can easily do it. So my question is how can this be accomplished without regexes? Pseudo code: iterate over chars if char is ( increment counter store position of first ( only if char is ) decrement counter if counter == 0 use index

How do I make my program repeat according to certain circumstances?

时光总嘲笑我的痴心妄想 提交于 2019-11-28 14:30:51
import java.util.Scanner; public class MyFirstGame { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please Enter A Number: "); double s = scanner.nextDouble(); double randomNumber = Math.random(); double realNumber = randomNumber*10; double realerNumber = Math.round(realNumber); System.out.println(realerNumber); if(s==realerNumber) { System.out.println("You Win!"); } else { System.out.println("Try Again..."); } } } So what I am trying to do is make a "game" for my Java class. I have generate a random number between 1 and 10 and the user

Haskell infinite recursion in list comprehension

依然范特西╮ 提交于 2019-11-28 13:07:38
I am trying to define a function that accepts a point (x,y) as input, and returns an infinite list corresponding to recursively calling P = (u^2 − v^2 + x, 2uv + y) The initial values of u and v are both 0. The first call would be P = (0^2 - 0^2 + 1, 2(0)(0) + 2) = (1,2) Then that resulting tuple (1,2) would be the next values for u and v, so then it would be P = (1^2 - 2^2 + 1, 2(1)(2) + 2) = (-2,6) and so on. I'm trying to figure out how to code this in Haskell. This is what I have so far: o :: Num a =>(a,a) -> [(a,a)] o (x,y) = [(a,b)| (a,b)<- [p(x,y)(x,y)]] where p(x,y)(u,v) = ((u^2)-(v^2)

Get duplicate characters in string

随声附和 提交于 2019-11-28 12:59:43
问题 I try to match/get all repetitions in a string. This is what I've done so far: var str = 'abcabc123123'; var REPEATED_CHARS_REGEX = /(.).*\1/gi; console.log( str.match(REPEATED_CHARS_REGEX) ); // => ['abca', '1231'] As you can see the matching result is ['abca', '1231'] , but I excpect to get ['abc', '123'] . Any ideas to accomplish that? 2nd question: Another thing I excpect, is to make it possible to change the duration how often a char needs to be in the string to get matched... For

Set repeatInterval in local notification

走远了吗. 提交于 2019-11-28 12:36:31
I want to set repeat interval to the value which user selects from date picker.I have date picker of type countdown mode in my application.If user selects 4 hours 15 minutes from date picker then I am setting firedate using the following code and alarm rings. [NSDate dateWithTimeIntervalSinceNow:[pickerTimer countDownDuration]] But I want that notification should repeat after every 4 hours 15 minutes until user cancels it. I have done r&d searched a lot but I can not figure out.The code I have used so far is: localNotification = [[UILocalNotification alloc] init]; [localNotification

UserNotification in 3 days then repeat every day/hour - iOS 10

与世无争的帅哥 提交于 2019-11-28 12:11:45
UILocalNotification has been depreciated so I would like to update my code to the UserNotification framework: let alertDays = 3.0 let alertSeconds = alertDays * 24.0 * 60.0 * 60.0 let localNotification:UILocalNotification = UILocalNotification() localNotification.alertAction = "Reminder" localNotification.alertTitle = "Reminder Title" localNotification.alertBody = "Reminder Message" localNotification.fireDate = Foundation.Date(timeIntervalSinceNow: alertSeconds) localNotification.repeatInterval = .day UIApplication.shared().scheduleLocalNotification(localNotification) How can I set a similar

cocos2d sprite repeat animation forever

≡放荡痞女 提交于 2019-11-28 11:48:38
In my iOS game, I hope the hero keep running until screen is touched and the hero should jump. So I write: In .h file: @interface Hero : CCSprite { CCSprite *_hero; id _keepRunning; } @property(nonatomic,retain) id keepRunning; In .m file: @synthesize keepRunning = _keepRunning; -(id) init { _keepRunning = [CCRepeatForever actionWithAction:[CCAnimate actionWithSpriteSequence:@"heroRun%04d.png" numFrames:30 delay:0.02f restoreOriginalFrame:NO]]; } Then when the game starts, I call run () method: -(void) run { [_hero stopAllActions]; [_hero runAction:_keepRunning]; _heroState = RUNNING; } Then I