cross-platform

Is there a 128 bit integer in C++?

百般思念 提交于 2019-12-17 10:56:28
问题 I need to store a 128 bits long UUID in a variable. Is there a 128-bit datatype in C++? I do not need arithmetic operations, I just want to easily store and read the value very fast. A new feature from C++11 would be fine, too. 回答1: GCC and Clang support __int128 回答2: Although GCC does provide __int128 , it is supported only for targets (processors) which have an integer mode wide enough to hold 128 bits. On a given system, sizeof() intmax_t and uintmax_t determine the maximum value that the

How to use node-set function in a platform-independent way?

房东的猫 提交于 2019-12-17 09:58:43
问题 I'm writing some xlst file which I want to use under linux and Windows. In this file I use node-set function which declared in different namespaces for MSXML and xsltproc ("urn:schemas-microsoft-com:xslt" and "http://exslt.org/common" respectively). Is there any platform independent way of using node-set? 回答1: You can use the function function-available() to determine which function you should use: <xsl:choose> <xsl:when test="function-available('exslt:node-set')"> <xsl:apply-templates select

How to do system short cuts cross platform integration in Java?

一世执手 提交于 2019-12-17 09:57:31
问题 As you may know, the short-cuts of save in Mac OS X is Cmd+S on Windows is Ctrl+S , and the short cuts of close an application is Cmd+Q and Windows is Alt + F4 . But the question is how to do these in a java application? Do I need to find all the short cuts I used in the application, and match the related function depends on different OSs. Any recommendations? Thanks. 回答1: The Toolkit method getMenuShortcutKeyMask() is useful in this context. While the method returns Event.CTRL_MASK on

Why does the calculated width and height in pixel of a string in Tkinter differ between platforms?

一个人想着一个人 提交于 2019-12-17 09:41:28
问题 I have a Python script which needs to calculate the exact size of arbitrary strings displayed in arbitrary fonts in order to generate simple diagrams. I can easily do it with Tkinter. import Tkinter as tk import tkFont root = tk.Tk() canvas = tk.Canvas(root, width=300, height=200) canvas.pack() (x,y) = (5,5) text = "yellow world" fonts = [] for (family,size) in [("times",12),("times",24)]: font = tkFont.Font(family=family, size=size) (w,h) = (font.measure(text),font.metrics("linespace"))

.Net (dotNet) wrappers for OpenCV? [closed]

两盒软妹~` 提交于 2019-12-17 06:25:38
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I've seen there are a few of them. opencvdotnet, SharperCV, EmguCV, One on Code Project. Does anyone have any experience with any of these? I played around with the one on Code Project for a bit, but as soon as I tried to do anything complicated I got some nasty uncatchable exceptions (i.e. Msgbox exceptions).

How do I compile a .java with support for older versions of Java?

怎甘沉沦 提交于 2019-12-17 04:30:27
问题 I want to compile my .java's (several) into one .jar that are compatible with at least Java 1.6 and newer, preferably Java 1.5 and newer versions of Java. (I have Java 1.7.0_5 ) 回答1: Yes, you can set the version of compiler at compile time. And compile your java code into old versions of java. From Oracle article : http://docs.oracle.com/javase/1.5.0/docs/tooldocs/windows/javac.html Cross-Compilation Example Here we use javac to compile code that will run on a 1.4 VM. % javac -target 1.4

Possible values from sys.platform?

怎甘沉沦 提交于 2019-12-17 04:27:53
问题 What are the possible return values from the following command? import sys print sys.platform I know there is a lot of possibilities, so I'm mainly interested in the "main" ones (Windows, Linux, Mac OS) 回答1: ┍━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━┑ │ System │ Value │ ┝━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━┥ │ Linux │ linux or linux2 (*) │ │ Windows │ win32 │ │ Windows/Cygwin │ cygwin │ │ Windows/MSYS2 │ msys │ │ Mac OS X │ darwin │ │ OS/2 │ os2 │ │ OS/2 EMX │ os2emx │ │ RiscOS │

PHP Echo Line Breaks

北战南征 提交于 2019-12-17 03:36:07
问题 What's the difference between \n and \r (I know it has something to do with OS), and what's the best way to echo a line break that will work cross platform? EDIT: In response to Jarod, I'll be using ths to echo a line break in a .txt log file, though I'm sure I'll be using it in the future for things such as echoing HTML makup onto a page. 回答1: \n is a Linux/Unix line break. \r is a classic Mac OS (non-OS X) line break. Mac OS X uses the above unix \n . \r\n is a Windows line break. I usually

Platform independent paths in Java

流过昼夜 提交于 2019-12-17 02:33:27
问题 I know the relative path of a file and want to handle it as a File object on both Linux and Windows. What is the best way to specify platform-independent paths in Java? 回答1: The File class contains the following public members that you can use for platform specific file paths: static String pathSeparator : The system-dependent path-separator character, represented as a string for convenience. static char pathSeparatorChar : The system-dependent path-separator character. static String

Difference between “\n” and Environment.NewLine

最后都变了- 提交于 2019-12-17 01:43:26
问题 What is the difference between two, if any (with respect to .Net)? 回答1: Depends on the platform. On Windows it is actually "\r\n". From MSDN: A string containing "\r\n" for non-Unix platforms, or a string containing "\n" for Unix platforms. 回答2: Exact implementation of Environment.NewLine from the source code: The implementation in .NET 4.6.1: /*===================================NewLine==================================== **Action: A property which returns the appropriate newline string for