Plotting labeled intervals in matplotlib/gnuplot

Updated: Now includes handling the data sample and uses mpl dates functionality. import matplotlib.pyplot as plt from matplotlib.dates import DateFormatter, MinuteLocator, SecondLocator import numpy as np from StringIO import StringIO import datetime as dt ### The example data a=StringIO(“””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 “””) … Read more

Timing in JS – multiple setIntervals running at once and starting at the same time?

Good question, but in JS you can’t. To have multiple functions in the same program execute at the same time you need multi-threading and some deep timing and thread handling skills. JS is single threaded. setInterval doesn’t acutally run the function after the delay, rather after the delay it adds the function to the event … Read more

How to wrap a float to the interval [-pi, pi)

Modulo function updated to handle boundary cases as noted by aka.nice and arr_sea: static const double _PI= 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089986280348; static const double _TWO_PI= 6.2831853071795864769252867665590057683943387987502116419498891846156328125724179972560696; // Floating-point modulo // The result (the remainder) has same sign as the divisor. // Similar to matlab’s mod(); Not similar to fmod() – Mod(-3,4)= 1 fmod(-3,4)= -3 template<typename T> T Mod(T … Read more

ISO 8601 Time Interval Parsing in Java

java.time The java.time framework built into Java 8 and later has a Duration.parse method for parsing an ISO 8601 formatted duration: java.time.Duration d = java.time.Duration.parse(“PT1H2M34S”); System.out.println(“Duration in seconds: ” + d.get(java.time.temporal.ChronoUnit.SECONDS)); Prints Duration in seconds: 3754

how to convert integer minutes to interval in postgres

Fastest way is with make_interval make_interval(years int DEFAULT 0, months int DEFAULT 0, weeks int DEFAULT 0, days int DEFAULT 0, hours int DEFAULT 0, mins int DEFAULT 0, secs double precision DEFAULT 0.0) So it looks like this (as suggested by @Teddy) SELECT make_interval(mins => 20); or, SELECT make_interval(0,0,0,0,0,20); Not to say that’s the … Read more

Quartz.Net how to create a daily schedule that does not gain 1 minute per day

You aren’t specifying the interval which happens to default to 1 minute, so it assumes you want to run the job every minute. Try ITrigger trigger = TriggerBuilder.Create() .WithDailyTimeIntervalSchedule (s => s.WithIntervalInHours(24) .OnEveryDay() .StartingDailyAt(TimeOfDay.HourAndMinuteOfDay(13, 0)) ) .Build(); The default should be to run every day, so the OnEveryDay() isn’t really needed. Not sure why you … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)