Updating an Apple Watch's complication's content at midnight - apple-watch-complication

I've add my complication entries and this all seems to work well - each complication entry is scheduled for midnight.
I'm testing the time change by setting my Mac's date to the following day where I'm expecting my complication to update to the next entry.
However, it only updates the entry when I open and close my app. I'm expecting to see it automatically change like the other standard complications do. Is this some behaviour I need to go out of my way to implement? I'd expect an automatic change as per the docs.
I've found the following:
ClockKit begins displaying a timeline entry precisely at the time specified by the entry’s date property.
But surely this is a greater than check too? I tried setting it exactly to midnight but (surprisingly) this doesn't work either.
Any help is appreciated.
Additionally, I found the following regarding updating the timeline, but I would have thought this would be for changing the timeline entries as oppose to just refreshing the complication for the current timeline:
During a background app refresh task. You can schedule background tasks to periodically update your watchOS content. This works best when your data changes at predictable times.

The Watch Simulator appears to have some quirks around handling of times. In particular, it doesn’t seem to obey time changes on the underlying system until you relaunch it.
Relaunch the Simulator after changing the system clock and check on your Complication then. If you want to test the transition to the next day specifically, you can set the system time to 11:58 pm and wait for it to cut over.

Related

How do I fix NPCs not showing a cast bar for some custom spells?

I am currently creating a module that creates custom boss fights in vanilla dungeons. To accomplish this without having to make edits to existing spells used by other creatures, I've been using Stoneharry Spell Editor to create custom spells that the bosses use.
The spells that I created are doing exactly what I want them to do but the majority of the spells that aren't instant cast will not have a cast timer shown while the boss is casting the spell.
Some of these spells haven't been edited aside from the damage. Just a straight up copy of a basic spell like Lightning Bolt. I searched through all of the attributes and there was no difference between spells that would show the cast timer and those that wouldn't.
What determines whether or not a spell with have a visible cast bar and how do I fix the spells that don't?
I have gone through the process of creating a custom MPQ file to patch my client in addition to the server side DBC file.
I was unable to find the cause of why some of these spells were not showing a cast bar but I did find a flag that can be set to force the display of the cast bar as a fix to the issue.
Setting AttributeEx4 with the value 268435456 (hex value 0x10000000) will force it to display. I confirmed this flag worked with all of the spells that were previously not showing a cast bar.
Might be related, might be unrelated, but from what I understand the 3.3.5 client and blizz's own UI uses events in the combat log to show stuff like cast bars in the UI frame. And because 3.3.5 client famously has bugs that the combat log gets frozen and stuck, sometimes these things disappear. People also call this famous bug other names like the "recount bug", since it leads to addons like Recount showing the wrong values for damage and such, because they stop receiving the correct events from the combat log. Notable thing is though the bug is very strange, it does not always completely freeze everything but rather still let some of the events through, leading the numbers in damage meter addons to change but be completely wrong.
I have stumbled to the same problem with regular mobs and bosses, noticed that some of them suddenly stop showing things like cast bars and buffs/debuffs after the combat log bug happens. The bosses still make their animations for casting and stuff properly, but they don't show in the UI. That's what lead me to think that the stuff happening in the "world" are handled by server sending opcodes but the stuff that is shown in your UI frame are from the combat log.
So first make sure you're using a combat log clearing addon or a macro, like this one:
https://github.com/anzz1/CLFix
Yes, I know that code runs the CombatLogClearEntires() every single frame, but from what I have tested I simply found every other addon that clears the log more infrequently to the combat log bug sometimes happening. Only running it every frame has spared me from any more combat log bugs. See, the thing about that bug is that you have to clear the log before it happens, clearing it afterwards won't usually help and you need to reload the whole UI.
Secondly, what you could do is check what your client sees happening in the combat log by printing the combat log events and comparing the different spell events that way. This can be achieved easily by making a frame, registering the COMBAT_LOG_EVENT_UNFILTERED event and printing the results.
Like this, just wrap that code into a .lua addon to see what's what:
local f = CreateFrame("Frame", nil, UIParent)
f:SetScript("OnEvent", function(self, event, ...)
-- timestamp, eventType, srcGUID, sourceName, srcFlags, destGUID, destName, destFlags, spellID, spellName, arg1, arg2, arg3, ...
print(...)
end)
f:RegisterEvent("COMBAT_LOG_EVENT_UNFILTERED")

watchOS - Show realtime departure data on complication

I have an public transport app with realtime departure data for trains.
I would like to add a complication that shows the departure time of the next train.
Is it possible to show (or refresh) realtime data on a complication? For example, showing "3 min. to station X." The data could change every minute, based on info that comes from the public transport API.
How should I accomplish this on watchOS 2 or watchOS 3?
I know the ETA app shows travel times in a complication, but I'm not sure how they achieve that.
Are realtime updates possible?
Complications aren't designed to show realtime data. Frequent updates can affect energy efficiency and impact the battery (on both watch and phone).
To minimize power usage, ClockKit asks you to provide as much data as you have available and then caches the data and renders it when needed.
While there is no fixed number of times a complication timeline can be reloaded, the complication data source is subject to a daily execution time budget.
If your app’s data changes frequently, it might be difficult to provide enough data to display in a complication. Worse, if you refresh your complication data too frequently, you may exceed your execution time budget and your complication might not be updated until the following day.
Once the daily budget is exhausted, calls to reloadTimeline (and extendTimeline) do nothing.
If your complication has already exceeded its allotted daily budget for execution time, calls to this method do nothing. Call this method sparingly.
How can a complication display relative times?
You can use a CLKRelativeDateTextProvider to create a formatted relative time that can change on a minute-by-minute basis.
A CLKRelativeDateTextProvider object creates a formatted string that conveys the difference in time between the current date and a date that you specify. You use a relative date text provider to implement timers or other relative time values in an efficient way. Instead of using multiple timeline entries to replicate a countdown timer, create a single timeline entry with a relative date text provider. When the user views the clock face, ClockKit automatically updates the relative time value in your complication, providing up-to-date time information.
How could a complication be frequently updated?
You could use a complication push update (either from a remote server, or locally from the phone in iOS 10).
There is a limit of 50 complication push updates per day.
You could fetch data on the phone and use transferCurrentComplicationUserInfo.
In watchOS 2, this was only subject to the daily budget. In watchOS 3, this is now limited to 50 transfers per day.
See Is transferCurrentComplicationUserInfo more suitable for complication update? for more details.
In watchOS 2, you could use getNextRequestedUpdateDate to schedule the next time to update your complication.
This can't occur more often than every ten minutes.
Note that watchOS 3 apps should be upgraded to use background refresh app tasks. The main benefit is that background tasks would be able to do more than merely update your complication. They can also handle fetching data, updating your model once the data arrives, as well as updating your dock snapshot.
Finally, you can schedule a manual update. In watchOS 3, the recommended way to do this would via a background refresh app task.
The task budget permits 4 tasks per hour. See scheduleBackgroundRefresh for more details.
Note that background refresh app tasks must not use more than 10% CPU.
Recommended WWDC 2016 sessions
208 What's New in watchOS 3 introduces some of these topics.
804 Designing Great Apple Watch Experiences discusses when and why to update your watch apps.
218 Keeping Your Watch App Up to Date provides details about using background tasks to update your complication, app, and dock snapshot.
As mentioned in the talks, you should schedule your updates around the times when they would be needed.
For your use case, examples would be only when public transit is running, and only when the regularly scheduled departure times would be affected by a delay.
Apple sample code
Apple provides WatchBackgroundRefresh sample code demonstrating how to use WKRefreshBackgroundTask to update WatchKit apps in the background.
To update any active complication within a background task, you would simply add code to reload (or extend) the timeline:
let complicationServer = CLKComplicationServer.sharedInstance()
for complication in activeComplications {
complicationServer.reloadTimelineForComplication(complication)
}

Using Firebase clock to timestamp changes

We have a dataset in Firebase updated by multiple clients.
We want to track the last modified on datetime of the dataset. We cannot rely on the client setting the modified on datetime as their local clock can be totally out of sync.
Is there a way I could have Firebase tag timestamp to a dataset based on its clock to track last modified on?
We're working on some features to support this at the moment, but we don't have a way to do this right now. Note, however, that the IDs created by "push()" are chronologically-ordered, and we compensate for client-side clock skew as best we can when we create them, so if all you're trying to do is make sure some writes to a list occur in order, you can do that with push().
I'd be interested in hearing how you'd like this feature to look. If you have a sec I'd appreciate an email to andrew at firebase...
Update: Firebase now supports setting server timestamps as well as accessing the server time directly on the client. See the documentation here:
https://www.firebase.com/docs/managing-presence.html
We're on the same boat... and I guess sooner or later, many firebase clients will have this issue, as it's a "new kind" of problem we never had to face in the old "client-server" days.
Out current solution (still in the making) is to estimate the time difference between the client and OUR server on initialization, and them compensate,
So - where we had x = new Date(),
it is now x = ourDateService.now()
our now() function simply does new Date() + diff
This works for us,as we don't need millisecond accuracy, and it's a single-page-app that loads once, so we can do this diff-check and initialize ourDateService on load, but this solution will not work for everybody (ofcourse, you can store it in the localstorage/cookie and revalidate every day or so).

Drupal 6: Heartbeat module is "missing" some content

I’m using the heartbeat module on my site to make an activity-stream and recently I discovered that it doesn’t display all the new comments.
I’ve displayed group messaging ‘cause I only want to display #username commented on #node_title and nothing more. But for some reason, when there is several comments submitted within a short range of time it either only displays one of the comments or nothing or it makes an entry in the activity-stream which is just blank.
Before I was using the built-in comment-template in Heartbeat but now I’ve tried to create my own instead. It works when I post a comment but when testing it and makes two comments within e.g. 30 seconds it still makes the error.
Are there any known problems with this issue or am I missing something?? I haven’t detected the problem with adding new nodes, which also can occur within a short period of time on my time.
Thanks
Sincere
- Mestika
If you are having display failures in Views, there is a patch someone worked out in February 2012 for Views 6.x-3.x - you might want to try that. It fixes the display for a bunch of fields. See http://drupal.org/node/1295570

Changing the date on my web server stops my ASP.NET app from working

I'm trying to write some code that checks the number of days between two dates, when I set the date on my IIS7 server to anytime in the future I get the standard "Internet Explorer cannot display the webpage" screen. This happens if I comment out all my date checking code, with todays date it loads with any future date it doesn't. I've tried rerunning IISReset which makes no difference.
Anyone seen this before?
Thanks
Jamie
You've proven that you can retreive the current system date from the server.
IMO, now you can go ahead and fudge the numbers by reading test dates from a file (override.txt, or whatever) and test your date calculation scenarios without having to mess with the server.
You will want to make sure that you have a common function for getting the system date, so that you can override in one spot. So if you're not already set to do that, re-tool the code a bit, re-test to ensure that you get the system date properly. Then drop in your override file and test away.

Resources