小编adi*_*ire的帖子

在onOpen条目对象中为函数添加参数

是否有一种方法可以将参数添加到将添加到Google电子表格文档的"脚本中心"菜单中的函数中?这是正常的onOpen方法.

function onOpen() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var entries = [{
    name : "Summary",
    functionName : "myOnOpen"
  }
];
  sheet.addMenu("Script Center Menu", entries);
};
Run Code Online (Sandbox Code Playgroud)

我想知道是否有类似于以下内容.

function onOpen() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet();
  var entries = [{
    name : "Summary",
    functionName : "myOnOpen",
    arguments : [value: "Some value"]
  }
  ];
  sheet.addMenu("Script Center Menu", entries);
};
Run Code Online (Sandbox Code Playgroud)

谢谢!

google-sheets google-apps-script google-apps-script-menu

6
推荐指数
1
解决办法
2620
查看次数

在ubuntu 16.04上安装fpm时出错

在具有以下错误日志的Ubuntu 16.04计算机中,fpm的安装失败.很长一段时间没有问题,并且包含的​​apt包没有变化.

安装的软件包是ruby-dev,gcc原本为FPM.我也试图与rubygems,build-essential,autoconf,autogen,automake,pkg-config,libgtk-3-devapt-utils,但无济于事.

sudo gem install --no-rdoc --no-ri fpm
Fetching: cabin-0.9.0.gem (100%)
Successfully installed cabin-0.9.0
Fetching: backports-3.11.1.gem (100%)
Successfully installed backports-3.11.1
Fetching: arr-pm-0.0.10.gem (100%)
Successfully installed arr-pm-0.0.10
Fetching: clamp-1.0.1.gem (100%)
Successfully installed clamp-1.0.1
Fetching: ffi-1.9.21.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing fpm:
        ERROR: Failed to build gem native extension.

    current directory: /var/lib/gems/2.3.0/gems/ffi-1.9.21/ext/ffi_c
/usr/bin/ruby2.3 -r …
Run Code Online (Sandbox Code Playgroud)

ruby debian ubuntu-16.04

2
推荐指数
1
解决办法
1051
查看次数

在对jthon应用程序引擎执行jQuery.post时,JSON对象未解码

我已经在应用引擎上工作了一段时间,从那以后这个问题一直困扰着我.无法找到解决方案,所以我想问过.

我在app引擎服务器的python中有一个简单的post处理程序.我正在做一个jQuery帖子.两者的代码都是这样的

main.py

import json
...

class SomeHandler(webapp2.RequestHandler):
   def post(self):
      data = json.loads(self.request.body)
      return self.response.out.write(json.dumps(data))
Run Code Online (Sandbox Code Playgroud)

和jQuery帖子

jQuery.post('/quiz',
{name:'some problem 2',desc:'some submitted 2',questions:[{question:'question1'}]},
function(data,textStatus, jqXHR){console.log('POST response: ');console.log(data);});
Run Code Online (Sandbox Code Playgroud)

当我这样做时,我得到以下错误

Traceback (most recent call last):
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1536, in __call__
    rv = self.handle_exception(request, response, e)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1530, in __call__
    rv = self.router.dispatch(request, response)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1278, in default_dispatcher
    return route.handler_adapter(request, response)
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 1102, in __call__
    return handler.dispatch()
  File "/Applications/GoogleAppEngineLauncher.app/Contents/Resources/GoogleAppEngine-default.bundle/Contents/Resources/google_appengine/lib/webapp2/webapp2.py", line 572, in dispatch
    return self.handle_exception(e, self.app.debug)
  File …
Run Code Online (Sandbox Code Playgroud)

jquery google-app-engine json jquery-post python-2.7

1
推荐指数
1
解决办法
1575
查看次数