单身狗的梦

文章 评论 浏览 29

单身狗的梦 2025-02-20 20:12:23

config/sanctum.php

检查是否存在Localhost:8000。

'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
  '%s%s',
  'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
  env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '',
))),

.env

// + 
SANCTUM_STATEFUL_DOMAINS=localhost:8000

JS

请与CSRF-Token一起发送。

const http = axios.create({
  baseURL: 'http://localhost:8000/api',
  withCredentials: true,
});

  const getUsers = () => {
    http.get('/users').then((res) => {
      setUsers(res.data);
    })
  }

// Methods except get
  const postUser = (data) => {
    http.get('/sanctum/csrf-cookie').then((res) => {
    http.post('/user',data).then((res) => {
    })
  })

config/sanctum.php

Check to see if localhost:8000 exists.

'stateful' => explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf(
  '%s%s',
  'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1',
  env('APP_URL') ? ','.parse_url(env('APP_URL'), PHP_URL_HOST) : '',
))),

.env

// + 
SANCTUM_STATEFUL_DOMAINS=localhost:8000

JS

Please send with csrf-token.

const http = axios.create({
  baseURL: 'http://localhost:8000/api',
  withCredentials: true,
});

  const getUsers = () => {
    http.get('/users').then((res) => {
      setUsers(res.data);
    })
  }

// Methods except get
  const postUser = (data) => {
    http.get('/sanctum/csrf-cookie').then((res) => {
    http.post('/user',data).then((res) => {
    })
  })

Laravel Sanctum和Spa混乱 - 会话再生问题

单身狗的梦 2025-02-20 17:29:36

NIFI无状态基本上是NIFI流的替代运行时。它是轻量级的,并且不会在重新启动之间持续数据(因此名称:)
我认为这里列出的信息非常全面:

nifi minifi 本质上是无头的nifi(不支持创作作者流动)并有NARS的Justa子集。另一方面,可以支持C2协议,并可以以这种方式下载流量。

根据您的描述,如果您有一个来源和目的地,并且在无状态的重新启动之间丢失的状态似乎是一个更好的选择。

NiFi Stateless is basically an alternate runtime for NiFI flows. It is lighweight and doesn't persist data between restarts (hence the name :)
I think the information listed here is quite comprehensive:

NiFi MiNiFi is essentially a headless NiFi (doesn't support authoring flows) and has justa subset of NARs. On the other hand supports the C2 protocol and can download flows that way.

Based on your description if you have a single source and destination and you are ok with state lost between restarts stateless seems to be a better fit.

Apache Nifi无状态与Apache Nifi minifi的意图有何不同

单身狗的梦 2025-02-20 15:21:20

会话状态有效。不知道它是否100%正确,但这适用于一个小测试示例:

import streamlit as st
from streamlit_option_menu import option_menu



"st.session_state object", st.session_statewith st.sidebar:
    selected = option_menu(

        menu_title= "Exposure time calculator",
        options=['A', 'B', 'C'],

    )
    
if selected == 'A':
    param1 = st.number_input('val1', value=20.0, key='key1')
    param2 = st.number_input('val2', value = 30.0, key = 'key2')
  
elif selected == 'B':
    add = st.session_state.key1 + st.session_state.key2
    divide = st.session_state.key1/st.session_state.key2
    st.write(add)
    st.write(divide)

Session states works. Don't know if it is 100% correct, but this works for a small test example:

import streamlit as st
from streamlit_option_menu import option_menu



"st.session_state object", st.session_statewith st.sidebar:
    selected = option_menu(

        menu_title= "Exposure time calculator",
        options=['A', 'B', 'C'],

    )
    
if selected == 'A':
    param1 = st.number_input('val1', value=20.0, key='key1')
    param2 = st.number_input('val2', value = 30.0, key = 'key2')
  
elif selected == 'B':
    add = st.session_state.key1 + st.session_state.key2
    divide = st.session_state.key1/st.session_state.key2
    st.write(add)
    st.write(divide)

简化Python变量声明

单身狗的梦 2025-02-20 08:23:07

无论是地图还是JSON,基本想法都将是迭代键值对并使用新值更新正确的密钥。

JSON的示例:

String json = "{\"query\":{\"select\":{\"f1\":1},\"where\":{\"f1\":1},\"orderBy\":[{\"key\":\"item.id\",\"direction\":\"asc\"},{\"key\":\"page.id\",\"direction\":\"desc\"}]}}";
JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject();
JsonArray jsonArray = jsonObject.get("query").getAsJsonObject().get("orderBy").getAsJsonArray();
Iterator<JsonElement> itr = jsonArray.iterator();
while(itr.hasNext()) {
    JsonObject obj = itr.next().getAsJsonObject();          
    obj.addProperty("direction", obj.get("direction").getAsString().toUpperCase());
}

System.out.println(jsonObject);

输出

{"query":{"select":{"f1":1},"where":{"f1":1},"orderBy":[{"key":"item.id","direction":"ASC"},{"key":"page.id","direction":"DESC"}]}}

Whether it's a map or JSON the basic idea will be to iterate the key-value pairs and update the correct key with the new value.

Example with json:

String json = "{\"query\":{\"select\":{\"f1\":1},\"where\":{\"f1\":1},\"orderBy\":[{\"key\":\"item.id\",\"direction\":\"asc\"},{\"key\":\"page.id\",\"direction\":\"desc\"}]}}";
JsonObject jsonObject = JsonParser.parseString(json).getAsJsonObject();
JsonArray jsonArray = jsonObject.get("query").getAsJsonObject().get("orderBy").getAsJsonArray();
Iterator<JsonElement> itr = jsonArray.iterator();
while(itr.hasNext()) {
    JsonObject obj = itr.next().getAsJsonObject();          
    obj.addProperty("direction", obj.get("direction").getAsString().toUpperCase());
}

System.out.println(jsonObject);

Output

{"query":{"select":{"f1":1},"where":{"f1":1},"orderBy":[{"key":"item.id","direction":"ASC"},{"key":"page.id","direction":"DESC"}]}}

嵌套的hashmap对象 - 评估大写的特定值

单身狗的梦 2025-02-19 18:20:21

不幸的是,没有内置模式识别。 Anychart库存图表组件支持建立几种类型的 href =“ https://docs.anychart.com/stock_charts/drawing_tools_and_annotations/triangle” rel =“ nofollow noreferrer”> triangle ,可以通过程序添加。

Unfortunately, there is no pattern recognition built-in. AnyChart Stock Chart Component supports building of several types of annotations like triangle, which can be added programmatically.

Anychart的Any Stock是否为您提供模式识别功能?

单身狗的梦 2025-02-19 06:00:42

您可以将索引级别的列表传递到 dataframe.droplevel

例如,给定以下数据框架,

import pandas as pd

df = (
    pd.DataFrame(np.random.randint(5, size=(5,5)), 
                 columns=list('abcde'))
      .set_index(list('abcd'))
)
>>> df

         e
a b c d   
0 4 2 0  2
3 2 3 1  1
4 2 2 3  4
0 0 1 4  2
  4 3 4  4

您可以做类似的事情

res = df.droplevel(list(range(1, len(df.index.names), 2)))
>>> res

     e
a c   
0 2  2
3 3  1
4 2  4
0 1  2
  3  4

You can pass a list of index levels to DataFrame.droplevel.

For instance, given the following DataFrame

import pandas as pd

df = (
    pd.DataFrame(np.random.randint(5, size=(5,5)), 
                 columns=list('abcde'))
      .set_index(list('abcd'))
)
>>> df

         e
a b c d   
0 4 2 0  2
3 2 3 1  1
4 2 2 3  4
0 0 1 4  2
  4 3 4  4

You can do something like

res = df.droplevel(list(range(1, len(df.index.names), 2)))
>>> res

     e
a c   
0 2  2
3 3  1
4 2  4
0 1  2
  3  4

从多索引数据集中降低均匀级别

单身狗的梦 2025-02-18 22:13:21

这是您要实现的示例。

const d = {
    name: 'Name goes here',
    type: 'type goes here',
    series : [{
        type: 'series type',
        label: 'series label'
  }]
}


const newD = {
    ...d,
    series: [
        {
          ...d.series[0], // problem is here
          tooltip: {
            enable: true,
          }
        }
      ]
  } 
console.log (newD)

here is sample of what you are trying to achieve .

const d = {
    name: 'Name goes here',
    type: 'type goes here',
    series : [{
        type: 'series type',
        label: 'series label'
  }]
}


const newD = {
    ...d,
    series: [
        {
          ...d.series[0], // problem is here
          tooltip: {
            enable: true,
          }
        }
      ]
  } 
console.log (newD)

在React状态的嵌套阵列中添加项目

单身狗的梦 2025-02-18 15:48:04

它在复制活动中是一个限制(或功能),它回合小数,我可以向您推荐的是将小数转换为字符串,然后在应对数据后将数据复制为SQL再次将其转换为十进制(使用虚拟列左右)。

Its a limitation (or feature) in Copy activity , it Rounds up the decimals, what i can recommend to you is converting your decimals into Strings and then copy your data to SQl after coping your data just re-convert it into decimal again (use a dummy column or so ).

使用ADF中的复制数据活动的值不匹配

单身狗的梦 2025-02-18 14:07:30

您可以减去 p6m“) 来自 fn:current-datetime()

fn:current-dateTime() - xs:yearMonthDuration("P6M")

您当前正在比较格式化日期时间的字符串值,以大大多于。尽管它们确实在字符串上进行词典编分,但比较DateTime值更容易。

=> op:where(
     op:and((
       op:eq(op:col("transMode"), 'Road'),
       op:gt(op:col("Ancillary_QuotePrice"), 0),
       op:lt(op:col('BookingCreateDt'), fn:current-dateTime() - xs:yearMonthDuration("P6M"))
     ))
   )

You can subtract xs:yearMonthDuration("P6M") from the fn:current-dateTime():

fn:current-dateTime() - xs:yearMonthDuration("P6M")

Also, you are currently comparing the string value of the formatted dateTime for greater and less than. While they do sort lexicographically as strings, it's easier to just compare the dateTime values.

=> op:where(
     op:and((
       op:eq(op:col("transMode"), 'Road'),
       op:gt(op:col("Ancillary_QuotePrice"), 0),
       op:lt(op:col('BookingCreateDt'), fn:current-dateTime() - xs:yearMonthDuration("P6M"))
     ))
   )

从当前日期使用光学查询减去6个月的日期

单身狗的梦 2025-02-18 01:43:21

您无法访问使用 const 在其块范围之外声明的变量。尝试以下操作,您将获得 ReferenceError

function foo() {
    const bar = "bar";
}
console.log(bar);

因此,您无法在传递给 this.api.getapi()的回调之外使用 aa subscribe ()

如果您想能够在回调之外使用 aa ,则可以使用使用 Let 来定义 aa 。在代码中:


  onScrollDown(evt:any) {
      
    setTimeout(() => {

        // Add this:
        let aa;
         
        this.api.getApi().subscribe(({tool,beuty}) => {
            // Change this:
            aa=this.beu=beuty.slice(0,this.i+=15);
        })
     
        if (evt.index === 0) {aa}
            
    }, 1000);
   

  }

我希望这会有所帮助。我真的无法确定它是否有效,因为我没有整个脚本。

You can't access a variable declared using const outside its block scope. Try the following and you will get an ReferenceError:

function foo() {
    const bar = "bar";
}
console.log(bar);

So, you can't use aa outside of the callback passed to this.api.getApi().subscribe().

If you want to be able to use aa outside of the callback you can define aa using let. In code:


  onScrollDown(evt:any) {
      
    setTimeout(() => {

        // Add this:
        let aa;
         
        this.api.getApi().subscribe(({tool,beuty}) => {
            // Change this:
            aa=this.beu=beuty.slice(0,this.i+=15);
        })
     
        if (evt.index === 0) {aa}
            
    }, 1000);
   

  }

I hope this helps. I can't really tell if it works because I don't have the whole script.

我在内部创建了一个`const` this.api.getapi()。subscribe(({{tool,beuty})``如何在我的``if`语句)内运行它?

单身狗的梦 2025-02-17 17:02:59

这是对问题的另一种看法,使用.net REGEX 类。

$contents = Get-Content FIX.log

# Tags to search for, separated by RegEx alternation operator
$tagsPattern = '55|270|271'

foreach($line in $contents) {
    # Extract the datetime field
    $dateTime = [regex]::Match( $line, '^\d{8}-\d{2}:\d{2}:\d{2}\.\d{3}' ).Value
    
    # Extract the desired tag values
    $tagValues = [regex]::Matches( $line, "(?<= (?:$tagsPattern)=)[^ ]+" ).Value

    # Output everything
    Write-Host $dateTime $tagValues
}
  • [REGEX] :: match()方法匹配给定模式的第一个实例,并返回一个 match> match 对象,其>值属性包含匹配的值。
  • [REGEX] :: MATDES()方法 able 模式的匹配。它返回匹配对象的集合。 With the aid of PowerShell's convenient
  • Regex101.com上的REGEX模式的说明和演示:

Here is another take on the problem, using the .NET Regex class.

$contents = Get-Content FIX.log

# Tags to search for, separated by RegEx alternation operator
$tagsPattern = '55|270|271'

foreach($line in $contents) {
    # Extract the datetime field
    $dateTime = [regex]::Match( $line, '^\d{8}-\d{2}:\d{2}:\d{2}\.\d{3}' ).Value
    
    # Extract the desired tag values
    $tagValues = [regex]::Matches( $line, "(?<= (?:$tagsPattern)=)[^ ]+" ).Value

    # Output everything
    Write-Host $dateTime $tagValues
}
  • The [regex]::Match() method matches the first instance of the given pattern and returns a single Match object, whose Value property contains the matched value.
  • The [regex]::Matches() method finds all matches of the pattern. It returns a collection of Match objects. With the aid of PowerShell's convenient member access enumeration feature, we directly create an array of all Value properties.
  • Explanation and demos of the RegEx patterns at regex101.com:

解析powershell中的结构化文件(修复4.4)

单身狗的梦 2025-02-16 22:27:10

命名卷本身并不是将文件从一个容器发布到另一个容器的可靠方法。查看这一点的最简单方法是在您的 html 目录中进行一些更改并运行 Docker-Compose build build; docker -compose -d 。在这种情况下,您会看到的是,代码卷的旧内容无需更新而在NGINX容器中使用,实际上该卷的旧内容隐藏在您的应用程序容器中。对于不称为卷的Docker的东西,包括Docker Bind-Mounts和Kubernetes卷,您将获得一个空的目录,其中没有任何复制。

解决此问题的绝对最简单方法是让应用程序提供自己的静态资产。执行此操作的机制是特定于框架的(而且我在PHP方面不太熟悉),但是如果您可以做到这一点,那么您的Nginx配置只有一个 proxy_pass fastcgi_pass 指令,并且没有任何文件可以使用。这消除了对此卷的需求。

如果这不是一个选项,那么您可以为包括静态资产的反向代理创建第二个图像。

FROM nginx:1.17-alpine
COPY ./html/ /usr/share/nginx/html/
# use the CMD from the base image, no need to repeat it

现在,您不是“共享文件” 本身本身,但是应用程序和反向代理都包含相同的静态文件从同一源树中构建的相同的静态文件。这意味着您不需要卷:撰写设置中的,除了做诸如注入配置之类的事情外。 (复制也可能是合理的。)

version: "3.8"
services:
  server:
    build:
      context: .
      dockerfile: Dockerfile.nginx
    ports:
      - "80:80"
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - app
    restart: always

  app:
    build: .
    restart: always

Named volumes, on their own, are not a reliable way to publish files from one container to another. The easiest way to see this is to make some change in your html directory and run docker-compose build; docker-compose up -d. What you'll see in this case is that the old contents of the code volume are used in the Nginx container without updates, and in fact the old contents of the volume hide the updated code in your application container. For things that aren't Docker named volumes, including Docker bind-mounts and Kubernetes volumes, you'll just get an empty directory with nothing copied into it.

The absolute easiest way to address this is to let the application serve its own static assets. The mechanism to do this is framework-specific (and I'm not well-versed in PHP), but if you can do this then your Nginx configuration just has a proxy_pass or fastcgi_pass directive, and it doesn't have any files on its own to serve. That eliminates the need for this volume.

If that's not an option, then you can create a second image for the reverse proxy that includes the static assets.

FROM nginx:1.17-alpine
COPY ./html/ /usr/share/nginx/html/
# use the CMD from the base image, no need to repeat it

Now you're not "sharing files" per se, but the application and the reverse proxy both contain the same static files built from the same source tree. This means you don't need volumes: in the Compose setup, except maybe to do things like inject configuration. (It's likely reasonable to COPY this into the image as well.)

version: "3.8"
services:
  server:
    build:
      context: .
      dockerfile: Dockerfile.nginx
    ports:
      - "80:80"
    volumes:
      - ./nginx.conf:/etc/nginx/conf.d/default.conf
    depends_on:
      - app
    restart: always

  app:
    build: .
    restart: always

运行Nginx和PHP-FPM作为具有共享卷的Docker中的分离容器

单身狗的梦 2025-02-16 21:09:26

您正在使用上下文路径/auth 。这是KeyCloak的默认上下文路径,直到版本16.x。您需要为KeyCloak 17+明确配置上下文路径。配置主机名 +代理传递给 http:// localhost:8080/auth/

doc: https://www.keycloak.org/server/server/server/server/server/all-config

You are using context path /auth. That was default context path for Keycloak until version 16.x. You need to configure context path explicitly for Keycloak 17+. Configure hostname-path + proxy pass to http://localhost:8080/auth/.

Doc: https://www.keycloak.org/server/all-config

用HTTP配置Keyloak 18

单身狗的梦 2025-02-16 12:56:02

您可以尝试以下步骤吗?

  1. capp不了解。
  2. 打开注册表浏览器,然后转到/_ System/Constrance/costority/components/org.wso.wso2.carbon.tasks/definitys/-1234/esb_task/并删除与任务配置相关的配置对于消息处理器,您遇到的问题。
  3. 删除&lt; ei_home中的内容&gt;/tmp目录并重新启动服务器。
  4. 现在再次部署CAPP。

Can you try the following steps?

  1. Undeploy your Capp.
  2. Open Registry Browser and go to /_system/governance/repository/components/org.wso2.carbon.tasks/definitions/-1234/ESB_TASK/ and delete the task configuration related to the Message processor you are having issues with.
  3. Delete the contents in <EI_HOME>/tmp directory and restart the server.
  4. Now deploy the Capp again.

无法激活WSO2 EI中的消息处理器6.6

单身狗的梦 2025-02-16 12:47:22

现代JavaScript环境支持方法。

const flatData = [["a", "b", ["c", "d"]]].flat(2)
console.log(flatData)
// ["a", "b", "c", "d"]

您可以选择将数字传递到 flat()是要平坦的级别数。

Modern javascript enviroments support the flat() method.

const flatData = [["a", "b", ["c", "d"]]].flat(2)
console.log(flatData)
// ["a", "b", "c", "d"]

The number you can optionally pass to flat() is the number of levels to flatten.

如何将带有两组括号的数组转换为只有一组括号?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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