小编Bla*_*lam的帖子

将 KeyValuePairs 列表传递给 AWS Cloudformation 模板

我正在为 ECS 中运行的一堆 (~75) 微服务​​构建一个 cloudformation 模板。有一个顶级模板将所有微服务作为嵌套堆栈包含在内。我希望所有微服务都使用相同的microservice.yaml模板并使用参数来定义要运行的微服务,而不是为每个服务创建数十个不同的模板文件。

AWSTemplateFormatVersion: '2010-09-09'
Description: Deploy a service into an ECS cluster
Parameters:
  ServiceName:
    Type: String
  ImageUrl:
    Type: String
  LogLevel:
    Type: String
    Default: debug
  NodeEnv:
    Type: String
    Default: integration

Resources:
  TaskDefinition:
    Type: AWS::ECS::TaskDefinition
    Properties:
      RequiresCompatibilities: 
        - EC2
      ContainerDefinitions:
        - Name: !Ref 'ServiceName'
          Image: !Ref 'ImageUrl'
          Environment:
            - Name: LOG_LEVEL
              Value: !Ref 'LogLevel'
            - Name: NODE_ENV
              Value: !Ref 'NodeEnv'

  Service:
    Type: AWS::ECS::Service
    Properties:
      ServiceName: !Ref 'ServiceName'
      Cluster: !ImportValue production-infrastructure:ECSClusterName
      DesiredCount: 1
      TaskDefinition: !Ref 'TaskDefinition' …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services amazon-ecs aws-cloudformation microservices

6
推荐指数
0
解决办法
1220
查看次数

Struts 2 OGNL - 比较validation.xml中的两个字符串值

我是Struts2和OGNL的新手,正在制作一个带注册页面的简单Web应用程序.有两个字段,password并且repassword(重新输入密码)并使用验证框架我想验证两个密码是否匹配(我知道我可以使用JavaScript轻松完成).这是我到目前为止所得到的.所有的现场验证器都工作正常.这是我的第一个非现场验证器,我不能让它工作.

<validator type="expression">
    <param name="expression">${password}!=${repassword}</param>
    <message>Passwords must match.</message>
</validator> 
Run Code Online (Sandbox Code Playgroud)

我试过两个

${password}!=${repassword}
Run Code Online (Sandbox Code Playgroud)

没有

password!=repassword
Run Code Online (Sandbox Code Playgroud)

OGNL标签.

java validation struts2 ognl

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

MongoDB 从数组中获取不同元素,并计算每个元素的出现次数

我的收藏中有以下文件。每个文档都包含推文的文本和从推文中挑选出的一组实体(使用 AWS Comprehend):

{
"text" : "some tweet by John Smith in New York about Stack Overflow",
"entities" : [
    {
        "Type" : "ORGANIZATION",
        "Text" : "stack overflow"
    },
    {
        "Type" : "LOCATION",
        "Text" : "new york"
    },
    {
        "Type" : "PERSON",
        "Text" : "john smith"
    }
  ]
},
{
    "text" : "another tweet by John Smith but this one from California and about Google",
    "entities" : [
    {
        "Type" : "ORGANIZATION",
        "Text" : "google"
    },
    {
        "Type" : "LOCATION", …
Run Code Online (Sandbox Code Playgroud)

group-by mongodb aggregation-framework

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

对于每个文档,从数组中检索带有 $max 字段的对象

我的收藏中有以下文件。每个文档都包含有关特定位置的历史天气数据:

{
'location':'new york', 
'history':[
    {'timestamp':1524542400, 'temp':79, 'wind_speed':1, 'wind_direction':'SW'}
    {'timestamp':1524548400, 'temp':80, 'wind_speed':2, 'wind_direction':'SW'}
    {'timestamp':1524554400, 'temp':82, 'wind_speed':3, 'wind_direction':'S'}
    {'timestamp':1524560400, 'temp':78, 'wind_speed':4, 'wind_direction':'S'}
    ]
},
{
'location':'san francisco', 
'history':[
    {'timestamp':1524542400, 'temp':80, 'wind_speed':5, 'wind_direction':'SW'}
    {'timestamp':1524548400, 'temp':81, 'wind_speed':6, 'wind_direction':'SW'}
    {'timestamp':1524554400, 'temp':82, 'wind_speed':7, 'wind_direction':'S'}
    {'timestamp':1524560400, 'temp':73, 'wind_speed':8, 'wind_direction':'S'}
    ]
},
{
'location':'miami', 
'history':[
    {'timestamp':1524542400, 'temp':84, 'wind_speed':9, 'wind_direction':'SW'}
    {'timestamp':1524548400, 'temp':85, 'wind_speed':10, 'wind_direction':'SW'}
    {'timestamp':1524554400, 'temp':86, 'wind_speed':11, 'wind_direction':'S'}
    {'timestamp':1524560400, 'temp':87, 'wind_speed':12, 'wind_direction':'S'}
    ]
}
Run Code Online (Sandbox Code Playgroud)

我想获取每个位置(或多或少)的最新天气数据列表,如下所示:

{
'location':'new york', 
'history':{'timestamp':1524560400, 'temp':78, 'wind_speed':4, 'wind_direction':'S'}
},
{
'location':'san francisco', 
'history':{'timestamp':1524560400, 'temp':73, …
Run Code Online (Sandbox Code Playgroud)

grouping mongodb aggregation-framework

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