首先,我node在macOS终端上运行,并得到
bash: /usr/local/bin/node: No such file or directory
Run Code Online (Sandbox Code Playgroud)
我跑步brew install node并得到
Warning: node 12.10.0 is already installed, it's just not linked You can use `brew link node` to link this version.
于是我运行brew link node,并得到
Error: Could not symlink include/node/common.gypi
/usr/local/include/node is not writable.
Run Code Online (Sandbox Code Playgroud)
我想这是一些权限问题。所以我用sudo运行它并得到
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to …Run Code Online (Sandbox Code Playgroud) 我正在尝试获取在 React 中使用输入标签上传的图像的 exif 元数据,并将以下函数附加到输入标签的属性“onChange”:
onChange(e) {
const { input: { onChange } } = this.props;
let img_arr = [];
for (let i = 0; i < e.target.files.length; i++) {
const file = e.target.files[i];
console.log('exif data');
console.log(EXIF.getData(file, () => {
var orientation = EXIF.getTag(this, "Orientation");
console.log('orientation');
console.log(orientation);
}));
img_arr.push({file: file, url: URL.createObjectURL(file)});
}
//console.log("printing img arr");
//console.log(img_arr);
onChange(img_arr);
}
Run Code Online (Sandbox Code Playgroud)
但是,我得到 EXIF 未定义。在exif-js页面,建议使用window.onload。https://github.com/exif-js/exif-js。如何在 React 组件中使用 window.onload ?
- 编辑 -
我将代码更改为这样,但方向仍然未定义:
onChange(e) {
const { input: { onChange } …Run Code Online (Sandbox Code Playgroud) 当我执行以下操作时,它会起作用:
user> (#(+ % 8) 7)
15
Run Code Online (Sandbox Code Playgroud)
但为什么这不起作用?
user> (#({:a %}) 7)
Execution error (ArityException) at user/eval74597$fn (form-init937950372947324749.clj:760).
Wrong number of args (0) passed to: clojure.lang.PersistentArrayMap
Run Code Online (Sandbox Code Playgroud)
预期结果:{:a 7}
我的目标是使用括号表示法来打印带有N个节点的所有形式的树,可以根据上下文无关的语法定义如下:
?树是空的
?(TT)具有左右子节点的节点
例如,所有具有3个节点的树将如下所示:
((((。)。)。)
((。(。))。)
((。)。(。))
(。((。)。))
(。(。(。)))
我用Ada编写了以下代码,
with Ada.Containers; use Ada.Containers;
with Ada.Containers.Vectors;
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Command_Line;
procedure Ass1 is
X: Positive := Positive'Value(Ada.Command_Line.Argument(1));
package String_Vectors is new Ada.Containers.Vectors
(Index_Type => Natural,
Element_Type => String);
function tree(N: Integer) return String_Vectors.Vector is
Strings : String_Vectors.Vector;
begin
if N = 1 then
Strings.Append("(.)");
return Strings;
end if;
for T in tree(N - 1).Iterate loop
Strings.Append("(" & T & ".)");
Strings.Append("(." & T & ")");
end loop;
return …Run Code Online (Sandbox Code Playgroud) 假设我正在使用 fgets 读取一个字符串,并且我想防止该字符串的字符在终端内部回显(没有 bash 技巧)。我怎样才能做到这一点?
我在Emacs Lisp Interaction上运行以下代码:
(defun square (x) (* x x))
(square (square (square 1001)))
Run Code Online (Sandbox Code Playgroud)
这给了我1114476179152563777。但是,((1001^2)^2)^2实际上是1008028056070056028008001。这怎么可能?
基本上我想做的是打印一个包含键的哈希表,这些键是字符串中的字符,并且这些键的值为1。例如,字符串“ aabbce”应提供字典{:a 1:b 1:c 1 }。以下是我的尝试,但只显示空的哈希图
(defn isValid [s]
(def dict {})
(map (fn [x] ((assoc dict :x 1))) (seq s))
(println dict)
)
Run Code Online (Sandbox Code Playgroud)