夢归不見

文章 评论 浏览 30

夢归不見 2025-02-21 00:27:32

您可以做到这一点:

val configuration = LocalConfiguration.current
val expanded = configuration.screenWidthDp > 840

这对应于景观中97.22%的平板电脑。对于与电话或平板电脑相对应的尺寸,有更多信息

You can do this:

val configuration = LocalConfiguration.current
val expanded = configuration.screenWidthDp > 840

This corresponds to 97.22% of tablets in landscape. For sizes corresponding to phones or tablets there is more info here.

如何知道在Android中的平板电脑或电话

夢归不見 2025-02-20 23:28:18

您应该使用分页来获取和展示产品。

You should use pagination to fetch and display products.

将MongoDB数据传输到客户端

夢归不見 2025-02-20 20:32:32
const input = '[ { "name": "DI", "children": [ { "name": "t", "children": [ { "name": "tID", "ir": true, "is": false }, { "name": "tTime", "ir": false, "is": false } ], "ir": false, "is": false }, { "name": "i", "idx": 0, "children": [ { "name": "idu", "ir": false, "is": false }, { "name": "il", "ir": false, "is": false }, { "name": "ibId", "children": [ { "name": "ib1", "ir": false, "is": false }, { "name": "ib2", "ir": false, "is": false } ], "ir": false, "is": false } ], "ir": false, "is": false } ] } ]'

// console.log(JSON.parse(input))

const convertToObject = (data) => {
  const { name, children, ...others } = data
  if(!children) return others;
  
 
  return children.reduce((acc, d) => {
    acc[d['name']] = convertToObject(d);
    return acc;
  }, {})
 
}

console.log(convertToObject({ 'children': JSON.parse(input) }))

const input = '[ { "name": "DI", "children": [ { "name": "t", "children": [ { "name": "tID", "ir": true, "is": false }, { "name": "tTime", "ir": false, "is": false } ], "ir": false, "is": false }, { "name": "i", "idx": 0, "children": [ { "name": "idu", "ir": false, "is": false }, { "name": "il", "ir": false, "is": false }, { "name": "ibId", "children": [ { "name": "ib1", "ir": false, "is": false }, { "name": "ib2", "ir": false, "is": false } ], "ir": false, "is": false } ], "ir": false, "is": false } ] } ]'

// console.log(JSON.parse(input))

const convertToObject = (data) => {
  const { name, children, ...others } = data
  if(!children) return others;
  
 
  return children.reduce((acc, d) => {
    acc[d['name']] = convertToObject(d);
    return acc;
  }, {})
 
}

console.log(convertToObject({ 'children': JSON.parse(input) }))

如何将树json转换为JS中的嵌套对象

夢归不見 2025-02-20 19:39:14

如果您刚刚安装了 miniconda> miniconda 或Anaconda或Anaconda确保您重新运行端子。

由此,我的意思是关闭并打开您的终端,然后尝试 conda列表验证您的安装。

对我来说,这有效!

If you have just installed Miniconda or Anaconda make sure you rerun your terminal.

From this, I mean close and open your terminal and then try conda list to verify your installation.

For me, this worked!!

我该如何运行康达?

夢归不見 2025-02-20 12:06:09

您应该只是在每行的开头而不是末端打印线路断裂。这样,您也无需考虑最后一行!
您还可以摆脱索引的增加。

for el in applicants:  # write the name of the worker to the text file
    if index == 0:  # this is the first line no need for a line break
        file.write(el)
        # increment the index for later iterations
        index += 1
    else:  # these are the middle lines and it is essential to break a line
        file.write("\n"+el)

you should simply print your line break at the start of each line instead of the end. That way you do not need to account for the last line too !
You also can get rid of the incrementing of the index.

for el in applicants:  # write the name of the worker to the text file
    if index == 0:  # this is the first line no need for a line break
        file.write(el)
        # increment the index for later iterations
        index += 1
    else:  # these are the middle lines and it is essential to break a line
        file.write("\n"+el)

如何在文本文件中按行打印数组的内容?

夢归不見 2025-02-20 02:12:22

尝试以下操作:

div_containing_radio = driver.find_element(by=By.XPATH,"//div[starts-with(@class, 'ProductVariants__PriceContainer-sc-1unev4j-9 jjiIua')]/following-sibling::text()")

Try these:

div_containing_radio = driver.find_element(by=By.XPATH,"//div[starts-with(@class, 'ProductVariants__PriceContainer-sc-1unev4j-9 jjiIua')]/following-sibling::text()")

硒:在其中嵌套的标签内获取文本

夢归不見 2025-02-19 21:12:50

您可以使用Google的“ Cloud Vision API(用于图像): https://cloud.google.com/vision “ 和“视频智能API(用于视频): https://cloud.google.com/video-intelligence/docs/docs“
视频智能API也可以从字节流处理图像。
构建一个Firebase功能,分析使用这些API发布媒体。
从这里构建其余逻辑。找到一种方法来检测他们的兴趣,节省他们的兴趣。

You could use Google's "cloud vision api(For Images): https://cloud.google.com/vision" and "Video Intelligent Api(For videos): https://cloud.google.com/video-intelligence/docs".
Video Intelligence Api could handle images too from byte stream.
Build a firebase function that analyse posted media with these api.
Build the rest of the logic from here. Find a way to detect their interest from post, save their interests.

Firebase-机器学习和兴趣跟踪,以创建用于分类帖子的算法

夢归不見 2025-02-19 20:42:26

问题在您的循环中。更具体地说,您需要在使用它之前声明变量i。如果您像以下片段一样更改代码,则您的代码正常工作:

let nums = [2, 1, 3, 4, 5, 6];

function sortArray(nums) {
  let arr = new Array();
  let smallest_index;
  for (let i = 0; i < nums.length; i++) {
    smallest_index = find_smallest(nums);
    arr.push("5");
  }

  return arr;
}

function find_smallest(arr) {
  let smallest = arr[0];
  let smallest_index = 0;

  for (let i = 1; i < arr.length; i++) {
    if (arr[i] < smallest) {
      console.log("this");
      smallest = arr[i];
      smallest_index = i;
    }
  }
  return smallest_index;
}

console.log(sortArray(nums));

唯一的区别是

for (let i = 1; ...

使用

for (i = 1; ...

The problem is within your for loops. More specifically, you need to declare the variable i before using it. If you alter your code like the below snippet, then your code works just as expected:

let nums = [2, 1, 3, 4, 5, 6];

function sortArray(nums) {
  let arr = new Array();
  let smallest_index;
  for (let i = 0; i < nums.length; i++) {
    smallest_index = find_smallest(nums);
    arr.push("5");
  }

  return arr;
}

function find_smallest(arr) {
  let smallest = arr[0];
  let smallest_index = 0;

  for (let i = 1; i < arr.length; i++) {
    if (arr[i] < smallest) {
      console.log("this");
      smallest = arr[i];
      smallest_index = i;
    }
  }
  return smallest_index;
}

console.log(sortArray(nums));

The only difference is using

for (let i = 1; ...

instead of

for (i = 1; ...

对于在另一个函数中调用的函数中的循环,用于循环JavaScript

夢归不見 2025-02-19 14:32:04

您可以在循环中建立复杂的 q 对象 - 使用 q_obj | = q(...) with或

selections = ['Who', 'What']
or_expr = Q()
for selection in selections:
    or_expr |= Q(question__startswith=selection)
MyModel.objects.filter(or_expr)

You can build up a complex Q object in a loop - use q_obj |= Q(...) to add another Q with OR

selections = ['Who', 'What']
or_expr = Q()
for selection in selections:
    or_expr |= Q(question__startswith=selection)
MyModel.objects.filter(or_expr)

如何将列表转换为多个Q对象?

夢归不見 2025-02-19 04:40:43

尝试使用PostgreSql /a>函数:

SELECT d.referenca,
       paketi.id_upnik,
       DATE(zadnji_klic)                   AS zadnji_klic,
       DATE(datum_zadnjega_posiljanja_sms) AS datum_zadnjega_posiljanja_sms,
       DATE(zadnji_datum_opomina_maila)    AS zadnji_datum_opomina_maila,
       DATE(datum_dopisa_dolznika)         AS datum_dopisa_dolznika,
       GREATEST(zadnji_klic, 
                datum_zadnjega_posiljanja_sms, 
                zadnji_datum_opomina_maila, 
                datum_dopisa_dolznika)     AS datum_zadnji_kontakt
FROM QUERIES AND SUBQUERIES

Try using PostgreSQL GREATEST function:

SELECT d.referenca,
       paketi.id_upnik,
       DATE(zadnji_klic)                   AS zadnji_klic,
       DATE(datum_zadnjega_posiljanja_sms) AS datum_zadnjega_posiljanja_sms,
       DATE(zadnji_datum_opomina_maila)    AS zadnji_datum_opomina_maila,
       DATE(datum_dopisa_dolznika)         AS datum_dopisa_dolznika,
       GREATEST(zadnji_klic, 
                datum_zadnjega_posiljanja_sms, 
                zadnji_datum_opomina_maila, 
                datum_dopisa_dolznika)     AS datum_zadnji_kontakt
FROM QUERIES AND SUBQUERIES

情况无法正常工作时 - Postgres

夢归不見 2025-02-19 00:50:19

现在,原始田地具有“有”用于检查其存在的方法
C ++。

这与包括非实验proto3可选支持的相同版本是

默认情况下启用了proto3的可选字段,不再需要
-experimention_allow_proto3_optional标志。

在该版本之前,一个人可以使用生成的 _case ()函数检测设置了哪个单字段。

The has accessors in C++ for oneof fields were added in 3.15:

Now Proto3 Oneof fields have "has" methods for checking their presence in
C++.

This is coincidentally the same version that includes non-experimental proto3 optional support:

Optional fields for proto3 are enabled by default, and no longer require
the --experimental_allow_proto3_optional flag.

Prior to that version, one can use the generated _case() function to detect which oneof field is set.

Protobuf版本的std :: String在Oneof中生成的代码差异

夢归不見 2025-02-18 23:15:17

您可以在开始时使用 get_lock

添加查询 do get_lock('lockname',30)在开始时, do resable_lock('lockname')之后询问。

因此,当用户1启动查询时,将设置锁定 lockname ,并且仅在完成后将其释放,如果用户2启动脚本 do get_lock('lockname',30)等待继续释放的锁。

You can use GET_LOCK

add the query DO GET_LOCK('lockname', 30) at the start and DO RELEASE_LOCK('lockname') after the query.

So when User 1 starts the query it sets the lock lockname and only releases it when finished, If User 2 starts the script DO GET_LOCK('lockname', 30) waits for the lock to be released before continuing.

Mariadb做选择等待其他交易完成

夢归不見 2025-02-18 19:29:40

它以@dawg描述的方式工作,因此我将其标记为解决方案。

@biffen的建议也在工作
通过bash中的文件内容循环

代码根据他的回答:

get_name () {
    name=$(awk -F ";" '{print $2 }' list.csv | sed 's/"//g')
    while read p; do
        echo "Hello" $p
    done < $name
}

get_name

It works that way @dawg described, so I mark this as solution.

The suggestion from @Biffen is also working
Looping through the content of a file in Bash

Code based on his answer:

get_name () {
    name=$(awk -F ";" '{print $2 }' list.csv | sed 's/"//g')
    while read p; do
        echo "Hello" $p
    done < $name
}

get_name

尴尬,sed,用于bash:打印“你好” &#x2B;姓名

夢归不見 2025-02-18 08:13:31

要并行运行API调用并等待所有这些调用,您需要将代码更改为遵循

if (isCall2 && responses) { 
     await Promise.all(responses.map(async ({ code }, index) => {          
        await getAxiosService().post("http://sample2.com", {
            code,
        });
     }));
}

完整代码:

export const createAllProducts =
  ({ data = null, isCall2 = false }) =>
   async (dispatch) => {
    try {
      dispatch({
        type: constants.CREATE_ALL_PRODUCTS_REQUEST,
      });

      const requests = data.map(({ test, name }) => {
        return getAxiosService().post("http://sample.com", {
          test,
          name,
        });
      });

      const responses = await Promise.all(requests);

      if (isCall2 && responses) { 
        await Promise.all(responses.map(async ({ code }, index) =>{          
          await getAxiosService().post("http://sample2.com", {
            code,
          });
        }));
    }
      
    dispatch({
        type: constants.CREATE_ALL_PRODUCTS_SUCCESS,
      });
    } catch (error) {
      dispatch({
        type: constants.CREATE_ALL_PRODUCTS_FAILURE,
      });
    }
  };

To run the API calls in parallel and wait for all those to complete, you need change the code to following

if (isCall2 && responses) { 
     await Promise.all(responses.map(async ({ code }, index) => {          
        await getAxiosService().post("http://sample2.com", {
            code,
        });
     }));
}

Full code:

export const createAllProducts =
  ({ data = null, isCall2 = false }) =>
   async (dispatch) => {
    try {
      dispatch({
        type: constants.CREATE_ALL_PRODUCTS_REQUEST,
      });

      const requests = data.map(({ test, name }) => {
        return getAxiosService().post("http://sample.com", {
          test,
          name,
        });
      });

      const responses = await Promise.all(requests);

      if (isCall2 && responses) { 
        await Promise.all(responses.map(async ({ code }, index) =>{          
          await getAxiosService().post("http://sample2.com", {
            code,
          });
        }));
    }
      
    dispatch({
        type: constants.CREATE_ALL_PRODUCTS_SUCCESS,
      });
    } catch (error) {
      dispatch({
        type: constants.CREATE_ALL_PRODUCTS_FAILURE,
      });
    }
  };

多个API在React中的Axios中接一个呼叫

夢归不見 2025-02-18 06:25:24

发布前选项请求并不是您的浏览器。
检查此 angular $ http是发送选项,而不是put/post/post < /a>

结论,您必须在Spring引导中修复CORS策略,以及Spring Boot如何处理SecurityConfiguration中的选项请求。您可以在问题中添加代码的这一部分吗?

That's not angular that post a preflight OPTIONS request, it's your browser.
Check this Angular $http is sending OPTIONS instead of PUT/POST

Conclusion you have to fix the CORS policy in the spring boot and how the spring boot handle the options request in your SecurityConfiguration. Can you please add this part of the code in your question.

Angular后呼叫称为Springboot的选项

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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