detect

How can I detect if an iPhone is rotating while being face up in a table?

我们两清 提交于 2019-12-05 20:22:43
Is there a way to detect if an iphone lying down in a table face up is rotating?. I do realize that this kind of movement is not reported by the accelerometer and neither is it reported to the - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation method. Is there a way to detect angle variations for the phone rotating this way?. Thank you. The gravity vector will be constant as it rotates on a flat table so you won't see anything on the accelerometers. You could follow compass heading changes to detect this rotation but only on an iPhone 3G S. See the

Detecting Broken CSS “background-images” in JavaScript/jQuery

孤街醉人 提交于 2019-12-05 17:28:29
Here is an example to detect broken Images http://maisonbisson.com/blog/post/12150/detecting-broken-images-in-javascript/ but is it possible to detect an broken background-image? For exmaple: <div style="background-image:url('http://myimage.de/image.png');"></div> Do you have control over the "404 not found" page on your server? In that case you could point it to a script that looks for .jpg/.png/.gif in the requested URL and log accordingly, then outputting a 404 page to the user. I dont think you need to have jQuery or javascript to tell you whether a link is broken. Use Firebug in Firefox

How to Detect Mac OS X Version in JavaScript

末鹿安然 提交于 2019-12-05 17:11:32
I have scoured everywhere on the internet as to how to detect the OS and it's version. I have found out how to do it for windows, (see code below), and now I want it to work for Mac too. Windows detection code (works perfectly!): // OS detection var _os_ = (function(){ var userAgent = navigator.userAgent.toLowerCase(); return { isWin2K: /windows nt 5.0/.test(userAgent), isXP: /windows nt 5.1/.test(userAgent), isVista: /windows nt 6.0/.test(userAgent), isWin7: /windows nt 6.1/.test(userAgent), }; }()); // get OS shorthand names var OS; if(_os_.isWin2K){ OS = "Windows 2000"; } if(_os_.isXP){ OS

Task manager close is not detected second time in a WinForms Application

怎甘沉沦 提交于 2019-12-05 16:50:13
private void Form1_FormClosing(object sender, FormClosingEventArgs e) { if (e.CloseReason == CloseReason.UserClosing) { if (MessageBox.Show(this, "Do you really want to close?", "Close?", MessageBoxButtons.YesNo) == DialogResult.No) { e.Cancel = true; } } } So when I want to close the application clicking the close button the message box is shown as it should, then I chose no. Then the line e.Cancel = true is executed and the form is not closed. Now the thing is, after this if i close the application from task manager the close reason is UserClosing !!! Why? Shouldn't it be TaskManagerClosing?

How to detect if the browser support flash?

房东的猫 提交于 2019-12-05 09:12:45
I just have two version of my site one is design for Flash supported (like Desktop) and the other one is for Mobile devices I just want to know if I can detect and if is true (support) they will stay the same website assuming is http://mywebsite.com but the link will display http://mywebsite.com/?flash=true and if is not support I will redirect them to http://mywebsite.com/?flash=false sorry for the dumb question you don't have to give me an answer but if you can provide me some sort of resource where can I dig the information and study about it myself Thanks. This javascript code fragment

Jquery detect scroll once

回眸只為那壹抹淺笑 提交于 2019-12-05 07:26:36
问题 Have read that it is possible to detect a scroll with this line: $('window').one('scroll', function() { } ); If have this inline code: var TimeVariable=setInterval(function(){ DoJQueryStuff() },300); function DoJQueryStuff() { if(typeof jQuery == "undefined") return; window.clearInterval(TimeVariable); $('body').one('mousemove', function() { alert('mouse'); } ); $('window').one('scroll', function() { alert('scroll'); } ); } DoJQueryStuff is called every 300 ms until JQuery is loaded. If I

Django: Detect database backend

守給你的承諾、 提交于 2019-12-04 22:19:00
I'm doing some "extra" queries in Django that need to work on both sqlite and postgres. The syntax of these queries varies between backend but I have no way of figuring out if I'm sending my queries to either postgres or sqlite. Is there a way to get the current database adapter so I can branch my code and send the right query for the active database server? OK, so there's two ways of doing it, as @Ricola3D said there's the option of checking settings.DATABASES['default']['ENGINE'] : >>> from django.conf import settings >>> settings.DATABASES['default']['ENGINE'] 'django.db.backends.sqlite3'

ACCESS VBA - Obtain Wireless Network Name (Connected)

僤鯓⒐⒋嵵緔 提交于 2019-12-04 13:42:26
Is it possible to detect the users Wifi network (SSID) they are connected to via vba? in Access 2010 Many thanks Max After some more research, I found the following link: http://www.vbforums.com/showthread.php?547916-List-available-wireless-networks-(using-WMI)-Help-pls If you scroll down to post #19 there is a code fragment using Native Wifi API, I adapted to the following code fragment where Function GetConnectedSSID() will return the SSID of the currently connected Wifi network: Option Explicit Private Const DOT11_SSID_MAX_LENGTH As Long = 32 Private Const WLAN_MAX_PHY_TYPE_NUMBER As Long =

How to detect if a user had javascript disabled?

女生的网名这么多〃 提交于 2019-12-04 12:15:04
I was talking with a friend about users who do not have javascript enabled in their browser and what could be done to show them a "no-javascript" version of your website. Is it possible and how can it be done? Thoughts? Don't try to build separate JS and non-JS versions of the site. Build a non-JS version and then enhance it with JS . This makes it easier to reuse code, allows you to use object/feature detection for the entire stack, and makes it less likely that users without JavaScript will be left behind if developers update one branch of the site but not the other. If you mean javascript,

jQuery Detect Bottom of Page on Mobile Safari/iOS

佐手、 提交于 2019-12-04 12:04:01
问题 I basically want the same functionality as facebook, twitter and all those other "infinite" scroll sites work, the code im using at the moment is jQuery(document).ready(function(){ $ = jQuery; $(window).scroll(function(){ if ($('.iosSlider').is(':visible')) { if($(window).scrollTop() + $(window).height() == $(document).height()) { $.get('/our-work/fakework.php', function(data) { $('#mobile-thumbs').append(data); }); } } }); }); This works flawlessly on all desktop browers, and even on my