我正试图在PyCharm中使用Karma测试运行器.我运行了karma init脚本,并选择从这个init脚本中包含Require.js插件.然后,当我尝试运行测试运行器时,我得到了这样的通知:Uncaught Error: Module name "assert" has not been loaded yet for context: _. Use require([])
所以我不得不使用"npm install assert"下载assert,然后在我的karma.conf.js文件中包含这样的一行:{pattern: 'node_modules/assert/assert.js', included: true},在files数组中.
但现在我得到了类似的抱怨:Uncaught Error: Module name "util/" has not been loaded yet for context: _. Use require([])虽然我使用'npm install util'安装,现在文件夹显示在我的node_modules文件夹下,但我所做的一切似乎都没有解决问题.
任何建议将不胜感激.
我正在使用 recorder.js 并且已经成功地达到了可以录制音频片段并一遍又一遍地播放到我内心深处的地步。但是现在我正在尝试将这个“blob”(我知道它包含正确的数据,因为它正在正确播放)作为我的 /public 文件夹中的音频 wav 文件发布。我的问题是我不确定如何处理 blob 并实际发布其内容。这是我的代码:
function sendWaveToPost1() {
console.log(savedWAVBlob);
$.ajax({ url: '/worm/save',
type: 'POST',
beforeSend: function(xhr) {xhr.setRequestHeader('X-CSRF-Token', $('meta[name="csrf-token"]').attr('content'))},
data: 'someData=' + savedWAVBlob,
success: function(response) {
console.log("success");
}
});
Run Code Online (Sandbox Code Playgroud)
}
控制器:
class WormController < ApplicationController
def create
end
def
save
audio = params[:someData]
p audio
save_path = Rails.root.join("public/audioFiles")
# Open and write the file to file system.
File.open(save_path, 'wb') do |f|
f.write audio.read
end
render :text=> 'hi'
end
end
Run Code Online (Sandbox Code Playgroud)
该代码基于这篇文章:在 rails 中保存音频文件。但是虽然我发布了一些东西,但它似乎是一个字符串,而不是音频文件的实际字节。这是我收到的 rails 控制台错误:
NoMethodError …Run Code Online (Sandbox Code Playgroud) 我正在尝试为gcloud实例设置新的ssh密钥。我完全按照此处的说明(https://cloud.google.com/compute/docs/instances/adding-removing-ssh-keys)进行操作,生成了一个新密钥,并将带有我的用户名的公共rsa-ssh密钥放在SSH上Google Cloud Platform界面中“元数据”标签的“密钥”部分,并使用chmod为我的公钥和私钥设置适当的权限。
尝试使用-vvv详细标志进行ss时,我收到一条错误的结尾如下:
...
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /Users/erickofman/.ssh/salsadb
debug3: send_pubkey_test
debug3: send packet: type 50
debug2: we sent a publickey packet, wait for reply
debug3: receive packet: type 51
debug1: Authentications that can continue: publickey
debug2: we did not send a packet, disable method
debug1: No more authentication methods to try.
Permission denied (publickey).
我(与同事一起)确保我的公钥包含在服务器的.ssh文件夹中的authorized_keys文件中。认为可能只是过时了,所以我也尝试重新启动ssh服务器service sshd restart,但无济于事。
我还尝试使用gcloud工具设置ssh,结果相同。
据我所知,我对网站具有正确的角色/权限。
这是服务器端日志的样子:
admin@awesome-website:~$ tail /var/log/auth.log
Nov 15 20:40:16 awesome-website sshd[18846]: …
audio ×1
blob ×1
gcloud ×1
instance ×1
javascript ×1
karma-runner ×1
node.js ×1
public-key ×1
pycharm ×1
requirejs ×1
ssh ×1