我正在gcloudGoogle Cloud Shell 中使用该命令。我正在关注的教程以及文档(https://cloud.google.com/sdk/gcloud/reference/compute/zones/list)表示,要以表格形式列出所有区域,您应该使用此命令:
gcloud compute zones list
Run Code Online (Sandbox Code Playgroud)
当我运行它时,结果不是在表格中列出,而是如下所示:
NAME: us-west2-b
REGION: us-west2
STATUS: UP
NEXT_MAINTENANCE:
TURNDOWN_DATE:
NAME: us-west2-c
REGION: us-west2
STATUS: UP
NEXT_MAINTENANCE:
TURNDOWN_DATE:
NAME: us-west3-a
REGION: us-west3
STATUS: UP
NEXT_MAINTENANCE:
TURNDOWN_DATE:
Run Code Online (Sandbox Code Playgroud)
这是一个全新的原始 Google Cloud 帐户。Google 是否更改了命令的默认输出格式list?
这是我的表架构:
CREATE TABLE tickers (
product_id TEXT NOT NULL,
trade_id INT NOT NULL,
sequence BIGINT NOT NULL,
time TIMESTAMPTZ,
price NUMERIC NOT NULL,
side TEXT NOT NULL,
last_size NUMERIC NOT NULL,
best_bid NUMERIC NOT NULL,
best_ask NUMERIC NOT NULL,
PRIMARY KEY (product_id, trade_id)
);
Run Code Online (Sandbox Code Playgroud)
我的应用程序在“ticker”频道上订阅了 Coinbase Pro 的 websocket,并在收到消息时在行情表中插入一行。
该表现在有近 200 万行。
我认为运行SELECT DISTINCT product_id FROM tickers会很快,但它需要大约 500 到 600 毫秒。这是来自的输出EXPLAIN ANALYZE:
HashAggregate (cost=47938.97..47939.38 rows=40 width=8) (actual time=583.105..583.110 rows=40 loops=1)
Group Key: product_id
-> Seq Scan …Run Code Online (Sandbox Code Playgroud) sql postgresql query-optimization database-performance postgresql-performance
这似乎是我将 iPod Touch 升级到 iOS 15 (15.0.1) 后出现的问题。
运行下面的示例时,它在第一次加载时工作正常,可以根据需要多次播放声音。但是,如果我锁定 iPod Touch 的屏幕,然后在几分钟后返回,则声音将不再播放。为了排除故障,我在 AudioContext 实例上设置了状态更改侦听器,并验证 Safari 是否将状态设置回设置running为interrupted屏幕锁定时的状态。然而,声音没有播放。
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>audio-test</title>
</head>
<body>
<script>
const AudioContext = window.AudioContext || window.webkitAudioContext;
const audioContext = new AudioContext();
// Create AudioBuffer and fill with two seconds of white noise.
const channels = 2;
const frameCount = audioContext.sampleRate * 2.0;
const audioBuffer = audioContext.createBuffer(channels, frameCount, audioContext.sampleRate);
for (var channel = 0; channel < …Run Code Online (Sandbox Code Playgroud) 我开始编写一个通用 TypeScript 函数,该函数将类构造函数以及构造函数所需的任何参数作为参数,并返回该类的新实例。我的要求之一是返回类型和构造函数参数类型必须由编译器推断。
经过一番尝试和错误后,我想出了一个工作版本,它似乎可以满足我的需要(见下文)。但是,有没有更好的方法来实现这一目标呢?
function instantiate<Params extends any[], Instance>(
ctor: new (...args: Params) => Instance, ...args: Params
) {
return new ctor(...args);
}
Run Code Online (Sandbox Code Playgroud)
用法示例:
class Circle {
constructor(public radius: number) {}
}
class Rectangle {
constructor(public width: number, public height: number) {}
}
const circle = instantiate(Circle, 5);
const rectangle = instantiate(Rectangle, 3, 7);
Run Code Online (Sandbox Code Playgroud)