Javascript: How to detect if a word is highlighted

The easiest way to do this is to detect mouseup and keyup events on the document and check whether any text is selected. The following will work in all major browsers. Example: http://www.jsfiddle.net/timdown/SW54T/ function getSelectedText() { var text = “”; if (typeof window.getSelection != “undefined”) { text = window.getSelection().toString(); } else if (typeof document.selection != … Read more

iOS How to detect iPhone X, iPhone 6 plus, iPhone 6, iPhone 5, iPhone 4 by macro?

Swift import UIKit public enum DisplayType { case unknown case iphone4 case iphone5 case iphone6 case iphone6plus static let iphone7 = iphone6 static let iphone7plus = iphone6plus case iphoneX } public final class Display { class var width:CGFloat { return UIScreen.main.bounds.size.width } class var height:CGFloat { return UIScreen.main.bounds.size.height } class var maxLength:CGFloat { return max(width, … Read more

PHP script – detect whether running under linux or Windows?

Check the value of the PHP_OS constantDocs. It will give you various values on Windows like WIN32, WINNT or Windows. See as well: Possible Values For: PHP_OS and php_unameDocs: if (strtoupper(substr(PHP_OS, 0, 3)) === ‘WIN’) { echo ‘This is a server using Windows!’; } else { echo ‘This is a server not using Windows!’; }

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)