portability

64 bit floating point porting issues

泄露秘密 提交于 2019-11-28 22:02:30
I'm porting my application from 32 bit to 64 bit. Currently, the code compiles under both architectures, but the results are different. For various reasons, I'm using floats instead of doubles. I assume that there is some implicit upconverting from float to double happening on one machine and not the other. Is there a way to control for this, or specific gotchas I should be looking for? edited to add: 32 bit platform gcc (GCC) 4.1.2 20070925 (Red Hat 4.1.2-33) Dual-Core AMD Opteron(tm) Processor 2218 HE 64 bit platform gcc (Ubuntu 4.3.3-5ubuntu4) 4.3.3 Intel(R) Xeon(R) CPU Applying the

Portable Programming IDE

落爺英雄遲暮 提交于 2019-11-28 20:49:19
Frequently I'm brainstormed with programming ideas that I would like to directly code. More or less like "Wow, that algorithm will rock! I need to write it now!". For this kind of "impulse" to write, I use http://www.jarte.com/ that is a cool portable text editor. If I'm near a cybecafe or a friend computer, I just plug the usb pen drive and start to write... So, I would like: 1) a portable minimalist IDE 2) with minimal OS requirement (ie.: I want run from XP, Vista, etc...) 3) any modern language (I can learn a new language if needed. I just want write/test the algoritm) 4) Syntax Highlight

How do I type a floating point infinity literal in python

三世轮回 提交于 2019-11-28 19:03:26
How do I type a floating point infinity literal in python? I have heard inf = float('inf') is non portable. Thus, I have had the following recommended: inf = 1e400 Is either of these standard, or portable? What is best practice? In python 2.6 it is portable if the CPU supports it The float() function will now turn the string nan into an IEEE 754 Not A Number value, and +inf and -inf into positive or negative infinity. This works on any platform with IEEE 754 semantics. float('inf') is non portable as in not portable back to Python 2.5 when the string output varies between platforms. From 2.6

MySql portable version

帅比萌擦擦* 提交于 2019-11-28 18:54:16
anyone know a portable version of mysql? I know xampp but it comes with PHP and Apache together anyone know how to isolate the mysql? You can download the MySQL Essentials version and make a few small changes to directories in the my.ini file to use relative paths instead of absolute paths. Then you can run the server directly without having to install or use a Windows service. Download a MySQL .zip file (instead of an .msi , though you could get the .msi and use 7Zip or Orca to extract the files from it). Extract the files. At a minimum you need the bin and share directories (actually, in bin

How portable is mktemp(1)?

南楼画角 提交于 2019-11-28 18:42:01
As the title suggests — can I be reasonably sure that mktemp will exist on any unix-y operating system I'm likely to encounter? Chris Johnsen POSIX does not seem to specify mktemp(1) . It looks like most modern systems have it, but the available functionality and the semantics of the options vary between implementations (so particular invocations may not be portable): mktemp(1) from OpenBSD — mktemp(1) originated in OpenBSD 2.1 mktemp(1) from FreeBSD mktemp(1) from Mac OS X — almost always the same as from FreeBSD mktemp(1) from Todd C. Miller of sudo fame mktemp(1) from Solaris mktemp(1) from

Django: 'current_tags' is not a valid tag library

巧了我就是萌 提交于 2019-11-28 17:18:14
问题 I have a small Django project I received from a friend. The code works perfectly on his system. However, on my system I get the following error message when running the server: TemplateSyntaxError at / 'current_tags' is not a valid tag library: Template library current_tags not found, tried django.templatetags.current_tags The problem is with a line in an html file: {% load current_tags %} This exact same code works on his system with no errors. What could that be? 回答1: I would suggest the

Correct, portable way to interpret buffer as a struct

╄→尐↘猪︶ㄣ 提交于 2019-11-28 17:11:38
问题 The context of my problem is in network programming. Say I want to send messages over the network between two programs. For simplicity, let's say messages look like this, and byte-order is not a concern. I want to find a correct, portable, and efficient way to define these messages as C structures. I know of four approaches to this: explicit casting, casting through a union, copying, and marshaling. struct message { uint16_t logical_id; uint16_t command; }; Explicit Casting: void send_message

What's the best C++ way to multiply unsigned integers modularly safely?

和自甴很熟 提交于 2019-11-28 17:09:41
问题 Let's say that you are using <cstdint> and types like std::uint8_t and std::uint16_t , and want to do operations like += and *= on them. You'd like arithmetic on these numbers to wrap around modularly, like typical in C/C++. This ordinarily works, and you find experimentally works with std::uint8_t , std::uint32_t and std::uint64_t , but not std::uint16_t . Specifically, multiplication with std::uint16_t sometimes fails spectacularly, with optimized builds producing all kinds of weird results

Proper shebang for Python script

江枫思渺然 提交于 2019-11-28 16:10:56
I'm usually using the following shebang declaration in my Python scripts: #!/usr/bin/python Recently, I've came across this shebang declaration: #!/usr/bin/env python In the script documentation, it was noted that using this form is "more portable". What does this declaration mean? How come there's a space in the middle of the path? Does it actually contribute to protability? #!/usr/bin/env python is more portable because in general the program /usr/bin/env can be used to "activate" the desired command without full path. Otherwise, you would have to specify the full path of the Python

Is there any guidance on converting existing .NET class libraries to portable libraries?

别来无恙 提交于 2019-11-28 15:57:55
I have some class libraries with a non-trivial amount of existing code. The class libraries currently target .NET 4.0. Is there any guidance on how to convert these libraries to be portable libraries? From looking at the .csproj, it doesn't appear that there are a lot of differences: <Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" /> and <ProjectTypeGuids>{786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids> Is it a good or bad idea to try converting an existing class library