intervals

SQL to find time elapsed from multiple overlapping intervals

ぐ巨炮叔叔 提交于 2019-11-27 21:36:37
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 prior to the start of repair. We need to extract the time for which the vehicle was on "parts hold" So for a vehicle identified as id = 1 parts were ordered (d1) and received (d2) on 4 different occasions ID d1 d2 1 8/1 8/8 1 8/2 8/6 1 8/12 8/14 1 8/3 8/10 8/1 8/8 d1 d2 |-------------------------------| 8/2 8/6 8/12 8/14 d1 d2 d1 d2 |---------------| |-----

AJAX Interval Refresh?

安稳与你 提交于 2019-11-27 21:03:38
问题 I'm trying to make an AJAX function update about 30 seconds. I have a simple version of that done, here is the code. var refInterval = window.setInterval('update()', 30000); // 30 seconds var update = function() { $.ajax({ type : 'POST', url : 'post.php', success : function(data){ $('.voters').html(data); }, }); }; This works, however, when the function is FIRST called I don't want it to wait 30 seconds, I just want the function to call, then wait 30 seconds, call again, wait 30 seconds, call

Finding matching interval(s) in pandas Intervalindex

穿精又带淫゛_ 提交于 2019-11-27 20:47:34
There's this interesting API called Intervalindex new in 0.20 that lets you create an index of intervals. Given some sample data: data = [(893.1516130000001, 903.9187099999999), (882.384516, 893.1516130000001), (817.781935, 828.549032)] You can create the index like this: idx = pd.IntervalIndex.from_tuples(data) print(idx) IntervalIndex([(893.151613, 903.91871], (882.384516, 893.151613], (817.781935, 828.549032]] closed='right', dtype='interval[float64]') An interesting property of Interval s is that you can perform interval checks with in : print(y[-1]) Interval(817.78193499999998, 828

MySQL select rows from exactly 7 days ago

痴心易碎 提交于 2019-11-27 17:21:58
问题 I'm completely stumped on this one, being trying for hours but with no success, hoping someone can help. Trying to build a cron script to run daily that returns the rows that are exactly 7 days older than the current date. The thing is, my query is not returning anything. No error messges, nothing (I know there are entries in the DB from the last 7 days - we get about 7000 new entries a day, so they are there!) I've tried a SELECT * and echo out the edit date with success, so everything is

javascript interval

六月ゝ 毕业季﹏ 提交于 2019-11-27 15:47:22
How can I use interval in js? For example I want to call a function every 5 seconds? <script type="text/javascript"> setInterval(openAPage(), 5000); function openAPage() { var startTime = new Date().getTime(); var myWin = window.open("http://www.sabah.com.tr","_blank") var endTime = new Date().getTime(); var timeTaken = endTime-startTime; </script> This script doesn't work, anyone know why? These answers are thorough and good; I just want to specifically fix yours. See the other answers for HOW/WHY. setInterval(openAPage, 5000); Note the lack of () . Also, you're missing the closing } on the

Run a function in time interval in jQuery

和自甴很熟 提交于 2019-11-27 15:03:01
I want to make a banner by using jQuery. When the page loaded script will show a group of photos one by one. For example, the controller sends 10 photos and each photo will be shown in 30 seconds after 10 minutes the script demand another photo from the controller. The question is: How can I make a function that runs in 30 sec. I need to run a function in a time interval without any button click or anything else. The main method is: setInterval(function () { console.log('it works' + new Date()); },30000); If you need to clear interval in future: var myInterval = setInterval(function () {

PostgreSQL how to concat interval value '2 days'

家住魔仙堡 提交于 2019-11-27 14:44:49
In PostgreSQL I want to concat the current_timestamp with an interval as follows: select current_timestamp + interval 2||' days' But when I do, I get an error: [Err] ERROR: syntax error at or near "2" LINE 1: select current_timestamp + interval 2||' days' But if I do it like this, it works correctly: select current_timestamp + interval '2 days' Why does one work, but not the other? With reference to the following page http://www.postgresql.org/docs/8.0/static/functions-datetime.html Part of the problem is that the standard SQL expression for intervals quotes the number, but not the keywords.

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

試著忘記壹切 提交于 2019-11-27 12:56:07
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. not daily, or weekly data, observations just have a time stamp, as in ticks data), and suppose you'd like to look at center and dispersion statistics that you are able to widen and tighten the interval of time over which these statistics are calculated. I made a simple for loop that does this. But it obviously runs very slow (In fact I think my loop

Plotting labeled intervals in matplotlib/gnuplot

淺唱寂寞╮ 提交于 2019-11-27 12:25:06
I have a data sample which looks like this: a 10:15:22 10:15:30 OK b 10:15:23 10:15:28 OK c 10:16:00 10:17:10 FAILED b 10:16:30 10:16:50 OK What I want is to plot the above data in the following way: captions ^ | c | *------* b | *---* *--* a | *--* |___________________ time > With the color of lines depending on the OK/FAILED status of the data point. Labels ( a/b/c/... ) may or may not repeat. As I've gathered from documentation for gnuplot and matplotlib , this type of a plot should be easier to do in the latter as it's not a standard plot and would require some preprocessing. The question

Making a interval timer in Java android

倖福魔咒の 提交于 2019-11-27 11:43:10
问题 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 times this interval should go. Like a interval that last 1 minute and goes 8 times. The question is which timer is best to use? I have tried me on the Android Countdown Timer and it seems to work. But is there another one which is better? 回答1: I would