情未る

文章 评论 浏览 28

情未る 2025-02-16 02:13:59

您可能需要按JOB_ID进行分组,然后选择汇总最大day_id

编辑:(请参见下文评论)
与原始列表的匹配可以使Job_ID的重复与相同的最大day_id保持

You may want to group by Job_ID and choose to aggregate max Day_ID

edit: (see below comment)
matching against original list allows to keep duplicates of Job_ID with same max Day_ID

如何在Microsoft Excel Power查询中找到每个ID的最大值?

情未る 2025-02-15 18:39:30

Entries in Remotes that are intended to install from GitHub can take the following

[<package>=][github::]<username>/<repository>[/<subdir>][<detail>]

对于此示例,远程字段中的条目应为glmmtmb = github :: glmmtmb/glmmtmb/glmmtmb/glmmtmb/glmmtmb/glmmtmb@ci_tweaks@ci_tweaks@ci_tweaks@ci_tweaksglmmtmb应出现在依赖>中(或在类似的字段中,例如建议)。

Entries in Remotes that are intended to install from GitHub can take the following general form:

[<package>=][github::]<username>/<repository>[/<subdir>][<detail>]

For this example the entry in the Remotes field should be glmmTMB=github::glmmTMB/glmmTMB/glmmTMB@ci_tweaks, and glmmTMB should appear in Depends (or in a similar field like Suggests).

如何在r takexte`description'的“远程”字段中包含子目录。

情未る 2025-02-15 08:10:18

您可以使用同样的方式检查消息类型

exists(
  select * from sys.service_message_types 
  where [name] = 'MessagetypeName'
);

您可以在sys.service_contracts 中检查上述message_type_id

You can check for the Message type using

exists(
  select * from sys.service_message_types 
  where [name] = 'MessagetypeName'
);

Likewise you can check for the above message_type_id in sys.service_contracts

在创建SQL代理对象之前,请先检查SQL代理对象

情未る 2025-02-15 06:48:36

小骇客,但您可以提取具有其中列表类型的列。然后使用降低递归爆炸并归一化所有列,直到没有更多列表/对象为止。

我的测试还不错,但是这样的事情。

from functools import reduce

def full_explode_normalize(df):
    # Extract list columns 
    explode_cols = [x for x in df.columns if isinstance(df.iloc[0][x], list)]
    if len(explode_cols) < 1:
        return df
    
    # Explode and normalize the list
    df = reduce(_explode, explode_cols, df)

    return df

def _explode(df, col):
    df = df.explode(col)

    if isinstance(df.iloc[0][col], list):
        df = _explode(df, col)
    elif isinstance(df.iloc[0][col], object):
        df_child = pd.json_normalize(df[col])
        # To prevent column name collision, add the parent column name as prefix.
        df_child.columns = [f'{col}.{x}' for x in df_child.columns]
        df = pd.concat([df.loc[:, ~df.columns.isin([col])].reset_index(drop=True), df_child], axis=1)
    
    return df

Little hacky but you can extract columns that has a list type in it. Then use reduce to recursively explode and normalize all columns until there are no more list/object.

I haven't tested well but something like this.

from functools import reduce

def full_explode_normalize(df):
    # Extract list columns 
    explode_cols = [x for x in df.columns if isinstance(df.iloc[0][x], list)]
    if len(explode_cols) < 1:
        return df
    
    # Explode and normalize the list
    df = reduce(_explode, explode_cols, df)

    return df

def _explode(df, col):
    df = df.explode(col)

    if isinstance(df.iloc[0][col], list):
        df = _explode(df, col)
    elif isinstance(df.iloc[0][col], object):
        df_child = pd.json_normalize(df[col])
        # To prevent column name collision, add the parent column name as prefix.
        df_child.columns = [f'{col}.{x}' for x in df_child.columns]
        df = pd.concat([df.loc[:, ~df.columns.isin([col])].reset_index(drop=True), df_child], axis=1)
    
    return df

如何将嵌套的JSON文件识别并爆炸作为数据框的列?

情未る 2025-02-14 04:31:50

我对此为时已晚,但是问题是Nest中的构建文件夹具有以下路径/app/dist/src/main,因此在您的软件包中。JSON使用此路径,然后您可以执行代码。

I am too late at this but the issue is that the build folder in nest has the following path /app/dist/src/main so in your package.json use this path and then you will be able to execute the code.

通过bitbucket管道部署Google App Engine Nest.js

情未る 2025-02-14 03:44:19

您可以通过应用比例CGAFFINETRANSFORM来做到这一点。

快速示例使用两个相同的标签,每个标签都设置为.SystemFont(ofSize:32.0,重量:.Regular),但是第二个标签缩放到50%高度:

class ScaledLabelVC: UIViewController {
    
    let v1 = UILabel()
    let v2 = UILabel()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        [v1, v2].forEach { v in
            v.text = "This is a string."
            v.font = .systemFont(ofSize: 32.0, weight: .regular)
            v.backgroundColor = .yellow
            v.translatesAutoresizingMaskIntoConstraints = false
            view.addSubview(v)
        }
        
        let g = view.safeAreaLayoutGuide
        NSLayoutConstraint.activate([
            
            v1.topAnchor.constraint(equalTo: g.topAnchor, constant: 20.0),
            v1.leadingAnchor.constraint(equalTo: g.leadingAnchor, constant: 20.0),
            v1.trailingAnchor.constraint(equalTo: g.trailingAnchor, constant: -20.0),
            
            v2.topAnchor.constraint(equalTo: v1.bottomAnchor, constant: 8.0),
            v2.leadingAnchor.constraint(equalTo: g.leadingAnchor, constant: 20.0),
            v2.trailingAnchor.constraint(equalTo: g.trailingAnchor, constant: -20.0),

        ])
        
        v2.transform = CGAffineTransform(scaleX: 1.0, y: 0.5)
        
    }
    
}

结果:

You can do this by applying a scale CGAffineTransform.

Quick example using two identical labels, each with font set to .systemFont(ofSize: 32.0, weight: .regular), but the second label scaled to 50% height:

class ScaledLabelVC: UIViewController {
    
    let v1 = UILabel()
    let v2 = UILabel()
    
    override func viewDidLoad() {
        super.viewDidLoad()
        
        [v1, v2].forEach { v in
            v.text = "This is a string."
            v.font = .systemFont(ofSize: 32.0, weight: .regular)
            v.backgroundColor = .yellow
            v.translatesAutoresizingMaskIntoConstraints = false
            view.addSubview(v)
        }
        
        let g = view.safeAreaLayoutGuide
        NSLayoutConstraint.activate([
            
            v1.topAnchor.constraint(equalTo: g.topAnchor, constant: 20.0),
            v1.leadingAnchor.constraint(equalTo: g.leadingAnchor, constant: 20.0),
            v1.trailingAnchor.constraint(equalTo: g.trailingAnchor, constant: -20.0),
            
            v2.topAnchor.constraint(equalTo: v1.bottomAnchor, constant: 8.0),
            v2.leadingAnchor.constraint(equalTo: g.leadingAnchor, constant: 20.0),
            v2.trailingAnchor.constraint(equalTo: g.trailingAnchor, constant: -20.0),

        ])
        
        v2.transform = CGAffineTransform(scaleX: 1.0, y: 0.5)
        
    }
    
}

Result:

enter image description here

字体字符高度变化iOS

情未る 2025-02-14 02:22:49

在您的Where条款中,您需要每个月的条件或条件。
您可以在循环中生成它,然后进行concat或类似的东西。

例如,您对1,3,4,7的输入的最终查询将如下:

SELECT *
FROM seasons as s
WHERE (1 between start_month and end_month
OR 3 between start_month and end_month
OR 4 between start_month and end_month
OR 7 between start_month and end_month)

In your where clause, you will want to have an OR conditions for each month.
You can generate it in a loop and then concat or something similar.

Your final query for input of 1,3,4,7 for example will look as follows:

SELECT *
FROM seasons as s
WHERE (1 between start_month and end_month
OR 3 between start_month and end_month
OR 4 between start_month and end_month
OR 7 between start_month and end_month)

检查列表中的任何值是否满足条件

情未る 2025-02-14 00:15:20

您可以在词典中使用一个控制值,其中包含创建“特殊”键时要使用的下一个值。

例如:

some_dictionary = {}

CONTROL_KEY = '__CONTROL__'

def make_placeholder(dict_):
    dict_[CONTROL_KEY] = dict_.get(CONTROL_KEY, -1) + 1
    return f'[prefix_{dict_[CONTROL_KEY]:02d}]'

for _ in range(5):
    print(make_placeholder(some_dictionary))

通过这种方式,您不必继续搜索下一个可能的键。如果可能会干扰后续处理,则一旦字典完全填充,您就可以始终删除控制键。

输出:

[prefix_00]
[prefix_01]
[prefix_02]
[prefix_03]
[prefix_04]

You could use a control value in the dictionary that contains the next value to be used when creating a "special" key.

For example:

some_dictionary = {}

CONTROL_KEY = '__CONTROL__'

def make_placeholder(dict_):
    dict_[CONTROL_KEY] = dict_.get(CONTROL_KEY, -1) + 1
    return f'[prefix_{dict_[CONTROL_KEY]:02d}]'

for _ in range(5):
    print(make_placeholder(some_dictionary))

In this way you don't have to keep searching for the next possible key. If it's likely to interfere with subsequent processing, you could always delete the control key once the dictionary is fully populated.

Output:

[prefix_00]
[prefix_01]
[prefix_02]
[prefix_03]
[prefix_04]

如果字典中存在密钥,则会生成新的密钥名称

情未る 2025-02-13 18:53:36

来源:使用JavaScript的字符串

可能不是最干净的解决方案,但是如果您始终想删除最后括号背后的文本,则它将起作用。

   var str = "Hello my name is (john) (doe) (bob)";
   var lastIndex = str.lastIndexOf("(");

   str = str.substring(0, lastIndex);
   console.log(str);

Source: How to remove the last word in a string using JavaScript

Possibly not the cleanest solution, but if you always want to remove the text behind last parentheses, it will work.

   var str = "Hello my name is (john) (doe) (bob)";
   var lastIndex = str.lastIndexOf("(");

   str = str.substring(0, lastIndex);
   console.log(str);

如何删除括号中的一部分字符串?

情未る 2025-02-13 11:54:51
<Text>{created_at}</Text>

create_at是一个对象(具体来说,a 时间戳),所以您不能将其作为一个小时候。它具有可以用来操纵它的各种功能,因此您可以做:

<Text>{created_at.seconds}</Text>

或者

<Text>{created_at.toString()}</Text>

<Text>{created_at.toDate().toLocaleTimeString()}</Text>

可以做很多事情,这仅取决于您要显示的内容。但是您无法显示整个对象。

<Text>{created_at}</Text>

created_at is an object (specifically, a Timestamp), so you can't put it as a child. It has various functions that you can use to manipulate it, so for example you could do:

<Text>{created_at.seconds}</Text>

or

<Text>{created_at.toString()}</Text>

or

<Text>{created_at.toDate().toLocaleTimeString()}</Text>

There's many things you could do, it just depends what you want to show. But you can't show the whole object.

物体无效,因为是一个反应子。如果您打算渲染一系列孩子,请改用阵列。反应

情未る 2025-02-13 03:40:51

您必须切换到US-EAST-1区域,并且选项“电子邮件接收”将出现在“配置”菜单上。似乎您正在使用不支持接收规则的区域。

You must switch to us-east-1 region and the option 'Email receiving' will appear on the configuration menu. Seems like you're using a region that not support receiving rules.

AWS是否删除了通过SES接收电子邮件的功能?

情未る 2025-02-12 20:06:54

没有什么比寻找有关特定问题的答案,并确切地找到一个具有相同问题的人,但没有解决方案。

幸运的是,我设法为SQL UPSERT提供了一个不错的解决方案,并使用Power Automate中的本地SQL连接器。

这是一般的概述,我将在以下步骤中进行:

”概述屏幕快照

第一步是使用get row(v2)通过ID检索单行。

下一步是解析上一个通话的主体的json。

这是我使用的架构:

{
    "type": "object",
    "properties": {
        "status": {
            "type": "integer"
        },
        "message": {
            "type": "string"
        },
        "error": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                }
            }
        },
        "source": {
            "type": "string"
        }
    }
}

现在,关键位,按下parse json操作后的hit Configure运行,并在上一个动作的成功和失败上运行。

”

然后,我们添加了一个条件检查,该条件检查GET行操作的状态代码(按Parse JSON Action输出)。如果以404状态失败,我们会执行插入。否则,请进行更新。

希望这有助于其他任何试图解决本地连接器的局限性。

Nothing like searching for an answer to your specific problem and finding exactly one other person with the same issue, but no resolution.

Fortunately, I've managed to work out a decent solution for an SQL Upsert with an On-Premises SQL Connector in Power Automate.

Here's the general overview, I'll go through step-by-step after:

Overview Screenshot

First step is to retrieve the single row by ID using Get row (V2).

Get Row

The next step is to parse the JSON of the body of the previous call.

Parse JSON

Here is the Schema that I used:

{
    "type": "object",
    "properties": {
        "status": {
            "type": "integer"
        },
        "message": {
            "type": "string"
        },
        "error": {
            "type": "object",
            "properties": {
                "message": {
                    "type": "string"
                }
            }
        },
        "source": {
            "type": "string"
        }
    }
}

Now the key bit, hit Configure Run After for the Parse JSON action and have it run on both Success and Failure of the previous action.

Run after

Then we add a conditional that checks the status code of the Get Row action (as output by the Parse JSON action). If it failed with a 404 Status, we do an Insert. Otherwise, do an Update.

Hopefully this helps anyone else trying to work around the limitations of the On-Premises connector.

Power Automate-在本地SQL Server表中插入/更新行

情未る 2025-02-11 23:42:51

您可以使用Phil的解决方案,也可以添加Flex-wrap:wrap; reccuringFormrow和width:100%; reccuringFormHeadeCell。

You can use Phil's solution, or you can add flex-wrap: wrap; to ReccuringFormRow and width: 100%; to ReccuringFormHeaderCell.

样式组件 - 如何以形式设置样式

情未る 2025-02-11 14:02:30

说明,请阅读:

fields.js中,您以module.exports对象的 part 导出了myfields,而不是默认导出:

module.exports.myFields = myFields;

这意味着您表示您正在导出一个看起来像:

{
  myFields: //... etc
}

但是,您已经导入myfields这样的对象:

const myFields = require('../fields');

基本上意味着您正在执行此操作:

const embedTest = new MessageEmbed()
.setColor('#4278f5')
.setTitle('__**MY TITLE**__')
.setThumbnail('mylink.com')
.setDescription(`**something**`)
.addFields([{
  myFields: [
    //... your fields
  ]
}])
.setFooter({text:`my footer`});

解决方案

将导出语句更改为:

module.exports = myFields;

将myfields数组设置为默认导出,而是将其设置为而不是将其封闭在对象中。

然后,您有两个选择。选择一个不是两者:

1。

使用...(扩展操作员)将数组“分布”。编辑commandfile.js

const myFields = require('../fields');

const embedTest = new MessageEmbed()
.setColor('#4278f5')
.setTitle('__**MY TITLE**__')
.setThumbnail('mylink.com')
.setDescription(`**something**`)
.addFields([...myFields]) // ADD 3 DOTS (spread operator)
.setFooter({text:`my footer`});

2。建议

只需删除[]周围的myfields,因为Myfields是数组

const myFields = require('../fields');

const embedTest = new MessageEmbed()
.setColor('#4278f5')
.setTitle('__**MY TITLE**__')
.setThumbnail('mylink.com')
.setDescription(`**something**`)
.addFields(myFields) // removed []
.setFooter({text:`my footer`});

Explanation, read:

In fields.js you exported myFields as part of the module.exports object, not as the default export:

module.exports.myFields = myFields;

This means you are exporting an object which looks like:

{
  myFields: //... etc
}

However, you have imported myFields like this:

const myFields = require('../fields');

Which basically means you are doing this:

const embedTest = new MessageEmbed()
.setColor('#4278f5')
.setTitle('__**MY TITLE**__')
.setThumbnail('mylink.com')
.setDescription(`**something**`)
.addFields([{
  myFields: [
    //... your fields
  ]
}])
.setFooter({text:`my footer`});

Solution

Change the export statement to:

module.exports = myFields;

This sets the myFields array to the default export, rather than enclosing it in an object.

Then you have TWO options. Pick one not both:

1.

Use ... (spread operator) to "spread" the array out. Edit commandfile.js

const myFields = require('../fields');

const embedTest = new MessageEmbed()
.setColor('#4278f5')
.setTitle('__**MY TITLE**__')
.setThumbnail('mylink.com')
.setDescription(`**something**`)
.addFields([...myFields]) // ADD 3 DOTS (spread operator)
.setFooter({text:`my footer`});

2. Recommended

Simply remove the [] surrounding myFields as myFields is the array

const myFields = require('../fields');

const embedTest = new MessageEmbed()
.setColor('#4278f5')
.setTitle('__**MY TITLE**__')
.setThumbnail('mylink.com')
.setDescription(`**something**`)
.addFields(myFields) // removed []
.setFooter({text:`my footer`});

从另一个文件导入的Discordjs嵌入字段

情未る 2025-02-11 13:03:19

当您用掩码索引一个数组时,您会得到一个扁平的(IE Shape = (n,))数组,仅包含掩码允许的值。

如果您正在寻找更大的pandas风格的掩码,其中无法匹配掩码的值,请使用np.Where

np.where(mask, a, np.nan)

将替换值mask == false 带有np.nan,返回数组的形状将与原始数组和掩码相同。

hpaulj 指出new.shape编号1300587true> true true true < /code> bask中的值。您应该通过运行sum(mask)获得相同的数字。

When you index an array with a mask, you get a flattened (i.e. shape = (N,)) array containing only the values that the mask allows.

If you're looking for a more pandas-style mask, where values that fail to match the mask are replaced, use np.where:

np.where(mask, a, np.nan)

That will replace values where mask == False with np.nan, and the shape of the returned array will be identical to that of the original array and the mask.

As hpaulj pointed out, the new.shape number 1300587 is the number of True values in your mask. You should get the same number by running sum(mask).

用布尔面具掩盖numpy阵列的意外行为

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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