range

Can I limit users to a specific range and zoom level on Google Maps?

I'm implementing a Google Map on a web-page. For the purpose of this project, I want to limit how far users can drag the map, so that they can only view a certain area that falls within two co-ordinates (one specifies north-west, the other, south-east, if you get my meaning). What's the best way to implement this using the Google Maps A...

Groovy range with a 0.5 step size

What's the most elgant way in Groovy to specify a range of integers and the 0.5 steps between them? e.g.: 1, 1.5, 2, 2.5, 3, 3.5, 4 Edit: To clarify: As an end result I need a range object for use in a Grails constraint. Though I suppose a list would be OK too. ...

Numerical range iterators in boost?

I'm aware of the range iterators in boost, and as for this reference, it seems there should be an easy way of doing what I want, but it's not obvious to me. Say I want to represent a numerical range, 0 to 100 (inclusive or not), say range(0,100). I would like to do something like: for_each(range<int>(0,100).begin(), range<int>(0,100).e...

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

How to script a comparison of a number against a range? 1 is not within 2-5 or 3 is within 2-5 ...

Business Weeks

I need a function in php that will calculate the business week in a specific format within a given date range. Example: startDate = 02-03-2009 endDate = 31-12-2010 Mar 2-6 Mar 9-13 Mar 16-20 Mar 23-27 Mar 30 - Apr 3 Apr 6 - 10 and so on... ...

Generate a different range in Ruby i.e. all possible /[0-9A-Za-z]{3}/

I feel like I'm using Ruby the wrong way here: I want to generate all possible matches for the regular expression /[0-9A-Za-z]{3}/ I can't use succ because "999".succ => "1000" and "zZz".succ => "aaAa". I'm having trouble using ranges because I can't seem to union (0..9), ('A'..'Z'), ('a'..'z') So I wrote: def alphaNumeric #range an...

How to find whether a number belongs to a particular range in Python ?

Suppose i want to check 1.1 belongs to range 0 to 0.5 how can i do it? with range i can do : for i in range(0,0.5): if i == 1.1: print 'yes' if i != 1.1: print 'no' Is ther any other way to do this ???? ...

How to divide a set of overlapping ranges into non-overlapping ranges?

Let's say you have a set of ranges: 0 - 100: 'a' 0 - 75: 'b' 95 - 150: 'c' 120 - 130: 'd' Obviously, these ranges overlap at certain points. How would you dissect these ranges to produce a list of non-overlapping ranges, while retaining information associated with their original range (in this case, the letter after the range)? For ...

How to get nodes lying inside a range with javascript?

I'm trying to get all the DOM nodes that are within a range object, what's the best way to do this? var selection = window.getSelection(); //what the user has selected var range = selection.getRangeAt(0); //the first range of the selection var startNode = range.startContainer; var endNode = range.endContainer; var allNodes = /*insert ma...

Clear/Standard name for a Unit Range [0->1]

Hi, I'm writing a Range class at the moment and I'm looking for a good name for the common range [0->1]. If it was a vector of length 1, I would call it a Unit vector. Is there a clear name to give this range/interval? Possibly a Unit Range? ...

How can I add non-sequential numbers to a range?

I am trying to iterate through the range(750, 765) and add the non-sequential numbers 769, 770, 774. If I try adding the numbers after the range function, it returns the range list, then the individual numbers: >>> for x in range(750, 765), 769, 770, 774: print x ... [750, 751, 752, 753, 754, 755, 756, 757, 758, 759, 760, 761, 762, 76...

How do I find start and end rows of merged cells in Excel with VBSCript?

From a VBS script I have to work with an Excel book with the format: | A | B | C | ----|-----------|-----------|-----------| 1 | Header1 | Header2 | Header3 | ----|-----------|-----------|-----------| 2 | FOLDER1 | | | ----|-----------|-----------|-----------| 3 | Item1 |...

(Ruby) How do you check whether a range contains a subset of another range?

If I have two ranges that overlap: x = 1..10 y = 5..15 When I say: puts x.include? y the output is: false because the two ranges only overlap partially. But if I want it to be "true" when there is partial overlap between two ranges, how would I write that? In other words I need a way to know when one range contains a subset of...

Live Range vs Reaching Definitions

In compiler data flow analysis, what is the difference between a live range of a variable and it's reaching definition? Both seem to refer to the same thing... ...

best data structure for sorted time series data that can quickly return subarrays?

I'm in need of a datastructure that is basically a list of data points, where each data point has a timestamp and a double[] of data values. I want to be able to retrieve the closest point to a given timestamp or all points within a specified range of timestamps. I'm using c#. my thinking was using a regular list would be possible, wher...

how get last number in range in python

there is a way to get the last number in range i need to get the last number in fibonacci sequence for first 20 terms or can to do with a list instead range? ...

break an IEnumerable<int> query which uses Enumerable.Range

Hi I have this following IEnumerable LINQ query: var query = from p in Enumerable.Range(2, 1000000) let sumofPowers = from ch in p.ToString() let sumOfPowers = Math.Pow(Convert.ToDouble(ch.ToString()), 5) select sumOfPowers where p == sumofPowers.Sum() select p; It finds the sum of all the numbers that can ...

Is it possible to implement a Python for range loop without an iterator variable?

Is is possible to do this; for i in range(some_number): #do something without the i? If you just want to do something x amount of times and don't need the iterator. ...

In VBA, how to return an array / or write to cells using a function?

Using this very simple function: Function WriteArray() as Variant Dim array(0 To 2) array(0) = "A" array(1) = "B" array(2) = "C" WriteArray = array End Function I was expecting to see in result the whole array in my Excel spreadsheet, but that's not the case: I get only the first string. I know there is trick to show the whole ar...

Can I iterate over the elements that are in one range of iterators but not in another?

Let's say I have a sequential container, and a range (pair of iterators) within that container of elements that are currently 'active'. At some point, I calculate a new range of elements that should be active, which may overlap the previous range. I want to then iterate over the elements that were in the old active range but that are not...