detection

How to detect the OS from a silverlight application?

£可爱£侵袭症+ 提交于 2020-02-01 03:08:07
问题 I have a Silverlight3 application that is meant to run on both Windows and Mac OS environments. I would like to know in runtime if my application is running on a Windows or Mac so I can tweak a few things to the way users are accustomed to in their operating system of choice. For example, in Windows it is the norm to use "OK" "Cancel" buttons, while in Mac OS the norm is "Cancel" "OK" buttons (reverse order). Any ideas? 回答1: There are two ways. From Silverlight: string os = Environment

Finding Largest Contours C++

a 夏天 提交于 2020-01-26 02:05:13
问题 I am currently trying to create a program that finds the edges of a receipt and then crops it accordingly. I used this code to do so: vector<vector<cv::Point> > contours; vector<Vec4i> hierarchy; findContours(edged, contours, hierarchy, CV_RETR_LIST, CV_CHAIN_APPROX_NONE); sort(contours.begin(), contours.end(), compareContourAreas); vector<cv::Point> target; for(int i = 0; i < contours.size(); i++){ vector<cv::Point> c = contours[i]; double p = arcLength(c, true); vector<cv::Point> approx;

Python Collision Detection with x and y coordinates for border

风流意气都作罢 提交于 2020-01-25 04:58:10
问题 Im working on a python turtle game where the turtle can move with commands but it has to be able to detect collision with rectangles and circles on the screen as well as the border. I have no idea how to do this can anyone help? 回答1: Collision is easy! Before the nitty gritty, you need to understand how to obtain the distance between two points. If you have not done this before it is just pythag! If you picture two points on a plane (red points on the picture), the shortest distance to travel

64-bit windows VMware detection

我是研究僧i 提交于 2020-01-22 09:50:47
问题 I am trying to develop an application which detects if program is running inside a virtual machine. For 32-bit Windows, there are already methods explained in the following link: http://www.codeproject.com/Articles/9823/Detect-if-your-program-is-running-inside-a-Virtual I am trying to adapt the code regarding Virtual PC and VMware detection in an 64-bit Windows operating system. For VMware, the code can detect successfully in an Windows XP 64-bit OS. But the program crashes when I run it in a

Is there a way to detect if a key has been pressed?

坚强是说给别人听的谎言 提交于 2020-01-21 18:55:25
问题 I am compiling and executing my programs in cygwin on a windows computer. I am quite inexperienced in C but I would like a way to detect if a key has been pressed without prompting the user(e.g me). My pseudo code with desirable functions is shown below. char ch; while(1){ if(KeyBeenPressed()){ //a key has been pressed before getting here ch=getKeyPressed(); if(ch=='0'){ printf("you have pressed 0"); } else{ printf("you did't press key 0"); } } //do other stuff } And my own try to solving

How to detect current JSF-Version?

此生再无相见时 提交于 2020-01-19 00:48:22
问题 I am developing a jsf-webapp and now I need to know what JSF-Version I am using? Where can I look this up? Thanks in advance. 回答1: Programmatically, you mean? You can get it from Package#getImplementationVersion(). String version = FacesContext.class.getPackage().getImplementationVersion(); There are by the way also getImplementationVendor() and getImplementationTitle() methods. You might want to use it as well in order to distinguish the vendor (MyFaces or Mojarra, for example). Or do you

How to detect current JSF-Version?

試著忘記壹切 提交于 2020-01-19 00:43:05
问题 I am developing a jsf-webapp and now I need to know what JSF-Version I am using? Where can I look this up? Thanks in advance. 回答1: Programmatically, you mean? You can get it from Package#getImplementationVersion(). String version = FacesContext.class.getPackage().getImplementationVersion(); There are by the way also getImplementationVendor() and getImplementationTitle() methods. You might want to use it as well in order to distinguish the vendor (MyFaces or Mojarra, for example). Or do you

How to detect database type?

我们两清 提交于 2020-01-15 11:33:11
问题 I need to be sure the database I'm connecting to is MySQL and not PostgreSQL or Microsoft SQL Server.How can I find out which type of database is being used . 回答1: The first hint might be the "connection error" you're likely to get if you try to connect to a PostgreSQL database with a mySQL database driver :) Basically, you need to: 1) Code your application in a portable manner (don't use MSSQL extensions in a query that might be run on mySql, for example) 2) Choose a portable driver API

Viola-Jones Algorithm - “Sum of Pixels”?

亡梦爱人 提交于 2020-01-15 06:09:03
问题 I have looked at many articles and answers to questions on how the Viola-Jones algorithm really works. I keep finding the answers saying the "sum of pixels" in a certain region subtracted by the "sum of pixels" in the adjacent region. I'm confused on what "sum of pixels" means. What is the value based on? Is it the number of pixels in the area? The intensity of the color? Thanks in advance. 回答1: These are the definitions based on Viola-Jones paper on 'Robust Real-time Object Detection'

URL detection with JavaScript

泄露秘密 提交于 2020-01-13 02:37:26
问题 I'm using the following script to force a specific page - when loaded for the first time - into a (third-party) iFrame. <script type="text/javascript"> if(window.top==window) { location.reload() } else { } </script> (For clarification: This 'embedding' is done automatically by the third-party system but only if the page is refreshed once - for styling and some other reasons I want it there from the beginning.) Right now, I'm wondering if this script could be enhanced in ways that it's able to