portability

How to ignore GUI as much as possible without rendering APP less GUI developer friendly

The substance of an app is more important to me than its apperance, yet GUI always seems to dominate a disproportionate percentage of programmer time, development and target resource requirements/constraints. Ideally I'd like an application architecture that will permit me to develop an app using a lightweight reference GUI/kit and foc...

Portable way of counting milliseconds in C++ ?

Hi, Is there any portable (Windows & Linux) way of counting how many milliseconds elapsed between two calls ? Basically, I want to achieve the same functionnality than the StopWatch class of .NET. (for those who already used it) In a perfect world, I would have used boost::date_time but that's not an option here due to some silly rule...

Is there any "standard" htonl-like function for 64 bits integers in C++ ?

Hi, I'm working on an implementation of the memcache protocol which, at some points, uses 64 bits integer values. These values must be stored in "network byte order". I wish there was some uint64_t htonll(uint64_t value) function to do the change, but unfortunately, if it exist, I couldn't find it. So I have 1 or 2 questions: Is the...

Making Postgres SQL minimal size. How?

I want to cut Postgres to its minimal size for purpose of including just database function with my application. I'm using Portable Postgres found on internet. Any suggestions what I can delete from Postgres installation which is not needed for normal database use? ...

Can you run a function on initialization in c?

Is there an mechanism or trick to run a function when a program loads? What I'm trying to achieve... void foo(void) { } register_function(foo); but obviously register_function won't run. so a trick in C++ is to use initialization to make a function run something like int throwaway = register_function(foo); but that doesn't wo...

Portable version of pyCrypto? - Python

Hi folks, does a portable version of pyCrypto exist? would one be easy to create? Help would be awesome! ...

How to write portable code in c++?

What are the things that I should keep in mind to write portable code? Since I'm a c++ beginner, I want to practice it since beginning. Thanks. ...

How to get a large integer as input and store it in memory

I know that performing arithmetic on large integers in brainfuck, while perhaps quite tedious at times, is entirely possible. However what I'm wondering about is what the generally acceptd best-practices are for taking in large integers (or even strings, I suppose) as input. Most compilers/interpreters allow you to provide full strings...

In C/C++, are volatile variables guaranteed to have eventually consistent semantics betwen threads?

Is there any guarantee by any commonly followed standard (ISO C or C++, or any of the POSIX/SUS specifications) that a variable (perhaps marked volatile), not guarded by a mutex, that is being accessed by multiple threads will become eventually consistent if it is assigned to? To provide a specific example, consider two threads sharing ...

What features of C++ are not compatible with compilers other than Visual Studio?

I was told to avoid using features of C++ like these as it makes it difficult to port the code to other compilers. The example I was given was using #ifdef instead of #pragma once in my header files. ...

Multithreading in C++ ... where to start?

I'd like to start learning multithreading in C++. I'm learning it in Java as well. In Java, if I write a program which uses multithreading, it will work anywhere. However in C++, doesn't multithreading rely on platform-specific API's? If so, that would seem to get in the way of portability. How can I do multithreading in C++ without cau...

How Do I Install Ruby Gems on a USB Stick

How would one install rubygems on a usb stick so that it would work like it would normally, but all files go on the stick? I have no experience at all with rubygems and have no idea of its inner workings, so please, go easy on me! Thanks in advance, ell. Edit: Basically, so it is entirely portable! ...

C++ count time overcoming 72 minutes range of clock_t

Hello, I'm trying to count the execution time of part of my application, but since I need to get milliseconds, and I need to get long execution times too. I'm currently using clock_t = clock() from ctime, but it has a range of only 72 minutes I think, which is not suitable for my needs. Is there any other portable way to count large exec...

How can we check that a binary EXE (PE) is COM Exe or Win32 Exe?

I need to check programatically whether a given EXE binary is a COM EXE or Win32 EXE. Is there any way to do this? Is the Import Table an answer to this? If somehow I can determine this from the registry, where in the registry should I look to find out if a binary is regsitered for COM? (This is specific to EXEs, as DLLs are not a proble...

Portable code for deprecated userInfo dictionary key (Cocoa)

In Mac OSX 10.6, the NSErrorFailingURLStringKey userInfo dictionary key is deprecated in favor of NSURLErrorFailingURLStringErrorKey. I am trying to write my program to be portable to both Mac OSX 10.5 and 10.6. For the time being, I'm just using the old key--but my compiler is giving me annoying deprecated warnings. // The following ca...

String manipulation & memory allocation - C

I am in the process of learning C. I have a method that takes 3 strings and combines them to do some operation. Following was my first implementation using a GCC compiler. void foo(const char *p1, const char *p2, const char *p3) { size_t length = strlen(p1) + strlen(p2) + strlen(p3); char combined[length + 1]; memset(combin...

Using Hibernate with RCP and PostgreSQL

Our team is building an RCP application using PostgreSQL for DB. We are evaluating the usage of Hibernate. Our project has the following constraints : 1) The project is a small extract-and-run-in-any-system type RCP application which is mostly used by non-technical users with a minimum setup needed. The application should have a low mem...

Cross-platform way of constructing an FS path with Qt

Hello, 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 s...

Are these C #ifdefs for portability outdated?

Hi, I'm working with an old C code that still has a few dusty corners. I'm finding a lot of #ifdef statements around that refer to operating systems, architectures, etc. and alter the code for portability. I don't know how many of these statements are still relevant today. I know that #ifdef isn't the best idea in certain circumstance...

Explain boost::filesystem's portable generic path format in C++

I am trying to understand portable generic path format and everything is not clicking. Can someone please explain this in terms of examples? I also have been told that I can use the forward slash in windows because windows understands both. Also is it considered good/safe style to use forward slash in windows? ...