我不是你的备胎

文章 评论 浏览 33

我不是你的备胎 2025-02-21 00:28:02

您的时循环会导致此问题。第一个元素具有索引 0 ,并且只要 lp< UP 0无法达到。将比Smaler等于Smaler的更小,您就很好。

此外,我会添加一张检查 up 的检查不小于 0 ,因为您正在减少它。您虽然循环看起来像这样:

while (lp <= up && up >= 0) {

Your while loop causes this problem. The first element has the index 0 and as long as lp < up 0 is not reachable. Change the smaller than to a smaler equals and you're good.

In addition I would add a check that up doesn't get smaller than 0 because you are decreasing it. You while loop could look like this:

while (lp <= up && up >= 0) {

字符串阵列的第一个元素是未找到的

我不是你的备胎 2025-02-20 20:07:35

我正在尝试使用 kint ,而我不能。这是我的群集配置文件:

apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
  - role: control-plane
    extraPortMappings:
      - containerPort: 30000
        hostPort: 30000
        listenAddress: 127.0.0.1

      - containerPort: 30001
        hostPort: 30001
        listenAddress: 127.0.0.1

然后发出创建群集的问题: streate create cluster -config cluster.yaml

然后我有一个示例部署:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-and-wiremock
spec:
  selector:
    matchLabels:
      app: nginx-and-wiremock
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx-and-wiremock
    spec:
      containers:
        - name: nginx
          image: nginx
          ports:
            - containerPort: 80
        - name: wiremock
          image: wiremock/wiremock:2.32.0
          ports:
            - containerPort: 8080

我使用 nginx wiremock 图像,露出不同的端口: 80 8080 。通过: kubectl应用-f nginx-wiremock-deployment.yaml

我还部署 service.yaml

apiVersion: v1
kind: Service
metadata:
  labels:
    app: nginx-and-wiremock
  name: nginx-and-wiremock
spec:
  ports:
    - name: nginx
      nodePort: 30000
      targetPort: 80
      port: 80
    - name: wiremock
      nodePort: 30001
      targetPort: 8080
      port: 8080
  selector:
    app: nginx-and-wiremock
  type: NodePort

一旦启动并运行:

curl localhost:30000
curl localhost:30001/__admin/mappings

两个响应都很好。

I am trying to re-produce this using kind and I can't. Here is my cluster config file:

apiVersion: kind.x-k8s.io/v1alpha4
kind: Cluster
nodes:
  - role: control-plane
    extraPortMappings:
      - containerPort: 30000
        hostPort: 30000
        listenAddress: 127.0.0.1

      - containerPort: 30001
        hostPort: 30001
        listenAddress: 127.0.0.1

then issue to create the cluster: kind create cluster --config cluster.yaml

Then I have a sample deployment:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: nginx-and-wiremock
spec:
  selector:
    matchLabels:
      app: nginx-and-wiremock
  replicas: 1
  template:
    metadata:
      labels:
        app: nginx-and-wiremock
    spec:
      containers:
        - name: nginx
          image: nginx
          ports:
            - containerPort: 80
        - name: wiremock
          image: wiremock/wiremock:2.32.0
          ports:
            - containerPort: 8080

I use nginx and wiremock images, that expose different ports: 80 and 8080. Deploy this one via : kubectl apply -f nginx-wiremock-deployment.yaml.

I also deploy a service.yaml:

apiVersion: v1
kind: Service
metadata:
  labels:
    app: nginx-and-wiremock
  name: nginx-and-wiremock
spec:
  ports:
    - name: nginx
      nodePort: 30000
      targetPort: 80
      port: 80
    - name: wiremock
      nodePort: 30001
      targetPort: 8080
      port: 8080
  selector:
    app: nginx-and-wiremock
  type: NodePort

Once this is up and running:

curl localhost:30000
curl localhost:30001/__admin/mappings

Both of the respond just fine.

如何将具有多个容器的Kubernetes部署连接到单个服务的多个服务端口?

我不是你的备胎 2025-02-20 14:21:25

您可以使用。您无法从同步函数中返回未来的结果,但是由于您的hellosync()返回void,因此。

void helloSync(){
  helloAsync().then((result) => print(result));
}

You could use .then() instead. You can't return the result of a Future from a synchronous function, but since your helloSync() returns void anyway, .then() might be what you are looking for.

void helloSync(){
  helloAsync().then((result) => print(result));
}

破坏异步 /等待声明链

我不是你的备胎 2025-02-20 13:20:10

我能够通过云通过云中添加端口来解决此问题。以前,我只在安全组中添加了一个端口8000,但遇到了同样的问题。之后,我添加了两个节点的所有提到的端口(8000和30303)。结果,我能够连接它的区块链节点。还通过采矿进行了测试,其中块正在同步。

I am able to resolve this issue by adding ports into my security group over cloud. Before, I had added only one port 8000 into the security group, but face the same problem. After that I have added all the mentioned ports that I have used (8000 and 30303) for both nodes. As a result I am able to connect it blockchain node. Also tested with mining where blocks are synchronizing.

如何在云上连接区块链节点?

我不是你的备胎 2025-02-20 12:05:47

Django将通过相关模型的名称访问反向外键关系,然后是a _set -suffix ,公开一个 > 。

{% for detalle_remito in remito.detalle_remito_set.all %}
    {{ detalle_remito.id_recurso.descripcion }}
{% endfor %}

在您看来,无需收集更多数据。

Django will make the reverse foreign key relation accessible with the related model's name followed by a _set-suffix, exposing an instance of RelatedManager.

{% for detalle_remito in remito.detalle_remito_set.all %}
    {{ detalle_remito.id_recurso.descripcion }}
{% endfor %}

No need to gather addional data for that in your view.

如何显示Django中三个相关表的数据?

我不是你的备胎 2025-02-20 09:29:20

您在代码中犯了一些错误。当您使用foreach-object进行管道时,您基本上将在代码框架中将其转移为“ $ _”中的每个项目。

因此,您在这里所做的是(如果删除了主题标签):

$yammer | ForEach-Object {
#Import-CSV "C:\Temp\yammerGroup.csv" | ForEach-Object {

foreach组为$ yammer,导入CSV,然后在CSV中使用ID $ yammer.id隐藏该组($ yammer.id)($ yammer.id)找到了小组,并且各自的ID)。

那么您应该使用什么概念?

例如,通过发现的组循环并将其隐藏在地址清单中:

$Yammer = Get-UnifiedGroup -ResultSize Unlimited |?{$_.GroupSku -eq "Yammer"}  
$yammer | ForEach-Object {
    Write-Host *** Task 1 ***    Setting Group Hidden From Address List Attribute -NoNewline -ForegroundColor Green
    Set-UnifiedGroup -Identity $_.id -HiddenFromAddressListsEnabled $true
}

或者使用CSV:

Get-UnifiedGroup -ResultSize Unlimited |?{$_.GroupSku -eq "Yammer"} |  Export-Csv "C:\Temp\yammerGroup.csv" -NoTypeInformation
Import-CSV "C:\Temp\yammerGroup.csv" | ForEach-Object {
    Write-Host *** Task 1 ***    Setting Group Hidden From Address List Attribute -NoNewline -ForegroundColor Green
    Set-UnifiedGroup -Identity $_.id -HiddenFromAddressListsEnabled $true
}

You are making a few mistakes in your code. When you pipe with Foreach-Object, you basically send every item through which will be referred to in the codeblock as '$_'.

So what you are doing here is (if the hashtag is removed):

$yammer | ForEach-Object {
#Import-CSV "C:\Temp\yammerGroup.csv" | ForEach-Object {

Foreach group in $yammer, import the CSV and then foreach item in the CSV hide the group with id $yammer.id ($yammer.id contains an array of all found groups and there respective id's).

So what concept should you use?

For instance looping through the found groups and hide them from addresslist:

$Yammer = Get-UnifiedGroup -ResultSize Unlimited |?{$_.GroupSku -eq "Yammer"}  
$yammer | ForEach-Object {
    Write-Host *** Task 1 ***    Setting Group Hidden From Address List Attribute -NoNewline -ForegroundColor Green
    Set-UnifiedGroup -Identity $_.id -HiddenFromAddressListsEnabled $true
}

Or use the CSV instead:

Get-UnifiedGroup -ResultSize Unlimited |?{$_.GroupSku -eq "Yammer"} |  Export-Csv "C:\Temp\yammerGroup.csv" -NoTypeInformation
Import-CSV "C:\Temp\yammerGroup.csv" | ForEach-Object {
    Write-Host *** Task 1 ***    Setting Group Hidden From Address List Attribute -NoNewline -ForegroundColor Green
    Set-UnifiedGroup -Identity $_.id -HiddenFromAddressListsEnabled $true
}

通过阵列与foreach循环通过CSV Newbie Assitance foreach循环

我不是你的备胎 2025-02-20 06:09:15

使用 charfield line_one

class Inventory(models.Model):
    title = models.CharField('Title', max_length=120, default='')
    # ...


class Invoice(models.Model):
   line_one = models.CharField('Line 1', max_length=120)
   # ...


class InvoiceForm(forms.ModelForm):
    line_one = forms.CharField(widget=forms.Select)

    class Meta:
        model = Invoice
        fields = ['line_one', ] # ...

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # populate the choices from the Inventory model objects
        self.fields['line_one'].widget.choices = [(i.title, i.title) for i in Inventory.objects.all()]
        # or
        self.fields['line_one'].widget.choices = [(t,t) for t in Inventory.objects.values_list('title', flat=True)

使用 foreferkey for line_one

如果您想使用 forefer> foreferykey )代码>,有必要具有 inting.title 的唯一值。

class Inventory(models.Model):
    title = models.CharField('Title', max_length=120, default='')
    # ...

    # The __str()__ method of an object is used by django
    # to generate the labels for a Select input widget
    def __str__(self):
        return self.title


class Invoice(models.Model):
   line_one = models.ForeignKey(Inventory, to_field='title', on_delete=models.CASCADE)
   # ...


class InvoiceForm(forms.ModelForm):
    class Meta:
        model = Invoice
        fields = ['line_one', ] # ...

    # no need for any form adjustments,
    # as django uses a select input as default for ForeignKey fields

Use a CharField for line_one

class Inventory(models.Model):
    title = models.CharField('Title', max_length=120, default='')
    # ...


class Invoice(models.Model):
   line_one = models.CharField('Line 1', max_length=120)
   # ...


class InvoiceForm(forms.ModelForm):
    line_one = forms.CharField(widget=forms.Select)

    class Meta:
        model = Invoice
        fields = ['line_one', ] # ...

    def __init__(self, *args, **kwargs):
        super().__init__(*args, **kwargs)

        # populate the choices from the Inventory model objects
        self.fields['line_one'].widget.choices = [(i.title, i.title) for i in Inventory.objects.all()]
        # or
        self.fields['line_one'].widget.choices = [(t,t) for t in Inventory.objects.values_list('title', flat=True)

Use a ForeignKey for line_one

If you like to use a ForeignKey, it is necessary to have unique values for Inventory.title.

class Inventory(models.Model):
    title = models.CharField('Title', max_length=120, default='')
    # ...

    # The __str()__ method of an object is used by django
    # to generate the labels for a Select input widget
    def __str__(self):
        return self.title


class Invoice(models.Model):
   line_one = models.ForeignKey(Inventory, to_field='title', on_delete=models.CASCADE)
   # ...


class InvoiceForm(forms.ModelForm):
    class Meta:
        model = Invoice
        fields = ['line_one', ] # ...

    # no need for any form adjustments,
    # as django uses a select input as default for ForeignKey fields

如何定义模型的字段以从另一个模型的另一个字段中选择另一个应用程序?

我不是你的备胎 2025-02-19 20:58:32

如此 github问题当前在本机中没有解决此问题的方法。您可以使用 highdicom 软件包。您可以使用 class highdicom.io subpodule。为了完整性,我在此处报告文档中提出的示例,以一次读取多帧DICOM文件的每个帧,

>>> from pydicom.data import get_testdata_file
>>> from highdicom.io import ImageFileReader

>>> test_filepath = get_testdata_file('eCT_Supplemental.dcm')
>>>
>>> with ImageFileReader(test_filepath) as image:
...     print(image.metadata.SOPInstanceUID)
...     for i in range(image.number_of_frames):
...         frame = image.read_frame(i)
...         print(frame.shape)
1.3.6.1.4.1.5962.1.1.10.3.1.1166562673.14401
(512, 512)
(512, 512)

因为您的数据不包含ICC配置文件,因此您应该使用该选项运行该示例 CRORCE_COLOR = false read_frame 函数中。此外,您应该评论第一个打印,因为缺少此属性会导致读取元数据的属性错误。通过这些更改,上面应该在您的数据上使用的示例代码看起来像这样:

>>> with ImageFileReader(test_filepath) as image:
    ...     #print(image.metadata.SOPInstanceUID)
    ...     for i in range(image.number_of_frames):
    ...         frame = image.read_frame(i, correct_color=False)
    ...         print(frame.shape)

有关更多问题,请始终先查看文档(此处链接)。

As described in this GitHub issue currently there's no solution to this in native pydicom. You can use the highdicom package instead. You can use the ImageFileReader class in the highdicom.io submodule. For the sake of completeness, I report here the example proposed in the documentation to read each frame of a multi-frame dicom file one step at a time:

>>> from pydicom.data import get_testdata_file
>>> from highdicom.io import ImageFileReader

>>> test_filepath = get_testdata_file('eCT_Supplemental.dcm')
>>>
>>> with ImageFileReader(test_filepath) as image:
...     print(image.metadata.SOPInstanceUID)
...     for i in range(image.number_of_frames):
...         frame = image.read_frame(i)
...         print(frame.shape)
1.3.6.1.4.1.5962.1.1.10.3.1.1166562673.14401
(512, 512)
(512, 512)

Since your data don't contain an ICC profile you should run the example with the option correct_color=False in the read_frame function. Furtherly you should comment the first print since the absence of this attribute causes an attribute error in reading metadata. With these changes the example code above that should work on your data looks like this:

>>> with ImageFileReader(test_filepath) as image:
    ...     #print(image.metadata.SOPInstanceUID)
    ...     for i in range(image.number_of_frames):
    ...         frame = image.read_frame(i, correct_color=False)
    ...         print(frame.shape)

For further issues always take a look at the documentation first (here linked).

读取大型DICOM文件的第一帧

我不是你的备胎 2025-02-19 19:14:49

解决:

Android Studio -> File -> sync project with Gradle files

Solved with:

Android Studio -> File -> sync project with Gradle files

离子Revenuecat“无法解析符号HybridCommon”还有更多

我不是你的备胎 2025-02-19 18:45:16

只需删除 .value

var created = 10;
var limitacc = 25;
var element = document.querySelector(".progress-bar");

if (created=== limitacc){
element.classList.add("bg-danger");
} else {
element.classList.add("bg-warning");
}

Just remove .value

var created = 10;
var limitacc = 25;
var element = document.querySelector(".progress-bar");

if (created=== limitacc){
element.classList.add("bg-danger");
} else {
element.classList.add("bg-warning");
}

JavaScript如果可变值等于变量值

我不是你的备胎 2025-02-19 14:56:37

我假设您在WordPress网站上遇到了这个问题。
正如您在上面的注释中提到的,您的 untuff typeError:$不是控制台中的函数错误,所以让我澄清问题。

$ 在WordPress中不可用 jQuery 对象提供。您必须使用 jQuery 关键字来访问jQuery,然后您可以提供 $ ,因此您的代码应该像这样:

jQuery(document).ready(function ($) {
    $(document).on('click', '.single_add_to_cart_button', function () {
        alert('Merge');
    });
});

或以现代方式

(function ($) {
    $(document).on('click', '.single_add_to_cart_button', function () {
        alert('Merge');
    });
})(jQuery);

I am assuming you have this problem with your WordPress website.
and as you mentioned in the above comments that you have Uncaught TypeError: $ is not a function error in the console, so let me clarify the issue.

$ is not available globally in WordPress as jQuery object. You'll have to use jQuery keyword to access the jQuery then you can supply it is $ so your code should be like this:

jQuery(document).ready(function ($) {
    $(document).on('click', '.single_add_to_cart_button', function () {
        alert('Merge');
    });
});

Or in a modern way

(function ($) {
    $(document).on('click', '.single_add_to_cart_button', function () {
        alert('Merge');
    });
})(jQuery);

jQuery $(。button-class).click(function(){});没有工作

我不是你的备胎 2025-02-19 10:50:23

单元格式是确定的解决方案吗?
您单击标题单元格并写入“ = A1”,其中A1是包含您更改文本的单元格

Would a cell formula be an ok solution?
You click on your header cell and write "=A1", where A1 is the cell that contains the text you change

如何使Excel中的标题具有来自单元格的价值和变化?

我不是你的备胎 2025-02-19 08:19:00

您的想法是好的和明确的,但远非最佳。

const objArr = [
{ id: 1, val: "

Your ideas are good and explicit, but far from being optimal.

const objArr = [
    { id: 1, val: "????" },
    { id: 1, val: "????" },
    { id: 1, val: "????" },
    { id: 2, val: "????" },
    { id: 2, val: "????" },
    { id: 2, val: "????" },
];
const idValMap = new Map();

objArr.forEach(o=>{
   let vals = idValMap.get(o.id);
   if(!vals){
       vals = [];
       idValMap.set(o.id,vals);
   }
   vals.push(o.val);
});

console.log(Array.from(idValMap.entries()));

You can do most of it in just one loop. Take the key, check if you saw it already, if not initialize. That's it

天真的方法总结了一系列对象?

我不是你的备胎 2025-02-19 01:54:13

您可能实现这一目标的一种方法是在脚本开始时通过编程安装依赖项,如

作为脚本工作流的示例,该脚本工作流程安装了依赖关系,例如,ulid:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: workflow-draft-
spec:
  entrypoint: draft-script
  templates:
 
    - name: draft-script
      steps:
      - - name: try-out-pip-install
          template: draft

    - name: draft
      script:
        image: python:alpine3.16
        command: ["python"]
        source: |
          import pip
          pip.main(['install', 'ulid'])
      
          import ulid
          print("ulid", ulid.ulid())

One way you might achieve this is by programmatically installing dependencies at the start of your script, as discussed in Installing python module within code

As an example of a Script Workflow that installs a dependency, e.g., ulid:

apiVersion: argoproj.io/v1alpha1
kind: Workflow
metadata:
  generateName: workflow-draft-
spec:
  entrypoint: draft-script
  templates:
 
    - name: draft-script
      steps:
      - - name: try-out-pip-install
          template: draft

    - name: draft
      script:
        image: python:alpine3.16
        command: ["python"]
        source: |
          import pip
          pip.main(['install', 'ulid'])
      
          import ulid
          print("ulid", ulid.ulid())

Argo:如何使用a&#x27;脚本&#x27;模板?

我不是你的备胎 2025-02-18 16:57:23

当用户发布用户名时,您可以这样做,例如,单击提交您可以使用mysqli编写此代码:

<?php

// make sure the error reporting is enabled!
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli('localhost', 'user', 'password', 'test');
$mysqli->set_charset('utf8mb4');

$username = $_POST['username'];
$stmt = $conn->prepare("SELECT 1 FROM table_name where username=?");
$stmt->bind_param("s", $username);
$stmt->execute();
$result = $stmt->get_result();
$user = $result->fetch_row();
if ($user) {
    $error[] = "This username is already taken!";
}

创建用户的列时,您可以使其独一无二,例如创建表用户(用户名Varchar(350)并非唯一)。

You can do it like this when the user post the username for example and click submit you can write this code using mysqli:

<?php

// make sure the error reporting is enabled!
mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);
$mysqli = new mysqli('localhost', 'user', 'password', 'test');
$mysqli->set_charset('utf8mb4');

$username = $_POST['username'];
$stmt = $conn->prepare("SELECT 1 FROM table_name where username=?");
$stmt->bind_param("s", $username);
$stmt->execute();
$result = $stmt->get_result();
$user = $result->fetch_row();
if ($user) {
    $error[] = "This username is already taken!";
}

When you create the column of the user you can make it unique, for example create table users(username varchar(350) not null unique).

人们注册时如何防止重复用户名?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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