Using the availability API is it possible to get the DAYS only between two query periods that a user has availability in their schedule based on the provided duration? It is unreasonable to receive and process 512 time slots to, for example, see if the user has availability in the month of May. Plus that might not even be enough data.
For example if a user has the following available:
May 1 9am
May 2 between 9 and 3pm
May 3 no time
May 4 ...
Could we get a result that says, the user has at least 1 hour (ie provided duration query) for these days? In this case it might return an array of dates like May 1/2/4/... or an array of time slots like May 1 9am, May 2 9am, May 4 10 am
Not right now. But it's a request we've had before and we plan to support it later this year.
Related
I have a scenario where I'm getting custom metrics thru an application. I want to create alerts based on thresholds and days of the week. Is there any way I can integrate the metadata in some storage and compare the metrics based on that? For example, I have message count metrics in the application, and if on Monday the message count is less than 100 or more than 200 I should get an alert. It varies on the day of the week. I have to monitor almost 250 custom metrics.
I tried implementing custom logs in Log analytics but I have a challenge in case if I want to change the thresholds then I need to drop the custom table and recreate it.
Thank you AnuragSingh-MSFT | Microsoft Docs. Posting your suggestion as an answer to help other community members.
Using a combination of both dayofweek() and case() functions, the resultant query itself can contain the threshold based on the day-of-week. Therefore, in future if the threshold changes, you will only have to edit the case statement and this solution also does not require additional storage/custom table.
let day = dayofweek(now());
let threshold = case(day == 1d, 5m, //threshold for Monday is 5 minutes
day == 2d, 2m, //threshold for Tuesday is 2 minutes
day == 3d, 5s, //threshold for Wednesday is 5 seconds
10m); //threshold for any other day is 10 minutes.
Heartbeat
| summarize LastHeartbeat=max(TimeGenerated) by Computer
| where LastHeartbeat < ago(threshold)
Reference: Regarding custom metrics application insights - Microsoft Q&A
I'm doing this request in Python / Postman:
https://www.googleapis.com/analytics/v3/data/mcf?
ids=ga:xxxx&metrics=
mcf:assistedConversions&
dimensions=&
start-date=2011-10-01&
end-date=2011-10-31
But I only seem to be able to get the total number of results.
1/ Can I get it on a daily granularity? I know that GA API has the ga:date optional parameter, but this does not work in combination with the MCF API and I couldn't find anything similar for MCF.
Do I have to iterate through each day to get the results at a daily granularity?
2/ Is the 30 days lookback applied to API calls? If just put the end date 4 years ahead, will it give me the full results?
Daily granularity: You should add the mcf:nthDay dimension to break the results down into individual days within the specified range:
Index for each day in the specified date range. Index for the first
day (i.e., start-date) in the date range is 0, 1 for the second day,
and so on.
Loopback time: yes it's 30 days and can'be be changed:
Note: The Multi-Channel Funnels Reporting API uses a non-adjustable
30-day lookback window.
If just put the end date 4 years ahead, will it give me the full results?
Why don't you test to find out and let us know :) ?
I'm stuck with building my own, simple browser game.
My program: you can upgrade your tools which allow you to gain more points per hour.
My problem:
So for example a user logs in and upgrades his tools from 0 to 1 which would double the amount of points gained. But upgrading takes 2 hours to complete. I don't expect my user to be online for 2 hours so I save the time he was last seen in an SQL table. Now when 2 hours have passed the amount of points gained need to be doubled but it's very possible that the user doesn't visit the page for another 10 hours. So my current program keeps adding 1 point per hour until the user visits the page. So in this case he'd have 12 points. But it needs to multiply after 2 hours so he needs to have 22 points.
Another, maybe simpler example is a maximum amount of points. Let's say the max is 10 points. But the user stays offline for 15 hours which means he'd earn 15 points at a rate of 1pnt/hr.
I don't have any functionally code yet because I want to know if something like this is actually possible and how for example cityVille(facebook) does it.
Now my question:
Can anyone give me a tip or give me some info on how to get started at this or at least give me the name of what I'm searching for? I've tried google'ing things like "offline database interactions" or "changing variables without user request" but nothing useful comes up.
Thanks in advance,
BlaDrzz.
You can schedule jobs with SQL server. These jobs can run at whatever frequency you like.
http://technet.microsoft.com/en-us/library/ms191439.aspx
I have a question about dealing with date & time in my web application. The application will sell monthly subscriptions. It shows dates only when clients buy and cancel subscriptions. Clients can buy additional services in the middle of the month. Application calculates a pro-rata to charge the client until his anniversary date.
I will store dates/times in UTC. It is only for US clients.
I am considering the following options and I would love to get feedback from more experienced developers:
1 - always present dates in EST. I can include a small caption explaining that all subscriptions uses EST. This would be simple as I would not have to deal with clients' timezones. However I am not so sure if clients would be put off by this. Any thoughts?
2 - always present dates in EDT. This would probably not work very well as it would be harder to explain the reason for using it. However I believe it would be simpler to process than EST.
3 - ask for client's timezone information when he signs up for the service and use that information. I don't think this would add too much complication, however I would have to offer them an option to change timezones and I would have to decide what to do with existing subscriptions when there is a change in timezone. If I go with this option I would ask the client to pick the timezone from a drop-down list.
4 - ask for client's location (City and State) and calculate the timezone myself.
5 - try to guess client's timezone based on his IP or another method (ideas???).
Options 3, 4 and 5 would probably be the most user-friendly. Option 1 seems to be the most straightforward to implement.
Sorry for the long post. If you took the time to read it, would you mind taking a little more time and sharing your thoughts and experience?
Thank you.
UPDATE 1 - 9/3/2011 - 17:08 MST
Just found out that PayPal records transactions using PDT and shows them to the client using the client's local timezone they setup when they signed up with PayPal.
I am now inclined to:
1 - show current date using PDT (to align with PayPal) - I will probably change the code to show date & time PDT. Currently I am only showing the date. I believe it will be clearer to the client if I also show the time.
2 - I will not show the anniversary date. I will let PayPal handle that. I will simply state that it is a monthly billing.
3 - When clients add a new service I will calculate the pro-rata using PDT and I will give them a three day grace period to account for timezone differences (thanks to Robert Levy below for suggesting it) and PayPal processing (I don't want to charge them a pro-rata amount if they are only a couple of days from their regular monthly charges).
Any thoughts?
Update 2 - 9/3/2011 - 21:01 MST
Just a quick update. After further research I found out that PayPal does send me a transaction date back. I am not going to show any dates until the client pays at PayPal and I receive confirmation. I will show PayPal's transaction date in the client's receipt.
Sounds like a plan. What do you think?
Just add a grace period of 24 hours from UTC. Easy to code, no extra UI, and unlikely to upset any customers.
Let's say that guy register's to my site for 5$ for 30 days. So how do I make code that automaticly after 30 days delete's his account?
Thanks for answers and sorry for poor english
Respectfully, Tom
Use the date handling functions of your preferred programming language. Do not attempt to implement it yourself. It's harder than you think.
I'd suggest simply noting the account's expiration date in its record, rather than having some sort of scheduled process to delete expired accounts.
For a .Net example: when you receive the $5 payment, set the account's expiration date to DateTime.Now.AddDays(30), and reject login on an account where expirationDate < DateTime.Now.
In Java, you'd need to pour the Date into a Calendar in order to add days, then pour it back into a Date when you're done.
However, what facilities are available to handle dates are determined by your environment.
If you can, convert the registration date and the current time to UNIX timestamps. Then subtract their registration time from the current time and check if the result is greater than the number of seconds in 30 days. (60 seconds * 60 minutes * 24 hours * 30 days = 2592000 seconds.)
Most likely you would run a cron job every day or so and check and see if an account's last payment was 30 days ago, and then delete the user. However, manipulating the date is difficult to explain unless we know what language you are using. Since you specified DateTime I'm going to assume that you mean the .NET DateTime object and then you can just do DateTime.addMonths(-1); or DateTime.addDays(-30) respectively.
If you just have to count 30 days you can count them as 30 * 24 * 60 * 60 = 2592000 seconds and simply subtract the unix timestamps.
Anything more complex than this is a PITA to implement yourself and yuo should follow recursive's advice.