detect

Detecting PS/2 port state in C#

自闭症网瘾萝莉.ら 提交于 2019-12-24 04:12:33
问题 this is my first post! I am attempting to simply detect whether there is a keyboard attached to the PS/2 port on my machine. The idea is that the computer will boot up, although if it detects a USB device or PS/2 keyboard, it reboots into an administrator mode. I have handled the USB aspect, although I have had no luck in finding any documentation for the PS/2 port. Some posts have said it is not possible to detect a keyboard plugged into a PS/2 port after boot, although I simply wish to

Microphone detection Actionscript 3

戏子无情 提交于 2019-12-24 00:52:56
问题 I'm having a few problems detecting whether a microphone is detected or not. I'm running the function Microphone.getMicrophone() and that should return null if there is no microphone attached, or if the user has clicked Deny on the security panel, right? The problem I'm facing is, on some computers where there is no microphone installed, Microphone.getMicrophone() still traces out as [object Microphone] . So say for example the user doesn't have a microphone, and clicks allow in the security

Detect if Device has GPS

杀马特。学长 韩版系。学妹 提交于 2019-12-23 21:16:03
问题 How to detect if GPS is available? The iPod touch and iPad WiFi version don't have GPS, they have something else based on WiFi. Anyway, how to know if GPS is available? Or how to detect iPod Touch or iPad Wifi model? 回答1: This is a common difficulty on iOS... One way would be to get a location and check if the altitude is present. if a valid altitude is present, the position has most probably been computed using GPS else either the GPS has not picked-up any signal yet or it is not present.

Detect shift key on application startup in C#/Windows Forms

随声附和 提交于 2019-12-23 18:42:29
问题 Is there a way to get a standard Windows Forms application to detect if the Shift key is being held down on application startup - without using Windows hooks? I ideally would like the workflow to change from normal if the shift key is held down when the EXE file is run. 回答1: Here is an article about reading the key states (and mouse) directly. 回答2: The ModifierKeys property looks ideal: private void Form1_Load(object sender, EventArgs e) { if ( (ModifierKeys & Keys.Shift) != 0) { MessageBox

JQuery - how do i detect how many divs of a given class exist within a given div?

好久不见. 提交于 2019-12-23 15:50:21
问题 I have a div like this: <div id="x" name="x" class="x" style=""></div> and contained within this div I have several divs like this: <div id="y_1" name="y_1" class="y" style=""></div> <div id="y_2" name="y_2" class="y" style=""></div> <div id="y_3" name="y_3" class="y" style=""></div> etc. QUESTION 1: How do I detect how many of these divs (class="y") are contained within the container div (class="x")? - (just an alert("") with the number, for example). QUESTION 2: How do I do something to

jQuery - Detect if element height is bigger than window height and do something about it

烈酒焚心 提交于 2019-12-23 09:58:12
问题 The tittle really says it all. Basically i want to detect if this div 's height is bigger than window height and do something about it.. I have done this but i cant get it to work http://jsfiddle.net/dhkCa/3 Why wont it work? Edit: Fixed a little error in the css code. Jsfiddle link updated. 回答1: The document 's contains all the elements within itself, and its height is a sum of the heights of all those elements (all the display:block elements anyway, plus margin and padding); therefore no

How to sequence events in PHP for uploading files to amazon S3

↘锁芯ラ 提交于 2019-12-23 04:17:06
问题 I am getting varied results with some PHP code I have written to upload files to S3 then call an EC2 instance to perform actions on the uploaded file. Here is the order I do things - 1) use S3 class to put file $result = s3 -> putObjectFile($uploadDIR, $bucket, $name, S3::ACL) 2) check $result if($result == "1") { //file made it to s3 3) use cURL to call EC2 instance and perform action on file in S3 I am using this with video files, when I upload a small video file it works ok (eg 3MB) but

Task manager close is not detected second time in a WinForms Application

强颜欢笑 提交于 2019-12-22 08:26:38
问题 private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { if (MessageBox.Show(this, "Do you really want to close?", "Close?", MessageBoxButtons.YesNo) == DialogResult.No) { e.Cancel = true; } } } So when I want to close the application clicking the close button the message box is shown as it should, then I chose no. Then the line e.Cancel = true is executed and the form is not closed. Now the thing is, after this if i close the

Detecting Broken CSS “background-images” in JavaScript/jQuery

依然范特西╮ 提交于 2019-12-22 08:06:23
问题 Here is an example to detect broken Images http://maisonbisson.com/blog/post/12150/detecting-broken-images-in-javascript/ but is it possible to detect an broken background-image? For exmaple: <div style="background-image:url('http://myimage.de/image.png');"></div> 回答1: Do you have control over the "404 not found" page on your server? In that case you could point it to a script that looks for .jpg/.png/.gif in the requested URL and log accordingly, then outputting a 404 page to the user. 回答2:

automatically detect web browser window width change?

南楼画角 提交于 2019-12-20 09:35:45
问题 i know that you with $(window).width() can get the size of the web browser. i want to detect when the user change the size of his web browser so i could readjust the columns width. is there a way to automatically detect this or do i have to use setTimeinterval to loop and see if it has changed? 回答1: Try the resize event $(window).resize(function() { console.log('window was resized'); }); 回答2: The JavaScript event is named window.onresize . The JQuery binding is named .resize() 回答3: Writing