青柠芒果

文章 评论 浏览 27

青柠芒果 2025-02-20 21:53:25

这个问题有点旧了,但是您可以

此链接说您需要有一个有效的NGROK配置文件(带有验证令牌和所有定义的隧道),然后运行以下命令:

ngrok service install --config C:\ngrok\ngrok.yml

并指向保存配置文件的位置。

然后,您可以使用ngrok命令启动,停止,重新启动和卸载服务。

ngrok service start
ngrok service stop
ngrok service restart
ngrok service uninstall

我今天只是这样做了,它运行良好。

希望这会有所帮助。

This question is a bit old, but you can install Ngrok as a Windows service.

This link says you need to have a valid Ngrok config file (with your auth token and all your tunnels defined) and then run the following command:

ngrok service install --config C:\ngrok\ngrok.yml

and point to where you've saved your config file.

Then you can use Ngrok commands to start, stop, restart, and uninstall your service.

ngrok service start
ngrok service stop
ngrok service restart
ngrok service uninstall

I just did this today and it is working pretty well.

Hope this helps.

在后台运行NGrok

青柠芒果 2025-02-20 15:33:02
library(data.table)
df <- data.frame(
          ID = c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L),
          year = c(2000L,2001L,2002L,2003L,2004L,
                   2000L,2001L,2002L,2003L,2004L),
       level = c(NA, 3L, 3L, 2L, 1L, 1L, 1L, 1L, 1L, 1L)
  )

setDT(df)[!is.na(level), level := cummin(level), by = ID][]
#>     ID year level
#>  1:  1 2000    NA
#>  2:  1 2001     3
#>  3:  1 2002     3
#>  4:  1 2003     2
#>  5:  1 2004     1
#>  6:  2 2000     1
#>  7:  2 2001     1
#>  8:  2 2002     1
#>  9:  2 2003     1
#> 10:  2 2004     1

library(data.table)
df <- data.frame(
          ID = c(1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L),
          year = c(2000L,2001L,2002L,2003L,2004L,
                   2000L,2001L,2002L,2003L,2004L),
       level = c(NA, 3L, 3L, 2L, 1L, 1L, 1L, 1L, 1L, 1L)
  )

setDT(df)[!is.na(level), level := cummin(level), by = ID][]
#>     ID year level
#>  1:  1 2000    NA
#>  2:  1 2001     3
#>  3:  1 2002     3
#>  4:  1 2003     2
#>  5:  1 2004     1
#>  6:  2 2000     1
#>  7:  2 2001     1
#>  8:  2 2002     1
#>  9:  2 2003     1
#> 10:  2 2004     1

Created on 2022-07-06 by the reprex package (v2.0.1)

通过与上面的单元进行比较来更改单元格值

青柠芒果 2025-02-20 09:43:23

您将如何将监视器合并到方案定义中?

How will you be incorporating the monitors in the scenario definition?

使用Jmeter中的Ultimate线程组重新创建负载跑步者方案

青柠芒果 2025-02-20 08:27:58

我不知道您的群体Joine目的是什么?我没有实体,从我可以重写的示例中:

var products = customerProductPrices.Select(pp => new ProductFilterResultModel
{
    Id = pp.Product.Id,
    Price = pp != null ? pp.Price : 0
})

I don't know what is your GroupJoin purpose? I don't have entities, from the example I can rewrite:

var products = customerProductPrices.Select(pp => new ProductFilterResultModel
{
    Id = pp.Product.Id,
    Price = pp != null ? pp.Price : 0
})

linq left Join无效对象必须具有一个值错误

青柠芒果 2025-02-20 04:34:29

不确定是否有其他原因使用上下文将此数据获取到API消费者中,但是使用NextJ, getStaticProps getserversideprops 当然要馈入路由组件,但是也许您错过了以下细节?

组件道具是活动页面,因此,每当您在路由之间导航时,组件都会更改为新页面。 因此,您发送给组件的任何道具将由页面

收到

pageProps 是一个对象,其初始道具通过我们的数据获取方法预先加载了您的页面,否则是一个空的对象。

https://nextjs.org/docs/advanced-fanced-features/custom-custom-app

因此, _app.tsx 可以在您的路由组件中采取任何行动,通常会从 getStaticProps getServersideProps

types.ts


// or whatever union type you need to indicate that myriad of "custom datas" you might be pushing out of getStaticProps
export type MaybeCustomDataFromGetStaticProps = Map<string, string> | undefined;

export type PagePropsWithCustomData = {
  customData: MaybeCustomDataFromGetStaticProps
  isSSR?: boolean;
}

pages/_app.tsx

import type { PagePropsWithCustomData } from '../types';

const App = ({
  Component,
  pageProps: { customData, isSSR, ...pageProps},
  router,
}: AppProps<PagePropsWithCustomData & Record<string, unknown>>) => {

  return (
    <ContextProvider value={{ isSSR, customData }}>
      <ContextApiConsumingComponent />
      <Component {...pageProps} />
    </ContextProvider>
  )

}

pages/somepage.tsx

import type { NextPage, GetServerSideProps } from "next";
import type { PagePropsWithCustomData } from '../types';
import { magicallyGetCustomData } from '../services/Api';
import { isSSR } from '../core/Routing';

type IndexRouteProps = PagePropsWithCustomData & {
  isSSR?: boolean;
}

const IndexRoute:NextPage<IndexRouteProps> = ({ customData, isSSR }) => {

  // no longer need to do anything with customData, or isSSR here

  return (
    <div>stuff</div>
  );
}

export const getServerSideProps:GetServerSideProps<IndexRouteProps> = async (context) => {
  const customData = await magicallyGetCustomData();
  
  return {
      props: { customData , isSSR: isSSR(context) }
  };
};

export default IndexRoute

Not sure if you have other reasons for using the context to get this data into the api consumer but with nextjs, the getStaticProps or getServerSideProps of course feeds into the route component, but maybe you've missed the following detail?

The Component prop is the active page, so whenever you navigate between routes, Component will change to the new page. Therefore, any props you send to Component will be received by the page.

pageProps is an object with the initial props that were preloaded for your page by one of our data fetching methods, otherwise it's an empty object.

https://nextjs.org/docs/advanced-features/custom-app

Therefore the _app.tsx can act on any props your route components would normally receive from getStaticProps or getServerSideProps

types.ts


// or whatever union type you need to indicate that myriad of "custom datas" you might be pushing out of getStaticProps
export type MaybeCustomDataFromGetStaticProps = Map<string, string> | undefined;

export type PagePropsWithCustomData = {
  customData: MaybeCustomDataFromGetStaticProps
  isSSR?: boolean;
}

pages/_app.tsx

import type { PagePropsWithCustomData } from '../types';

const App = ({
  Component,
  pageProps: { customData, isSSR, ...pageProps},
  router,
}: AppProps<PagePropsWithCustomData & Record<string, unknown>>) => {

  return (
    <ContextProvider value={{ isSSR, customData }}>
      <ContextApiConsumingComponent />
      <Component {...pageProps} />
    </ContextProvider>
  )

}

pages/somepage.tsx

import type { NextPage, GetServerSideProps } from "next";
import type { PagePropsWithCustomData } from '../types';
import { magicallyGetCustomData } from '../services/Api';
import { isSSR } from '../core/Routing';

type IndexRouteProps = PagePropsWithCustomData & {
  isSSR?: boolean;
}

const IndexRoute:NextPage<IndexRouteProps> = ({ customData, isSSR }) => {

  // no longer need to do anything with customData, or isSSR here

  return (
    <div>stuff</div>
  );
}

export const getServerSideProps:GetServerSideProps<IndexRouteProps> = async (context) => {
  const customData = await magicallyGetCustomData();
  
  return {
      props: { customData , isSSR: isSSR(context) }
  };
};

export default IndexRoute

next.js&#x2B; SSR不更新上下文API

青柠芒果 2025-02-20 03:28:50

我不太确定您想做什么,但是根据我所理解的内容,这是一个解决方案:

从我看到的数据框架中,您的数据框架有多个列,您希望将其分组为一列,并将其分组为具有最高值的值最低,因此我将创建一个与以下特征几乎相同的数据框架:

import pandas as pd
import numpy as np

cols = 3
rows = 4
np.random.seed(0)
df = pd.DataFrame(np.random.randint(0, 1000, (rows, cols)), columns= ["A","B","C"])

print(df)

     A    B    C
0  684  559  629
1  192  835  763
2  707  359    9
3  723  277  754

现在,我将单行中的所有列对它们进行分组,并以这样的降序组织它们:

data = df.to_numpy().flatten() 
data = pd.DataFrame(data)
data.sort_values(by=[0],ascending=False)

因此,我们将获得1倍矩阵,其中值在降序:

    0
4   835
5   763
11  754
9   723
6   707
0   684
2   629
1   559
7   359
10  277
3   192
8   9

注意:此代码片段应适用于您的脚本;我没有这样做,因为我不知道您的数据集,最后我的英语对任何语法错误都不是很抱歉

I'm not so sure what you want to do but here is a solution according to what I understood:

From what I see you have a dataframe with several columns and you would like it to be grouped in a single column with the values ​​from highest to lowest, so I will create a dataframe with almost the same characteristics as follows:

import pandas as pd
import numpy as np

cols = 3
rows = 4
np.random.seed(0)
df = pd.DataFrame(np.random.randint(0, 1000, (rows, cols)), columns= ["A","B","C"])

print(df)

     A    B    C
0  684  559  629
1  192  835  763
2  707  359    9
3  723  277  754

Now I will group all the columns in a single row and organize them in descending order like this:

data = df.to_numpy().flatten() 
data = pd.DataFrame(data)
data.sort_values(by=[0],ascending=False)

So as a result we will obtain a 1xn matrix where the values ​​are in descending order:

    0
4   835
5   763
11  754
9   723
6   707
0   684
2   629
1   559
7   359
10  277
3   192
8   9

Note: This code fragment should be adapted to your script; I didn't do it because I don't know your dataset and lastly my English is not that good sorry for any grammatical errors

在数据框中按行分类值

青柠芒果 2025-02-19 21:20:11

检查柏树测试​​,并具有一些轻微的文件夹路径和不同的baseurl的mod。

由于赛普拉斯V10不再具有“运行所有”选项,因此我还添加了一个称为 all.cy.js 的枪管规格,该规格允许运行多个规格,并且 也可以执行规格的顺序(这对此很重要)。

该测试在 cypress Open 中均可正常工作,然后选择 all.cy.js ,以及 cypress run-spec cypress/e2e/e2e/all.cy.js

all.cy.js

import './site.cy.js'
import './another.cy.js'

site.cy.js

let dataStore = require("../support/dataStore");
import "cypress-localstorage-commands";

describe('Verify the Global data saving', () => {

  context('Global data', () => {
    beforeEach(() => {
      cy.restoreLocalStorage();
      cy.visit('http://example.com')
    });

   
    it('First get the text and Save globally', () => {
 
      // cy.get('#companyNameDiv > span').invoke('text').then((text)=>{
        const text = 'this is my text'
        dataStore.globaldata = text;
        console.log("First test outcome:: " +dataStore.globaldata); // all good here
      // });
    });

    it('Use that text in second test', () => {
      console.log("Yeh, global text in second test :: " +dataStore.globaldata );  // all good here
    });
  });
});

entere.cy.js

let dataStore = require("../support/dataStore");
import "cypress-localstorage-commands";

describe('Retrive another test file', () => {
  context('Retrive saved data in another test file', () => {

    it('Get the text', () => {
      console.log("Yeh, another test file:: " +dataStore.globaldata); 

      expect(dataStore.globaldata).to.eq('this is my text')   // ✅ passes
    });
  });
});

Checking out the Cypress tests, with some slight mods for folder paths and different baseUrl.

Since Cypress v10 no longer has "Run all" option I also added a barrel spec called all.cy.js which allows running multiple specs and also enforces the order of the spec (which would be important for this to work).

The test worked ok in cypress open then selecting all.cy.js and also cypress run --spec cypress/e2e/all.cy.js.

all.cy.js

import './site.cy.js'
import './another.cy.js'

site.cy.js

let dataStore = require("../support/dataStore");
import "cypress-localstorage-commands";

describe('Verify the Global data saving', () => {

  context('Global data', () => {
    beforeEach(() => {
      cy.restoreLocalStorage();
      cy.visit('http://example.com')
    });

   
    it('First get the text and Save globally', () => {
 
      // cy.get('#companyNameDiv > span').invoke('text').then((text)=>{
        const text = 'this is my text'
        dataStore.globaldata = text;
        console.log("First test outcome:: " +dataStore.globaldata); // all good here
      // });
    });

    it('Use that text in second test', () => {
      console.log("Yeh, global text in second test :: " +dataStore.globaldata );  // all good here
    });
  });
});

another.cy.js

let dataStore = require("../support/dataStore");
import "cypress-localstorage-commands";

describe('Retrive another test file', () => {
  context('Retrive saved data in another test file', () => {

    it('Get the text', () => {
      console.log("Yeh, another test file:: " +dataStore.globaldata); 

      expect(dataStore.globaldata).to.eq('this is my text')   // ✅ passes
    });
  });
});

在检索dataStore.js对象时,js文件中抛出了未定义

青柠芒果 2025-02-19 19:32:27

经过帖子之后,人们也遇到了这个问题,我查看了学科支持的答案,他们都说访问这些文档,我以前曾多次看过这些文档。但是,这一次我向下滚动并找到了一个“缩写”,因为他们称其为uid:

< img src =“ https://i.sstatic.net/grolm.png” alt =“ Schoology api docs”>

所以而不是尝试使用用户/ME 端点您只需使用端点:/app-user-info ,它返回带有时间戳和uid的JSON!

获得UID后,您可以通过使用UID替换我的 uders/me 端点来自由:用户/{uid}

url:
https://api.schoology.com/v1/app-user-info

两腿授权标头:

OAuth realm="Schoology API",
oauth_consumer_key="{CONSUMER_KEY}",
oauth_signature_method="PLAINTEXT",
oauth_timestamp="{TIMESTAMP}",
oauth_token="",
oauth_nonce="{RANDOM_CHARS}",
oauth_version="1.0",
oauth_signature="{CONSUMER_SECRET}%26"

After going through post after post of people also having this problem I looked at the answers from Schoology support and they all said visit the docs, which I have looked over multiple times before. however this time I scrolled down and found a "short-cut" as they called it to get the UID:

Schoology API Docs

So instead of trying to use the users/me endpoint you simply use the endpoint: /app-user-info which returns a JSON with timestamp and UID!

After you get the UID you can freely access the users/me endpoint by replacing me with the UID like so: users/{UID}

URL:
https://api.schoology.com/v1/app-user-info

two-legged Authorization header:

OAuth realm="Schoology API",
oauth_consumer_key="{CONSUMER_KEY}",
oauth_signature_method="PLAINTEXT",
oauth_timestamp="{TIMESTAMP}",
oauth_token="",
oauth_nonce="{RANDOM_CHARS}",
oauth_version="1.0",
oauth_signature="{CONSUMER_SECRET}%26"

Schoology API:“用户/ME”重复的nonce错误

青柠芒果 2025-02-19 12:36:54

最后,我自己修改了以下几乎没有修改,我自己解决了问题。

初始化 formControlname 喜欢 myDivName:this.fb.Array([]),

 get myDivName() {
    return <FormArray>this.myTestForm.get('myDivName');
  }

ins drop> drop()方法>分配并传递formValue

const formArry = this.myDivName;
formArry.insert(0,this.fb.control(event.container.data));

工作演示

注意:我不确定修复的效率有多高,但会尽可能地优化它

Finally, I fixed my issue by myself, by doing little modification like below.

initialize formControlName like myDivName: this.fb.array([]),

 get myDivName() {
    return <FormArray>this.myTestForm.get('myDivName');
  }

inside drop() method assign and pass formValue

const formArry = this.myDivName;
formArry.insert(0,this.fb.control(event.container.data));

working demo

Note: I'm not sure how efficient the fix is, but will optimize it as much as can.

Thanks to all who atleast view my question

反应性形式的工作很奇怪,呈斜滴cdk-重复的项目

青柠芒果 2025-02-19 05:59:19

您可以尝试将其转换为字符串,然后使用Regexp提取所需的小数

function truncDigits(inputNumber: number, digits: number) {
 const match = inputNumber.toString().match(new RegExp(`^\\d+\\.[\\d]{0,${digits}}`))

 if (!match) {
   return inputNumber
 }

 return parseFloat(match[0])
}

:我使用的是 Regexp ctor的字符串版本,因为字面意义不允许动态参数。

You can try to convert to a string and then use a RegExp to extract the required decimals

function truncDigits(inputNumber: number, digits: number) {
 const match = inputNumber.toString().match(new RegExp(`^\\d+\\.[\\d]{0,${digits}}`))

 if (!match) {
   return inputNumber
 }

 return parseFloat(match[0])
}

Note: I'm using the string version of the RegExp ctor as the literal one doesn't allow for dynamic params.

截断一个数字

青柠芒果 2025-02-19 02:06:50

如果要在&gt; 元素中选择&lt; svg&gt; 之前,请尝试以下XPath:

//*[@data-component-id="nokia-react-components-iconbutton" and following-sibling::svg[1][contains(@class,"HelpOutline")]]

If you want to select the <button> element before the <svg>, try the following XPath:

//*[@data-component-id="nokia-react-components-iconbutton" and following-sibling::svg[1][contains(@class,"HelpOutline")]]

如何使用硒来定位按钮元素?

青柠芒果 2025-02-18 10:13:59

在使用可观察到时,您需要了解,您不能依靠 async/等待来考虑完成测试。因此,您可以使用完成参数为您处理。

在您的示例中,您需要在 get 函数的模拟实现中返回可观察的,并且在该可观察到的中,您应该丢下错误。

While working with Observables you need to understand that you can't rely on async/await to consider your test done. So, you can use the done parameter to handle that for you.

In your example, you will need to return an Observable within the mock implementation of the get function and, within that Observable you should throw an error.

如何在可观察的情况下测试例外?

青柠芒果 2025-02-18 06:06:31

您可以在查询中应用多种方式。

VesselProductDetails::where('vessel_code',$vessel_code)
->orderBy('vessel_code', 'asc')
->orderBy('type', 'asc')
->get();

希望这对您有用。

You can apply multiple sorts in your query.

VesselProductDetails::where('vessel_code',$vessel_code)
->orderBy('vessel_code', 'asc')
->orderBy('type', 'asc')
->get();

Hope this will work for you.

Laravel查询排序字段均匀而奇怪

青柠芒果 2025-02-18 03:37:59

您应该使用 textContent 而不是 innertext

这是我的解决方案:

const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
const jsdom = require('jsdom');
const { JSDOM } = jsdom;

class Appartment {
    price
    title
    description
    location
}

let multipleDivs = []
const appartments = []

function trim(text){
    return text.replace(/(\r\n|\n|\r)/gm, "").trim()
}


async function fetchKijijiAppartments() {
    const url = `https://www.kijiji.ca/b-ville-de-montreal/appartement-4-1-2/k0l1700281?rb=true&dc=true`
    try {
        const kijijiRes = await fetch(url);
        if (!kijijiRes.ok) {
            throw new Error(
                `HTTP error: ${kijijiRes.status}`
            )
        }

        const response = await kijijiRes.text()
       // console.log("DB: ", response)
        const dom = new JSDOM(response)
        multipleDivs = dom.window.document.querySelectorAll(".info-container")
        //console.log("DB: " multipleDivs)
        return multipleDivs
    } catch (error) {
        console.log("Error Made")
        console.log(error)
    }
}


async function scrapeAppartments() {

    await fetchKijijiAppartments()
        .then(data => {
            data.forEach(div => {
                const appartement = new Appartment
                appartement.price = trim(div.querySelector(".price").textContent)
                appartement.title = trim(div.querySelector(".title").textContent)
                appartement.description = trim(div.querySelector(".description").textContent)
                console.log("DB: ", appartement)
                appartments.push(appartement)
            })
        })

}

scrapeAppartments()

You should use textContent instead of innerText.

Here's my solution:

const fetch = (...args) => import('node-fetch').then(({default: fetch}) => fetch(...args));
const jsdom = require('jsdom');
const { JSDOM } = jsdom;

class Appartment {
    price
    title
    description
    location
}

let multipleDivs = []
const appartments = []

function trim(text){
    return text.replace(/(\r\n|\n|\r)/gm, "").trim()
}


async function fetchKijijiAppartments() {
    const url = `https://www.kijiji.ca/b-ville-de-montreal/appartement-4-1-2/k0l1700281?rb=true&dc=true`
    try {
        const kijijiRes = await fetch(url);
        if (!kijijiRes.ok) {
            throw new Error(
                `HTTP error: ${kijijiRes.status}`
            )
        }

        const response = await kijijiRes.text()
       // console.log("DB: ", response)
        const dom = new JSDOM(response)
        multipleDivs = dom.window.document.querySelectorAll(".info-container")
        //console.log("DB: " multipleDivs)
        return multipleDivs
    } catch (error) {
        console.log("Error Made")
        console.log(error)
    }
}


async function scrapeAppartments() {

    await fetchKijijiAppartments()
        .then(data => {
            data.forEach(div => {
                const appartement = new Appartment
                appartement.price = trim(div.querySelector(".price").textContent)
                appartement.title = trim(div.querySelector(".title").textContent)
                appartement.description = trim(div.querySelector(".description").textContent)
                console.log("DB: ", appartement)
                appartments.push(appartement)
            })
        })

}

scrapeAppartments()

尽管在控制台上返回时,当从承诺中返回时,innertext值是不确定的

青柠芒果 2025-02-17 06:48:09

您可以通过一定程度的间接解决这个问题。

只要只有一位作者,您就可以这样做:

  • 将一组数据项放在结构中,
  • 分配几个这样的结构
  • 在非原子上写入读者没有使用原子上的读者
  • 将指针更改为读者应使用读取器的结构

应读取指针,然后访问各个结构中的数据。

如果可能在主要上下文仍在阅读时发生另一个中断,那么您需要将指针保留到读取器所使用的struct的指针,而作者可以在填写结构之前对此进行检查。如果只有一位读者,那么在原子上访问第二个指针会更容易。

为了使事情变得平滑,您可以分配三个或更多的结构,并将它们视为环缓冲区。

You can solve this problem with a level of indirection.

As long as there is only one writer, you could do it like this:

  • Put the set of data items in a struct
  • Allocate several such structs
  • Write non-atomically to the members of a struct which the readers are not using
  • Atomically change a pointer to which struct the reader should use

The reader should read the pointer then access the data in the respective struct.

If it is possible that another interrupt occurs while the main context is still reading then you need to keep a pointer to which struct the reader is using, and the writer can check this before filling out the struct. Accessing this second pointer atomically is easier if there is only one reader.

To smooth things out you can allocate three or more structs, and treat them as a ring buffer.

如何在C中一次原子读取多个变量?

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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