detect

Detect user exit site

烈酒焚心 提交于 2019-12-11 13:11:22
问题 I have an urge to detect when a user leaves my site in order to record accurately the session length of the user in question. I have thought of a couple possible solutions for this: I first thought I could use onbeforeunload and send a simple ajax to record the last activity but what practice has shown me is that onbeforeunload is unreliable for now and it's a bad idea to use it since it's not cross browser. Then I thought I could use cookies to record the user's session length, respectively

How to detect Collision between 2 UIViews

廉价感情. 提交于 2019-12-11 13:01:31
问题 I have a UIImageView which contains my main Character, and I have made the UIImageView appear circle see below code for creating my character copter = [[UIImageView alloc] initWithFrame:CGRectMake(100, 500, 90, 90)]; [copter setContentMode:UIViewContentModeScaleAspectFit]; copter.layer.cornerRadius = roundf(copter.frame.size.width/2.0); copter.layer.masksToBounds = YES; [copter startAnimating]; [[self view] addSubview:copter]; [self setBat:copter]; I am having trouble with my collision

Batch file detect if specific tab is open?

你。 提交于 2019-12-11 10:29:02
问题 I want to let my script check, if a specific tab is open or not in google chrome, for example "https://stackoverflow.com/". I know how to check if the browser runs at all, but I am not sure, if it's possible to let check it if an specific tab is open. Does someone has an idea, how i could realize this? 回答1: Sort of.. First you need OpenList extension for chrome.Then you need snedkeys.bat. This is a script in the same directory as the snedKeys.bat.It will list all opened links in chrome: @echo

Eclipse unable to detect that a server has started

落爺英雄遲暮 提交于 2019-12-11 07:28:21
问题 I've been trying to solve a mind puzzling problem. I'm currently unable to use any server with eclipse, as they all start correctly but eclipses seems to be unable to see it. I've tried using sun-java6-jdk instead of openjdk6. I've tried using the command line given by the debug view and everything went fine I've successfully reproduced that bug with Glassfish 3.1, JBoss 5.1, Tomcat 6.0 I'm trying to figure out how this is possible. Maybe a network issue? Has anyone met the same problem ? 回答1

How to read an analogue gauge using Open CV

强颜欢笑 提交于 2019-12-10 23:32:39
问题 I'm interested in trying to read an analog gauge using a Raspberry PI and Open CV. I've only really messed with face detection in opencv, so I don't even know where to begin. Any ideas, starting points? 回答1: You can detect circles with HoughCircles method and detect lines with HoughLinesP method of with opencv lib in Python. After detecting these, you can find out the value of the gauge from the line's position via trigonometry. You can see the sample code in python. It basically does these:

Detecting input keystroke during WPF processing

青春壹個敷衍的年華 提交于 2019-12-10 12:23:48
问题 Greetings, I want to write code that executes within an event handler, inside a WPF Windows application, that can detect a keypress, specifically an "Escape" character keypress, within a processing loop. This will allow the user to escape from processing. I realize this may be accomplished with some kind of multi-threaded approach, but the problem seems so simple I wondered if it might be accomplished as follows: // Attempt 1: See if Keyboard static IsKeyDown method detects key presses while

Getting current running application

99封情书 提交于 2019-12-09 19:39:50
问题 How may I get the current running application? I want to check if the application is running or not in service. I used the following code for that. ActivityManager activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE ); PackageManager pm =getPackageManager(); procInfos = activityManager.getRunningAppProcesses(); But it is returning me list of several applications, even if I pressed back button on their home screen. The running app list is still showing them in the list.

jquery detect which button submitted form

て烟熏妆下的殇ゞ 提交于 2019-12-08 16:49:28
问题 I have a form with the following: <form id="my-form" ...> ... <button type="submit" name="bttnsubmit" value="1">The first button</button> <button type="submit" name="bttnsubmit" value="2">The last button</button> </form> I'd like to detect which triggered the form submit event using just: $('#my-form').submit(function(){ //psuedo code if($('[name=bttnsubmit]').val() == 1) { .... } }); Obviously that selector will always return the value of the first bttnsubmit element it comes across, so I

How to detect wheter running on 3G or Wi-Fi on iPhone?

北城余情 提交于 2019-12-08 13:48:42
问题 Some lines of code? Any experience? 回答1: You can use Apple's Reachability code to retrieve this information: Example: Reachability *reach = [Reachability reachabilityForLocalWiFi]; [reach startNotifier]; NetworkStatus stat = [reach currentReachabilityStatus]; if(stat & NotReachable) { //not reachable } if(stat & ReachableViaWiFi) { //reachable via wifi } if(stat & ReachableViaWWAN) { //reachable via wwan } 回答2: Apple's Reachability class will give you this information. http://developer.apple

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

[亡魂溺海] 提交于 2019-12-08 13:44:27
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 for larger video (eg 80MB) the code doesnt seem to get past step 1. The file is moved to s3 ok but my