martedì 4 aprile 2017
venerdì 23 dicembre 2016
create or replace function sec2time (sec in number) return varchar2 is seconds number; hours_var number; minutes_var number; seconds_var number; output_var varchar2(32); begin if (nvl(sec,0)=0) then return 'ND'; end if; seconds := abs(sec); hours_var:= trunc (seconds / 3600); minutes_var:= trunc((seconds - (hours_var*3600))/60); seconds_var := seconds - (hours_var*3600) - (minutes_var*60); output_var := to_char(hours_var,'00')||':'||to_char(minutes_var,'00')||':'||to_char(seconds_var,'00'); return(replace(output_var,' ','')); end;
lunedì 4 luglio 2016
giovedì 23 giugno 2016
mercoledì 16 marzo 2016
How To Disable Your Windows Screensaver With Motion Detection
While password-locked screensavers are a security necessity at many businesses, in most homes the screensaver’s only real purpose is to…well…save the screen. It can become a little bit of an annoyance to have to tap the keyboard or move the mouse whenever you walk up to the computer to see what’s going on. It’s especially annoying if you have scans running or some other activity that you just want to monitor over a long period of time. The screensaver will kick in, and you have to tap the keyboard or move the mouse to remove it.
There may be some newer computer systems that already do this, but for the most part people are still stuck with tapping the keyboard to disable the screen saver. I started thinking about this the other day and decided to try to put together a combination of applications and scripts that would accomplish this simple automation task (yes, these are the sorts of things automation engineers do for fun).
The Motion-Detection Screensaver SolutionWhat I came up with was an application-script combination that would constantly monitor the webcam for motion, and then instantly run a script that would remove the screensaver. Deciding on the webcam software was easy. I was tempted to use the Active Webcam software that I previously wrote about, but then I realized that YawCam, which Mark covered before, is much simpler and more effective for this sort of task.
Once you install and run YawCam (and give them a nice donation for offering us this free software), you’ll see the following screen over the webcam video.
On this screen, you’ll see a “Settings…” button next to Run.exe. Select the checkbox next to “Run.exe” and then click on the settings button.
Click on the Activate check box for flood control (you don’t want the script launching 50 times a second), and put some delay (I put 10 seconds, but you can use up to 60 or more). The next step would be to click on the browse button and choose your script file that you want to run. Alas, you don’t have one yet. Don’t worry, I’ve got you covered.
You’ll notice that the default filter looks for .bat or .exe files, but you can also choose a Windows Script file (.wsf). For this article, I hunted for a whole list of ways to kill the screensaver via script. I searched for programs that already exist, or batch job methods that disable the screen saver. In each of those cases the screensaver stays disabled – not good. So then I turned to methods to send keyboard keys or mouse clicks to Windows – and sure enough, that was the solution.
After digging around Microsoft help files, I found the SendKeys code that simulates pressing the “Enter” button on the keyboard. The following is the script.
Save this script to a .wsf file and point the Action event in YawCam to that file. Now, every time there’s motion in the webcam, it’ll kick off your script, which simulates pressing the keyboard enter key – which will disable the screen saver.
set WshShell = WScript.CreateObject(“WScript.Shell”)
If you find that your script isn’t getting launched or the motion detection doesn’t seem to be working (or it’s too sensitive), make sure to check out the “Settings” tab in YawCam. Make sure that the tolerance is high enough so it’s not too sensitive, and make sure the sensitivity is high enough so that it picks up when you sit down in front of the computer.