portability

How to deal with the most common classes missing on J2ME

馋奶兔 提交于 2019-11-30 05:01:07
I'm trying to code an application which runs un different java platforms like J2SE, J2ME, Android, etc. I already know that I'll have to rewrite most of the UI for each platform, but want to reuse the core logic. Keeping this core portable involves three drawbacks that I know of: Keeping to the old Java 1.4 syntax , not using any of the nice language features of Java 5.0 only using external libraries that are known to work on those platforms (that is: don't use JNI and don't have dependencies to other libs which violate this rules) only using the classes which are present on all those

How portable is using the low bit of a pointer as a flag?

风流意气都作罢 提交于 2019-11-30 04:51:55
If there is for example a class that requires a pointer and a bool . For simplicity an int pointer will be used in examples, but the pointer type is irrelevant as long as it points to something whose size() is more than 1 . Defining the class with { bool , int *} data members will result in the class having a size that is double the size of the pointer and a lot of wasted space If the pointer does not point to a char (or other data of size(1) ), then presumably the low bit will always be zero. The class could defined with {int *} or for convenience: union { int *, uintptr_t } The bool is

GetThreadId on pre-vista systems?

心不动则不痛 提交于 2019-11-30 03:55:36
问题 Apperantly, GetThreadId is a Vista API. How can I get a thread's id on pre vista systems? 回答1: There are a few options: When you call CreateThread, you get the handle back. You can call GetCurrentThreadId to get the current thread's ID. You can use Thread32First/Thread32Next to enumerate threads. 回答2: If you can somehow make the thread in question call GetCurrentThreadId and store it somewhere, you could read the result. 回答3: If the thread in question enters an alertable wait state frequently

What is meant when a piece of code is said to be portable? [closed]

為{幸葍}努か 提交于 2019-11-30 03:54:16
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 7 years ago . I have seen in many documentations that a piece of code is portable . Can anyone explain to me exactly what it means to call a piece of code portable? 回答1: Portable code is code that is not tightly coupled to one

Writing a portable C program - which things to consider?

空扰寡人 提交于 2019-11-30 03:39:03
For a project at university I need to extend an existing C application, which shall in the end run on a wide variety of commercial and non-commercial unix systems (FreeBSD, Solaris, AIX, etc.). Which things do I have to consider when I want to write a C program which is most portable? The best advice I can give, is to move to a different platform every day, testing as you go. This will make the platform differences stick out like a sore thumb, and teach you the portability issues at the same time. Saving the cross platform testing for the end, will lead to failure. That aside Integer sizes can

Unix paths that work for any platform in Python?

流过昼夜 提交于 2019-11-30 02:40:30
问题 Can all paths in a Python program use ".." (for the parent directory) and / (for separating path components), and still work whatever the platform ? On one hand, I have never seen such a claim in the documentation (I may have missed it), and the os and os.path modules do provide facilities for handling paths in a platform agnostic way (os.pardir, os.path.join,…), which lets me think that they are here for a reason. On the other hand, you can read on StackOverflow that "../path/to/file" works

Reproducibility of java pseudo-random numbers across systems and versions?

删除回忆录丶 提交于 2019-11-30 02:12:41
问题 I need to generate a controlled sequence of pseudo-random numbers, given an initial integer parameter. For that I'm using the standard Java Random class, seeded by an integer parameter. I'd like to make sure that I will generate the same sequence across systems (Operating system, but also Java/JDK version), in the foreseeable future (and more!). In summary: Does Java ensure the reproducibility / portability of it's pseudo-random number generator across implementation and versions ? Note: I've

Packaging Ruby into a portable executable

青春壹個敷衍的年華 提交于 2019-11-30 01:21:54
I have been trying to find a good solution to this for a long time: Is there a sure-fire way to install ruby to a folder which is portable on that platform? I want to have a folder which I can easily copy into a distribution I am making so I can have a ruby environment "on the go". It is fine if I need to compile the source and stuff, as long as I end up with a portable ruby install. I have found a few resources which tries to solve this, but none are satisfactory for me. Portable Ruby on Rails environment http://hcettech.blogspot.pt/2012/05/windows-portable-rails-development.html For me this

Portable C++ build system [closed]

╄→尐↘猪︶ㄣ 提交于 2019-11-29 22:58:44
I'm looking for a good and easy in maintenance portable build system for C++ projects. Main platforms should include Windows (Visual Studio 8+) and Linux (gcc); Cygwin may be an advantage. We're considering two main possibilities: CMake and Boost.Jam . SCons can be also an option, but I haven't investigated it yet. CMake and Boost.Jam seem to have the following traits: CMake: (+) generates native "makefile" (solution for Windows, project for Eclipse) (+) extensions for testing and packaging (-) demands a configuration file in every project folder (-) based on a little too verbose peculiar

Django: 'current_tags' is not a valid tag library

女生的网名这么多〃 提交于 2019-11-29 21:58:48
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? mif I would suggest the following: (Most likely) You haven't installed one of the dependencies of your tag library. Check the