portability

Writing USB Drive Portable Applications in C#

风格不统一 提交于 2019-12-05 05:16:33
One of my favorite things about owning a USB flash storage device is hauling around a bunch of useful tools with me. I'd like to write some tools, and make them work well in this kind of environment. I know C# best, and I'm productive in it, so I could get a windows forms application up in no time that way. But what considerations should I account for in making a portable app? A few I can think of, but don't know answers to: 1) Language portability - Ok, I know that any machine I use it on will require a .NET runtime be installed. But as I only use a few windows machines regularly, this

Python: import _io

寵の児 提交于 2019-12-05 02:53:06
问题 I'm trying to determine which files in the Python library are strictly necessary for my script to run. Right now I'm trying to determine where _io.py is located. In io.py (no underscore), the _io.py module (with underscore) is imported on line 60. 回答1: Some modules are compiled directly into the interpreter -- there are no files corresponding to them. You can retrieve a list of these modules from sys.builtin_module_names. In my Pyton 3.1 installation, _io is included in this list. You might

What's the most cross-platform friendly coding language? [closed]

孤街醉人 提交于 2019-12-05 01:34:32
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 3 months ago . Let's say I want to create FPS game, let's say clone Crysis so everybody understand what type of graphics & performance I'm after. What's the best code to write this game with so it's as easy as possible to port it to all the common platforms? Of course I want the

C++: Is there a standard definition for end-of-line in a multi-line string constant?

拟墨画扇 提交于 2019-12-04 23:37:30
If I have a multi-line string C++11 string constant such as R"""line 1 line 2 line3""" Is it defined what character(s) the line terminator/separator consist of? Keith Thompson The intent is that a newline in a raw string literal maps to a single '\n' character. This intent is not expressed as clearly as it should be, which has led to some confusion. Citations are to the 2011 ISO C++ standard. First, here's the evidence that it maps to a single '\n' character. A note in section 2.14.5 [lex.string] paragraph 4 says: [ Note: A source-file new-line in a raw string literal results in a new-line in

Should enum never be used in an API?

青春壹個敷衍的年華 提交于 2019-12-04 18:03:59
问题 I am using a C library provided to me already compiled. I have limited information on the compiler, version, options, etc., used when compiling the library. The library interface uses enum both in structures that are passed and directly as passed parameters. The question is: how can I assure or establish that when I compile code to use the provided library, that my compiler will use the same size for those enum s? If it does not, the structures won't line up, and the parameter passing may be

What's a portable way of converting Byte-Order of strings in C

僤鯓⒐⒋嵵緔 提交于 2019-12-04 15:36:26
I am trying to write server that will communicate with any standard client that can make socket connections (e.g. telnet client) It started out as an echo server, which of course did not need to worry about network byte ordering. I am familiar with ntohs, ntohl, htons, htonl functions. These would be great by themselves if I were transfering either 16 or 32-bit ints, or if the characters in the string being sent were multiples of 2 or 4 bytes. I'd like create a function that operates on strings such as: str_ntoh(char* net_str, char* host_str, int len) { uint32_t* netp, hostp; netp = (uint32_t*

six.moves.builtins.range is not consistent in Python 2 and Python 3

北慕城南 提交于 2019-12-04 13:08:17
For a very large integer range, xrange (Python 2) should be used, which is renamed to range in Python 3. I assumed module six can provide a consistent why of writing. But I found six.moves.builtins.range returns a list in Python 2 and an iterable non-list object in Python 3, just as the name range does. Also, six.moves.builtins.xrange does not exist in Python 2. Was I using the wrong function in six ? Or does six simply not provide a solution for the range and xrange functions? I know I can test sys.version[0] and rename the function accordingly. I was just looking for a "Don't Repeat Yourself

Are there actual systems where difftime accounts for leap seconds?

天大地大妈咪最大 提交于 2019-12-04 11:43:37
The C standard (ISO/IEC 9899) states: 7.2x.2.2 The difftime function Synopsis #include <time.h> double difftime(time_t time1, time_t time0); Description The difftime function computes the difference between two calendar times: time1 - time0 . Returns The difftime function returns the difference expressed in seconds as a double . This leaves it ambiguous (I guess, intentionally) if the result accounts for leap seconds or not. The difference (26 seconds when comparing from 1970 to July 2015) matters in some applications. Most implementations of the C standard library do not account for leap

Is the .NET string hash function portable? [duplicate]

不问归期 提交于 2019-12-04 10:17:48
问题 This question already has answers here : Closed 8 years ago . Possible Duplicate: How do I create a HashCode in .net (c#) for a string that is safe to store in a database? I use C# 4.0 and gets the string hash by invoking: "my string".GetHashCode() Code generated by this call is stored into database to future use. This hash code is used to find some subset of strings and then to equal comparison. Questions are: Is it a standardized hash calculation? May I assume that it is possible to

Portable way to put stdout in binary mode

大憨熊 提交于 2019-12-04 09:41:26
I'm writing C programs used as cgi's that generate and output gif images. They're used in HTML pages with tags of the form <img src="/cgi-bin/gifprogram.cgi?param=val&etc"> , where the query string params describe the image to be generated by the cgi. C program cgi's invoked like this emit their output to stdout. And in this case the output's a gif image containing lots of binary (non-printable) bytes. That's already working fine on Unix/Linux. But Windows apparently requires a separate non-portable _setmode(_fileno(stdout),_O_BINARY) call (and some Windows-specific #include 's). Otherwise you