detect

Best way to detect mobile device and redirect

∥☆過路亽.° 提交于 2019-11-30 19:43:20
Here's my snippet for detecting a mobile display based on the screen size. You can force the site to stay in desktop-mode by adding a forceDesktop param to the URL. I`m new to jquery so if you have suggestions, please comment. Credits go to brandonjp: How can I get query string values in JavaScript? <script> $.urlParam = function(name, url) { if (!url) { url = window.location.href; } var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url); if (!results) { return undefined; } return results[1] || undefined; } window.onload = function() { var forceDesktop = $.urlParam('forceDesktop');

How to determine if a Facebook user has uploaded a profile picture or its default?

好久不见. 提交于 2019-11-30 15:00:31
Is there a way to know if a user uploaded an image to the profile or it has the default user picture of Facebook via FQL or somthing else? Love Sharma You can use the Python script below (as not mentioned any programming language) to make it work. urllib.urlopen('https://graph.facebook.com/<PROFILE_ID>/picture?access_token=%s' % access_token).geturl() This will provide you a Facebook profile photo URL. If that URL contains <PROFILE_ID> then it uploads an image. Else the default Facebook image is uploaded. For example, if uploaded image: http://profile.ak.fbcdn.net/hprofile-ak-snc4/195361_

Peak detection algorithm in Python

青春壹個敷衍的年華 提交于 2019-11-30 08:54:14
问题 I'm implementing a peak detection algorithm in Python that detects only those peaks that are above a threshold magnitude. I don't want to use the inbuilt function as I have to extend this simulation to Hardware implementation also. from math import sin,isnan from pylab import * def peakdet(v, delta,thresh,x): delta=abs(delta) maxtab = [] mintab = [] v = asarray(v) mn, mx = v[0], v[0] mnpos, mxpos = NaN, NaN lookformax = True for i in arange(len(v)): this = v[i] if abs(this)>thresh: if this >

How to intercept (detect) a Paste command into a TMemo?

天大地大妈咪最大 提交于 2019-11-30 08:37:14
问题 How to catch Paste command and change text of Clipboard before that text is pasted into a TMemo, but, after Paste, text in Clipboard must be same like before changing? Example, Clipboard have text 'Simple Question', text that go in the TMemo is 'Симплe Qуeстиoн', and after that text in Clipboard is like before changing, 'Simple Question'. 回答1: Derive a new control that descends from 'TMemo' to intercept the WM_PASTE message: type TPastelessMemo = class(TMemo) protected procedure WMPaste(var

How can you detect if the device is rooted in the app? [duplicate]

妖精的绣舞 提交于 2019-11-30 07:40:58
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: Determine if running on a rooted device On Launch of the application, I want to detect if the device running is rooted. Is there proper way of detecting it? I don't think trying to write a file to '\data' to see if rooted is a good solution. (Since even rooted devices may have that path unprivileged) 回答1: At the end of the day, you can't. A rooted device may be modified in any way, and thus can completely hide

Dealing with tel: anchor

一笑奈何 提交于 2019-11-30 05:42:38
问题 I have an anchor to a telephone number. On phones is great. On desktops with Skype or Google Voice it's good. The problem is on desktops that just don't know how to deal with that. What should I do? Detect if it's not mobile and change the link? I still want the link to show, just the URL to be different. Is there a better way? If not, how do I detect mobile in JavaScript in order to change the href attribute? Thank you. 回答1: To detect if the browser is launching from a mobile in JavaScript:

Best way to detect mobile device and redirect

冷暖自知 提交于 2019-11-30 04:25:33
问题 Here's my snippet for detecting a mobile display based on the screen size. You can force the site to stay in desktop-mode by adding a forceDesktop param to the URL. I`m new to jquery so if you have suggestions, please comment. Credits go to brandonjp: How can I get query string values in JavaScript? <script> $.urlParam = function(name, url) { if (!url) { url = window.location.href; } var results = new RegExp('[\\?&]' + name + '=([^&#]*)').exec(url); if (!results) { return undefined; } return

How to determine if a Facebook user has uploaded a profile picture or its default?

▼魔方 西西 提交于 2019-11-29 21:21:02
问题 Is there a way to know if a user uploaded an image to the profile or it has the default user picture of Facebook via FQL or somthing else? 回答1: You can use the Python script below (as not mentioned any programming language) to make it work. urllib.urlopen('https://graph.facebook.com/<PROFILE_ID>/picture?access_token=%s' % access_token).geturl() This will provide you a Facebook profile photo URL. If that URL contains <PROFILE_ID> then it uploads an image. Else the default Facebook image is

How to check the network speed using swift

怎甘沉沦 提交于 2019-11-29 20:46:50
问题 I have googled too many pages saying on the network reachability (only yes or no availibilty), but I never heard somebody could detect the network speed using Swift xcode environment. I need this feature(detect the network speed to some host), could someone gave me a clue on this issue 回答1: I made this func to calculate the network speed in Swift 3 . I download an image from my server and calculate the elapsed time. func testSpeed() { let url = URL(string: "http://my_image_on_web_server.jpg")

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

限于喜欢 提交于 2019-11-29 20:44:36
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 really poor, almost none). Unfortunately, on that page it didn't show how to extract the information of