Automatic execution of code after finishing a cell in Jupyter - jupyter

Is it possible to set up Jupyter so that whenever a cell is finished running it would automatically carry out some code?
Some of my code takes a long time to run, and it is quite inconvenient to have to check back often to see whether the code is completed. I can manually add some notification code at the end of each cell, but it would be much easier if I can simply put this code in say, jupyter_application_config.py or custom.js, and have jupyter calls it automatically.
It would be even better if it can be set up so that the code is executed if the cell takes more than n seconds to run.

This answer is a bit late... but I also wanted notifications when long running code in Jupyter cells had completed, and I found the Notify extension to be limiting (eg., no notifications if I was away from my computer). My solution for myself was to create a custom magic that using Pushbullet to send notifications to both my computer and my iPhone.
The magic is called pushnote. Maybe it will be helpful for you.

Related

Navigate To at start up simulation

When I run the model, I want my model to go to the viewarea of the simulation parameters in the agent of this user interface. So at the simulation and java actions I added this by the next code (also a screenshot is added at the bottom):
root.uI_startUP.SimulationParameters.navigateTo();
The strange thing is when I run the model for the first time, he goes for like 1 second to this view area, but then automatically returns to the main agent. When I stop the model and restart it again (and keep the run window open), this problem is not happening and it is staying in the good user-interface agent view area.
What could be the reason behind this? and how can this be solved.
Added later:
At the moment I fixed it by creating an event which is triggered by the variable start==true, and after that navigates to the interface and sets this value to false. see figure below
This works, and seems to be a solution.
But I'm still curious why the first method is not working..
Seems to be the code in "Initial experiment setup" that messes here.
Remove both code snippets and only call uI_startUP.SimulationParameters.navigateTo() on the "On startup" of Main.
This is how you should do it anyway :)

Way to update user while code is executing?

I'm creating a SwiftUI multiplatform app in XCode and I have a section of my code that hangs. I want to update the user so they know what's happening and are willing to wait. I originally planned to have an alert with text that changed and then planned to have a Text element that updated. In both cases this isn't shown until after the code executes and as such only shows the final message (normally the success done message unless an error made it end sooner).
Is there anyway I can have a visible message to the user through an alert or SwiftUI element that is updated right away and thus will be helpful?
The fact that the alert isn't even shown until after the code executes is bad and incorrect. This suggests that you are doing something lengthy on the main thread, and that is an absolute no-no. You are freezing the interface and you risk the WatchDog process crashing your app before the user's very eyes. If something takes time, do it in the background.

Plotly Dash - Callback triggers sometimes & the same callback doesnt trigger sometime

I am facing issue with callbacks. I have 3 drop downs, one scattermap , one table and one slider on the screen and they all need to work in tandem and i have 5 call backs. When i execute the application all my callbacks associated with these controls execute in random order. After that when i click on scattermap it may or may not work. Say we assume it worked. Then i can navigate all around without any hassle. Then if i execute the application then click on the scattermap then as i mentioned it may or may not work. Say suppose it didn't work this time. If so is the case it will not work at all no matter what i do and simulaneously one specific dropdown also becomes dysfunctional. However if click any of the other two drop downs then evrything will start functioning as normal.
I have digged really deep into this and figured out that this has nothing to do with my code. The underlying issue is that when the click doesn't work the reason the reason behind that is the callback isn't getting triggered. I found out this by applying some debugging techniques and i am 100% sure the callback is not firing. Can anyone help me resolve/understand this please.

Is there a way to see the order in which functions are called when we execute a program in Xcode?

Is there a way to see the order in which functions are called when we execute a program in Xcode? For instance, at runtime, if we press a button corresponding to a certain IBAction, can we see the order of method calls thereafter? I know the debugger is available, but it seems to be particularly useful when you know exactly what method calls you are looking for.
Any help would be much appreciated!
Swift flows top to bottom. This is a good post on that. As well you can run a breakpoint, also added an explanation of a breakpoint. You can use them to stop and manually advance Xcode to the next thing to execute helps a lot with debugging.
You could also do print("Function x")
in each of the functions you have. This would then print them in order of execution time.
Swift Flow
Breakpoint Article

Program that will run continuously without any condition

I want to write code in swift in xcode, which should has button function and others, but the code should has function, which will run continuously without any condition. Is there any chance to do this?
If you want code to run continuously you might want a loop (as in while-loop) which runs in a background thread so you don't block the UI. Everytime the UI should update, you will have to dispatch the changing activities back to the UI-thread.
For a general tutorial to swift-multithreading refer to
https://www.raywenderlich.com/148513/grand-central-dispatch-tutorial-swift-3-part-1