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
11
votes
3 answers

difference of two sets of intervals

i'm trying to write some code to calculate the difference of two sets of intervals A - B , Interval endpoints are integers , but i'm strugling to come with efficient solution , any suggestion would be much appreciated example : [(1, 4), (7, 9)] -…
11
votes
2 answers

Get time interval in mysql

is there a query for me to get the time interval - One minute, five minutes, quarter hour, half hour, hour, and day? I use MySQL as a database.
hearmeroar
  • 297
  • 1
  • 8
  • 18
11
votes
2 answers

Computing the smallest positive integer not covered by any of a set of intervals

Someone posted this question here a few weeks ago, but it looked awfully like homework without prior research, and the OP promptly removed it after getting a few downvotes. The question itself was rather interesting though, and I've been thinking…
Clément
  • 12,299
  • 15
  • 75
  • 115
11
votes
1 answer

How to fix browser's memory growth when using periodic AJAX/XMLHttpRequest calls?

I've spent the whole weekend to elaborate the memory growth issue within my web application written in Dojo. The web application is going to "run forever", so restarting the browser is not planned. The application is updating dynamic data from…
arm1n
  • 151
  • 1
  • 7
11
votes
3 answers

SQL: Merge Date Ranges

I've a table, which describes work slices of a business working calendar: (date format is 24 hours format) PK | STARTDATE | ENDDATE __________________________________________ 1 | 2012/07/21 02:00 | 2012/07/21 04:00 2 | 2012/07/21…
user1552089
  • 111
  • 1
  • 1
  • 3
10
votes
3 answers

SQL to find time elapsed from multiple overlapping intervals

Not using MSSQL or DB2 or Oracle. No CTE. No OVERLAP predicate. No INTERVAL data type. The situation: on a vehicle to be repaired work can not start until all parts ordered for the job have been received. Parts may be ordered multiple times…
jon
  • 111
  • 1
  • 5
10
votes
6 answers

Plotting a number line in Mathematica

I would like to plot a simple interval on the number line in Mathematica. How do I do this?
James Howard
  • 1,258
  • 2
  • 11
  • 26
10
votes
1 answer

Why does php datetime diff depend on time zones?

See the following code: function printDiff($tz) { $d1 = new DateTime("2015-06-01", new DateTimeZone($tz)); $d2 = new DateTime("2015-07-01", new DateTimeZone($tz)); $diff = $d1->diff($d2); print($diff->format("Year: %Y Month: %M Day:…
Csongor Halmai
  • 3,239
  • 29
  • 30
10
votes
2 answers

Random placement of non-overlapping intervals

I have an interval G, and a set of non-overlapping sub-intervals of various lengths s1, s2, ..., sn. G |--------------------------------------------------------------// //-----------| s1 [---] s3 [------------------] …
Daniel Standage
  • 8,136
  • 19
  • 69
  • 116
10
votes
3 answers

javascript switch using intervals

Can I use intervals in a switch statement? Like switch (parseInt(troops[i])) { case <10: editbox.style.fontSize = "13px"; break; case <100: …
FernandoSBS
  • 655
  • 5
  • 12
  • 23
10
votes
1 answer

Finding minimum number of points which covers entire set of intervals?

Given a set of intervals [x,y] where 0 <= x,y <= 2000 how to find minimum number of points which can cover(i.e. Every interval should contain at least one point in resultant set of points) all intervals? example: Given Set of intervals: [2,5] …
Parth
  • 188
  • 1
  • 1
  • 9
10
votes
6 answers

Optimal room count and sizes for N overlapping Meeting Schedules

I bumped into this question and I am not sure if my solution is optimal. Problem Given N weighted (Wi) and possibly overlapping intervals (representing meeting schedules) , find the minimum number "&" capacity of meeting rooms needed to conduct all…
10
votes
2 answers

php - How To Convert 1 day To Seconds

I am creating a form to set publish interval and want to sum all of the submitted values into seconds. The form consist of fields to determine seconds, minutes, hours, day and so on. I am collecting the submitted values to string by giving date…
Ari
  • 4,643
  • 5
  • 36
  • 52
10
votes
4 answers

R - Faster Way to Calculate Rolling Statistics Over a Variable Interval

I'm curious if anyone out there can come up with a (faster) way to calculate rolling statistics (rolling mean, median, percentiles, etc.) over a variable interval of time (windowing). That is, suppose one is given randomly timed observations (i.e.…
EconomiCurtis
  • 2,107
  • 4
  • 23
  • 33
10
votes
5 answers

How can i loop through a daterange with different intervals?

I have a daterange (from, to) that i want loop through an different intervals (daily, weekly, monthly, ...) How can i loop through this dateranges? Update Thanks for your answers, i came up with the following: interval = 'week' # month, year start…
tonymarschall
  • 3,862
  • 3
  • 29
  • 52