Allow user interaction when application is asked to exit - qt

I'd like to write a Qt application which main purpose is to warn the user that there are things to do before he should shut down the computer. I thought this is possible, since a lot of applications ask the user to save before quitting when the computer is about to be shut down. I also want the user to be able to interrupt the shut down process, like those applications allow the user to say "Cancel".
Is there a way to do this in Qt?
If not, how to do this at least in a gnome session? (Support for more desktop environments would be nice, but currently this application is for me and my friends only, and we all use gnome.)
I read about the signal QCoreApplication::aboutToQuit(), but the documentation says that it doesn't allow user interaction. My application doesn't use any widget (maybe only a system tray icon), so the QWidget::closeEvent isn't of any use either.
Will handling the appropriate posix signal help? But as far as I know, such a signal handler may only contain trivial statements and asking the user whether to really shut down isn't trivial.
Here are some details if it helps: When the user wants to shut down the computer, my application will check if the repository (he configured to watch) is "clean", i.e. there is nothing to commit. If there is something to be committed, the application should warn the user and let him choose to ignore the uncommitted files or to abort the shut down process (in order to commit the changes).

You should implement session handling. When the operating system shuts down, QApplication::commitData() is called and you can ask the session manager to allow user interaction:
Within this function, no user interaction is possible, unless you ask the manager for explicit permission.
There is also an example about exactly your use case here.

Related

Kill app in ios actually does not kill from OS

I m using Device.BeginInvokeOnMainThread(() => { Thread.CurrentThread.Abort(); });
System.Diagnostics.Process.GetCurrentProcess().Kill(); this in xamarin.forms to kill app in ios through dependency service.
But actually it is not killing the app when i press the home button it is still showing.
Can anyone help me out of this?
This is not possible. From the Apple technical Q&A (https://developer.apple.com/library/archive/qa/qa1561/_index.html):
A: There is no API provided for gracefully terminating an iOS
application.
In iOS, the user presses the Home button to close applications. Should
your application have conditions in which it cannot provide its
intended function, the recommended approach is to display an alert for
the user that indicates the nature of the problem and possible actions
the user could take — turning on WiFi, enabling Location Services,
etc. Allow the user to terminate the application at their own
discretion.
Although the documentation is pretty old, this still stands. Even if you do find some way to implement it, it will never be allowed to the App Store.

Check Meteor "Call Queue"

I may have the terminology wrong however I am looking for ways to check the queue of meteor.call functions that are being retried due to a user being offline.
Some context: I have a system that allows users to book appointments in a diary. Some users with (very) poor wifi coverage are seeing appointments appear however subsequently disappear and it seems this is due to them being created when offline and then the page reloaded / disconnected before the page comes back online or before the local and remote data are synced. I have implemented an approach to inform the user that they are offline and as such should not change / reload the page however I would like to be able to check this queue so that once the connection is back, I know how long to wait until it has caught up.

How hidden are you to a network admin

So to be more specific, I am aware that an admin can see your browser history and stuff but can they see what you do in cmd and if you run cmd in general?
This question is rather vague. Do you have a specific question here? As a general rule, an administrator account exists to keep tabs on all actions performed on the host in question. The administrator would have access to whatever histories, file systems and commands you may have executed, added, deleted, etc.. In some cases, the logging level may be turned down, but I would never assume that your actions are invisible to an administrator account.

ASP.NET sync long process w/ Requirements

I am working with an e-commerce platform, and I have a task to synchronize with some remote accounting software. The task requires syncing orders, products, inventory...etc. With large amounts of data being synced,the process can take awhile. So, I don't think asp.net application would be the best place to handle this. So, the requirements are:
To be able to schedule this process to run overnight
To be able to manually fire off this process and pass into it some variables like order numbers to export.
Possibly get back status info when fired off manually.
Has to work on .net 3.5
Issues: Can't use a windows service because the site is hosted remotely on a shared service, and the host won't allow a service.
Ideas: I'm having a really hard time finding the best way to handle this outside asp.net that fits all requirements, but I do have access to their FTP and thought possibly a console app that hosts a web-service may work, and I can put Quartz scheduler in global file to fire off service from the site.
Anyway, please offer some thoughts and experiences if you have them on which methods have worked for you.
Can't use a windows service because the site is hosted remotely on a shared service, and the host won't allow a service.
That might be a problem. Does this hosting service provide any other kind of scheduling functionality? If not then you may need to consider changing your hosting services.
You're correct in that ASP.NET is not the tool you'd use for scheduling tasks. A web application is a request/response system (and is very much at the mercy of the hosting process, IIS usually for ASP.NET). So you need some way to schedule the task to execute at regular intervals. Windows Services, Windows Task Scheduler, or some other task scheduling tool.
As for the requirement to be able to invoke the process manually, that's a simple matter of separating the invocation of the logic from the logic itself. Picture the following components:
A module which performs the logic, not bound to any UI or any way of invoking it. Basically a Class Library project (or part of one).
A Windows Service or Console Application which references the Class Library and invokes the logic.
A Web Application which references the Class Library and invokes the logic.
Once you've sorted out how to schedule the Console Application, just schedule it and it's all set. If the process returns some information then the Console Application can also perform any notifications necessary to inform people of that information.
The Web Application can then also have an interface somewhere to invoke the process manually. Since the process "can take a while" then of course you won't want the interface to wait for it to complete. This can result in timeouts and leave the system in an unknown state. Instead you'd want to return the UI to the user indicating that the process has started (or been queued) and that they will be notified with the results when it completes. There are a couple of options for this...
You can use a BackgroundWorker to actually invoke the process. When the process completes, send a notification to the user who invoked it.
You can write a record to a database table to "queue" the process and have something like a Windows Service or scheduled Console Application (same scenario as above) which regularly polls that table for queued tasks, performs the task, and sends the notification. (Of course updating the status in the table along the way so it doesn't perform it twice.)
There are pros and cons either way, it's really up to you how you'd like to proceed. Ultimately you're looking at two main things here:
Separate the logic itself from the scheduling/invocation of the logic.
Utilize a scheduling system to schedule tasks. (If your hosting provider doesn't have one, find one that does.)

Managing Software Updates

I am looking into different ways to handle updating an ASP.NET application across many different clients, and looking for suggestions from your previous experience.
We need the client apps to check if they have any available updates.
A way to Auto update (If possible, something similar to chromes but for webapp).
Some way to check that we are the ones sending the updates. (Checksum of some sort I would guess)
Any other tips/advice
Thanks
Edit: after thinking more about this overnight, I would have to agree that auto updates may not be the best. However maybe something more along the lines of how wordpress does it. Wordpress will display saying that there is an update available then clicking will auto update the system.
I would absolutely not have your application auto update on clients (assuming you mean clients are entities external to your organization) servers. We would immediately stop using a product that would "phone home" and update itself. Clients need to be able to choose when and how an update on their server occurs.
If you are going to do this, the easiest way would be to set up URI the systems could ping once a day etc. and see if there are updates available. If so the application would pull it down from the host system and update itself. If you do it using SSL then the certificate would verify the URI being hit is your company.
Having a hard time figuring out if you're actually talking about a web application or a desktop application. If you're trying to do something similar to Chrome...I'm guessing a desktop application. If that's the case...check out ClickOnce deployment.
It offers the first three bullet points you mention:
Every time a person runs the app, it will check for updates.
If updates are found, the user can choose to install them or not (better user experience than forcing the update on the user).
The application always checks the URL that the app was installed from...which in your case would be your servers.

Resources