在Google表格中,您可以添加一些脚本功能.我正在为onEdit
活动添加一些东西,但我不知道它是否有效.据我所知,你不能从Google表格中调试一个直播事件,所以你必须从调试器中做到这一点,这是没有意义的,因为传递给我的onEdit()
函数的事件参数将始终是未定义的,如果我从它运行它Script Editor
.
因此,我试图在调用函数Logger.log
时使用该方法记录一些数据onEdit
,但这似乎只有在从函数运行时才有效Script Editor
.当我从中运行它时Script Editor
,我可以通过转到查看日志View->Logs...
我希望能够在事件实际执行时看到日志,但我无法理解.
我该如何调试这些东西?
我正在使用Docker来运行Apache实例.我的docker文件是这样的:
FROM ubuntu
MAINTAINER your.face@gmail.com
RUN cat /etc/passwd
RUN cat /etc/group
RUN apt-get update && apt-get install -yq apache2 php5 libapache2-mod-php5 php5-mysql
RUN apt-get install -yq openssh-server
RUN mkdir /var/run/sshd
ENV APACHE_RUN_USER www-data
ENV APACHE_RUN_GROUP www-data
ENV APACHE_LOG_DIR /var/log/apache2
EXPOSE 80
ADD config/apache2/000-default.conf /etc/apache2/sites-available/000-default.conf
ADD config/php5/php.ini /etc/php5/apache2/php.ini
ADD config/start.sh /tmp/start.sh
ADD src /var/www
RUN chown -R root:www-data /var/www
RUN chmod u+rwx,g+rx,o+rx /var/www
RUN find /var/www -type d -exec chmod u+rwx,g+rx,o+rx {} +
RUN find /var/www -type f -exec chmod u+rw,g+rw,o+r …
Run Code Online (Sandbox Code Playgroud) 安装mongodb后,我跑mongod
了
mongod --dbpath <pathtodb> --logpath <pathtolog> --replSet rs0
Run Code Online (Sandbox Code Playgroud)
然后我与mongo shell连接并运行
rs.initiate()
Run Code Online (Sandbox Code Playgroud)
然后我尝试将文档插入到集合中,但收到错误:
> db.blah.insert({a:1})
WriteResult({ "writeError" : { "code" : undefined, "errmsg" : "not master" } })
Run Code Online (Sandbox Code Playgroud)
看rs.status()
,我看到的状态是REMOVED
:
> rs.status() { "state" : 10, "stateStr" : "REMOVED", "uptime" : 1041, "optime" : Timestamp(1429037007, 1), "optimeDate" : ISODate("2015-04-14T18:43:27Z"), "ok" : 0, "errmsg" : "Our replica set config is invalid or we are not a member of it", "code" : 93 }
我不知道我可以做些什么来搞砸这个.这应该是我认为的.我如何通过这个?
我正在尝试做这样的事情:
struct SomeStruct {
const char *bytes;
const char *desc;
};
SomeStruct example = { { 0x10, 0x11, 0x12, 0x13 }, "10-13" };
Run Code Online (Sandbox Code Playgroud)
为什么这不起作用?
我/etc/security/limits.conf
在docker容器中添加了一些内容以限制用户进程的最大数量user1
,但是当我在用户下的容器中运行bash时user1
,ulimit -a
并未反映pam限制文件(/etc/security/limits.conf
)中定义的限制.
我怎样才能让它发挥作用?
我还增加了行session required pam_limits.so
到/etc/pam.d/common-session
,所以这不是问题.
我用类似的东西启动docker容器 sudo docker run --user=user1 --rm=true <container-name> bash
此外,sudo docker run ... --user=user1 ... cmd
不适用pam限制,但sudo docker run ... --user=root ... su user1 -c 'cmd'
确实如此
我正在测试在os.execve
虚拟环境中进行一些恶作剧。sys.executable
如果我将当前的python进程替换为另一个python子进程,就会遇到空的问题。
以下示例显示了发生的情况(在python shell中运行):
import os, sys
print(sys.executable) # works this time
os.execve("/usr/bin/python", [], {}) # drops me into a new python shell
import sys # yes, again
print(sys.executable) # is empty
Run Code Online (Sandbox Code Playgroud)
我在python shell中运行以上命令的完整输出:
lptp [ tmp ]: python
Python 2.7.10 (default, Oct 14 2015, 16:09:02)
[GCC 5.2.1 20151010] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os, sys
>>> print(sys.executable) # works this time
/usr/bin/python
>>> os.execve("/usr/bin/python", [], {}) # drops …
Run Code Online (Sandbox Code Playgroud) 我有一个安装了cygwin和openssh的windows guest,在Vagrantfile中配置了用户/密码.当我运行vagrant时,一切正常,直到"配置和启用网络接口",此时它barfs并抱怨windows vagrant box需要winrm:
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for SSH to become available...
==> default: Creating shared folders metadata...
==> default: Configuring and enabling network interfaces...
Configuring networks on Windows requires the communicator to be
set to WinRM. To do this, add the following to your Vagrantfile:
config.vm.communicator = …
Run Code Online (Sandbox Code Playgroud) 我想为多种不同的OS类型(例如windows和linux)提供一个Vagrantfile.我目前正在尝试这样做:
... if config.vm.guest.to_s == "windows" # ... do something windows specific else # ... do something linux specific end
但是,config.vm.guest
返回Object
实例,而不是字符串或符号,即使它是在基本框Vagrant文件(即config.vm.guest = :windows
)中设置的.
我怎样才能做到这一点?
这段代码给了我一个SCRIPT5002: Function expected
错误:
var callIt = function(func) { func(); }
Run Code Online (Sandbox Code Playgroud)
为什么!?这就像它试图进行类型检查或其他东西
编辑:用例
var callIt = function(func) { func(); }
function nextSlide() {
var fn = currSlide ? currSlide.hide : callIt;
currSlide = setupSlides[++slideIdx];
fn(currSlide.show());
}
Run Code Online (Sandbox Code Playgroud)
DOH!
我正在使用imp
库从字符串(不要问)导入模块。这一切都很好,很花哨,但是当这样的模块出现错误时,我会得到这样的堆栈跟踪:
Traceback (most recent call last):
File "<string>", line 33, in do_something
File "<string>", line 20, in really_do_something
Exception: STRING FILENAME EXAMPLE
Run Code Online (Sandbox Code Playgroud)
我尝试将模块上的文件属性设置为有意义的值,但<string>
文件名仍用于异常回溯中。
关于如何指定异常中使用的文件名的任何想法?
更新:我正在使用这样的小鬼:动态模块导入试图在不应该做的时候进行相对导入