range

SQL Query to check ALL days exist between a date range

Hi, I have a table of Prices with a start date, end date and price. I want a search to pass in a date range and return whether a price exists for all days in that range. The date range can span multiple prices, just not have any gaps in between. Is this possible? Prices startDate datetime endDate datetime price DECLARE @startDate dat...

How to print a range with decimal points in Python?

I can print a range of numbers easily using range, but is is possible to print a range with 1 decimal place from -10 to 10? e.g -10.0, -9.9, -9.8 all they way through to +10? ...

Are upper bounds of indexed ranges always assumed to be exclusive?

So in Java, whenever an indexed range is given, the upper bound is almost always exclusive. From java.lang.String: substring(int beginIndex, int endIndex) Returns a new string that is a substring of this string. The substring begins at the specified beginIndex and extends to the character at index endIndex - 1 From java.util....

How can I randomly iterate through a large Range?

I would like to randomly iterate through a range. Each value will be visited only once and all values will eventually be visited. For example: class Array def shuffle ret = dup j = length i = 0 while j > 1 r = i + rand(j) ret[i], ret[r] = ret[r], ret[i] i += 1 ...

Calculating a range of an exact number of values in Python

Hello, I'm building a range between two numbers (floats) and I'd like this range to be of an exact fixed length (no more, no less). range and arange work with steps, instead. To put things into pseudo Python, this is what I'd like to achieve: start_value = -7.5 end_value = 0.1 my_range = my_range_function(star_value, end_value, length...

Determining if an offset is in between line numbers?

hi I need to determine if a given selection is in between a start line and an end line. I have an ILineRange and a given offset within the viewport of eclipse. (I need to know, if the selection (from a remote party) was made within the current viewport of the local user. Unfortunately, I cannot get an ILineRange from the selection. I mus...

how to use timeuuid names in cassandra

Hi guys, I have a problem, I would like to build logging system which will be using timeuuid type as a column name which will allow me ask for it later. Since for range queries order by time I need to use timeuuid type I would like to ask you how can I specify range queries for timeuuid column names if timeuuid is every time unique and...

Intersecting boundaries with lucene

I'm using Lucene, and I'm trying to find a way to index and retrieve documents that have a ranged property. For example I have: Document 1: Price:[30 TO 50] Document 2: Price:[45 TO 60] Document 3: Price:[60 TO 70] And I would like to search for all the documents whose ranges intersect a specific interval, in the above example, if I ...

Most appropriate exception for a collection not being initialised?

What is the most appropriate .Net exception type for when you have a class which must have its collection property initialised with at least one item? I'm thinking that it would be an ArgumentOutOfRangeException but is there something more appropriate based on a collection? ...

Make a range in postgres

Hi, how can I make a range in a select in PostgreSQL ? I'd like to have this return: num --- 1 2 3 4 5 6 In a query like: SELECT range(1,6) AS num; ...

Python 3 with the range function

I can type in the following code in the terminal, and it works: for i in range(5): print(i) And it will print: 0 1 2 3 4 as expected. However, I tried to write a script that does a similar thing: print(current_chunk.data) read_chunk(file, current_chunk) numVerts, numFaces, numEdges = current_chunk.data print(current_chunk.da...

Automatic Adjusting Range Table

I have a table with a start date range, an end date range, and a few other additional columns. On input of a new record, I want to automatically adjust any overlapping date ranges (shrinking them, splitting them, or deleting them to allow for the new input -- see algorithm below). I also want to ensure that no overlapping records can a...

MySQL range date overlap check

This table is used to store sessions CREATE TABLE session ( id int(11) NOT NULL AUTO_INCREMENT , start_date date , end_date date ); INSERT INTO session (start_date, end_date) VALUES ("2010-01-01", "2010-01-10") , ("2010-01-20", "2010-01-30") , ("2010-02-01", "2010-02-15") ; We don't want to have conflict between ranges Let's sa...

Java: random long number in 0 <= x < n range.

Random class has a method to generate random int in a given range. For example: Random r = new Random(); int x = r.nextInt(100); This would generate an int number more or equal to 0 and less than 100. I'd like to do exactly the same with long number. long y = magicRandomLongGenerator(100); Random class has only nextLong(), but it ...

How do I print array values in a range when values are supplied?

My php reads in xml and I want to ouput the values within a given range. I have no way of knowing the size of the array or the range. However, I do know where to start; I have a $key that holds my current location. I also know where to stop; I have the word "ENDEVENTS" between each set. I want to get the values from my current position (...

about ruby range?

like this range = (0..10) how can I get number like this: 0 5 10 plus five every time but less than 10 if range = (0..20) then i should get this: 0 5 10 15 20 ...

Subtracting Delphi Time Ranges from a Date Range, Calculate Remaining Time

I'm looking for an algorithm that will help calculate a workday working time length. It would have an input date range and then allow subtracting partially or completely intersecting time range slices from that date range and the result would be the number of minutes (or the fraction/multiple of a day) left in the original date range, a...

How do I pass a Range to a Sub in Word VBA?

I know this sounds simple, but seemingly it is not. If I write this in Word VBA, it always says "incompatible types" - why? And how do I make it work? Thank you very much for your help! Sub GetRange() Dim r As Range Set r = ActiveDocument.Paragraphs(5).Range ProcessRange (r) End Sub Sub ProcessRange(r As Range) Debug.Pr...

Range of inputs on Blackberry's accelerometer

I am looking at using the accelerometer as an input channel for controlling a game on the Blackberry. However, I only want to respond to it when the user makes a violent motion to the left or the right. So my question is: what is the range of input to expect from a user holding the device in their hands and what threshold should I set ...

Range-based for statement definition redundancy

Looking at n3092, in §6.5.4 we find the equivalency for a range-based for loop. It then goes on to say what __begin and __end are equal to. It differentiates between arrays and other types, and I find this redundant (aka confusing). It says for arrays types that __begin and __end are what you expect: a pointer to the first and a pointer...