愛放△進行李

文章 评论 浏览 29

愛放△進行李 2025-02-20 21:37:10

如果您更改 app.js 如下

const express = require('express')
const app = express()

const port = process.env.PORT || 3001;

app.get('/api/test', function(req, res){
    return res.status(200).send('First Server');
})

app.get('/nodetest/api/test', function(req, res){
    return res.status(200).send('as an IIS application');
})

app.listen(port, () =>{
    console.log(`Server is listening to ${port}.....`);
})

If you change your app.js as below, then it should work

const express = require('express')
const app = express()

const port = process.env.PORT || 3001;

app.get('/api/test', function(req, res){
    return res.status(200).send('First Server');
})

app.get('/nodetest/api/test', function(req, res){
    return res.status(200).send('as an IIS application');
})

app.listen(port, () =>{
    console.log(`Server is listening to ${port}.....`);
})

带有httpplatformhandler的IIS节点Express JS

愛放△進行李 2025-02-20 19:10:27
    #include<stdio.h>  
  
#define N 5  
  
int main()  
{  
    int a[N], i, temp, pos, dir;  
  
    printf("Enter %d integer numbers\n", N);  
    for(i = 0; i < N; i++)  
        scanf("%d", &a[i]);  
  
    printf("Enter the number of positions to shift\n");  
    scanf("%d", &pos);  
  
    printf("Enter the direction of shifting ...\n");  
    printf("LEFT: 1 and RIGHT: 0\n");  
    scanf("%d", &dir);  
  
    while(pos)  
    {  
        if(dir)  
        {  
            temp = a[0];  
            for(i = 0; i < N - 1; i++)  
                a[i] = a[i + 1];  
  
            a[N - 1] = temp;  
        }  
        else  
        {  
            temp = a[N - 1];  
            for(i = N - 1; i > 0; i--)  
                a[i] = a[i - 1];  
  
            a[0] = temp;  
        }  
  
        pos--;  
    }  
  
    printf("Array after shift operation ...\n");  
    for(i = 0; i < N; i++)  
        printf("%d\n", a[i]);  
  
    printf("\n");  
  
    return 0;  
} 

我不太了解您的问题,因为我仍然是C编程的初学者,但是这可能对您有帮助
https:// .com/8964/c-program-to-shift-elements-of-an-array-by-n-position/

    #include<stdio.h>  
  
#define N 5  
  
int main()  
{  
    int a[N], i, temp, pos, dir;  
  
    printf("Enter %d integer numbers\n", N);  
    for(i = 0; i < N; i++)  
        scanf("%d", &a[i]);  
  
    printf("Enter the number of positions to shift\n");  
    scanf("%d", &pos);  
  
    printf("Enter the direction of shifting ...\n");  
    printf("LEFT: 1 and RIGHT: 0\n");  
    scanf("%d", &dir);  
  
    while(pos)  
    {  
        if(dir)  
        {  
            temp = a[0];  
            for(i = 0; i < N - 1; i++)  
                a[i] = a[i + 1];  
  
            a[N - 1] = temp;  
        }  
        else  
        {  
            temp = a[N - 1];  
            for(i = N - 1; i > 0; i--)  
                a[i] = a[i - 1];  
  
            a[0] = temp;  
        }  
  
        pos--;  
    }  
  
    printf("Array after shift operation ...\n");  
    for(i = 0; i < N; i++)  
        printf("%d\n", a[i]);  
  
    printf("\n");  
  
    return 0;  
} 

I don't quite understand your issue because I am still a beginner in C programming but, This might be helpful to you
https://technotip.com/8964/c-program-to-shift-elements-of-an-array-by-n-position/

阵列移动和重新排列

愛放△進行李 2025-02-20 16:25:15

很难没有示例数据,但是一个选项是仅显示一个数据指出原始数据框中的每个 k 数据点,然后用直线段插入丢失的天数。 (这基本上是降采样。)

例如,要显示每5个数据点,请更改以下行:

ax.plot('Date', col, data=weather_data)

对此:

ax.plot('Date', col, data=weather_data.iloc[::5])

还有其他方法,例如非线性插值或显示滚动平均值,但这应该作为起点。

Hard to say without sample data, but one option is to show only one data point out of every k data points in the original DataFrame, and interpolate the missing days with straight line segments. (This is basically downsampling.)

For example, to show every 5 data points, change this line:

ax.plot('Date', col, data=weather_data)

to this:

ax.plot('Date', col, data=weather_data.iloc[::5])

There are other approaches such as nonlinear interpolation or showing a rolling average, but this should serve as a starting point.

如何跳过Matplotlib图中的一些X值以降低密度?

愛放△進行李 2025-02-20 12:52:10

我认为它“只是”在第0页=&gt; $ i = 0。如果有时只会发生这种情况,正如您所说,我很确定您在“ myfunction”块中的任何地方重置$ i。

您还可以检查响应中是否有prevPage和NextPage属性。如果有一个页面im确定还有NextPage属性。在这种情况下,您不再需要$我了。

但是:这是我将如何打印变量NextPage和PrevPage。

提示:让您的代码解释发生了什么。只是不要说“ $ i”,这是“ nextpage”。
而“ hasnextpage”时,您想获取更多信息。

$prevPage = 0
$nextPage = 0
do {

    Write-Host "Prev Page = $prevPage"
    Write-Host "Next Page = $nextPage"
    
    #invoke software products 
    $response = Invoke-RestMethod -Method GET -Uri "$aAppBaseUrl/software-products?size=2000&page=$nextPage" -Headers $headers

    #function execution block
    myFunction

    $prevPage = $nextPage 
    $nextPage += 1

    $hasNextPage = !$response.last


} while ($hasNextPage)

i don't think it "just" stuck at page 0 => $i = 0. If that only sometimes happens, as you say, i'm pretty sure that you reset $i anywhere in your "myFunction" block.

You also could check if there is a prevPage and nextPage Property in the response. If there is an lastPage im sure there is also a nextPage Property. In this case you dont need your $i anymore.

However: Here is how i would print the variables nextPage and prevPage.

Tip: Let your code explain what's going on. Just dont say "$i", it's "nextPage".
And while "hasNextPage" you want to fetch more information.

$prevPage = 0
$nextPage = 0
do {

    Write-Host "Prev Page = $prevPage"
    Write-Host "Next Page = $nextPage"
    
    #invoke software products 
    $response = Invoke-RestMethod -Method GET -Uri "$aAppBaseUrl/software-products?size=2000&page=$nextPage" -Headers $headers

    #function execution block
    myFunction

    $prevPage = $nextPage 
    $nextPage += 1

    $hasNextPage = !$response.last


} while ($hasNextPage)

在第0页(有时)invoke-restmethod循环

愛放△進行李 2025-02-19 14:27:03

怎么样

String vowels = "aeiouyAEIOUY"; // you can declare it somewhere before loop to 
                                // to avoid redeclaring it each time in loop

//inside loop
if ((a>='a' && a<='z') || (a>='A' && a<='Z')){ //is letter
    if (vowels.indexOf(a)!=-1)                 //is vowel
        v++;
    else                                       //is consonant
        c++;
}

How about something like

String vowels = "aeiouyAEIOUY"; // you can declare it somewhere before loop to 
                                // to avoid redeclaring it each time in loop

//inside loop
if ((a>='a' && a<='z') || (a>='A' && a<='Z')){ //is letter
    if (vowels.indexOf(a)!=-1)                 //is vowel
        v++;
    else                                       //is consonant
        c++;
}

我如何检查Java中的句子中有多少个辅音和元音?

愛放△進行李 2025-02-19 03:37:43

例如

   uri = string(abi.encodePacked(uriPrefix, Strings.toString(serialNum), uriSuffix));

You would want to use abi.encodePacked to combine multiple strings

For example:

   uri = string(abi.encodePacked(uriPrefix, Strings.toString(serialNum), uriSuffix));

如何将UINT64转换为焊接中的字符串

愛放△進行李 2025-02-18 22:48:21

是组合的nescessary吗?您不能让当前的文化决定使用哪种语言吗?

我的vb.net有点生锈,但我认为这应该类似于您在C#中的工作方式,请参见如何在c#

该链接有关如何执行此操作的更多详细信息,它被标记为C# VB。

本质上,为您的主要语言创建一个资源文件,例如 strings.resx 听起来像您已经完成的,请确保您始终将所有文本分配给控件。

将所有语言添加为具有语言名称的新资源文件。例如 strings.it.resx ,如果您以后要添加更多语言,则不需要更改代码行。

这有帮助吗?

Private Sub LangSelector_SelectedIndexChanged(sender As Object, e As EventArgs) Handles LangSelector.SelectedIndexChanged
    With LangSelector.Items
        Select Case Me.LangSelector.SelectedIndex
            Case Is = 0
                SetLanguage("it")
            Case Is = 1
                SetLanguage("en")
            Case Is = 2
                SetLanguage("fr")
            Case Is = 3
                SetLanguage("es")
            Case Is = 4
                SetLanguage("it")
        End Select
    End With
End Sub

Private Sub SetLanguage(language as String)
  Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(language);
  For Each (Control c in ???.Controls)
    If c.GetType == typeof(YourType)
      (CType(c,YourType)).UpdateLanguage()
    End If
  Next
End Sub

Is the comboBox nescessary? Can't you let the Current Culture decide which language to use?

My VB.Net is a bit rusty but I think this should work similar to how you would do it in C#, see How to use localization in C#

The link goes in to a lot more details on how to do this, it's tagged as C# but I think it wouldn't be hard to make it work in VB.

Essentially, create a resource file e.g. strings.resx for your primary language which it sounds like you have done, ensure you always assign every bit of text to your controls from that.

Add all your languages as a new resource file with the language name in it. e.g. strings.it.resx and you wan't need to change a line of code if you want to add more languages later.

Does this help?

Private Sub LangSelector_SelectedIndexChanged(sender As Object, e As EventArgs) Handles LangSelector.SelectedIndexChanged
    With LangSelector.Items
        Select Case Me.LangSelector.SelectedIndex
            Case Is = 0
                SetLanguage("it")
            Case Is = 1
                SetLanguage("en")
            Case Is = 2
                SetLanguage("fr")
            Case Is = 3
                SetLanguage("es")
            Case Is = 4
                SetLanguage("it")
        End Select
    End With
End Sub

Private Sub SetLanguage(language as String)
  Thread.CurrentThread.CurrentUICulture = CultureInfo.GetCultureInfo(language);
  For Each (Control c in ???.Controls)
    If c.GetType == typeof(YourType)
      (CType(c,YourType)).UpdateLanguage()
    End If
  Next
End Sub

更改其他USERCORTROL表格上的文本(翻译),VB.NET问题

愛放△進行李 2025-02-18 18:46:53

实际受保护的而不是 public 就足够了...

现在假设您的类无需 实际上是继承。

现在发生的事情是, b 的任何实例都合并了其自己的实例 a 以及 c 的任何实例。 b c 呼叫 a 的构造函数,一个继承类 d 不需要照顾。

如果引入了虚拟继承,则此更改:现在将构建 a 唯一实例的任务委派给了最派生的类,即在给定情况下为 d

d 现在需要访问 a 的常见实例,以便能够调用其构造函数。这可以通过 b 或&nbsp;(!)通过 c - 因此,如果至少有一个,就足够了至少提供受保护访问该实例的访问 - 在给定情况下, c ,但也可能是 b

Actually protected instead of public would suffice...

Now assume your classes would not inherit virtually.

What now happens is that any instance of B incorporates its own instance of A as well as does any instance of C. Both B and C call A's constructor already, an inheriting class D doesn't need to care for.

This changes if virtual inheritance is introduced: Now the task of constructing the sole instance of A is delegated to the most derived class, which is D in given case.

D now needs access to this common instance of A to be able to call it's constructor. This can occur via B or (!) via C – so it suffices if at least one of these provides at least protected access to that single instance – C in given case but could have been B as well.

C4594在视觉工作室警告

愛放△進行李 2025-02-18 18:20:28
 function appendRefferalPoints() {
 const totalPts = 1000;
 let cartValue=10;
 let discount=0;
 let inputValue = 0;   
    // creating form - ok
    $form = $('<form id="refForm" class="refForm coupon-form" ></form>');
    $form.append(
        '<input type="text" id="refValue" name="refInput" class="coupon-value input-small"  value="100" >'
    );
    $form.append('<button id="btnClick" class="btn">Aplica</button>');
    $("body").append($form);
    $(document).on("submit", "#refForm", function(e){  
    //getting input value while submitting form
        inputValue=$("#refValue").val();
        //converting 100 pts to 1 dallor
        discount=inputValue/100;
        //calculating balance pts
        let balancePts = totalPts - parseInt(inputValue);
        //calculating final amount
    let finalCartValue=cartValue-discount;
    alert("finalCartValue"+finalCartValue);
    });
 }
appendRefferalPoints();
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

 function appendRefferalPoints() {
 const totalPts = 1000;
 let cartValue=10;
 let discount=0;
 let inputValue = 0;   
    // creating form - ok
    $form = $('<form id="refForm" class="refForm coupon-form" ></form>');
    $form.append(
        '<input type="text" id="refValue" name="refInput" class="coupon-value input-small"  value="100" >'
    );
    $form.append('<button id="btnClick" class="btn">Aplica</button>');
    $("body").append($form);
    $(document).on("submit", "#refForm", function(e){  
    //getting input value while submitting form
        inputValue=$("#refValue").val();
        //converting 100 pts to 1 dallor
        discount=inputValue/100;
        //calculating balance pts
        let balancePts = totalPts - parseInt(inputValue);
        //calculating final amount
    let finalCartValue=cartValue-discount;
    alert("finalCartValue"+finalCartValue);
    });
 }
appendRefferalPoints();
 
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>

表格上的减法金额提交JavaScript / jQuery

愛放△進行李 2025-02-18 03:14:56

我在

{
  "name": "My extension",
  ...
  "permissions": [
    "storage"
  ],
  ...
}

I find this in chrome storage documentation.
You must declare the "storage" permission in the extension manifest to use the storage API. For example:

{
  "name": "My extension",
  ...
  "permissions": [
    "storage"
  ],
  ...
}

chrome.local.score get设置 - 关闭弹出窗口时,保存复选框状态和功能

愛放△進行李 2025-02-17 22:45:12

您需要使用可以执行PHP程序的HTTP服务器。

您似乎已经使用node.js编写了自己的服务器,但是除非您已经明确设计了它,否则它不会支持PHP在node.js生态系统中。

You need to use an HTTP server which can execute PHP programs.

You appear to have written your own server using Node.js then it won't support PHP unless you have designed it - explicitly - to do so (and you'd be better off using server-side JS instead of PHP if you were already in a Node.js ecosystem).

php 404接触形式

愛放△進行李 2025-02-17 22:00:16

您可以使用 scrolltoIndex 类似此示例的方法:

import React, {useRef} from 'react';
import {
  FlatList,
  SafeAreaView,
  StyleSheet,
  Text,
  TouchableOpacity,
} from 'react-native';

const App = () => {
  const flatListRef = useRef();
  const data = [
    {
      id: 0,
      title: 'Lorem Ipsum is simply dummy',
      body: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
    },
    {
      id: 1,
      title: 'Lorem Ipsum is simply dummy',
      body: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
    },
  ];

  const scrollToTop = idx => {
    flatListRef?.current?.scrollToIndex({
      animated: true,
      index: idx,
      viewOffset: 100,
    });
  };

  const renderProductCard = ({item, index}) => (
    <TouchableOpacity
      style={styles.productCard}
      onPress={() => {
        scrollToTop(index);
        /*        const productCard = [...listDataSource];
                productCard[item.key].isExpanded = !productCard[item.key].isExpanded;
                setListDataSource(productCard);*/
      }}>
      <Text>{item.title}</Text>
    </TouchableOpacity>
  );
  return (
    <SafeAreaView>
      <FlatList
        data={data}
        horizontal
        ref={flatListRef}
        contentContainerStyle={{alignItems: 'flex-end'}}
        showsHorizontalScrollIndicator={false}
        renderItem={renderProductCard}
        keyExtractor={itemData => itemData.toString()}
      />
    </SafeAreaView>
  );
};

export default App;
const styles = StyleSheet.create({
  productCard: {
    width: 300,
    height: 100,
    marginRight: 10,
    backgroundColor: 'green',
    borderRadius: 12,
  },
});

“在此处输入图像说明”

You can use scrollToIndex method like this example:

import React, {useRef} from 'react';
import {
  FlatList,
  SafeAreaView,
  StyleSheet,
  Text,
  TouchableOpacity,
} from 'react-native';

const App = () => {
  const flatListRef = useRef();
  const data = [
    {
      id: 0,
      title: 'Lorem Ipsum is simply dummy',
      body: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
    },
    {
      id: 1,
      title: 'Lorem Ipsum is simply dummy',
      body: "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum.",
    },
  ];

  const scrollToTop = idx => {
    flatListRef?.current?.scrollToIndex({
      animated: true,
      index: idx,
      viewOffset: 100,
    });
  };

  const renderProductCard = ({item, index}) => (
    <TouchableOpacity
      style={styles.productCard}
      onPress={() => {
        scrollToTop(index);
        /*        const productCard = [...listDataSource];
                productCard[item.key].isExpanded = !productCard[item.key].isExpanded;
                setListDataSource(productCard);*/
      }}>
      <Text>{item.title}</Text>
    </TouchableOpacity>
  );
  return (
    <SafeAreaView>
      <FlatList
        data={data}
        horizontal
        ref={flatListRef}
        contentContainerStyle={{alignItems: 'flex-end'}}
        showsHorizontalScrollIndicator={false}
        renderItem={renderProductCard}
        keyExtractor={itemData => itemData.toString()}
      />
    </SafeAreaView>
  );
};

export default App;
const styles = StyleSheet.create({
  productCard: {
    width: 300,
    height: 100,
    marginRight: 10,
    backgroundColor: 'green',
    borderRadius: 12,
  },
});

enter image description here

React Native-水平扁平列表卷轴实现

愛放△進行李 2025-02-17 16:20:42

对于“纯” CMAKE项目,这是一个生成的构建树无法完成的。

假设您正在将工具链文件的路径传递到cmake(使用 -dcmake_toolchain_file = $ ndk/build/build/cmake/android.toolchain.toolchain.cmake ),您也应该以 android_abi /代码>参数。 请参见在这里

有关可能的值, 对于每个ABI,类似:

MyProjectDir/
  build_x86_64/
  build_x86/
  build_arm64/
  build_armeabi/
  src/
  ...

另一方面,您正在使用一个由Gradle Marand的项目工作,那么ABI会自动由Gradle控制,并且只需担心,如果您 not not 想要为所有ABIS建造。

正常构建应用程序,当您获得APK时 - 打开它(本质上是邮政编码)。内部应该是 lib 目录,其中包含每个ABI的子目录。

For a "pure" CMake project, this cannot be done with a single generated build tree.

Assuming you are passing a path to a toolchain file to CMake (with -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake), you should also be passing in an ANDROID_ABI argument. For possible values see here

You're then expected to have a separate build dir for each ABI, something like:

MyProjectDir/
  build_x86_64/
  build_x86/
  build_arm64/
  build_armeabi/
  src/
  ...

If, on the other hand, you are working with a Gradle-managed project, then the ABI is automatically controlled by Gradle and you only need to worry if you don't want to build for all ABIs.

Build your app as normal, and when you get an APK - open it (it's essentially a ZIP archive). Inside it should be a lib directory containing subdirectories for each ABI.

Android NDK:用cmake指定app_abi

愛放△進行李 2025-02-17 15:57:20

对于任何试图将可接受的解决方案应用于荷抗价值模板的人,如果您要嵌套双打,则必须使用单个报价:

value_template: "{{ value_json['internet-computer'].usd }}"

For anyone trying to apply the accepted solution to HomeAssistant value templates, you must use single quotes if you are nesting in doubles:

value_template: "{{ value_json['internet-computer'].usd }}"

无法使用“ - ”访问JSON属性。短跑

愛放△進行李 2025-02-17 13:40:49

我尝试了上述解决方案,但似乎在某些情况下参数 $ body 无法包含必要的元素,因为当我们调用 cy.get('hody')。因此,我找到了另一个解决方案,使用柏树使用jQuery,这就是:

let counter = 0;
const timeOut: number = Cypress.config('defaultCommandTimeout');
  
  const sleep = (milliseconds) => {
    const date = Date.now();
    let currentDate = null;
    do {
      currentDate = Date.now();
    } while (currentDate - date < milliseconds);
  };

  while (true) {
    if (Cypress.$(element).length > 0 && Cypress.$(element).is(':visible')) {
      Cypress.$(element).click();
      break;
    } else {
      sleep(500);
      counter = counter + 500;
        if (counter >= timeOut) {
          cy.log(elementName+ ' was not found after timeout');
          break;
        }
    }
  }

I tried the above solution, but seems that in some cases parameter $body could not contain necessary element, cause it was not loaded when we invoked cy.get('body'). So, I found another solution, using jQuery via Cypress, here is it:

let counter = 0;
const timeOut: number = Cypress.config('defaultCommandTimeout');
  
  const sleep = (milliseconds) => {
    const date = Date.now();
    let currentDate = null;
    do {
      currentDate = Date.now();
    } while (currentDate - date < milliseconds);
  };

  while (true) {
    if (Cypress.$(element).length > 0 && Cypress.$(element).is(':visible')) {
      Cypress.$(element).click();
      break;
    } else {
      sleep(500);
      counter = counter + 500;
        if (counter >= timeOut) {
          cy.log(elementName+ ' was not found after timeout');
          break;
        }
    }
  }

是否可以继续执行测试,如果e元素未找到柏树

更多

推荐作者

櫻之舞

文章 0 评论 0

弥枳

文章 0 评论 0

m2429

文章 0 评论 0

野却迷人

文章 0 评论 0

我怀念的。

文章 0 评论 0

更多

友情链接

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