我使用 CloudFormation/AWS SAM 创建了 RDS 数据库和 Lambda 函数。我目前通过环境变量传递数据库连接信息,但不确定这是否是推荐的方式,因为在 AWS 仪表板中,我可以以明文形式看到密码
TestApiFunction:
Type: AWS::Serverless::Function
DependsOn: DB
Properties:
Handler: src/test.handler
FunctionName: Test
VpcConfig:
SecurityGroupIds:
- !Ref DataTierSecurityGroup
SubnetIds:
- !Ref PrivateSubnet1
- !Ref PrivateSubnet2
- !Ref PrivateSubnet3
Environment:
Variables:
'DB_HOST': !GetAtt DB.Endpoint.Address
'DB_USER': !Ref DBUser
'DB_PASSWORD': !Ref DBPassword
Run Code Online (Sandbox Code Playgroud) 我已经设置了自定义资源,以在删除后立即返回
const aws = require('aws-sdk')
const util = require('util')
exports.handler = (event, context) => {
console.log('Event>>>')
console.log(JSON.stringify(event))
aws.config.update({ region: event.ResourceProperties.Region })
if (event.RequestType === 'Delete') return ApiMethodCustom.sendResponse(event, context, 'SUCCESS') // HERE!
ApiMethodCustom.setupIntegration(event, context)
}
static async sendResponse(event, context, responseStatus, responseData = {}) {
var responseBody = JSON.stringify({
Status: responseStatus,
Reason: "See the details in CloudWatch Log Stream: " + context.logStreamName,
PhysicalResourceId: context.logStreamName,
StackId: event.StackId,
RequestId: event.RequestId,
LogicalResourceId: event.LogicalResourceId,
Data: responseData
});
console.log("RESPONSE BODY:\n", responseBody);
var https = require("https");
var url …Run Code Online (Sandbox Code Playgroud) I am trying to create a CloudSQL instance using terraform but its not even trying to create it appears: The CloudSQL dashboard doesnt change
google_sql_database_instance.db-instance: Still creating... [9m41s elapsed]
google_sql_database_instance.db-instance: Still creating... [9m51s elapsed]
google_sql_database_instance.db-instance: Still creating... [10m1s elapsed]
Run Code Online (Sandbox Code Playgroud)
It eventually timesout. Why is that?
resource "google_sql_database_instance" "db-instance" {
# depends_on = [google_service_networking_connection.private-vpc-connection]
name = "sonarqube"
database_version = "POSTGRES_9_6"
region = "asia-southeast1"
settings {
tier = "db-f1-micro"
# ip_configuration {
# private_network = google_compute_network.private-network.self_link
# }
}
}
Run Code Online (Sandbox Code Playgroud)
I even …
我正在尝试使用插件无限滚动
它需要选择器用于下一页链接.我想如果导航如下,
<ul>
<li><a href="#" class="active">page 1</a></li>
<li><a href="#" class="next">page 2</a></li>
<li><a href="#">page 3</a></li>
<li><a href="#">page 4</a></li>
<li><a href="#">page 5</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
我可以"a.next"用作下一页的选择器.但如果我的页面导航标记如下,没有.next该类,会发生什么
<ul>
<li><a href="#" class="active">page 1</a></li>
<li><a href="#">page 2</a></li>
<li><a href="#">page 3</a></li>
<li><a href="#">page 4</a></li>
<li><a href="#">page 5</a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
如何选择页面2链接,假设.active表示当前页面
我有像标记
这里显示
我想知道为什么它看起来像第12和第13行
.notes:link span,
.notes:visited span { ...
Run Code Online (Sandbox Code Playgroud)
好像它的工作
.comments span,
background-position: -16px -16px;
}
.permalink:link span,
.permalink:visited span {
background-position: -32px -16px;
}
Run Code Online (Sandbox Code Playgroud)
似乎它不存在
由于某种原因,cssdesk似乎在下面的案例代码中...
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title></title>
<style>
.notes:link span,
.notes:visited span,
.comments span,
.permalink:link span,
.permalink:visited span {
background: url("http://static.tumblr.com/ikeq9mi/F6Tl4vrjj/metasprite.jpg") no-repeat;
padding-right: 16px; /* width */
font-size: 15px; /* height */
margin: 0 2px;
position: relative;
top: -1px;
}
.notes:link span,
.notes:visited span {
background-position: 0 -16px;
}
.comments span, …Run Code Online (Sandbox Code Playgroud) 我不知道我是否这样做
foreach (func_to_return_array() as $item) { ... }
Run Code Online (Sandbox Code Playgroud)
它会func_to_return_array()多次调用(数组长度)吗?如果它,我猜它会更好用
$arr = func_to_return_array();
foreach ($arr as $item) { ... }
Run Code Online (Sandbox Code Playgroud) 我是C#的新手并且正在读这篇文章
protected:仅派生类型或相同类型的成员.internal:只有同一程序集中的代码.也可以是对象外部的代码,只要它在同一个程序集中.(类型的默认值)protected internal:来自派生类型的代码或同一程序集中的代码.受保护的OR内部组合.什么protected internal是?不internal还允许派生类型来访问的变量?
什么是集会?
我是c#的新手.主要来自PHP背景或基本VB.
我明白IEnumerable<Customer>这就像是一个客户名单.
但是是什么Action<IEnumerable<Customer>, Exception>.类型IEnumerable<Customer>&的动作Exception.似乎对我来说没什么意义.
在C#中,差异是什么
var obj = (Array)Something
Run Code Online (Sandbox Code Playgroud)
VS
var obj = Something as Array
Run Code Online (Sandbox Code Playgroud) 所以我有一个颜色选择器.用户可以使用RGB或HSB选择颜色.每个值都有滑块/属性.例如,当用户设置红色时,我将计算HSB值以反映新的颜色值.当用户设置Hue时,将从HSB值重新计算RGB值.但是看到那里有一个循环.当我组RGB它必须重新计算HSB值,OK,到目前为止,但它也意味着HSB值将改变导致重新RGB值再次更新.我认为这是问题所在,但我该如何解决这个问题呢?
我使用的一个可能的解决方案是标记,不是非常易读,但它的工作原理.基本上,当我设置属性时,我还设置了一个标志来表示我正在设置一个值
public float Hue {
get { return _hue; }
set
{
if (_hue == value)
return;
CurrentlySetting = (CurrentlySetting.HasValue) ? CurrentlySetting : ColorType.HSB;
_hue = value;
NotifyPropertyChanged("Hue");
NotifyPropertyChanged("Color");
RecalculateRGB();
CurrentlySetting = (CurrentlySetting == ColorType.HSB) ? null : CurrentlySetting;
}
}
Run Code Online (Sandbox Code Playgroud)
当我"重新计算"值时,我会检查并确保我当前没有设置它们
protected void RecalculateRGB(Color color = new Color())
{
if (CurrentlySetting == ColorType.RGB) // prevent stackoverflow
return;
if (color == new Color())
color = HSBColorHelper.FromAHSB(255, Hue, Saturation, Brightness);
Red = color.R;
Green = color.G;
Blue = color.B; …Run Code Online (Sandbox Code Playgroud)