I have a Flask-Angular application and it is hosted on 127.0.0.1:5000. I opened this link twice on 2 separate tabs. I have a function that uses time.sleep() for 8 seconds when I click a button called "Run".
When I click the Run button on both tabs, I would expect that the first tab sleeps for 8 seconds and the second tab should've been asleep for 16 seconds (asleep 8 seconds and waiting for server while the first app uses the function for another 8 seconds)
However, both the tabs stay asleep for 8 seconds only.
How is this possible?
Is Chrome creating new instances of my back end as well?
Related
I have a Chrome extension I am working on that queries a remote server and shows a desktop notification when it changes. I am using an event page which will frequently go to sleep so I use a Google Alarm to have it do a check every 5 minutes. I save the last state out into a variable and compare it to current state to determine if a desktop notification should be displayed. I'm finding this last state variable is frequently going undefined when chrome is not in the foreground or under other conditions. I have a few variables this may be happening to as well.
How do I prevent this from happening?
Currently calling showModalDialog() in a Google docs addon will take 3 seconds to display a modal popup. Sometimes it is much more : 6 seconds.
This is a minimum : a blank popup will take - at least - 3 seconds, a real popup will take even more.
On the contrary, when a user opens a popup in Google docs, like 'insert special character', it is very fast (less than 1 second, almost instant).
Is there a way to avoid this very slow API response time ?
I have a dispatcher timer in my windows phone app, issue is while user clicks on the center button (deactivated button) timer is stopping. I want to make this timer work when user again takes the app. I can save the stopping time in a isolated storage but getting confused while user again takes the app after the deactivated event occurs, timer getting stopped.
Basically i want a timer that runs when the application deactivating also.
You can't have running timer when application is deactivated. But what you can do is to save the exact time when user close app by saving it to isolated storage settings in deactivate event.
Then, when user activate app again, you need to get current time. Calculate how much time passed by and add it to your measured time variable.
I used MediaCapture APIs in my App. Let's say I started recording and preview. During recording, I pressed Start key and quickly come back to the App by long pressing Back key and selecting my app (task swap). The result is that the preview is frozen either running on Emulator or 8.1 WP hardware. I don't find a better event to register for Start key. I understand that this.Resume can handle restoration when your APP is being deactivated. But here I mean I switch back from Start within 2~3 seconds and the Resume call is not get called. I am thinking that I can disable preview when Start key is pressed as a workaround. Then when App is brought back to foreground, user can restart recording. However, both scenarios I can't find a proper event. Of course if preview is not frozen when APP is swapped back, I don't need to do anything. Now it seems preview is not working after task swapped back from Start.
Here are the APIs I am using
_mediaCapture.StartRecordToStorageFileAsync(_profile, _recordStorageFile);
capturePreview.Source = App._mediaCapture;
_mediaCapture.StartPreviewAsync();
The issue you're hitting here has to do with the fact that as long as the debugger is attached, suspending/resuming won't work like it will once your app is running on its own.
See here: https://msdn.microsoft.com/en-us/library/windows/apps/hh974425.aspx
Try the same thing you're doing right now, except press the Suspend button in VS once your app is in the background. To bring it back, press the Resume button. Alternatively, try the same thing without the debugger attached.
As long as you're handling the Suspending/Resuming events correctly, MediaCapture lifecycle won't be a problem.
To learn more, have a look at the UniversalCameraSample on the Microsoft github repository: http://aka.ms/2015builduniversalcamerasample. It targets Windows 10, but a lot still applies to 8.1.
There are three events you can register for.
CoreWindow.Activated will be raised when you are no longer the foreground app. This can happen because the user switched away, or because something like a Reminder or Phone Call popped up on top, etc. Simply getting a toast notification does not raise the Activated event.
CoreWindow.VisibilityChanged will be raised when you are no longer visible. This happens when the user switches away, locks the phone, etc.
CoreApplication.Suspending will be raised when you are being suspended. The system doesn't suspend you immediately when the user switches away (in case they switch back quickly, eg they had accidentally hit the Start button). Instead it waits a few seconds before raising this event.
I am developing an app for iOS and Android that monitors a users locations and plots a course with markers every 10 seconds or so however when the phone is locked the location stops tracking and plotting the positions stop.
I have added UIBackgroundModes to location and also .executeInBackground = true.
Anything I could be missing?
I think you should ask this permission.
Yet the IOS is through incosistente this sense, not necessarily you'll get an update every 10 seconds.
Permission -> Background Location Updates