笙痞

文章 评论 浏览 30

笙痞 2025-02-14 03:44:59

恐怕我没有时间写一个完整的答案,但是以下可能会有所帮助。我相信有一种方法可以避免使用 sumproduct 编写多个 countifs ,但我还没有到达那里。

=SUM(1,
    COUNTIFS($B3,">"&$C3),
    COUNTIFS($B3,">" & SUM($C3:$D3)),
    COUNTIFS($B3,">" & SUM($C3:$E3))
)

I am afraid I don't have time to write a full answer but the below might help. I am sure there is a way to avoid writing multiple COUNTIFS with a SUMPRODUCT but I haven't got there yet.

=SUM(1,
    COUNTIFS($B3,">"&$C3),
    COUNTIFS($B3,">" & SUM($C3:$D3)),
    COUNTIFS($B3,">" & SUM($C3:$E3))
)

enter image description here

我如何创建一个公式,该公式将返回一个日期和以前的日期大于某些要求的数字?

笙痞 2025-02-13 22:54:00

谢谢大家。

问题是包裹。
我已经重新创建了整个项目,现在它正常工作。

Thanks all.

The issue was with the packages.
I have recreated the whole project and now it's working properly.

RectRouter空白页

笙痞 2025-02-13 16:29:03

我能够如下解决:

<html>
<head></head>
<body>
    <img id="photo" alt="Girl in a jacket" width="500" height="600">
</body>
    <script type="text/javascript">
        const myRequest = new Request('http://localhost:8080/blue/', {
        method: 'GET',
        headers: new Headers(),
        type: "arraybuffer",
        mode: 'cors',
        cache: 'default',
        });

        fetch(myRequest)
            .then(response => response.blob())
            .then(blob => {
                var reader = new FileReader();
                reader.readAsDataURL(blob); 
                reader.onloadend = function() {
                    var imageUrl = reader.result;                
                    var img = document.querySelector("#photo");
                    img.src = imageUrl;
                }
            });
    </script>
</html>

I was able to solve it as below:

<html>
<head></head>
<body>
    <img id="photo" alt="Girl in a jacket" width="500" height="600">
</body>
    <script type="text/javascript">
        const myRequest = new Request('http://localhost:8080/blue/', {
        method: 'GET',
        headers: new Headers(),
        type: "arraybuffer",
        mode: 'cors',
        cache: 'default',
        });

        fetch(myRequest)
            .then(response => response.blob())
            .then(blob => {
                var reader = new FileReader();
                reader.readAsDataURL(blob); 
                reader.onloadend = function() {
                    var imageUrl = reader.result;                
                    var img = document.querySelector("#photo");
                    img.src = imageUrl;
                }
            });
    </script>
</html>

在图像中加载缓冲液,反射为blob null

笙痞 2025-02-13 09:28:29

它之所以被弃用是因为语义始终有点模糊,我们不能保证使用它的样式表将在以后的版本中始终以相同的方式工作:它使代码取决于指令执行顺序,可以通过增强优化器轻松更改。我们无意实际撤回语法 - 尽管如果造成严重问题,我们可能会这样做。

关于马丁的评论,欢迎您在这里提出有关撒克逊商业版的问题,但是如果您在saxonica.plan.io上提出问题,我们会更有义务对开源用户同样如此。

It's deprecated because the semantics have always been a bit fuzzy, and we can't guarantee that a stylesheet that uses it will always work the same way in a future release: it makes the code dependent on the order of execution of instructions, which can easily change with an enhancement to the optimizer. We have no intention of actually withdrawing the syntax - though we might do so if it causes serious problems.

As regards Martin's comment, you're welcome to raise questions about the commercial editions of Saxon here, but we feel more of an obligation to actually respond if you raise the question on saxonica.plan.io - that's equally true for open source users.

撒克逊人:可分配的折旧时间线

笙痞 2025-02-12 17:17:24

在Haskell中,我们为我们传达的值编写lambdas:

id :: forall a . a->a
id = \x -> x

但是,当我们编译为封闭于系统F的低级核心语言时,我们还会看到 type lambdas 。代码变得更像

id = \ @a (x :: @a) -> x

是:呼叫者应选择并传递类型 @A ,然后是该类型的值 x :: @a ,最后回到 X

现在,您的问题来自

forall a . T -> U a
--  vs
T -> forall a . U a

此处的两种(同构)类型, t 不取决于 a 。这两种类型确实是同构的,在较低的层面上,这只是用类型lambda“翻转”术语的问题:

\ @a (x :: T) -> ...  -- has the former type
-- vs
\ (x :: T) @a -> ...  -- has the latter

由于在Haskell中,我们通常不会写或看到类型 - lambdas,因此很难区分在这之间。此外,当编译器执行类型推理时,它将(据我所知)推断出第一个类型的推断,其中类型 - lambdas都是开始的。

两者到底有什么区别?

不多。毕竟,它们具有同构类型。一个在最高级别上具有 forall a ,而另一个则位于另一个位置。

一旦您像以前一样应用对参数,GHC将自动选择添加推断 @A 参数的正确位置,因此您不会轻易注意到差异。这两个呼叫是这些形式的:

f @r x
-- vs
f x @r

最重要的是,GHC可以重新将类型重新化,因此我们获得了

(\@r -> f @r x) :: forall r . ....
(\@r -> f x @r) :: forall r . ....

我可以用一个不能用另一个做的事情吗?

并不真地。

为什么完全需要通用量化才能向后?

通常,当定义 a b 之间的同构时,我们想要

forw :: A -> B
back :: B -> A

任何一种类型都有forall(例如, a = forallr。vr )然后,我们在该职位上得到一个福特。请注意,在这种情况下, back 的类型也是异摩式,

forall r . B -> V r

如果我们省略了量词,我们将获得的类型(并让Haskell重新添加它在顶级级别上)。

(相比之下, forw ::(Forallr。vr)类型中的量词无法移动到顶级。

In Haskell we write lambdas for the values we pass:

id :: forall a . a->a
id = \x -> x

but when we compile to the lower-level Core language, which is closed to System F, we also see type lambdas. The code becomes more like

id = \ @a (x :: @a) -> x

which means: the caller should choose and pass a type @a, then a value of that type x :: @a and finally receive that value back x.

Now, your issue arises from the two (isomorphic) types

forall a . T -> U a
--  vs
T -> forall a . U a

Here, T does not depend on a. The two types are indeed isomorphic, and at the lower level it's just a matter of "flipping" the term-lambda with the type-lambda:

\ @a (x :: T) -> ...  -- has the former type
-- vs
\ (x :: T) @a -> ...  -- has the latter

Since in Haskell we do not usually write or see the type-lambdas, it is hard to distinguish between these. Further, when the compiler performs type inference it will (as far as I can understand) infer the first one, where the type-lambdas are all at the beginning.

What exactly is the difference between the two?

Not much. They have isomorphic types, after all. One has the forall a at the topmost level, while the other has it in another position.

Once you apply then to arguments as you did, GHC will automatically choose the right place to add the inferred @a argument, so you won't easily notice the difference. The two calls are of these forms:

f @r x
-- vs
f x @r

On top, GHC can re-generalize the type, hence we obtain

(\@r -> f @r x) :: forall r . ....
(\@r -> f x @r) :: forall r . ....

Is there something I can do with one that can't be done with the other?

Not really.

Why is the universal quantification needed at all for backward?

Usually, when defining an isomorphism between A and B we want

forw :: A -> B
back :: B -> A

If either type has a forall (say, A = forall r . V r) then we get a forall in that position. Note that the type for back in this case is also isormoprhic to

forall r . B -> V r

which is what we would get if we omitted the quantifier (and let Haskell re-add it implicitly at the top-level).

(By contrast, the quantifier in the type of forw :: (forall r . V r) -> B can not be moved to the top level.)

如何理解Yoneda的自然同构中的普遍量化?

笙痞 2025-02-12 16:14:49

您可以提取 onsuccess 或 onerror 使用 运算符并检查返回的类型 result

suspend fun registerDevice(): Result<String> {
    try {
        val result: AwsResult<String> = repository.getChallenge()
        when (result) {
            is AwsResult.onSuccess -> {
                val data = result.data
                // ... do something when request is success
            }
            is AwsResult.onError -> {
                val exception = result.exception
                // ... do something when request is error
            }
        }
        
    } catch (e: Exception) {

    }
}

我也将' t建议以小字母开头命名科特林课程,良好的风格是以大字母开头命名课程:

sealed class AwsResult<out R> {
    data class Success<out T>(val data: T) : AwsResult<T>()
    data class Error(val exception: Exception) : AwsResult<Nothing>()
}

You can extract onSuccess or onError using when operator and checking a type of the returned result:

suspend fun registerDevice(): Result<String> {
    try {
        val result: AwsResult<String> = repository.getChallenge()
        when (result) {
            is AwsResult.onSuccess -> {
                val data = result.data
                // ... do something when request is success
            }
            is AwsResult.onError -> {
                val exception = result.exception
                // ... do something when request is error
            }
        }
        
    } catch (e: Exception) {

    }
}

Also I wouldn't recommend to name Kotlin classes starting with a small letter, the good style is to name classes starting with a big letter:

sealed class AwsResult<out R> {
    data class Success<out T>(val data: T) : AwsResult<T>()
    data class Error(val exception: Exception) : AwsResult<Nothing>()
}

暂停用户酶与存储库

笙痞 2025-02-12 12:19:25

这是我的第一个评论,所以我希望它有效,

但是您可以尝试使用diff:

diff file1.txt file2.txt

This is litteratly my first comment so I hope it works,

but you can try using diff:

diff file1.txt file2.txt

如何使用BASH脚本比较两个文本文件的两个文本文件?

笙痞 2025-02-12 07:39:11

如果您在 test_a 上方取消装饰器并删除参数,则它将起作用。另外,您可以从班级定义和固定装饰器中删除冗余括号:

import pytest


@pytest.fixture
def my_fixture():
    print('Inside fixture my_fixture.')


@pytest.fixture
def a():
    print('Inside fixture a . Returning value 3 for a')
    return 3


class Test:

    @pytest.mark.usefixtures('my_fixture', 'a')
    def test_a(self, a):
        print("Inside test. Argument has value: {}".format(a))


if __name__ == '__main__':
    pytest.main()

If you uncomment decorator above test_a and remove parameters it will work. Also you can remove redundant parentheses from class definition and fixture decorator:

import pytest


@pytest.fixture
def my_fixture():
    print('Inside fixture my_fixture.')


@pytest.fixture
def a():
    print('Inside fixture a . Returning value 3 for a')
    return 3


class Test:

    @pytest.mark.usefixtures('my_fixture', 'a')
    def test_a(self, a):
        print("Inside test. Argument has value: {}".format(a))


if __name__ == '__main__':
    pytest.main()

固定装置&#x27; a&#x27;未找到

笙痞 2025-02-12 02:22:10

如果要检查列中是否有python int s,请尝试以下操作:

df['quantity'].map(type).eq(int).any()

If you want to check if there are any Python ints in your column, try this:

df['quantity'].map(type).eq(int).any()

检查列中的值是否为整数并返回true

笙痞 2025-02-11 17:33:29

您可以使用 noreferrer“> repess unpessignit: :body() 以及使用 标题:: set 。您必须将选项&lt; jsvalue&gt; 传递给 request> requestInit :: body()。要通过字符串,您可以执行:

let mut opts = RequestInit::new();
opts.method("POST");
opts.body(Some(wasm_bindgen::JsValue::from_str("[1, 2, 3]")));
opts.credentials(web_sys::RequestCredentials::Include);
    
let request = Request::new_with_str_and_init(
    "http://localhost:8080/api/v1/books",
    &opts
).unwrap();

request.headers().set("content-type", "application/json");

// send the request

要发送更复杂的对象,可以使用 jsvalue :: from_serde

You can set the body using RequestInit::body() and the required headers using Headers::set. You have to pass an Option<JsValue> to RequestInit::body(). To pass a string, you can do:

let mut opts = RequestInit::new();
opts.method("POST");
opts.body(Some(wasm_bindgen::JsValue::from_str("[1, 2, 3]")));
opts.credentials(web_sys::RequestCredentials::Include);
    
let request = Request::new_with_str_and_init(
    "http://localhost:8080/api/v1/books",
    &opts
).unwrap();

request.headers().set("content-type", "application/json");

// send the request

To send a more complex object, you can use serde with JsValue::from_serde.

如何在WebAssembly中使用Web-Sys与JSON主体提出发布请求?

笙痞 2025-02-11 11:33:26

Debezium仅将数据源用于Kafka。不会从Kafka阅读或写入新数据库。

您可以使用JDBC接收器Kafka连接器转介其旧博客文章,以写入新服务器

https://debezium.io/blog/2017/09/25/streaming-to-to-to-to-another-another-database/

Debezium only sources data into Kafka. Won't read from Kafka or write to a new database.

You can refer an old blog post of theirs using the JDBC Sink Kafka Connector to write to a new server

https://debezium.io/blog/2017/09/25/streaming-to-another-database/

流数据库(MARIADB)使用Apache-Kafka和Debezium Connector更改为另一个数据库表

笙痞 2025-02-11 09:33:30

Workmanager仅支持iOS上的一次性任务。在文档中很明显。

此外,当应用程序从应用程序切换器终止时,不要指望您的任务执行。

iOS决定何时根据电池寿命,设备觉醒是否为诸如诸如电池寿命之类的事物为您的流程分配线程,现在甚至拥有ML模型,可以从应用程序的过去性能和使用模式中学习。您无法可靠地预测何时从队列中挑选任务。

就我而言,我在白天的某些时间需要进行一些计算并发送通知。我只是将所有这些计算都移至服务器并发送了远程通知。

Workmanager only supports one-off tasks on iOS. It is pretty clear on that in its documentation.

Moreover, don't expect your tasks to execute when the app is terminated from the app switcher.

iOS decides when to assign threads for your process based on things such as battery life, if the device is awake or not, and now even has ML models that learn from the past performance of your app and your usage patterns. You can't reliably predict when your task gets picked from the queue.

In my case, I had some computation to do at certain times in the day and send a notification. I just moved all of that computation to the server and sent remote notifications.

Flutter Workmanager计划背景工作iOS

笙痞 2025-02-11 05:50:14

九头蛇不支持这种扩展。
您可以通过按照描述的在这里)来实现它。

像:
您可以通过默认列表组成config节点baz.c和bar.c,具有原型 foo/proto.yaml 充当基础:

aa: ???
bb: 2

bar/c.yaml:

defaults:
 - /foo/c@c
c:
  aa: 1
  # bb will be "inherited" from /foo/c

baz/c.yaml:

defaults:
 - /foo/c@c
c:
  aa: 2
  # bb will be "inherited" from /foo/c

注意:

  1. 我没有运行它,所以这里可能会有一些东西,但是总的来说,这是必经之路。
  2. 您的例子是不透明的,很难说什么是重要的,什么不是。可能有一种更干净的方法来实现您实际要做的事情。

Hydra does not support this kind of extension.
You can achieve it by extending configs as described here.

Something like:
You can compose the config node baz.c and bar.c via the defaults list, having a prototype foo/proto.yaml act as a base:

aa: ???
bb: 2

bar/c.yaml:

defaults:
 - /foo/c@c
c:
  aa: 1
  # bb will be "inherited" from /foo/c

baz/c.yaml:

defaults:
 - /foo/c@c
c:
  aa: 2
  # bb will be "inherited" from /foo/c

Note:

  1. I didn't run it so there could be something off here, but in general that's the way to go.
  2. Your example is opaque and it's hard to say what is important and what is not. There could be a cleaner way to achieve what you are actually trying to do.

Hydra覆盖.YAML配置中的插值dict值

笙痞 2025-02-11 02:52:20

java.lang.math 中的操作与Java中的所有其他算术操作一致。整数操作总是在64位或32位 int 中工作。

如果移位操作员以外的整数操作员至少具有一个类型 long 的操作数,则使用64位精度进行操作,而数值操作员的结果是类型。如果其他操作数不是 long ,则首先将其加宽()。

否则,使用32位精度进行操作,数值操作员的结果是 int 。如果两个操作数不是 int ,则首先将其扩大到 int 由数字促销。

换句话说,即使以下相当于 abs 的以下内容都不会编译:

byte a = 42, absA = a < 0? -a: a;

因为数字操作 -a 都会将 a 促进 >否定之前

重要的是,将结果的表现为 byte 在这里不会是无损操作。 字节数据类型的值范围从 -128 +127 ,因此,如果值为 -128 ,它的绝对值 +128 在字节值范围之外,并且将铸造为 byte 将导致溢出到 -127

因此,要进行正确且有效的计算,您应该在Java中像始终执行 byte 简短 char> char 计算,使用 int 计算所有内容,仅将最终结果归还给您的数据类型。当您要计算平均值时,必须使用 int 进行计算(甚至 long ,如果您的数组元素超过16777215)。

byte[] array // e.g. test case: = { 1, -1, -128, 127 };

int sum = 0;
for(byte b: array) sum += Math.abs(b);
int average = sum/array.length;
// if you really need a byte result
byte byteAverage = average == 128? 127: (byte)average;

我不知道Kotlin,但是在Java中,如果操作数是类型 byte ,则自动促销对 int 也有效,因此您无需“铸造它是一个整数”来调用 math.abs(int)。您只需要处理结果,即结果是 int ,就像 byte 上的所有算术操作一样,简短, char 或其包装器类型。

The operations in java.lang.Math are in line with all other arithmetic operations in Java. Integer operations always work in either, 64 bit long or 32 bit int.

As stated in JLS, §4.2.2. Integer Operations

If an integer operator other than a shift operator has at least one operand of type long, then the operation is carried out using 64-bit precision, and the result of the numerical operator is of type long. If the other operand is not long, it is first widened (§5.1.5) to type long by numeric promotion (§5.6).

Otherwise, the operation is carried out using 32-bit precision, and the result of the numerical operator is of type int. If either operand is not an int, it is first widened to type int by numeric promotion.

In other words, not even the following, equivalent to abs, would compile:

byte a = 42, absA = a < 0? -a: a;

as the numeric operation -a will promote a to int before negating.

It’s important that a cast of the result to byte would not be a lossless operation here. The byte datatype has a value range from -128 to +127, so if the value is -128, its absolute value +128 is outside the byte value range and a cast to byte would cause an overflow to -127.

Therefore, to have a correct and efficient calculation, you should do as always in Java when it comes to byte, short, or char calculations, calculate everything using int and only cast the final result back to your data type. When you want to calculate the average, you have to calculate the sum using int anyway (or even long if you have more than 16777215 array elements).

byte[] array // e.g. test case: = { 1, -1, -128, 127 };

int sum = 0;
for(byte b: array) sum += Math.abs(b);
int average = sum/array.length;
// if you really need a byte result
byte byteAverage = average == 128? 127: (byte)average;

I don’t know about Kotlin, but in Java, the automatic promotion to int also works if the operand is of type Byte, so you don’t need to “cast it to an integer” to call Math.abs(int). You only have to deal with the fact that the result will be an int, as with all arithmetic operations on byte, short, char, or their wrapper types.

在Kotlin或Java中找到字节变量的绝对值?

笙痞 2025-02-10 19:44:09

嵌套以进行环(Java/kotlin)是在单线线程中完成的,因此不一定是表现最多的。

如果标准位图,则具有 colormatrixfilter ,但您正在尝试使用图像流进行更多操作。

Android最近贬低了他们的计算系统 renderscript> renderscript 并建议移动到 vulkan 。 Open gl es仍得到支持,请参见 https://github.com/google/google/groafika =“ https://github.com/cats-oss/android-gpuimage” rel =“ nofollow noreferrer”> https://github.com/cats-oss-oss/android-gpuimage 用于一些示例。

您可以用

Android的OpenCV存在,但请注意,如果您是从桌面上移植代码,则版本之间的功能会有所不同。

对于基于机器学习的图像处理模型,IE tensorflow lite lite ,您可以使用 camerax映像分析如果使用设备摄像头。其他型号可用,例如 Google的Mediapipe Project

Nested for loops (Java/Kotlin) are done in single thread so not necessarily the most performant.

If standard bitmap, there are functions like ColorMatrixFilter but you are trying to do more with a stream of images.

Android recently depreciated their compute system Renderscript and advise moving to Vulkan. Open GL ES remains supported, see https://github.com/google/grafika and https://github.com/cats-oss/android-gpuimage for some examples.

You can write your own code with the Android NDK in C/C++ via JNI

OpenCV exists for Android but be aware that features between versions vary if you are porting code over from desktop.

For a machine learning based image processing model i.e. Tensorflow Lite, you can use CameraX Image Analysis if using the device camera. Other models are available such as Google's MediaPipe project.

Java / Kotlin-快速像素明智图像操作的最佳方法

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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