I need to set a tickInterval of 5 days and one of 13 days.
And I did this:
tickInterval: 24 * 3600 * 1000 * 5 (5 days)
tickInterval: 24 * 3600 * 1000 * 13 (13 days)
What I get instead is a tickInterval of 7 days when it's set to 5.
And a tickInterval of 14 days when it's set to 13.
Is there a way I could actually get what I need?
thx.
Related
I need to schedule a Jenkins job each 20 minute for every hour meaning
(eg. 00:20, 01:20, 02:20, 03:20, etc.)
What I got now is:
H * * * * is running for every hour
H/20 * * * * is running every 20 minutes (each XX:20)
What is the right Cron expression for my case?
Order is:
minute
hour
day of month
month
day of week
20 * * * *
https://man7.org/linux/man-pages/man5/crontab.5.html
Check it here
https://crontab.guru/#20_*_*_*_*
I'd like to sum the total time allocated per task. Time has been provided either in minutes or in hours.
For example Task A should be:
30 minutes + 2 hours x 60 minutes/hour + 150 minutes = 300
What formula should I use on B2 to get such a result, considering that I have many more than 4 people?
Try
=sumproduct(n(C2:I2)*if(D2:J2="minutes",1,60))
I have a table like this
Row time viewCount
1 00:00:00 31
2 00:00:01 44
3 00:00:02 78
4 00:00:03 71
5 00:00:04 72
6 00:00:05 73
7 00:00:06 64
8 00:00:07 70
I would like to aggregate this into
Row time viewCount
1 00:00:00 31
2 00:15:00 445
3 00:30:00 700
4 00:45:00 500
5 01:00:04 121
6 01:15:00 475
.
.
.
Please help. Thanks in advance
Supposing that you actually have a TIMESTAMP column, you can use an approach like this:
#standardSQL
SELECT
TIMESTAMP_SECONDS(
UNIX_SECONDS(timestamp) -
MOD(UNIX_SECONDS(timestamp), 15 * 60)
) AS time,
SUM(viewCount) AS viewCount
FROM `project.dataset.table`
GROUP BY time;
It relies on conversion to and from Unix seconds in order to compute the 15 minute intervals. Note that it will not produce a row with a zero count for an empty 15 minute interval unlike Mikhail's solution, however (it's not clear if this is important to you).
Below is for BigQuery Standard SQL
Note: you provided simplified example of your data and below follows it - so instead of each 15 minutes aggregation, it uses each 2 sec aggregation. This is for you to be able to easy test / play with it. It is easily can be adjusted to 15 minutes by changing SECOND to MINUTE in 3 places and 2 to 15 in 3 places. Also this example uses TIME data type for time field as it is in your example so it is limited to just 24 hour period - most likely in your real data you have DATETIME or TIMESTAMP. In this case you will also need to replace all TIME_* functions with respective DATETIME_* or TIMESTAMP_* functions
So, finally - the query is:
#standardSQL
WITH `project.dataset.table` AS (
SELECT TIME '00:00:00' time, 31 viewCount UNION ALL
SELECT TIME '00:00:01', 44 UNION ALL
SELECT TIME '00:00:02', 78 UNION ALL
SELECT TIME '00:00:03', 71 UNION ALL
SELECT TIME '00:00:04', 72 UNION ALL
SELECT TIME '00:00:05', 73 UNION ALL
SELECT TIME '00:00:06', 64 UNION ALL
SELECT TIME '00:00:07', 70
),
period AS (
SELECT MIN(time) min_time, MAX(time) max_time, TIME_DIFF(MAX(time), MIN(time), SECOND) diff
FROM `project.dataset.table`
),
checkpoints AS (
SELECT TIME_ADD(min_time, INTERVAL step SECOND) start_time, TIME_ADD(min_time, INTERVAL step + 2 SECOND) end_time
FROM period, UNNEST(GENERATE_ARRAY(0, diff + 2, 2)) step
)
SELECT start_time time, SUM(viewCount) viewCount
FROM checkpoints c
JOIN `project.dataset.table` t
ON t.time >= c.start_time AND t.time < c.end_time
GROUP BY start_time
ORDER BY start_time, time
and result is:
Row time viewCount
1 00:00:00 75
2 00:00:02 149
3 00:00:04 145
4 00:00:06 134
I'm having a problem using columns in Highcharts (highstock).
I can set differents ranges to group data (minutes, hours, days...), Highcharts tries to adjust the column size for each group and I can set the size of each column and distance between columns based on how many columns are in the chart.
This works fine in almost every quantity of data... but is not working for 72 columns (3 days in hours), the columns looks too thin (less than 1 px).
http://jsfiddle.net/3cbvV/2/
var chart;
$(document).ready(function () {
chart = new Highcharts.StockChart({
chart: {
renderTo: 'container'
},
xAxis: {
ordinal: false,
maxZoom: 2 * 3600000
},
series: [{
data: s,
type: 'column',
dataGrouping: {
units: [
['minute', [1, 5, 10, 30]],
['hour', [1,2]],
['day', [1]],
['week', [1]],
['month', [1]]
],
groupPixelWidth: 10,
approximation: 'high'
}
}]
});
});
If you move the mouse over the chart you could see the columns, if you zoom to 2 days columns looks fine but still being too thin, if you zoom to max (2 hours) the size is perfect, just as I expected.
How can I set the lines wider?
Well, in general, you can set higher groupPixelInterval, to get wider columns.
And about bug with missing columns - it's already fixed on master branch, see: http://jsfiddle.net/3cbvV/3/
Solved!
The problem occurs when i use too many time intervals, (seconds), then I wasn't showing 72 columns (3 days of 24 hours = 72) as I thought, because I have columns with seconds (like 14:21:57), then I was showing 3 days of 24 hours of 60 minutes of 60 seconds = 259200 columns.
To solve the issue I rounded every column to zero seconds and zero minutes (14:21:57 -> 14:00:00), and that's all :)
Solution: http://jsfiddle.net/3cbvV/4/
Math.floor(1398384001000/6000000)*6000000
I have rails 3 application and the following problem. I need to calculate a price based on the following:
Term range from 1 to 365 days (1 year).
Tariffs in a tables which presented in two sections: for one day and for half a month (15 days)
Example 1:
Prices: 1 day price = 0.5 and 15 days = 6
Term : 45 days.
Price: To get the price we devide the number of days by 15 (45/15 = 3) and multiply the result by the tariff for 15 days (3*6 = 18). Final price 18.
Example 2:
Prices: 1 day price = 0.5 and 15 days = 6
Term : 79 days.
Price: To get the price we find the half month period in this case is 45 and again we devide that number by 15 (75/15 = 5) and multiply the result by the tariff for 15 days (5*6 = 30). However there are 4 more days to account for, so we multiple them by the price for a day (4*0.5 = 2). The sum of the two results forms the final price (30+2 = 32).
The period is submited through a from and can be anything from 1 day to 365 days, prices per day and 15 days are stored in a database. My question is how to make the calculations in ruby/rails, so the code always calculates the half month and the reminder if any?
Any help is appreciated.
use the modulo operator:
79 / 15 # dividing integers performs an euclidian division
=> 5
79 % 15 # gives you the rest from an euclidian division.
=> 4