漫雪独思

文章 评论 浏览 29

漫雪独思 2025-02-15 18:43:34

我认为您应用了创建资源“ MWAA”的Terraform计划,然后您以某种方式丢失了州(本地存储和丢失了?或状态未与其他客户共享?),然后您再次重新应用计划并且Terraform告诉您,它再次创建了“ MWAA”。

在这种情况下,您的主要问题是您失去了状态,并且您需要确保通过将其存储在存储桶中来确保它坚持下去。

但是,如果您确实需要使Terraform了解已经创建的资源,则需要将其放在Terraform的状态下。这样做的一种工具是“ Terraform Import”,您可以在此处阅读更多信息: https:// https:// www .terraform.io/cli/导入

I assume that you applied a Terraform plan which created resource "MWAA", then you somehow lost the state (locally stored and lost?, or the state wasn't shared with a different client?), then you re-apply the plan again, and Terraform informs you that it created "MWAA", again.

In that case, your main problem is that you lost the state, and you need to make sure that you do persist it, e.g., by storing it in a bucket.

However, if you really need to make Terraform aware about an already created resource, you need to put it in Terraform's state. One tool to do that is "terraform import", about which you can read more here: https://www.terraform.io/cli/import

忽略Terraform中已经配置的资源-AWS

漫雪独思 2025-02-15 03:05:57

您的问题与您通过的参数类型并不相关,至少不是您的第一个问题。您的代码

int sales = int.Parse(ctx.TruckRentalPbs.FromSqlRaw("salesForSelectedMonth", date).FirstOrDefault().ToString());

无法使用这种方式。实体框架需要从Sqlraw到所知道的实体绘制结果。但是在这里,您将返回一个未知的结果集,其中它对其结构一无所知。

解决方法的方法是将EF的结果转变为内存绑定的集合,然后对剩余代码使用常规LINQ查询:

int sales = int.Parse(ctx.TruckRentalPbs.FromSqlRaw("salesForSelectedMonth", date).AsEnumerable().FirstOrDefault().ToString());

然后,您可以通过用两个INT参数替换日期参数来更改参数,并将两者都传递到查询中。

Your problem isn't really related to the type of parameter you pass, at least not your first problem. Your code

int sales = int.Parse(ctx.TruckRentalPbs.FromSqlRaw("salesForSelectedMonth", date).FirstOrDefault().ToString());

can't work this way. Entity Framework needs to map the result from FromSqlRaw to the entities it knows. But here you are returning an unknown result set where it doesn't know anything about its structure.

The workaround for this is to turn the result from EF into a memory bound collection and then use regular LINQ queries for the remaining code:

int sales = int.Parse(ctx.TruckRentalPbs.FromSqlRaw("salesForSelectedMonth", date).AsEnumerable().FirstOrDefault().ToString());

Then you can change the parameters by replacing the date parameter with two INT parameters and pass both into the query.

SQL存储的程序以通过月/年传递日期价值

漫雪独思 2025-02-15 00:52:37
const { BarClass } = await geClass();

相同

const BarClass = (await geClass()).BarClass;

与(以这种方式看更容易看) 。
在此语句中,标识符 barclass 出现两次:第一次出现 barclass 是一个变量名称,第二个是属性名称。 Eslint抱怨您的变量不在骆驼案中,这是事实。您可以通过重命名变量以匹配规则约定来解决该问题,但这最终会使您的代码降低:

const { BarClass: barClass } = await geClass();

或者等效地,

const barClass = (await geClass()).BarClass;

我担心您使用的规则没有办法对具有类型的变量进行例外班级,这将是首选的解决方案。

const { BarClass } = await geClass();

is the same thing as

const BarClass = (await geClass()).BarClass;

(it's easier to look at it this way).
In this statement, the identifier BarClass appears two times: the first occurrence of BarClass is a variable name, the second one is a property name. ESLint is complaining that your variable is not in camel case, which is true. You could fix that by renaming the variable to match the rule conventions, but that would end up make your code less clear:

const { BarClass: barClass } = await geClass();

or equivalently

const barClass = (await geClass()).BarClass;

I'm afraid that the rule you are using has no way to make exceptions for variables with the type of a class, which would be the preferred solution.

为什么Eslint将类别视为命名规则中的变量?

漫雪独思 2025-02-14 22:14:30

实际上,如果使用 chromedriver ,但它需要使用 Chrome开发人员工具协议(在硒4中支持)。

更具体地说:您必须:

  1. 使用 getTarget.getTargets 方法。
  2. 提取要关闭的页面(目标)的 targetID
  3. 使用 targetId 。

Actually it is possible if using chromedriver but it requires to use Chrome Developer Tools Protocol (which is supported in Selenium 4).

More specifically you have to:

  1. Get list of targets using Target.getTargets method.
  2. Extract the targetId of the page (target) you want to close.
  3. Close the page (target) using Target.closeTarget method passing the targetId.

Selenium:通过索引关闭特定选项卡(句柄)而无需切换到它

漫雪独思 2025-02-14 21:39:01

这是您想要的吗?

df %>%
  summarize(quantile = paste0( "Q",1:3, "(", scales::percent(c(0.25, 0.50, 0.75)), ")"),
    value = quantile(usr_thp, c(0.25, 0.50, 0.75))) %>%
  pivot_wider(names_from = quantile, values_from = value)


# A tibble: 1 × 3
  `Q1(25%)` `Q2(50%)` `Q3(75%)`
      <dbl>     <dbl>     <dbl>
1     4480.     6600.    10156.

Is this what you're looking for?

df %>%
  summarize(quantile = paste0( "Q",1:3, "(", scales::percent(c(0.25, 0.50, 0.75)), ")"),
    value = quantile(usr_thp, c(0.25, 0.50, 0.75))) %>%
  pivot_wider(names_from = quantile, values_from = value)


# A tibble: 1 × 3
  `Q1(25%)` `Q2(50%)` `Q3(75%)`
      <dbl>     <dbl>     <dbl>
1     4480.     6600.    10156.

将数据框架分为100桶,然后分开后应包含100个值中的值25、50、75

漫雪独思 2025-02-14 10:00:37

问题在图书馆Microsoft.data.sqlite.core-version 3.1.26
将库版本更改为6.0.6解决了问题。

The problem was in the library Microsoft.Data.Sqlite.Core --version 3.1.26
Changing the library version to 6.0.6 solved the problem.

在.netcore(dapper)的随机时间内额外的150ms Sqlite查询响应

漫雪独思 2025-02-13 16:55:41

设备信息下的每个数据点还包含一个表。因此,您可以使用 css 选择器来提取正确的数据。

import requests
from bs4 import BeautifulSoup
        
url = 'https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpcd/classification.cfm?start_search=1&submission_type_id=&devicename=&productcode=&deviceclass=&thirdparty=&panel=®ulationnumber=&implant_flag=&life_sustain_support_flag=&summary_malfunction_reporting=&sortcolumn=deviceclassdesc&pagenum=10'
    
r = requests.get(url)
    
soup = BeautifulSoup(r.text, 'html.parser')
   
product_tables = soup.select('table tbody tr td a')[11:]
for product_table in product_tables:
    print(product_table.get_text(strip=True))
    

输出:

device, cpr assist
heart valve, more than minimally manipulated allograft
cleanser, root canal
saliva, artificial
locator, root apex
device, electrical dental anesthesia
mouthguard, prescription
cord, retraction
mouthguard, over-the-counter
mouthguard, migraine/tension headache

Each data point under device information also contains a table. So you can use CSS selector to pull the right data.

import requests
from bs4 import BeautifulSoup
        
url = 'https://www.accessdata.fda.gov/scripts/cdrh/cfdocs/cfpcd/classification.cfm?start_search=1&submission_type_id=&devicename=&productcode=&deviceclass=&thirdparty=&panel=®ulationnumber=&implant_flag=&life_sustain_support_flag=&summary_malfunction_reporting=&sortcolumn=deviceclassdesc&pagenum=10'
    
r = requests.get(url)
    
soup = BeautifulSoup(r.text, 'html.parser')
   
product_tables = soup.select('table tbody tr td a')[11:]
for product_table in product_tables:
    print(product_table.get_text(strip=True))
    

Output:

device, cpr assist
heart valve, more than minimally manipulated allograft
cleanser, root canal
saliva, artificial
locator, root apex
device, electrical dental anesthesia
mouthguard, prescription
cord, retraction
mouthguard, over-the-counter
mouthguard, migraine/tension headache

带有beautifuresoup attributeError的刮擦表:resultset对象没有属性&#x27; find_all&#x27;

漫雪独思 2025-02-13 12:13:10

您只需使用 array。 filter()方法。我在以下代码段中添加了描述性评论。

尝试此

// Input person array
const person = [{
    id: "2", name: "Tomas Addreh", language: "English"
}, {
    id: "6", name: "Mark Addreh", language: "English"
}, {
    id: "15", name: "Alex Atres", language: "Spanish"
}, {
    id: "1", name: "Mark Sertoj", language: "Spanish"
}, {
    id: "12", name: "Martha Forrest", language: "Spanish"
}];

// Initializing an array to get selected checkbox values.
const selectedPerson = [];

// getSelectedPerson() method invoke on checkbox value change.
function getSelectedPerson(event) {

// This line of code is used to push the selected languages from the checkboxes on checked into an array and remove if checbox unchecked.
  event.target.checked ? selectedPerson.push(event.target.value) : selectedPerson.splice(selectedPerson.indexOf(event.target.value), 1);
  
  // If there is any checbox selected then it will go inside this condition.
  if (selectedPerson.length) {
    // To filtered out the person array based on the languages available in selectedPerson array.
    const filtered = person.filter(({ language }) => selectedPerson.includes(language));
    // Assignign a result into a "result" div
        document.getElementById('result').innerHTML = JSON.stringify(filtered, null, 2);
  } else {
    // else case
    document.getElementById('result').innerHTML = [];
  }
}
<input type="checkbox" id="english" name="english" value="English" onchange="getSelectedPerson(event)">
<label for="english"> English</label><br>
<input type="checkbox" id="spanish" name="spanish" value="Spanish" onchange="getSelectedPerson(event)">
<label for="spanish"> Spanish</label><br>

<pre id="result"></pre>

You can simply achieve this requirement by using Array.filter() along with Array.includes() method. I added the descriptive comments in the below code snippet.

Try this :

// Input person array
const person = [{
    id: "2", name: "Tomas Addreh", language: "English"
}, {
    id: "6", name: "Mark Addreh", language: "English"
}, {
    id: "15", name: "Alex Atres", language: "Spanish"
}, {
    id: "1", name: "Mark Sertoj", language: "Spanish"
}, {
    id: "12", name: "Martha Forrest", language: "Spanish"
}];

// Initializing an array to get selected checkbox values.
const selectedPerson = [];

// getSelectedPerson() method invoke on checkbox value change.
function getSelectedPerson(event) {

// This line of code is used to push the selected languages from the checkboxes on checked into an array and remove if checbox unchecked.
  event.target.checked ? selectedPerson.push(event.target.value) : selectedPerson.splice(selectedPerson.indexOf(event.target.value), 1);
  
  // If there is any checbox selected then it will go inside this condition.
  if (selectedPerson.length) {
    // To filtered out the person array based on the languages available in selectedPerson array.
    const filtered = person.filter(({ language }) => selectedPerson.includes(language));
    // Assignign a result into a "result" div
        document.getElementById('result').innerHTML = JSON.stringify(filtered, null, 2);
  } else {
    // else case
    document.getElementById('result').innerHTML = [];
  }
}
<input type="checkbox" id="english" name="english" value="English" onchange="getSelectedPerson(event)">
<label for="english"> English</label><br>
<input type="checkbox" id="spanish" name="spanish" value="Spanish" onchange="getSelectedPerson(event)">
<label for="spanish"> Spanish</label><br>

<pre id="result"></pre>

将多个对象的数组合并到一个对象中

漫雪独思 2025-02-13 05:15:40

非常感谢Stefanuk Yurik的解决方案。

sensitivity = 0.65
supplername = "John's Company"
select_columns = %Q[id, name, similarity(lower(name),'lower(#{suppliername.gsub("'","''"}')) as sim]

Supplier.select('subquery.*').from(
  Supplier.select(select_columns).where(company_id: 3)
).where(
  Arel::Table.new('subquery')[:sim].gt(#{sensitivity})
).order(sim: :desc)`

many thanks to stefanuk yurik for the solution.

sensitivity = 0.65
supplername = "John's Company"
select_columns = %Q[id, name, similarity(lower(name),'lower(#{suppliername.gsub("'","''"}')) as sim]

Supplier.select('subquery.*').from(
  Supplier.select(select_columns).where(company_id: 3)
).where(
  Arel::Table.new('subquery')[:sim].gt(#{sensitivity})
).order(sim: :desc)`

Ruby on Rails选择使用PostgreSQL的条件下的别名

漫雪独思 2025-02-13 00:13:45

您应该将其添加到 app.module

{ provide: LocationStrategy, useClass: HashLocationStrategy }

You should add this to the app.module:

{ provide: LocationStrategy, useClass: HashLocationStrategy }

Angular 13应用程序部署在Apache服务器上,在刷新上投掷404错误

漫雪独思 2025-02-12 16:56:15

您正在使用此在循环中声明新的 isprimex 让Isprimex = false; 。它应该只是 isprimex = false;

You are declaring new isPrimeX within the loop using this let isPrimeX = false;. It should be just isPrimeX = false;

为什么代码显示Prime和非质量答案?

漫雪独思 2025-02-12 09:17:38

您已经尝试使用to_date进行格式化,但是to_date用于从字符串中转换

为以所需形式格式化的日期,您可以使用date_format如下

spark.sql("select date_format(to_date(cast(date as string),'yyyyMMdd'),'MM-dd-yyyy') as DATE_FINAL from df1")

you have tried to format using to_date but to_date is used to convert into date from string

for formatting in desired form you can do using date_format like below

spark.sql("select date_format(to_date(cast(date as string),'yyyyMMdd'),'MM-dd-yyyy') as DATE_FINAL from df1")

SparkSQL将整数转换为mm-dd-yyyy

漫雪独思 2025-02-11 20:05:57

您需要查找何时打开文件并通过 case-if 语句编写代码,大部分时间是生成事件的时间,就像单击按钮一样。

下面的示例显示了如何在按钮提交单击后处理用户选择的XLXS文件。

from pathlib import Path
import PySimpleGUI as sg

layout = [
    [sg.Input(key='-IN-'), sg.FileBrowse(file_types=(("All XLSX Files", "*.xlsx"), ))],
    [sg.Button('Submit')],
]
window = sg.Window('Title', layout)

while True:

    event, values = window.read()

    if event == sg.WIN_CLOSED:
        break
    elif event == 'Submit':
        filename = values['-IN-']
        if Path(filename).is_file():    # Check if file exists or not
            """ Open user chosen xlsx file & do something here """
            print(filename)

window.close()

You need to find when the file to be open and write code by case-if statement, most of time, it is when an event generated, like a button clicked.

Following example show how to work on user chosen XLXS file after a button Submit clicked.

from pathlib import Path
import PySimpleGUI as sg

layout = [
    [sg.Input(key='-IN-'), sg.FileBrowse(file_types=(("All XLSX Files", "*.xlsx"), ))],
    [sg.Button('Submit')],
]
window = sg.Window('Title', layout)

while True:

    event, values = window.read()

    if event == sg.WIN_CLOSED:
        break
    elif event == 'Submit':
        filename = values['-IN-']
        if Path(filename).is_file():    # Check if file exists or not
            """ Open user chosen xlsx file & do something here """
            print(filename)

window.close()

如何在我指出的区域中使用用户选择的Excel文件

漫雪独思 2025-02-11 17:56:15

错字错误

if (list.style.display == "none") {
   list.style.display = "block";
 }
else {
  list.style.display = "none";
}

const button = document.getElementById("btn");

const list = document.getElementById("list");

list.style.display = "none";

button.addEventListener("click",(event)=> {
  if (list.style.display == "none") {
      list.style.display = "block";
    }
    else {
      list.style.display = "none";
    }
})
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
 <meta charset="utf-8">
  <title></title>
  
</head>
<body>
  
  <button id="btn">Click Here</button>
  <ul id="list">
    <li>item</li>
    <li>item</li>
    <li>item</li>
    <li>item</li>
  </ul>
</body>
</html>

Typo Error

if (list.style.display == "none") {
   list.style.display = "block";
 }
else {
  list.style.display = "none";
}

const button = document.getElementById("btn");

const list = document.getElementById("list");

list.style.display = "none";

button.addEventListener("click",(event)=> {
  if (list.style.display == "none") {
      list.style.display = "block";
    }
    else {
      list.style.display = "none";
    }
})
<!DOCTYPE html>
<html lang="en" dir="ltr">
<head>
 <meta charset="utf-8">
  <title></title>
  
</head>
<body>
  
  <button id="btn">Click Here</button>
  <ul id="list">
    <li>item</li>
    <li>item</li>
    <li>item</li>
    <li>item</li>
  </ul>
</body>
</html>

我需要解决此菜单下拉问题

漫雪独思 2025-02-11 10:03:00

只需使用 itererator 函数。

function* getCurrentValue(arr, count) {
  for (let item of arr) {
    for (let j = 0; j < count; j++) {
      yield item;
    }
  }
}

for (let value of getCurrentValue([0, 315, 270, 225, 180, 135, 90], 3)) 
{
  console.log(value);
}

Simply use an iterator function.

function* getCurrentValue(arr, count) {
  for (let item of arr) {
    for (let j = 0; j < count; j++) {
      yield item;
    }
  }
}

for (let value of getCurrentValue([0, 315, 270, 225, 180, 135, 90], 3)) 
{
  console.log(value);
}

如何从闭合功能调用中返回相同的值n次?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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