想挽留

文章 评论 浏览 20375

想挽留 2025-02-20 20:23:39

因此,在使用$活动之后,我终于找到了解决方案。以下是我使用的:

@ViewChild('data') data: ElementRef;
divElement: HTMLElement;

然后在提交活动中:

async onSubmit(formGroup, target) {
    this.divElement = this.data.nativeElement;
    this.divElement.classList.remove("ng-dirty");
}

So, after playing with the $event, I finally found the solution. Below is what I used:

@ViewChild('data') data: ElementRef;
divElement: HTMLElement;

then on the submit event:

async onSubmit(formGroup, target) {
    this.divElement = this.data.nativeElement;
    this.divElement.classList.remove("ng-dirty");
}

在成功提交表单时使用反应性形式删除CSS

想挽留 2025-02-20 18:48:16

如果您尝试自己执行此操作,则应发布您的代码,以便我们可以帮助调试它。

您需要使用Import-CSV将数据输入PS。这将为您提供一系列PS对象。从这里,您可以循环遍历每个对象,并执行所需的计算。

$data = Import-Csv -Path C:\temp\test.csv

$data | Format-Table

foreach ($datum in $data) {
    if ($datum.Serial.StartsWith('C')) {
        $datum.result = $datum.Colour - $datum.Spotcol
    }

    else {
        if ($datum.Colour) { $datum.result = $datum.Colour }
        else { $datum.result = 0 }
    }
}

$data | Format-Table

让我们调用 $ data 数组<代码> $ datum 的每次迭代。您的D列标题为 $ datum.colour ,e列的标题为 $ datum.spotcol ,列的标题为 $ datum.serial.serial 。这是因为数组的每个对象都有列标题为属性名称,而不是Excel的A2 D2东西。

在每次迭代中,如果 $ datum.Serial [a2]以“ C”开头,我们做 $ datum.colour [d2] - $ datum.spotcol < /code> [e2]并将其分配给 $ datum.result [f2]。否则,我们制作 $ datum.result [f2] $ datum.colour [d2]的值。

编辑:

进行语法更改( $ data | ft to $ data |格式 - 桌面

If you have tried to do it on your own, you should post your code so we can help debug it.

You need to use Import-Csv to get the data into PS. This will give you an array of PS Objects. From here, you can loop through each object and do what calculations you need.

$data = Import-Csv -Path C:\temp\test.csv

$data | Format-Table

foreach ($datum in $data) {
    if ($datum.Serial.StartsWith('C')) {
        $datum.result = $datum.Colour - $datum.Spotcol
    }

    else {
        if ($datum.Colour) { $datum.result = $datum.Colour }
        else { $datum.result = 0 }
    }
}

$data | Format-Table

Let's call each iteration of the $data array $datum. Your D column is titled $datum.Colour, E column is titled $datum.Spotcol, and A column is titled $datum.Serial. This is because each object of the array has the column titles as the attribute names instead of Excel's A2 D2 stuff.

At each iteration, if $datum.Serial [A2] starts with "C", we do $datum.Colour [D2] - $datum.Spotcol [E2] and assign it to $datum.result [F2]. Otherwise, we make $datum.result [F2] the value of $datum.Colour [D2].

Edit:

Made grammatical changes ($data | FT to $data | Format-Table)

我想使用powershell在假设&#x27中减去数值(在.csv文件中)。 B2&#x27;从相邻的单元格中说&#x27; c2&#x27;

想挽留 2025-02-20 12:36:02

这是解决方案:

 val sasUrl = resource.data.data //get this sas url from api or anywhere you want
   try {
     val imageStream = contentResolver.openInputStream(Uri.fromFile(File(selectionResult!![0])))
     val imageLength = imageStream!!.available()
     val handler = Handler(Looper.getMainLooper())
     val th = Thread {
         try {
            AzureManager.UploadImage(sasUrl,imageStream, imageLength)
         } catch (ex: Exception) {
            val exceptionMessage = ex.message
            Log.e("SAS_ERROR", "error1: ${ex.localizedMessage}")
         }
       }
     }
             th.start()
      } catch (ex: Exception) {
             Log.e("SAS_ERROR", "error2: ${ex.localizedMessage}")
             Toast.makeText(this, ex.message, Toast.LENGTH_SHORT).show()
      }










//In AzureManager class create this method
    public static void UploadImage(String sasUrl, InputStream image, int imageLength) throws Exception {
        CloudBlockBlob cloudBlockBlob = new CloudBlockBlob(new URI(sasUrl));
        cloudBlockBlob.upload(image, imageLength);
    }

Here is the solution:

 val sasUrl = resource.data.data //get this sas url from api or anywhere you want
   try {
     val imageStream = contentResolver.openInputStream(Uri.fromFile(File(selectionResult!![0])))
     val imageLength = imageStream!!.available()
     val handler = Handler(Looper.getMainLooper())
     val th = Thread {
         try {
            AzureManager.UploadImage(sasUrl,imageStream, imageLength)
         } catch (ex: Exception) {
            val exceptionMessage = ex.message
            Log.e("SAS_ERROR", "error1: ${ex.localizedMessage}")
         }
       }
     }
             th.start()
      } catch (ex: Exception) {
             Log.e("SAS_ERROR", "error2: ${ex.localizedMessage}")
             Toast.makeText(this, ex.message, Toast.LENGTH_SHORT).show()
      }










//In AzureManager class create this method
    public static void UploadImage(String sasUrl, InputStream image, int imageLength) throws Exception {
        CloudBlockBlob cloudBlockBlob = new CloudBlockBlob(new URI(sasUrl));
        cloudBlockBlob.upload(image, imageLength);
    }

使用java在Android中使用SAS URL将文件上传到Azure存储中

想挽留 2025-02-20 07:44:09

您可以将“颜色类”类分为读取的接口和类似的修改接口:

public interface IColors {
    ConsoleColor Primary { get; }
    ConsoleColor Default { get; }
    ConsoleColor Input { get; }
    ConsoleColor Success { get; }
    ConsoleColor Error { get; }
    ConsoleColor Highlight { get; }
}

public interface IModifyableColors {
    ConsoleColor Primary { get; set; }
    ConsoleColor Default { get; set; }
    ConsoleColor Input { get; set; }
    ConsoleColor Success { get; set; }
    ConsoleColor Error { get; set; }
    ConsoleColor Highlight { get; set; }
}

两个接口都将由类 colors (可以成为私有类)实现:

class Colors : IColors, IModifyableColors
{
    public ConsoleColor Primary { get; set; } = ConsoleColor.White;
    public ConsoleColor Default { get; set;  } = ConsoleColor.Gray;
    public ConsoleColor Input { get; set; } = ConsoleColor.Gray;
    public ConsoleColor Success { get; set; } = ConsoleColor.Green;
    public ConsoleColor Error { get; set; } = ConsoleColor.Red;
    public ConsoleColor Highlight { get; set; } = ConsoleColor.Blue;
}

您的UI类将公开仅阅读接口:

public static class UI {
    static readonly Colors _colors = new();

    public static IColors Colors => _colors;

    public static void ConfigureColors(Action<IModifyableColors> modification) {
        modification.Invoke(_colors);
    }
}

You may split the Colors class into a readonly interface and a modification interface like this:

public interface IColors {
    ConsoleColor Primary { get; }
    ConsoleColor Default { get; }
    ConsoleColor Input { get; }
    ConsoleColor Success { get; }
    ConsoleColor Error { get; }
    ConsoleColor Highlight { get; }
}

public interface IModifyableColors {
    ConsoleColor Primary { get; set; }
    ConsoleColor Default { get; set; }
    ConsoleColor Input { get; set; }
    ConsoleColor Success { get; set; }
    ConsoleColor Error { get; set; }
    ConsoleColor Highlight { get; set; }
}

Both interfaces would be implemented by the class Colors (which could be made a private class):

class Colors : IColors, IModifyableColors
{
    public ConsoleColor Primary { get; set; } = ConsoleColor.White;
    public ConsoleColor Default { get; set;  } = ConsoleColor.Gray;
    public ConsoleColor Input { get; set; } = ConsoleColor.Gray;
    public ConsoleColor Success { get; set; } = ConsoleColor.Green;
    public ConsoleColor Error { get; set; } = ConsoleColor.Red;
    public ConsoleColor Highlight { get; set; } = ConsoleColor.Blue;
}

Your UI class would then expose the readonly interface only:

public static class UI {
    static readonly Colors _colors = new();

    public static IColors Colors => _colors;

    public static void ConfigureColors(Action<IModifyableColors> modification) {
        modification.Invoke(_colors);
    }
}

如何仅使用Action&lt; class&gt;如何允许修改类属性方法?

想挽留 2025-02-20 04:42:45

这是我获得3种方法x密集/稀疏阵列的一些统计信息。为了稳定,我会坚持使用 cumsum 方法。

def rejection_randPos(l):
    r, c = l.shape
    i, j = random.randint(0, r - 1), random.randint(0, c - 1)
    while not l[i, j]:
        i, j = random.randint(0, r - 1), random.randint(0, c - 1)
    return i, j

def cumSum_randPos(l):
    c = l.shape[1]
    target = random.randint(1, l.sum())
    idx = np.argmax(l.cumsum() >= target)
    return idx // c, idx % c

def argWhere_randPos(l):
    target = random.randint(0, l.sum() - 1)
    return np.argwhere(l)[target]


A = np.random.rand(5, 8) < 0.8
%timeit rejection_randPos(A)
%timeit cumSum_randPos(A)
%timeit argWhere_randPos(A)
B = np.random.rand(5, 8) < 0.05
%timeit rejection_randPos(B)
%timeit cumSum_randPos(B)
%timeit argWhere_randPos(B)

=&gt;

1.92 µs ± 28.9 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
9.81 µs ± 182 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
12.4 µs ± 148 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
28 µs ± 311 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
10.1 µs ± 753 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
12.3 µs ± 264 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

Here are some statistics I got for 3 methods x dense/sparse arrays. For stability, I would stick with cumSum method.

def rejection_randPos(l):
    r, c = l.shape
    i, j = random.randint(0, r - 1), random.randint(0, c - 1)
    while not l[i, j]:
        i, j = random.randint(0, r - 1), random.randint(0, c - 1)
    return i, j

def cumSum_randPos(l):
    c = l.shape[1]
    target = random.randint(1, l.sum())
    idx = np.argmax(l.cumsum() >= target)
    return idx // c, idx % c

def argWhere_randPos(l):
    target = random.randint(0, l.sum() - 1)
    return np.argwhere(l)[target]


A = np.random.rand(5, 8) < 0.8
%timeit rejection_randPos(A)
%timeit cumSum_randPos(A)
%timeit argWhere_randPos(A)
B = np.random.rand(5, 8) < 0.05
%timeit rejection_randPos(B)
%timeit cumSum_randPos(B)
%timeit argWhere_randPos(B)

=>

1.92 µs ± 28.9 ns per loop (mean ± std. dev. of 7 runs, 1000000 loops each)
9.81 µs ± 182 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
12.4 µs ± 148 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
28 µs ± 311 ns per loop (mean ± std. dev. of 7 runs, 10000 loops each)
10.1 µs ± 753 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)
12.3 µs ± 264 ns per loop (mean ± std. dev. of 7 runs, 100000 loops each)

布尔阵列的随机位置

想挽留 2025-02-20 03:38:41

我找到了一个解决方案:我创建auththread,然后调用main。

I found a solution: I create the authThread, and then call main.

Python非阻滞输入

想挽留 2025-02-19 15:43:42

您可以在没有任何订阅状态的情况下更改整个应用程序。您必须使用等待widgetsbinding.instance.performreassemble(); ,它用您的更新值触发了整个应用程序。这是函数

”在此处输入图像描述

You can change the whole app without any subscription and set state. You have to use await WidgetsBinding.instance.performReassemble(); which is triggered the whole app with your updated value.This is the function

enter image description here

无法使用Flutter_localizations,INTL在子页面中刷新文本

想挽留 2025-02-19 09:27:01

使用&lt; p&gt; arragraphs,而不是文本节点,其中有许多线路断点。

您可以在循环中轻松创建它们:

const lines = [
    'The checked element is : '+e.id,
    data.results[0].title,
    'IMDB  Rating : ' + data.results[0].imdbRating,
    'Year of release : ' + data.results[0].year,
    'Overview : ' + data.results[0].overview,
    data.results[1].title
];
for (const line of lines) {
    const paragraph = document.createElement('p');
    paragraph.appendChild(document.createTextNode(line));
    outputContainer.appendChild(paragraph);
}

Use <p>aragraphs instead of text nodes with many linebreaks inbetween.

You can create them easily in a loop:

const lines = [
    'The checked element is : '+e.id,
    data.results[0].title,
    'IMDB  Rating : ' + data.results[0].imdbRating,
    'Year of release : ' + data.results[0].year,
    'Overview : ' + data.results[0].overview,
    data.results[1].title
];
for (const line of lines) {
    const paragraph = document.createElement('p');
    paragraph.appendChild(document.createTextNode(line));
    outputContainer.appendChild(paragraph);
}

更好,更清洁的编写此代码的方式?

想挽留 2025-02-18 01:40:36

请尝试配置发行人URL ,包括TFP ,以兼容。

有关更多详细信息,请参见: >令牌兼容性
说:

注释:ISS索赔IE;发行人确定Azure AD B2C的租户
发行了令牌。通常价值是这样的东西
https://&lt; domain&gt;/{b2c tent guid}/v2.0/

但是我的应用程序或图书馆需要Azure ad B2C为
符合 openID connect connect discovy 1.0 spec ,使用此
https://&lt; domain&gt;/tfp/{b2c tenant guid}/{policy ID}/v2.0/
包括Azure AD B2C租户和用户流的ID
用于代币请求。

例如:

“issuer” : “https://your-tenant-name.b2clogin.com/tfp/c5b2xxxxxxxxx0-8axxxxxx3d3b/B2C_1A_signin/v2.0/”

https://{tenantID}.b2clogin.com/tfp/{tenantID}/{policy-name}/v2.0/

参考:

  1. 配置Azure Active Directory B2C提供商手动 - Power-Power
    应用| Microsoft Doc

Please try to configure issuer URL including tfp for token compatibility.

For more details see: Token compatibility
which says:

Note : iss claim i.e; issuer identifies tenant of azure ad b2c that
issued the token. Usually the value is some thing like this
:https://<domain>/{B2C tenant GUID}/v2.0/

But If your application or library needs Azure AD B2C to be
compliant with the OpenID Connect Discovery 1.0 spec, use this
https://<domain>/tfp/{B2C tenant GUID}/{Policy ID}/v2.0/
as it
includes IDs for both the Azure AD B2C tenant and the user flow that
was used in the token request.

enter image description here

For example:

“issuer” : “https://your-tenant-name.b2clogin.com/tfp/c5b2xxxxxxxxx0-8axxxxxx3d3b/B2C_1A_signin/v2.0/”

or

https://{tenantID}.b2clogin.com/tfp/{tenantID}/{policy-name}/v2.0/

References:

  1. Configure the Azure Active Directory B2C provider manually - Power
    Apps | Microsoft Docs
  2. AzureAD Authentication with AWS API Gateway v2 JWT Authorizers |
    rayterrill.com

Azure AD B2C破坏OIDC规格

想挽留 2025-02-17 16:47:04

来自

从旋转矩阵初始化。

可以用3 x 3个正确的正交矩阵表示3个维度的旋转[1]。如果输入不正确,则使用[2]中描述的方法创建近似值。

其中[2] f。兰迪斯·马克利(Landis Markley),“旋转矩阵中的单位四元里”,《指导,控制与动力学杂志》。 31.2,第440-442页,2008年。

您的输入非常不是正交的:

>>> intrinsic @ np.transpose(intrinsic)
array([[4.85737872e+05, 1.31178349e+05, 4.81818115e+02],
       [1.31178349e+05, 3.23910199e+05, 2.72256989e+02],
       [4.81818115e+02, 2.72256989e+02, 1.00000000e+00]])

但是返回的旋转矩阵是:

>>> r @ r.T
array([[1.00000000e+00, 2.85398587e-17, 4.25286470e-17],
       [2.85398587e-17, 1.00000000e+00, 2.44541461e-17],
       [4.25286470e-17, 2.44541461e-17, 1.00000000e+00]])

实际上,原始矩阵的特征值与正交矩阵的特征值(单位幅度级复杂):

>>> np.linalg.eigvals(r)
array([0.53490302+0.84491346j, 0.53490302-0.84491346j,
       1.        +0.j        ])

>>> np.linalg.eigvals(intrinsic)
array([503.5763855, 499.7862854,   1.       ])

我不熟悉近似值并且这里使用的假设,但是如果您不提供理智的旋转矩阵,那么当您尝试将其变成一个时,您会得到一些不同的东西也就不足为奇了。

From the docs:

Initialize from rotation matrix.

Rotations in 3 dimensions can be represented with 3 x 3 proper orthogonal matrices [1]. If the input is not proper orthogonal, an approximation is created using the method described in [2].

Where [2] refers to the paper by F. Landis Markley, “Unit Quaternion from Rotation Matrix”, Journal of guidance, control, and dynamics vol. 31.2, pp. 440-442, 2008..

Your input is very much not orthogonal:

>>> intrinsic @ np.transpose(intrinsic)
array([[4.85737872e+05, 1.31178349e+05, 4.81818115e+02],
       [1.31178349e+05, 3.23910199e+05, 2.72256989e+02],
       [4.81818115e+02, 2.72256989e+02, 1.00000000e+00]])

But the returned rotation matrix is, as it should be:

>>> r @ r.T
array([[1.00000000e+00, 2.85398587e-17, 4.25286470e-17],
       [2.85398587e-17, 1.00000000e+00, 2.44541461e-17],
       [4.25286470e-17, 2.44541461e-17, 1.00000000e+00]])

In fact the eigenvalues of your original matrix are nothing like those of an orthogonal matrix (unit magnitude complexes):

>>> np.linalg.eigvals(r)
array([0.53490302+0.84491346j, 0.53490302-0.84491346j,
       1.        +0.j        ])

>>> np.linalg.eigvals(intrinsic)
array([503.5763855, 499.7862854,   1.       ])

I'm not familiar with the approximations and assumptions used here, but if you don't provide a sane rotation matrix then it's not surprising that you get something different when you try to turn it into one.

scipy旋转:from_matrix-&gt; as_quat-&gt; from_quat-&gt; AS_MATRIX给出与输入不同的输出

想挽留 2025-02-17 08:38:20

我怀疑内存是一个指针,您正在使用其地址,从而计算指针的校验和遵循字节而不是 指向

reinterpret_cast 完全不必要,计算您使用的函数已模板。和所有铸造关键字一样, reinterpret_cast cripples编译器类型检查并禁用了许多有用的警告和错误,因此您确实应该认为这是最后的度假胜地。

尝试以下试验:

auto result = CRC32::calculate(memory, 1);

当且仅当您尝试过并且它没有编译时,因为内存实际上不是指针,则

auto result = CRC32::calculate(&memory, 1);

I have a suspicion that memory is a pointer, and you're taking its address, thereby calculating the checksum of the pointer and following bytes rather than the data it points to.

The reinterpret_cast is wholly unnecessary, the calculate function you are using is templated. And like all the cast keywords, reinterpret_cast cripples compiler type-checking and disables a whole lot of useful warnings and errors, so you really should consider it a last resort.

Try this:

auto result = CRC32::calculate(memory, 1);

If and only if you have tried that and it fails to compile because memory is not actually a pointer, then

auto result = CRC32::calculate(&memory, 1);

如何检查整个结构(无需填充)

想挽留 2025-02-16 08:34:23

我们有一个称为“接近”的参数,您可以在文档中检查我们的API参考,此参数是由中心纬度,经度[WGS84度]和RADIUS [meter]指定的圆形搜索区域。

所有几何形状都重叠这个圆圈,将返回,首先按距离排序。示例:接近= 47.731,7.5549,100多个坐标对可以作为半分离的列表传递。对于每个人,搜索了layer_ids列表。如果每个坐标对都在不同的层中探索,则layer_ids包含(逗号分隔列表)层的半分隔列表。

此参数将解决问题。
https://develicer.here.here.here.er.com/documentation/documentation/fleet-telematics/ api reference.html

we have a parameter called "proximity" you can check in our API Reference in the documentation, this parameter is a circular search area specified by center latitude, longitude [WGS84 degrees], and radius [meter].

All geometries overlapping this circle will be returned, sorted by distance, closest first. Example: proximity=47.731,7.5549,100 Multiple coordinate pairs can be passed as a semicolon-separated list. For each of them, the layer_ids list is searched. If each coordinate pair is explored in a different set of layers, layer_ids contains a semicolon-separated list of (comma-separated list of) layers.

This parameter will do the trick.
https://developer.here.com/documentation/fleet-telematics/api-reference.html

这里的机队远程信息处理(Colculaterouteapi)响应错误

想挽留 2025-02-16 07:29:31

我最近遇到了同样的问题。尽管我使用pip安装了“请求”库,但使用WSL,但随后的调用导入请求失败了。
幸运的是,我的一位同事告诉我,请使用:

ln -s /usr/bin/python3 /usr/bin/python

(you may need to sudo first)

打开新的外壳后,解决了问题。可悲的是,我无法详细告诉您为什么。

I ran into the same problem recently. Although I installed the 'requests' library with pip, using wsl, the subsequent call to import requests failed with a ModuleNotFoundError :-(
Luckily a colleague of mine told me to simlink the python command with:

ln -s /usr/bin/python3 /usr/bin/python

(you may need to sudo first)

After opening a new shell, the problem was resolved. Sadly, I cannot tell you in detail why.

使用WSL执行Python文件时的LIB错误(modulenotfounderror:无模块命名为&#x27; pil&#x27;)

想挽留 2025-02-15 18:25:00

无论您最终使用什么,请确保您检查输入尚未被 Magic_quotes 或其他一些好含量的垃圾弄脏,并在必要时通过 stripslashes 或任何对其进行消毒的方法。

Whatever you do end up using, make sure that you check your input hasn't already been mangled by magic_quotes or some other well-meaning rubbish, and if necessary, run it through stripslashes or whatever to sanitize it.

如何防止PHP中的SQL注入?

想挽留 2025-02-15 16:53:16

在Windows-gnu中实际上有两个不同的目标:

  • x86_64-pc-windows-gnu 构建64位可执行文件和
  • i686-pc-windows-gnu 构建32--位。

当您使用货物时,您会告诉它与 - Target 一起使用的目标,但默认值将是您使用的目标,通常是64位。

调用 GCC 目标的位置将导致参数 -M32 -M64 。通常GCC会接受这两个选项,但是有时,如果您只有32位的编译器版本,则(或货物)使用 -M64 选项,将会对此抱怨:

sorry, unimplemented: 64-bit mode not compiled in

正确的解决方案是安装64位Mingw版本,这应该是当今的默认版本。我的意思是,通常的叉子现在称为 mingw- w64

In Windows-Gnu there are actually two different targets:

  • x86_64-pc-windows-gnu to build 64-bit executables and
  • i686-pc-windows-gnu to build 32-bit ones.

When you use cargo you tell it what target to use with --target, but the default will be the one you are using, that usually will be the 64-bit one.

When invoking gcc the bitness of the target will result in the parameter -m32 or -m64. Usually GCC will accept both options, but sometimes, if you have a 32-bit only version of the compiler, if you (or cargo) use the -m64 option the compiler will complain with that:

sorry, unimplemented: 64-bit mode not compiled in

The right solution is to install a 64-bit MinGW version, that should be the default nowadays. I mean, the usual fork is now called MinGW-w64.

不能编译项目

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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