detect

How to detect the printer model?

Hi! When I plug my HP Laserjet 3015, Windows detects the correct model and then tries to install the appropriate drivers. How can I detect the model of connected printer(s)? I don't want to use the list of installed printers because a Zebra printer can be installed with a Generic/Text only driver. I'm a Delphi and C# programmer, so an...

how to detect if a URL points to a SWF

Is there a way (preferrably using JavaScript) to determine whether a URL is to a SWF or a JPG? The obvious answer is to sniff the filename for ".jpg" or ".swf" but I'm dealing with banners that are dynamically decided by the server and usually have a lot of parameters and generally don't include an extension. so i'm wondering if I co...

How could I know when someone attaches a removable disk on my computer?

I would like to know how can I detect when the user attaches a removable drive on a computer ( in a Windows XP environment ) . There surely has to be a better way than constantly checking to see if the number of drives increased , right ? ...

How can I write a program that can detect by itself that it has been changed?

Hi, I need to write a small program that can detect that it has been changed. Please give me a suggestion! Thank you. ...

Detecting the fundamental frequency

There's this tech-festival in IIT-Bombay, India, where they're having an event called "Artbots" where we're supposed to design artbots with artistic abilities. I had an idea about a musical robot which takes a song as input, detects the notes in the song and plays it back on a piano. I need some method which will help me compute the pitc...

VB.NET: Detect if a text file is open

Is there any way to determine if a text file is currently open in a text editor? Or better yet, is there a way to trigger an event when a text file is opened (from any program)? ...

Detecting drop into textarea with Javascript

All I need is to be able to detect when text is dropped into a Textarea. I then take that text and do stuff with it and clear the textarea. There may be many of these textareas and very high UI expectations, so polling is a last resort. For IE, "onfocus" does the trick, since this event is fired after the user drops stuff into the tex...

Is there a way to detect Layout or Display changes in WPF?

Hello! I am trying to check how fast the Frame control can display a FixedPage object when it is assigned to Frame.Content property. I plan to check the tick count before and after the assignment to the Content property. Example: int starttime = Environment.TickCount; frame1.Content = fixedpage; int endtime = Environment.TickCount; ...

noscript tag, I need to present alternative html if not enabled.

Is it possible to replace javascript w/ HTML if JavaScript is not enabled on the user's browser? I know I can use <noscript>this displays in place of javascript</noscript> That works fine, but it still runs the javascript. In theory I would want this: if javascript is enabled   run javascript if javascript is not enabled   don't r...

Method to detect a parked page?

Anyone know of a way to programatically detect a parked web page? That is, those pages that you accidentally type in (or intentionally sometimes) and they are hosted by a domain parking service with nothing but ads on them. I am working on a linking network and want to make sure that sites that expire don't end up getting snatched by s...

Detecting network connection speed and bandwidth usage in C#

Is there a way to detect the network speed and bandwidth usage in C#? Even pointers to open-source components are welcome. Thanks in advance. ...

Upstart calling script (for inserted USB-drive)

Hi, I know that Ubuntu (and Fedora) uses Upstart istead of the classical System V init daemon (SysVinit). I would like to know how to detect when a USB-drive has been inserted, mount it and copy some files to it. I would like Upstart to call my own script for this. If it is possible I would like Upstart to call the script for a specifi...

Is there a way to fire a javascript function on submit without onsubmit()

I am looking to write a javascript function that will fire when a user submits a form, however I do not have edit access to the submit button so that I can add the onsubmit function. I am able to add a <script> tag, so if I can detect the submit, then I can execute my code. Anyone know how to do this? ...

How do I automatically find a user's location?

I am currently working on a show listing website. I am going to display show information by location for the user sorted in a variety of different ways. I know I could ask the user where they are located when they first sign into the site, but I've seem to notice that many sites have this capability built-in to detect location automa...

Detecting MIME type in PHP

I'm looking for the best (possible on most PHP 5.2 installs and still actively developed) way to detect a files MIME type in PHP. I'm aware of the mime_content_type() method and the Fileinfo extension, however mime_content_type() is unreliable and deprecated, and Fileinfo doesn't come in a "standard" PHP (5.2) install. Do I have any o...

Detecting CTRL+V using AS3 in IE

I am not able to detect the keyboard event CTRL+V on a swf using AS3 in IE. It seems to trigger the default browser behavior, and im not able to do anything... Any workaround for this? ...

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

Hi I am hoping someone can help me to understand why 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) ...

can client side Javascript detect when server has closed http connection while client is working?

In my application, the client is a Javascript set of functions in the browser, and it does some work - for example, playing a clip. It uses XmlHttpRequest to talk to the server. However, the server is allowed to abruptly close the connection since there is no other way it seems, to interrupt the client. Can the client detect, while it i...

How do you detect iPhone v. iPhone 3G using Obj C

There is a model property of the device, but it doesn't distinguish between iPhone and iPhone 3G. Is there a better way? ...

How should unit tests set up data sources when not running in an application server?

Thank you all for your help. A number of you posted (as I should have expected) answers indicating my whole approach was wrong, or that low-level code should never have to know whether or not it is running in a container. I would tend to agree. However, I'm dealing with a complex legacy application and do not have the option of doing a...