烟凡古楼

文章 评论 浏览 28

烟凡古楼 2025-02-20 12:55:54

不再建议使用仅客户端结帐和 redirectToCheckout

相反,您可以使用付款链接(如果您需要客户端 - 仅解决方案),也可以在您的服务器上创建结帐会议,然后将人员发送到在结帐会话对象上 url

但是,关于您最初的问题, redirectToCheckout 只有在重定向失败时才会返回承诺。如果重定向成功,则页面上运行的JavaScript将停止运行,因为浏览器将导航到另一个页面(Stripe Checkout页面),因此没有机会返回任何内容。

Both client-only Checkout and redirectToCheckout are no longer recommended.

Instead you can use Payment Links (if you need a client-only solution) or you can create Checkout Sessions on your server and send people to the url on the Checkout Session object.

Regarding your original question, though, redirectToCheckout will only return a promise if the redirect fails. If the redirect succeeds the JavaScript running on your page will stop running because the browser will have navigated to another page (the Stripe Checkout page), so there's no chance for anything to be returned.

如何从Stripe.RedirectToCheckout()中检索结果值?

烟凡古楼 2025-02-20 07:58:48

The PipelineResult object should have a waitUntilFinish operation that you can call from within your try block to ensure the pipeline completes before the finally block executes.

如何在管道结束时运行一些代码

烟凡古楼 2025-02-19 19:03:23

您可以使用不等式类来表示“不相等”或其别名 ne 。例如:

print(solve(Ne(2-x, 3)))
# out: (x > -oo) & (x < oo) & Ne(x, -1)

You can use the Unequality class to represent the "not equal", or its alias Ne. For example:

print(solve(Ne(2-x, 3)))
# out: (x > -oo) & (x < oo) & Ne(x, -1)

Sympy“不等”方程

烟凡古楼 2025-02-19 09:15:58

如果我们不添加新值,只需从一个线程更新现有的键值,然后从另一个线程读取现有的键值,则通常是安全的吗?

我将仅解决这个问题的这一部分。不,在多线程环境中使用普通字典&lt; int,十进制&gt; ,其中固定键的数量并可以更新值,绝对不是线程安全。这是因为更新十进制不是原子操作,因此可以撕裂十进制值。您可以在此处找到有关此现象的实验证明:在C#中。

Will normal dictionary is thread safe if we don't add new values, just updating existing key value from one thread and reading from another thread is safe?

I'll address this part of the question only. No, using a normal Dictionary<int, decimal> in a multithreaded environment, where the number of keys is fixed and the values can be updated, is definitely not thread-safe. That's because updating a decimal is not an atomic operation, so a decimal value can be torn. You can find an experimental demonstration of this phenomenon here: Reproduce torn reads of decimal in C#.

更快的KV vs字典与并发词典,仅在更新字典的值时才使用该字典

烟凡古楼 2025-02-18 12:39:08

.col 必须是直接的

问题是您将 .col DIVS与另一个Div(没有 .ROW class)包装,

 <div class="row">
    <div *ngFor="let column of columns"> // This is the real column, but has no .col
        <div class="col">
            <div *ngFor="let cell of column">
                ...cellcontent...
            </div>
        </div>
    </div>
</div>

尝试将代码更新为如下:

<div class="row">
    <div *ngFor="let column of columns" class="col"> // *ngFor and .col class in the same div
        <div *ngFor="let cell of column">
            ...cellcontent...
        </div>
    </div>
</div>

由于您将 .col 放入非flex div(具有NE *ngfor >)的 .col 样式是被忽略。


如果要保留*ngfor 出于任何原因分开,则可以使用 ng-container 而不是 div (因为不是不是实际上是在浏览器中渲染的),以迭代您的列。

喜欢以下

<div class="row">
    <ng-container *ngFor="let column of columns"> // This will render only the children
        <div class="col">
            <div *ngFor="let cell of column">
                ...cellcontent...
            </div>
        </div>
    </ng-container>
</div>

.col has to be a direct .row child to work fine.

The problem is that you are wrapping your .col divs with another div (with no .row class)

From your snippet

 <div class="row">
    <div *ngFor="let column of columns"> // This is the real column, but has no .col
        <div class="col">
            <div *ngFor="let cell of column">
                ...cellcontent...
            </div>
        </div>
    </div>
</div>

Try updating your code as follow:

<div class="row">
    <div *ngFor="let column of columns" class="col"> // *ngFor and .col class in the same div
        <div *ngFor="let cell of column">
            ...cellcontent...
        </div>
    </div>
</div>

Since you were putting your .col inside a non-flex div (the one with ne *ngFor), the .col style was ignored.


If you want to keep your *ngFor separated for any reason, you could do the following using ng-container instead of div (since is not actually rendered in the browser), to iterate your columns.

Like the following

<div class="row">
    <ng-container *ngFor="let column of columns"> // This will render only the children
        <div class="col">
            <div *ngFor="let cell of column">
                ...cellcontent...
            </div>
        </div>
    </ng-container>
</div>

Angular和Bootstrap的不正确工作:列仅由内容的大小拉伸

烟凡古楼 2025-02-18 02:37:06

您可以使用整数值并从哈希表中获取对象。

const
    data = [{ a: 0, b: 0.75, c: 0, d: 0 }, { a: 1, b: 0.88, c: 0, d: 0 }, { a: 2, b: 0.38, c: 0, d: 1 }, { a: 3, b: 0.7, c: 1, d: 1 }, { a: 4, b: 0.93, c: 1, d: 0 }, { a: 5, b: 0.02, c: 1, d: 1 }, { a: 6, b: 0.16, c: 0, d: 1 }, { a: 7, b: 0.78, c: 1, d: 0 }],
    bin = 0.1, // this is the number by which will create range
    result = Object.values(data.reduce((r, { b, c, d }) => {
        const slot = Math.floor(b / bin);
        r[slot] ??= { countOfA: 0, labelOfB: [slot * bin, (slot + 1) * bin].map(v => v.toFixed(1)).join('-'), sumOfC: 0, sumOfD: 0 };
        r[slot].countOfA++;
        r[slot].sumOfC += c;
        r[slot].sumOfD += d;
        return r;
    }, {}));
    
console.log(result);
.as-console-wrapper { max-height: 100% !important; top: 0; }

You could get the slot by using integer values and get the objects from a hash table.

const
    data = [{ a: 0, b: 0.75, c: 0, d: 0 }, { a: 1, b: 0.88, c: 0, d: 0 }, { a: 2, b: 0.38, c: 0, d: 1 }, { a: 3, b: 0.7, c: 1, d: 1 }, { a: 4, b: 0.93, c: 1, d: 0 }, { a: 5, b: 0.02, c: 1, d: 1 }, { a: 6, b: 0.16, c: 0, d: 1 }, { a: 7, b: 0.78, c: 1, d: 0 }],
    bin = 0.1, // this is the number by which will create range
    result = Object.values(data.reduce((r, { b, c, d }) => {
        const slot = Math.floor(b / bin);
        r[slot] ??= { countOfA: 0, labelOfB: [slot * bin, (slot + 1) * bin].map(v => v.toFixed(1)).join('-'), sumOfC: 0, sumOfD: 0 };
        r[slot].countOfA++;
        r[slot].sumOfC += c;
        r[slot].sumOfD += d;
        return r;
    }, {}));
    
console.log(result);
.as-console-wrapper { max-height: 100% !important; top: 0; }

如何根据使数字隔离在ReactJ中的范围内的数字创建新数组

烟凡古楼 2025-02-18 00:01:16
import { HttpClient } from '@angular/common/http';

constructor(private readonly http: HttpClient) { }

getRequest(){
   return this.http.get(reqUrl).toPromise()
}
import { HttpClient } from '@angular/common/http';

constructor(private readonly http: HttpClient) { }

getRequest(){
   return this.http.get(reqUrl).toPromise()
}

如何从角度承诺中恢复身体?

烟凡古楼 2025-02-17 19:48:20

我带领你走这条路,所以我可能应该为您提供帮助。

I led you down this path, so I should probably help you. ????

That code has some things specific to their implementation that you don't need. Settings.ImpersonatedUserDomain seems to be a setting they created that gets pulled from somewhere else. But it's just the name of the domain. I have no idea what DLT.DDL.set() does, but you probably don't need it.

You should also be looking at the msExchDynamicDLBaseDN attribute too. It may turn out to be the same on every DL, but just in case...

That code also takes the email address of one dynamic DL and gets the details of just that one, where, if I remember correctly, you want to get all of the dynamic DLs on your domain. If I'm correct in that, this is how I would do it:

using System.DirectoryServices;

public class Class2
{
    public static List<DistributionList> GetDynamicDistributionLists()
    {
        var distributionLists = new List<DistributionList>();
        var domain = "example.com";
        
        // Find all dynamic DLs
        using (var searchRoot = new DirectoryEntry(
quot;LDAP://{domain}"))
        using (var searcher = new DirectorySearcher(searchRoot, "(objectClass=msExchDynamicDistributionList)",
            new [] {"cn", "msExchDynamicDLFilter", "msExchDynamicDLBaseDN"}
        ))
        using (var results = searcher.FindAll())
        {
            foreach (SearchResult result in results)
            {
                if (result.Properties.Contains("cn") && result.Properties.Contains("msExchDynamicDLFilter"))
                {
                    var dl = new DistributionList {
                        Name = (string) result.Properties["cn"][0], 
                        Filter = (string) result.Properties["msExchDynamicDLFilter"][0],
                        SearchRoot = (string) result.Properties["msExchDynamicDLBaseDN"][0]
                    };
                    distributionLists.Add(dl);
                }
            }
        }
        
        //Get membership of each DL
        foreach (var dl in distributionLists) {
            using (var searchRoot = new DirectoryEntry(
quot;LDAP://{dl.SearchRoot}"))
            using (var searcher = new DirectorySearcher(searchRoot, dl.Filter, new [] {"distinguishedName"}))
            using (var results = searcher.FindAll())
            {
                foreach (SearchResult result in results)
                {
                    dl.Members.Add((string) result.Properties["distinguishedName"][0]);
                }
            }
        }

        return distributionLists;
    }
}

public class DistributionList   
{
    public string Name { get; set; }
    public string Filter { get; set; }
    public string SearchRoot { get; set; }
    public List<string> Members { get; set; } = new List<string>();
}

Set domain to the name of your domain. This will populate the Members collection with the distinguishedName of each member. You can change that if you'd rather have the email (use the mail attribute), or anything else.

C# - 不确定如何修复与其他人复制的自定义类/类型有关的错误

烟凡古楼 2025-02-17 13:30:47

我希望它能有所帮助

var data map[string]interface{}
err := DB.Model(models.User{}).Clauses(clause.Returning{}).Create(data).Error
if err != nil {
    return models.User{}, err
}

id := fmt.Sprint(data["id"])
var user models.User
DB.First(&user, id)
return user, nil

I hope it can help

var data map[string]interface{}
err := DB.Model(models.User{}).Clauses(clause.Returning{}).Create(data).Error
if err != nil {
    return models.User{}, err
}

id := fmt.Sprint(data["id"])
var user models.User
DB.First(&user, id)
return user, nil

如何使用Gorm从数据库中返回新创建的记录

烟凡古楼 2025-02-17 12:24:13

您不能只是丢下错误吗?消息再处理将重新处理它(默认为5次),那么这将是错误队列中的错误。您将必须仔细检查队列配置

can't you just throw an error - message reprocessing will reprocess it (default 5 times) then it will be an error in the error queue. You will have to double check your queue configurations

Maximo入口MIF自动化脚本 - 位置失败消息在错误队列中以进行重新处理

烟凡古楼 2025-02-17 07:32:23

您应该能够通过过滤 targetUsername offictuSername 属性,通过过滤 eventData 的 。

示例代码更新(我还删除了。'#text'从EventID行中删除了零件,以确保捕获此值),

$filter = "*[System[EventID=4740 and Provider[@Name='Microsoft-Windows-Security-Auditing']]]"
$result = Get-WinEvent -LogName Security -FilterXPath $filter | ForEach-Object {
    # convert the event to XML and grab the Event node
    $eventXml = ([xml]$_.ToXml()).Event
    # output the properties you need
    [PSCustomObject]@{
        EventID       = $eventXml.System.EventID
        TimeCreated   = $eventXml.System.TimeCreated.SystemTime -replace '\.\d+.*

如果您愿意,可以使用以下所有属性来删除所有属性:

$filter = "*[System[EventID=4740 and Provider[@Name='Microsoft-Windows-Security-Auditing']]]"
$result = Get-WinEvent -LogName Security -FilterXPath $filter | ForEach-Object {
    # convert the event to XML and grab the Event node
    $eventXml = ([xml]$_.ToXml()).Event
    # output the properties you need
    $object = [PSCustomObject]@{
        EventID       = $eventXml.System.EventID
        TimeCreated   = $eventXml.System.TimeCreated.SystemTime -replace '\.\d+.*

您'd然后最终得到您可用的所有属性,每个结果都包含数据,例如:

“示例结果数据”

Computer = $eventXml.System.Computer TargetUserName = ($eventXml.EventData.Data | Where-Object { $_.Name -eq "TargetUserName"}).'#text' SubjectUserName = ($eventXml.EventData.Data | Where-Object { $_.Name -eq "SubjectUserName"}).'#text' } } # output on screen $result | Format-Table -AutoSize # save as CSV file if you like $result | Export-Csv -Path 'C:\MyProgr_Events_302.csv' -NoTypeInformation

如果您愿意,可以使用以下所有属性来删除所有属性:


您'd然后最终得到您可用的所有属性,每个结果都包含数据,例如:

“示例结果数据”

Computer = $eventXml.System.Computer } $eventXml.EventData.Data | ForEach-Object { $object | Add-Member -MemberType NoteProperty -Name $_.Name -Value $_.'#text' } $object } # output on screen$ $result | Format-Table -AutoSize

您'd然后最终得到您可用的所有属性,每个结果都包含数据,例如:

“示例结果数据”

Computer = $eventXml.System.Computer TargetUserName = ($eventXml.EventData.Data | Where-Object { $_.Name -eq "TargetUserName"}).'#text' SubjectUserName = ($eventXml.EventData.Data | Where-Object { $_.Name -eq "SubjectUserName"}).'#text' } } # output on screen $result | Format-Table -AutoSize # save as CSV file if you like $result | Export-Csv -Path 'C:\MyProgr_Events_302.csv' -NoTypeInformation

如果您愿意,可以使用以下所有属性来删除所有属性:


您'd然后最终得到您可用的所有属性,每个结果都包含数据,例如:

“示例结果数据”

You should be able to get the TargetUserName and SubjectUserName properties by filtering the EventData for those specifically named attributes.

Example code updated (I've also removed the .'#text' part from the EventID line to ensure this value is captured)

$filter = "*[System[EventID=4740 and Provider[@Name='Microsoft-Windows-Security-Auditing']]]"
$result = Get-WinEvent -LogName Security -FilterXPath $filter | ForEach-Object {
    # convert the event to XML and grab the Event node
    $eventXml = ([xml]$_.ToXml()).Event
    # output the properties you need
    [PSCustomObject]@{
        EventID       = $eventXml.System.EventID
        TimeCreated   = $eventXml.System.TimeCreated.SystemTime -replace '\.\d+.*

If you prefer, you could pull out all attributes with the following instead:

$filter = "*[System[EventID=4740 and Provider[@Name='Microsoft-Windows-Security-Auditing']]]"
$result = Get-WinEvent -LogName Security -FilterXPath $filter | ForEach-Object {
    # convert the event to XML and grab the Event node
    $eventXml = ([xml]$_.ToXml()).Event
    # output the properties you need
    $object = [PSCustomObject]@{
        EventID       = $eventXml.System.EventID
        TimeCreated   = $eventXml.System.TimeCreated.SystemTime -replace '\.\d+.*

You'd then end up with all the attributes available to you and each result would contain data such as:

Example result data

Computer = $eventXml.System.Computer TargetUserName = ($eventXml.EventData.Data | Where-Object { $_.Name -eq "TargetUserName"}).'#text' SubjectUserName = ($eventXml.EventData.Data | Where-Object { $_.Name -eq "SubjectUserName"}).'#text' } } # output on screen $result | Format-Table -AutoSize # save as CSV file if you like $result | Export-Csv -Path 'C:\MyProgr_Events_302.csv' -NoTypeInformation

If you prefer, you could pull out all attributes with the following instead:


You'd then end up with all the attributes available to you and each result would contain data such as:

Example result data

Computer = $eventXml.System.Computer } $eventXml.EventData.Data | ForEach-Object { $object | Add-Member -MemberType NoteProperty -Name $_.Name -Value $_.'#text' } $object } # output on screen$ $result | Format-Table -AutoSize

You'd then end up with all the attributes available to you and each result would contain data such as:

Example result data

Computer = $eventXml.System.Computer TargetUserName = ($eventXml.EventData.Data | Where-Object { $_.Name -eq "TargetUserName"}).'#text' SubjectUserName = ($eventXml.EventData.Data | Where-Object { $_.Name -eq "SubjectUserName"}).'#text' } } # output on screen $result | Format-Table -AutoSize # save as CSV file if you like $result | Export-Csv -Path 'C:\MyProgr_Events_302.csv' -NoTypeInformation

If you prefer, you could pull out all attributes with the following instead:


You'd then end up with all the attributes available to you and each result would contain data such as:

Example result data

需要将XML数据提取到CSV

烟凡古楼 2025-02-17 05:10:45

根据@Inian,根据我的要求,我的查询更改很少。

yq -r '.[] | select(.id=="id_2").name' s.txt

As Per @Inian, I made few changes in query as follows according to my requirements.

yq -r '.[] | select(.id=="id_2").name' s.txt

使用YQ过滤数据后如何选择特定键

烟凡古楼 2025-02-17 01:30:25

您可以尝试实现这一目标:

  1. set -webkit-text-stroke -webkit-text-fill-color 而不是 text-shadow to获取边界(阴影)。
  2. 创建一个伪级,然后使用 attrs()从数据属性中获取值。
  3. 使用背景clip 我们的文本被剪切,我们放置了一个渐变。
  4. 使用 @supports 避免某些浏览器不支持 -webkit-text-stroke -webkit-text-text-fill-color

@supports (-webkit-text-stroke: 0 #000) and (-webkit-text-fill-color: #000) {
  .styled {
    display: flex;
    background-color: black;
    font-size: 5rem;
    list-style-type: none;
    margin: 0;
    padding: 0;
    position: relative;
    font-family: sans-serif;
    
    -webkit-text-fill-color: white;
    -webkit-text-stroke-width: 5px;
    -webkit-text-stroke-color: transparent;
  }
  .styled::after {
    content: attr(data-css); /* get value from html */
    position: absolute;
    top: 0;
    left: 0;
    font-size: inherit;
    transition: all .5s linear;
    
    background-image: linear-gradient(to left, white 50%, cyan 50%);
    background-size: 200%;
    background-position: 100%;
    background-clip: text;
    -webkit-background-clip: text;

  }
  .styled:hover::after {
    background-position: 0;
  }
}

@supports not ((-webkit-text-stroke: 0 #000) or (-webkit-text-fill-color: #000)) {
  .styled {
    background-color: black;
    font-size: 30px;
    list-style-type: none;
    margin: 0;
    padding: 0;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
  }
  .styled:hover {
    text-shadow: -1px -1px 0 cyan, 1px -1px 0 cyan, -1px 1px 0 cyan, 1px 1px 0 cyan;
  }
}
<li class="styled" data-css="Test">Test</li>

You can try to achieve this:

  1. Set -webkit-text-stroke and -webkit-text-fill-color instead of text-shadow to get the border (shadow).
  2. Create a pseudo-class and use attrs() to get the value from data attribute.
  3. With background-clip our text is clipped and we place a gradient.
  4. Use @supports to avoid if some browser doesn't support -webkit-text-stroke and -webkit-text-fill-color.

Edit dazziling-code

@supports (-webkit-text-stroke: 0 #000) and (-webkit-text-fill-color: #000) {
  .styled {
    display: flex;
    background-color: black;
    font-size: 5rem;
    list-style-type: none;
    margin: 0;
    padding: 0;
    position: relative;
    font-family: sans-serif;
    
    -webkit-text-fill-color: white;
    -webkit-text-stroke-width: 5px;
    -webkit-text-stroke-color: transparent;
  }
  .styled::after {
    content: attr(data-css); /* get value from html */
    position: absolute;
    top: 0;
    left: 0;
    font-size: inherit;
    transition: all .5s linear;
    
    background-image: linear-gradient(to left, white 50%, cyan 50%);
    background-size: 200%;
    background-position: 100%;
    background-clip: text;
    -webkit-background-clip: text;

  }
  .styled:hover::after {
    background-position: 0;
  }
}

@supports not ((-webkit-text-stroke: 0 #000) or (-webkit-text-fill-color: #000)) {
  .styled {
    background-color: black;
    font-size: 30px;
    list-style-type: none;
    margin: 0;
    padding: 0;
    text-shadow: -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 1px 1px 0 #fff;
  }
  .styled:hover {
    text-shadow: -1px -1px 0 cyan, 1px -1px 0 cyan, -1px 1px 0 cyan, 1px 1px 0 cyan;
  }
}
<li class="styled" data-css="Test">Test</li>

动画文本阴影颜色从左到右CSS

烟凡古楼 2025-02-16 04:38:06

假设getID(),getDescription(),getingRedients(),getSellingPrice()方法是读取用户输入。

您将需要创建一个食品类来保存这些价值,并为展示逻辑提供一系列食物。

伪代码

public class Food{
    private String id;
    private String description;
    private String ingredients;
    private double sellingPrice;
    // Constructor, Getter, Setter
}


List<Food> foodList = new ArrayList<>();
String id = getId()
String description = getDescription()
String ingredients = getIngredients()
double sellingPrice = getSellingPrice()
Food food = new Food(id, description, ingredients, sellingPrice)

foodList.add(food);   

Assume the getId(), getDescription(), getIngredients(), getSellingPrice() methods was reading user input.

You will need to create a Food class to hold these values and have an ArrayList of Food for the display logic.

Pseudo code

public class Food{
    private String id;
    private String description;
    private String ingredients;
    private double sellingPrice;
    // Constructor, Getter, Setter
}


List<Food> foodList = new ArrayList<>();
String id = getId()
String description = getDescription()
String ingredients = getIngredients()
double sellingPrice = getSellingPrice()
Food food = new Food(id, description, ingredients, sellingPrice)

foodList.add(food);   

使用GET方法添加到阵列列表

烟凡古楼 2025-02-15 17:12:25

在容器平台中部署EFK堆栈。 daemonset从主机中收集所有容器,并向Elasticsearch收集所有容器时,运行Fluentd。使用Kibana,您可以可视化存储在Elasticsearch中的日志。
使用策展人,您可以根据要保留日志的天数应用数据保留策略。

Deploy EFK stack in the container platform. FLuentd is run as daemonset collecting the logs from all the containers from a host and feeds to elasticsearch. Using kibana you can visualize the logs stored in elasticsearch.
With curator you can apply data retention policies depending on the amount of days you want to keep the logs.

重新启动后,持续存在容器日志

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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