detect

Is there any way to have PHP detect a corrupted image?

江枫思渺然 提交于 2019-11-29 07:28:41
Is there any way to have PHP determine whether an image file is corrupted and will not be able to display properly? I've tried to check with fopen and check whether the URL is valid, but it hasn't worked! Javascript solution (with involving jQuery, though this should be possible to do without it too): <script type='text/javascript'> $(function(){ var files = [ 'warning-large.png', 'warning-large-corrupted.png', 'http://www.example.com/none.gif', 'http://sstatic.net/stackoverflow/img/favicon.ico' ]; for ( var n in files ) { var img = $('<img/>'); img.error(function(){ alert('error:\n' + this

How to AutoDetect/Use IE proxy settings in .net HttpWebRequest

青春壹個敷衍的年華 提交于 2019-11-29 03:13:15
Is it possible to detect/reuse those settings ? How ? The exception i'm getting is This is the exception while connecting to http://www.google.com System.Net.WebException: Unable to connect to the remote server ---> System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond 66.102.1.99:80 at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.InternalConnect(EndPoint

How to load an arbitrary image from a BLOB stream into a TImage?

人盡茶涼 提交于 2019-11-29 01:03:18
问题 If I understand it correctly, TImage.LoadFromFile determines the type of picture from the file extension. Is there any way to detect the image type automatically from a TBlobStream with a raw image in it? My current code: procedure LoadImageFromStream(AImage: TImage; ADataSet: TDataSet); var Stream: TStream; begin Stream := ADataSet.CreateBlobStream(Field, bmRead); try AImage.Picture.Graphic.LoadFromStream(Stream); finally Stream.Free; end; end 回答1: See this SO answer for file content

How to detect mobile browser using jQuery or in some other SIMPLE way..? [duplicate]

∥☆過路亽.° 提交于 2019-11-29 00:12:48
Possible Duplicate: best way to detect handheld device in jQuery I want to make a mobile version of my web app. How I can run a function that will detect if a request is being made from a desktop or mobile browser? This is so that if the user is requesting from a mobile browser and they click on a link, rather than go to the actual page, it should get hijacked and do some other event.. Thanks in advance.. There are a few scripts on Detect Mobile Browser that redirect mobile visitors on the server side or with JavaScript or jQuery. You could use the following to get the platform navigator

Detecting autocomplete on form input with jQuery

孤者浪人 提交于 2019-11-28 22:33:10
I have a form that detects if all the text-fields are valid on each keyup() and focus(); if they're all valid, it will enable the submit button for the user to press. However, if the user fills in one of the text inputs with a browsers autocomplete feature, it prevents the submit button from being enabled. Is there a way to detect if any of the input has changed regardless of how it's been changed, using jQuery? The jQuery change event will only fire on blur. The keyup event will fire as you type. Neither fire on clicking an auto-completion option. I am also searching for a way to detect this,

iOS: Accurately determining energy of a bump from accelerometer output

喜欢而已 提交于 2019-11-28 22:11:54
I am creating a tuning fork app, where you pat the iPhone into the palm of your other hand, or against a soft surface in order to set the fork zinging. So I would like to detect the energy contained in each 'bump' (EDIT: Removed a ton of gumpf) Can anyone help me crack this one? Thanks to one of the wizards on freenode's #math channel (thanks Igor), I have a really good working solution. You use the standard method to fire a callback at the maximum frequency possible (100Hz), which will contain the instantaneous acceleration x,y,z values. I will let the code speak for itself, good code should

RANSAC Algorithm

落花浮王杯 提交于 2019-11-28 19:19:01
问题 Can anybody please show me how to use RANSAC algorithm to select common feature points in two images which have a certain portion of overlap? The problem came out from feature based image stitching. 回答1: I implemented a image stitcher a couple of years back. The article on RANSAC on Wikipedia describes the general algortihm well. When using RANSAC for feature based image matching, what you want is to find the transform that best transforms the first image to the second image. This would be

Detect only screenshot with FileObserver Android

依然范特西╮ 提交于 2019-11-28 18:26:10
I am currently developing an application for Android and wanted to know how to detect a screenshot. I tried with FileObserver but the problem is that all events are detected ( when device goes into sleep, message, etc. ) . How to detect only screenshot ? Thank you in advance ! alijandro How did you use FileObserver to detect screen shot creation? When using FileObserver , only monitor the file creation event in screen shot directory. String path = Environment.getExternalStorageDirectory() + File.separator + Environment.DIRECTORY_PICTURES + File.separator + "Screenshots" + File.separator; Log.d

iphone SDK detect Wifi and Carrier network

好久不见. 提交于 2019-11-28 16:55:12
my app accesses the internet and i just want to detect whether there is a connection either via wifi or via carrier data network or not apple has made an example for that "Reachability" https://developer.apple.com/iphone/library/samplecode/Reachability/ i think it just detects the wifi and not the carrier network can anyone tell me, whats the best to be done to detect if there's a connection ( any type of connection ) Appreciate ur help! That sample is exactly what you need. Look at Reachability.m. it'll tell you whether you have any connection, and then tell you what kind of connection you

Python and OpenCV. How do I detect all (filled)circles/round objects in an image?

这一生的挚爱 提交于 2019-11-28 16:50:51
问题 I am trying to make a program which opens an image, scans it for circles/round shapes and returns the coordinates so that I can use the cv.Circle function to draw circles over the circle detected. My question is: How do I get the coordinates/radii of the circles detected in an image using cv.HoughCircles() ? Using this page, I found out how to detect the circles (which took me a lot of time to find out since I don't understand terms like threshold and the OpenCV documentation for Python is