小编Aru*_*pta的帖子

在WebSocket中接收Blob并在Canvas中呈现为图像

我正在构建一个简单的WebSocket应用程序,它将当前画布的二进制快照传输给其他侦听器.

使用WebSocket将当前画布快照发送为:

var image = context.getImageData(0, 0, canvas.width, canvas.height);
var buffer = new ArrayBuffer(image.data.length);
var bytes = new Uint8Array(buffer);
for (var i=0; i<bytes.length; i++) {
    bytes[i] = image.data[i];
}
websocket.send(buffer);
Run Code Online (Sandbox Code Playgroud)

尝试将接收端的数据呈现为:

var bytes = new Uint8Array(blob.size);
var image = context.createImageData(canvas.width, canvas.height);
for (var i=0; i<image.length; i++) {
    image[i] = bytes[i];
}
context.drawImage(image, 0, 0);
Run Code Online (Sandbox Code Playgroud)

正确接收blob但仍未呈现图像.

任何的想法 ?

javascript websocket

12
推荐指数
2
解决办法
2万
查看次数

使用gcloud创建一个新的Google Cloud项目

根据https://cloud.google.com/sdk/gcloud/reference/init gcloud init myproject命令中的文档不起作用.

google-cloud> gcloud init myproject Initialized gcloud directory in [/Users/arungupta/workspaces/google-cloud/myproject/.gcloud]. Cloning [https://source.developers.google.com/p/myproject/r/default] into [default]. Cloning into '/Users/arungupta/workspaces/google-cloud/myproject/default'... fatal: remote error: Repository not found. You may need to create a repository for this project using the Source Code tab at https://console.developers.google.com ERROR: Command '['git', 'clone', 'https://source.developers.google.com/p/myproject/r/default', '/Users/arungupta/workspaces/google-cloud/myproject/default', '--config', 'credential.helper=gcloud.sh']' returned non-zero exit status 128 ERROR: Unable to initialize project [myproject], cleaning up [/Users/arungupta/workspaces/google-cloud/myproject]. ERROR: (gcloud.init) Unable to initialize project [myproject].

使用gcloud init minecraft-server --project minecraft-server-183 …

google-compute-engine gcloud

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

在github上缺少通知

我跟着线程:

如何收到有关新GitHub问题的通知?

"通知中心"已通过电子邮件和Web检查参与和观看和通知电子邮件也是正确的.

但我没有收到任何关于任何推送到我的github存储库的通知:

https://github.com/arun-gupta/javaee7-samples

甚至没有收到任何问题的通知.这是一个单独的项目,而不是团队.

如何启用基本通知,以便收到任何推送到存储库的电子邮件以及任何问题的更新?

notifications github

6
推荐指数
2
解决办法
5450
查看次数

来自artifactId的Camel案例文件名为Maven原型?

对于Maven原型,采用怎样骆驼情况下,生成的文件名${artifactId}archetype-metadata.xml?例如,sample-my应该给SampleMy.java.

我认为这需要一个速度模板,但这需要指定一个宏archetype-metadata.xml.可以在pluginApp .java中创建宏,如下所示:

https://github.com/arun-gupta/spigot-archetype/blob/master/src/main/resources/archetype-resources/src/main/java/ pluginApp .java#L4-L7

怎么办archetype-metadata.xml

有问题的确切片段位于:

https://github.com/arun-gupta/spigot-archetype/blob/master/src/main/resources/META-INF/maven/archetype-metadata.xml#L14

velocity archetypes maven minecraft

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

AWS CLI:Lambda无法假定为该函数定义的角色

AWS CLI版本:

aws --version
aws-cli/1.11.21 Python/2.7.12 Darwin/15.3.0 botocore/1.4.78
Run Code Online (Sandbox Code Playgroud)

尝试创建Lambda函数并获取错误:

An error occurred (InvalidParameterValueException) when calling the CreateFunction operation: The role defined for the function cannot be assumed by Lambda.
Run Code Online (Sandbox Code Playgroud)

角色创建为:

aws iam create-role --role-name microrole --assume-role-policy-document file://./trust.json
Run Code Online (Sandbox Code Playgroud)

trust.json 是:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "Service": "lambda.amazonaws.com"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}
Run Code Online (Sandbox Code Playgroud)

政策附件如下:

aws iam put-role-policy --policy-document file://./policy.json --role-name microrole --policy-name micropolicy
Run Code Online (Sandbox Code Playgroud)

policy.json 是:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "logs:CreateLogGroup", …
Run Code Online (Sandbox Code Playgroud)

security amazon-web-services aws-cli aws-lambda serverless-architecture

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

AccessDeniedException:无法确定要授权的服务/操作名称

使用AWS CLI

aws --version
aws-cli/1.11.21 Python/2.7.12 Darwin/15.3.0 botocore/1.4.78
Run Code Online (Sandbox Code Playgroud)

按照https://github.com/arun-gupta/serverless/tree/master/aws/microservice#post-method中的说明为API网关创建POST方法.可以使用test-invoke-methodAWS Console 成功调用此方法.

使用AWS CLI创建GET方法https://github.com/arun-gupta/serverless/tree/master/aws/microservice#get-method.使用test-invoke-method和AWS Console 调用此方法会出现以下错误:

{
    "status": 500,
    "body": "{\"message\": \"Internal server error\"}",
    "log": "Execution log for request test-request\nThu Dec 29 00:58:56 UTC 2016 : Starting execution for request: test-invoke-request\nThu Dec 29 00:58:56 UTC 2016 : HTTP Method: GET, Resource Path: /books\nThu Dec 29 00:58:56 UTC 2016 : Method request path: {}\nThu Dec 29 00:58:56 UTC 2016 : Method request query string: …
Run Code Online (Sandbox Code Playgroud)

aws-cli aws-lambda aws-api-gateway serverless-architecture

6
推荐指数
2
解决办法
9006
查看次数

创建实例时,gcloud compute instances create命令失败

使用创建实例gcloud似乎不起作用: google-cloud> gcloud compute instances create minecraft-instance --image ubuntu-14-10 --tags minecraft NAME ZONE MACHINE_TYPE INTERNAL_IP EXTERNAL_IP STATUS ERROR: (gcloud.compute.instances.create) Unable to fetch a list of zones. Specifying [--zone] may fix this issue: - Project marked for deletion.

添加区域名称的方式不同: google-cloud> gcloud compute instances create minecraft-instance --image ubuntu-14-10 --zone us-central1-a --tags minecraft NAME ZONE MACHINE_TYPE INTERNAL_IP EXTERNAL_IP STATUS ERROR: (gcloud.compute.instances.create) Failed to find image for alias [ubuntu-14-10] in public image project [ubuntu-os-cloud]. - Project marked for deletion.

提供不同的图像名称也会失败: google-cloud> gcloud …

google-compute-engine

5
推荐指数
2
解决办法
9744
查看次数

为 Docker 守护进程分配标签

如何为 Ubuntu 上已经运行的 Docker 守护进程分配标签?

尝试:

export DOCKER_OPTS="--label=com.example.storage=ssd"
sudo restart docker
Run Code Online (Sandbox Code Playgroud)

但没有帮助。docker info需要显示Labels

docker

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

Docker for Mac 的 Docker 守护进程日志

这类似于Docker 守护进程日志在哪里?. 但更多的是Docker Desktop for Mac

在哪里可以找到Docker Desktop for Mac的守护进程日志?

macos docker docker-for-mac docker-desktop

4
推荐指数
2
解决办法
7026
查看次数

无法在区域/可用区中创建 EBS

尝试将 EBS 块存储创建为:

aws ec2 create-volume --region us-west-1 --availability-zone us-west-2a --size 5 --volume-type gp2
Run Code Online (Sandbox Code Playgroud)

但这给出了一个错误:

A client error (InvalidZone.NotFound) occurred when calling the CreateVolume operation: The zone 'us-west-2a' does not exist.
Run Code Online (Sandbox Code Playgroud)

创建实例时查看无效可用区但没有帮助。

有什么线索吗?

amazon amazon-ec2 amazon-web-services

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

SSH进入在亚马逊上运行的Kubernetes集群

创建了一个2节点Kubernetes集群:

KUBERNETES_PROVIDER=aws NUM_NODES=2 kube-up.sh
Run Code Online (Sandbox Code Playgroud)

这显示输出为:

Found 2 node(s).
NAME                                         STATUS    AGE
ip-172-20-0-226.us-west-2.compute.internal   Ready     57s
ip-172-20-0-227.us-west-2.compute.internal   Ready     55s
Validate output:
NAME                 STATUS    MESSAGE              ERROR
controller-manager   Healthy   ok                   
scheduler            Healthy   ok                   
etcd-0               Healthy   {"health": "true"}   
etcd-1               Healthy   {"health": "true"}   
Cluster validation succeeded
Done, listing cluster services:

Kubernetes master is running at https://52.33.9.1
Elasticsearch is running at https://52.33.9.1/api/v1/proxy/namespaces/kube-system/services/elasticsearch-logging
Heapster is running at https://52.33.9.1/api/v1/proxy/namespaces/kube-system/services/heapster
Kibana is running at https://52.33.9.1/api/v1/proxy/namespaces/kube-system/services/kibana-logging
KubeDNS is running at https://52.33.9.1/api/v1/proxy/namespaces/kube-system/services/kube-dns
kubernetes-dashboard is running at https://52.33.9.1/api/v1/proxy/namespaces/kube-system/services/kubernetes-dashboard
Grafana is running at https://52.33.9.1/api/v1/proxy/namespaces/kube-system/services/monitoring-grafana …
Run Code Online (Sandbox Code Playgroud)

ssh amazon-ec2 kubernetes

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