platform-independent

Is .NET platform independent?

此生再无相见时 提交于 2019-11-28 11:24:51
.NET is a language independent platform. But is it platform independent as well ? How ? EDIT : I have heard, .NET 4.0 is developed considering plateform independency ! Well, hope it may take over Java, if so ! EDIT : The answer depends upon the way how we define 'platform', like .NET for windows platform and Mono for Java. But, the question is, don't do we have general development platform which is OS independent ! Does OS independency related to platform independency ? It's really a matter of how you define "platform". E.g. .NET is platform independent as long as the platform is .NET, the

File.separator vs FileSystem.getSeparator() vs System.getProperty(“file.separator”)?

杀马特。学长 韩版系。学妹 提交于 2019-11-28 04:01:44
There seems to be three identical ways to get the platform-dependent "file separator" platform-independently: java.io.File.separator java.nio.file.FileSystems.getDefault().getSeparator(); System.getProperty("file.separator") How do we decide when to use which? Is there even any difference between them? System.getProperties() can be overridden by calls to System.setProperty(String key, String value) or with command line parameters -Dfile.separator=/ File.separator gets the separator for the default filesystem. FileSystems.getDefault() gets you the default filesystem. FileSystem.getSeparator()

C++ Converting a time string to seconds from the epoch

耗尽温柔 提交于 2019-11-27 14:07:39
I have a string with the following format: 2010-11-04T23:23:01Z The Z indicates that the time is UTC. I would rather store this as a epoch time to make comparison easy. What is the recomended method for doing this? Currently (after a quck search) the simplist algorithm is: 1: <Convert string to struct_tm: by manually parsing string> 2: Use mktime() to convert struct_tm to epoch time. // Problem here is that mktime uses local time not UTC time. Martin York Using C++11 functionality we can now use streams to parse times: The iomanip std::get_time will convert a string based on a set of format

Node.js - Find home directory in platform agnostic way

 ̄綄美尐妖づ 提交于 2019-11-27 10:24:20
Process.platform returns "win32" for Windows. On Windows a user's home directory might be C:\Users[USERNAME] or C:\Documents and Settings[USERNAME] depending on which version of Windows is being used. On Unix this isn't an issue. As mentioned in a more recent answer , the preferred way is now simply: const homedir = require('os').homedir(); [Original Answer] : Why not use the USERPROFILE environment variable on win32? function getUserHome() { return process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME']; } os.homedir() was added by this PR and is part of the public 4.0.0 release

Is .NET platform independent?

旧城冷巷雨未停 提交于 2019-11-27 03:37:17
问题 .NET is a language independent platform. But is it platform independent as well ? How ? EDIT : I have heard, .NET 4.0 is developed considering plateform independency ! Well, hope it may take over Java, if so ! EDIT : The answer depends upon the way how we define 'platform', like .NET for windows platform and Mono for Java. But, the question is, don't do we have general development platform which is OS independent ! Does OS independency related to platform independency ? 回答1: It's really a

File.separator vs FileSystem.getSeparator() vs System.getProperty(“file.separator”)?

Deadly 提交于 2019-11-27 00:15:40
问题 There seems to be three identical ways to get the platform-dependent "file separator" platform-independently: java.io.File.separator java.nio.file.FileSystems.getDefault().getSeparator(); System.getProperty("file.separator") How do we decide when to use which? Is there even any difference between them? 回答1: System.getProperties() can be overridden by calls to System.setProperty(String key, String value) or with command line parameters -Dfile.separator=/ File.separator gets the separator for

C++ Converting a time string to seconds from the epoch

蓝咒 提交于 2019-11-26 22:23:40
问题 I have a string with the following format: 2010-11-04T23:23:01Z The Z indicates that the time is UTC. I would rather store this as a epoch time to make comparison easy. What is the recomended method for doing this? Currently (after a quck search) the simplist algorithm is: 1: <Convert string to struct_tm: by manually parsing string> 2: Use mktime() to convert struct_tm to epoch time. // Problem here is that mktime uses local time not UTC time. 回答1: Using C++11 functionality we can now use

Platform independent size_t Format specifiers in c?

江枫思渺然 提交于 2019-11-26 18:30:59
I want to print out a variable of type size_t in C but it appears that size_t is aliased to different variable types on different architectures. For example, on one machine (64-bit) the following code does not throw any warnings: size_t size = 1; printf("the size is %ld", size); but on my other machine (32-bit) the above code produces the following warning message: warning: format '%ld' expects type 'long int *', but argument 3 has type 'size_t *' I suspect this is due to the difference in pointer size, so that on my 64-bit machine size_t is aliased to a long int ( "%ld" ), whereas on my 32

Node.js - Find home directory in platform agnostic way

99封情书 提交于 2019-11-26 11:53:38
问题 Process.platform returns \"win32\" for Windows. On Windows a user\'s home directory might be C:\\Users[USERNAME] or C:\\Documents and Settings[USERNAME] depending on which version of Windows is being used. On Unix this isn\'t an issue. 回答1: As mentioned in a more recent answer, the preferred way is now simply: const homedir = require('os').homedir(); [Original Answer] : Why not use the USERPROFILE environment variable on win32? function getUserHome() { return process.env[(process.platform ==

Platform independent size_t Format specifiers in c?

前提是你 提交于 2019-11-26 06:27:08
问题 I want to print out a variable of type size_t in C but it appears that size_t is aliased to different variable types on different architectures. For example, on one machine (64-bit) the following code does not throw any warnings: size_t size = 1; printf(\"the size is %ld\", size); but on my other machine (32-bit) the above code produces the following warning message: warning: format \'%ld\' expects type \'long int *\', but argument 3 has type \'size_t *\' I suspect this is due to the