detection

PHP 5.3.5 fileinfo() MIME Type for MS Office 2007 files - magic.mime updates?

醉酒当歌 提交于 2019-12-20 01:21:20
问题 On a PHP upload, I'm trying to validate the MIME Type of the files being uploaded to match a valid set of MIME types for the application. When attempting to use the fileinfo() to determine the MIME type of an Office 2007 file it is NOT detecting as their appropriate MIME Types. Instead the MIME type response is "application/zip" Office Document MIME types: http://filext.com/faq/office_mime_types.php Example PHP Code: $oFileInfo = new finfo( FILEINFO_MIME_TYPE ); $sMimeType = $oFileInfo ->

Detect if image is embedded

橙三吉。 提交于 2019-12-19 10:54:06
问题 I started to write my own image host but I have a little problem: I want to display an HTML page if you directly view the link (eg. Domain.com/img/123) via the browser, and an image if you embed the link via <img src="Domain.com/img/123"> to faciliate the use. Is it possible to detect whether the link is directly viewed or the link is embedded with PHP? 回答1: You can use a htaccess file for this purpose: When the browser loads an embedded image, he already knows the format to expect, so he

Determining which gencode (compute_, arch_) values I need for nvcc - within CMake

末鹿安然 提交于 2019-12-19 07:34:44
问题 I'm using CMake as a build system for my code, which involves CUDA. I was thinking of automating the task of deciding which compute_XX and arch_XX I need to to pass to my nvcc in order to compile for the GPU(s) on my current machine. Is there a way to do this: With the NVIDIA GPU deployment kit? Without the NVIDIA GPU deployment kit? Does CMake's FindCUDA help you in determining the values for these switches? 回答1: My strategy has been to compile and run a bash script that probes the card and

Identify Colors using android Camera

时间秒杀一切 提交于 2019-12-19 03:59:24
问题 Currently working on one academic project regarding color detection in android. I am trying to detect color using android cameras that would during live preview or after the picture is taken. I am looking for something like this image. This is ColorGrab android application screenshot. Basically I wanted to identify every color as a particular one color. Lets take a example for that, suppose application detected #FF6CBB but this color is actually similar to pink but I want to mark this color

How to check for a duplicate email address in PHP, considering Gmail (user.name+label@gmail.com)

六月ゝ 毕业季﹏ 提交于 2019-12-18 13:36:44
问题 How can I check for duplicate email addresses in PHP , with the possibility of Gmail's automated labeler and punctuation in mind? For example, I want these addressed to be detected as duplicates: username@gmail.com user.name@gmail.com username+label@gmail.com user.name+label@gmail.com Despite what Daniel A. White claims: In Gmail, dots at random places before the '@' (and label) can be placed as much as you like. user.name@gmail.com and username@gmail.com are in fact the same user. 回答1:

How do you detect the CPU architecture type during run-time with GCC and inline asm?

故事扮演 提交于 2019-12-18 07:07:04
问题 I need to find the architecture type of a CPU. I do not have access to /proc/cpuinfo, as the machine is running syslinux. I know there is a way to do it with inline ASM, however I believe my syntax is incorrect as my variable iedx is not being set properly. I'm drudging along with ASM, and by no means an expert. If anyone has any tips or can point me in the right direction, I would be much obliged. static int is64Bit(void) { int iedx = 0; asm("mov %eax, 0x80000001"); asm("cpuid"); asm("mov %0

Color detection in opencv

帅比萌擦擦* 提交于 2019-12-17 17:59:39
问题 I want to detect a specific color say, blue, from a live video stream. I have written the following code which displays the live video stream and change it into HSV and grayscale. Since I am completely new to opencv I have no idea what to do next. Can someone complete the code for me to detect a specific color. #include<opencv\cv.h> #include<opencv\highgui.h> using namespace cv; int main(){ Mat image; Mat gray; Mat hsv; VideoCapture cap; cap.open(0); namedWindow("window", CV_WINDOW_AUTOSIZE);

Just upgraded my OS X to Yosemite, Android Device Chooser not showing device - what to do?

狂风中的少年 提交于 2019-12-17 08:55:29
问题 After upgrading to OS X Yosemite I found that eclipse was not working because JAVA was not properly installed. I installed it and now I am able to open eclipse. When I connect my device, I am able to see my device on the device list in eclipse. However when I run my project, I am unable to see it on Android device chooser. My device is getting detected by Eclipse but I am not able to select it to run. This was working perfectly on my previous OS X Mavericks! Please help! Thanks 回答1: It seems

NLTK and language detection

筅森魡賤 提交于 2019-12-17 07:12:46
问题 How do I detect what language a text is written in using NLTK? The examples I've seen use nltk.detect , but when I've installed it on my mac, I cannot find this package. 回答1: Have you come across the following code snippet? english_vocab = set(w.lower() for w in nltk.corpus.words.words()) text_vocab = set(w.lower() for w in text if w.lower().isalpha()) unusual = text_vocab.difference(english_vocab) from http://groups.google.com/group/nltk-users/browse_thread/thread/a5f52af2cbc4cfeb?pli=1&safe

Proper method to detect device model (iPhone/iPod Touch)?

六眼飞鱼酱① 提交于 2019-12-14 03:42:37
问题 Is this the proper way to detect which device a user is running? NSString *currentModel = [[UIDevice currentDevice] model]; if ([currentModel isEqualToString:@"iPhone"]) { // The user is running on iPhone so allow Call, Camera, etc. } else { // The user is running on a different device (iPod / iPad / iPhone Simulator) disallow Call. } 回答1: It is not a general solution but Apple in many cases provides API calls to check wether specific feature is supported or not. Examples could be: