小编vos*_*usa的帖子

使用jquery中的chrome开发人员工具进行Dom异常调试

在使用chrome develper工具启动调试会话时,我一直收到一个dom异常.即使使用这个小的HTML测试文档,这个问题仍然存在:

<!DOCTYPE HTML>
<html lang="en">
<head>
<meta charset="utf-8">
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js">  
    </script>
</head>
<body>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)

异常代码:12消息:"SYNTAX_ERR:DOM Exception 12"

行1904中发生异常:

            try {
                b.call(c.documentElement, "[test!='']:sizzle")
            } catch (f) {
                e = !0
            }
Run Code Online (Sandbox Code Playgroud)

有任何想法吗?我正在使用chrome 19.0.1084.36

jquery html5 google-chrome-devtools domexception

17
推荐指数
2
解决办法
7258
查看次数

如何使用webpack-dev-server代理代理到ssl端点

当我尝试代理此http://localhost:9000/rpc请求时,我收到:

cannot proxy to https://example.appspot.com:80 
  (write EPROTO  101057795:error:140770FC:SSL routines:
  SSL23_GET_SERVER_HELLO:unknown protocol:openssl\ssl\s23_clnt.c:794:)
Run Code Online (Sandbox Code Playgroud)

webpack-dev-derver配置:

devServer: {
    contentBase: "./",
    hostname: 'localhost',
    port: 9000,
    proxy: {
        '/rpc': {
            target: 'https://example.appspot.com',
            secure: false,
            changeOrigin: true     // **Update-2 SOLVED**
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我使用fetch:fetch('/rpc' ...来发出请求,Windows 10专业人员运行webpack.

没有代理:fetch('https://example.com/rpc' ...SSL请求正常.

更新.我不得不使用SSL端口443(参见Steffen的回答).
现在使用:https://example.appspot.com:443

但仍然没有合作secure: true.控制台日志显示:

cannot proxy to https://example.appspot.com:443 
(Hostname/IP doesn't match certificate's altnames: "Host: localhost. 
is not in the cert's altnames: DNS:*.appspot.com, DNS:*.thinkwithgoogle.com, …
Run Code Online (Sandbox Code Playgroud)

javascript ssl proxy webpack webpack-dev-server

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

我们可以将mailchimp与Google网站集成

我在Google网站上创建网站,我想知道我们可以将Mailchimp与Google网站集成.我看到官方邮件黑猩猩集成链接 它说你可以整合

  • Google Ananlytic
  • Google Doc
  • Google通讯录

有人可以告诉我它是否有可能?谢谢 注意:我正在标记PHP和HTML,因为这些大师可能会遇到同样的问题.

html php google-sites mailchimp

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

如何使用app engine SDK提供cloudstorage文件

在app引擎中,我可以使用我的应用程序的默认存储桶来提供像pdf这样的cloudstorage文件:

http://storage.googleapis.com/<appid>.appspot.com/<file_name>
Run Code Online (Sandbox Code Playgroud)

但是,如何在不使用blob_key的情况下在SDK中提供本地cloudstorage文件?

我这样写默认存储桶:

gcs_file_name = '/%s/%s' % (app_identity.get_default_gcs_bucket_name(), file_name)
with gcs.open(gcs_file_name, 'w') as f:
    f.write(data)
Run Code Online (Sandbox Code Playgroud)

SDK ='app_default_bucket'中默认存储桶的名称

在SDK数据存储区中,我有一个:GsFileInfo显示:filename:/app_default_bucket/example.pdf

更新和解决方法:您可以获取非图像文件(如css,js和pdf)的服务URL.

gs_file = '/gs/%s/%s/%s' % (app_identity.get_default_gcs_bucket_name(), folder, filename)
serving_url = images.get_serving_url(blobstore.create_gs_key(gs_file))
Run Code Online (Sandbox Code Playgroud)

python sdk google-app-engine serving google-cloud-storage

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

在 Svelte 中重新启动或重新初始化组件

是否有一种简单的方法可以强制重新启动 Svelte 组件?

重启用例:

  • 清除 HTML 文件输入的文件列表(您无法重置路径/值)
  • 使用 CSS 悬停时,选择项目后导航栏下拉折叠

也许除了重启还有其他解决方案,但让我们在这里使用组件重启。

在适用于上传用例的重启代码下方:

SomeApp.svelte

<script>
      ...
      import Upload from "./upload/Upload.svelte";

      export let uid;  // firebase uid from auth

      // restart the Upload component after the upload 
      // to clear the filename of the <input type="file" ..../>  
      // restart by making use of a dynamic (falsy) component
      let upload_component = Upload;
      let restart = false;

      $: if (restart) {
         // use a falsy to stop / destroy this component 
         upload_component = null; …
Run Code Online (Sandbox Code Playgroud)

svelte svelte-component svelte-3

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

获取带有名称空格的cloudstorage对象的已签名URL时的NoSuchKey

下面的应用引擎代码使用app_identity.sign_blob()来请求已签名的网址.当GCS文件名中没有空格时,此代码可以正常工作.对象名称中允许有空格.为了测试,我使用了SDK.

我已经看到很多关于这个问题的问题,但我无法创建解决方案

这是一个bug还是?

def sign_url(bucket_object, expires_after_seconds=6, bucket=default_bucket):

    method = 'GET'
    gcs_filename = urllib.quote('/%s/%s' % (bucket, bucket_object))
    content_md5, content_type = None, None

    # expiration : number of seconds since epoch
    expiration_dt = datetime.utcnow() +    timedelta(seconds=expires_after_seconds)
    expiration = int(time.mktime(expiration_dt.timetuple()))

    # Generate the string to sign.
    signature_string = '\n'.join([
        method,
        content_md5 or '',
        content_type or '',
        str(expiration),
        gcs_filename])

    signature_bytes = app_identity.sign_blob(signature_string)[1]

    # Set the right query parameters. we use a gae service account for the id
    query_params = {'GoogleAccessId': google_access_id,
                    'Expires': …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine python-2.7 google-cloud-storage

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

寻找发送原始邮件(包括附件)的Amazon SES示例

亚马逊SES文档对我来说并不清楚.因此,如果您可以通过示例发送原始文本电子邮件(包括PDF附件)来帮助我,这将对我有所帮助.我使用Python 2.5和Google App引擎.我必须使用"raw",因为如果我包含附件,这是唯一的SES选项.

我现在的问题:

  • 帖子请求的内容是什么.
  • 我应该在标题中添加哪些消息字段.
  • 如何处理"returnPath".
  • 如何处理文本正文.它应该是:Content-Type:text/plain; 字符集= UTF-8; 格式=流动; delsp = YES.内容传输编码:base64
  • 如何为此帖子构建HMAC签名.我知道如何签名,但原始字符串如何查找签名函数.

python email google-app-engine amazon-web-services amazon-ses

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

如何通过谷歌应用引擎写入谷歌驱动器上的现有文件?

我正在尝试创建一个带有额外菜单的谷歌电子表格。该菜单将触发一个操作,该操作将创建自定义的内容字符串。该字符串需要写入已存储在谷歌驱动器上的现有文本文件中。

在寻找可能的解决方案时,我研究了驱动应用程序文件类和blob类,但我不知道如何完成这项工作。

我能够检索现有文件(顺便说一句,这是纯文本)并显示其内容:

    var file = DriveApp.getFileById("EXISTING_FILE_ID");
    var fileContent = file.getBlob().getDataAsString();
Run Code Online (Sandbox Code Playgroud)

但我不知道如何覆盖现有文件。它不是创建新文件的选项,我需要坚持使用特定的 ID。电子表格和书面文件都将在我的云端硬盘中归我所有,并公开共享。其他用户将修改电子表格,因此需要更新文件。

后备计划: 如果有其他方法可以通过 dropbox 等路径(而不是通过 id)访问此文件,则可以删除并重新创建该文件。这种访问如何可能?

google-apps-script

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

应用引擎上的云存储和安全下载策略。GCS acl 或 blobstore

我的 appengine 应用程序创建了云存储文件。这些文件将由第三方下载。这些文件包含个人医疗信息

下载的首选方式是什么:

  1. 使用带有用户 READER acl 的直接 GCS 下载链接。
  2. 或者在 appengine 应用中使用 blobstore 下载处理程序。

这两种解决方案都需要第三方登录(谷歌登录)。性能不是问题。隐私和安全错误和错误的发生。

使用加密的 zip 文件下载是一种选择。这意味着我必须将密码存储在项目中。或者通过电子邮件发送一个随机密码?

更新我用来创建签名下载 url 的 appengine 代码

import time
import urllib
from datetime import datetime, timedelta
from google.appengine.api import app_identity
import os
import base64

API_ACCESS_ENDPOINT = 'https://storage.googleapis.com'

# Use the default bucket in the cloud and not the local SDK one from app_identity
default_bucket = '%s.appspot.com' % os.environ['APPLICATION_ID'].split('~', 1)[1]
google_access_id = app_identity.get_service_account_name()


def sign_url(bucket_object, expires_after_seconds=60):
    """ cloudstorage signed url to download …
Run Code Online (Sandbox Code Playgroud)

authentication google-app-engine acl blobstorage google-cloud-storage

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

为什么我们要注册自定义元素

当我们使用聚合物或 x-tag 时,我们必须注册一个新元素。但是为什么,如果我们可以使用普通的 es6 javascript 来构建一个没有 registerElement 的阴暗组件。这在最新版本的 Chrome、Firefox 和 Edge 中运行良好,无需使用 polyfill 或转译为 es5。

<a-custom-element id="aid"></a-custom-element>

<template id="a-custom-element">  
    ....  // html
</template>
Run Code Online (Sandbox Code Playgroud)

我使用这个函数来初始化(挂载)组件类实例:

function mountCustomElement(custom_tag, custom_class) {
    Array.from(document.querySelectorAll(custom_tag)).forEach((element) => {
            new custom_class(element, custom_tag);
    });
}
document.addEventListener("DOMContentLoaded", function () {
    ....
    mountCustomElement('a-custom-element', AComponent);
    ....
}); 
Run Code Online (Sandbox Code Playgroud)

组件类:

class AComponent {             // without the extend HTMLElement !!
    constructor(custom_element, template_id) {

        this.id = custom_element.id;
        let content = document.querySelector(`#${template_id}`).content;
        // for easy inspection
        AComponent.hasOwnProperty('instances') ?Acomponent.instances.push(this) :AComponent.instances = [this];

        ....
        let $root = document.querySelector(`#${this.id}`);
        $root.appendChild(document.importNode(content, …
Run Code Online (Sandbox Code Playgroud)

javascript web-component ecmascript-6 x-tag polymer

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