portability

How do I get the current user in Perl in a portable way?

喜你入骨 提交于 2019-12-30 05:54:06
问题 How does one get the current user in a portable way? This seems like an FAQ but perlport doesn't speak about it, maybe because some odd systems don't have the concept of "user" to being with? However, let's stick to *nix and Windows. getpwuid($>) is not implemented on Windows. $ENV{USER} || $ENV{USERNAME} seems finicky. http://search.cpan.org didn't turn up much. 回答1: getlogin: This implements the C library function of the same name, which on most systems returns the current login from /etc

Store user settings into application folder

半城伤御伤魂 提交于 2019-12-30 04:33:09
问题 I'm using setting from my C# application like this: String str = Properties.Settings.Default.SETTINGS_NAME; When I save this settings, a settings file is created on C:\Documents and Settings\<user name>\Local Settings\Application Data\<comp name>\Keb.exe_Url_pbs4eg1o2ija22omldrwjxhdam0jxxi5\1.0.0.0\user.config Is there a way to change this path to Application.ExecutablePath\user.config , and use it next time so my application can be more portable ? 回答1: You can control the location of the

How to declare a variable as thread local portably?

雨燕双飞 提交于 2019-12-30 04:11:07
问题 C11 introduces the _Thread_local storage class specifier that can be used in combination with the static and extern storage class specifiers to declare a variable as thread local. The GNU C compiler suite implements a storage class specifier __thread with the same same semantics. Unfortunately I did not find any compiler (I tried gcc, clang and SUN studio) that actually implements the _Thread_local keywords. I currently use the following construct to declare a keyword thread_local : /* gcc

What development tools do you carry on your USB drive? [closed]

梦想与她 提交于 2019-12-29 10:08:31
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I've just bought a new 4GB USB thumb drive and I'm trying to decide what to put on it. I'm thinking about one of the webserver on a

Different int sizes on my computer and Arduino

你。 提交于 2019-12-29 09:04:46
问题 Im working on a sparetime project, making some server code to an Arduino Duemilanove, but before I test this code on the controller I am testing it on my own machine (An OS X based macbook). I am using ints some places, and I am worried that this will bring up strange errors when code is compiled and run on the Arduino Duemilanove because the Arduino handles ints as 2 bytes, and my macbook handles ints as 4 bytes. Im not a hardcore C and C++ programmer, so I am in a bit of worry how an

Different int sizes on my computer and Arduino

只愿长相守 提交于 2019-12-29 09:03:23
问题 Im working on a sparetime project, making some server code to an Arduino Duemilanove, but before I test this code on the controller I am testing it on my own machine (An OS X based macbook). I am using ints some places, and I am worried that this will bring up strange errors when code is compiled and run on the Arduino Duemilanove because the Arduino handles ints as 2 bytes, and my macbook handles ints as 4 bytes. Im not a hardcore C and C++ programmer, so I am in a bit of worry how an

64 bit floating point porting issues

馋奶兔 提交于 2019-12-29 04:29:08
问题 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)

What is portability? How is java more portable than other languages? [closed]

梦想与她 提交于 2019-12-29 02:47:05
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 years ago . I wonder how Java is more portable than C, C++ and .NET and any other language. I have read many times about java being portable due to the interpreter and JVM, but the JVM just hides the architectural differences in the hardware, right? We'd still need different JVMs for different machine architectures. What am

STL containers element destruction order

笑着哭i 提交于 2019-12-28 02:09:04
问题 Does ISO C++ standard mandate any sort of destruction order of objects inside STL containers? Are std::list / std::vector / std::map elements destroyed starting from the beginning or the end of the container? Can I rely on std::map storing its elements in std::pair s internally so a key in a pair is destroyed before its value (or vice versa)? 回答1: Unspecified in the standard. Yes, but this means that the key is destroyed after its associated value. 回答2: Unspecified Yes, you can depend on std:

How to convert a simple .Net console project a into portable exe with Mono and mkbundle?

蓝咒 提交于 2019-12-28 00:52:11
问题 I'd like to convert my simple pure .Net 2.0 console utility into a portable exe which I could just put on an USB stick and run without having to worry whether the CLR and framework libraries are installed on a particular machine or not. Stackoverflow already has some information on using Mono and Mkbundle for creating self-contained Windows exes from .Net-projects, but what I would like to have is a compact but useful HOWTO. What are the minimum steps for achieving a portability from a simple