野の

文章 评论 浏览 30

野の 2025-02-04 03:26:24

Sagemaker项目没有硬删除。当您通过SDK或CLI删除它们时(

There's no hard delete on SageMaker Projects. When you delete them through the SDK or CLI (API reference), it updates the status of the project to 'Deleted'. You can extend the left pane to see the status, like the screenshot below. Studio projects pane

如何删除Amzon Sagemaker Studio项目

野の 2025-02-03 15:28:34

根据您的问题,您的问题是Flutterfirebasemessagingservice的到来。如果您在日志中看到,已经提到

io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: Targeting S+ (version 31 and above)
requires that an explicit value for android:exported be defined when intent filters are present]

您只需要从Intent-Filter中删除额外的Android:导出=“ false”即可。
放在此处

            <intent-filter >
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

也像更新插件一样,如果它们没有更新

  • firebase_core: ^1.16.0
  • firebase_messaging: ^11.3.0

As per your question, your issue is arriving of FlutterFirebaseMessagingService. If you see in log there is already mention that

io.flutter.plugins.firebasemessaging.FlutterFirebaseMessagingService: Targeting S+ (version 31 and above)
requires that an explicit value for android:exported be defined when intent filters are present]

You just need to delete extra android:exported="false" from intent-filter.
put here as like

            <intent-filter >
                <action android:name="android.intent.action.MAIN"/>
                <category android:name="android.intent.category.LAUNCHER"/>
            </intent-filter>
            <intent-filter>
                <action android:name="FLUTTER_NOTIFICATION_CLICK" />
                <category android:name="android.intent.category.DEFAULT" />
            </intent-filter>

also update plugin, if they are not updated

  • firebase_core: ^1.16.0
  • firebase_messaging: ^11.3.0

颤音:install_parse_failed_manifest_malformed:installpackageli期间失败的解析

野の 2025-02-03 13:41:39

使用洗牌索引 np.ndarray 对象的答案

name_list = ['Glen','John','Mark','Shane','Ricky','Steve']
partition = len(name_list) // 2
part1, part2 = np.array_split(name_list, 2)
idx = np.arange(partition)
np.random.shuffle(idx)
roll = np.arange(partition)
np.random.shuffle(roll)
for i in roll:
    roll_idx = np.roll(idx, i)
    print(np.vstack([part1, part2[:partition][roll_idx]]).T)

输出

[['Glen' 'Ricky']
 ['John' 'Shane']
 ['Mark' 'Steve']]
[['Glen' 'Steve']
 ['John' 'Ricky']
 ['Mark' 'Shane']]
[['Glen' 'Shane']
 ['John' 'Steve']
 ['Mark' 'Ricky']]

说明

  • 将返回相应的值。
  • part2 [:partition] [idx] 可以确保其长度相等。

Answer

name_list = ['Glen','John','Mark','Shane','Ricky','Steve']
partition = len(name_list) // 2
part1, part2 = np.array_split(name_list, 2)
idx = np.arange(partition)
np.random.shuffle(idx)
roll = np.arange(partition)
np.random.shuffle(roll)
for i in roll:
    roll_idx = np.roll(idx, i)
    print(np.vstack([part1, part2[:partition][roll_idx]]).T)

Output

[['Glen' 'Ricky']
 ['John' 'Shane']
 ['Mark' 'Steve']]
[['Glen' 'Steve']
 ['John' 'Ricky']
 ['Mark' 'Shane']]
[['Glen' 'Shane']
 ['John' 'Steve']
 ['Mark' 'Ricky']]

Explanation

  • Using the shuffled index for np.ndarray object will return the value of the corresponding.
  • part2[:partition][idx] can make sure that their length of them are equal.

如何在Python中执行随机配对/匹配

野の 2025-02-03 13:07:50

我解决了这个问题。我只是用'单引号'封闭了角色的价值。我使用',而不是 [?] ,这是一个很好的方法,还是有人有更好的想法?

I have solved this problem. I just enclosed the value of roles with 'single quotes'. Instead of [?], I used '?', is this a good approach, or does anyone has a better idea?

SQL:将多个值插入单列中

野の 2025-02-03 02:57:56

这就是我这样做的方式:

import csv

with open('StudentsMajorsList.csv', newline='') as file:
    reader = csv.reader(file)
    data1 = list(reader)
    
with open('GPAList.csv', newline='') as file:
    reader = csv.reader(file)
    data2 = list(reader)

merge1 = []
merge2 = []
merge3 = []

for list1 in data1:
    for item in list1:
        x = item.split(',')
    merge1.append(x)
        
for list2 in data2:
    for item in list2:
        x = item.split(',')
    merge2.append(x)
    
for i in range(len(merge1)):
    for j in range(len(merge2)):
        if(merge1[i][0] == merge2[j][0]):
            merge3.append(merge1[i][0:])
            merge3[i].append(merge2[j][1])

for item in merge3:
    for i in item:
        if (i == ''):
            item.remove(i)
            
for item in range(len(merge3)):
    print(merge3[item])
    
with open('FullRoster.csv', 'w') as csvfile:
    csvwriter = csv.writer(csvfile)
    csvwriter.writerows(merge3)

输出:

['305671', 'Jones', 'Bob', 'Electrical Engineering', '3.1']
['987621', 'Wong', 'Chen', 'Computer Science', '3.85']
['323232', 'Rubio', 'Marco', 'Computer Information Systems', '3.8']
['564321', 'Awful', 'Student', 'Computer Science', 'Y', '2.2']
['769889', 'Boy', 'Sili', 'Computer Information Systems', 'Y', '3.9']
['156421', 'McGill', 'Tom', 'Electrical Engineering', '3.4']
['999999', 'Genius', 'Real', 'Physics', '4']

This is how I would of done it:

import csv

with open('StudentsMajorsList.csv', newline='') as file:
    reader = csv.reader(file)
    data1 = list(reader)
    
with open('GPAList.csv', newline='') as file:
    reader = csv.reader(file)
    data2 = list(reader)

merge1 = []
merge2 = []
merge3 = []

for list1 in data1:
    for item in list1:
        x = item.split(',')
    merge1.append(x)
        
for list2 in data2:
    for item in list2:
        x = item.split(',')
    merge2.append(x)
    
for i in range(len(merge1)):
    for j in range(len(merge2)):
        if(merge1[i][0] == merge2[j][0]):
            merge3.append(merge1[i][0:])
            merge3[i].append(merge2[j][1])

for item in merge3:
    for i in item:
        if (i == ''):
            item.remove(i)
            
for item in range(len(merge3)):
    print(merge3[item])
    
with open('FullRoster.csv', 'w') as csvfile:
    csvwriter = csv.writer(csvfile)
    csvwriter.writerows(merge3)

Output:

['305671', 'Jones', 'Bob', 'Electrical Engineering', '3.1']
['987621', 'Wong', 'Chen', 'Computer Science', '3.85']
['323232', 'Rubio', 'Marco', 'Computer Information Systems', '3.8']
['564321', 'Awful', 'Student', 'Computer Science', 'Y', '2.2']
['769889', 'Boy', 'Sili', 'Computer Information Systems', 'Y', '3.9']
['156421', 'McGill', 'Tom', 'Electrical Engineering', '3.4']
['999999', 'Genius', 'Real', 'Physics', '4']

如何基于第一列合并两个CSV文件(没有标题,没有熊猫)

野の 2025-02-02 22:24:32

我已经开始充实这一点, accountId 是可以的,因为三个组件形式形式:

// An account belongs to broker, and within a tenant (that can have multiple accounts).
public class AccountId : ValueObject
{
    public string Id { get; init; }
    public TenantId TenantId { get; init; }
    public BrokerId BrokerId { get; init; }

    public AccountId(TenantId tenantId, BrokerId brokerId, string id)
    {
        TenantId = tenantId;
        BrokerId = brokerId;
        Id = id;
    }

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return TenantId;
        yield return BrokerId;
        yield return Id;
    }
}

执行是价值对象,没有生命周期,因为它们不能存在于帐户之外:

public class FillDetail : ValueObject
{
    public string FillId { get; init; }

    // Must be unique for each and every fill.
    public FillDetail(string fillId) => FillId = fillId;

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return FillId;
    }
}

public class Execution : ValueObject
{
    public FillDetail FillDetail { get; init; }
    public UserId UserId { get; init; } // A user potentially could create trades in other tenants, with appropriate claims/roles.
    public Contract Contract { get; init; }
    public string Exchange { get; init; }
    public string BrokerContractId { get; init; }
    public string BucketName { get; init; }
    public decimal Size { get; init; }
    public double Price { get; init; } // The execution price, excluding commissions.
    public DateTime Timestamp { get; init; }
    public Action Action { get; init; }
    public bool IsForcedLiquidation { get; init; }
    public Side Side { get; init; }
    public Liquidity Liquidity { get; init; }
    public FillDetail? Correction { get; init; }

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return FillDetail;
        yield return UserId;
        yield return Contract;
        yield return Exchange;
        yield return BrokerContractId;
        yield return BucketName;
        yield return Size;
        yield return Price;
        yield return Timestamp;
        yield return Action;
        yield return IsForcedLiquidation;
        yield return Side;
        yield return Liquidity;
        if (Correction != null) yield return Correction;
    }
}

帐户是 ENTITY 随着时间的推移而演变,并且将具有业务逻辑以例如:

  1. 计算p+l当在分类帐中输入执行时,
  2. 请防止当前职位(从执行日志派生)开放时进行交易,或其他订单,树篱等。

此逻辑将属于帐户

public sealed class Account : Entity
{
    public AccountId AccountId { get; init; }

    readonly List<Execution> executions = new();

    public void LogExecution(Execution execution)
    {
        // TODO: Check if this execution already exists, if so ignore it.
        this.executions.Add(execution);

        // This is where we would scan list of prior trades, calculate open positions, P+L etc.
    }

    public void PlaceOrder(Contract contract)
    {
        // We could have limit of no more than 10% of account balance allocated to any one position.
    }

    public IEnumerable<Execution> GetExecutions()
    {
        throw new NotImplementedException();
    }

    protected override IEnumerable<ValueObject> GetIdentityComponents()
    {
        yield return AccountId;
    }
}

我认为这更可能是一个更好的模型,而我现在对大量执行日志(和管理该性能)感到担忧,但是我将保存此问题。

请随时提供自己的答案,Pointers非常感谢。

I have started to flesh this out, an AccountID is ok as the three components form the identity:

// An account belongs to broker, and within a tenant (that can have multiple accounts).
public class AccountId : ValueObject
{
    public string Id { get; init; }
    public TenantId TenantId { get; init; }
    public BrokerId BrokerId { get; init; }

    public AccountId(TenantId tenantId, BrokerId brokerId, string id)
    {
        TenantId = tenantId;
        BrokerId = brokerId;
        Id = id;
    }

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return TenantId;
        yield return BrokerId;
        yield return Id;
    }
}

Executions are value objects, with no lifetime as they cannot exist outside of an account:

public class FillDetail : ValueObject
{
    public string FillId { get; init; }

    // Must be unique for each and every fill.
    public FillDetail(string fillId) => FillId = fillId;

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return FillId;
    }
}

public class Execution : ValueObject
{
    public FillDetail FillDetail { get; init; }
    public UserId UserId { get; init; } // A user potentially could create trades in other tenants, with appropriate claims/roles.
    public Contract Contract { get; init; }
    public string Exchange { get; init; }
    public string BrokerContractId { get; init; }
    public string BucketName { get; init; }
    public decimal Size { get; init; }
    public double Price { get; init; } // The execution price, excluding commissions.
    public DateTime Timestamp { get; init; }
    public Action Action { get; init; }
    public bool IsForcedLiquidation { get; init; }
    public Side Side { get; init; }
    public Liquidity Liquidity { get; init; }
    public FillDetail? Correction { get; init; }

    protected override IEnumerable<object> GetEqualityComponents()
    {
        yield return FillDetail;
        yield return UserId;
        yield return Contract;
        yield return Exchange;
        yield return BrokerContractId;
        yield return BucketName;
        yield return Size;
        yield return Price;
        yield return Timestamp;
        yield return Action;
        yield return IsForcedLiquidation;
        yield return Side;
        yield return Liquidity;
        if (Correction != null) yield return Correction;
    }
}

The account is a Entity as it evolves over time, and would have business logic to for example:

  1. Calculate P+L when executions are entered on the ledger
  2. Prevent trades from taking place if current positions (derived from the execution log) are open, or additional orders, hedges etc.

This logic would belong in the Account:

public sealed class Account : Entity
{
    public AccountId AccountId { get; init; }

    readonly List<Execution> executions = new();

    public void LogExecution(Execution execution)
    {
        // TODO: Check if this execution already exists, if so ignore it.
        this.executions.Add(execution);

        // This is where we would scan list of prior trades, calculate open positions, P+L etc.
    }

    public void PlaceOrder(Contract contract)
    {
        // We could have limit of no more than 10% of account balance allocated to any one position.
    }

    public IEnumerable<Execution> GetExecutions()
    {
        throw new NotImplementedException();
    }

    protected override IEnumerable<ValueObject> GetIdentityComponents()
    {
        yield return AccountId;
    }
}

I think this is more likely a better model, whilst I now have concerns on the massive execution log (and managing that performance) however I will save that for a further question.

Feel free to provide your own answers, pointers much appreciated.

为基于DDD的日记系统选择识别

野の 2025-02-02 07:57:01

您没有正确模拟 fs.promises

index.js

const fs = require('fs').promises;
const path = require('path');

const writeData = async (data, file) => {
  const directoryPath = path.join(__dirname, '../wiremock/stubs/mappings');
  try {
    await fs.writeFile(`${directoryPath}/${file}`, data);
    return `${file} written`;
  } catch (err) {
    return err;
  }
};

module.exports = { writeData };

index.test.js

const { writeData } = require('.');

jest.mock('fs', () => ({
  promises: {
    writeFile: jest.fn(),
  },
}));

describe('Write file', () => {
  it('should write a file', async () => {
    const result = await writeData('test data', 'test-file');
    expect(result).toEqual('test-file written');
  });
});

测试结果:

 PASS  stackoverflow/72115160/index.test.js
  Write file
    ✓ should write a file (3 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.857 s, estimated 12 s

You didn't mock the fs.promises correctly.

index.js:

const fs = require('fs').promises;
const path = require('path');

const writeData = async (data, file) => {
  const directoryPath = path.join(__dirname, '../wiremock/stubs/mappings');
  try {
    await fs.writeFile(`${directoryPath}/${file}`, data);
    return `${file} written`;
  } catch (err) {
    return err;
  }
};

module.exports = { writeData };

index.test.js:

const { writeData } = require('.');

jest.mock('fs', () => ({
  promises: {
    writeFile: jest.fn(),
  },
}));

describe('Write file', () => {
  it('should write a file', async () => {
    const result = await writeData('test data', 'test-file');
    expect(result).toEqual('test-file written');
  });
});

Test result:

 PASS  stackoverflow/72115160/index.test.js
  Write file
    ✓ should write a file (3 ms)

Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        2.857 s, estimated 12 s

如何用嘲笑示意一个fs.writefile呼叫?

野の 2025-02-02 06:24:45

您正在Callapi方法中创建警报对话框。然后,当单击重试按钮时,您应该能够再次呼叫Callapi方法。

这是Callapi方法的错误回调的修改版本。让我知道这是否是您需要的。

if (error instanceof NoConnectionError | error instanceof TimeoutError) {
            AlertDialog.Builder builder = new 
            AlertDialog.Builder(context);
            builder.setMessage("some network related message");
            builder.setPositiveButton("RETRY", (dialog, which) -> {
                dialog.cancel();
                // Make another call to callAPI with the same parameter
                callAPI(context, url, REQUEST, parameters)
            });
            builder.setNegativeButton("CANCEL", (dialog, which) -> {
                dialog.cancel();
            });
            builder.show();
        }

You are creating your alert dialog inside your callAPI method. Then you should be able to make another call to your callAPI method when Retry button is clicked.

Here is a modified version of your callAPI method's error callback. Let me know if this is what you need.

if (error instanceof NoConnectionError | error instanceof TimeoutError) {
            AlertDialog.Builder builder = new 
            AlertDialog.Builder(context);
            builder.setMessage("some network related message");
            builder.setPositiveButton("RETRY", (dialog, which) -> {
                dialog.cancel();
                // Make another call to callAPI with the same parameter
                callAPI(context, url, REQUEST, parameters)
            });
            builder.setNegativeButton("CANCEL", (dialog, which) -> {
                dialog.cancel();
            });
            builder.show();
        }

当Android凌空请求中有网络或超时错误时,如何再次致电API

野の 2025-02-02 03:26:48
df.pivot(index='time', columns='location', values='count')

location    A  B  C  D
time                  
2022-05-01  1  2  3  4
2022-05-02  5  6  7  8
df.pivot(index='time', columns='location', values='count')

location    A  B  C  D
time                  
2022-05-01  1  2  3  4
2022-05-02  5  6  7  8

如何基于索引和一列转换熊猫数据框

野の 2025-02-02 00:41:21

1.Drop用户'read_account'@'%';

2.创建用户'read_account'@'%'由“密码”确定;

3.将上的选择授予'read_account'@'%';

4.Flush特权;

1.drop user 'read_account'@'%';

2.create user 'read_account'@'%' identified by 'password';

3.grant select on . to 'read_account'@'%';

4.flush privileges;

gcloud mysql仅阅读用户

野の 2025-02-01 14:02:17

您的有条件逻辑

if a[i] < 0 and a[i - 1] > 0 and a[i + 1] > 0

似乎是听起来和可读的。但是它将在边界案例中存在问题:

[1, 2, -3] -> IndexError: list index out of range
[-1, 2, 3] -> [2, 3]

正确处理它可能很简单,就像跳过您的第一个和最后一个元素一样列出了

for i in range(1, len(a) - 1)

测试

import numpy as np


def del_neg_between_pos(a):
    delete_idx = []
    for i in range(1, len(a) - 1):
        if a[i] < 0 and a[i - 1] > 0 and a[i + 1] > 0:
            delete_idx.append(i)

    return np.delete(a, delete_idx)


if __name__ == "__main__":
    a1 = [1, 3, 6, -2, 4, 5, 8, -3, 9, 2, -5, -7, -9, 3, 6, -7, -6, 2]
    a2 = [1, 2, -3]
    a3 = [-1, 2, 3]
    for a in [a1, a2, a3]:
        print(del_neg_between_pos(a))

输出

[ 1  3  6  4  5  8  9  2 -5 -7 -9  3  6 -7 -6  2]
[ 1  2 -3]
[-1  2  3]

Your conditional logic

if a[i] < 0 and a[i - 1] > 0 and a[i + 1] > 0

seems sound and readable to me. But it would have issues with the boundary cases:

[1, 2, -3] -> IndexError: list index out of range
[-1, 2, 3] -> [2, 3]

Handling it properly could be as simple as skipping the first and last element of you list with

for i in range(1, len(a) - 1)

Test

import numpy as np


def del_neg_between_pos(a):
    delete_idx = []
    for i in range(1, len(a) - 1):
        if a[i] < 0 and a[i - 1] > 0 and a[i + 1] > 0:
            delete_idx.append(i)

    return np.delete(a, delete_idx)


if __name__ == "__main__":
    a1 = [1, 3, 6, -2, 4, 5, 8, -3, 9, 2, -5, -7, -9, 3, 6, -7, -6, 2]
    a2 = [1, 2, -3]
    a3 = [-1, 2, 3]
    for a in [a1, a2, a3]:
        print(del_neg_between_pos(a))

Output

[ 1  3  6  4  5  8  9  2 -5 -7 -9  3  6 -7 -6  2]
[ 1  2 -3]
[-1  2  3]

删除仅在阳性之间的负面元素

野の 2025-01-31 17:49:54
SELECT G.GROUP_ID 
FROM GROUP_MEMBER AS G
WHERE NOT EXISTS
 (
   SELECT 1 FROM GROUP_MEMBER AS X WHERE G.GROUP_ID=X.GROUP_ID AND X.ROLE='OWNER'
 )
SELECT G.GROUP_ID 
FROM GROUP_MEMBER AS G
WHERE NOT EXISTS
 (
   SELECT 1 FROM GROUP_MEMBER AS X WHERE G.GROUP_ID=X.GROUP_ID AND X.ROLE='OWNER'
 )

如何查询只有没有AN and的组的组?

野の 2025-01-31 14:59:53

如果您安装了远程开发扩展包

”在此处输入图像说明”

It should be there on the left side if you installed the Remote Development extension pack

enter image description here

显示VSS代码远程资源管理器需要什么

野の 2025-01-31 14:18:01

使用其他库有一些更简单的方法来实现这一目标。但是,考虑到您正在使用小型阵列,可以使用以下修改使用代码:

array2[10]
array[50]
int counter = 0;

for(int i = 0; i < 10; ++i){
for(int k = 0; k < 50; ++k){  
if( array2[i] == array[k])counter++;
}
}

这应该有效。

There are easier ways to achieve this using other libraries. But considering you're working with small arrays, you could use your code with the following modification:

array2[10]
array[50]
int counter = 0;

for(int i = 0; i < 10; ++i){
for(int k = 0; k < 50; ++k){  
if( array2[i] == array[k])counter++;
}
}

That should work.

比较两个阵列..在c

野の 2025-01-31 13:55:48

在F串中,需要由两层表示卷发括号,因此您需要三层来满足您的要求:

>>> a = 100
>>> f'{{a}}'
'{a}'
>>> f'{{{a}}}'
'{100}'

In the f-string, curly braces need to be represented by two layers, so you need three layers to meet your requirements:

>>> a = 100
>>> f'{{a}}'
'{a}'
>>> f'{{{a}}}'
'{100}'

在用f literals编写数学表达式的matplotlob中;如何处理加薪的力量(^)

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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