学习 Ruby on Rails 后,我还想学习 Node.JS。
在 Node.JS 中,您可以使用以下命令逐行读取文件readline:
var fs = require("fs");
var readline = require("readline");
var fileName = "input.txt";
Run Code Online (Sandbox Code Playgroud)
我们可以readline这样分配给文件:
var lineReader = readline.createInterface({
input: fs.createReadStream(fileName)
});
Run Code Online (Sandbox Code Playgroud)
然后我们可以这样读取每一行:
lineReader.on('line', function(line) {
// handle line code here
});
Run Code Online (Sandbox Code Playgroud)
这将允许我只读取单个文件。
如果我有这样的文件名数组:
var fileNames = ["input1.txt", "input2.txt", "input3.txt"];
Run Code Online (Sandbox Code Playgroud)
我想读取该数组中每个文件的每一行并处理它们的line事件。
如何逐行读取多个文件?
我已将标准的unitypackage文件导入到我的 Unity3D 项目中,该项目有自己的 C# 代码。然后我打开我的 Visual Studio Community Edition 以使用它的代码作为命名空间,我得到了这个:
它甚至没有显示在这个项目的解决方案中:
没有Nakama放置这些脚本的文件夹。
有没有办法重新创建项目解决方案?
我使用的是Visual Studio 社区版 2015 14.0.25
我有这行代码:
// I pass milliseconds timestamp on time var
ZonedDateTime zonedDatetIme = ZonedDateTime.ofInstant(java.time.Instant.ofEpochMilli(time), java.time.ZoneId.of("Asia/Almaty"))
Run Code Online (Sandbox Code Playgroud)
当我这次尝试输出时,它返回:
System.our.println(zonedDatetIme)
// returns
2020-01-24T17:00+06:00[Asia/Almaty]
Run Code Online (Sandbox Code Playgroud)
然后我试图格式化这个日期时间:
DateTimeFormatter formatter = DateTimeFormatter.ofPattern('dd.MM.yyyy hh:mm');
System.our.println(formatter.format(zonedDateTime));
Run Code Online (Sandbox Code Playgroud)
返回给我的是:
24.01.2020 05:00
Run Code Online (Sandbox Code Playgroud)
那是错的。这就像它减去我的时区的 6 小时而不是添加它。为什么会发生这种情况?
我已经为我的rails_admin集成了CKEditor。在edit页面中我添加了 CKEditor 并编写了文本。
在我的模型显示页面中,它向我显示如下:

我的代码show:
show do
include_all_fields
end
Run Code Online (Sandbox Code Playgroud)
我需要添加什么来显示我在 CKEditor 上编写的文本,能够在rails_admin 中显示?
====更新====
我已经config.assets.precompile += %w( ckeditor/* )在我的production.rb and development.rb. 然后我运行了 rake asset 预编译任务并重新启动了我的服务器。在我上面的图片中它仍然显示相同的内容。
即使可以以 html 格式显示文本,也会产生新的问题。正如您在图片中看到的,有一个img标签,它src显示的不是我上传的图片的完整目录。如果我需要将此格式化文本作为 JSON 发送到我的手机?
====更新====
我已经打开浏览器的代码检查器来查看description页面的一部分。它向我展示了这个:

我的html代码是用CKEditor创建的,写得很好,但是我的浏览器不认为它是html代码并且有引号。这些引号是否会影响我的浏览器将其显示为纯文本?
如何提取特定gem的源代码,以便可以在本地编辑它?要把它添加到我的Rails应用程序文件夹中吗?
我需要它能够更改gem的代码.
在处理了一些项目后,我的 npm 开始从全局错误的地址下载依赖项:
npm install -g bower
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! network request to http://172.168.1.1/bower failed, reason:
connect ETIMEDOUT 172.168.1.1
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm …Run Code Online (Sandbox Code Playgroud)