笑咖

文章 评论 浏览 28

笑咖 2025-02-21 00:46:24

我认为您需要:

set constraints all deferred;

来源: https:> https:// /docs/current/sql-set-constraints.html

I think you need:

set constraints all deferred;

Source: https://www.postgresql.org/docs/current/sql-set-constraints.html

Alter Sesse设置约束= EDB/ Postgres中的递延等效量

笑咖 2025-02-20 21:37:02

使用符合条件和条件聚合:

SELECT *
FROM tab
QUALIFY COUNT_IF(COUNTRY = 'US') OVER(PARTITION BY PET) > 0
   AND COUNT(*) OVER(PARTITION BY PET) > 1;

count_if(country ='us')(pet分区)> 0 - 组中至少必须是我们的

计数(*)(pet)> 1 - 每行PET

样本数据:

CREATE OR REPLACE TABLE tab(ID INT,PET TEXT,COUNTRY TEXT)
AS
SELECT * FROM VALUES (45,'DOG','US'),    (72,'DOG','CA'),
(15,'CAT','CA'),     (36,'CAT','US'),    (21,'SNAKE','FR'),
(12,'SNAKE','IN'),   (20,'PIG','US'),    (14,'PIG','RS'),
(33,'HORSE','IQ'),   (90,'HORSE','ID');

输出:

”在此处输入图像描述”

Using QUALIFY and conditional aggregation:

SELECT *
FROM tab
QUALIFY COUNT_IF(COUNTRY = 'US') OVER(PARTITION BY PET) > 0
   AND COUNT(*) OVER(PARTITION BY PET) > 1;

COUNT_IF(COUNTRY = 'US') OVER(PARTITION BY PET) > 0 - at least one row in the group has to be US

COUNT(*) OVER(PARTITION BY PET) > 1 - more than one row per pet

Sample data:

CREATE OR REPLACE TABLE tab(ID INT,PET TEXT,COUNTRY TEXT)
AS
SELECT * FROM VALUES (45,'DOG','US'),    (72,'DOG','CA'),
(15,'CAT','CA'),     (36,'CAT','US'),    (21,'SNAKE','FR'),
(12,'SNAKE','IN'),   (20,'PIG','US'),    (14,'PIG','RS'),
(33,'HORSE','IQ'),   (90,'HORSE','ID');

Output:

enter image description here

如何过滤雪花内的一对行

笑咖 2025-02-20 02:10:24

使用以下步骤,我根据您的问题文本创建了一个示例图。

g.addV('Student').property('id','S1').as('s1').
  addV('Student').property('id','S2').as('s2').
  addV('Student').property('id','S3').as('s3').
  addV('Student').property('id','S4').as('s4').
  addV('Student').property('id','S5').as('s5').
  addV('Skill').property('SkillName','cricket').as('cr').
  addV('Skill').property('SkillName','football').as('fo').
  addV('Skill').property('SkillName','golf').as('go').
  addV('Skill').property('SkillName','volleyball').as('vo').
  addE('HAS_SKILL').from('s1').to('cr').
  addE('HAS_SKILL').from('s1').to('fo').
  addE('HAS_SKILL').from('s2').to('fo').
  addE('HAS_SKILL').from('s2').to('go').
  addE('HAS_SKILL').from('s3').to('fo').
  addE('HAS_SKILL').from('s3').to('cr').
  addE('HAS_SKILL').from('s3').to('vo').
  addE('HAS_SKILL').from('s4').to('cr').
  addE('HAS_SKILL').from('s5').to('fo') 

这些步骤构建了一个看起来像

“示例图”

然后我们可以使用这些行沿着查询找到常见技能列表。

g.V().has('Student','id','S1').
      out('HAS_SKILL').as('common').
      in('HAS_SKILL').
      group().
        by('id').
        by(select('common').values('SkillName').fold()).unfold()

从这些构建块中产生的是

{'S3': ['cricket', 'football']}
{'S4': ['cricket']}
{'S5': ['football']}
{'S1': ['cricket', 'football']}
{'S2': ['football']}

您可以获取计数和任何其他必需的信息。

g.V().has('Student','id','S1').
      out('HAS_SKILL').as('common').
      in('HAS_SKILL').
      group().
        by('id').
        by(select('common').values('SkillName').fold()).
      unfold().
      project('id','count','skills').
        by(keys).
        by(select(values).count(local)).
        by(select(values)).
      order().
        by('count',desc)

这给了我们最终的结果

{'id': 'S3', 'count': 2, 'skills': ['cricket', 'football']}
{'id': 'S1', 'count': 2, 'skills': ['cricket', 'football']}
{'id': 'S4', 'count': 1, 'skills': ['cricket']}
{'id': 'S5', 'count': 1, 'skills': ['football']}
{'id': 'S2', 'count': 1, 'skills': ['football']}

Using the steps below, I created a sample graph based on your question text.

g.addV('Student').property('id','S1').as('s1').
  addV('Student').property('id','S2').as('s2').
  addV('Student').property('id','S3').as('s3').
  addV('Student').property('id','S4').as('s4').
  addV('Student').property('id','S5').as('s5').
  addV('Skill').property('SkillName','cricket').as('cr').
  addV('Skill').property('SkillName','football').as('fo').
  addV('Skill').property('SkillName','golf').as('go').
  addV('Skill').property('SkillName','volleyball').as('vo').
  addE('HAS_SKILL').from('s1').to('cr').
  addE('HAS_SKILL').from('s1').to('fo').
  addE('HAS_SKILL').from('s2').to('fo').
  addE('HAS_SKILL').from('s2').to('go').
  addE('HAS_SKILL').from('s3').to('fo').
  addE('HAS_SKILL').from('s3').to('cr').
  addE('HAS_SKILL').from('s3').to('vo').
  addE('HAS_SKILL').from('s4').to('cr').
  addE('HAS_SKILL').from('s5').to('fo') 

Those steps build a graph that looks like this

Sample Graph

We can then find the list of common skills using a query along these lines.

g.V().has('Student','id','S1').
      out('HAS_SKILL').as('common').
      in('HAS_SKILL').
      group().
        by('id').
        by(select('common').values('SkillName').fold()).unfold()

Which produces

{'S3': ['cricket', 'football']}
{'S4': ['cricket']}
{'S5': ['football']}
{'S1': ['cricket', 'football']}
{'S2': ['football']}

From these building blocks you can then get the counts and any other required information.

g.V().has('Student','id','S1').
      out('HAS_SKILL').as('common').
      in('HAS_SKILL').
      group().
        by('id').
        by(select('common').values('SkillName').fold()).
      unfold().
      project('id','count','skills').
        by(keys).
        by(select(values).count(local)).
        by(select(values)).
      order().
        by('count',desc)

Which gives us the final result

{'id': 'S3', 'count': 2, 'skills': ['cricket', 'football']}
{'id': 'S1', 'count': 2, 'skills': ['cricket', 'football']}
{'id': 'S4', 'count': 1, 'skills': ['cricket']}
{'id': 'S5', 'count': 1, 'skills': ['football']}
{'id': 'S2', 'count': 1, 'skills': ['football']}

如何找到常见的顶点计数并在Gremlin中对结果进行排序?

笑咖 2025-02-19 23:43:30

经过大量调试,我能够找到自己的错误。在users.module.ts中,我有此代码:

@Module({
  imports: [TypeOrmModule.forRoot()],
  controllers: [UsersController],
  providers: [UsersService]
})
export class UsersModule {}

我用typeormmodule.forroot()storageModule 开始工作。问题在于,使用typeormmodule.forroot()作为空白,它无法使用storageModule中提供的任何配置
正确的一个:

@Module({
  imports: [StorageModule],
  controllers: [UsersController],
  providers: [UsersService]
})
export class UsersModule {}

After much debugging, I was able to find my mistake. in the users.module.ts I had this code:

@Module({
  imports: [TypeOrmModule.forRoot()],
  controllers: [UsersController],
  providers: [UsersService]
})
export class UsersModule {}

I replaced TypeOrmModule.forRoot() with StorageModule and it started working. The problem was that with TypeOrmModule.forRoot() as blank, it wasn't able to utilize any configuration that was provided in StorageModule
The correct one is below:

@Module({
  imports: [StorageModule],
  controllers: [UsersController],
  providers: [UsersService]
})
export class UsersModule {}

UNALE可以连接到Typeorm的Postgres

笑咖 2025-02-19 12:24:28

所需的解决方案包括以下步骤:

  1. 您需要将阶段定义为根级别的参数:

     参数: 
      阶段:
        默认值:dev
        描述:API网关部署的散打
        类型:字符串
    
    资源...
     
  2. 在资源定义中使用(!ref)添加(!ref)的参考文献:

     资源:
      APIGATEWAAPI:
        类型:aws :: serverless :: api
        特性:
          端点配置:区域
          Stagename:!ref阶段
          开放式:“ 3.0”
          名称:asaf_api_second
          描述:“我来自山姆的API”
     
  3. 要部署到prod时,使用CLI或TOML文件中的部署命令中覆盖所需的阶段参数:

      SAM部署 - 参数跨越阶段= prod
     

The required solution includes the following steps:

  1. You will need to define the stage as a parameter in the root level:

    Parameters: 
      stage:
        Default: dev
        Description: StageName of API Gateway deployment
        Type: String
    
    Resources...
    
  2. Add a reference using (!Ref) to the stage parameter name in the resource definition:

    Resources:
      ApiGatewayApi:
        Type: AWS::Serverless::Api
        Properties:
          EndpointConfiguration: REGIONAL
          StageName: !Ref stage
          OpenApiVersion: "3.0"
          Name: asaf_api_second
          Description: "my api from sam"
    
  3. When you want to deploy to prod, override the required stage parameter in the deploy command using cli or in the toml file:

    sam deploy --parameter-overrides stage=prod
    

如何使用SAM到SPESIFIC阶段部署到AWS而不影响其他阶段?

笑咖 2025-02-19 01:22:25

只有使用工作中的条件才有可能。

It's only possible using the conditional on the job.

github动作:如何在合并分支名称上滤波的pull_request事件上触发工作流程

笑咖 2025-02-18 20:08:00

您应该调用appendchild on option而不是q

var option = document.createElement('li');
        var checkbox = document.createElement('input');
        var label = document.createElement('label')
        var checkBoxId = "checkbox" + "" + questionNumber + subquestionNumber;
        checkbox.type = "checkbox";
        checkbox.id = checkBoxId;
        option.className = "optionName";
        label.htmlFor = checkBoxId;
        checkBoxId.htmlFor = option;
        label.appendChild(document.createTextNode('Option ' + subquestionNumber));
        option.appendChild(label); //add `label` to `li`
        option.appendChild(checkbox); //add `checkbox` to `li`
        q.appendChild(option)

You should call appendChild on option instead of q

var option = document.createElement('li');
        var checkbox = document.createElement('input');
        var label = document.createElement('label')
        var checkBoxId = "checkbox" + "" + questionNumber + subquestionNumber;
        checkbox.type = "checkbox";
        checkbox.id = checkBoxId;
        option.className = "optionName";
        label.htmlFor = checkBoxId;
        checkBoxId.htmlFor = option;
        label.appendChild(document.createTextNode('Option ' + subquestionNumber));
        option.appendChild(label); //add `label` to `li`
        option.appendChild(checkbox); //add `checkbox` to `li`
        q.appendChild(option)

如何将元素添加到不同的< li>

笑咖 2025-02-18 19:33:04

在文件夹结构中的IDE中,转到test/java< - 右键单击​​,然后单击“在Java中运行测试” 在此处输入图像描述
这就是我在Intellij中运行所有测试的方式。

我不知道您提到的错误,但是我遇到类似错误的时间是因为我需要设置环境变量。如果是这种情况,而不是单击“在Java中运行测试”,则转到“更多运行/调试 - > modify Run Configuration”,并在相应的字段中设置您的环境变量。
在此处输入图像描述

In the IDE in the folder structure go to test/java <-- right click and then click "Run test in java" enter image description here.
This is how I run all the tests in IntelliJ.

I don't know about the error you mention, but the times I've gotten a similar error is because I needed to set up environment variables. If that's the case instead of click on "Run test in java" go to "More Run/Debug --> Modify Run Configuration" and there set your environment variables in the corresponding field.
enter image description here

如何在Spring Boot应用程序中运行所有JUNIT测试?

笑咖 2025-02-18 18:35:33

最常见的原因是您的表单上有一些不受管理的解决方案层,可以检查并删除它,更多详细信息

The most common reason is that you have some unmanaged solution layer(s) on your form, you can check and delete it, more detail here

CRM 365-托管解决方案导入不会删除事件处理程序

笑咖 2025-02-18 13:16:27

如果这找不到文件夹,则可以创建一个

destination: function(req, file, cb) {
    fs.mkdir('./uploads/',(err)=>{
       cb(null, './uploads/');
    });
  },

if this can't find a folder then you can create one

destination: function(req, file, cb) {
    fs.mkdir('./uploads/',(err)=>{
       cb(null, './uploads/');
    });
  },

Inoent:没有这样的文件或目录。

笑咖 2025-02-18 10:45:25

您可以绑定&lt;&lt; comboboxSelected&gt;&gt;性别上的事件和更新 value value all_name ofert all_name 事件回调:

...
def on_gender_selected(event):
    selected = gender.get()
    # get the names for selected gender
    all_name['value'] = [x['Name'] for x in [John, Linda, Martin] if x['Gender'] == selected]
    all_name.set('') # clear current selection

gender.bind('<<ComboboxSelected>>', on_gender_selected)
...

You can bind <<ComboboxSelected>> event on gender and update value option of all_name inside the event callback:

...
def on_gender_selected(event):
    selected = gender.get()
    # get the names for selected gender
    all_name['value'] = [x['Name'] for x in [John, Linda, Martin] if x['Gender'] == selected]
    all_name.set('') # clear current selection

gender.bind('<<ComboboxSelected>>', on_gender_selected)
...

通过词典连接两个组合(目的是在Combobox中显示男性或女性名称)

笑咖 2025-02-17 23:29:30

当您仅通过-o没有任何级别时,代码会发生什么?

它与-O1相同,“优化一点”

顺便说一句,此和-O0有什么区别?

由于您的代码没有明显的副作用,因此如果启用了Optimizer,则将其删除。无论是否使用X [11]调用未定义的行为,或者是否访问有效的索引x [0],都会发生这种情况。首先写入x [0]项目,以确保其不确定也没有任何效果。

-O0显式禁用优化,因此您将获得某种方式生成的机器代码...也许。如果您的代码包含未定义的行为,则编译器不必生成任何可预测或有意义的内容。

通常在C中没有界限检查,这是程序员处理它的责任。


至于-fsanitize = address,添加一个副作用,它可能会启动:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) 
{
    char* x = malloc(10);
    char n = x[11];
    printf("%d\n", n);
}

结果:

== 1 ==错误:地址:地址上的堆 - 毫无用:

What happens to the code when you pass only -O without any level?

It's the same as -O1, "optimize a little bit"

What's the difference between this and -O0, that by the way, works well?

Since your code has no obvious side effects, it will be removed by the optimizer if enabled. This happens no matter if you invoke undefined behavior with x[11] or if you access a valid index x[0]. Writing to the x[0] item first to ensure it isn't indeterminate doesn't have any effect either.

-O0 explicitly disables optimizations, so you'll get some manner of machine code generated... maybe. The compiler doesn't have to generate anything predictable or meaningful in case your code contains undefined behavior.

There's generally no bounds-checking in C, it's the programmer's responsibility to handle it.


As for -fsanitize=address, add a side effect and it might kick in:

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char **argv) 
{
    char* x = malloc(10);
    char n = x[11];
    printf("%d\n", n);
}

Results in:

==1==ERROR: AddressSanitizer: heap-buffer-overflow on address-...

gcc -o优化没有未使用变量检测堆溢出

笑咖 2025-02-17 14:07:15

urlpatterns必须始终为list对象。否则,django将始终在给定函数中丢弃错误:for url_pattern在反向(self.url_patterns)中:,因为set> set object 无法反向。因此,请记住这一点:

urlpatterns = [
    path(...),
    path(...),
    (...)
]

urlpatterns have to be always a list object. Otherwise Django will always throw error in given function: for url_pattern in reversed(self.url_patterns):, because set object cannot be reversed. So simply keep this in mind:

urlpatterns = [
    path(...),
    path(...),
    (...)
]

&#x27; set&#x27;对象不是可逆的,但是我没有得到特定的文件或行

笑咖 2025-02-17 12:58:39

我解决了这个问题。我正在使用错误的uuid软件包。

I solved the issue. I was using the wrong uuid package.

uck of typeError:o.error不是一个功能

笑咖 2025-02-17 12:46:17

我尝试了许多更改密码,配置和重新启动的组合。这是有效的方法:

  1. 我已从usr/lib/aarch64-linux-gnu(libpq.so.5和libpq.so.5.14单独删除libpq.so)
  2. 更改了所有method pg_hba.conf to Trust&amp;重新启动Postgres
  3. 更改password-recryption postgresql.conf to md5&amp;重新启动用户的Postgres
  4. 重置密码Postgres(由于“方法/信任”可能是多余的)&amp;重新启动Postgres
    ...而且有效。

谢谢你!

I have tried many combinations of changing passwords, configs and restarting. Here's what worked:

  1. I have removed libpq.so from usr/lib/aarch64-linux-gnu (libpq.so.5 and libpq.so.5.14 are left alone)
  2. Changed all METHODs in pg_hba.conf to trust & restart postgres
  3. Changed password-encryption in postgresql.conf to md5 & restart postgres
  4. Reset password for user postgres (which might have been redundant due to "method/trust") & restart postgres
    ...and it works.

Thank you!

PGADMIN4 SCRAM身份验证LIBPQ 10

更多

推荐作者

眼泪淡了忧伤

文章 0 评论 0

corot39

文章 0 评论 0

守护在此方

文章 0 评论 0

github_3h15MP3i7

文章 0 评论 0

相思故

文章 0 评论 0

滥情空心

文章 0 评论 0

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文