故事和酒

文章 评论 浏览 29

故事和酒 2025-02-20 20:46:33

这是Apache TinkerPop将数据库实现器留下的东西,并且它确实因实现而有所不同。我看到您用Amazon-Neptune标记了问题。当前,Neptune仅对顶点和边缘执行唯一的ID约束。

在以后的版本中,可能会添加其他模式约束功能,但是目前您必须在应用程序逻辑中监视/控制该功能。

This is something that Apache TinkerPop leaves up to the database implementor, and it does vary by implementation. I see you tagged the question with amazon-neptune. Currently Neptune only enforces the unique ID constraints for vertices and edges.

It's possible in a future release that additional schema constraint capabilities will be added, but at the present time you would have to monitor/control that in your application logic.

如何确保Gremlin顶点上的独特属性?

故事和酒 2025-02-20 20:08:21

我已经阅读了您的问题4次,并且从我所要求的内容中读取了:“如何在使用SSMS中使用结果对文本选项进行返回结果中的特定列的列宽度”。

答案:

是,转换(varchar(10)....是解决方案

否,convert(varchar(10)....系统函数不会影响性能 的方式。

实用 href =“ https://blog.sqlauthority.com/2016/06/06/sql-server-server-vertical-select-mode-mode-mode-feature-sql-server-management-studio/”模式“它允许您一次编辑多行文本。这对于删除不中断空间的结果很有用 。

列 是的,他们可以放慢脚步。

I have read your question 4 times and from what I understand what you are asking is: "how to reduce column width of a specific column in returned results when using Results to Text option in SSMS".

Answer:

YES, CONVERT(VARCHAR(10) .... is the solution

AND

NO, CONVERT(VARCHAR(10) .... system function will not impact performance in a practical way.

Another useful feature in SSMS is "Vertical Block Select Mode" which allows you to edit multiple lines of text at once. This is useful for removing unnecesary white space in Result to Text columns.

RE "but am also told by a senior dev that too many functions with a system that runs thousands if not hundreds of thousands of lines of code can be slowed down by too many functions": you senior dev is talking about user defined functions. Yes they can slow things down.

不同的别名语法的含义及其对该别名行的字符长度输出的影响?

故事和酒 2025-02-20 17:38:59

您的链接会在参考它们的对象文件之前消耗库,然后

  • 尝试编译并将程序链接到GCC工具链。
  • 您的链接指定所有必要的库和库搜索路径,
  • 如果libfoo取决于libbar,那么您的链接在libbar之前正确放置libfoo
  • 您的链接失败了,未定义的引用 错误。
  • 但是所有未定义的某物 s均在您拥有的标题文件中声明
    #include d,实际上是您要链接的库中定义的。

示例在C中。它们同样可能是C ++

一个最小的例子,涉及您构建的静态库

my_lib.c

#include "my_lib.h"
#include <stdio.h>

void hw(void)
{
    puts("Hello World");
}

my_lib.h

#ifndef MY_LIB_H
#define MT_LIB_H

extern void hw(void);

#endif

eg1.c

#include <my_lib.h>

int main()
{
    hw();
    return 0;
}

您构建静态库:

$ gcc -c -o my_lib.o my_lib.c
$ ar rcs libmy_lib.a my_lib.o

编译程序:

$ gcc -I. -c -o eg1.o eg1.c

您尝试将其链接到libmy_lib.a and Fail:

$ gcc -o eg1 -L. -lmy_lib eg1.o 
eg1.o: In function `main':
eg1.c:(.text+0x5): undefined reference to `hw'
collect2: error: ld returned 1 exit status

如果您在一个步骤中进行编译和链接,则相同的结果,例如:

$ gcc -o eg1 -I. -L. -lmy_lib eg1.c
/tmp/ccQk1tvs.o: In function `main':
eg1.c:(.text+0x5): undefined reference to `hw'
collect2: error: ld returned 1 exit status

一个涉及共享系统库的最小示例,压缩库libz

eg2.c

#include <zlib.h>
#include <stdio.h>

int main()
{
    printf("%s\n",zlibVersion());
    return 0;
}

编译您的程序:

$ gcc -c -o eg2.o eg2.c

尝试将您的程序与libz链接到失败:

$ gcc -o eg2 -lz eg2.o 
eg2.o: In function `main':
eg2.c:(.text+0x5): undefined reference to `zlibVersion'
collect2: error: ld returned 1 exit status

同样,如果您一口气编译并链接:

$ gcc -o eg2 -I. -lz eg2.c
/tmp/ccxCiGn7.o: In function `main':
eg2.c:(.text+0x5): undefined reference to `zlibVersion'
collect2: error: ld returned 1 exit status

以及涉及pkg-config的示例2上的变体:

$ gcc -o eg2 $(pkg-config --libs zlib) eg2.o 
eg2.o: In function `main':
eg2.c:(.text+0x5): undefined reference to `zlibVersion'

您在做什么错?

在要链接的对象文件和库中,以使您的
程序,您将库放在参考的对象文件之前
他们。您需要在之后放置库
给他们。

链接示例1正确:

$ gcc -o eg1 eg1.o -L. -lmy_lib

成功:

$ ./eg1 
Hello World

链接示例2正确:

$ gcc -o eg2 eg2.o -lz

成功:

$ ./eg2 
1.2.8

链接示例2 pkg-config变化正确:

$ gcc -o eg2 eg2.o $(pkg-config --libs zlib) 
$ ./eg2
1.2.8

说明

读数是可选的。

默认情况下,GCC生成的链接命令在您的发行版上,
在从左到右的链接中消费文件
命令行序列。当发现一个文件是指某物
并且不包含其定义,将搜索定义
在右边的文件中。如果最终找到一个定义,
参考已解决。如果任何参考文献在最后仍未解决,
链接失败:链接器不会向后搜索。

首先,示例1 ,使用静态库my_lib.a

静态库是对象文件的索引存档。当链接器时
在链接序列中查找-lmy_lib,并计算出这是指
到静态库./ libmy_lib.a,它想知道您的程序是否
需要libmy_lib.a中的任何对象文件。

libmy_lib.a中只有对象文件,即my_lib.o,只有一件事定义
my_lib.o中,即功能hw

链接器将决定您的程序需要my_lib.o,并且仅当它已经知道
您的程序是指hw,在一个或多个对象文件中
添加到程序中,并且没有添加的对象文件
包含HW的定义。

如果是真的,那么链接器将从库中提取my_lib.o的副本,
将其添加到您的程序中。然后,您的程序包含hw的定义,因此
它对hw的引用已解决

当您尝试链接程序时:

$ gcc -o eg1 -L. -lmy_lib eg1.o

链接器尚未添加 eg1.o 到程序
-lmy_lib。因为那时它尚未看到eg1.o
您的程序尚未提及hw
尚未完全引用任何参考 ,因为它所做的所有参考
eg1.o中。

因此,链接器不会将my_lib.o添加到程序中,并且没有更多
用于libmy_lib.a

接下来,它找到eg1.o,并将其添加为程序。一个对象文件
链接序列始终添加到程序中。现在,该程序使
引用hw,不包含hw的定义;但
链接序列中没有什么可以提供丢失的
定义。对hw的引用结束未解决的,链接失败。

其次,示例2 ,使用共享库libz

共享库不是对象文件或类似物品的内容。它是
更像没有main功能的 program
而是公开其定义的其他多个符号,以便其他符号
程序可以在运行时使用它们。

今天,许多Linux发行版将配置其GCC工具链,以便其语言驱动程序(GCCg ++gfortran等)
指示系统链接器(ld)以 as-As-As-As-neded 基础链接共享库。
您有其中一个发行版。

这意味着,当链接器在链接序列中找到-Lz
到共享库(Say)/usr/lib/x86_64-linux-gnu/libz.so,它想知道是否已添加到尚未定义的程序中的任何引用由libz导出的定义

如果这是真的,那么链接器将 not 将任何块从libz
将它们添加到您的程序中;相反,它只会医生您程序的代码
这样: -

  • 在运行时,系统程序加载程序将将libz的副本加载到
    随着程序加载程序的副本,运行它。

  • 在运行时,每当您的程序指定的内容
    libz,该参考使用libz in in in
    相同的过程。

您的程序只想参考由libz导出的定义的一件事,
即功能zlibversion,仅在eg2.c中仅引用一次。
如果链接器将其引用到您的程序,然后找到定义
libz导出,引用是已解决的

但是当您尝试链接程序时,例如:

gcc -o eg2 -lz eg2.o

事件的顺序与示例1相同的方式是错误的。
在链接器找到-lz时, no 参考任何内容
在程序中:它们都在eg2.o中,尚未看到。所以
Linker认为Libz没有用。当它到达eg2.o时,将其添加到程序中,
然后对zlibversion有未定义的引用,链接序列完成了;
该引用尚未解决,链接失败。

最后,pkg-config示例2的变体具有明显的解释。
壳扩张之后:

gcc -o eg2 $(pkg-config --libs zlib) eg2.o

变为:

gcc -o eg2 -lz eg2.o

这只是示例2。

我可以在示例1中重现问题,但不能在示例2中

链接:

gcc -o eg2 -lz eg2.o

对您来说很好!

(OR:该链接对您有效,例如Fedora 23,但在Ubuntu 16.04上失败了)

这是因为链接工作的发行版是其中之一
不将其GCC工具链配置为链接共享库 as-as-needed

回到当天,类似Unix的系统链接静态和共享是正常的
图书馆通过不同的规则。链接序列中的静态库是链接的
在示例1中解释的基于的基础上,但共享库是无条件链接的。

这种行为在链接时间是经济的,因为链接器不必思考
该程序是否需要共享库:如果是共享库,
链接它。大多数链接中的大多数库都是共享库。但是也有缺点: -

  • 它在运行时不经济,因为它可能导致共享库为
    即使不需要程序也与程序一起加载。

  • 静态和共享库的不同链接规则可能使人困惑
    到不知道-lfoo是否在其链接中是否不知道-lfoo
    即将解析为/some/where/libfoo.a/some/where/libfoo.so
    并且可能不了解共享和静态库之间的区别
    无论如何。

这种权衡导致了当今的分裂状况。一些发行版
更改了他们共享库的海湾合作委员会链接规则,以便 as-as-neded
原理适用于所有库。一些发行版与旧
方式。

即使我同时编译和链接,我仍然会遇到这个问题?

如果我只是这样做:

$ gcc -o eg1 -I. -L. -lmy_lib eg1.c

肯定必须首先编译eg1.c,然后链接结果
带有libmy_lib.a的对象文件。所以怎么不知道该对象文件
进行链接时需要吗?

因为编译和与单个命令链接不会改变
连锁序列的顺序。

运行上面的命令时,gcc数字显示您需要汇编 +
连锁。因此,在幕后,它会生成一个编译命令,并运行
然后,然后生成一个链接命令,然后运行它,好像 you 已经运行了
两个命令:

$ gcc -I. -c -o eg1.o eg1.c
$ gcc -o eg1 -L. -lmy_lib eg1.o

因此,如果您 do 运行这两个命令,则链接会失败。这
您在失败中注意到的唯一区别是GCC已经生成了
编译 +链接案例中的临时对象文件,因为您没有告诉它
使用eg1.o。我们看到:

/tmp/ccQk1tvs.o: In function `main'

而不是:

eg1.o: In function `main':

另请参见

指定了相互依存的链接库的顺序是错误的

只是一种方式
在其中您可以获得需要需要的定义的文件
在链接的后面,与提供定义的文件相比。将图书馆放在
引用它们的对象文件是犯同样错误的另一种方式。

Your linkage consumes libraries before the object files that refer to them

  • You are trying to compile and link your program with the GCC toolchain.
  • Your linkage specifies all of the necessary libraries and library search paths
  • If libfoo depends on libbar, then your linkage correctly puts libfoo before libbar.
  • Your linkage fails with undefined reference to something errors.
  • But all the undefined somethings are declared in the header files you have
    #included and are in fact defined in the libraries that you are linking.

Examples are in C. They could equally well be C++

A minimal example involving a static library you built yourself

my_lib.c

#include "my_lib.h"
#include <stdio.h>

void hw(void)
{
    puts("Hello World");
}

my_lib.h

#ifndef MY_LIB_H
#define MT_LIB_H

extern void hw(void);

#endif

eg1.c

#include <my_lib.h>

int main()
{
    hw();
    return 0;
}

You build your static library:

$ gcc -c -o my_lib.o my_lib.c
$ ar rcs libmy_lib.a my_lib.o

You compile your program:

$ gcc -I. -c -o eg1.o eg1.c

You try to link it with libmy_lib.a and fail:

$ gcc -o eg1 -L. -lmy_lib eg1.o 
eg1.o: In function `main':
eg1.c:(.text+0x5): undefined reference to `hw'
collect2: error: ld returned 1 exit status

The same result if you compile and link in one step, like:

$ gcc -o eg1 -I. -L. -lmy_lib eg1.c
/tmp/ccQk1tvs.o: In function `main':
eg1.c:(.text+0x5): undefined reference to `hw'
collect2: error: ld returned 1 exit status

A minimal example involving a shared system library, the compression library libz

eg2.c

#include <zlib.h>
#include <stdio.h>

int main()
{
    printf("%s\n",zlibVersion());
    return 0;
}

Compile your program:

$ gcc -c -o eg2.o eg2.c

Try to link your program with libz and fail:

$ gcc -o eg2 -lz eg2.o 
eg2.o: In function `main':
eg2.c:(.text+0x5): undefined reference to `zlibVersion'
collect2: error: ld returned 1 exit status

Same if you compile and link in one go:

$ gcc -o eg2 -I. -lz eg2.c
/tmp/ccxCiGn7.o: In function `main':
eg2.c:(.text+0x5): undefined reference to `zlibVersion'
collect2: error: ld returned 1 exit status

And a variation on example 2 involving pkg-config:

$ gcc -o eg2 $(pkg-config --libs zlib) eg2.o 
eg2.o: In function `main':
eg2.c:(.text+0x5): undefined reference to `zlibVersion'

What are you doing wrong?

In the sequence of object files and libraries you want to link to make your
program, you are placing the libraries before the object files that refer to
them. You need to place the libraries after the object files that refer
to them.

Link example 1 correctly:

$ gcc -o eg1 eg1.o -L. -lmy_lib

Success:

$ ./eg1 
Hello World

Link example 2 correctly:

$ gcc -o eg2 eg2.o -lz

Success:

$ ./eg2 
1.2.8

Link the example 2 pkg-config variation correctly:

$ gcc -o eg2 eg2.o $(pkg-config --libs zlib) 
$ ./eg2
1.2.8

The explanation

Reading is optional from here on.

By default, a linkage command generated by GCC, on your distro,
consumes the files in the linkage from left to right in
commandline sequence. When it finds that a file refers to something
and does not contain a definition for it, to will search for a definition
in files further to the right. If it eventually finds a definition, the
reference is resolved. If any references remain unresolved at the end,
the linkage fails: the linker does not search backwards.

First, example 1, with static library my_lib.a

A static library is an indexed archive of object files. When the linker
finds -lmy_lib in the linkage sequence and figures out that this refers
to the static library ./libmy_lib.a, it wants to know whether your program
needs any of the object files in libmy_lib.a.

There is only object file in libmy_lib.a, namely my_lib.o, and there's only one thing defined
in my_lib.o, namely the function hw.

The linker will decide that your program needs my_lib.o if and only if it already knows that
your program refers to hw, in one or more of the object files it has already
added to the program, and that none of the object files it has already added
contains a definition for hw.

If that is true, then the linker will extract a copy of my_lib.o from the library and
add it to your program. Then, your program contains a definition for hw, so
its references to hw are resolved.

When you try to link the program like:

$ gcc -o eg1 -L. -lmy_lib eg1.o

the linker has not added eg1.o to the program when it sees
-lmy_lib. Because at that point, it has not seen eg1.o.
Your program does not yet make any references to hw: it
does not yet make any references at all, because all the references it makes
are in eg1.o.

So the linker does not add my_lib.o to the program and has no further
use for libmy_lib.a.

Next, it finds eg1.o, and adds it to be program. An object file in the
linkage sequence is always added to the program. Now, the program makes
a reference to hw, and does not contain a definition of hw; but
there is nothing left in the linkage sequence that could provide the missing
definition. The reference to hw ends up unresolved, and the linkage fails.

Second, example 2, with shared library libz

A shared library isn't an archive of object files or anything like it. It's
much more like a program that doesn't have a main function and
instead exposes multiple other symbols that it defines, so that other
programs can use them at runtime.

Many Linux distros today configure their GCC toolchain so that its language drivers (gcc,g++,gfortran etc)
instruct the system linker (ld) to link shared libraries on an as-needed basis.
You have got one of those distros.

This means that when the linker finds -lz in the linkage sequence, and figures out that this refers
to the shared library (say) /usr/lib/x86_64-linux-gnu/libz.so, it wants to know whether any references that it has added to your program that aren't yet defined have definitions that are exported by libz

If that is true, then the linker will not copy any chunks out of libz and
add them to your program; instead, it will just doctor the code of your program
so that:-

  • At runtime, the system program loader will load a copy of libz into the
    same process as your program whenever it loads a copy of your program, to run it.

  • At runtime, whenever your program refers to something that is defined in
    libz, that reference uses the definition exported by the copy of libz in
    the same process.

Your program wants to refer to just one thing that has a definition exported by libz,
namely the function zlibVersion, which is referred to just once, in eg2.c.
If the linker adds that reference to your program, and then finds the definition
exported by libz, the reference is resolved

But when you try to link the program like:

gcc -o eg2 -lz eg2.o

the order of events is wrong in just the same way as with example 1.
At the point when the linker finds -lz, there are no references to anything
in the program: they are all in eg2.o, which has not yet been seen. So the
linker decides it has no use for libz. When it reaches eg2.o, adds it to the program,
and then has undefined reference to zlibVersion, the linkage sequence is finished;
that reference is unresolved, and the linkage fails.

Lastly, the pkg-config variation of example 2 has a now obvious explanation.
After shell-expansion:

gcc -o eg2 $(pkg-config --libs zlib) eg2.o

becomes:

gcc -o eg2 -lz eg2.o

which is just example 2 again.

I can reproduce the problem in example 1, but not in example 2

The linkage:

gcc -o eg2 -lz eg2.o

works just fine for you!

(Or: That linkage worked fine for you on, say, Fedora 23, but fails on Ubuntu 16.04)

That's because the distro on which the linkage works is one of the ones that
does not configure its GCC toolchain to link shared libraries as-needed.

Back in the day, it was normal for unix-like systems to link static and shared
libraries by different rules. Static libraries in a linkage sequence were linked
on the as-needed basis explained in example 1, but shared libraries were linked unconditionally.

This behaviour is economical at linktime because the linker doesn't have to ponder
whether a shared library is needed by the program: if it's a shared library,
link it. And most libraries in most linkages are shared libraries. But there are disadvantages too:-

  • It is uneconomical at runtime, because it can cause shared libraries to be
    loaded along with a program even if doesn't need them.

  • The different linkage rules for static and shared libraries can be confusing
    to inexpert programmers, who may not know whether -lfoo in their linkage
    is going to resolve to /some/where/libfoo.a or to /some/where/libfoo.so,
    and might not understand the difference between shared and static libraries
    anyway.

This trade-off has led to the schismatic situation today. Some distros have
changed their GCC linkage rules for shared libraries so that the as-needed
principle applies for all libraries. Some distros have stuck with the old
way.

Why do I still get this problem even if I compile-and-link at the same time?

If I just do:

$ gcc -o eg1 -I. -L. -lmy_lib eg1.c

surely gcc has to compile eg1.c first, and then link the resulting
object file with libmy_lib.a. So how can it not know that object file
is needed when it's doing the linking?

Because compiling and linking with a single command does not change the
order of the linkage sequence.

When you run the command above, gcc figures out that you want compilation +
linkage. So behind the scenes, it generates a compilation command, and runs
it, then generates a linkage command, and runs it, as if you had run the
two commands:

$ gcc -I. -c -o eg1.o eg1.c
$ gcc -o eg1 -L. -lmy_lib eg1.o

So the linkage fails just as it does if you do run those two commands. The
only difference you notice in the failure is that gcc has generated a
temporary object file in the compile + link case, because you're not telling it
to use eg1.o. We see:

/tmp/ccQk1tvs.o: In function `main'

instead of:

eg1.o: In function `main':

See also

The order in which interdependent linked libraries are specified is wrong

Putting interdependent libraries in the wrong order is just one way
in which you can get files that need definitions of things coming
later in the linkage than the files that provide the definitions. Putting libraries before the
object files that refer to them is another way of making the same mistake.

什么是未定义的参考/未解决的外部符号错误,我该如何修复?

故事和酒 2025-02-20 16:19:16

我只是在.env文件中遇到相同的问题,文件将db_host的值更改为127.0.0.0.1

“更改db_host = mysql代码>到db_host = 127.0.0.1

I have the same issue just in .env file change the value of DB_HOST to 127.0.0.1

"change DB_HOST=mysql to DB_HOST=127.0.0.1"

SQLSTATE [HY000] [2002]连接时间(sql:select * sessions` w from`id` id` = me2deg11zq4pjbhzcowlhzcowlhzwzwzuwpebkdgplyhuleg limit 1)

故事和酒 2025-02-20 05:48:03

video_item.dart中,您正在设置initstate仅运行一次的视频变量方法再次调用。因此,视频 _videoItemstate的变量永远不会再次设置,因此它保持与相同的旧值,

您只需在videoitem 这样的构造函数

children: [
      Text(widget.video.title),
      const SizedBox(width: 16),
      Text(widget.video.intro)
    ],

in video_item.dart you are setting the video variable inside the initState which only runs once, so whenever you use setState only the build method gets called again. thus the video variable in the _VideoItemState is never set again, so it stays with the same old value

you can simply just use the video coming in the VideoItem constructor like this

children: [
      Text(widget.video.title),
      const SizedBox(width: 16),
      Text(widget.video.intro)
    ],

flutter setstate()do do do to Reative fo to list数据更改

故事和酒 2025-02-19 21:43:22

正如某些人试图学习这件事的那样,我就是这样看的。对于初学者来说,上面的示例可能过于复杂。

如果运行此代码:

var local = true;
var global = true;


function test(){
  var local = false;
  var global = false;
  console.log(local)
  console.log(global)
}

test();

console.log(local);
console.log(global);

输出将读取为:false,false,true,true,

因为它将函数中的变量与外部的变量分开,因此术语local变量,这是因为我们在分配中使用了var 。如果您删除函数中的var,因此现在读取这样的读数:

var local = true;
var global = true;


function test(){
  local = false;
  global = false;
  console.log(local)
  console.log(global)
}

test();

console.log(local);
console.log(global);

输出为false,false,false,false,

这是因为而不是在本地范围或函数中创建新变量,而是使用全局变量并重新分配它们错误。

As someeone trying to learn this this is how I see it. The above examples were maybe a bit overly complicated for a beginner.

If you run this code:

var local = true;
var global = true;


function test(){
  var local = false;
  var global = false;
  console.log(local)
  console.log(global)
}

test();

console.log(local);
console.log(global);

The output will read as: false, false, true, true

Because it sees the variables in the function as seperate from those outside of it, hence the term local variable and this was because we used var in the assignment. If you take away the var in the function so it now reads like this:

var local = true;
var global = true;


function test(){
  local = false;
  global = false;
  console.log(local)
  console.log(global)
}

test();

console.log(local);
console.log(global);

The output is false, false, false, false

This is because rather than creating a new variable in the local scope or function it simply uses the global variables and reassigns them to false.

var关键字的目的是什么?我什么时候应该使用它(或省略)?

故事和酒 2025-02-19 21:38:48

非常感谢您,您是对的,我完成了两次新课程,所以我在Extension Startup上运行此课程,然后Do clear()而不是删除(xx)。现在我可以前进。

Thank you very much you are right, i made a new class twice, so i run this at extension startup, and do clear() instead of delete(xx). Now i can move forward.

问题部分中的VSCODE扩展堆叠输出

故事和酒 2025-02-19 03:57:53

这是一个可能的解决方案:

[data[0], data[1], *data[2], *data[3]]

如果您更喜欢一种更通用的方法:

[dct for x in data for dct in (x if isinstance(x, list) else (x,))]

This is a possible solution:

[data[0], data[1], *data[2], *data[3]]

If you prefer a more general approach:

[dct for x in data for dct in (x if isinstance(x, list) else (x,))]

如何合并Python列表中的不同价值类型?

故事和酒 2025-02-18 22:53:28

这是我的上述解决方案。

我使用new ObjectId(id)
import {objectId}从'mongodb'';

(如果收到 ts7016:找不到模块'mongodb'的声明文件,

请按照“键入”键入'

  1. 键入'' mongodb' 'root项目
  2. 创建index.d.ts
  3. 添加声明模块'mongodb';
  4. index.d.ts中添加tsconfig.json文件的路径
    Typeroots如下

“ Typeroots”:[

import { ObjectID } from 'mongodb';
 async findOne(id: string): Promise<Seller> {
    const result = await this.sellerRepository.findOne(new ObjectID(id));
    return result;
  }

Here is my solution for above..

I used new ObjectID(id) and
import { ObjectID } from 'mongodb';

if you get error like TS7016: Could not find a declaration file for module 'mongodb'

then follow below steps

  1. create folder with 'typings'any at root project
  2. create index.d.ts
  3. add declare module 'mongodb';
  4. add path of the index.d.ts in tsconfig.json file under
    typeRoots as below

"typeRoots": [ "./typings", "./node_modules/@types/" ]

sample code

import { ObjectID } from 'mongodb';
 async findOne(id: string): Promise<Seller> {
    const result = await this.sellerRepository.findOne(new ObjectID(id));
    return result;
  }

类型的参数&#x27; {id:string; }&#x27;无法分配到类型的参数&#x27; findOneOptions&lt; seller&gt;&#x27;

故事和酒 2025-02-18 08:04:46

只需按下红色按钮,然后重新启动您的应用程序即可停止应用程序。它将解决这个问题。

Simply stop your application by hitting the red button and start your application again. It will solve this problem.

enter image description here

未经手的例外:缺少Pluginexception(在Channel插件上没有找到用于方法的实现,

故事和酒 2025-02-17 23:45:39

c_screen_instance全局吗?
auto_off_timer全局吗?

考虑提供更多代码。

但是无论如何。

bool addApbChangeCallback(void * arg, apb_change_cb_t cb){
    initApbChangeCallback();
    apb_change_t * c = (apb_change_t*)malloc(sizeof(apb_change_t));
    if(!c){
        log_e("Callback Object Malloc Failed");
        return false;
    }
    c->next = NULL;
    c->prev = NULL;
    c->arg = arg;
    c->cb = cb;
    xSemaphoreTake(apb_change_lock, portMAX_DELAY);
    if(apb_change_callbacks == NULL){
        apb_change_callbacks = c;
    } else {
        apb_change_t * r = apb_change_callbacks;
        // look for duplicate callbacks
        while( (r != NULL ) && !((r->cb == cb) && ( r->arg == arg))) r = r->next;
        if (r) {
            log_e("duplicate func=%8p arg=%8p",c->cb,c->arg);
            free(c);
            xSemaphoreGive(apb_change_lock);
            return false;
        }
        else {
            c->next = apb_change_callbacks;
            apb_change_callbacks-> prev = c;
            apb_change_callbacks = c;
        }
    }
    xSemaphoreGive(apb_change_lock);
    return true;
}

这是addapbChangeCallback的声明。

您的错误来自此行:

while( (r != NULL ) && !((r->cb == cb) && ( r->arg == arg))) r = r->next;

其中r是一个结构,可以保留所有回调。
此错误确实表明此回调函数已在您的代码中的某个地方分配。 r是全局,因此您的代码正在两次重新分配同一回调。

尝试仅分配一次,或者在使用removeapBchangeCallback(void * arg,apb_change_cb_t cb)timerDetachIrstrupt

我也找到了一个报告的报告与timerattach在当前版本上有关的问题: https:/ /Github.com/espressif/arduino-esp32/issues/6730

尝试将平台PIO的版本滚动到更稳定的版本中:

# instead of espressif32
platform = https://github.com/platformio/platform-espressif32.git#<tag-version>

查看可用的可用标签的git链接。

is c_screen_Instance global?
is auto_off_timer global?

Consider providing a bit more of your code.

But anyway.

bool addApbChangeCallback(void * arg, apb_change_cb_t cb){
    initApbChangeCallback();
    apb_change_t * c = (apb_change_t*)malloc(sizeof(apb_change_t));
    if(!c){
        log_e("Callback Object Malloc Failed");
        return false;
    }
    c->next = NULL;
    c->prev = NULL;
    c->arg = arg;
    c->cb = cb;
    xSemaphoreTake(apb_change_lock, portMAX_DELAY);
    if(apb_change_callbacks == NULL){
        apb_change_callbacks = c;
    } else {
        apb_change_t * r = apb_change_callbacks;
        // look for duplicate callbacks
        while( (r != NULL ) && !((r->cb == cb) && ( r->arg == arg))) r = r->next;
        if (r) {
            log_e("duplicate func=%8p arg=%8p",c->cb,c->arg);
            free(c);
            xSemaphoreGive(apb_change_lock);
            return false;
        }
        else {
            c->next = apb_change_callbacks;
            apb_change_callbacks-> prev = c;
            apb_change_callbacks = c;
        }
    }
    xSemaphoreGive(apb_change_lock);
    return true;
}

This is addApbChangeCallback's declaration.

Your error comes from this line :

while( (r != NULL ) && !((r->cb == cb) && ( r->arg == arg))) r = r->next;

Where r it's a struct to hold all the callbacks.
This error indeed indicates this callback function was already assigned somewhere in your code. r is global, so your code is re-assigning the same callback twice.

Try to either only assign it once, or to unassign the function before assigning it again with removeApbChangeCallback(void * arg, apb_change_cb_t cb) or timerDetachInterrupt

I've also found a reported issue related to timerAttach on the current version here: https://github.com/espressif/arduino-esp32/issues/6730

Try to roll back the Platform PIO's version to a more stable one:

# instead of espressif32
platform = https://github.com/platformio/platform-espressif32.git#<tag-version>

Check on the git link for the available tags you can use.

从班级传递一个void(*fn)

故事和酒 2025-02-17 06:32:49

我也遇到了类似的情况。

我的Windows用户是管理员,因此我怀疑WSL的权限不足,并且我试图将WSL的默认用户切换为root。

ubuntu config --default-user root

下图显示了我切换到root后的粘结状态。
clion状态

仍然有错误,但是它可以检测到CMake,我现在可以使用CMAKE来构建构建该程序。

最后,这是我的原始错误消息。

CMake Error: Could not open file for write in copy operation /mnt/c/Users/Administrator/AppData/Local/Temp/cmake_check_environment1/_build9958369055144970030/CMakeFiles/3.22.1/CMakeSystem.cmake.tmp
CMake Error: : System Error: Inappropriate ioctl for device
CMake Error at /usr/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake:193 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)

...
....

CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:56 (try_compile):
  Unknown extension ".c" for file

    /mnt/c/Users/Administrator/AppData/Local/Temp/cmake_check_environment1/_build9958369055144970030/CMakeFiles/CMakeTmp/testCCompiler.c

  try_compile() works only for enabled languages.  Currently these are:

    C CXX

  See project() command to enable other languages.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

   

 

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!

I have encountered a similar situation.

My Windows user is administrator, so I suspect that WSL has insufficient permissions, and I tried to switch the default user of WSL to root.

ubuntu config --default-user root

The following image shows the state of CLion after I switched to root.
CLion status

There are still errors, but it can detect CMake and I can now use CMake to build the program.

Lastly, here is my original error message.

CMake Error: Could not open file for write in copy operation /mnt/c/Users/Administrator/AppData/Local/Temp/cmake_check_environment1/_build9958369055144970030/CMakeFiles/3.22.1/CMakeSystem.cmake.tmp
CMake Error: : System Error: Inappropriate ioctl for device
CMake Error at /usr/share/cmake-3.22/Modules/CMakeDetermineSystem.cmake:193 (configure_file):
  configure_file Problem configuring file
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)

...
....

CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:56 (try_compile):
  Unknown extension ".c" for file

    /mnt/c/Users/Administrator/AppData/Local/Temp/cmake_check_environment1/_build9958369055144970030/CMakeFiles/CMakeTmp/testCCompiler.c

  try_compile() works only for enabled languages.  Currently these are:

    C CXX

  See project() command to enable other languages.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Check for working C compiler: /usr/bin/cc - broken
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
  The C compiler

    "/usr/bin/cc"

  is not able to compile a simple test program.

  It fails with the following output:

   

 

  CMake will not be able to correctly generate this project.
Call Stack (most recent call first):
  CMakeLists.txt:1 (project)


-- Configuring incomplete, errors occurred!

使用WSL时的CMAKE错误

故事和酒 2025-02-17 04:41:33
=ARRAYFORMULA(REGEXREPLACE(""&TRANSPOSE(QUERY(TRANSPOSE(
QUERY({Data!A:B, TEXT(Data!A:A, "yyyymmdd×MMMM yyyy")}, 
 "select Col2,count(Col2) 
  where Col2 != ''
    AND MONTH(Col1)<=MONTH(DATE'"&TEXT(A2,"YYYY-MM-DD")&"')
    AND MONTH(Col1)>=MONTH(DATE'"&TEXT(EDATE(A2,-3),"YYYY-MM-DD")&"')
  group by Col2 
  pivot Col3", 1)),"order by Col1 desc")),"^(.*×)", ))

参考:

我如何更改Google表格中的日期格式查询日期枢轴表格使用日期过滤器?

排序查询枢轴表 - Google表格

=ARRAYFORMULA(REGEXREPLACE(""&TRANSPOSE(QUERY(TRANSPOSE(
QUERY({Data!A:B, TEXT(Data!A:A, "yyyymmdd×MMMM yyyy")}, 
 "select Col2,count(Col2) 
  where Col2 != ''
    AND MONTH(Col1)<=MONTH(DATE'"&TEXT(A2,"YYYY-MM-DD")&"')
    AND MONTH(Col1)>=MONTH(DATE'"&TEXT(EDATE(A2,-3),"YYYY-MM-DD")&"')
  group by Col2 
  pivot Col3", 1)),"order by Col1 desc")),"^(.*×)", ))

Reference:

How do I change the date format in a Google Sheets query pivot table with date filters?

Sort Query Pivot Table - Google Sheets

查询/枢轴函数:标题标题降序&amp;一个月格式mmmm yyyy

故事和酒 2025-02-16 10:08:23

这是从晦涩的答案中得出的解决方案,从线上减去箭头的头部,因此不会伸出来:

  void drawArrow(Offset a, Offset b, Canvas canvas, Color color) {
    final paint = Paint()
      ..color = color
      ..strokeWidth = 2
      ..strokeCap = StrokeCap.round;
    const arrowSize = 10;
    const arrowAngle = pi / 6;

    final dX = b.dx - a.dx;
    final dY = b.dy - a.dy;
    final angle = atan2(dY, dX);

    // Recalculate b such that it's the end of the line minus the arrow.
    final Offset subtractedB = Offset(
      b.dx - (arrowSize - 2) * cos(angle),
      b.dy - (arrowSize - 2) * sin(angle),
    );

    canvas.drawLine(a, subtractedB, paint);
    final path = Path();

    path.moveTo(b.dx - arrowSize * cos(angle - arrowAngle),
        b.dy - arrowSize * sin(angle - arrowAngle));
    path.lineTo(b.dx, b.dy);
    path.lineTo(b.dx - arrowSize * cos(angle + arrowAngle),
        b.dy - arrowSize * sin(angle + arrowAngle));
    path.close();
    canvas.drawPath(path, paint);
  }

Here's a solution derived from obscure's answer to subtract the head of the arrow from the line so it does not stick out:

  void drawArrow(Offset a, Offset b, Canvas canvas, Color color) {
    final paint = Paint()
      ..color = color
      ..strokeWidth = 2
      ..strokeCap = StrokeCap.round;
    const arrowSize = 10;
    const arrowAngle = pi / 6;

    final dX = b.dx - a.dx;
    final dY = b.dy - a.dy;
    final angle = atan2(dY, dX);

    // Recalculate b such that it's the end of the line minus the arrow.
    final Offset subtractedB = Offset(
      b.dx - (arrowSize - 2) * cos(angle),
      b.dy - (arrowSize - 2) * sin(angle),
    );

    canvas.drawLine(a, subtractedB, paint);
    final path = Path();

    path.moveTo(b.dx - arrowSize * cos(angle - arrowAngle),
        b.dy - arrowSize * sin(angle - arrowAngle));
    path.lineTo(b.dx, b.dy);
    path.lineTo(b.dx - arrowSize * cos(angle + arrowAngle),
        b.dy - arrowSize * sin(angle + arrowAngle));
    path.close();
    canvas.drawPath(path, paint);
  }

flutter)如何用画布制作箭线?

故事和酒 2025-02-16 03:57:27

与Podfile(React Native 0.72.4)一起,您需要使用React-nativativatient,则需要将React-Native-nive-nive-nive-nive-nive-nive-nive-nive-nive-nive-flipper设置为。 config.js 文件:

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# 

因此,我更新了react> react-native.config.js这样:

// react-native.config.js at project root
module.exports = {
  project: {
    ios: {},
    android: {},
  },
  assets: ['./src/resources/fonts/'],
  dependencies: {
    // when NO_FLIPPER=1
    ...(process.env.NO_FLIPPER
      ? {'react-native-flipper': {platforms: {ios: null}}}
      : {}),
  },
};

现在最终使用iPad

According with Podfile (React Native 0.72.4), you need to exclude react-native-flipper if NO_FLIPPER=1 is set, using a react-native.config.js file:

# If you are using a `react-native-flipper` your iOS build will fail when `NO_FLIPPER=1` is set.
# because `react-native-flipper` depends on (FlipperKit,...) that will be excluded
#
# To fix this you can also exclude `react-native-flipper` using a `react-native.config.js`
# ```js
# module.exports = {
#   dependencies: {
#     ...(process.env.NO_FLIPPER ? { 'react-native-flipper': { platforms: { ios: null } } } : {}),
# 

so I updated my react-native.config.js like this:

// react-native.config.js at project root
module.exports = {
  project: {
    ios: {},
    android: {},
  },
  assets: ['./src/resources/fonts/'],
  dependencies: {
    // when NO_FLIPPER=1
    ...(process.env.NO_FLIPPER
      ? {'react-native-flipper': {platforms: {ios: null}}}
      : {}),
  },
};

Now finally it works as expected with iPad

Screenshot 2023-11-22 at 19 27 16

Flipper:桌面未能提供证书。 Flipper桌面的错误

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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