问题标签 [cross-platform]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
4 回答
100523 浏览

php - PHP 回显换行符

\n 和 \r 之间有什么区别(我知道它与操作系统有关),以及回显跨平台工作的换行符的最佳方法是什么?

编辑:作为对 Jarod 的回应,我将使用 ths 在 .txt 日志文件中回显换行符,但我确信将来我会使用它来将 HTML makup 回显到页面上。

0 投票
1 回答
167 浏览

cross-platform - 每个平台上的“数据目录”概念

这与跨平台应用程序应该将数据保存在哪里非常相似?,但稍微扩展一下。

关于数据的父目录应该在哪里有一些很好的建议,但对于给定应用程序的目录应该是什么却没有太多建议。

例如,假设我们在 My Brand 中有一个由 My Corp 编写的跨平台应用程序,名为 My App。假设 My Brand 中的其他产品可能需要自己的数据,My Corp 中的其他品牌也是如此。它的数据和/或配置在 Windows 上应该放在哪里?在 Unix 上?Mac OS9?Mac OS X?其他?

例如,在 Windows 上,数据会进入“...\Application Data\My Corp\My Brand\My App”,而在 Mac OS X 上,数据会进入 ~/Library/Application Support/My Corp/My Brand /My App”,在 Unix 上它会进入“~/.mycorp/mybrand/myapp”?(我想其他平台会使用 unix 的修改,即使基本目录可能不同。)

如果没有真正的约定,这似乎合理吗?对 Mac OS9 有什么建议吗?

0 投票
6 回答
472 浏览

windows - Are there alternatives for creating large container files that are cross platform?

Previously, I asked the question.

The problem is the demands of our file structure are very high.

For instance, we're trying to create a container with up to 4500 files and 500mb data.

The file structure of this container consists of

  • SQLite DB (under 1mb)
  • Text based xml-like file
  • Images inside a dynamic folder structure that make up the rest of the 4,500ish files

  • After the initial creation the images files are read only with the exception of deletion.

  • The small db is used regularly when the container is accessed.

Tar, Zip and the likes are all too slow (even with 0 compression). Slow is subjective I know, but to untar a container of this size is over 20 seconds.

Any thoughts?

0 投票
8 回答
5285 浏览

cross-platform - Cross-platform, cross-language messaging system?

I'm developing a set of applications that work together to create a system for processing metering data. There's several reasons I want to have them loosely coupled and the system should be extensible by third parties, so the apps will be tied together via messaging.

I'm looking for a messaging system that offers bindings in (at least) C#, Java and Python and supports messaging patterns like Publish-Subscribe, Guaranteed Delivery, Selective Consumer (like Peek in .Net Messaging).

As far as I could find out, there's nothing wrong with JMS or .Net Messaging, it's just that they are for .Net / Java only.

The system should give me control over which transport mechanism (Sockets, Message Queues, etc.) to use when setting up a channel. I want to be able to both scale out to remote machines and speed things up with local transport facilities.

If I can't find anything suitable, I'll have to roll my own. I'd probably use Google's protocol buffers for serialization. If anybody has other recommendations for technology options, fire away.

Oh, yes - and I would like to have optional encryption on a per-channel or per-message basis.

ETA: Thanks for all the quick replies. I'm working my way through the docs & propaganda now. Has anybody used the technologies below, and for what / with what results?

0 投票
1 回答
592 浏览

java - .NET (Mono) 是否支持跨平台文件操作和跨平台音频元数据处理(通过库)?

对于我的下一个项目,两个领先的领跑者是 .NET 和 Java。该项目将采用一个包含目录和音乐文件(最初是 MP3,但最终扩展到其他音乐格式)的目录(类似于 Windows 中的 My Music)。对于每个文件,它允许您播放文件并查看/编辑其元数据、文件名和位置。

我知道 Java 有用于获取/编辑元数据和跨平台文件操作支持的库。我也知道 .NET 有用于处理元数据的库,但我不确定我需要的文件操作。但是,我真的很想回到 .NET,尤其是因为我想将它保留在我的简历中,但自 .NET 2.0 以来我就没有使用过它(现在是什么,3.5?),如果我不使用跟上它,把它放在我的简历上是没有意义的,因为我无法回答任何关于新技术版本的问题。

最初,Windows 是我唯一关心的问题,但我想将其作为跨平台应用程序发布。

注意:我知道我正在重新发明轮子,但这是我遇到的一个问题,我认为解决它会很有趣。它处理了许多问题,从 UI 问题到文件结构管理到外部库等等。

0 投票
3 回答
61630 浏览

debugging - 如何检查 GDB 中函数的返回值?

假设返回值分配给变量,是否可以检查 gdb 中函数的返回值?

0 投票
3 回答
3750 浏览

linux - 是否有任何工具可以检查交叉编译的 .so 文件中的符号?

我有一个应用程序在启动时将 .so 文件加载为插件,使用dlopen()

构建环境在 x86 硬件上运行,但应用程序正在针对另一个平台进行交叉编译。

如果我可以(作为自动构建过程的一部分)进行检查以确保 .so 文件和应用程序的组合中没有任何未解析的符号,而无需实际部署应用程序,那就太好了。

在我编写脚本来使用 的输出测试符号之前nm,我想知道是否有人知道已经这样做的实用程序?


编辑1:稍微改变了描述——我不只是试图测试.so中的符号,而是结合几个.so和应用程序本身——即。在应用程序加载所有 .so 之后,是否还会有未解析的符号。

正如答案中所建议的那样(感谢 Martin v. Löwis 和 tgamblin),nm将很容易识别单个文件中丢失的符号,但不容易识别在其他加载的模块之一中已解决哪些符号。

0 投票
1 回答
14160 浏览

python - 是否有从 Python 的 OSError 获取信息的跨平台方式?

例如,在一个简单的目录创建操作中,我可以像这样创建一个 OSError:

(Ubuntu Linux)

现在我可以像这样捕获该错误:

有没有一种跨平台的方式可以让我知道 17 或“文件存在”总是意味着同一件事,以便我可以根据情况采取不同的行动?

(这是在另一个问题中出现的。)

0 投票
5 回答
9724 浏览

python - 在 python 中播放声音文件的跨平台方式是什么?

我尝试使用 pyaudio 播放 .wav 文件。它在 Windows 上运行良好,但在另一台设备使用声音时无法在 Ubuntu 中运行。

错误是“IOError: [Errorno Invalid output device (no default output device)] -9996

我可以尝试使用另一个库吗?另一种方法?

0 投票
3 回答
2687 浏览

c++ - 3D 场景文件格式和查看器

我正在寻找用于保存和查看 3D 场景(工程仿真模型和结果的可视化)的跨平台解决方案,但那里(仍然)似乎并不多。

大约 10 年前,我对此进行了研究,然后选择了 VRML(并开始了最终转向OpenVRML的项目)。不幸的是,在过去的十年里,VRML/X3D 并没有变得无处不在。

理想的解决方案是提供一个 C++ 库,该库可以插入到某个级别的 3D 渲染管道中,以将 3D 场景捕获到文件中;以及一个可自由再分发的查看器,允许查看操作、部分隐藏、注释、尺寸标注等。至少应该支持 linux、mac 和 windows。

3D PDF 似乎可以满足大多数查看器的要求,但 Adob​​e sdk 显然只能在 Windows 上使用。

有什么建议么 ?