range

How do I pass worksheet and ranges as variables?

主宰稳场 提交于 2019-12-13 16:01:16
问题 I want to pass the names of sheets and ranges between subroutines. The following throws a "Subscript out of range" error: Sub This() x = "Sheet1" y = "D3" MsgBox (x.Range(y).Value) End Sub This is a sample of my Project Explorer. 回答1: Your worksheet's .Name property is Valuation ; its Worksheet .CodeName property is Sheet1 . dim x as string, y as string dim xx as worksheet, yy as range x = "Valuation" set xx = worksheets(x) y = "D3" set yy = xx.range(y) debug.print yy.address(0,0, external:

MySQL count rows in multiple date ranges?

冷暖自知 提交于 2019-12-13 15:56:10
问题 I want to count the rows in several date ranges (i.e: last hour, today, this week, last 30 days) from a given table. I need to know how many entries are in this time/date periods to be able to tell if a given user has reach the limit for each one of this ranges. For instance, a user can have max 300 entries one month but with a (hourly/daily/weekly/monthly) limit. So far I'm trying with a subquery approach using a SELECT CASE similar to this one: group by range in mysql Which should be the

Styling seek slider

梦想与她 提交于 2019-12-13 15:43:10
问题 I have this video player here and I'm having trouble with something. I'm Trying to make the seekslider show a different color after the slider thumb. This is What I'm trying to achive I looked everywhere and cannot find one that works and matches a the style I'm looking for, Is there any possible way to do this. var vid, playbtn, seekslider, curtimetext, durtimetext, mutebtn, volumeslider, fullscreenbtn; function intializePlayer(){ // Set object references vid = document.getElementById("my

How To Select A Range in an Iframe With “Start” and “End” in Firefox like “selectionStart” from inputs element

為{幸葍}努か 提交于 2019-12-13 15:24:17
问题 for Internet Explorer, I have the current code to select a range in an iframe with desingMode setting to on: var Range = window.document.selection.createRange(); var obj = { start: 3 , end : 6 } Range.collapse( true ); Range.moveStart( 'character', obj.start ); Range.moveEnd( 'character', obj.end - obj.start ); Range.select(); Most useful if I want select only one piece of a string by only 2 parameters. Start and End ( for input elements exists the properties selectionStart and selectionEnd )

Create an array of a range of letters starting after A and finishing after Z ie (B to AC)

瘦欲@ 提交于 2019-12-13 14:55:00
问题 I am working with the Roo Gem and wanted to pull data from a spreadsheet based on standard A1 syntax. I have columns in the spreadsheet beyond Z so Excel does the whole AA, AB, AC column positions. I want to create an array for columns W to AH. Ruby doesn't seem to like when the upper range extends past Z but hasn't started from A?? Any ideas how to ("B".."AC").to_a and not get [] Here is the basic problem in irb. ("A".."Z").to_a #=> ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L"

How can I compare a number against a range in bash or Perl?

旧巷老猫 提交于 2019-12-13 11:49:45
问题 How to script a comparison of a number against a range? 1 is not within 2-5 or 3 is within 2-5 回答1: It's even better in Perl6 . Chained comparison operators: if( 2 <= $x <= 5 ){ } Smart-match operator: if( $x ~~ 2..5 ){ } Junctions: if( $x ~~ any 2..5 ){ } Given / When operators: given( $x ){ when 2..5 { } when 6..10 { } default{ } } 回答2: In Perl: if( $x >= lower_limit && $x <= upper_limit ) { # $x is in the range } else { # $x is not in the range } 回答3: In bash: $ if [[ 1 -gt 2 && 1 -lt 5 ]]

Kotlin: Lambdas, range, map, filter and reduce/fold

穿精又带淫゛_ 提交于 2019-12-13 11:23:52
问题 Using the functions such as lambdas, range, map, filter and reduce/fold, calculate the sum of numbers between 1 and 1000 which are divisible by 5 or 3 and print the result. 回答1: We can do the following: println((1..1000).filter{ it % 3 == 0 || it % 5 == 0 }.reduce{sum, element -> sum + element}) Instead of reduce we could use sum as well which would look like this: println((1..1000).filter{ it % 3 == 0 || it % 5 == 0 }.sum()) 来源: https://stackoverflow.com/questions/55132231/kotlin-lambdas

Python : what would be the ouput of range(x,y) if x>y

浪子不回头ぞ 提交于 2019-12-13 11:23:05
问题 Let x and y be two integers : How range(x,y) such x>y would be considered in Python ? I tried following code in both python 2.7 and python 3.3: for i in range(10,3): print i I thought range(10,3) should be considered as the list [0,3,6,9], but this portion of code isn't rendering anything. 回答1: You have two options: rearrange the input values, range(0, 10, 3) # => (0, 3, 6, 9) write a wrapper function which rearranges them for you: def safe_range(a, b): return range(0, max(a,b), min(a,b))

Python script to find nth prime number

北慕城南 提交于 2019-12-13 10:53:17
问题 I'm new to Python and I thought I'd try to learn the ropes a bit by writing a function to find the nth prime number, however I can't get my code to work properly. No doubt this is due to me missing something fundamental, but I'd appreciate your help in finding where it went wrong! c=2 n=input("Which prime would you like? ") n=int(n) a=[] l=len(a) while l<=n: if c==2: a.append(c) elif (c % 2 ==0): #c is even break elif (c % 2 !=0): #c is odd if c<7: a.append(c) elif c >=7: for i in range(3,int

Trying to make loop for a function that stops after the result is lower than a certain value

余生颓废 提交于 2019-12-13 10:52:35
问题 I'm taking a beginner python class and part of an exercise we were given was this: The point x with the property x= sin(x)−ax+ 30 is called a fixed point of the function f(x) = sin(x)−ax+ 30. It can be computed with the so-called fixed point iteration: x(i+1)= sin(x(i))−ax(i)+ 30, where the superscript (i) denotes an iteration counter. Here you find a piece of Python code which performs the first 200 steps of this x=0.5 a=0.5 for i in range(200): x = sin(x) - a*x + 30 print('The result after