cross-platform

How to choose the location of a log file for a Java application in a platform independent way?

痞子三分冷 提交于 2020-01-24 22:54:09
问题 I'm writing a java application. Currently this produces a file called "trace.txt" in the same directory the .jar file lives. This can sometimes cause issue with file permissions, eg writing to C:\Program Files\Foo\trace.txt. After a bit of research on SO it seems the general opinion is to log to Application Data\Foo\ for the given user. This won't be the same location for other OS's. What's the best practice in this situation? I'm using java.util.logging. 回答1: You could always use the USER

How to add qt resources to android APK file?

。_饼干妹妹 提交于 2020-01-24 21:42:13
问题 I'm porting a small Qt application to the Android . I am using Qt Creator . I have a resource file with some images. The question is how to add these files to the android APK package . Another question is how to access them from Qt ? Can I use something like: QIcon actions_ok = QIcon(RES_PATH + "check.png")? 回答1: You'll need to add the images to your assets folder, and then access them using the following URI: file:///android_asset/check.png 来源: https://stackoverflow.com/questions/11071161

Check if a system implements a function

自闭症网瘾萝莉.ら 提交于 2020-01-24 02:27:07
问题 I'm creating a cross-system application. It uses, for example, the function itoa , which is implemented on some systems but not all. If I simply provide my own itoa implementation: header.h:115:13: error: conflicting types for 'itoa' extern void itoa(int, char[]); In file included from header.h:2:0, from file.c:2:0, c:\path\to\mingw\include\stdlib.h:631:40: note: previous declaration of 'itoa' was here _CRTIMP __cdecl __MINGW_NOTHROW char* itoa (int, char*, int); I know I can check if macros

Steps to enable and use iconv on Windows with Indy 10.5.9

廉价感情. 提交于 2020-01-23 03:35:32
问题 For cross-platform development with Internet Direct (Indy), it can be useful to enable iconv support instead of the OS-specific Windows character conversions. This would allow to continue developing and testing code on Windows in the Delphi IDE, but still be able to find conversion related issues before compiling the code on a different platform. Indy 10 already includes code to use the iconv API on Linux and Windows. On Windows, some preparation is required: copy the iconv API DLL to the app

Cross-platform way of getting temp directory in Python

自作多情 提交于 2020-01-22 04:04:30
问题 Is there a cross-platform way of getting the path to the temp directory in Python 2.6? For example, under Linux that would be /tmp , while under XP C:\Documents and settings\[user]\Application settings\Temp . 回答1: That would be the tempfile module. It has functions to get the temporary directory, and also has some shortcuts to create temporary files and directories in it, either named or unnamed. Example: import tempfile print tempfile.gettempdir() # prints the current temporary directory f =

Recommend some Bresenham's-like algorithm of sphere mapping in 2D?

主宰稳场 提交于 2020-01-21 13:59:05
问题 I need the fastest sphere mapping algorithm. Something like Bresenham's line drawing one. Something like the implementation that I saw in Star Control 2 (rotating planets). Are there any already invented and/or implemented techniques for this? I really don't want to reinvent the bicycle. Please, help... Description of the problem. I have a place on the 2D surface where the sphere has to appear. Sphere (let it be an Earth) has to be textured with fine map and has to have an ability to scale

Recommend some Bresenham's-like algorithm of sphere mapping in 2D?

喜欢而已 提交于 2020-01-21 13:58:10
问题 I need the fastest sphere mapping algorithm. Something like Bresenham's line drawing one. Something like the implementation that I saw in Star Control 2 (rotating planets). Are there any already invented and/or implemented techniques for this? I really don't want to reinvent the bicycle. Please, help... Description of the problem. I have a place on the 2D surface where the sphere has to appear. Sphere (let it be an Earth) has to be textured with fine map and has to have an ability to scale

Recommend some Bresenham's-like algorithm of sphere mapping in 2D?

筅森魡賤 提交于 2020-01-21 13:57:30
问题 I need the fastest sphere mapping algorithm. Something like Bresenham's line drawing one. Something like the implementation that I saw in Star Control 2 (rotating planets). Are there any already invented and/or implemented techniques for this? I really don't want to reinvent the bicycle. Please, help... Description of the problem. I have a place on the 2D surface where the sphere has to appear. Sphere (let it be an Earth) has to be textured with fine map and has to have an ability to scale

How to write a cross-platform program?

左心房为你撑大大i 提交于 2020-01-20 19:16:10
问题 Greetings, I want to write a small cross-platform utility program with GUI in it. What language/GUI-library should I stick to? Is it possible whatsoever? This is gonna be a small program, so I don't want to make people download JVM or .NET Framework. Is it possible to develop it natively? Update 1. By "natively" I mean that the end result will be native code without intermediate layers like Java Virtual Machine or .NET Common Language Runtime Update 2. A FREE solution is preferable ;) 回答1: If

How to write a cross-platform program?

自闭症网瘾萝莉.ら 提交于 2020-01-20 19:15:09
问题 Greetings, I want to write a small cross-platform utility program with GUI in it. What language/GUI-library should I stick to? Is it possible whatsoever? This is gonna be a small program, so I don't want to make people download JVM or .NET Framework. Is it possible to develop it natively? Update 1. By "natively" I mean that the end result will be native code without intermediate layers like Java Virtual Machine or .NET Common Language Runtime Update 2. A FREE solution is preferable ;) 回答1: If