Questions tagged [intervals]

Intervals are used to measure “distance” between values.

Intervals are used to measure “distance” between values.

In the DBMS world interval typically refers to the period between 2 timestamps, many modern RDBMS systems natively supports intervals and operation with them.

More information on the intervals can be found in the wild.

2903 questions
17
votes
4 answers

SymPy: Limit symbol/variable to interval

Using SymPy, is it possible to limit the possible values of a symbol/variable to a certain range? I now I can set some properties while defining symbols, like positive=True, but I need more control, i.e. I need to set it to be in the interval [0,1].…
Se Norm
  • 1,715
  • 5
  • 23
  • 40
17
votes
1 answer

Making a interval timer in Java android

I have plans to create an interval app using timers. It should just be the most basic So I'll have to add some more when I've understood the basics. What I want to achieve is to select the number of minutes an interval should last, yet how many…
Hans Fredrik
  • 235
  • 1
  • 2
  • 8
17
votes
4 answers

Implementing a dynamic multiple timeline queue

Introduction I would like to implement a dynamic multiple timeline queue. The context here is scheduling in general. What is a timeline queue? This is still simple: It is a timeline of tasks, where each event has its start and end time. Tasks are…
schlamar
  • 9,238
  • 3
  • 38
  • 76
16
votes
3 answers

With `pandas.cut()`, how do I get integer bins and avoid getting a negative lowest bound?

My dataframe has zero as the lowest value. I am trying to use the precision and include_lowest parameters of pandas.cut(), but I can't get the intervals consist of integers rather than floats with one decimal. I can also not get the left most…
joelostblom
  • 43,590
  • 17
  • 150
  • 159
16
votes
7 answers

Display duration in a human readable format such as "X hours, Y minutes"

I am using Rails 4, Ruby 2.1 with PostgreSQL. I have a database field called duration which is an interval data type. When pulling out the data in this column it returns in the format of hh:mm:ss, e.g. 01:30:00. I am trying to figure out a way to…
patrick
  • 9,837
  • 3
  • 20
  • 27
16
votes
1 answer

Interval tree algorithm that supports merging of intervals with no overlap

I'm looking for an interval tree algorithm similar to the red-black interval tree in CLR but that supports merging of intervals by default so that there are never any overlapping intervals. In other words if you had a tree containing two intervals…
Dave Griffiths
  • 1,962
  • 19
  • 22
16
votes
5 answers

How to map the PostgreSQL Interval column type in Hibernate?

Under PostgreSQL, I'm using PersistentDuration for the mapping between the sql type interval & duration but it doesn't work. Another user found the same issue & come with his own class: public void nullSafeSet(PreparedStatement statement, Object…
adam
  • 161
  • 1
  • 1
  • 6
16
votes
2 answers

Java: Random long value in an interval

Possible Duplicate: Java: random long number in 0 <= x < n range I want to generate a random long value in an interval but it seems that the Random class nextLong() doesn't accept arguments like nextInt(). What can I do here?
Mintz
  • 929
  • 2
  • 11
  • 17
15
votes
2 answers

Partition into classes: jenks vs kmeans

I want to partition a vector (length around 10^5) into five classes. With the function classIntervals from package classInt I wanted to use style = "jenks" natural breaks but this takes an inordinate amount of time even for a much smaller vector of…
J. Win.
  • 6,662
  • 7
  • 34
  • 52
15
votes
7 answers

Auto-Interval precision in MS Chart

I'm currently using the charting within .NET using System.Windows.Forms.DataVisualization.Charting.Chart. Thus far it seems very powerful, and works great. However, there is a huge problem in terms of how it is auto-calculating intervals. I use a…
drharris
  • 11,194
  • 5
  • 43
  • 56
15
votes
3 answers

MySQL DATE_ADD usage, 5 day interval

I'm trying to select the order total sum ($) and invoice count over a 5 day period in a single query. I can't seem to get this to happen though. The current query I have is here... SELECT COUNT(id) as invoice_count, SUM(orderTotal) as…
Ben
  • 60,438
  • 111
  • 314
  • 488
15
votes
4 answers

Create a jQuery special event for content changed

I'm trying to create a jQuery special event that triggers when the content that is bound, changes. My method is checking the content with a setInterval and check if the content has changed from last time. If you have any better method of doing that,…
Sindre Sorhus
  • 62,972
  • 39
  • 168
  • 232
15
votes
1 answer

Allen's Interval Algebra operations in SQL

I've been struggling to solve a few tricky problems in SQL where I need to infer asset utilisation from event intervals, and have just learned about Allen's Interval Algebra, which seems to be the key to solving these problems. The algebra describes…
Tommy O'Dell
  • 7,019
  • 13
  • 56
  • 69
14
votes
3 answers

Extract left and right limit from a Series of pandas Intervals

I want to get interval margins of a column with pandas intervals and write them in columns 'left', 'right'. Iterrows does not work (documentation says it would not be use for writing data) and, anyway it would not be the better solution. import…
mike
  • 323
  • 3
  • 11
14
votes
6 answers

Terminate a thread after an interval if not returned

I have a thread which grabs some data from network or serial port. The thread must terminate (or return false) if no data is received within 5 seconds. In other words, if running the thread is taking more than 5 seconds it must stop. I am writing in…
Mahdi
  • 198
  • 2
  • 2
  • 9