Delphi Code for Cancelling or Continuing the lock attempt and Display an Alert When User Locks Computer - delphi

This is a toughie (I am obviously new to Stack Overflow)! Delphi code for displaying an alert (reminder) to sign out when a user locks their PC. I believe this would need:
Detect locking their Windows 7 or 10 computer / workstation.
Display a MessageDlg with 2 buttons: "Lock" (proceed with locking computer) and "Cancel Lock" (so that they can sign out online and then lock their computer).
This could possibly be an executable installed on their local computer that would run on StartUp in the background.
Please note, I have created simple Delphi programs in Delphi 6 for years but this is way above my "pay grade". If this is even possible MANY thanks for your time !! You cannot begin to imagine how helpful this would be!
Scott
I tried copying "How Do I detect a user locking / unlocking a screen in Windows 7". It did not have the lock cancelling feature that would allow a user to perform another task before locking their computer.

As far as I know it is not possible to prevent user from locking the computer. In fact it is quite common practice to have computers set up in a way so that they lock themselves automatically after certain time of user inactivity.
This can greatly improves overall IT security as in most cases prevents random person getting access to unlocked computer just because person that is otherwise using this computer stepped away for a few minutes.
Now if your program would somehow prevent this from happening you would be potentially compromising IT security.
In fact I suspect that you might want to actually increase IT security by forcing your users to regularly log out of the online system. But this is not the way to do it.
It would be much better if your online service would use time limited session management. What I mean by this? I mean that online service session should time-out after user hasn't performed any activity in this online service for certain time.

Related

In iOS11, how to keep a background task running past 10 min?

My question involves keeping an app that monitors user interactions in the background, for example time spent in one or the app. The issue arises when you can not have a background process run for more than 10 min or violate Apple's sandbox restrictions. Since I am relatively new to the Apple API, and could not find a direct answer that didn't involve location services or VOIP (which are both interesting options, but my application will not be able to use either viably), I come to ask for options in which I can understand when another app opens, when it closes, when it fetches data, and when user holds phone in certain orientation (ie when people hold their phone at certain angles to read text and etc.) for certain amount of time.
The purpose of this analyzation is to predict an attention span for the user, so I need to be able to run in the background, as the user will not be using my app while it predicts attention span.
My thoughts on this are possibly accessing the system log, and somehow parse previous statements (I don't think sandbox will allow), but inevitably the iOS system will suspend my processes after some point unless I put a timer. There is also the option of having the system wake up my app via opportunistic fetching, but that won't be useful if I don't collect the data.
Keep in mind this is within IOS 11, so it is much more restrictive than previous iterations. I understand this may seem like a complex problem, but even a direction in which to head could be useful to me.
This solution might work, (not recommended since it drains the battery quicker).
Just update your current location, every 10 mins. It will reset the background thread timer.

Indy Telnet SendString robustness best practice

I have a simple Firemonkey application with a series of buttons and sliders (track bar) that when a user interacts with these controls it send a command using IdTelnet. i.e.
IdTelnet1.SendString(' '+str+#13);
The problem is that very occasionally the users experience total lockup of the app and windows reports the app as "Not responding" when clicking on something. I have not reproduced this myself however I suspect its related to clicking on buttons in quick succession.
My current theory is that I am getting re-entry into SendString and IdTelnet is not handling this well.
Before jumping into writing a queued sending system I wanted to ask for any best practice advice. Is this a known issue and what is the best way to do quick fire sends that are user initiated?

How can I determine the quality of a connection in iOS?

I'm familiar with using Reachability to determine the type of internet connection (if any) being used on an iOS device. Unfortunately that's not a decent indicator of connection quality. Wifi with low signal strength is pretty sketchy and 3G with anything less than 3 bars is a disaster (not to mention networks that only allow EDGE connections).
How can I determine the quality of my connection so I can help my users decide if they should be downloading larger files on their current connection?
A pragmatic approach would be to download one moderately large-sized file hosted on a reliable, worldwide CDN, at the start of your application. You know the filesize beforehand, you just have to measure the time it takes, make a simple computation and then you've got your estimate of the quality of the connection.
For example, jQuery UI source code, unminified, gzipped weighs roughly 90kB. Downloading it from http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.14/jquery-ui.js takes 327ms here on my Mac. So one can assume I have at least a decent connection that can handle approximately 300kB/s (and in fact, it can handle much more).
The trick is to find the good balance between the original file size and the latency of the network, as the full download speed is never reached on a small file like this. On the other hand, downloading 1MB right after launching your application will surely penalize most of your users, even if it will allow you to measure more precisely the speed of the connection.
Cyrille's answer is a good pragmatic answer, but is not really in the end a great solution in the mobile context for these reasons:
It involves doing a test "at the start of your application" by which I assume he means when your app launches. But your app may execute for a long while, may go background and then back into the foreground, and all the while the user is changing network contexts with changes in underlying network performance - so that initial test result may bear no relationship to the "current" performance of the network connection.
For the reason he rightly points out, that it is "penalizing" your user by making them download a test file over what may already be constrained network conditions.
You also suggest in your original post that you want your user to decide if they should download based on information you present to them. But I would suggest that this is not a good way to approach interacting with mobile users - that you should not be asking them to make complicated decisions. If absolutely necessary, only ask if they want to download the file if you think it may present a problem, but keep it that simple - "Do you want to download XYZ file (100 MB)?" I personally would even avoid even that.
Instead of downloading a test file, the better solution is to monitor and adapt. Measure the performance of the connection as you go along, keep track of the "freshness" of that information you have about how well the connection is performing, and only present your user with a decision to make if based on the on-going performance of the connection it seems necessary.
EDIT: For example, if you determine a patience threshold that in your opinion represents tolerable download performance, keep track of each download that the user does in order to determine if that threshold is being reached. That way, instead of clogging up the users connection with test downloads, you're using the real world activity as the determining factor for "quality of the connection", which is ultimately about the end-user experience of the quality of the connection. If you decide to provide the user with the ability to cancel downloads, then you have an excellent "input" about the user's actual patience threshold, and can adapt your functionality to that situation, by subsequently giving them the choice before they start the download. If you've flipped into this type of "confirmation" mode, but then find that files are starting to download faster, you could dynamically exit the confirmation mode.
Rob's answer is very good, but for a more specific implementation start with (https://developer.apple.com/library/archive/samplecode/SimplePing/Introduction/Intro.html#//apple_ref/doc/uid/DTS10000716)Apple's Simple Ping example source code
Target the domain for the server that you want to monitor connection quality to. Use the ping library to "ping" it on a regular basis (say 1 or 10 seconds depending upon your UI needs). Measure how long it takes to get a response to your ping (or if it never returns) to develop an estimate of the connection quality to communicate to your user.

Detecting log-ins with SENS

I have a .Net service that uses SENS to detect when a user logs on or off. I'm having two problems, though:
Even though the service seems to be
starting automatically, if there is
only one user on the computer and
that user doesn't have a password
(meaning windows will start right
away), the log-in doesn't seem to be
getting detected. Is it possible
that the service is getting started
too late? If so, what are my
options?
I don't seem to have a way to detect windows switches users. In other words, if I log in with person A, I can detect that. If I then switch users (meaning person A doesn't log out) to person B, person B logs in and I detect that. But if I switch back to person A, no log-on has taken place, and I don't know that the switch took place. Is there a way, via SENS, to catch these events. I seem to only be able to catch Display locks/unlocks, logging on/off, when the screensaver starts/stops, and when the shell starts. Is it possible to do more with SENS, or perhaps to detect when the user is switched using these operations? Or perhaps by some other technique?
ISensLogon2 gave me SessionDisconnect and SessionReconnect, which happen when the user is switched without logging off. I don't have a technical way to solve the second problem, so I'm just circumventing it.

Is there a way to determine if a user is using broadband or dial-up

We have a requirement from a customer to provide a "lite" version for dial-up and all the bells-and-whistles for a broadband user.
The solution will use Flex / Flash / Java EJB and some jsp.
Is there a way for the web server to distinguish between the two?
You don't care about the user's connection type, you care about the download speed.
Have a tiny flash app that downloads the rest the of the flash, and times how long it takes. Or an HTML page that times how long an Ajax download takes.
If the download of the rich-featured app takes too long, have the initially downloaded stub page/flash redirect to the slow download page (or download the bare-bones flash app, or whatever).
The simplest and most reliable mechanism is probably to get the user to select their connection type from a drop down. Simple, I know, but it may save you a world of grief!
There's no way to distinguish between a broadband or dial-up as a connection type, but you can make an educated guess by connection speed.
Gmail does this and provides a link to a basic HTML version of their service if they detect it.
(source: nirmaltv.com)
My guess is that there is some client side javascript polling done on AJAX requests. If the turnaround time surpasses a threshold, the option to switch to "lite" appears.
The best part about this option is that you allow the user to choose if they want to use the lite version instead of forcing them.
Here's a short code snippet from a code who attempted something similar. It's in C#, but it's pretty short and it's just the concept that's of interest.
Determine the Connection Speed of your client
Of course, they could be a temporary speed problem that has nothing to do with the user's connection at the time you test, etc, etc.
I had a similar problem a couple of years ago and just let the user choose between the hi and lo bandwidth sites. The very first thing I loaded on the page was this option, so they could move on quickly.
I think the typical approach to this is just to ask the user. If you don't feel confidant that your users will provide an accurate answer, I suspect you'll have to write an application that runs a speed test on the client. Typically these record how long it takes the client to receive x number of bytes, and use that to determine bandwidth.
Actionscript 3 has a library to help you with this task, but I believe it requires you to deploy your flex/flash app on Flash Media Server. See ActionScript 3.0 native bandwidth detection for details.
#Apphacker (I'd comment instead of answering if I had enough reputation...):
Can't guarantee the reverse, either--I have Earthlink dial-up, soon to upgrade to Earthlink DSL (it's what's available here...).
You could check their IP and see if it resolves to/is assigned to a dial up provider, such as AOL, Earthlink, NetZero. Wouldn't guarantee that those that don't resolve to such a provider are broadband users.
you could ...
ask the user
perform a speed test and ask the user if the result you found is correct
perform a speed test and hope that the result found is correct
I think a speed test should be enough.
If you only have a small well known user group it is sometimes possible to determine the connection speed by the ip. (Some providers assign different subnets to dial-up/broadband connections)

Resources