我正在尝试向index.html文件中的按钮添加功能如下:我有一个按钮元素index.html
<button id="auth-button">Authorize</button>
Run Code Online (Sandbox Code Playgroud)
在main.js应用程序中,我有
require('crash-reporter').start();
console.log("oh yaeh!");
var mainWindow = null;
app.on('window-all-closed', function(){
if(process.platform != 'darwin'){
app.quit();
}
});
app.on('ready',function(){
mainWindow = new BrowserWindow({width:800, height : 600});
mainWindow.loadUrl('file://' + __dirname + '/index.html');
var authButton = document.getElementById("auth-button");
authButton.addEventListener("click",function(){alert("clicked!");});
mainWindow.openDevTools();
mainWindow.on('closed',function(){
mainWindow = null;
});
});
Run Code Online (Sandbox Code Playgroud)
但是出现如下错误:
Uncaught Exception: ReferenceError: document is not defined
在构建电子应用程序时是否可以访问DOM对象?或者是否有其他替代方法可以提供所需的功能?
当我在代理网络中时,我在cmd中设置了代理设置,如下所示:
set http_proxy=http://username:pass@hostname:port
set https_proxy=https://username:pass@hostname:port
现在我在普通网络上,我想在命令提示符中取消设置代理设置.是否有任何直接命令可以让我直接为命令行取消设置http_proxy和https_proxy环境变量,而不是导航通过GUI删除它们?
当我尝试使用Ubuntu 15.04安装电子时
sudo npm install electron-prebuilt -g
这就是我得到的
/usr/local/bin/electron -> /usr/local/lib/node_modules/electron-prebuilt/cli.js
> electron-prebuilt@0.28.3 postinstall /usr/local/lib/node_modules/electron-prebuilt
> node install.js
Downloading electron-v0.28.3-linux-x64.zip
Error: tunneling socket could not be established, cause=139936635598656:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:
/usr/local/lib/node_modules/electron-prebuilt/install.js:15
throw err
^
Error: tunneling socket could not be established, cause=139936635598656:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:s23_clnt.c:795:
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! electron-prebuilt@0.28.3 postinstall: `node install.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed …Run Code Online (Sandbox Code Playgroud) SWI Prolog允许在非最低级别的顶级之前执行目标,如下所示
swipl -s consultingfile.pl -g start
Run Code Online (Sandbox Code Playgroud)
但是,当具有非零arity的谓词指定如下时
swipl -s consultingfile.pl -g start(1)
Run Code Online (Sandbox Code Playgroud)
它给出了一个错误
syntax error near unexpected token '('
Run Code Online (Sandbox Code Playgroud)
如何将非零arity谓词作为最高级别之前的目标传递?
我想为Docker容器的子网设置IP自定义池。为此,我遵循了此停止的docker守护程序,删除了docker0接口并使用自定义NetworkId重新创建
systemctl stop docker
ip link del docker0
Run Code Online (Sandbox Code Playgroud)
使用NetworkManager重新创建docker0虚拟网桥接口并将其打开。
ant@ant ~> nmcli con up <UID>
ant@ant ~> ip addr
111: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 3e:ff:1b:ce:e4:a4 brd ff:ff:ff:ff:ff:ff
inet 172.20.0.1/20 brd 172.20.15.255 scope global docker0
valid_lft forever preferred_lft forever
Run Code Online (Sandbox Code Playgroud)
现在,当我再次启动docker daemon时,
ant@ant ~> systemctl start docker
ant@ant ~> ip addr
111: docker0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
link/ether 3e:ff:1b:ce:e4:a4 brd ff:ff:ff:ff:ff:ff
inet …Run Code Online (Sandbox Code Playgroud) .pl扩展名为perl 的文件的默认文件类型.但是我经常使用prolog所以每次打开一个新文件时我都必须通过运行vim命令手动设置它
:set filetype=prolog
我尝试通过插入以下行来自动化它 ~/.vimrc
autocmd BufNewFile,BufRead *.pl set syntax=prolog
还尝试在.vim/ftdetect/pl.vim文件中插入此行是徒劳的.
如何将.pl文件设置为prolog类型而不是perl?
I have some docker containers running on my machine, one of them being container_1
I am able to access container_1's cli using
ant@ant~/D/m/l/db> docker exec -it container_1 bash
daemon@1997cc093b24:/$
Run Code Online (Sandbox Code Playgroud)
This allows me to go to container_1's cli but with no write permissions. The following commands give a permission denied error
ant@ant~/D/m/l/db> docker exec -it container_1 touch test.txt
bash: test.txt: Permission denied
ant@ant~/D/m/l/db>docker exec -it container_1 bash
daemon@1997cc093b24:/$ touch test.txt
bash: test.txt: Permission denied
Run Code Online (Sandbox Code Playgroud)
Also tried using --previleged option …
docker ×2
electron ×2
bash ×1
cmd ×1
dom ×1
http-proxy ×1
javascript ×1
node.js ×1
prolog ×1
proxy ×1
swi-prolog ×1
ubuntu ×1
vim ×1
windows ×1