cross-platform

How to get a settings storage path in a cross-platform way in Qt?

帅比萌擦擦* 提交于 2019-12-10 03:19:17
问题 My program needs to read/write a text (just a few lines) file with its settings to disk. To specify a path in code may work well on one platform, like windows, but if runs it on Linux, the path is not cross platform. I am looking for a similar solution to QSettings that saves settings to different paths or has its native ways to handle this. Programmers don't need to do with the details. But the text file is not suitable to be saved as a value in QSettings . No user interaction should be

Does Xamarin have an #if or #ifdef for determining the platform?

久未见 提交于 2019-12-10 03:14:37
问题 For example, #ifdef iOS, #ifdef android, or the like. If there is #if, that would be even better. 回答1: iOS: #if __MOBILE__ Console.WriteLine ("__MOBILE__ is defined"); #endif #if __IOS__ Console.WriteLine ("__IOS__ is defined"); #endif Android: #if __MOBILE__ Console.WriteLine ("__MOBILE__ is defined"); #endif #if __ANDROID__ Console.WriteLine ("__ANDROID__ is defined"); #endif https://bugzilla.xamarin.com/show_bug.cgi?id=6459#c12 xamarin documentation 回答2: Yes it does, I don't know, if

Cross-platform unicode in C/C++: Which encoding to use?

孤人 提交于 2019-12-10 02:43:10
问题 I'm currently working on a hobby project (C/C++) which is supposed to work on both Windows and Linux, with full support for Unicode. Sadly, Windows and Linux use different encodings making our lives more difficult. In my code I'm trying to use the data as universal as possible, making it easy for both Windows and Linux. In Windows, wchar_t is encoded as UTF-16 by default, and as UCS-4 in Linux (correct me if I'm wrong). My software opens ({_wfopen, UTF-16, Windows},{fopen, UTF-8, Linux}) and

Cross-platform C++: Use the native string encoding or standardise across platforms?

ぐ巨炮叔叔 提交于 2019-12-10 02:06:20
问题 We are specifically eyeing Windows and Linux development, and have come up with two differing approaches that both seem to have their merits. The natural unicode string type in Windows is UTF-16, and UTF-8 in linux. We can't decide whether the best approach: Standardise on one of the two in all our application logic (and persistent data), and make the other platforms do the appropriate conversions Use the natural format for the OS for application logic (and thus making calls into the OS), and

UIBezierPath to NSData to Server to Android

≡放荡痞女 提交于 2019-12-10 00:48:09
问题 currently I have a class that conforms to NSCoding containing a UIBezierPath and a UIColor. required init(coder aDecoder: NSCoder) { super.init() self.lineColor = aDecoder.decodeObjectForKey("color") as! UIColor self.bezierPath = aDecoder.decodeObjectForKey("bezier") as! UIBezierPath } func encodeWithCoder(aCoder: NSCoder) { aCoder.encodeObject(lineColor, forKey: "color") aCoder.encodeObject(bezierPath, forKey: "bezier") } I achieve this with NSKeyedArchiver NSKeyedArchiver

Positive integer from Python hash() function

两盒软妹~` 提交于 2019-12-10 00:47:20
问题 I want to use the Python hash() function to get integer hashes from objects. But built-in hash() can give negative values, and I want only positive. And I want it to work sensibly on both 32-bit and 64-bit platforms. I.e. on 32-bit Python, hash() can return an integer in the range -2**31 to 2**31 - 1 . On 64-bit systems, hash() can return an integer in the range -2**63 to 2**63 - 1 . But I want a hash in the range 0 to 2**32-1 on 32-bit systems, and 0 to 2**64-1 on 64-bit systems. What is the

Cross platform .Net? [closed]

霸气de小男生 提交于 2019-12-09 17:56:23
问题 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 6 years ago . If you were to write an GUI application that runs locally and calls a webservice, to be cross platform, can you do it with .Net, what tools would you recommend? I was considering Java as it would be relatively easy to pick up due to its C# similarity and then I could use the JVM. 回答1: You should get familiar

Standard way to open a folder window in linux?

帅比萌擦擦* 提交于 2019-12-09 16:32:35
问题 I want to open a folder window, in the appropriate file manager, from within a cross-platform (windows/mac/linux) Python application. On OSX, I can open a window in the finder with os.system('open "%s"' % foldername) and on Windows with os.startfile(foldername) What about unix/linux? Is there a standard way to do this or do I have to special case gnome/kde/etc and manually run the appropriate application (nautilus/konqueror/etc)? This looks like something that could be specified by the

Setting Mercurial's execute bit on Windows

浪尽此生 提交于 2019-12-09 15:34:30
问题 I work on a Mercurial repository that is checked out onto an Unix filesystem such as ext3 on some machines, and FAT32 on others. In Subversion, I can set the svn:executable property to control whether a file should be marked executable when checked out on a platform that supports such a bit. I can do this regardless of the platform I'm running SVN on or the filesystem containing my working copy. In Mercurial, I can chmod +x to get the same effect if the clone is on a Unix filesystem. But how

How to launch the associated application for a file / directory / URL?

时光总嘲笑我的痴心妄想 提交于 2019-12-09 14:53:48
问题 Linux seems to be easy: xdg-open <file/directory/URL> . Apparently, Mac is similar: open should be used instead of xdg-open . I don't have access to a Mac so I couldn't test it. For Windows , I found 4 different suggestions and those that I have tried failed. Is there a non-java, cross platform way to launch the associated application for a certain file type? suggests start How to give focus to default program of shell-opened file, from Java? suggests cmd /c start ... How to open user system