Sbt/Play - Run task everytime play reloads the application - sbt

When my app is running, and I change a file, play reloads the application. Is it possible to define an sbt task that executes every time the application reloads?
Thanks!

Related

How to cache my shiny application only one time on loading

I have a shiny application that is published on shinyappsio. The application has a filter Reporter and it is loaded with a default Reporter. How can I cache only the first time the application loads for the default reporter and then every time someone accesses the application it will use the cache to load it?

CosmosDB Change feed using ADF -how to reset change feed process in uat/prod anytime

Generally if the pipeline and activity name unchanged, the checkpoint can be recorded by ADF to get changed data from the last run automatically. If pipeline name or activity name is changed, the checkpoint will be reset, which leads you to start from beginning or get changes from now in the next run. At the moment when first time trigger published pipeline, it automatically restart from the beginning or from now on.
But in production or Uat, if the first run having some problem or already ran first time, then how to reset the deployed pipeline so that pipeline start from beginning again using trigger. also observed that even if the dataflow name changes, then also pipeline not starting from beginning in debug mode?
How to achieve full load and incremental load at any point of time from deployed pipeline in any environment?

Asp.net mvc3 - how to stop clearing HttpRuntime.Cache when debugging locally

I'm using asp.net mvc3. Our app heavily uses the HttpRuntime.Cache to store data in memory on the web server to reduce database calls.
My issue is that every time I run the app locally (F5 in Visual Studio) the cache appears to be cleared, causing a full reload of all the data from the database. i.e. I run once, get the data from the db then stop. If I run again seconds later the cache appears to have been invalidated and the database call happens again. My timeouts are all way in the future so not sure what's going on here.
I really only want to get the data when the cache is really empty, not every time I hit F5 in VS. Is there a way to turn off the setting that's clearing my cache every time I run locally?
Thanks!
If you want to retain the cache even after compilation, I would recommend to take the cache outside the process by using other caching frameworks such as AppFabric or memcached. These frameworks use distributed caching which stores the cache out of process and thus avoiding invalidating of cache every time you compile.
Every time you stop debugging, it kills the App Domain, in which the cache is stored. There's nothing you can do about this, because in order to recompile the app, and start the new app, you must build a new AppDomain.
There is no way to prevent this. When you Stop the debugger in VS and then reattach the debugger again it will recycle the Worker Process. Anything cached in the worker process will be flushed out as the process will be started fresh.

ASP MVC - Getting application to restart when starting new debugging

When editing parts of my project that get called in Application_Start(), i want to have the web app restart every time i press 'Debug', so that i can debug these parts.
But if i dont change the Global.asax.cs self, it doesnt restart and therefore doesnt fire the Application_Start().
Is there any setting or trick to let the app restart each time i start a new debug?
If you are using the development server, simply right-click>stop on the tray icon. When it starts back up you will have a fresh new app-domain that needs to execute global.asax.
Or, in any case, dev or IIS, simply add a space or otherwise modify the web.config file - that will recycle the app domain.
Update - on further consideration: Have you tried re building.
Another thought - you could add a 'pre-build event' that 'touches' the web.config using a command line. BUT - you will probably want to define a special build configuration with configuration manager that is clearly marked, otherwise you may forget that you are killing your app domain and chase your tail in circles. ;p
try searching for 'windows touch file timestamp'.

Running a web app automatically

I have an asp.net update web app. Users go the the page, hit the update button and the program runs. We also want this program to run as a scheduled task everynight. Is this possible? How would you handle this?
thanks
You could create a shortcut on your program to a page on your web app (say update.aspx?command=update) and then have your server's scheduler set to run that shortcut at the time you wish.
I would only recommend that you use a page which has nothing on it and will only respond to a specific command, that way you lower the risk of your page being "tripped" when you don't want it to be.
A better way would be to break the application up into a domain layer dll, then your aspx page could use that dll, and you could also write a console app that used the same dll. You could setup a scheduled task to run the console app nightly.

Resources