portability

How to avoid SQL Server error on ORDER BY with duplicate columns

半腔热情 提交于 2019-12-11 07:36:43
问题 Although this question references PHP, it is not actually PHP-specific, so I have not flagged it as such. We have a PHP framework which supports multiple DB back-ends. There is a generic function in our data object class, which allows you to get records from the underlying table, with a specified criteria and sort order. It looks something like this: function GetAll($Criteria, $OrderBy = "") { ... // Add primary key (column 1) to end of order by list, // so that returned order is predictable.

Portable way in c++ to get the routing table

我们两清 提交于 2019-12-11 04:33:09
问题 I need to get the routing table for a machine in a portable fashion. I'm using C++ and the Boost library is already available if that helps. No calling external commands like "route" because that isn't portable and the external command may not be available. 回答1: Certainly calling route isn't advisable as forking and executing is rarely the way. Unfortunately, I can tell you [as the founder of the Net-SNMP project, where we report routes for many many platforms in C], there is no platform

Safe assumption regarding size and alignment of datatypes on different platforms?

扶醉桌前 提交于 2019-12-11 03:56:53
问题 Let's say I will only be using types with explicit width, e.g. no int but int32, uint16, etc... is it safe to assume that: A byte will always take 8 bits and will be 8 bit aligned A short will always take 16 bits and will be 16 bit aligned An int will always take 32 bits and will be 32 bit aligned A long int will always take 64 bits and will be 64 bit aligned A float will always take 32 bits and will be 32 bit aligned A double will always take 64 bits and will be 64 bit aligned --- and also

Java application that can run entirely from a DVD

霸气de小男生 提交于 2019-12-11 03:27:04
问题 I have to create a java application that can run entirely from a DVD. The application must connect with a database that will be also on the DVD. I was thinking to use an embedded database but i dont know much about them. Do i have to start the database server from my java application and if i do, how should i do it? Thanks in advance. Nick Tsilivis 回答1: You can use SQLite which is a very light weighted version of SQL. It stores its data in a single file. You even don't have to log in with an

Character strings in Fortran: Portable LEN_TRIM and LNBLNK?

断了今生、忘了曾经 提交于 2019-12-11 02:14:27
问题 I need a portable function/subroutine to locate the position of the last non-blank character in a string . I've found two options: LEN_TRIM and LNBLNK . However, different compilers seem to have different standards. The official documentation for the following compilers suggests that LEN_TRIM is part of the Fortran 95 standard on the following platforms: IBM: LEN_TRIM Intel: LNBLNK and LEN_TRIM gfortran: LNBLNK and LEN_TRIM PGI: LEN_TRIM However, it appears that nothing is guaranteed on

How to install pyInstaller with Portable Python and Movable Python

时光总嘲笑我的痴心妄想 提交于 2019-12-11 01:27:27
问题 Portable Python and Movable Python allow programming python without installing anythin, just by unpacking something. :-) I'd like also to be able to create standalone executable from my scripts, nut I can't tie pyInstaller to these packages, as pyInstaller requires pyWin32, but pyWin32 relies on python registry signatures, and I have not them as I'm using portable version of python! Any workaround? By unpacking pywin32 executable ( pywin32-217.win32-py2.7.exe) I get two folders, PLATLIB and

Does the C99 standard guaranteed the binary representation of unsigned int?

本小妞迷上赌 提交于 2019-12-10 21:54:19
问题 C99 (ISO/IEC 9899:1999) 6.2.6.2/1 Integer types The values of any padding bits are unspecified. 45) A valid (non-trap) object representation of a signed integer type where the sign bit is zero is a valid object representation of the corresponding unsigned type, and shall represent the same value. For any integer type, the object representation where all the bits are zero shall be a representation of the value zero in that type. In the C99 standard, an integer type where all the bits are zero

safe way of allocating memory for a list node

冷暖自知 提交于 2019-12-10 17:54:51
问题 In a simple list, ex : struct Node { Node *next; void *data; } is there any problem if i allocate Node and Data in a single allocation (provided i know the size), like Node * t = (Node*)malloc(sizeof(Node) + DataSize)); and always assign data at the end of allocated chunk, t->data = (BYTE*)t+ sizeof(Node); /* BYTE is byte length, can use char in gcc */ Node and data will get deleted in a sinlge go, so there no real problem tighlty coupling them (by design ) I am looking at Portability issues

What platforms offer SystemRandom?

故事扮演 提交于 2019-12-10 16:17:46
问题 Python's random.SystemRandom provides cryptographic-quality pseudorandom numbers. What platforms is it supported on? Most importantly, are there any platforms that it is not supported on, and if so, which ones? Can anyone provide any information about how portable it is? 回答1: From http://docs.python.org/library/random.html The random module also provides the SystemRandom class which uses the system function os.urandom() to generate random numbers from sources provided by the operating system.

how to make portable regex?

為{幸葍}努か 提交于 2019-12-10 15:39:37
问题 Which features of regular expressions are standard, and which are idiosyncratic ? What should I do, and not do, if I want to use the same regex in different context, languages, platforms ? 回答1: There is no standard, but if maximum portability is your goal you should stick to the features supported by JavaScript regexes. All of the other major flavors support everything JS does, with only minor variations here and there. For example, some only support the POSIX character-class notation ( [