辞别

文章 评论 浏览 550

辞别 2025-02-20 02:37:20

不,crontab中没有任何选择来修改cron文件。

您必须:获取当前的cron文件(crontab -l> newfile),对其进行更改并将新文件放置在适当的位置(crontab newfile)。

如果您熟悉PERL,则可以使用此模块 config :: crontab

LLP,安德里亚

No, there is no option in crontab to modify the cron files.

You have to: take the current cron file (crontab -l > newfile), change it and put the new file in place (crontab newfile).

If you are familiar with perl, you can use this module Config::Crontab.

LLP, Andrea

如何在没有交互式编辑器的情况下使用BASH创建CRON作业?

辞别 2025-02-19 07:16:45

CUDA中没有现有的内在__ vmulus8()。但是,可以使用现有的内在物进行模拟。基本上,我们可以使用两个32位变量将四个8位数量的四个16位产品包装。然后将每种产品夹至255,并在置入操作的帮助下将每种产品的最小字节提取到最终结果中。 CUDA 11为计算功能生成的代码看起来合理。性能是否足够取决于用例。如果此操作发生在用包装字节的处理管道计算的中间,则应该是这种情况。

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

/* byte-wise multiply with unsigned saturation */
__device__ unsigned int vmulus4 (unsigned int a, unsigned int b)
{
    unsigned int plo, phi, res;
    // compute products
    plo = ((a & 0x000000ff) * (b & 0x000000ff) + 
           (a & 0x0000ff00) * (b & 0x0000ff00));
    phi = (__umulhi (a & 0x00ff0000, b & 0x00ff0000) + 
           __umulhi (a & 0xff000000, b & 0xff000000));
    // clamp products to 255
    plo |= __vcmpne2 (plo & 0xff00ff00, 0x00000000);
    phi |= __vcmpne2 (phi & 0xff00ff00, 0x00000000);
    // extract least significant eight bits of each product
    res = __byte_perm (plo, phi, 0x6420);
    return res;
}

__global__ void kernel (unsigned int a, unsigned int b, unsigned int *res)
{
    *res = vmulus4 (a, b);
}

unsigned int vmulus4_ref (unsigned int a, unsigned int b)
{
    unsigned char a0, a1, a2, a3, b0, b1, b2, b3;
    unsigned int p0, p1, p2, p3;
    a0 = (a >>  0) & 0xff;
    a1 = (a >>  8) & 0xff;
    a2 = (a >> 16) & 0xff;
    a3 = (a >> 24) & 0xff;
    b0 = (b >>  0) & 0xff;
    b1 = (b >>  8) & 0xff;
    b2 = (b >> 16) & 0xff;
    b3 = (b >> 24) & 0xff;
    p0 = (unsigned int)a0 * (unsigned int)b0;
    p1 = (unsigned int)a1 * (unsigned int)b1;
    p2 = (unsigned int)a2 * (unsigned int)b2;
    p3 = (unsigned int)a3 * (unsigned int)b3;
    if (p0 > 255) p0 = 255;
    if (p1 > 255) p1 = 255;
    if (p2 > 255) p2 = 255;
    if (p3 > 255) p3 = 255;
    return (p0 << 0) + (p1 << 8) + (p2 << 16) + (p3 << 24);
}

// George Marsaglia's KISS PRNG, period 2**123. Newsgroup sci.math, 21 Jan 1999
// Bug fix: Greg Rose, "KISS: A Bit Too Simple" http://eprint.iacr.org/2011/007
static uint32_t kiss_z=362436069, kiss_w=521288629;
static uint32_t kiss_jsr=123456789, kiss_jcong=380116160;
#define znew (kiss_z=36969*(kiss_z&65535)+(kiss_z>>16))
#define wnew (kiss_w=18000*(kiss_w&65535)+(kiss_w>>16))
#define MWC  ((znew<<16)+wnew )
#define SHR3 (kiss_jsr^=(kiss_jsr<<13),kiss_jsr^=(kiss_jsr>>17), \
              kiss_jsr^=(kiss_jsr<<5))
#define CONG (kiss_jcong=69069*kiss_jcong+1234567)
#define KISS ((MWC^CONG)+SHR3)

int main (void)
{
    unsigned int *resD = 0;
    unsigned int a, b, res, ref;

    cudaMalloc ((void**)&resD, sizeof resD[0]);
    for (int i = 0; i < 1000000; i++) {
        a = KISS;
        b = KISS;
        kernel<<<1,1>>>(a, b, resD);
        cudaMemcpy (&res, resD, sizeof res, cudaMemcpyDeviceToHost);
        ref = vmulus4_ref (a, b);
        if (res != ref) {
            printf ("error: a=%08x b=%08x res=%08x ref=%08x\n", a, b, res, ref);
            return EXIT_FAILURE;
        }
    }
    cudaFree (resD);
    return EXIT_SUCCESS;
}

There is no existing intrinsic __vmulus8() in CUDA. However, it can be emulated using existing intrinsics. Basically, we can pack the four 16-bit products of four 8-bit quantities using two 32-bit variable to hold them. Then clamp each product to 255 and extract the least-significant byte of each product into the final result with the help of the permute operation. The code generated by CUDA 11 for compute capabilities >= 7.0 looks reasonable. Whether the performance is sufficient will depend on the use case. If this operation occurs in the middle of a processing pipeline computing with packed bytes, that should be the case.

#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>

/* byte-wise multiply with unsigned saturation */
__device__ unsigned int vmulus4 (unsigned int a, unsigned int b)
{
    unsigned int plo, phi, res;
    // compute products
    plo = ((a & 0x000000ff) * (b & 0x000000ff) + 
           (a & 0x0000ff00) * (b & 0x0000ff00));
    phi = (__umulhi (a & 0x00ff0000, b & 0x00ff0000) + 
           __umulhi (a & 0xff000000, b & 0xff000000));
    // clamp products to 255
    plo |= __vcmpne2 (plo & 0xff00ff00, 0x00000000);
    phi |= __vcmpne2 (phi & 0xff00ff00, 0x00000000);
    // extract least significant eight bits of each product
    res = __byte_perm (plo, phi, 0x6420);
    return res;
}

__global__ void kernel (unsigned int a, unsigned int b, unsigned int *res)
{
    *res = vmulus4 (a, b);
}

unsigned int vmulus4_ref (unsigned int a, unsigned int b)
{
    unsigned char a0, a1, a2, a3, b0, b1, b2, b3;
    unsigned int p0, p1, p2, p3;
    a0 = (a >>  0) & 0xff;
    a1 = (a >>  8) & 0xff;
    a2 = (a >> 16) & 0xff;
    a3 = (a >> 24) & 0xff;
    b0 = (b >>  0) & 0xff;
    b1 = (b >>  8) & 0xff;
    b2 = (b >> 16) & 0xff;
    b3 = (b >> 24) & 0xff;
    p0 = (unsigned int)a0 * (unsigned int)b0;
    p1 = (unsigned int)a1 * (unsigned int)b1;
    p2 = (unsigned int)a2 * (unsigned int)b2;
    p3 = (unsigned int)a3 * (unsigned int)b3;
    if (p0 > 255) p0 = 255;
    if (p1 > 255) p1 = 255;
    if (p2 > 255) p2 = 255;
    if (p3 > 255) p3 = 255;
    return (p0 << 0) + (p1 << 8) + (p2 << 16) + (p3 << 24);
}

// George Marsaglia's KISS PRNG, period 2**123. Newsgroup sci.math, 21 Jan 1999
// Bug fix: Greg Rose, "KISS: A Bit Too Simple" http://eprint.iacr.org/2011/007
static uint32_t kiss_z=362436069, kiss_w=521288629;
static uint32_t kiss_jsr=123456789, kiss_jcong=380116160;
#define znew (kiss_z=36969*(kiss_z&65535)+(kiss_z>>16))
#define wnew (kiss_w=18000*(kiss_w&65535)+(kiss_w>>16))
#define MWC  ((znew<<16)+wnew )
#define SHR3 (kiss_jsr^=(kiss_jsr<<13),kiss_jsr^=(kiss_jsr>>17), \
              kiss_jsr^=(kiss_jsr<<5))
#define CONG (kiss_jcong=69069*kiss_jcong+1234567)
#define KISS ((MWC^CONG)+SHR3)

int main (void)
{
    unsigned int *resD = 0;
    unsigned int a, b, res, ref;

    cudaMalloc ((void**)&resD, sizeof resD[0]);
    for (int i = 0; i < 1000000; i++) {
        a = KISS;
        b = KISS;
        kernel<<<1,1>>>(a, b, resD);
        cudaMemcpy (&res, resD, sizeof res, cudaMemcpyDeviceToHost);
        ref = vmulus4_ref (a, b);
        if (res != ref) {
            printf ("error: a=%08x b=%08x res=%08x ref=%08x\n", a, b, res, ref);
            return EXIT_FAILURE;
        }
    }
    cudaFree (resD);
    return EXIT_SUCCESS;
}

cuda simd指令,用于每个字节乘法,无符号饱和

辞别 2025-02-19 04:04:21

如果将函数称为(您可能必须提供其他参数),

test('www','find_all')

则可以在函数中调用方法“ find_all”,例如:

result = getattr(soup, function)(*lst)

If you call the function like (you may have to provide additional arguments)

test('www','find_all')

You can call the method "find_all" in the function like:

result = getattr(soup, function)(*lst)

如何从功能中调用导入库的功能?

辞别 2025-02-18 16:22:50

我可以想到两个问题为什么这不起作用。

  • 首先,您要访问themedata darktheme中定义的,但是您的thememode并不暗。因此,在Interialt> Interialapp add thememode:thememode.dark参数。
  • 其次,您调用theme.of(context)的按钮.primarycolor在窗口小部件与主题定义相同,而您的上下文仍然没有该数据。因此,只有当前小部件的儿童的上下文才有此数据。解决方案是在其内部使用按钮制作一个新的小部件,或用Builder窗口小部件包装您的按钮,其构建器内部具有上下文。

您的问题可以是第一,第二或两者。

I can think of two problems why this is not working.

  • First, you want to access ThemeData defined in darkTheme, but your themeMode is not dark. So in MaterialApp add themeMode: ThemeMode.dark parameter as well.
  • Second, your button where you call Theme.of(context).primaryColor is inside same widget as your definition of Theme, and your context still doesn't have that data. So only context of children of current widget have this data. Solution would be to make a new widget with your button inside it, or wrap your button with Builder widget which have context inside its builder.

Your problem can be first, second or both.

主要的自定义颜色不作颤动

辞别 2025-02-18 07:28:53

一种可能的解决方案是使用以下代码停止postgres.exe背景过程:

taskkill /fi“ imagename eq postgres.exe” /t

One possible solution would be to stops the postgres.exe background processes using the following code:

Taskkill /FI "IMAGENAME eq postgres.exe" /T

停止Postgres.exe背景过程

辞别 2025-02-18 02:25:51

这是因为响应的默认类型为json,您需要将响应设置为text

才能实现此目的:

public createXML(data:IJob)
{
    console.log("createXML - POST data to server: ", data);
    let headers = new HttpHeaders();
    headers = headers.append('Content-Type', 'application/xml');
    return this.httpClient.post<any>(
      environment.restUrl + "/createXML/",
      data, 
      {
        responseType: "text" // this is 
      }
     ).pipe(
      tap((data) => console.log(data)),
      catchError(this.handleError)
    );
}

有关更多信息,您可以看到<<。 a href =“ https://angular.io/guide/http#making-a-post-request” rel =“ nofollow noreferrer”>如何制作邮政请求

This is happening because the default type of your response is JSON, you need to set the response as text

In order to achieve this you have to:

public createXML(data:IJob)
{
    console.log("createXML - POST data to server: ", data);
    let headers = new HttpHeaders();
    headers = headers.append('Content-Type', 'application/xml');
    return this.httpClient.post<any>(
      environment.restUrl + "/createXML/",
      data, 
      {
        responseType: "text" // this is 
      }
     ).pipe(
      tap((data) => console.log(data)),
      catchError(this.handleError)
    );
}

For more information you see how to make a POST request

Angular-从服务器返回XML数据

辞别 2025-02-18 00:41:15

nosuchelementException 是不同的web驱动器例外之一,当定位器(即id/xpath/css selectors等Selenium程序代码无法在网页上找到Web元素。获得此例外有两种可能性,即我们提供了一个不正确的定位器,试图找到Web元素,或者我们提供了正确的定位器,但是与定位器相关的Web元素在网页上可用。

请尝试使用以下

xpath

//input[@placeholder='Search for an item']

css selector

input[placeholder='Search for an item']

注意:在vba中不知道,在java中,请在元素上找到一些等待,如下

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
WebElement  elem = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@placeholder='Search for an item']")));
elem.sendKeys("ABC");

希望这样回答您的问题

NoSuchElementException is one of the different WebDriver Exceptions and this Exception occurs, when the locators (i.e. id / xpath/ css selectors etc) we mentioned in the Selenium Program code is unable to find the web element on the web page. There are two possibilities for getting this Exception, i.e. either we have provided a incorrect locator and trying to find the web element or we have provided correct locator, but the web element related to the locator is not available on the web page.

Please try using the below

XPATH

//input[@placeholder='Search for an item']

CSS SELECTOR

input[placeholder='Search for an item']

Note: Put some waits while locating to the element, as I do not know in Vba, but in java like below

WebDriverWait wait = new WebDriverWait(driver, Duration.ofSeconds(30));
WebElement  elem = wait.until(ExpectedConditions.elementToBeClickable(By.xpath("//input[@placeholder='Search for an item']")));
elem.sendKeys("ABC");

Hope this answer your question

VBA硒问题

辞别 2025-02-18 00:25:51

更新:此答案是较早版本的打字稿中的最佳解决方案,但是较新版本中有更好的选项(请参阅其他答案)。

公认的答案有效,在某些情况下可能需要,但没有提供任何类型的安全性来构建对象的缺点。如果您尝试添加未定义的属性,此技术至少会丢弃类型错误。

interface F { (): any; someValue: number; }

var f = <F>function () { }
f.someValue = 3

// type error
f.notDeclard = 3

Update: This answer was the best solution in earlier versions of TypeScript, but there are better options available in newer versions (see other answers).

The accepted answer works and might be required in some situations, but have the downside of providing no type safety for building up the object. This technique will at least throw a type error if you attempt to add an undefined property.

interface F { (): any; someValue: number; }

var f = <F>function () { }
f.someValue = 3

// type error
f.notDeclard = 3

在打字稿中构建具有属性的功能对象

辞别 2025-02-16 20:58:39

您可以按行解析文件。您将将当前块作为数组变量,将其填充,因为排除行,当新块启动时,只需将上一个块添加到最终结果阵列中。

以下代码使用基本函数(而不是$ this-&gt;调用,就像您在问题中一样)。您可以根据需要更新代码。

<?php
// the file was placed on my server for testing
$file = fopen('test.txt','r');
// this will contain the final result
$result = [];
// currentBlock is null at first
$currentBlock = null;
while (($line = fgets($file)) !== false) {
    // extracting the line code
    $lineCode = substr($line, 0, 14);
    // checking if the row contains a value, between two '
    $rowComponents = explode("'", $line);
    if (count($rowComponents) < 2) {
        // the row is not formatted ok
        continue;
    }
    $value = $rowComponents[1];
    switch ($lineCode) {
        case 'S10.G00.00.001':
            $website = $value;
            break;
        case 'S10.G00.00.002':
            $companyName = $value;
            break;
        case 'S10.G00.00.003':
            $version = $value;
            break;
        case 'S21.G00.30.001':
            // starting a new entry
            if ($currentBlock !== null) {
                // we already have a block being parsed
                // so we added it to the final result
                $result[] = $currentBlock;
            }
            // starting the current block as an empty array
            $currentBlock = [];
            $currentBlock['property1'] = $value;
            break;
        case 'S21.G00.30.002':
            $currentBlock ['property2'] = $value;
            break;
        case 'S21.G00.30.004':
            $currentBlock ['property4'] = $value;
            break;
    }
}
// adding the last entry into the final result
// only if the block exists
if ($currentBlock !== null) {
    $result[] = $currentBlock;
}
fclose($file);
// output the result for debugging
// you also have the $website, $companyName, $version parameters populated
var_dump($result);

?>

滚动运行后,我从var_dump调用:

array(3) {
  [0]=>
  array(3) {
    ["property1"]=>
    string(12) "employee one"
    ["property2"]=>
    string(4) "AAAA"
    ["property4"]=>
    string(4) "BBBB"
  }
  [1]=>
  array(3) {
    ["property1"]=>
    string(10) "employee 2"
    ["property2"]=>
    string(4) "CCCC"
    ["property4"]=>
    string(4) "DDDD"
  }
  [2]=>
  array(3) {
    ["property1"]=>
    string(10) "employee 3"
    ["property2"]=>
    string(4) "EEEE"
    ["property4"]=>
    string(4) "FFFF"
  }
}

You can parse the file line by line. You will have the current block as an array variable, populate it as rows are parsed and, when a new block start just add the previous block to the final result array.

The following code uses basic functions (and not $this-> calls, as you have in the question). You can update the code as you wish.

<?php
// the file was placed on my server for testing
$file = fopen('test.txt','r');
// this will contain the final result
$result = [];
// currentBlock is null at first
$currentBlock = null;
while (($line = fgets($file)) !== false) {
    // extracting the line code
    $lineCode = substr($line, 0, 14);
    // checking if the row contains a value, between two '
    $rowComponents = explode("'", $line);
    if (count($rowComponents) < 2) {
        // the row is not formatted ok
        continue;
    }
    $value = $rowComponents[1];
    switch ($lineCode) {
        case 'S10.G00.00.001':
            $website = $value;
            break;
        case 'S10.G00.00.002':
            $companyName = $value;
            break;
        case 'S10.G00.00.003':
            $version = $value;
            break;
        case 'S21.G00.30.001':
            // starting a new entry
            if ($currentBlock !== null) {
                // we already have a block being parsed
                // so we added it to the final result
                $result[] = $currentBlock;
            }
            // starting the current block as an empty array
            $currentBlock = [];
            $currentBlock['property1'] = $value;
            break;
        case 'S21.G00.30.002':
            $currentBlock ['property2'] = $value;
            break;
        case 'S21.G00.30.004':
            $currentBlock ['property4'] = $value;
            break;
    }
}
// adding the last entry into the final result
// only if the block exists
if ($currentBlock !== null) {
    $result[] = $currentBlock;
}
fclose($file);
// output the result for debugging
// you also have the $website, $companyName, $version parameters populated
var_dump($result);

?>

After the scrips runs, I have the following output, from the var_dump call:

array(3) {
  [0]=>
  array(3) {
    ["property1"]=>
    string(12) "employee one"
    ["property2"]=>
    string(4) "AAAA"
    ["property4"]=>
    string(4) "BBBB"
  }
  [1]=>
  array(3) {
    ["property1"]=>
    string(10) "employee 2"
    ["property2"]=>
    string(4) "CCCC"
    ["property4"]=>
    string(4) "DDDD"
  }
  [2]=>
  array(3) {
    ["property1"]=>
    string(10) "employee 3"
    ["property2"]=>
    string(4) "EEEE"
    ["property4"]=>
    string(4) "FFFF"
  }
}

从文本文件中提取块,他们的第一行以同一字符串开始

辞别 2025-02-16 20:30:17

是在回调之前。

是的。

在这种情况下,var1和var2将不确定。

编号然后方法返回a 承诺。它不会返回未定义的

Is it before callbacks run.

Yes.

In that case, var1 and var2 will be undefined.

No. The then method returns a promise. It doesn't return undefined.

导出语句何时在节点JS中运行?

辞别 2025-02-16 17:50:17

例如,我将各种字符串长度插入Sheet1!b1:b20使用= pept(“

Sub Test()

    Dim MySheet As Worksheet
    Set MySheet = ThisWorkbook.Worksheets("Sheet1")

    Dim Name_Column As Long
    Name_Column = 2

    Dim iloop_line As Long
    Dim StringValue As String
    For iloop_line = 1 To 20
        StringValue = LCase(MySheet.Cells(iloop_line, Name_Column))
        Debug.Print StringValue & "_addr" & Space(30 - Len(StringValue & "_addr")) & ": std_logic_vector"
        Debug.Print StringValue & "_val" & Space(30 - Len(StringValue & "_val")) & ": std_logic_vector"
    Next iloop_line
    
End Sub

上面的代码为我提供了下面的输出 - 始终是第31个字符。

aaaaaaaaaaa_addr              : std_logic_vector
aaaaaaaaaaa_val               : std_logic_vector
aaaaaaaaaaaa_addr             : std_logic_vector
aaaaaaaaaaaa_val              : std_logic_vector
aaaaaaaaaa_addr               : std_logic_vector
aaaaaaaaaa_val                : std_logic_vector
aaaaaaaaaa_addr               : std_logic_vector
aaaaaaaaaa_val                : std_logic_vector 

编辑:很尴尬 - 从vba中的space命令不知道。已经更新了代码,而不是rept。想想上次我使用的可能是Sinclair Basic。

As an example I inserted various string lengths into Sheet1!B1:B20 using =REPT("a",RANDBETWEEN(1,20)).

Sub Test()

    Dim MySheet As Worksheet
    Set MySheet = ThisWorkbook.Worksheets("Sheet1")

    Dim Name_Column As Long
    Name_Column = 2

    Dim iloop_line As Long
    Dim StringValue As String
    For iloop_line = 1 To 20
        StringValue = LCase(MySheet.Cells(iloop_line, Name_Column))
        Debug.Print StringValue & "_addr" & Space(30 - Len(StringValue & "_addr")) & ": std_logic_vector"
        Debug.Print StringValue & "_val" & Space(30 - Len(StringValue & "_val")) & ": std_logic_vector"
    Next iloop_line
    
End Sub

The code above gave me the output below - the : is always the 31st character.

aaaaaaaaaaa_addr              : std_logic_vector
aaaaaaaaaaa_val               : std_logic_vector
aaaaaaaaaaaa_addr             : std_logic_vector
aaaaaaaaaaaa_val              : std_logic_vector
aaaaaaaaaa_addr               : std_logic_vector
aaaaaaaaaa_val                : std_logic_vector
aaaaaaaaaa_addr               : std_logic_vector
aaaaaaaaaa_val                : std_logic_vector 

Edit: Well that's embarrassing - never knew about the SPACE command in VBA. Have updated code to use that rather than REPT. Think last time I used that could have been with Sinclair BASIC.

如何对齐宏(VBA)生成的代码

辞别 2025-02-16 13:49:06

您的代码(带有我的评论)

def min_variance(mean_returns, cov_matrix):
    num_assets = len(mean_returns)
    args = (mean_returns, cov_matrix)
    constraints = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})
    bound = (0.0,1.0)
    bounds = tuple(bound for asset in range(num_assets))

# this is un-indented, which to Python means
# it's a line of code outside the min_variance method
result = sco.minimize(portfolio_volatility, num_assets*[1./num_assets,], args=args,
                        method='SLSQP', bounds=bounds, constraints=constraints)
    return result

您的result =行未注明,因此它不是min_variance方法的一部分。

如果您缩进它,它应该看起来像这样并解决您的直接问题。

def min_variance(mean_returns, cov_matrix):
    num_assets = len(mean_returns)
    args = (mean_returns, cov_matrix)
    constraints = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})
    bound = (0.0,1.0)
    bounds = tuple(bound for asset in range(num_assets))

    result = sco.minimize(portfolio_volatility, num_assets*[1./num_assets,], args=args,
                        method='SLSQP', bounds=bounds, constraints=constraints)
    return result

Your code (with a comment from me)

def min_variance(mean_returns, cov_matrix):
    num_assets = len(mean_returns)
    args = (mean_returns, cov_matrix)
    constraints = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})
    bound = (0.0,1.0)
    bounds = tuple(bound for asset in range(num_assets))

# this is un-indented, which to Python means
# it's a line of code outside the min_variance method
result = sco.minimize(portfolio_volatility, num_assets*[1./num_assets,], args=args,
                        method='SLSQP', bounds=bounds, constraints=constraints)
    return result

Your result = line is un-indented, so it's not part of the min_variance method.

If you indent it, it should look like this and resolve your immediate issue.

def min_variance(mean_returns, cov_matrix):
    num_assets = len(mean_returns)
    args = (mean_returns, cov_matrix)
    constraints = ({'type': 'eq', 'fun': lambda x: np.sum(x) - 1})
    bound = (0.0,1.0)
    bounds = tuple(bound for asset in range(num_assets))

    result = sco.minimize(portfolio_volatility, num_assets*[1./num_assets,], args=args,
                        method='SLSQP', bounds=bounds, constraints=constraints)
    return result

凹痕误差和未定义的变量

辞别 2025-02-16 12:05:01

听起来您尝试连接时使用localhost作为主机名。

在Docker上下文中,localhost是容器本身。您可以将其服务名称作为主机名称连接到另一个容器。

因此,当连接从Human_Cloning_Facities到Jedi_service时,您应该使用http://jedi_service:8082/,并且从Jedi_service连接到Human_Cloning_facilities到Human_Cloning_facities代码>。

在Docker创建的桥梁网络上的容器之间连接时,您应该使用容器端口。这在您的情况下并没有改变,因为您将端口映射到主机上的同一端口号。但是,如果您只需要访问网络上其他容器的容器,则无需将端口映射到主机端口。仅当您需要从主机访问容器时才需要。

It sounds like you're using localhost as the host name when you try to connect.

In a Docker context, localhost is the container itself. You can connect to another container by using it's service name as it's host name.

So when connecting from human_cloning_facilities to jedi_service, you should use http://jedi_service:8082/ and when connecting from jedi_service to human_cloning_facilities, you should use http://human_cloning_facilities:8080/.

When connecting between containers on the bridge network that Docker creates, you should use the container ports. That doesn't make a difference in your case since you map your ports to the same port numbers on the host. But if you only need to access the containers from other containers on the network, you don't need to map the ports to host ports. That's only needed if you need to access the containers from the host.

HTTP连接在两个Docker容器之间拒绝,而从外部则可以连接

辞别 2025-02-16 07:24:22

您可以在无线电输入上设置V-Model,并使用计算的属性过滤数据:

new Vue({
  el: "#demo",
  data() {
    return {
      checks: ['Developer','Tester', 'Designer', 'Support'],
      infojobs: [{genres: 'Developer', position:'Senior Java Engineer, Big Data',      exprerience:'3-5 Years', salary:'', headequarters:'', content1:'A', content2:'B',   content3:'C'}],
      selected: null,
      display: ''
    }
  },
  computed: {
    filtered() {
      if (this.selected) return this.infojobs.filter(i => i.genres === this.selected)
      return this.infojobs
    }
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
  <div class="job-filter">
    <h3>Filter</h3>
    <div class="radio-group" id="group-filter" :class="{ 'display-block': this.display }">
      <div class="radio-check pdt-10 ">
        <input type="radio"  name="fav_language" v-model="selected" value="">
        <label for="">Tất cả</label><br>
      </div>
      <div class="radio-check" v-for="(check, index) in checks" :key="index">
        <input type="radio" :id="index" :value="check"  name="fav_language" v-model="selected" >
        <label for="">{{check}}</label><br>
      </div>
      {{selected}}
    </div>
  </div>
  <div class="search">
    <div class="search-top flex-wrap">
      <h5>22 tin tuyển dụng</h5>
      <div class="search-input">
        <input type="search" placeholder="Nhập từ khóa để tìm kiếm">
        <button><img src="../assets/recruit/search.svg" alt=""></button>
      </div>
    </div>
    <div class="job-item" v-for="(item, index) in filtered" :key="index">
      <h3 class="mleft-27">{{item.position}}</h3>
      <div class="job-info flex-wrap">
          <div class="job-info-left pleft-27 flex-wrap">
            <div>
              <img src="../assets/recruit/years.svg" alt="">
              <b>{{item.exprerience}}</b>
            </div>
            <div>
              <img src="../assets/recruit/luong.svg" alt="">
              <b>{{item.salary}}</b>
            </div>
            <div>
              <img src="../assets/recruit/diadiem.svg" alt="">
              <b>{{item.headequarters}}</b>
              </div>
          </div>
          <div>
            <h6>2 ngày trước</h6>
          </div>
        </div>
        <div class="info-job flex-wrap">
          <div class="list-info-job">
            <ul>
                <li>{{item.content1}}</li>
                <li>{{item.content2}}</li>
                <li>{{item.content3}}</li>
            </ul>
          </div>
          <a href="/detail">
            <button class="btn-detail" >Xem chi tiết</button>
          </a>
        </div>
    </div>
  </div>
</div>

You can set v-model on your radio inputs and use computed property to filter data:

new Vue({
  el: "#demo",
  data() {
    return {
      checks: ['Developer','Tester', 'Designer', 'Support'],
      infojobs: [{genres: 'Developer', position:'Senior Java Engineer, Big Data',      exprerience:'3-5 Years', salary:'', headequarters:'', content1:'A', content2:'B',   content3:'C'}],
      selected: null,
      display: ''
    }
  },
  computed: {
    filtered() {
      if (this.selected) return this.infojobs.filter(i => i.genres === this.selected)
      return this.infojobs
    }
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="demo">
  <div class="job-filter">
    <h3>Filter</h3>
    <div class="radio-group" id="group-filter" :class="{ 'display-block': this.display }">
      <div class="radio-check pdt-10 ">
        <input type="radio"  name="fav_language" v-model="selected" value="">
        <label for="">Tất cả</label><br>
      </div>
      <div class="radio-check" v-for="(check, index) in checks" :key="index">
        <input type="radio" :id="index" :value="check"  name="fav_language" v-model="selected" >
        <label for="">{{check}}</label><br>
      </div>
      {{selected}}
    </div>
  </div>
  <div class="search">
    <div class="search-top flex-wrap">
      <h5>22 tin tuyển dụng</h5>
      <div class="search-input">
        <input type="search" placeholder="Nhập từ khóa để tìm kiếm">
        <button><img src="../assets/recruit/search.svg" alt=""></button>
      </div>
    </div>
    <div class="job-item" v-for="(item, index) in filtered" :key="index">
      <h3 class="mleft-27">{{item.position}}</h3>
      <div class="job-info flex-wrap">
          <div class="job-info-left pleft-27 flex-wrap">
            <div>
              <img src="../assets/recruit/years.svg" alt="">
              <b>{{item.exprerience}}</b>
            </div>
            <div>
              <img src="../assets/recruit/luong.svg" alt="">
              <b>{{item.salary}}</b>
            </div>
            <div>
              <img src="../assets/recruit/diadiem.svg" alt="">
              <b>{{item.headequarters}}</b>
              </div>
          </div>
          <div>
            <h6>2 ngày trước</h6>
          </div>
        </div>
        <div class="info-job flex-wrap">
          <div class="list-info-job">
            <ul>
                <li>{{item.content1}}</li>
                <li>{{item.content2}}</li>
                <li>{{item.content3}}</li>
            </ul>
          </div>
          <a href="/detail">
            <button class="btn-detail" >Xem chi tiết</button>
          </a>
        </div>
    </div>
  </div>
</div>

当我单击单击单击按钮和标签时​​,如何在VUEJS 2中显示相应的值

辞别 2025-02-16 05:04:10

有了这两个规则,有一个替代方案都不匹配,然后重复。重复一件事不匹配的东西是不行的。

通过重新格式化规则,很明显,替代方案无匹配:

rfc5322_obsBody
  : ( LFD* CR* ((NUL | rfc5322_text) LFD* CR*)* // alternative 1
    | CRLF                                      // alternative 2
    )*
  ;

rfc5322_obsUnstruct
  : ( LFD* CR* (rfc5322_obsUText LFD* CR*)* // alternative 1
    | rfc5322_fws                           // alternative 2
    )*
  ;

在这两种情况下,替代1都不匹配任何匹配(然后用*重复)。

在这两种情况下,您都应该能够将内部*(零或更多)更改为+(一次或多个):

rfc5322_obsBody
  : ( LFD* CR* ((NUL | rfc5322_text) LFD* CR*)+ // alternative 1
    | CRLF                                      // alternative 2
    )* // <- outer *
  ;

rfc5322_obsUnstruct
  : ( LFD* CR* (rfc5322_obsUText LFD* CR*)+ // alternative 1
    | rfc5322_fws                           // alternative 2
    )* // <- outer *
  ;

这将导致替代1匹配某物,但是,外部*仍然会导致整个规则仍然没有匹配,因此您可以在那里。

With both these rules, there is an alternative that matches nothing, which is then repeated. And repeating something that matches nothing, is not OK.

By reformatting the rules, it will be apparent which alternative matches nothing:

rfc5322_obsBody
  : ( LFD* CR* ((NUL | rfc5322_text) LFD* CR*)* // alternative 1
    | CRLF                                      // alternative 2
    )*
  ;

rfc5322_obsUnstruct
  : ( LFD* CR* (rfc5322_obsUText LFD* CR*)* // alternative 1
    | rfc5322_fws                           // alternative 2
    )*
  ;

In both cases, alternative 1 matches nothing (which is then repeated with *).

In both cases, you should just be able to change the inner * (zero or more) into + (once or more):

rfc5322_obsBody
  : ( LFD* CR* ((NUL | rfc5322_text) LFD* CR*)+ // alternative 1
    | CRLF                                      // alternative 2
    )* // <- outer *
  ;

rfc5322_obsUnstruct
  : ( LFD* CR* (rfc5322_obsUText LFD* CR*)+ // alternative 1
    | rfc5322_fws                           // alternative 2
    )* // <- outer *
  ;

which will cause alternative 1 to match something, yet the outer * will still cause the entire rule to still match nothing, so you're OK there.

antl4的规则...包含至少一个可以匹配一个空字符串的替代方案的闭合。

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

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