How can I judge whether deep freeze is in frozen programatically? - software-design

Two problem here:
Just like the title, when Faronics' deep freeze is running at my computer, how can I find whether it is in frozen state programatically?
Deep freeze seriously influence my software update scheme, Is there any good idea to handle it?
Any answer is appreciated. thanks!

You can query windows event log for checking Deep Freeze frozen or thawed state.
When Deep Freeze is in Frozen state it will create an event log under
Event Logs > Windows > Application
Event Data : Frozen
When Deep Freeze is in Thawed state it will create an event log under
Event Logs > Windows > Application
Event Data : Thawed

I found it by searching the registry
HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Faronics\Deep Freeze 6\DF Status
This will be either Frozen or Thawed as a string.
An oddity is the fact that it says Deep Freeze 6 in the registry but i have version 8 installed.

First Question:
Hold down the shift key and double-click the Deep Freeze icon. Alternatively, you can press CTRL+ALT+SHIFT+F6.
Enter your password and click OK.(ask the shop owner)
If you have not yet entered a password you should be able to click OK without entering a password.
The Boot Options dialog is displayed. That will tell you if it's active.
Second Question:
Deep Freeze is not optimized to handle updates. I've tried a few different solutions similar to Deep Freeze and found that Drive Vaccine was the most user friendly in terms of implementing updates. Something to keep in mind, as I know the handling of updates has been many people's biggest complaint about Deep Freeze.

Related

How do I know who changed my Cloud Function

Yesterday, on a beautiful Saturday, I was resting. When suddenly the phone rings and the "system has stopped working".
When I observed the "cloud functions" one of them had an upload that I did not do, probably another member of the team.
After all, I was resting!
Now, my manager wants the deployment history for all functions.
How to know and where to get this information?
Entering the "cloud function" I can even see that there was the deploy, but it does not say "which user did it".
There are audit logs kept for all user actions. You can determine who updated the function by:
Go to Logging > Logs Explorer
In the Query Builder text box, add the following search term:
protoPayload.methodName="google.cloud.functions.v1.CloudFunctionsService.UpdateFunction"
Click the Run Query button and then filter down by the date and time of when it was deployed and you'll see the user's email in the principal_email property.
#Brian's answer is good. But here's another way to check Audit logs and see all operations happening on Cloud Functions:
Go to Navigation Menu > Home > Activity
Go to Filter Categories on the right part of the screen and make sure all Activity types are selected (checking only Data Access and configuration works fine as well).
Click Resource type and uncheck all but don't click OK yet.
Type to filter "Cloud Function" then check it.
Click OK.
In logs for the functions you have the information about deployment it should look something like that:
{"#type":"type.googleapis.com/google.cloud.audit.AuditLog","status":{},"authenticationInfo":{"principalEmail":"EMAIL#gmail.com"},"serviceName":"cloudfunctions.googleapis.com","methodName":"google.cloud.functions.v1.CloudFunctionsService.UpdateFunction","resourceName":"projects/ffunctions-nodejs/locations/us-central1/functions/CRON_1440_OptimisationCall"}
I would start with reviewing this information (it is on the Console -> Project -> Functions -> logs)
Down the rabbit hole, we can go into console.cloud.google.com (Console -> Project -> Functions -> click on the three dots and go "Detailed usage statistics").
not really sure what you can dig in there though
Go to the Logs explorer and paste the below to find the updaed users of the cloud function.
resource.type = "cloud_function"
resource.labels.function_name = "your_cloud_function_name"
protoPayload.methodName="google.cloud.functions.v1.CloudFunctionsService.UpdateFunction"
Hope this helps!!

Using apple script to press the return key when prompted to connect to server

Currently this is my delima. Once in a while a build agent will reboot. It needs to always stay connected to share on one of our servers. The idea was to tell finder to mount the volume, wait 2 seconds, and then press enter...since the user name and pssword are both part of the address when I enter it such as SMB://username:password#Server1/DFS it pops up the pasword dialog fully populated but I can't get applescript to recognize it, then press either connect or the return to say "Yes" login witht hat name and don't prompt me.
it worked fine when connecting at home to a synology device but it's not working when connecting to a server in the office.
tell application "Finder" to mount volume "SMB://username:password#Server1/DFS"
delay 2
tell application "System Events" to keystroke "return" -- key code 36
Any help for this seemingly simple step would be greatly apprecited.
I have looked ove the forums and found variou stratagies but they all relate to an application like Firefox or some other script aware app. I just need it to press enter when the password dialog comes up.
First of all the Finder is not needed to mount a volume, you can delete the tell block.
Secondly, if username and password are passed the volume is supposed to mount without a dialog. Maybe you could find the reason why it doesn't.
Nevertheless the password dialog belongs to the process SecurityAgent, you have to use (ugly) GUI scripting to press the button:
tell application "System Events"
repeat until exists process "SecurityAgent"
delay 0.5
end repeat
tell window 1 of process "SecurityAgent"
click button 2
end tell
end tell
The script waits until the window appeared, this is much more reliable than an hard-coded delay.
Looks like a possible XY Problem as I would expect a solution such as https://apple.stackexchange.com/a/698/204318 to work for you to directly mount the share:
mount -t smbfs //username:password#MACHINENAME/SHARENAME /SomeLocalFolderOfChoice
However, if you are really required to interact with the dialog, and as you asked about it, take a look at this tutorial (written in Python) for scripting up something:
detect missing connection
attempt connection
capture screen periodically
look for dialog box, else loop
error after a few seconds of failure
if dialog is detected, interact with it
input username and password
wait, then press return
check if connection worked after a small delay
success or failure
This type of strategy is very powerful for interacting with all sorts of different dialogs you may encounter and should be possible in AppleScript if you are much more familiar with it (or another scripting language).
If you are open to non-AppleScript solutions, then you might consider Keyboard Maestro, one of the best Mac automation tools available.
You said:
it pops up the pasword dialog fully populated but I can't get
applescript to recognize it, then press either connect or the return
to say "Yes" login witht hat name and don't prompt me.
You could probably do this very easily using Keyboard Maestro. Here's an example of the KM Actions to accomplish this.
If you'd like help with KM, please visit the forum at:
https://forum.keyboardmaestro.com/
I'm a big AppleScript/JXA user, but I often find it easier/quicker to use KM for many automation tasks. Of course, KM Macros can execute AppleScript, JXA, Shell Scripts, and other scripts easily.
You can try a full version of KM for free for 30 days.

Qt 5.8 How to use the SCXML framework with sub state machines?

I am trying to build a system, which is orchestrated by a main state machine and has different sub state machines for the tasks it is executing. Being a long-time Qt user I looked at the new SCXML implementation in Qt 5.8. However I cannot figure out how to use the API provided with 5.8 to implement sub state machines properly.
My idea is to use a main state machine and then invoke the specific sub state machines in the states of the main state machine. While invoking the sub state machines works I could not figure out how to access them after the top state machine objects emits invokedServicesChanged(..) I can access the pointer to QScxmlInvokableService but not to the concerning state machine.
Also the top level state machine object only exposes states and events from the top and not from the invoked state machines. For example topLevelStateMachine->activeStateNames() only lists the top states.
Looking at Qt's source code I saw that QScxmlInvokableService is actually a the base class for QScxmlScxmlService which contains a pointer to the concerning state machine. Unfortunately QScxmlScxmlService is defined in qscxmlinvokableservice_p.h which is private as the _p in the name indicates. So how am I supposed to use the public SCXML API? Am I missing something? IIRC SCXML support was a technical preview in 5.7 but is now included in 5.8 as part of the normal distribution.
I spent the last week or so studying the examples and then writing my own state machine and code that responds to it. It took a while as the documentation is not as clear as it could be.
I have found that activeStateNames does retrieve all states contained within the state machine, including sub-states.
It took me a couple of readings of the traffic light example to get figure this out. The key is that the sub-state machines are contained in specific states. (The graphical view of the state machine helps here.)
In the example there are only two states in the over-all, top-level machine: working and broken. The transitions are controlled by events smash and repair.
Within each of the two states are smaller state machines. Broken contains a state machine of two states: blinking and unblinking. That state machine starts in the state blinking when broken is entered.
When the in the sub-state blinking of broken, activeStateNames will return blinking if called with false (defaulted) or blinking and broken when called with true.
So how do you use this?
If I have something I want to set/unset according to a specific state, I can connectToState in the machine. The slot I connect to will get called when the state changes between active and inactive, and it will receive a boolean value saying if the state is active. In the traffic light example, the state red is connected to the redLight. Since redLight should be on when in the red state and not otherwise, it is connected to a slot takes a boolean: true turns the light on, false turns it off.
Okay, but what if I want to catch an event when I enter a state?
I simply select the state, then add an onEntry -> send and specify the event name. This will cause an event to be sent when I enter the state. This event can be routed to a slot (in Qt 5.8) using connectToEvent. [The Qt 5.7 version only has a generic eventOccurred signal which you can send to a slot and then query which event using event.name().]

HKWorkoutSession isn't keeping app at front of Apple Watch

It has been stated that an app running a HKWorkoutSession will have special privileges over other watchOS 2 apps, so when a user looks at their Apple Watch, it will go to the view showing running a workout rather than the watch face.
Currently, on both my device and simulator, this is not the case. If I start a HKWorkoutSession and then leave for 5 minutes and then interact with either the Apple Watch, or the Watch Simulator, it presents the watch face.
If I then open my app, it appears to have been frozen, rather than terminated (which is what I imagine happens to other apps). As the UI will update when I need receive a response in my query.updateHandler. Also if I set it to provide haptic feedback every time my query.updateHandler receives a new HKQuantitySample it will do so, so the app must be running in the background in some form.
Has anyone else noticed this behaviour, and am I doing anything wrong, or expecting something I shouldn't?
Here is how I start my HKWorkoutSession:
self.workoutSession = HKWorkoutSession(activityType: HKWorkoutActivityType.Other, locationType: HKWorkoutSessionLocationType.Indoor)
self.healthStore.startWorkoutSession(self.workoutSession) {
success, error in
if error != nil {
print("startWorkoutSession \(error)\n")
self.printLabel.setText("startWorkoutSession \(error)")
self.printLabel.setTextColor(UIColor.redColor())
}
We're seeing that too, for the moment we've made sure 'opens last activity' is configured.
When the UI is active we start a dispatch_timer to request and process data in 1 second intervals.
Make sure you do any significant processing using the NSUserProcessInfo method though and pause the dispatch_timers whenever you are no longer active. You'll get crashes otherwise.

Loadrunner Test Scenario Controller doesn't want to start and throws this : "Failed to start/stop Service Virtualization"

I have a Loadrunner Test Scenario, here is the snapshot for it:
after opening my Test Scenario with Loadrunner Controller, I click then the "Start Scenario" button, the Scenario must run for 2 Hours, but it stops after 1 minute, and get the following Error:
Failed to stop Service Virtualization.
Failed to start Service Virtualization.
here you can see the error snapshot:
to increase the size of the snapshot please: Ctrl++
It seems that you have unwittingly activated an integration with HP Service Virtualization (or SV for short), without having SV installed on the same machine. In order to remove it, open the SV configuration dialog and uncheck all the entries.
I solved the problem with a lot of effort.
the problem is, when you have test scenario, which worked before, and you try to remove some script (groups) of the scenario,after that the test scenario will not work, what I've done, is I created from scratch a new scenario with the same test scripts, and voila it worked, I hope everyone will pay attention at that in the future

Resources