软的没边

文章 评论 浏览 27

软的没边 2025-02-20 12:33:51

问题在于具有:

apiVersion: networking.k8s.io/v1 
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/cors-allow-methods: "GET, OPTIONS, HEAD"
    nginx.ingress.kubernetes.io/cors-allow-headers: "Content-Type, Accept-Ranges, Content-Range, Range, Content-Encoding, Content-Length, Access-Control-Allow-Origin"

http/1.1 204没有内容响应的K8S入口是正确的前飞行员响应,由提供入口,这是不是预期的WebDav Reponse ,第一个请求甚至没有达到运行WSGIDAV的POD。

解决方案:禁用入口上的CORS支持。然后还可以:

/usr/libexec/gvfsd-dav ssl=true user=anonymous host=files.isric.org  prefix=/soilgrids/latest/data/
> OPTIONS /soilgrids/latest/data HTTP/1.1
> Soup-Debug-Timestamp: 1657095042
> Soup-Debug: SoupSession 1 (0x55758f924100), SoupMessage 1 (0x7f01180060d0), SoupSocket 1 (0x7f0118342110)
> Host: dev-files.isric.org
> Accept-Encoding: gzip, deflate
> User-Agent: gvfs/1.48.2
> Accept-Language: en-us, en;q=0.9
> Connection: Keep-Alive
  
< HTTP/1.1 200 OK
< Soup-Debug-Timestamp: 1657095042
< Soup-Debug: SoupMessage 1 (0x7f01180060d0)
< Date: Wed, 06 Jul 2022 08:10:42 GMT
< Content-Type: text/html
< Content-Length: 0
< Connection: keep-alive
< DAV: 1
< Allow: OPTIONS, HEAD, GET, PROPFIND
< MS-Author-Via: DAV
< Strict-Transport-Security: max-age=15724800; includeSubDomains
< 

The problem lies on the k8s ingress that has:

apiVersion: networking.k8s.io/v1 
kind: Ingress
metadata:
  annotations:
    nginx.ingress.kubernetes.io/enable-cors: "true"
    nginx.ingress.kubernetes.io/cors-allow-methods: "GET, OPTIONS, HEAD"
    nginx.ingress.kubernetes.io/cors-allow-headers: "Content-Type, Accept-Ranges, Content-Range, Range, Content-Encoding, Content-Length, Access-Control-Allow-Origin"

The HTTP/1.1 204 No Content response is the correct pre-flight CORS response that is provided by the ingress, this is not the expected WebDAV reponse, and the first request was not even reaching the pod running wsgidav.

Solution: Disable CORS support on ingress. and then things are OK:

/usr/libexec/gvfsd-dav ssl=true user=anonymous host=files.isric.org  prefix=/soilgrids/latest/data/
> OPTIONS /soilgrids/latest/data HTTP/1.1
> Soup-Debug-Timestamp: 1657095042
> Soup-Debug: SoupSession 1 (0x55758f924100), SoupMessage 1 (0x7f01180060d0), SoupSocket 1 (0x7f0118342110)
> Host: dev-files.isric.org
> Accept-Encoding: gzip, deflate
> User-Agent: gvfs/1.48.2
> Accept-Language: en-us, en;q=0.9
> Connection: Keep-Alive
  
< HTTP/1.1 200 OK
< Soup-Debug-Timestamp: 1657095042
< Soup-Debug: SoupMessage 1 (0x7f01180060d0)
< Date: Wed, 06 Jul 2022 08:10:42 GMT
< Content-Type: text/html
< Content-Length: 0
< Connection: keep-alive
< DAV: 1
< Allow: OPTIONS, HEAD, GET, PROPFIND
< MS-Author-Via: DAV
< Strict-Transport-Security: max-age=15724800; includeSubDomains
< 

/SBIN/Mount.davfs:安装失败;该服务器不支持WebDav

软的没边 2025-02-19 17:50:37

我会将添加为“小” 作为 size size 的类型,并且我还将添加“ small” 作为通用类型的默认值。

function getDetail<S extends Size = "small">(size: S | "small" = "small"):Detail<S>{
    if(size === "small")
        return "noDetail" as Detail<S>;
    if(size === "medium")
        return "partialDetail" as Detail<S>
    return "fullDetail" as Detail<S>;
}

游乐场

I would add "small" as type for size and I would also add "small" as default for the generic type.

function getDetail<S extends Size = "small">(size: S | "small" = "small"):Detail<S>{
    if(size === "small")
        return "noDetail" as Detail<S>;
    if(size === "medium")
        return "partialDetail" as Detail<S>
    return "fullDetail" as Detail<S>;
}

Playground

如何允许打字稿通用参数具有默认值

软的没边 2025-02-19 15:02:49

我会尝试用 async Task 关于新密码的结果:

- hosts: rhel
  become: yes

  tasks:
    - name: Set ansible password.
      ansible.builtin.user:
        name: ansible
        update_password: always
        password: "{{ new_ansible_pw_var | password_hash ('sha512')}}"
     async: 15
     poll: 0
     register: change_ansible_password

   - name: Check ansible password change was successful
     vars:
       ansible_password: "{{ new_ansible_pw_var }}"
     async_status:
       jid: "{{ change_ansible_password.ansible_job_id }}"
     register: job_result
     until: job_result.finished
     retries: 15
     delay: 1

   - name: polite guests always clean after themselves when necessary (see doc)
     vars:
       ansible_password: "{{ new_ansible_pw_var }}"
     async_status:
       jid: "{{ change_ansible_password.ansible_job_id }}"
       mode: cleanup

I'd try to do this with an async task and check back on the result with the new password:

- hosts: rhel
  become: yes

  tasks:
    - name: Set ansible password.
      ansible.builtin.user:
        name: ansible
        update_password: always
        password: "{{ new_ansible_pw_var | password_hash ('sha512')}}"
     async: 15
     poll: 0
     register: change_ansible_password

   - name: Check ansible password change was successful
     vars:
       ansible_password: "{{ new_ansible_pw_var }}"
     async_status:
       jid: "{{ change_ansible_password.ansible_job_id }}"
     register: job_result
     until: job_result.finished
     retries: 15
     delay: 1

   - name: polite guests always clean after themselves when necessary (see doc)
     vars:
       ansible_password: "{{ new_ansible_pw_var }}"
     async_status:
       jid: "{{ change_ansible_password.ansible_job_id }}"
       mode: cleanup

更改Ansible密码时会出错

软的没边 2025-02-19 06:25:19

这几乎是正常的行为。

序列发生器的唯一责任是产生独特的整数值,仅此而已。

This is pretty much normal behavior.

The sole responsibility of the sequence generator is to produce distinct integer values, nothing more.

为什么我的序列机器跳过ID值?

软的没边 2025-02-19 01:32:37

好吧,我的活动中有这个代码。

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
    getWindow().setAllowEnterTransitionOverlap(true);
    getWindow().setAllowReturnTransitionOverlap(true);
    getWindow().setExitTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, true).setDuration(250));
    getWindow().setEnterTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, true).setDuration(250));
    getWindow().setReenterTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, false).setDuration(250));
    getWindow().setReturnTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, false).setDuration(250));
    super.onCreate(savedInstanceState);
...
}

当我尝试去外部应用程序时,我发生了这次崩溃,并且我的活动中有一个回收模型。

似乎回收器的视图在动画上有一些问题。

我为解决这个问题所做的就是通过评论该线条来放弃出口动画

// getWindow().setExitTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, true).setDuration(250));

Well I had this code in my activity.

@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    getWindow().requestFeature(Window.FEATURE_ACTIVITY_TRANSITIONS);
    getWindow().setAllowEnterTransitionOverlap(true);
    getWindow().setAllowReturnTransitionOverlap(true);
    getWindow().setExitTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, true).setDuration(250));
    getWindow().setEnterTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, true).setDuration(250));
    getWindow().setReenterTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, false).setDuration(250));
    getWindow().setReturnTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, false).setDuration(250));
    super.onCreate(savedInstanceState);
...
}

This crash happened for me when I tried to go to an external App and I had a recyclerview in my activity.

It seems like the recycler view has some issues with Animations.

What i did to solve this was to give up having the exit animation by commenting that line out

// getWindow().setExitTransition(new MaterialSharedAxis(MaterialSharedAxis.Z, true).setDuration(250));

当使用可运行的可运行的notifyEmchangemchange时,recyclerview崩溃了[IllegalArgumentException]

软的没边 2025-02-18 21:01:21

我在使用current_col()中找到了我自己问题的解决方案,该解决方案在使用ifelse()中给出了当前列的名称。

test %>% mutate(across(c(a, b, c), ~ifelse(cur_column() == d, -99, .)))

I found the solution to my own question in using current_col() which gives the name of the current column in an across()function, using ifelse().

test %>% mutate(across(c(a, b, c), ~ifelse(cur_column() == d, -99, .)))

如果列名在另一列中,则一系列列的突变单元格

软的没边 2025-02-18 09:40:23

看来这只是凹痕的问题。

我创建了这个,它可以按预期创建/编辑excel,然后将数据范围写入两个不同的表:

import pandas as pd
d = {'1':[5,6,7], '2':[1,2,3], '3':[9,8,7]}
e = {'1':[1,1,1], '2':[2,2,2], '3':[3,3,3]}

# make two different test dataframes
df = pd.DataFrame(d)
dfe = pd.DataFrame(e)

# send to excel
excel_path = "C:\\test\\test.xlsx"

with pd.ExcelWriter(excel_path) as writer:
    df.to_excel(writer, sheet_name='Sheet_name_1')
    dfe.to_excel(writer, sheet_name='Sheet_name_2')

print('done')

结果:

“在此处输入映像”

另外, writer.save()不是在写作时,由于块的的出口就足够了。

it looks like it is just an issue with the indentation.

i create this and it works as expected creating / editing an excel and then writing the dataframes to two different sheets:

import pandas as pd
d = {'1':[5,6,7], '2':[1,2,3], '3':[9,8,7]}
e = {'1':[1,1,1], '2':[2,2,2], '3':[3,3,3]}

# make two different test dataframes
df = pd.DataFrame(d)
dfe = pd.DataFrame(e)

# send to excel
excel_path = "C:\\test\\test.xlsx"

with pd.ExcelWriter(excel_path) as writer:
    df.to_excel(writer, sheet_name='Sheet_name_1')
    dfe.to_excel(writer, sheet_name='Sheet_name_2')

print('done')

result:

enter image description here

Also, the writer.save() is not necessary as the exit of the with block is sufficient when writing.

从许多HTML表中获取用户的输入

软的没边 2025-02-17 22:08:17

不知道为什么您会遇到错误。由于某种原因,我看不到它被阻止的原始站点,但是可以使用您输入的DIV运行Express Server,并且在以下情况下使用以下功能对我来说很好。

import string

import bs4
import requests

if __name__ == '__main__':
    r = requests.get('http://localhost:3000/')
    soup = bs4.BeautifulSoup(r.text)
    div = soup.find('div', class_='DrugPriceBox__price___dj2lv')
    acceptable_chars = set(string.ascii_letters + string.digits + '.')
    drugprice = ''.join(char for char in div.text if char in acceptable_chars)
    print(drugprice)

Not sure why you are getting an error. I cannot see the original site as it is blocked for some reason, but running an express server with exactly the div that you entered, and using the below worked fine for me with the below.

import string

import bs4
import requests

if __name__ == '__main__':
    r = requests.get('http://localhost:3000/')
    soup = bs4.BeautifulSoup(r.text)
    div = soup.find('div', class_='DrugPriceBox__price___dj2lv')
    acceptable_chars = set(string.ascii_letters + string.digits + '.')
    drugprice = ''.join(char for char in div.text if char in acceptable_chars)
    print(drugprice)

从div中获得价值,还有另一个空白标签python beautifulsoup

软的没边 2025-02-17 08:01:42

因此,您可以将多个“在商店下”安装到​​Alluxio(一个HDF和一个S3),并通过明确的操作在两个商店的两个下方的数据之间移动,或者在某些情况下使用某些规则和自动化来激发数据传输(如果您正在使用Alluxio Enterprise)。它最终会在传输时将数据存储在Alluxio Cache中,但是您当然可以将数据移动。

So you can mount multiple "under stores" to Alluxio (one hdfs and one S3) and have data move between the two under stores either through explicit actions, or in some cases using some rules and automation to instigate the transfer of data (if you are using Alluxio enterprise). It would end up storing the data in the Alluxio cache as it transfers, but you can certainly have data move.

在Alluxio上安装HDFS数据

软的没边 2025-02-17 05:05:19

错误 “ npm err!缺少脚本:“ dev” 因为您没有开发

脚本

  1. 。 nodemon
  2. 添加“ dev”:“ 中的nodemon ./bin/www” “ scripts” in package.json

错误'jsx'当前未启用 :在创建 babelrc.json 文件之后,在您的根文件夹中并粘贴到它:

{
 "presets": ["@babel/preset-react"]
  } 

您必须检查<<<<<代码> node_modules/react-scripts/config/webpack.config.js
然后寻找

 // @remove-on-eject-begin
            babelrc: false,
            configFile: false,

然后set babelrc:true,启用 .babelrc 文件更改工作

The error "npm ERR! Missing script: "dev" because you don't have dev script.

You can try :

  1. installing npm install --save-dev nodemon
  2. add "dev": "nodemon ./bin/www" in your "scripts" in package.json

the error 'jsx' isn't currently enabled : after creating babelrc.json file in your root folder and pasting to it:

{
 "presets": ["@babel/preset-react"]
  } 

you have to check node_modules/react-scripts/config/webpack.config.js
and look for

 // @remove-on-eject-begin
            babelrc: false,
            configFile: false,

then set babelrc: true, to enable .babelrc file changes to work

如何解决对实验语法的支持&#x27; jsx&#x27;当前启用了ISNENABLE

软的没边 2025-02-16 14:17:41

已经有很多解释来解释它是如何发生以及如何修复它的,但是您也应该遵循最佳实践避免 nullpointerexpiption

参见:
最佳实践

我会补充一点,非常重要,可以很好地利用 final 修饰符。
使用“最终”

修饰符:

  1. 使用 final 修饰符来执行良好的初始化。
  2. 避免在方法中返回null,例如适用时返回空收集。
  3. 使用注释 @Nullable
  4. 快速失败,并使用断言在整个应用程序不应为null时避免通过整个应用程序传播Null对象。
  5. 首先使用已知对象的平等: if(“ nownobject” .equals(unknownobject)
  6. peave valueof()而不是 toString()
  7. 使用null SAFE 方法 stringutils.isempty(null)
  8. 使用Java 8可选作为方法中的返回值,可选类为表示可选值而不是null引用提供了解决方案。

A lot of explanations are already present to explain how it happens and how to fix it, but you should also follow best practices to avoid NullPointerExceptions at all.

See also:
A good list of best practices

I would add, very important, make a good use of the final modifier.
Using the "final" modifier whenever applicable in Java

Summary:

  1. Use the final modifier to enforce good initialization.
  2. Avoid returning null in methods, for example returning empty collections when applicable.
  3. Use annotations @NotNull and @Nullable
  4. Fail fast and use asserts to avoid propagation of null objects through the whole application when they shouldn't be null.
  5. Use equals with a known object first: if("knownObject".equals(unknownObject)
  6. Prefer valueOf() over toString().
  7. Use null safe StringUtils methods StringUtils.isEmpty(null).
  8. Use Java 8 Optional as return value in methods, Optional class provide a solution for representing optional values instead of null references.

什么是NullPoInterException,我该如何修复?

软的没边 2025-02-15 22:11:46

我刚刚在20分钟前遇到了我朋友的项目。解决方案非常完美。
如果您不想更新您的IDE(出于任何原因)或降级您的Maven版本,则只需要更改Maven Home Path :(文件|设置| build,...等。除“ ...包装器”外,所有列出的变体。
通常,我在c:/my-maven-folder/...包装器中使用分离的maven,所以我从来没有遇到过这样的问题。希望它有帮助!

I've just ran into this problem 20mins ago with my friend's project. The solution is just perfect.
If you don't want to update your IDE (for any reason) or downgrade yor Maven version, you just need to change your Maven Home path: (File | Settings | Build,...etc. | Build Tools | Maven) for any listed variant except "...wrapper".
Generally, I use separated maven in C:/my-maven-folder/...wrapper, so I've never had such a problem. Hope it helps!

在使用Maven 3.8.5中导入Springboot 2.7项目时错误

软的没边 2025-02-15 19:08:31

尝试以下操作:

var workbook = new ExcelFile();
var worksheet = workbook.Worksheets.Add("Sheet1");
var cell = worksheet.Cells["C3"];
cell.Formula = "'=IF(ISBLANK(B3), \"\", 10)";
workbook.Save("output.xlsx");

Try this:

var workbook = new ExcelFile();
var worksheet = workbook.Worksheets.Add("Sheet1");
var cell = worksheet.Cells["C3"];
cell.Formula = "'=IF(ISBLANK(B3), \"\", 10)";
workbook.Save("output.xlsx");

如何在Gembox.spreadsheet中应用Excel公式

软的没边 2025-02-15 05:35:37

因此,它可以使用您正在尝试的东西,但我认为您对凹陷有问题。

使用 nindent 确保所有行被缩进,并且不要引用该值。

kind: ConfigMap
apiVersion: v1
metadata:
  name: test
  namespace: test
data:
  index.js: | {{- tpl (.Files.Get "values/index.js") $ | nindent 4 }}

So it works what you are trying but I think you have issues with the indention.

Use nindent to ensure all lines are indented and dont quote the value.

kind: ConfigMap
apiVersion: v1
metadata:
  name: test
  namespace: test
data:
  index.js: | {{- tpl (.Files.Get "values/index.js") $ | nindent 4 }}

helm tpl函数在configmap中用于读取index.js

软的没边 2025-02-14 22:04:17

我通过删除卷来解决问题。那是因为Dockerfile本身复制了源代码,并且不需要卷。我只需要在开发环境中的卷,以便在进行代码更改时进行容器进行更新:)

我将创建单独的docker-compose.yml文件:一个用于开发,另一个用于生产环境。

I solved the issue by removing the volume. That is because the dockerfile itself copies the source code and there is no need for the volume. I only needed the volume in my development environment so that the container gets updated while I make code changes :)

I will create separate docker-compose.yml files: one for development and another for the production environment.

gitlab和docker组成:安装目录是空容器内空的

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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