portability

How do you deal with Internet Explorer?

拟墨画扇 提交于 2019-11-28 15:28:54
I am aware that there are probably other questions regarding this topic. I guess that every web developer goes through this with IE. My problem: I am developing a web-based application fully based on Javascript. I am a Mac user. I was really happy that everything worked great in Safari, Firefox and Opera. I then asked a friend with Windows to check it with Internet Explorer, and things don't work as well. My application is very sensitive to the HTML standards. The main problem is the CSS layout. The JavaScript itself seems to be working properly thanks to jQuery for portability. My question:

Byte precision pointer arithmetic in C when sizeof(char) != 1

久未见 提交于 2019-11-28 13:05:40
How can one portably perform pointer arithmetic with single byte precision? Keep in mind that: char is not 1 byte on all platforms sizeof(void) == 1 is only available as an extension in GCC While some platforms may have pointer deref pointer alignment restrictions, arithmetic may still require a finer granularity than the size of the smallest fundamental POD type Your assumption is flawed - sizeof(char) is defined to be 1 everywhere. From the C99 standard (TC3) , in section 6.5.3.4 ("The sizeof operator"): (paragraph 2) The sizeof operator yields the size (in bytes) of its operand, which may

PHP - Shorter Magic Quotes Solution

天大地大妈咪最大 提交于 2019-11-28 12:22:39
问题 I'm writing a app that needs to be portable. I know I should disable magic quotes on the PHP configuration but in this case I don't know if I can do that, so I'm using the following code: if (get_magic_quotes_gpc() === 1) { $process = array(&$_GET, &$_POST, &$_COOKIE, &$_REQUEST); while (list($key, $val) = each($process)) { foreach ($val as $k => $v) { unset($process[$key][$k]); if (is_array($v)) { $process[$key][stripslashes($k)] = $v; $process[] = &$process[$key][stripslashes($k)]; } else {

How portable is the re-entrant qsort_r function compared to qsort?

蹲街弑〆低调 提交于 2019-11-28 12:08:48
qsort_r() is the re-entrant version of qsort() which takes an additional 'thunk' argument and passes it into the compare function and I'd like to be able to use it in portable C code. qsort() is POSIX and everywhere but qsort_r() seems to be a BSD extension. As a specific question, does this exist or have an equivalent in the Windows C runtime? I've attempted to write a portable version of qsort_r / qsort_s (called sort_r) shown with an example. I've also put this code in a git repo ( https://github.com/noporpoise/sort_r ) struct sort_r_data { void *arg; int (*compar)(const void *a1, const

Cross-platform way of constructing an FS path with Qt [duplicate]

扶醉桌前 提交于 2019-11-28 11:54:28
Possible Duplicate: Qt equivalent of PathAppend? Short story: does Qt 4 have an analog of Python's os.path.join ? Long story: I need to add a relative path to the application directory, QCoreApplication::applicationDirPath() in the Right Way (TM), so that the code doesn't depend on the file system directory separator character. Is merely joining QStrings and using "/" as the separator a good solution? Adam W You can either use "/" directly or use QDir::separator() . But in general use a QDir for this (which translates "/" to the platform specific path separator for you). liaK From Qt 4.6 QDir

What is fadvise/madvise equivalent on windows?

亡梦爱人 提交于 2019-11-28 11:10:28
On UNIX, I can, for example, tell the OS that the mapping will be needed in the future with posix_fadvise(POSIX_FADV_WILLNEED) . It will then read-ahead the data if it feels so. How to tell the access intend to Windows ? Steve Schnepp Actually, as Anders mostly suggested, there is no such method in the memory management functions available in Windows 7 and earlier . 2 different ways exists to do something similar : Read the data asynchronously with ReadFileEx . The data might then still be in the file cache when needed later. Open the file with a streaming hint with the FILE_FLAG_SEQUENTIAL

How to make designer generated .Net application settings portable

╄→гoц情女王★ 提交于 2019-11-28 10:26:05
I've been looking at modifying the source of the Doppler podcast aggregator with the goal of being able to run the program directly from my mp3 player. Doppler stores application settings using a Visual Studio designer generated Settings class , which by default serializes user settings to the user's home directory. I'd like to change this so that all settings would be stored in the same directory as the exe. It seems that this would be possible by creating a custom provider class which inherits the SettingsProvider class. Has anyone created such a provider and would like to share code? Update

Fixed-width integers in C++

馋奶兔 提交于 2019-11-28 09:44:30
Occasionally I need to use fixed-width integers for communication with external devices like PLCs. I also use them to define bitmasks and perform bit manipulation of image data. AFAIK the C99 standard defines fixed-width integers like int16_t. However the compiler I use, VC++ 2008 doesn't support C99 and AFAIK Microsoft is not planning to support it. My question is what is the best practice for using fixed-width integers in C++? I know that VC++ defines non-standard fixed-width integers like __int16, but I am hesitant to use a non-standard type. Will the next C++ standard define fixed-width

Android & iOS: How to develop for both?

Deadly 提交于 2019-11-28 09:42:54
I want to develop an application for both android and iOS devices. Is there a way to develop the application once and deploy on both? Or is it a must to develop for each platform separately? If you want applications that provide a native experience, then you will have to write separate applications. I think the best place to start is with a really nice web version optimized for mobile browsers. I think the nicest web apps are better than a lot of the native apps, but they aren't competitive with the better native apps. There are also a couple of options like Titanium or PhoneGap , which are

Portable json module in jython

江枫思渺然 提交于 2019-11-28 08:52:01
问题 I am making a python script with jython and I need to use the json module that dosent exist in jython 2.5 . Do any of you guys know a way to include a module as a single file that can be moved around with the script without installing it on the host's jython . I was planning on using the simple json module i found on pypi If it helps. 回答1: Try http://opensource.xhaus.com/projects/jyson A fast JSON codec for jython 2.5, written in java. 回答2: Jython 2.7.0 now includes the standard library json