platform-detection

Detecting Windows or Linux? [duplicate]

元气小坏坏 提交于 2020-01-11 14:52:12
问题 This question already has answers here : How do I programmatically determine operating system in Java? (20 answers) Closed 4 years ago . I am seeking to run a common Java program in both Windows and Linux. The program needs to do some things differently on each platform. So how can / should my Java program detect it is running under Linux vs. Windows? 回答1: apache commons lang has a class SystemUtils.java you can use : SystemUtils.IS_OS_LINUX SystemUtils.IS_OS_WINDOWS 回答2: Try: System

Detect different device platforms using CSS

痞子三分冷 提交于 2019-12-17 10:26:11
问题 I'd like to say that I have read and tried many variations of the instructions here: http://www.cloudfour.com/ipad-css/ Detect iPhone/iPad purely by css Detect Xoom browser (Android) http://www.w3.org/TR/css3-mediaqueries/ http://www.w3schools.com/html5/att_link_media.asp http://en.wikipedia.org/wiki/List_of_Android_devices http://en.wikipedia.org/wiki/File:Vector_Video_Standards2.svg I would like to have my page use different CSS files depending on the device being used. I have seen many

Detecting the platform (Window or Linux) by Groovy/Grails

瘦欲@ 提交于 2019-12-05 08:40:27
问题 Is there a way to detect the platform (Window / Linux) in which the website is running by Groovy / Grails? 回答1: System.properties['os.name'] will return the name of the OS, e.g. "Windows XP". So if you want to figure out whether you're running on Windows or not, you could do something like: if (System.properties['os.name'].toLowerCase().contains('windows')) { println "it's Windows" } else { println "it's not Windows" } Alternatively, org.apache.commons.lang.SystemUtils (from the Apache

Detecting the platform (Window or Linux) by groovy/grails

人走茶凉 提交于 2019-12-03 22:07:37
Is there a way to detect the platform (Window / Linux) in which the website is running by Groovy / Grails? Dónal System.properties['os.name'] will return the name of the OS, e.g. "Windows XP". So if you want to figure out whether you're running on Windows or not, you could do something like: if (System.properties['os.name'].toLowerCase().contains('windows')) { println "it's Windows" } else { println "it's not Windows" } Alternatively, org.apache.commons.lang.SystemUtils (from the Apache commons-lang project) exposes some boolean constants that provide the same information as the code above, e

Reliably detect Windows in Python

徘徊边缘 提交于 2019-11-28 16:14:09
问题 I'm working on a couple of Linux tools and need to prevent installation on Windows, since it depends on FHS and is thus rendered useless on that platform. The platform.platform function comes close but only returns a string. Unfortunately I don't know what to search for in that string for it to yield a reliable result. Does anyone know what to search for or does anyone know of another function that I'm missing here? 回答1: >>> import platform >>> platform.system() 'Windows' 回答2: For those that

Detect different device platforms using CSS

隐身守侯 提交于 2019-11-27 11:30:28
I'd like to say that I have read and tried many variations of the instructions here: http://www.cloudfour.com/ipad-css/ Detect iPhone/iPad purely by css Detect Xoom browser (Android) http://www.w3.org/TR/css3-mediaqueries/ http://www.w3schools.com/html5/att_link_media.asp http://en.wikipedia.org/wiki/List_of_Android_devices http://en.wikipedia.org/wiki/File:Vector_Video_Standards2.svg I would like to have my page use different CSS files depending on the device being used. I have seen many solutions to this, all using some form of the above. However, when testing on an HTC Desire I consistently

How to detect Windows 64-bit platform with .NET?

十年热恋 提交于 2019-11-26 03:13:30
问题 In a .NET 2.0 C# application I use the following code to detect the operating system platform: string os_platform = System.Environment.OSVersion.Platform.ToString(); This returns \"Win32NT\". The problem is that it returns \"Win32NT\" even when running on Windows Vista 64-bit. Is there any other method to know the correct platform (32 or 64 bit)? Note that it should also detect 64 bit when run as a 32 bit application on Windows 64 bit. 回答1: IntPtr.Size won't return the correct value if

Detecting a mobile browser

我只是一个虾纸丫 提交于 2019-11-25 22:52:53
问题 I\'m looking for a function which return boolean value if user has mobile browser or not. I know that I can use navigator.userAgent and write that function by using regex, but user-agents are too various for different platforms. I doubt that match all possible devices would be easy, and I think this problem has been solved before many times so there should be some kind of complete solution for such task. I was looking at this site, but sadly the script is so cryptic that I have no idea how to