梦在夏天

文章 评论 浏览 30

梦在夏天 2025-02-20 22:40:32

我找到了解决方案!!

我已经修改了我的登台表列[do_not_contact_flag]为smallint,并将转换添加到我的处理proc中的位置,然后再加载在最终的SQL表中。

I found the solution !!

I've modified my staging table column [Do_Not_Contact_Flag] to be SMALLINT, and added the conversion to BIT in my processing stored proc before loading in the final SQL Table.

SSIS C#SQLBULKCOPY .CSV文件错误:无法将参数值从字符串转换为布尔值。字符串未公认为有效的布尔值

梦在夏天 2025-02-20 19:43:48

正如注释中指出的那样,curve_fit具有参数(f,xdata,ydata,p0 = none,sigma = none,absolute_sigma = false,check_finite = true,bunds =( - inf,inf,inf),method,method = none,none,jac jac = none,** kwargs);即,我交换了X数据和Y数据的顺序。 popt,pcov = curve_fit(lorentzian,频率,test_data,maxFev = 100000,p0 =猜测)求解它。

As pointed out in the comments, curve_fit has arguments (f, xdata, ydata, p0=None, sigma=None, absolute_sigma=False, check_finite=True, bounds=(- inf, inf), method=None, jac=None, **kwargs); i.e., I swapped the order of the x data and y data. popt, pcov = curve_fit(lorentzian, frequencies, test_data, maxfev = 100000, p0 = guess) solves it.

Scipy Curve_fit do do do not of lorentzian的峰值

梦在夏天 2025-02-20 19:12:15

错误发生在此行中,

button = customtkinter.CTkButton(master=frame_left, text="Enter", command="print_test").grid(row=11, column=0, padx=20, pady=15)

您无法将函数称为字符串来修复它,请尝试此行

button = customtkinter.CTkButton(master=frame_left, text="Enter", command=print_test()).grid(row=11, column=0, padx=20, pady=15)

The error happens at this line

button = customtkinter.CTkButton(master=frame_left, text="Enter", command="print_test").grid(row=11, column=0, padx=20, pady=15)

you cannot call a function as a string to fix it try this line

button = customtkinter.CTkButton(master=frame_left, text="Enter", command=print_test()).grid(row=11, column=0, padx=20, pady=15)

Pusintkinker模块中的TypeError

梦在夏天 2025-02-20 17:30:04

“您想实现的目标是在数组的任何元素中存在的值时应用红色背景,否则要应用蓝色背景,您可以确认吗?” - Rigoberto Ramirez Cruz

“@rigobertoramirezcruz是的” - 认真

需要发布该问题,因为问题不清楚。以下示例是可重复使用的函数。结果在HTML中看起来像这样:

<mark style="color:red">0</mark>  <!-- {"length": "None",    -->
<mark style="color:blue">0</mark> <!--  "duration": "10000", -->
<mark style="color:blue">0</mark> <!--  "percentage": "65"}, -->
<mark style="color:blue">1</mark> <!-- {"width": "Half",     -->
<mark style="color:blue">1</mark> <!--  "detail": "under",   -->
<mark style="color:blue">1</mark> <!--  "duration": "25000", -->
<mark style="color:blue">1</mark> <!--  "percentage": "25"}, -->
<mark style="color:blue">2</mark> <!-- {"length": "Full",    -->
<mark style="color:blue">2</mark> <!--  "duration": "20000", -->
<mark style="color:blue">2</mark> <!--  "percentage": "90"}; -->
<!--
This is the result if "length" and "None" were the 2nd and 3rd @param 
(the only <mark> that has red text)
-->

详细信息在示例中评论

let testArray = [{"length":"None","duration":"10000", "percentage":"65"}, 
{"width":"Half","detail":"under","duration":"25000","percentage":"25"}, 
{"length":"Full","duration":"20000","percentage":"90"}];

// Reference the element that'll display results
const test = document.querySelector('.test');

/**
 * @desc - Given an array of objects, a key and a value, generate a <mark>
 * with an index of the current object for each key/value pair. 
 * If a pair matches the 2nd and 3rd @param the index will be red.
 * @param {array<object>} array - An array of objects
 * @param {string} key - The first string of a pair representing a property 
 *                       name
 * @param {string} val - The second string of a pair representing a value
 * @param {object<DOM>} node - The DOM Object that the results will be 
 *                             displayed in @default is <body>
 */ 
function findKV(array, key, val, node = document.body) {  
  // Prepare key/val for comparison -- matching is case insensitive
  key = key.toLowerCase();
  val = val.toLowerCase();
  // For each object of the array...
  array.forEach((obj, idx) => {
    /*
    Convert object into an array of pairs -- pass the destructed 
    [key, value] array pair
    */
    Object.entries(obj).forEach(([k, v]) => {
      /*
      Compare with a ternary:
      If key equals k AND val equals v color is red -- otherwise it's blue
      */
      let color = key === k.toLowerCase() && val === v.toLowerCase() ?
      'red' : 'blue';
      /*
      Generate a <mark> with an index of current object with the
      appropriate color
      */
      node.innerHTML += 
      `<mark style='color:${color};font-size:4rem;'>
         ${idx}
       </mark>`;
    });
  });
  // Add a line-break
  node.innerHTML +=`<br>`;
}

findKV(testArray, 'length', 'None', test);
findKV(testArray, 'percentage', '25', test);
findKV(testArray, 'duration', '20000', test);
html {font: 400 1ch/1 Consolas}
.test {outline: 4px dashed brown}
<div class='test'></div>

"What you want to achieve is applying the red background when the value exists in any of the elements of the array, otherwise to apply the blue background, can you confirm?" – Rigoberto Ramirez Cruz

"@RigobertoRamirezCruz yeah" – seriously

Needed to post that because the question wasn't clear. The following example is a reusable function. The result looks like this in HTML:

<mark style="color:red">0</mark>  <!-- {"length": "None",    -->
<mark style="color:blue">0</mark> <!--  "duration": "10000", -->
<mark style="color:blue">0</mark> <!--  "percentage": "65"}, -->
<mark style="color:blue">1</mark> <!-- {"width": "Half",     -->
<mark style="color:blue">1</mark> <!--  "detail": "under",   -->
<mark style="color:blue">1</mark> <!--  "duration": "25000", -->
<mark style="color:blue">1</mark> <!--  "percentage": "25"}, -->
<mark style="color:blue">2</mark> <!-- {"length": "Full",    -->
<mark style="color:blue">2</mark> <!--  "duration": "20000", -->
<mark style="color:blue">2</mark> <!--  "percentage": "90"}; -->
<!--
This is the result if "length" and "None" were the 2nd and 3rd @param 
(the only <mark> that has red text)
-->

Details are commented in example

let testArray = [{"length":"None","duration":"10000", "percentage":"65"}, 
{"width":"Half","detail":"under","duration":"25000","percentage":"25"}, 
{"length":"Full","duration":"20000","percentage":"90"}];

// Reference the element that'll display results
const test = document.querySelector('.test');

/**
 * @desc - Given an array of objects, a key and a value, generate a <mark>
 * with an index of the current object for each key/value pair. 
 * If a pair matches the 2nd and 3rd @param the index will be red.
 * @param {array<object>} array - An array of objects
 * @param {string} key - The first string of a pair representing a property 
 *                       name
 * @param {string} val - The second string of a pair representing a value
 * @param {object<DOM>} node - The DOM Object that the results will be 
 *                             displayed in @default is <body>
 */ 
function findKV(array, key, val, node = document.body) {  
  // Prepare key/val for comparison -- matching is case insensitive
  key = key.toLowerCase();
  val = val.toLowerCase();
  // For each object of the array...
  array.forEach((obj, idx) => {
    /*
    Convert object into an array of pairs -- pass the destructed 
    [key, value] array pair
    */
    Object.entries(obj).forEach(([k, v]) => {
      /*
      Compare with a ternary:
      If key equals k AND val equals v color is red -- otherwise it's blue
      */
      let color = key === k.toLowerCase() && val === v.toLowerCase() ?
      'red' : 'blue';
      /*
      Generate a <mark> with an index of current object with the
      appropriate color
      */
      node.innerHTML += 
      `<mark style='color:${color};font-size:4rem;'>
         ${idx}
       </mark>`;
    });
  });
  // Add a line-break
  node.innerHTML +=`<br>`;
}

findKV(testArray, 'length', 'None', test);
findKV(testArray, 'percentage', '25', test);
findKV(testArray, 'duration', '20000', test);
html {font: 400 1ch/1 Consolas}
.test {outline: 4px dashed brown}
<div class='test'></div>

通过检查值是否存在,应用CSS

梦在夏天 2025-02-19 22:28:28

正如我在评论中提到的那样,我认为这种方法可能会导致一些错误,因此我建议您更改您的请求。

也许在前端的计算,然后发送带有新位置和ID的对象,然后对其进行处理?

请求主体看起来像这样

[
  {
    "id":1,
    "position":2,
  },
  {
    "id":2,
    "position":3,
  }, ... ,
  {
    "id":10,
    "position":1,
  }
]

,然后您可以在此列表上迭代并将每个设备分配给其新位置

for item in request.data:
    d = Device.objects.get(item['id'])
    d.position = item['position']
    d.save()

As I have mentioned in my comment I think this approach may lead to some errors, so I would suggest you change your request a little bit.

Maybe do the calculations on the front end and then send an object with the new positions and ids and then process that?

request body could look like this

[
  {
    "id":1,
    "position":2,
  },
  {
    "id":2,
    "position":3,
  }, ... ,
  {
    "id":10,
    "position":1,
  }
]

and then you could iterate on this list and assign each device to it's new position

for item in request.data:
    d = Device.objects.get(item['id'])
    d.position = item['position']
    d.save()

使用django中的拖放表进行排序表的逻辑

梦在夏天 2025-02-19 14:04:06

我发现了这一点:

void rand_maze {
  // begin with a rectangular maze of all closed cells
  // numrows = number of rows of cells;
  // numcols = number of columns of cells;
  start = cell at (0,0);
  goal  = cell at (numrows-1, numcols-1);
  numcells = numrows * numcols;
  Partition p(numcells); // p represents the maze components

  // goal is not reachable from start
  while (!p.Find(start, goal)) {
    edge = randomly select a wall;
    x = edge.x;
    y = edge.y;
    if(!p.Find(x,y)) {
      remove edge;
      // x and y now in same component
      p.Union(x,y);
    }
  }
}

I found this:

Using Disjoint Set (Union-Find) to Build a Maze Generator

void rand_maze {
  // begin with a rectangular maze of all closed cells
  // numrows = number of rows of cells;
  // numcols = number of columns of cells;
  start = cell at (0,0);
  goal  = cell at (numrows-1, numcols-1);
  numcells = numrows * numcols;
  Partition p(numcells); // p represents the maze components

  // goal is not reachable from start
  while (!p.Find(start, goal)) {
    edge = randomly select a wall;
    x = edge.x;
    y = edge.y;
    if(!p.Find(x,y)) {
      remove edge;
      // x and y now in same component
      p.Union(x,y);
    }
  }
}

如何在Unity 3D中产生一个脱节的迷宫

梦在夏天 2025-02-19 12:52:44

我也遇到了这个问题,不必要地解决了它。所以我希望这会有所帮助。

1-确保您遵循ubuntu的pyenv构建指南中的步骤noreferrer“> https://github.com/pyenv/pyenv/wiki#suggested-build-environment )并安装了所有必要的APT软件包。

2-如果中的第一个项目,其中Openssl 显示了酿造码的路径。您可能想更改此问题。您只需卸载openssl@3和 [email&nbsp; email&nbsp;然后,默认情况下,它应该使用openssl的公共安装。

我首先试图使其与Brew OpenSSL安装一起使用,但没有真正起作用。只有在从Brew中卸载OpenSSL之后,它就没有任何问题了。

I also had this problem and it took unnecessarily long to solve it. So I hope this helps.

1- Make sure that you followed the steps in the build guide of pyenv for Ubuntu (https://github.com/pyenv/pyenv/wiki#suggested-build-environment) and installed all the necessary apt packages.

2- If the first item in where openssl shows a path to brew dirs. You might want to change this. You can simply uninstall openssl@3 and [email protected] via brew. Then it should use the apt installation of openssl by default.

I first tried to make it work with brew openssl installation but nothing really worked. Only after uninstalling openssl from brew it worked without any issues.

Ubuntu中的Pyenv 22.04:错误:未编译Python SSL扩展。缺少openssl lib?

梦在夏天 2025-02-18 21:12:52

令牌仅在内部存储在Lucene和Solr中。他们不会更改以任何方式返回给您的存储文本。文本是逐字存储的 - 即您发送的文本是返回给您的内容。

在后台生成并存储在索引中的令牌会影响您可以搜索存储的内容以及处理方式的方式,它不会影响字段的显示值。

您可以在Solr的管理页面下使用分析页面,以确切查看在存储在索引中之前,如何将字段的文本处理到令牌中。

这样做的原因是,您通常有兴趣将实际的文本返回给用户,使令牌化和处理的值可见,对于返回到人类的文档而言并没有真正的意义。

Tokens are only stored internally in Lucene and Solr. They do not change the stored text that gets returned to you in any way. The text is stored verbatim - i.e. the text you sent in is what gets returned to you.

The tokens generated in the background and stored in the index affect how you can search against the content you've stored and how it's processed, it does not affect the display value of the field.

You can use the Analysis page under Solr's admin page to see exactly how text for a field gets processed into tokens before being stored in the index.

The reason for this is that you're usually interested in returning the actual text to the user, making the tokenized and processed values visible doesn't really make sense for a document that gets returned to a human.

Solr Tokenizer无需做任何事情

梦在夏天 2025-02-18 16:20:02
1.Clear Schema and import Schema again. 
2. This mostly happens when there are some changes to table schema after creating pipeline and datasets. verify once.
3.The schema and datasets should be refreshed when there are some changes in the SQL table schema.
4. For table name or view name used in the query, use []. ex: [dbo].[persons]
5. In datasets select table name
6. try to publish before testing.
1.Clear Schema and import Schema again. 
2. This mostly happens when there are some changes to table schema after creating pipeline and datasets. verify once.
3.The schema and datasets should be refreshed when there are some changes in the SQL table schema.
4. For table name or view name used in the query, use []. ex: [dbo].[persons]
5. In datasets select table name
6. try to publish before testing.

查看数据工厂复制数据操作中使用的查询

梦在夏天 2025-02-18 12:15:03

我能够用此示例。我创建了自定义FormValidator ,然后将其放在我的 editform

<EditForm Model="@Input" OnValidSubmit="@UpdateProfile">
    <FluentValidator TValidator="InputModelValidator" />
    <UI.Models.Other.CustomFormValidator @ref="@customFormValidator" />

,然后在 Update Profile 中我可以清除它。

另外,一旦我清除了现在有效的电子邮件地址,该错误就会清除。

我假设我正在互动FulentValidation中的自定义验证,并且需要一个独立的验证器。

        private async Task UpdateProfile(EditContext context)
        {
            customFormValidator.ClearFormErrors();

            if (await IsEmailValid(Input.Email).ConfigureAwait(false) == false)
                var errors = new Dictionary<string, List<string>>();

                errors.Add("Email", new List<string>
                {
                    $"Username '{Input.Email}' is already taken."
                });

                await InvokeAsync(async () =>
                {
                    customFormValidator.DisplayFormErrors(errors);
                    StateHasChanged();
                }).ConfigureAwait(false);
            }
        }

I was able to fix it with this example. I created the customFormValidator and then put that within my EditForm

<EditForm Model="@Input" OnValidSubmit="@UpdateProfile">
    <FluentValidator TValidator="InputModelValidator" />
    <UI.Models.Other.CustomFormValidator @ref="@customFormValidator" />

Then in UpdateProfile I was able to clear it out.

Also, once I cleared out the email address that was now valid, the error cleared.

I assume that I was interacting the custom validation within FluentValidation and I needed a stand alone validator.

        private async Task UpdateProfile(EditContext context)
        {
            customFormValidator.ClearFormErrors();

            if (await IsEmailValid(Input.Email).ConfigureAwait(false) == false)
                var errors = new Dictionary<string, List<string>>();

                errors.Add("Email", new List<string>
                {
                    
quot;Username '{Input.Email}' is already taken."
                });

                await InvokeAsync(async () =>
                {
                    customFormValidator.DisplayFormErrors(errors);
                    StateHasChanged();
                }).ConfigureAwait(false);
            }
        }

大风验证|如何清除自定义错误消息

梦在夏天 2025-02-18 07:29:08

用户可能不确定,如果您使用无效的用户ID,这可能会发生。使用可选的链条摆脱此错误。

        return {
          role: userRecord?.customClaims?.["role"],
          type: userRecord?.customClaims?.["type"],
        };

只需检查未定义的

the user maybe undefined, this could happen if you use invalid userId. Use optional chaining to get rid of this error.

        return {
          role: userRecord?.customClaims?.["role"],
          type: userRecord?.customClaims?.["type"],
        };

simply check for the undefined

firebase自定义索赔返回对象可能是未定义的&#x27;

梦在夏天 2025-02-17 16:31:03

这终于对我有用。由于我无法在Colab中使用Tiffile.imread(),因此我尝试了GDAL和RASTERIO,但是图像形状将首先是通道。第一个数字的问题是由于

np.reshape() 

没有更改数据维度轴的原因。
然后,我使用了下面的代码,并解决了问题。

with rio.open("gdrive/My Drive/file.tif") as ds:
  arr=ds.read()
np.moveaxis(arr, 0, -1)

This finally works for me. Since I cannot use tiffile.imread() in colab, I tried gdal and rasterio, but the image shape would be channel first. The problem for the first figure is caused by

np.reshape() 

which did not change the axis of data dimension.
Then I used codes below and the issue is addressed.

with rio.open("gdrive/My Drive/file.tif") as ds:
  arr=ds.read()
np.moveaxis(arr, 0, -1)

为什么gdal.open(path).ReadAsArray()从tiffile.imread(路径)产生不同的结果

梦在夏天 2025-02-17 08:10:46

看来我正在尝试做的事情并没有真正的意义。
I found this post which talks about header-only Cmake中的库。
由于没有C文件,因此无法创建对象文件。因此,可以创建任何.SO文件。

如该帖子中所述,我将尝试创建一个.c文件,该文件只包含所有.h文件以创建.so文件。

It seems like what I was trying to do did not really make sense.
I found this post which talks about header-only libraries in CMake.
Since there are no c files, no object files can be created. Therefore, no .so file can be created.

As described in that other post I will try to create a .c file which simply includes all .h files to create a .so file.

梦在夏天 2025-02-17 03:32:26

我认为当您尝试访问节点时,iFrame文档还没有准备好。您应该等待iframe加载事件之后,您可以访问子节点。

$('#iframe').on("load", function() {
    // do the stuff here
});

I think the iframe document is not ready when you try to access the nodes. You should wait for the iframe load event after that you can access the child nodes.

$('#iframe').on("load", function() {
    // do the stuff here
});

如何在iframe标签的#document中获取HTML元素

梦在夏天 2025-02-17 02:48:43

当前没有办法使用 .editorConfig 来执行此操作。

但是,当您阅读

Currently there isn't a way to do this with the .editorconfig.

However, maybe you get a idea when you read the discussion in a feature request about that topic.

在.editorConfig中指定end_of_line的end_of_line

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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