问:
Kotlin - Calculate Age according to a choice from Drop Down Menu
I'm starting to learn Kotlin and trying to make a simple project that calculate your age in (Years, Months, Weeks, Days) which is choices in a drop down menu
and you select the date of birth from datePickerDialog
both the drop down menu and the date dialog are working fine
but I can't find the way to get the difference between the current date and the date of birth!
API: 26

Sample of the Project

```<code>package com.example.agecalculator

import android.annotation.SuppressLint
import android.app.DatePickerDialog
import android.os.Bundle
import android.widget.DatePicker
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.agecalculator.ui.theme.AgeCalculatorTheme
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.*

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            AgeCalculatorTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colors.background
                ) {
                    MainUI(this)
                }
            }
        }
    }
}

@Composable
fun MainUI(context: MainActivity) {
    Column(
        modifier = Modifier
            .fillMaxWidth()
            .background(color = colorResource(id = R.color.MinaBackground)),
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        Spacer(modifier = Modifier.height(8.dp))
        Text(
            text = "Calculate Your Age",
            fontSize = 24.sp,
            color = colorResource(id = R.color.MinaFont),
            modifier = Modifier
                .align(Alignment.Start)
                .padding(16.dp, 8.dp)
        )
        Spacer(modifier = Modifier.height(8.dp))
        MyUI(context = context)
        Spacer(modifier = Modifier.height(8.dp))

    }
}

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun MyUI(context: MainActivity) {

    val contextForToast = LocalContext.current.applicationContext

    val listItems = arrayOf("Years", "Months", "Weeks", "Days")

    var selectedItem by remember {
        mutableStateOf(listItems[0])
    }

    var expanded by remember {
        mutableStateOf(false)
    }

    // the box
    ExposedDropdownMenuBox(
        expanded = expanded,
        onExpandedChange = {
            expanded = !expanded
        }
    ) {

        // text field
        TextField(
            value = selectedItem,
            onValueChange = {},
            readOnly = true,
            label = { Text(text = "in", color = colorResource(id = R.color.MinaFont)) },
            trailingIcon = {
                ExposedDropdownMenuDefaults.TrailingIcon(
                    expanded = expanded
                )
            },
            colors = ExposedDropdownMenuDefaults.textFieldColors(
                textColor = colorResource(id = R.color.MinaFont),
                backgroundColor = colorResource(id = R.color.MinaForeground),
                trailingIconColor = colorResource(id = R.color.MinaFont),
            )
        )

        // menu
        ExposedDropdownMenu(
            expanded = expanded,
            onDismissRequest = { expanded = false },
            Modifier.background(colorResource(id = R.color.MinaForeground))
        ) {
            listItems.forEach { selectedOption ->
                // menu item
                DropdownMenuItem(onClick = {
                    selectedItem = selectedOption
                    Toast.makeText(contextForToast, selectedOption, Toast.LENGTH_SHORT).show()
                    expanded = false
                }) {
                    Text(text = selectedOption, color = colorResource(id = R.color.MinaFont))
                }
            }
        }
    }
    MyCal(context = context, dropDownSelection = selectedItem)

}

@SuppressLint("WeekBasedYear")
@Composable
fun MyCal(context: MainActivity, dropDownSelection: String) {
    val calendar = Calendar.getInstance()
    val year = calendar.get(Calendar.YEAR)
    val month = calendar.get(Calendar.MONTH)
    val day = calendar.get(Calendar.DAY_OF_MONTH)
    calendar.time = Date()
    val formatter = DateTimeFormatter.ofPattern("dd/MM/YYYY")
    val current = LocalDate.now().format(formatter)
    val date = remember { mutableStateOf("") }
    val datePickerDialog = DatePickerDialog(
        context,
        { _: DatePicker, year: Int, month: Int, dayOfMonth: Int ->
            date.value = "$dayOfMonth/${month + 1}/$year"
        },
        year,
        month,
        day
    )
    Button(onClick = { datePickerDialog.show() }) {
        if (date.value == "") {
            Text(text = current)
        } else Text(text = date.value)
    }

}
</code>```

Body:
I'm starting to learn Kotlin and trying to make a simple project that calculate your age in (Years, Months, Weeks, Days) which is choices in a drop down menu
and you select the date of birth from datePickerDialog
both the drop down menu and the date dialog are working fine
but I can't find the way to get the difference between the current date and the date of birth!
API: 26

Sample of the Project

package com.example.agecalculator

import android.annotation.SuppressLint
import android.app.DatePickerDialog
import android.os.Bundle
import android.widget.DatePicker
import android.widget.Toast
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
import androidx.compose.foundation.background
import androidx.compose.foundation.layout.*
import androidx.compose.material.*
import androidx.compose.runtime.*
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.colorResource
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import com.example.agecalculator.ui.theme.AgeCalculatorTheme
import java.time.LocalDate
import java.time.format.DateTimeFormatter
import java.util.*

class MainActivity : ComponentActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContent {
            AgeCalculatorTheme {
                // A surface container using the 'background' color from the theme
                Surface(
                    modifier = Modifier.fillMaxSize(),
                    color = MaterialTheme.colors.background
                ) {
                    MainUI(this)
                }
            }
        }
    }
}

@Composable
fun MainUI(context: MainActivity) {
    Column(
        modifier = Modifier
            .fillMaxWidth()
            .background(color = colorResource(id = R.color.MinaBackground)),
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        Spacer(modifier = Modifier.height(8.dp))
        Text(
            text = "Calculate Your Age",
            fontSize = 24.sp,
            color = colorResource(id = R.color.MinaFont),
            modifier = Modifier
                .align(Alignment.Start)
                .padding(16.dp, 8.dp)
        )
        Spacer(modifier = Modifier.height(8.dp))
        MyUI(context = context)
        Spacer(modifier = Modifier.height(8.dp))

    }
}

@OptIn(ExperimentalMaterialApi::class)
@Composable
fun MyUI(context: MainActivity) {

    val contextForToast = LocalContext.current.applicationContext

    val listItems = arrayOf("Years", "Months", "Weeks", "Days")

    var selectedItem by remember {
        mutableStateOf(listItems[0])
    }

    var expanded by remember {
        mutableStateOf(false)
    }

    // the box
    ExposedDropdownMenuBox(
        expanded = expanded,
        onExpandedChange = {
            expanded = !expanded
        }
    ) {

        // text field
        TextField(
            value = selectedItem,
            onValueChange = {},
            readOnly = true,
            label = { Text(text = "in", color = colorResource(id = R.color.MinaFont)) },
            trailingIcon = {
                ExposedDropdownMenuDefaults.TrailingIcon(
                    expanded = expanded
                )
            },
            colors = ExposedDropdownMenuDefaults.textFieldColors(
                textColor = colorResource(id = R.color.MinaFont),
                backgroundColor = colorResource(id = R.color.MinaForeground),
                trailingIconColor = colorResource(id = R.color.MinaFont),
            )
        )

        // menu
        ExposedDropdownMenu(
            expanded = expanded,
            onDismissRequest = { expanded = false },
            Modifier.background(colorResource(id = R.color.MinaForeground))
        ) {
            listItems.forEach { selectedOption ->
                // menu item
                DropdownMenuItem(onClick = {
                    selectedItem = selectedOption
                    Toast.makeText(contextForToast, selectedOption, Toast.LENGTH_SHORT).show()
                    expanded = false
                }) {
                    Text(text = selectedOption, color = colorResource(id = R.color.MinaFont))
                }
            }
        }
    }
    MyCal(context = context, dropDownSelection = selectedItem)

}

@SuppressLint("WeekBasedYear")
@Composable
fun MyCal(context: MainActivity, dropDownSelection: String) {
    val calendar = Calendar.getInstance()
    val year = calendar.get(Calendar.YEAR)
    val month = calendar.get(Calendar.MONTH)
    val day = calendar.get(Calendar.DAY_OF_MONTH)
    calendar.time = Date()
    val formatter = DateTimeFormatter.ofPattern("dd/MM/YYYY")
    val current = LocalDate.now().format(formatter)
    val date = remember { mutableStateOf("") }
    val datePickerDialog = DatePickerDialog(
        context,
        { _: DatePicker, year: Int, month: Int, dayOfMonth: Int ->
            date.value = "$dayOfMonth/${month + 1}/$year"
        },
        year,
        month,
        day
    )
    Button(onClick = { datePickerDialog.show() }) {
        if (date.value == "") {
            Text(text = current)
        } else Text(text = date.value)
    }

}


来源: stackexchange

问:
Add dynamic multiple dropdown with values on Add button click in Vue.Js
Requirement :

1.I have one add button while clicking that button I need to show one dropdown with three options like (A,B,C) beside that one input text field and delete icon need to show. Consider I have choosen option 'A'.
Note :- Clicking this delete icon will delete the entire row.

2.When I  click again Add button then I need to show one more dropdown below the previous one with two options like (B,C) beside that one input text field and delete icon need to show.
Note :- Option selected in previous dropdown won't show in here. Consider I have choosen option 'B'. Clicking this delete icon will delete the entire row.

3.When I  click again Add button then I need to show one more dropdown below the previous one with only one option like (C) beside that one input text field and delete icon need to show.
Note :- Option selected in previous two dropdown won't show in here.
Clicking this delete icon will delete the entire row.

4.If user click again Add button then one error message will show only three items can add.

I'm absolute beginner in Vue.Js. I've got stock in this feature in Vue.Js and I would really appreciate your efforts. Thank you!

ContentLicense: CC BY-SA 4.0


问:
ESP32 With KSZ8081
I have got the hardware developed for ESP32 with KSZ8081 PHY controller. I am trying to program ESP32 for the ethernet with basic examples given in VS code IDE.

I am getting Ethernet Started but no link up and IP address is not getting assigned.

How to configure the ethernet basic example to work with KSZ8081 controller.

Title: ESP32 With KSZ8081


问:
How do I split a sentence by Step value in Python?
How do I split a sentence by a step value in python ? I can use split() to SPLIT the sentence by a separator like this:

```<code>str.split("\n")
</code>```

For example:

I have a sentence: "The quick brown fox jumps over the lazy dog"

I want to split it by 3 words : ['The quick brown','fox jumps over', 'the lazy dog']

How do i do that with or without a function?

I tried split() but it returns a list where each word is a item.

['The' ,'quick' ,'brown','fox' ,'jumps' ,'over', 'the' ,'lazy','dog']

Body:
How do I split a sentence by a step value in python ? I can use split() to SPLIT the sentence by a separator like this:

str.split("\n")

For example:

I have a sentence: "The quick brown fox jumps over the lazy dog"

I want to split it by 3 words : ['The quick brown','fox jumps over', 'the lazy dog']

How do i do that with or without a function?

I tried split() but it returns a list where each word is a item.

['The' ,'quick' ,'brown','fox' ,'jumps' ,'over', 'the' ,'lazy','dog']


问:
Why do my getValue methods keep returning only the most recent objects values?
I am a beginner with java, and I am confused on why my code only returns the values of the most recent object. I am creating a bunch of properties for my Monopoly project inside a class Property using a parameterized constructor.

For the Property class, I made these variables and constructors:

```<code>public class Property {

    private static String name;
    private static int owner;
    private static int price;
    private static int mortgage;
    private static boolean mortgaged;
    private static int houses;
    private static int set;
    private static int rent;
    private static int houseOneRent;
    private static int houseTwoRent;
    private static int houseThreeRent;
    private static int houseFourRent;
    private static int hotelRent;
    private static int housePrice;

    // Constructor

    public Property(String name, int price, int rent, int house1, int house2, int house3, int house4, int hotel, int housePrice) {

        this.name = name;
        owner = 0;
        this.price = price;
        this.mortgage = price/2;
        mortgaged = false;
        houses = 0;
        set = 0;
        this.rent = rent;
        this.houseOneRent = house1;
        this.houseTwoRent = house2;
        this.houseThreeRent = house3;
        this.houseFourRent = house4;
        this.hotelRent = hotel;
        this.housePrice = housePrice;

        System.out.println("The " + this.name + " property has been initialized.");
    }
</code>```

I then created all my properties in a different class, using code like this. I did it for all the properties but I won't show them to save space.

```<code>Property Yellow1 = new Property("Atlantic Avenue", 260, 22, 110, 330, 800, 975, 1150, 150);
        Property Yellow2 = new Property("Ventnor Avenue", 260, 22, 110, 330, 800, 975, 1150, 150);
        Property Yellow3 = new Property("Marvin Gardens", 280, 24, 120, 360, 850, 1025, 1200, 150);

        Property Green1 = new Property("Pacific Avenue", 300, 26, 130, 390, 900, 1100, 1275, 200);
        Property Green2 = new Property("North Caroline Avenue", 300, 26, 130, 390, 900, 1100, 1275, 200);
        Property Green3 = new Property("Pennsylvania Avenue", 320, 38, 150, 450, 1000, 1200, 1400, 200);

        Property DarkBlue1 = new Property("Park Place", 350, 35, 175, 500, 1100, 1300, 1500, 200);
        Property DarkBlue2 = new Property("Broadway", 400, 50, 200, 600, 1400, 1700, 2000, 200);
</code>```

I then created getValue methods such as these below:

```<code>public static String getName() {

        return name;
    }

    public static int getOwner() {

        return owner;
    }

    public static int getPrice() {

        return price;
    }
</code>```

When I ran the getValue methods like this:

```<code>System.out.println(Yellow1.getHousePrice());
</code>```

It output:

```<code>200
</code>```

200 is the correct value for the final object I constructed; DarkBlue1. The value that should have been output for Yellow1 is 150. Why is it outputting 200?

Body:
I am a beginner with java, and I am confused on why my code only returns the values of the most recent object. I am creating a bunch of properties for my Monopoly project inside a class Property using a parameterized constructor.

For the Property class, I made these variables and constructors:

public class Property {

    private static String name;
    private static int owner;
    private static int price;
    private static int mortgage;
    private static boolean mortgaged;
    private static int houses;
    private static int set;
    private static int rent;
    private static int houseOneRent;
    private static int houseTwoRent;
    private static int houseThreeRent;
    private static int houseFourRent;
    private static int hotelRent;
    private static int housePrice;

    // Constructor

    public Property(String name, int price, int rent, int house1, int house2, int house3, int house4, int hotel, int housePrice) {

        this.name = name;
        owner = 0;
        this.price = price;
        this.mortgage = price/2;
        mortgaged = false;
        houses = 0;
        set = 0;
        this.rent = rent;
        this.houseOneRent = house1;
        this.houseTwoRent = house2;
        this.houseThreeRent = house3;
        this.houseFourRent = house4;
        this.hotelRent = hotel;
        this.housePrice = housePrice;

        System.out.println("The " + this.name + " property has been initialized.");
    }

I then created all my properties in a different class, using code like this. I did it for all the properties but I won't show them to save space.

Property Yellow1 = new Property("Atlantic Avenue", 260, 22, 110, 330, 800, 975, 1150, 150);
        Property Yellow2 = new Property("Ventnor Avenue", 260, 22, 110, 330, 800, 975, 1150, 150);
        Property Yellow3 = new Property("Marvin Gardens", 280, 24, 120, 360, 850, 1025, 1200, 150);

        Property Green1 = new Property("Pacific Avenue", 300, 26, 130, 390, 900, 1100, 1275, 200);
        Property Green2 = new Property("North Caroline Avenue", 300, 26, 130, 390, 900, 1100, 1275, 200);
        Property Green3 = new Property("Pennsylvania Avenue", 320, 38, 150, 450, 1000, 1200, 1400, 200);

        Property DarkBlue1 = new Property("Park Place", 350, 35, 175, 500, 1100, 1300, 1500, 200);
        Property DarkBlue2 = new Property("Broadway", 400, 50, 200, 600, 1400, 1700, 2000, 200);

I then created getValue methods such as these below:

public static String getName() {

        return name;
    }

    public static int getOwner() {

        return owner;
    }

    public static int getPrice() {

        return price;
    }

When I ran the getValue methods like this:

System.out.println(Yellow1.getHousePrice());

It output:

200

200 is the correct value for the final object I constructed; DarkBlue1. The value that should have been output for Yellow1 is 150. Why is it outputting 200?


问:
how to fetch data of table after doing full outer join?
i am having a business problem
having a table which have following

```<code>    |sku_id    |solr_status   |entry_context | mrp
     1         active           10            20
     1         inactive         10            30
     1         active           10            22.5
     2         inactive         10            10
     2         inactive         10            31
</code>```

filter the data into

```<code>table1->active
table2->inactive
</code>```

now i have to do the according to condition

```<code>full outer join on 1 and 2 on sku_id..  Three possible cases
          case (1 is  not null, 2 is not null)  => use 1
          case (1 is null, 2 is not null) => use 2
          case (1 is not null, 2 is null) => use  1
</code>```

my code is something like that

```<code> val activeCatalog=dataframe.filter('solr_status===true).cache()
    val inActiveCatalog=dataframe.filter('solr_status===false).cache()
    val fullCatalog=activeCatalog.join(inActiveCatalog,Seq("sku"),joinType = "outer")
    fullCatalog.show(false)
    val resultCatalog = (activeCatalog,inActiveCatalog) match {
      case (activeCatalog,inActiveCatalog) if(activeCatalog.count()!=0L && inActiveCatalog.count()!=0L)=>
        fullCatalog.filter('solr_status===true).cache()
      case (activeCatalog, inActiveCatalog) if (activeCatalog.count() == 0L && inActiveCatalog.count() != 0L) =>
        fullCatalog.filter('solr_status === false).cache()
      case (activeCatalog, inActiveCatalog) if (activeCatalog.count() != 0L && inActiveCatalog.count() == 0L) =>
        fullCatalog.filter('solr_status === true).cache()
    }
</code>```

so using the approach i am getting ambiguous column error. also my
result data set should maintain the schema for active or inactive
table, doing outer join will create duplicate columns

any help ?

Body:
i am having a business problem
having a table which have following

    |sku_id    |solr_status   |entry_context | mrp
     1         active           10            20
     1         inactive         10            30
     1         active           10            22.5
     2         inactive         10            10
     2         inactive         10            31

filter the data into

table1->active
table2->inactive

now i have to do the according to condition

full outer join on 1 and 2 on sku_id..  Three possible cases
          case (1 is  not null, 2 is not null)  => use 1
          case (1 is null, 2 is not null) => use 2
          case (1 is not null, 2 is null) => use  1

my code is something like that

 val activeCatalog=dataframe.filter('solr_status===true).cache()
    val inActiveCatalog=dataframe.filter('solr_status===false).cache()
    val fullCatalog=activeCatalog.join(inActiveCatalog,Seq("sku"),joinType = "outer")
    fullCatalog.show(false)
    val resultCatalog = (activeCatalog,inActiveCatalog) match {
      case (activeCatalog,inActiveCatalog) if(activeCatalog.count()!=0L && inActiveCatalog.count()!=0L)=>
        fullCatalog.filter('solr_status===true).cache()
      case (activeCatalog, inActiveCatalog) if (activeCatalog.count() == 0L && inActiveCatalog.count() != 0L) =>
        fullCatalog.filter('solr_status === false).cache()
      case (activeCatalog, inActiveCatalog) if (activeCatalog.count() != 0L && inActiveCatalog.count() == 0L) =>
        fullCatalog.filter('solr_status === true).cache()
    }

so using the approach i am getting ambiguous column error. also my
result data set should maintain the schema for active or inactive
table, doing outer join will create duplicate columns

any help ?


问:
When building a C++ static library what causes third party libraries hidden in source files to become end user dependencies?
Sorry if this question is a bit long winded. I know there is a lot of ground already covered here.

Essentially I get the below error when including my tst_engine.lib in another target.

```<code>lld-link: error: undefined symbol: SDL_Init
>>> referenced by C:\Users\n10255460\CLionProjects\2D_engine_and_game\tst_engine\TstGameEngine.cpp:22
>>>               tst_engine.lib(TstGameEngine.cpp.obj):(public: __cdecl tst::TstGameEngine::TstGameEngine(bool *))

lld-link: error: undefined symbol: SDL_Quit
>>> referenced by C:\Users\n10255460\CLionProjects\2D_engine_and_game\tst_engine\TstGameEngine.cpp:43
>>>               tst_engine.lib(TstGameEngine.cpp.obj):(public: __cdecl tst::TstGameEngine::~TstGameEngine(void))
ninja: build stopped: subcommand failed.
</code>```

As It says above, SDL is used in a .cpp file not a .h file. On top of this, this error goes away when including SDL as a dependency in the target I'm attempting to compile with tst_engine as a library.

As far as I've previously understood things, if a third party library is in a source file it should never become a dependency for those who use the lib associated with the source file. Below are the two relevant cmake files:

executable that triggers the error:

```<code>cmake_minimum_required(VERSION 3.24)
project(game)

set(CMAKE_CXX_STANDARD 20)

include_directories(../tst_engine)

set(lib ${CMAKE_SOURCE_DIR}\\libraries\\lib)

include_directories(${CMAKE_SOURCE_DIR}\\libraries\\include)

add_executable(game main.cpp)
target_link_libraries(game
        ${CMAKE_SOURCE_DIR}\\cmake-build-debug\\tst_engine\\tst_engine.lib
)
</code>```

library that compiles successfully:

```<code>cmake_minimum_required(VERSION 3.24)
project(tst_engine)

set(CMAKE_CXX_STANDARD 20)

set(lib ${CMAKE_SOURCE_DIR}\\libraries\\lib)

include_directories(${CMAKE_SOURCE_DIR}\\libraries\\include)

add_library(tst_engine STATIC TstGameEngine.h TstGameEngine.cpp)
target_link_libraries(tst_engine PRIVATE ${lib}\\SDL2main.lib ${lib}\\SDL2.lib ${lib}\\SDL2-static.lib)
</code>```

Body:
Sorry if this question is a bit long winded. I know there is a lot of ground already covered here.

Essentially I get the below error when including my tst_engine.lib in another target.

lld-link: error: undefined symbol: SDL_Init
>>> referenced by C:\Users\n10255460\CLionProjects\2D_engine_and_game\tst_engine\TstGameEngine.cpp:22
>>>               tst_engine.lib(TstGameEngine.cpp.obj):(public: __cdecl tst::TstGameEngine::TstGameEngine(bool *))

lld-link: error: undefined symbol: SDL_Quit
>>> referenced by C:\Users\n10255460\CLionProjects\2D_engine_and_game\tst_engine\TstGameEngine.cpp:43
>>>               tst_engine.lib(TstGameEngine.cpp.obj):(public: __cdecl tst::TstGameEngine::~TstGameEngine(void))
ninja: build stopped: subcommand failed.

As It says above, SDL is used in a .cpp file not a .h file. On top of this, this error goes away when including SDL as a dependency in the target I'm attempting to compile with tst_engine as a library.

As far as I've previously understood things, if a third party library is in a source file it should never become a dependency for those who use the lib associated with the source file. Below are the two relevant cmake files:

executable that triggers the error:

cmake_minimum_required(VERSION 3.24)
project(game)

set(CMAKE_CXX_STANDARD 20)

include_directories(../tst_engine)

set(lib ${CMAKE_SOURCE_DIR}\\libraries\\lib)

include_directories(${CMAKE_SOURCE_DIR}\\libraries\\include)

add_executable(game main.cpp)
target_link_libraries(game
        ${CMAKE_SOURCE_DIR}\\cmake-build-debug\\tst_engine\\tst_engine.lib
)

library that compiles successfully:

cmake_minimum_required(VERSION 3.24)
project(tst_engine)

set(CMAKE_CXX_STANDARD 20)

set(lib ${CMAKE_SOURCE_DIR}\\libraries\\lib)

include_directories(${CMAKE_SOURCE_DIR}\\libraries\\include)

add_library(tst_engine STATIC TstGameEngine.h TstGameEngine.cpp)
target_link_libraries(tst_engine PRIVATE ${lib}\\SDL2main.lib ${lib}\\SDL2.lib ${lib}\\SDL2-static.lib)


问:
unable to use where-object as value is nested in array with powershell
I'm currently working through a csv of Sharepoint AuditData and trying to evaluate several fields that are nested in the audit data field.
I've tried all the Usual $_.AuditData.CreatedDate etc. but can't figure out how to query the data thats nested in it.
It's my first time trying to evaluate against data thats structured like this and any help about how best to go about this would be very much appreciated.

I've tried the where object clause and its not returning the data I would expect

```<code>"PSComputerName","RunspaceId","PSShowComputerName","RecordType","CreationDate","UserIds","Operations","AuditData","ResultIndex","ResultCount","Identity","IsValid","ObjectState"
"REDACTED","REDACTED","REDACTED","REDACTED","REDACTED","REDACTED","REDACTED","{""AppAccessContext"":{""AADSessionId"":""REDACTED"",""CorrelationId"":""REDACTED"",""TokenIssuedAtTime"":""REDACTED"",""UniqueTokenId"":""REDACTED""},""CreationTime"":""REDACTED"",""Id"":""REDACTED"",""Operation"":""REDACTED"",""OrganizationId"":""REDACTED"",""RecordType""REDACTED""UserKey"":""REDACTED"",""UserType""REDACTED""Version""REDACTED""Workload"":""REDACTED"",""ClientIP"":""REDACTED"",""ObjectId"":""REDACTED"",""UserId"":""REDACTED"",""CorrelationId"":""REDACTED"",""EventSource"":""REDACTED"",""ItemType"":""REDACTED""",""ListId"":""REDACTED"",""ListItemUniqueId"":""REDACTED"",""Site"":""REDACTED"",""UserAgent"":""REDACTED"",""WebId"":"REDACTED"",""MachineId"":""REDACTED"",""FileSyncBytesCommitted"":""REDACTED"",""HighPriorityMediaProcessing""REDACTED""ImplicitShare"":""REDACTED"",""IsManagedDevice""REDACTED""SourceFileExtension"":""REDACTED"",""SiteUrl"":""REDACTED"",""SourceFileName"":""REDACTED"",""SourceRelativeUrl"":""REDACTED""}","REDACTED","REDACTED","REDACTED","REDACTED","REDACTED"
</code>```

Body:
I'm currently working through a csv of Sharepoint AuditData and trying to evaluate several fields that are nested in the audit data field.
I've tried all the Usual $_.AuditData.CreatedDate etc. but can't figure out how to query the data thats nested in it.
It's my first time trying to evaluate against data thats structured like this and any help about how best to go about this would be very much appreciated.

I've tried the where object clause and its not returning the data I would expect

"PSComputerName","RunspaceId","PSShowComputerName","RecordType","CreationDate","UserIds","Operations","AuditData","ResultIndex","ResultCount","Identity","IsValid","ObjectState"
"REDACTED","REDACTED","REDACTED","REDACTED","REDACTED","REDACTED","REDACTED","{""AppAccessContext"":{""AADSessionId"":""REDACTED"",""CorrelationId"":""REDACTED"",""TokenIssuedAtTime"":""REDACTED"",""UniqueTokenId"":""REDACTED""},""CreationTime"":""REDACTED"",""Id"":""REDACTED"",""Operation"":""REDACTED"",""OrganizationId"":""REDACTED"",""RecordType""REDACTED""UserKey"":""REDACTED"",""UserType""REDACTED""Version""REDACTED""Workload"":""REDACTED"",""ClientIP"":""REDACTED"",""ObjectId"":""REDACTED"",""UserId"":""REDACTED"",""CorrelationId"":""REDACTED"",""EventSource"":""REDACTED"",""ItemType"":""REDACTED""",""ListId"":""REDACTED"",""ListItemUniqueId"":""REDACTED"",""Site"":""REDACTED"",""UserAgent"":""REDACTED"",""WebId"":"REDACTED"",""MachineId"":""REDACTED"",""FileSyncBytesCommitted"":""REDACTED"",""HighPriorityMediaProcessing""REDACTED""ImplicitShare"":""REDACTED"",""IsManagedDevice""REDACTED""SourceFileExtension"":""REDACTED"",""SiteUrl"":""REDACTED"",""SourceFileName"":""REDACTED"",""SourceRelativeUrl"":""REDACTED""}","REDACTED","REDACTED","REDACTED","REDACTED","REDACTED"


问:
Visual studio 2022 does not show project base net 6.0
I created a project wpf .net 6.0, 7.0 on visual studio 2022. Solution Explorer of Visual studio did not show my project.
enter image description here
At the left-bottom of VS indexing files run forever.
enter image description here

Projects base on Net Framework is work normally.

Who have any solution for this issue?
Thank you very much


问:
React import trows error and stops rendering page
I am following React tutorial.
I have this component.

```<code>  export default function Header(){
    return (<header>
        <nav className="nav-bar">
        <img src="../img/react.png" className="logo" ></img>
        <ul className="nav-items">
            <li className="nav-item">Pricing</li>
            <li className="nav-item">About</li>
            <li className="nav-item">Contact</li>
        </ul>
        </nav>
    </header>)
  }
</code>```

And I am trying to import it in this file

```<code>import Header from "./Header";

const rootEl = document.getElementById("root");

function Footer(){
    return(
        <footer className="footer">
            <p>@ 2022 LastName developed. All rights reserved</p>
        </footer>
    )
}
function MainContent(){
    return(
        <div>
            <h2>Reasons I want to learn React</h2>
            <ol>
                <li>List item 1</li>
                <li>List item 2</li>
                <li>List item 3</li>
            </ol>
        </div>
    )
}

function CustomPage()
{
    return (
        <div>

            <MainContent/>
            <Footer/>
        </div>

    )
}

ReactDOM.render(<CustomPage/>, rootEl);
</code>```

I am using CDNs to load react react-dom and babel

When I add import Header from "./Header"; console shows this error:

```<code>Uncaught ReferenceError: require is not defined
    at <anonymous>:3:15
    at eve (transformScriptTags.ts:99:10)
    at n (transformScriptTags.ts:173:9)
    at s (transformScriptTags.ts:204:11)
    at t.forEach.e.src.o.onreadystatechange (transformScriptTags.ts:121:9)
</code>```

Could it be a problem with CDN links or its something completely eslse?

Body:
I am following React tutorial.
I have this component.

  export default function Header(){
    return (

Pricing

About

Contact

    )
  }

And I am trying to import it in this file

import Header from "./Header";

const rootEl = document.getElementById("root");

function Footer(){
    return(

@ 2022 LastName developed. All rights reserved

    )
}
function MainContent(){
    return(

Reasons I want to learn React

List item 1

List item 2

List item 3

    )
}

function CustomPage()
{
    return (

            <MainContent/>

    )
}

ReactDOM.render(<CustomPage/>, rootEl);

I am using CDNs to load react react-dom and babel

When I add import Header from "./Header"; console shows this error:

Uncaught ReferenceError: require is not defined
    at <anonymous>:3:15
    at eve (transformScriptTags.ts:99:10)
    at n (transformScriptTags.ts:173:9)
    at s (transformScriptTags.ts:204:11)
    at t.forEach.e.src.o.onreadystatechange (transformScriptTags.ts:121:9)

Could it be a problem with CDN links or its something completely eslse?


问:
machine learning+deep learning+speech recognition
I run the code in my editor (VS Code) without any problems, but for next step and due to RAM and GPU limitation, I took it in colab, but got an error that seems to be due to mismatch of versions due to transfer from my editor to colab. how can i fix  this problem?

The current version of python running on Google Colab is 3.8.16, I used tensorflow 2.3.0 and keras 2.4.3.

The error is related to this part of code when use the model.fit() for train the model:

(I use CTC_loss in model):

model.fit(
    train_dg,
    validation_data=val_dg,
    epochs=args.epochs,
    callbacks=[PlotLossesKeras(),
        early_stopping,
        cp,
        csv_logger,
        lrs]
)
```
<p>But I got this error:</p>
```----------------------------------------------------------------------------------------------------
**Epoch 00001: LearningRateScheduler reducing learning rate to 0.001. Epoch 1/300
-----------**---------------------------------------------------------------- InvalidArgumentError                      Traceback (most recent call last) <ipython-input-87-2b4ea6811b43> in <module>
----> 1 model.fit(train_dg,validation_data=val_dg,epochs=args.epochs,callbacks=[PlotLossesKeras(),early_stopping,cp,csv_logger,lrs])

9 frames /usr/local/lib/python3.8/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     57   try:
     58     ctx.ensure_initialized()
---> 59     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
     60                                         inputs, attrs, num_outputs)
     61   except core._NotOkStatusException as e:

InvalidArgumentError:  Saw a non-null label (index >= num_classes - 1) following a null label, batch: 2 num_classes: 16 labels: 16,0,0,0,0,0,0 labels seen so far:       [[node functional_3/CTCloss/CTCLoss (defined at <ipython-input-17-1689d20fc46d>:887) ]] [Op:__inference_train_function_6401]

Function call stack: train_function

---------------------------------------------------------------------------------------
```

I try change the version of python in colab but it dosent work.
also change num_classes in the last layer of my model, it dosent work too.

Body:
I run the code in my editor (VS Code) without any problems, but for next step and due to RAM and GPU limitation, I took it in colab, but got an error that seems to be due to mismatch of versions due to transfer from my editor to colab. how can i fix  this problem?

The current version of python running on Google Colab is 3.8.16, I used tensorflow 2.3.0 and keras 2.4.3.

The error is related to this part of code when use the model.fit() for train the model:

(I use CTC_loss in model):

model.fit(
    train_dg,
    validation_data=val_dg,
    epochs=args.epochs,
    callbacks=[PlotLossesKeras(),
        early_stopping,
        cp,
        csv_logger,
        lrs]
)

But I got this error:

----------------------------------------------------------------------------------------------------
**Epoch 00001: LearningRateScheduler reducing learning rate to 0.001. Epoch 1/300
-----------**---------------------------------------------------------------- InvalidArgumentError                      Traceback (most recent call last) <ipython-input-87-2b4ea6811b43> in <module>
----> 1 model.fit(train_dg,validation_data=val_dg,epochs=args.epochs,callbacks=[PlotLossesKeras(),early_stopping,cp,csv_logger,lrs])

9 frames /usr/local/lib/python3.8/dist-packages/tensorflow/python/eager/execute.py in quick_execute(op_name, num_outputs, inputs, attrs, ctx, name)
     57   try:
     58     ctx.ensure_initialized()
---> 59     tensors = pywrap_tfe.TFE_Py_Execute(ctx._handle, device_name, op_name,
     60                                         inputs, attrs, num_outputs)
     61   except core._NotOkStatusException as e:

InvalidArgumentError:  Saw a non-null label (index >= num_classes - 1) following a null label, batch: 2 num_classes: 16 labels: 16,0,0,0,0,0,0 labels seen so far:       [[node functional_3/CTCloss/CTCLoss (defined at <ipython-input-17-1689d20fc46d>:887) ]] [Op:__inference_train_function_6401]

Function call stack: train_function

---------------------------------------------------------------------------------------

I try change the version of python in colab but it dosent work.
also change num_classes in the last layer of my model, it dosent work too.


问:
Use index of values in each bin of a histogram to bin other arrays in python
I am binning some data using np.hist, i.e. histo, edges = np.hist(array, bins=100). Now, I need to use the indices of the data points in each bin to get the equivalent values from some other arrays (named for example array1, array2, ..) to get 100 (i.e. nbins) sets of values. If this was the case of a single bound, I could easily do

```<code>ia = np.where((array>=edges[lower]) & (array<edges[upper]))
xa = list(set(ia[0]))
new1= array1[xa]
new2 = array2[xa]
...
...
...
</code>```

But I can't find an efficient method to do it for the binned data. Is there a way to do this?

Edit:

After much looking around, I found a rather inelegant solution.

```<code>dict_ = {}

for i in range(len(bins)-1):
    ii = np.where((array>=edges[i])&(array<edges[i+1]))
    xx = list(set(ii[0]))
    dict_[i] = xx

new_lst = []
for val in dict_.values():
    new_lst.append(val)
</code>```

The variable new_lst is a list of indices listed for each bin. Finally, doing

```<code>for i in range(len(new_lst)):
    hh = list(set(res[i]))
    array1_select = array1[hh]
    ...some operation...
</code>```

This seems to do the trick for now. However, if someone as a more efficient solution, let me know.

Body:
I am binning some data using np.hist, i.e. histo, edges = np.hist(array, bins=100). Now, I need to use the indices of the data points in each bin to get the equivalent values from some other arrays (named for example array1, array2, ..) to get 100 (i.e. nbins) sets of values. If this was the case of a single bound, I could easily do

ia = np.where((array>=edges[lower]) & (array<edges[upper]))
xa = list(set(ia[0]))
new1= array1[xa]
new2 = array2[xa]
...
...
...

But I can't find an efficient method to do it for the binned data. Is there a way to do this?

Edit:

After much looking around, I found a rather inelegant solution.

dict_ = {}

for i in range(len(bins)-1):
    ii = np.where((array>=edges[i])&(array<edges[i+1]))
    xx = list(set(ii[0]))
    dict_[i] = xx

new_lst = []
for val in dict_.values():
    new_lst.append(val)

The variable new_lst is a list of indices listed for each bin. Finally, doing

for i in range(len(new_lst)):
    hh = list(set(res[i]))
    array1_select = array1[hh]
    ...some operation...

This seems to do the trick for now. However, if someone as a more efficient solution, let me know.


问:
Can i install MaterialDesign on my "C# WPF .NET Framework 4.52 project" the 2.0.9 MaterialDesignColors?
I'm developing a C# WPF .NET Framework 4.52 project and I want to use Material Design. I could intall MaterialDesignThemes but I couldn't to MaterialDesignColors and this produces dependencies errors. I don't know if I'm doing something wrong or if it's impossible to do it.

I really aprecciate your replies,

Thank you!


问:
I tried to use postman to post on mongodb but it give me this eror
Hi I want to know how to fix this error. I tried to post data using postman on to mongodb but it give the the following error.

```<code>{
    "message": "Product validation failed: _id: Cast to ObjectId failed for value \"1\" (type string) at path \"_id\"",
    "stack": "ValidationError: Product validation failed: _id: Cast to ObjectId failed for value \"1\" (type string) at path \"_id\"\n    at model.Document.invalidate (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\document.js:2917:32)\n    at model.$set (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\document.js:1454:12)\n    at model.$set (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\document.js:1149:16)\n    at model.Document (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\document.js:158:12)\n    at model.Model (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\model.js:107:12)\n    at new model (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\model.js:4792:15)\n    at Array.<anonymous> (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\model.js:3336:17)\n    at _start (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\helpers\\parallelLimit.js:27:37)\n    at parallelLimit (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\helpers\\parallelLimit.js:23:5)\n    at Function.Model.$__insertMany (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\model.js:3366:3)"
}
</code>```

and here are the data i want to post

```<code>const products = [
  {
    _id: "1",
    name: "Velcro Ballerinas For Girls  (Pink)",
    image: "/images/6.png",
    description:
      "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",
    price: 89,
    countInStock: 3,
    rating: 4,
    numReviews: 4,
  },
  {
    _id: "2",
    name: "Velcro Sneakers For Boys & Girls  (Blue)",
    image: "/images/5.png",
    description:
      "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",
    price: 599,
    countInStock: 10,
    rating: 2,
    numReviews: 2,
  },
  {
    _id: "3",
    name: "Sesame Street Unisex-Child ELMO Puppet Slipper",
    image: "/images/4.png",
    description:
      "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",
    price: 929,
    countInStock: 0,
    rating: 3.5,
    numReviews: 3,
  },
  {
    _id: "4",
    name: "Lace Casual Boots For Boys & Girls  (Tan)",
    image: "/images/3.png",
    description:
      "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",
    price: 399,
    countInStock: 10,
    rating: 5,
    numReviews: 9,
  },
  {
    _id: "5",
    name: "Lace Walking Shoes For Boys & Girls  (Pink)",
    image: "/images/2.png",
    description:
      "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",
    price: 49,
    countInStock: 7,
    rating: 2,
    numReviews: 2,
  },
  {
    _id: "6",
    name: "Women Red Heels Sandal",
    image: "/images/1.png",
    description:
      "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",
    price: 29,
    countInStock: 0,
    rating: 0,
    numReviews: 0,
  },
];

export default products;
</code>```

I have my port on 5000 and using the command
http://localhost:5000/api/import/products to post but it does not work.

I tried to change the value inside the local file but it still doesn't work

Body:
Hi I want to know how to fix this error. I tried to post data using postman on to mongodb but it give the the following error.

{
    "message": "Product validation failed: _id: Cast to ObjectId failed for value \"1\" (type string) at path \"_id\"",
    "stack": "ValidationError: Product validation failed: _id: Cast to ObjectId failed for value \"1\" (type string) at path \"_id\"\n    at model.Document.invalidate (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\document.js:2917:32)\n    at model.$set (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\document.js:1454:12)\n    at model.$set (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\document.js:1149:16)\n    at model.Document (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\document.js:158:12)\n    at model.Model (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\model.js:107:12)\n    at new model (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\model.js:4792:15)\n    at Array.<anonymous> (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\model.js:3336:17)\n    at _start (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\helpers\\parallelLimit.js:27:37)\n    at parallelLimit (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\helpers\\parallelLimit.js:23:5)\n    at Function.Model.$__insertMany (D:\\Uni\\SE_Y3\\Semester 1\\Web Programming\\Project code\\Uptown_Book\\server\\node_modules\\mongoose\\lib\\model.js:3366:3)"
}

and here are the data i want to post

const products = [
  {
    _id: "1",
    name: "Velcro Ballerinas For Girls  (Pink)",
    image: "/images/6.png",
    description:
      "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",
    price: 89,
    countInStock: 3,
    rating: 4,
    numReviews: 4,
  },
  {
    _id: "2",
    name: "Velcro Sneakers For Boys & Girls  (Blue)",
    image: "/images/5.png",
    description:
      "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",
    price: 599,
    countInStock: 10,
    rating: 2,
    numReviews: 2,
  },
  {
    _id: "3",
    name: "Sesame Street Unisex-Child ELMO Puppet Slipper",
    image: "/images/4.png",
    description:
      "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",
    price: 929,
    countInStock: 0,
    rating: 3.5,
    numReviews: 3,
  },
  {
    _id: "4",
    name: "Lace Casual Boots For Boys & Girls  (Tan)",
    image: "/images/3.png",
    description:
      "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",
    price: 399,
    countInStock: 10,
    rating: 5,
    numReviews: 9,
  },
  {
    _id: "5",
    name: "Lace Walking Shoes For Boys & Girls  (Pink)",
    image: "/images/2.png",
    description:
      "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",
    price: 49,
    countInStock: 7,
    rating: 2,
    numReviews: 2,
  },
  {
    _id: "6",
    name: "Women Red Heels Sandal",
    image: "/images/1.png",
    description:
      "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",
    price: 29,
    countInStock: 0,
    rating: 0,
    numReviews: 0,
  },
];

export default products;

I have my port on 5000 and using the command
http://localhost:5000/api/import/products to post but it does not work.

I tried to change the value inside the local file but it still doesn't work


问:
Cosmos DB Trigger is not working after upgrading WebJobs.Extensions.CosmosDB and WebJobs.Extensions.Storage to latest version
Error is showed after upgrading Cosmos DB and storage in web jobs extension .

We have upgraded the project to .NET 6 and upgraded azure functions sdk to latest version.


问:
not generating report in windows rdlc report viewer 2012
I have a system which uses Microsoft SDLC ReportViewer 2012, i watched a video on YT on how to integrate this on my system but as i do it my system can't create the report, as it was on the video it should create it in the path just like below


问:
Getting error in MongoDB API error connecting to Cosmos DB
Getting below error in intermittent way while mongo API connecting cosmos db.
Can anyone please help us on this?

```<code>Error occoured in NfcQueueTrigger function. StackTrace :    at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ProcessResponse(ConnectionId connectionId, CommandMessage responseMessage)
   at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocolAsync[TResult](IWireProtocol`1 protocol, ICoreSession session, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.RetryableWriteOperationExecutor.ExecuteAsync[TResult](IRetryableWriteOperation`1 operation, RetryableWriteContext context, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkUnmixedWriteOperationBase`1.ExecuteBatchAsync(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkUnmixedWriteOperationBase`1.ExecuteBatchesAsync(RetryableWriteContext context, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.ExecuteBatchAsync(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.ExecuteWriteOperationAsync[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.ExecuteWriteOperationAsync[TResult](IClientSessionHandle session, IWriteOperation1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.BulkWriteAsync(IClientSessionHandle session, IEnumerable1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.UsingImplicitSessionAsync[TResult](Func2 funcAsync, CancellationToken cancellationToken)
   at NFCServicesKastleAzureFunction.NfcQueueTrigger.Run(String myQueueItem, ILogger log)
</code>```

Below is the sample connection string we are using..

"MongoConnectionString": "mongodb://xxx-xxx-xxx-01:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==@xxxx-xxxx-xxx-01.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@xxxx-xxxx-xxxx-01@",
```

tried to run in local but didnt get the error there. Its coming during server call and that also intermittently.

Body:
Getting below error in intermittent way while mongo API connecting cosmos db.
Can anyone please help us on this?

Error occoured in NfcQueueTrigger function. StackTrace :    at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ProcessResponse(ConnectionId connectionId, CommandMessage responseMessage)
   at MongoDB.Driver.Core.WireProtocol.CommandUsingCommandMessageWireProtocol`1.ExecuteAsync(IConnection connection, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Servers.Server.ServerChannel.ExecuteProtocolAsync[TResult](IWireProtocol`1 protocol, ICoreSession session, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.RetryableWriteOperationExecutor.ExecuteAsync[TResult](IRetryableWriteOperation`1 operation, RetryableWriteContext context, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkUnmixedWriteOperationBase`1.ExecuteBatchAsync(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkUnmixedWriteOperationBase`1.ExecuteBatchesAsync(RetryableWriteContext context, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.ExecuteBatchAsync(RetryableWriteContext context, Batch batch, CancellationToken cancellationToken)
   at MongoDB.Driver.Core.Operations.BulkMixedWriteOperation.ExecuteAsync(IWriteBinding binding, CancellationToken cancellationToken)
   at MongoDB.Driver.OperationExecutor.ExecuteWriteOperationAsync[TResult](IWriteBinding binding, IWriteOperation`1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.ExecuteWriteOperationAsync[TResult](IClientSessionHandle session, IWriteOperation1 operation, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.BulkWriteAsync(IClientSessionHandle session, IEnumerable1 requests, BulkWriteOptions options, CancellationToken cancellationToken)
   at MongoDB.Driver.MongoCollectionImpl1.UsingImplicitSessionAsync[TResult](Func2 funcAsync, CancellationToken cancellationToken)
   at NFCServicesKastleAzureFunction.NfcQueueTrigger.Run(String myQueueItem, ILogger log)

Below is the sample connection string we are using..

"MongoConnectionString": "mongodb://xxx-xxx-xxx-01:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx==@xxxx-xxxx-xxx-01.mongo.cosmos.azure.com:10255/?ssl=true&replicaSet=globaldb&retrywrites=false&maxIdleTimeMS=120000&appName=@xxxx-xxxx-xxxx-01@",

tried to run in local but didnt get the error there. Its coming during server call and that also intermittently.


问:
How can I memoize redux state?
I'm struggling with useSelector in component and I would like to memoize the value of useSelector to just read the value from the cache if other states changes and don't get the state from redux for every component rerender.
Here's the selector which I've used in parent component:

```<code>const campaignListSelector = createSelector(
        (state) => state.campaignReducer,
        campaignReducer => campaignReducer.campaignList ? campaignReducer.campaignList.campaigns : []
    );

const campaigns = useSelector(campaignListSelector);
</code>```

Also I have a component which is called Button:

```<code>const Button = React.memo(({ onClick, counter, title }) => {
    return <button onClick={onClick}>{counter}</button>
})
</code>```

And this is the code which I've developed in parent component:

```<code>const ParentComponent = (props) => {
const dispatch = useDispatch()
const [state, setState] = React.useState({
        pageNo: 1,
        counter: 0,
})
useEffect(() => {
    console.log("state.pageNo", state.pageNo)
    dispatch(CampaignActionCreators.fetchCampaignList(state.pageNo, -1, null, null, 'All', '', 'All'));
}, [state.pageNo])}

const campaignListSelector = createSelector(
    (state) => state.campaignReducer,
    campaignReducer => campaignReducer.campaignList ? campaignReducer.campaignList.campaigns : []
);

const campaigns = useSelector(campaignListSelector);

const table = React.useMemo(() => {
    console.log(campaignList)
    return <table className="table table-list-layout">
        <thead>
            <tr>
                <th width="15%">
                    {Utils.i18n('campaign', true)}
                </th>
                <th className="text-center">
                    {Utils.i18n('campaignSetting', true)}
                </th>
            </tr>
        </thead>
        <tbody>
            {campaignList && campaignList.map((campaign, index) => (
                <tr key={index}>
                    <td>
                        <LinkButton to={`/Campaign/View?id=${campaign.id}`}
                            text={campaign.title}
                        />
                    <td className="text-center">
                        -
                    </td>
                </tr>
            ))}
        </tbody>
    </table>
})

const onClick = () =>
    setState({
        ...state,
        counter: state.counter + 1
    })

return <React.Fragment>
    <Button onClick={onClick} counter={state.counter} />
    {table}
</React.Fragment>
</code>```

My problem is that every time I click on the Button compponent, table value which I've used it with React.memo will be re-rendered and console.log(campaignList) will show a line on the console. How can I prevent table from re-rendering while I just click on button and inline state of the ParentComponent will be changed? How can I memoize the value of campaigns?

Title: How can I memoize redux state?

Body:
I'm struggling with useSelector in component and I would like to memoize the value of useSelector to just read the value from the cache if other states changes and don't get the state from redux for every component rerender.
Here's the selector which I've used in parent component:

const campaignListSelector = createSelector(
        (state) => state.campaignReducer,
        campaignReducer => campaignReducer.campaignList ? campaignReducer.campaignList.campaigns : []
    );

const campaigns = useSelector(campaignListSelector);

Also I have a component which is called Button:

const Button = React.memo(({ onClick, counter, title }) => {
    return <button onClick={onClick}>{counter}</button>
})

And this is the code which I've developed in parent component:

const ParentComponent = (props) => {
const dispatch = useDispatch()
const [state, setState] = React.useState({
        pageNo: 1,
        counter: 0,
})
useEffect(() => {
    console.log("state.pageNo", state.pageNo)
    dispatch(CampaignActionCreators.fetchCampaignList(state.pageNo, -1, null, null, 'All', '', 'All'));
}, [state.pageNo])}

const campaignListSelector = createSelector(
    (state) => state.campaignReducer,
    campaignReducer => campaignReducer.campaignList ? campaignReducer.campaignList.campaigns : []
);

const campaigns = useSelector(campaignListSelector);

const table = React.useMemo(() => {
    console.log(campaignList)
    return

                    {Utils.i18n('campaign', true)}

                    {Utils.i18n('campaignSetting', true)}

            {campaignList && campaignList.map((campaign, index) => (

                        <LinkButton to={`/Campaign/View?id=${campaign.id}`}
                            text={campaign.title}
                        />

                        -

            ))}

})

const onClick = () =>
    setState({
        ...state,
        counter: state.counter + 1
    })

return <React.Fragment>
    <Button onClick={onClick} counter={state.counter} />
    {table}
</React.Fragment>

My problem is that every time I click on the Button compponent, table value which I've used it with React.memo will be re-rendered and console.log(campaignList) will show a line on the console. How can I prevent table from re-rendering while I just click on button and inline state of the ParentComponent will be changed? How can I memoize the value of campaigns?


问:
Does twig have the equivalent of blades "@push" and or "@stack"
https://laravel.com/docs/9.x/blade#stacks

basically it lets you overwrite block multiple times, but instead of overwriting each other, each call appends to the block.

E.g.

```<code><head>
    <!-- Head Contents -->

    @stack('myscripts')
</head>
</code>```
```<code>@push('myscripts')
    <script src="/example11.js"></script>
@endpush
</code>```
```<code>@push('myscripts')
    <script src="/example22.js"></script>
@endpush
</code>```

results in

```<code><head>
    <!-- Head Contents -->

    <script src="/example11.js"></script>
    <script src="/example22.js"></script>
</head>
</code>```

Body:
https://laravel.com/docs/9.x/blade#stacks

basically it lets you overwrite block multiple times, but instead of overwriting each other, each call appends to the block.

E.g.

    @stack('myscripts')

@push('myscripts')

@endpush

@push('myscripts')

@endpush

results in


问:
How to avoid web crawlers and bots to call your script?
My website is having a script tag which links to a script which helps me keep track of all the user activity in my web page. My web page has click events linked to that script's function.

I want web crawlers and bots to either not load that script or send me wrong data from the click events.

Also want to know if web crawlers and bots can call the script scr or call the click events in my page and send me wrong data from that page. Is this possible??

Thank you in advance.

I checked the whole internet and found nothing, stackoverflow community can help!! Please.


问:
How to prevent extra build in github. Generated by git tag push
Earlier we were using the GITlab. Recently we are migrated to GITHUB. When I am commit a code in GITHUB it generating a build in jenkins via webhook push event.
But in my ansible code we are pushing a tag for the same code. It also generating a new build in jenkins with by default "build" branch name.

I need to prevent a build which is getting triggered by the tag push in jenkins. It causing a issue in our whole pipeline. Due to that we gave the optional filter for branch but It preventing our multibranching scenario.


问:
How to solve "Uncought TypeError: Cannot read properties" at React.js
camera's Json

"entity_id": "camera_3", "mode": "Home"

Light.js

```<code>const Camera = (props) = {

const { entity_id } = useParams();
const [camera, setCamera] = useState();
const [camera_position, setCameraPosition] = useState();

  const setCemaraHome = async(data) => {
    console.log("Body sent to server", {
      entity_id: entity_id,
    })
    await axios.post('xxx.com',
    {
      entity_id: entity_id,
    },
      {
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${cookies.get('accesstoken')}`
        },
      })
      .then(result => {
        console.log(result.data)
        console.log('Set Home!');
        setVal('Home');
        getDevices();
      })
      .catch(err => {
        console.log(err);
      });
  }

  const setCemaraAway = async(data) => {
    console.log("Body sent to server", {
      entity_id: entity_id,
    })
    await axios.post('xxx.com/',
    {
      entity_id: entity_id,
    },
      {
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${cookies.get('accesstoken')}`
        },
      })
      .then(result => {
        console.log(result.data)
        console.log('Set Away!');
        setVal('Away');
        getDevices();

      })
      .catch(err => {
        console.log(err);
      });
  }

const getDevices = async(data) => {
  await axios.get('/xxx.com/',
    {
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${cookies.get('accesstoken')}`
      },
    })
    .then(result => {
      console.log(result.data)
      setCamera(result.data.attributes.camera);
      setCameraPosition(camera.filter(c => c.entity_id === entity_id).map((item,i) =>  item.mode));

    })
    .catch(err => {
      console.log(err);
    });
}

// for Home mode Dropdown
const [val, setVal] = useState(camera_position[0]);

console.log(camera_position[0]);
console.log(val);

return (

                      <Dropdown.Menu className="home_mode_dropdown">
                        <Dropdown.Item className="home_mode_dropdown_item">
                            <div className="ic_schedule_label flex">
                              <input
                                className="home_mode_radio"
                                type="radio"
                                value="home"
                                onChange={setCemaraHome}
                                checked={val === 'Home'}
                              />
                              <img className="ic_home_mode" src={ic_home_mode} />
                              <p className="radio_text">Home</p>
                            </div>
                        </Dropdown.Item>
                        <Dropdown.Item className="home_mode_dropdown_item">
                            <div className="ic_schedule_label flex">
                              <input
                                className="home_mode_radio"
                                type="radio"
                                value="away"
                                onChange={setCemaraAway}
                                checked={val === 'Away'}
                              />
                              <img className="ic_away_mode" src={ic_away_mode} />
                              <p className="radio_text">Away</p>
                            </div>
                        </Dropdown.Item>
                      </Dropdown.Menu>
                    </Dropdown>

);
</code>```

`

on the initial screen

I check the following part in the console
console.log(camera_position);

I got

[]

but,
For example, by selecting "Home" with the radio button
and then the screen is rendered

['Home']

It will be displayed.
I don't quite understand this.
Then try to pull out "Home"

So I write
console.log(camera_position[0]);
and reload,

I get the following error.
Uncought TypeError: Cannot read properties of Light.js undefined (reading "0")
I don't know why...

On the initial screen when the page is opened
On the radio buttons (Home and Away are available) in the drop-down menu
I want to reflect the state of the backend.

For example, if the backend camera position (mode field) is Home
The Home radio button is checked.

Conversely
If the backend camera position (mode field) is Away
The Away radio button is checked.

enter image description here

Body:
camera's Json

"entity_id": "camera_3", "mode": "Home"

Light.js

const Camera = (props) = {

const { entity_id } = useParams();
const [camera, setCamera] = useState();
const [camera_position, setCameraPosition] = useState();

  const setCemaraHome = async(data) => {
    console.log("Body sent to server", {
      entity_id: entity_id,
    })
    await axios.post('xxx.com',
    {
      entity_id: entity_id,
    },
      {
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${cookies.get('accesstoken')}`
        },
      })
      .then(result => {
        console.log(result.data)
        console.log('Set Home!');
        setVal('Home');
        getDevices();
      })
      .catch(err => {
        console.log(err);
      });
  }

  const setCemaraAway = async(data) => {
    console.log("Body sent to server", {
      entity_id: entity_id,
    })
    await axios.post('xxx.com/',
    {
      entity_id: entity_id,
    },
      {
        headers: {
          'Content-Type': 'application/json',
          'Authorization': `Bearer ${cookies.get('accesstoken')}`
        },
      })
      .then(result => {
        console.log(result.data)
        console.log('Set Away!');
        setVal('Away');
        getDevices();

      })
      .catch(err => {
        console.log(err);
      });
  }

const getDevices = async(data) => {
  await axios.get('/xxx.com/',
    {
      headers: {
        'Content-Type': 'application/json',
        'Authorization': `Bearer ${cookies.get('accesstoken')}`
      },
    })
    .then(result => {
      console.log(result.data)
      setCamera(result.data.attributes.camera);
      setCameraPosition(camera.filter(c => c.entity_id === entity_id).map((item,i) =>  item.mode));

    })
    .catch(err => {
      console.log(err);
    });
}

// for Home mode Dropdown
const [val, setVal] = useState(camera_position[0]);

console.log(camera_position[0]);
console.log(val);

return (

                      <Dropdown.Menu className="home_mode_dropdown">
                        <Dropdown.Item className="home_mode_dropdown_item">

                              <input
                                className="home_mode_radio"
                                type="radio"
                                value="home"
                                onChange={setCemaraHome}
                                checked={val === 'Home'}
                              />

Home

                        </Dropdown.Item>
                        <Dropdown.Item className="home_mode_dropdown_item">

                              <input
                                className="home_mode_radio"
                                type="radio"
                                value="away"
                                onChange={setCemaraAway}
                                checked={val === 'Away'}
                              />

Away

                        </Dropdown.Item>
                      </Dropdown.Menu>
                    </Dropdown>

);

`

on the initial screen

I check the following part in the console
console.log(camera_position);

I got

[]

but,
For example, by selecting "Home" with the radio button
and then the screen is rendered

['Home']

It will be displayed.
I don't quite understand this.
Then try to pull out "Home"

So I write
console.log(camera_position[0]);
and reload,

I get the following error.
Uncought TypeError: Cannot read properties of Light.js undefined (reading "0")
I don't know why...

On the initial screen when the page is opened
On the radio buttons (Home and Away are available) in the drop-down menu
I want to reflect the state of the backend.

For example, if the backend camera position (mode field) is Home
The Home radio button is checked.

Conversely
If the backend camera position (mode field) is Away
The Away radio button is checked.

enter image description here


问:
Content Management-, Shop-System and Framework recognition with Tensorflow/Keras
I am very new to the World of Machine learning and up until now I've only done Tutorials and Example-Projects on this topic. I'm currently working on my first actual project and (hopefully apt) implementation of Machine Learning for my purpose.

The purpose is fairly simple: I want to automatically detect the Name of a known Content Management- (WordPress, TYPO3, Joomla!, Drupal, ...), Shop-System (Shopware5, Shopware6, Magento2, ...) or Framework (Symphony, Laravel, ...) only by using a list of files and directories from the document root of one of these systems with a max-depth of 3 directories.

I have nearly 150k installations of 22 different systems of which I know what system they are. Sadly my tool set on the Web servers, where those installations lie is limited. With these informations my though process was like this:

If I get a file-list of each of these installation's document root plus 2 directory levels recoursively (with unix tools (find mostly)) and optimize the output by filtering out known big directories like cache, media storage, libraries, ... I should get a List of 30 to 80 files and directories that should be iconic for the system at hand.

If I then use python to parse this list as JSON, I should be able to compile a list of nearly 150k example file-list-JSON, and their corresponding Software as a tag. With this I should be able to train a TF model.

Afterwards the model should be able to tell me what software is in use when I only give him a JSON of the directory list of the document root of an unknown system (that is one of the 22 known systems) which was created in the same way as the training data.

My focus is not the Performance of gathering the training data and the Performance of the training itself. I only want a fast way to later on identify a single system based on the directory and file list.

Now my problem is that I kinda lack the experience to know if this is going to work in the first place, if the JSON needs a certain format to work with TF or Keras or if this is even the most efficient way to do it.

any advice, hint, link to comparable project documentations or helpful docs in general is very welcome!

EDIT: Small addition to make it a little bit more transparent.

PHP based Content Management and Shop Systems have a vaguely similar Filestructure but everyone does what they want so the biggest similarity is a file that is served to the Apache Webserver, A configuration file containing the Databasecredentials, directories for themes, frontend, backend, libraries/plugins and so on.

naming conventions, order and hierarchy vary between the different systems.

So lets use an example.

Magento1: My initial thought as described above was to get a List of files with a simple find command with a maxdepth of 3 that also outputs if its a file ";f" or a directory ";d" and using grep afterwards to filter out the more redundant stuff like cache contents, user uploads and so on.

From this I get a list like this:

```<code>./index.php;f
./get.php;f
./cron.php;f
./api.php;f
./shell;d
./shell/log.php;f
./shell/compiler.php;f
./shell/abstract.php;f
./shell/.htaccess;f
./shell/indexer.php;f
./mage;f
./skin;d
./skin/frontend;d
./skin/frontend/rwd;d
./skin/frontend/base;d
./skin/frontend/default;d
./skin/adminhtml;d
./skin/adminhtml/default;d
./install;d
./install/default;d
./install.php;f
./app;d
./app/code;d
./app/code/core;d
./app/code/community;d
./app/Mage.php;f
./app/.htaccess;f
...
</code>```

parsed as json I imagined it as something like this:

```<code>[
  {
    "name": "index.php",
    "type": "file"
  },
  {
    "name": "get.php",
    "type":  "file"
  },
    {
    "name": "cron.php",
    "type": "file"
  },
  {
    "name": "api.php",
    "type": "file"
  },
  {
    "name": "shell",
    "type": "directory",
    "children": [
      {
        "name": "log.php",
        "type": "file"
      },
      {
        "name": "compiler.php",
        "type": "file"
      },
      {
        "name": "abstact.php",
        "type": "file"
      },
      {
        "name": ".htaccess",
        "type": "file"
      },
      {
        "name": "indexer.php",
        "type": "file"
      }
    ]
  },
  {
    "name": "mage",
    "type": "file"
  },
  {
    "name": "skin",
    "type": "directory",
    "children": [
      {
        "name": "frontend",
        "type": "directory",
        "children": [
          {
            "name": "rwd",
            "type": "directory"
          },
          {
            "name": "base",
            "type": "directory"
          },
          {
            "name": "default",
            "type": "directory"
          }
        ]
      },
      {
        "name": "adminhtml",
        "type": "directory",
        "children": [
          {
            "name": "default",
            "type": "directory"
          }
        ]
      },
      {
        "name": "install",
        "type": "directory",
        "children": [
          {
            "name": "default",
            "type": "directory"
          }
        ]
      }
    ]
  },
  {
    "name": "install.php",
    "type": "file"
  },
  {
    "name": "app",
    "type": "directory",
    "children": [
      {
        "name": "code",
        "type": "directory",
        "children": [
          {
            "name": "core",
            "type": "directory"
          },
          {
            "name": "community",
            "type": "directory"
          }
        ]
      },
      {
        "name": "Mage.php",
        "type": "file"
      },
      {
        "name": ".htaccess",
        "type": "file"
      },
...
</code>```

if I minify this I have a json in the form of something like this:

```<code>[{"name":"index.php","type":"file"},{"name":"get.php","type":"file"},{"name":"cron.php","type":"file"},{"name":"api.php","type":"file"},{"name":"shell","type":"directory","children":[{"name":"log.php","type":"file"},{"name":"compiler.php","type":"file"},{"name":"abstact.php","type":"file"},{"name":".htaccess","type":"file"},{"name":"indexer.php","type":"file"}]},{"name":"mage","type":"file"},{"name":"skin","type":"directory","children":[{"name":"frontend","type":"directory","children":[{"name":"rwd","type":"directory"},{"name":"base","type":"directory"},{"name":"default","type":"directory"}]},{"name":"adminhtml","type":"directory","children":[{"name":"default","type":"directory"}]},{"name":"install","type":"directory","children":[{"name":"default","type":"directory"}]}]},{"name":"install.php","type":"file"},{"name":"app","type":"directory","children":[{"name":"code","type":"directory","children":[{"name":"core","type":"directory"},{"name":"community","type":"directory"}]},{"name":"Mage.php","type":"file"},{"name":".htaccess","type":"file"}...
</code>```

If I pour 150k of these into tensorflow, with a second list withe corelating labels for the 22 systems these filesystems represent, will it be able to tell me what label an until then not known json list of files and directories has? Will it be able to identify a different magento installation as Magento1 for example?

Body:
I am very new to the World of Machine learning and up until now I've only done Tutorials and Example-Projects on this topic. I'm currently working on my first actual project and (hopefully apt) implementation of Machine Learning for my purpose.

The purpose is fairly simple: I want to automatically detect the Name of a known Content Management- (WordPress, TYPO3, Joomla!, Drupal, ...), Shop-System (Shopware5, Shopware6, Magento2, ...) or Framework (Symphony, Laravel, ...) only by using a list of files and directories from the document root of one of these systems with a max-depth of 3 directories.

I have nearly 150k installations of 22 different systems of which I know what system they are. Sadly my tool set on the Web servers, where those installations lie is limited. With these informations my though process was like this:

If I get a file-list of each of these installation's document root plus 2 directory levels recoursively (with unix tools (find mostly)) and optimize the output by filtering out known big directories like cache, media storage, libraries, ... I should get a List of 30 to 80 files and directories that should be iconic for the system at hand.

If I then use python to parse this list as JSON, I should be able to compile a list of nearly 150k example file-list-JSON, and their corresponding Software as a tag. With this I should be able to train a TF model.

Afterwards the model should be able to tell me what software is in use when I only give him a JSON of the directory list of the document root of an unknown system (that is one of the 22 known systems) which was created in the same way as the training data.

My focus is not the Performance of gathering the training data and the Performance of the training itself. I only want a fast way to later on identify a single system based on the directory and file list.

Now my problem is that I kinda lack the experience to know if this is going to work in the first place, if the JSON needs a certain format to work with TF or Keras or if this is even the most efficient way to do it.

any advice, hint, link to comparable project documentations or helpful docs in general is very welcome!

EDIT: Small addition to make it a little bit more transparent.

PHP based Content Management and Shop Systems have a vaguely similar Filestructure but everyone does what they want so the biggest similarity is a file that is served to the Apache Webserver, A configuration file containing the Databasecredentials, directories for themes, frontend, backend, libraries/plugins and so on.

naming conventions, order and hierarchy vary between the different systems.

So lets use an example.

Magento1: My initial thought as described above was to get a List of files with a simple find command with a maxdepth of 3 that also outputs if its a file ";f" or a directory ";d" and using grep afterwards to filter out the more redundant stuff like cache contents, user uploads and so on.

From this I get a list like this:

./index.php;f
./get.php;f
./cron.php;f
./api.php;f
./shell;d
./shell/log.php;f
./shell/compiler.php;f
./shell/abstract.php;f
./shell/.htaccess;f
./shell/indexer.php;f
./mage;f
./skin;d
./skin/frontend;d
./skin/frontend/rwd;d
./skin/frontend/base;d
./skin/frontend/default;d
./skin/adminhtml;d
./skin/adminhtml/default;d
./install;d
./install/default;d
./install.php;f
./app;d
./app/code;d
./app/code/core;d
./app/code/community;d
./app/Mage.php;f
./app/.htaccess;f
...

parsed as json I imagined it as something like this:

[
  {
    "name": "index.php",
    "type": "file"
  },
  {
    "name": "get.php",
    "type":  "file"
  },
    {
    "name": "cron.php",
    "type": "file"
  },
  {
    "name": "api.php",
    "type": "file"
  },
  {
    "name": "shell",
    "type": "directory",
    "children": [
      {
        "name": "log.php",
        "type": "file"
      },
      {
        "name": "compiler.php",
        "type": "file"
      },
      {
        "name": "abstact.php",
        "type": "file"
      },
      {
        "name": ".htaccess",
        "type": "file"
      },
      {
        "name": "indexer.php",
        "type": "file"
      }
    ]
  },
  {
    "name": "mage",
    "type": "file"
  },
  {
    "name": "skin",
    "type": "directory",
    "children": [
      {
        "name": "frontend",
        "type": "directory",
        "children": [
          {
            "name": "rwd",
            "type": "directory"
          },
          {
            "name": "base",
            "type": "directory"
          },
          {
            "name": "default",
            "type": "directory"
          }
        ]
      },
      {
        "name": "adminhtml",
        "type": "directory",
        "children": [
          {
            "name": "default",
            "type": "directory"
          }
        ]
      },
      {
        "name": "install",
        "type": "directory",
        "children": [
          {
            "name": "default",
            "type": "directory"
          }
        ]
      }
    ]
  },
  {
    "name": "install.php",
    "type": "file"
  },
  {
    "name": "app",
    "type": "directory",
    "children": [
      {
        "name": "code",
        "type": "directory",
        "children": [
          {
            "name": "core",
            "type": "directory"
          },
          {
            "name": "community",
            "type": "directory"
          }
        ]
      },
      {
        "name": "Mage.php",
        "type": "file"
      },
      {
        "name": ".htaccess",
        "type": "file"
      },
...

if I minify this I have a json in the form of something like this:

[{"name":"index.php","type":"file"},{"name":"get.php","type":"file"},{"name":"cron.php","type":"file"},{"name":"api.php","type":"file"},{"name":"shell","type":"directory","children":[{"name":"log.php","type":"file"},{"name":"compiler.php","type":"file"},{"name":"abstact.php","type":"file"},{"name":".htaccess","type":"file"},{"name":"indexer.php","type":"file"}]},{"name":"mage","type":"file"},{"name":"skin","type":"directory","children":[{"name":"frontend","type":"directory","children":[{"name":"rwd","type":"directory"},{"name":"base","type":"directory"},{"name":"default","type":"directory"}]},{"name":"adminhtml","type":"directory","children":[{"name":"default","type":"directory"}]},{"name":"install","type":"directory","children":[{"name":"default","type":"directory"}]}]},{"name":"install.php","type":"file"},{"name":"app","type":"directory","children":[{"name":"code","type":"directory","children":[{"name":"core","type":"directory"},{"name":"community","type":"directory"}]},{"name":"Mage.php","type":"file"},{"name":".htaccess","type":"file"}...

If I pour 150k of these into tensorflow, with a second list withe corelating labels for the 22 systems these filesystems represent, will it be able to tell me what label an until then not known json list of files and directories has? Will it be able to identify a different magento installation as Magento1 for example?


问:
Throttling working only for callback routes in laravel not for controller based routes
```<code>Route::post('login', [AuthController::class, 'login']);
Route::post('login',function () {
        echo 'hello';
    });
</code>```

In laravel throttling is not working for first kind of routes only working for later kind of routes where callback are used please help how to make it work in first kind of routes where controllers are used.

Body:
Route::post('login', [AuthController::class, 'login']);
Route::post('login',function () {
        echo 'hello';
    });

In laravel throttling is not working for first kind of routes only working for later kind of routes where callback are used please help how to make it work in first kind of routes where controllers are used.


问:
Python Azure Functions: is there a way to automate the choice of package versions to test which combination works?
I have the following requirements.txt:

```<code>pip==22.1.2
azure-functions
azure-functions-durable
datetime
requests==2.23.0
arcgis==1.8.0.post1
openpyxl==3.0.3
aiohttp==3.7.3
numpy
wheel
</code>```

and I need to use newer versions of arcgis. However, if I only change that version, I get errors related to other packages that are not compatible.

So, it would appear that this is a problem of combinations. Is there a way I can automate generating these combinations, launching a local debug in VS Code, and testing to see if the dependencies are resolved successfully?

Body:
I have the following requirements.txt:

pip==22.1.2
azure-functions
azure-functions-durable
datetime
requests==2.23.0
arcgis==1.8.0.post1
openpyxl==3.0.3
aiohttp==3.7.3
numpy
wheel

and I need to use newer versions of arcgis. However, if I only change that version, I get errors related to other packages that are not compatible.

So, it would appear that this is a problem of combinations. Is there a way I can automate generating these combinations, launching a local debug in VS Code, and testing to see if the dependencies are resolved successfully?


问:
Debounce method not executed in javascript
I have the following functions imported in a js file.

```<code>import {  debounce } from "@/abc/def";
</code>```

The handleAttributes function gets called from the following event listener from the same file.

```<code>export const attributesHandler = (canvas) => {
  bus.on("attributeChange", (attributes, object) => {
    handleAtrributes({ canvas, attributes, component: object });
  });
};

</code>```

The debounce method is not executed in the handleAtrributes function.

```<code>const handleAtrributes = async ({ attributes, canvas, component }) => {
    debounce(() => {
      getComponentScreenshot(component, canvas);
    }, 600);

};
</code>```

Body:
I have the following functions imported in a js file.

import {  debounce } from "@/abc/def";

The handleAttributes function gets called from the following event listener from the same file.

export const attributesHandler = (canvas) => {
  bus.on("attributeChange", (attributes, object) => {
    handleAtrributes({ canvas, attributes, component: object });
  });
};

The debounce method is not executed in the handleAtrributes function.

const handleAtrributes = async ({ attributes, canvas, component }) => {
    debounce(() => {
      getComponentScreenshot(component, canvas);
    }, 600);

};


问:
nconf returns undefined if dependency linked with npm link
I have two projects.
Let's say:
Project A, Project B
Project B is a dependent module in Project A

When we do npm start i.e. start the server for Project A, the nconf gets initialized with development env files succesfully and returns all the related env variables without any error.

For project B it also uses nconf for some of its module.

Now when I am normally installing the dependecies of Project A from npm install command, Project B gets installed but duplicate dependencies gets removed. And because of this when using any reference to nconf in Project B it uses the one present in Project A.

Since I am doing local dev I don't want to publish the Project B everytime I make some changes and thus came to know about npm link where we can create a symlink for the local packages.

But when I am creating a symlink for Project B in Project A. The duplicate dependencies are not getting removed from Project B node_modules as they were getting removed while doing npm install. And thus when Project A invokes any module of Project B which uses nconf, it does not finds the env files and thus returns undefined.

Things I've tried:

Using npm dedup on Project A to delete any duplicate dependencies, but instead of deleting the duplicate dependencies it is also removing the linked packages and is installing the published ones and therefore I can't test the local changes.

Deleting node_modules from Project B and then linking it to Project A, but now it says that nconf was not provided.

Using file based dependency load i.e, in dependencies object of Project A: {
projectB: "file:../projectB"
}. But again it is having the same issue.

I am expecting to npm link in the similar way as it does while doing npm install, or a way that Project B's nconf uses project A's initialized nconf file path.

Note: Both uses same version of nconf


问:
Header picture not showing on all pages (dynamics 365 power pages)
I'm making a demo page for a company. I have a problem, I want the logo to appear in the header, which it does in most of the pages. Not when an article is selected or a category is selected as shown in the first image: Image 1

I have added the web file of the logo in the Portal Management App, and it works on every page exept the categories and articles pages. Image 2
Image 3

Any ideas?

I've tried doing exactly as I've done with the other pages but it doesn't work.


问:
Why my code is failing the npm run test case
```<code>const mongoose=require('mongoose');
const assert = require('assert')

describe('Finding records', function () {

    var char;
    beforeEach(function (done) {
        char = new MarioChar({
            name: 'Mario'
        });

        char.save().then(function () {
            assert(char.isNew === false);
            done();
        });
    });
    it('Finds one record from the database', function (done) {

        findOne({ name: 'Mario' }).then(function (result) {
            assert(result.name === 'Mario');
            done();
        });

    });

    it('Finds one record from the database', function (done) {

        findOne({ _id: char._id }).then(function (result) {
            assert(result._id === char._id);
            done();
        });

    });

});
</code>```

The code is to find the records from MongoDB and
I have tried to pass these test case but these test case are failing therefore can someone please tell me where I am making mistake

Body:
const mongoose=require('mongoose');
const assert = require('assert')

describe('Finding records', function () {

    var char;
    beforeEach(function (done) {
        char = new MarioChar({
            name: 'Mario'
        });

        char.save().then(function () {
            assert(char.isNew === false);
            done();
        });
    });
    it('Finds one record from the database', function (done) {

        findOne({ name: 'Mario' }).then(function (result) {
            assert(result.name === 'Mario');
            done();
        });

    });

    it('Finds one record from the database', function (done) {

        findOne({ _id: char._id }).then(function (result) {
            assert(result._id === char._id);
            done();
        });

    });

});

The code is to find the records from MongoDB and
I have tried to pass these test case but these test case are failing therefore can someone please tell me where I am making mistake


问:
Thingworx query takes too long
In the backend queries execute very fast, however the queries for the interface are extremely slow. Thingworx connects to a SQL DB and the database works just fine. Tried to reboot TWX, also to store the data directly in TWX but it is so much that it does not work properly. Interface is using mainly graphs that picture several parameters with their value in a 15 min interval.</p>

Title: Thingworx query takes too long


问:
axios.create' is undefined
I am implementing axios interceptor in tsx for react native expo. I am geting following error:

TypeError: axios.create is not a function. (In 'axios
.create()', 'axios.create' is undefined).

How can I solve this?

Version for axios: "axios": "^1.2.1",

```<code>import { _retrieveData } from "./AsyncStorage";
const configData = require('../config/config.json');
const axios = require('axios');

const userApi = axios.create();

userApi.defaults.timeout = 4000;

userApi.interceptors.request.use(async (config: any) => {
    const token = await _retrieveData('token');
    config.headers.common = { 'Authorization': `Bearer ${token}` }
    return config;
}, (error: any) => {
    return Promise.reject(error);
});

export default userApi;
</code>```

Title: axios.create' is undefined

Body:
I am implementing axios interceptor in tsx for react native expo. I am geting following error:

TypeError: axios.create is not a function. (In 'axios
.create()', 'axios.create' is undefined).

How can I solve this?

Version for axios: "axios": "^1.2.1",

import { _retrieveData } from "./AsyncStorage";
const configData = require('../config/config.json');
const axios = require('axios');

const userApi = axios.create();

userApi.defaults.timeout = 4000;

userApi.interceptors.request.use(async (config: any) => {
    const token = await _retrieveData('token');
    config.headers.common = { 'Authorization': `Bearer ${token}` }
    return config;
}, (error: any) => {
    return Promise.reject(error);
});

export default userApi;


问:
How to get filtered dependency graph only for certain library
I am searching for uses of a certain library, with

```<code> ./gradlew :app:dependencies > output_file.txt
</code>```

and it is a very long file. and Is there any command that will only show me with compose as the library?

Body:
I am searching for uses of a certain library, with

 ./gradlew :app:dependencies > output_file.txt

and it is a very long file. and Is there any command that will only show me with compose as the library?


问:
Gtk-ERROR and shutdown when using zed wrapper and darknet ros together
I use Yolo for object detection in darknet.

Enviroment info
Ubuntu 20.04
ROS noetic
GPU Jetson xavier NX
Camera ZED
CUDA 11.4
openCV 4.2.0
ZED DSK 3.8.2(for jetpack 5.0)

Two terminals, each with

```<code>roslaunch darknet_ros darknet_ros yolo_v3.launch
</code>```

and

```<code>roslaunch zed_wrapper zed.launch
</code>```

were executed.
Then the darknet_ros terminal gave a Gtk-ERROR.

```<code>Gtk-ERROR **: 04:28:17.451: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported
</code>```

enter image description here

I used this link to resolve the conflict between openCV and matplotlib, but it did not solve the problem.
Gtk-ERROR **: GTK+ 2.x symbols detected

Node

```<code>/zed/zed_node/rgb_raw/image_raw_color
</code>```

of the ZED is available on darknet_ros.

How can I resolve GTK errors and perform object detection?

Thanks

Body:
I use Yolo for object detection in darknet.

Enviroment info
Ubuntu 20.04
ROS noetic
GPU Jetson xavier NX
Camera ZED
CUDA 11.4
openCV 4.2.0
ZED DSK 3.8.2(for jetpack 5.0)

Two terminals, each with

roslaunch darknet_ros darknet_ros yolo_v3.launch

and

roslaunch zed_wrapper zed.launch

were executed.
Then the darknet_ros terminal gave a Gtk-ERROR.

Gtk-ERROR **: 04:28:17.451: GTK+ 2.x symbols detected. Using GTK+ 2.x and GTK+ 3 in the same process is not supported

enter image description here

I used this link to resolve the conflict between openCV and matplotlib, but it did not solve the problem.
Gtk-ERROR **: GTK+ 2.x symbols detected

Node

/zed/zed_node/rgb_raw/image_raw_color

of the ZED is available on darknet_ros.

How can I resolve GTK errors and perform object detection?

Thanks