C++ Cross-Platform High-Resolution Timer

Updated answer for an old question: In C++11 you can portably get to the highest resolution timer with: #include <iostream> #include <chrono> #include “chrono_io” int main() { typedef std::chrono::high_resolution_clock Clock; auto t1 = Clock::now(); auto t2 = Clock::now(); std::cout << t2-t1 << ‘\n’; } Example output: 74 nanoseconds “chrono_io” is an extension to ease I/O … Read more

How to get available memory C++/g++?

On UNIX-like operating systems, there is sysconf. #include <unistd.h> unsigned long long getTotalSystemMemory() { long pages = sysconf(_SC_PHYS_PAGES); long page_size = sysconf(_SC_PAGE_SIZE); return pages * page_size; } On Windows, there is GlobalMemoryStatusEx: #include <windows.h> unsigned long long getTotalSystemMemory() { MEMORYSTATUSEX status; status.dwLength = sizeof(status); GlobalMemoryStatusEx(&status); return status.ullTotalPhys; } So just do some fancy #ifdefs and … Read more

2D Cross-Platform Game Development Engines [closed]

I would recommend V-Play (v-play.net) – it’s a cross-platform game engine based on Qt for iOS, Android, Symbian, MeeGo, Blackberry10 and also can export for native desktop applications for Windows, Mac and Linux. It’s based on C++ but has a neat scripting support for QML & JavaScript. QML is a no-brainer to learn and can … Read more

Possible values from sys.platform?

┍━━━━━━━━━━━━━━━━━━━━━┯━━━━━━━━━━━━━━━━━━━━━┑ │ System │ Value │ ┝━━━━━━━━━━━━━━━━━━━━━┿━━━━━━━━━━━━━━━━━━━━━┥ │ Linux │ linux or linux2 (*) │ │ Windows │ win32 │ │ Windows/Cygwin │ cygwin │ │ Windows/MSYS2 │ msys │ │ Mac OS X │ darwin │ │ OS/2 │ os2 │ │ OS/2 EMX │ os2emx │ │ RiscOS │ riscos │ │ AtheOS … Read more

Python: Platform independent way to modify PATH environment variable

You should be able to modify os.environ. Since os.pathsep is the character to separate different paths, you should use this to append each new path: os.environ[“PATH”] += os.pathsep + path or, if there are several paths to add in a list: os.environ[“PATH”] += os.pathsep + os.pathsep.join(pathlist) As you mentioned, os.path.join can also be used for … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)