问:
My lazycolumn items and my textfield glide on the screen when the keyboard is opened in jetpack compose
I'm just at the beginning of a chat bot application and I'm showing dialogs with lazycolumn. I also have a textfield, the bot responds to the texts entered in this textfield and cards appear on the screen, but when the keyboard is opened, my lazycolumn items slide upwards and the textfield does not appear properly. To solve this, I used something called bringIntoViewRequester and

I added the following to
my

manifest android:windowSoftInputMode="adjustResize"

MainActivity window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)

I'll share my codes below.

How can I solve this problem? also this method as far as I know is experimental, in my opinion if there is another non experimental method you know it would be better

my first screen

```<code>var index = 1

@Composable
fun FirstScreen() {

    val list = remember { mutableStateListOf<Message>() }

    val botList = listOf("Peter", "Francesca", "Luigi", "Igor")
    val random = (0..3).random()
    val botName: String = botList[random]

    val hashMap: HashMap<String, String> = HashMap<String, String>()

    customBotMessage(message = Message1, list)

    LazyColumn {
        items(list.size) { i ->
            if (list[i].id == RECEIVE_ID)
                Item(message = list[i], botName)
            else
                Item(message = list[i], "User")
        }
    }
    SimpleOutlinedTextFieldSample(list, hashMap)

}

@OptIn(ExperimentalComposeUiApi::class, ExperimentalFoundationApi::class)
@Composable
fun SimpleOutlinedTextFieldSample(
    list: SnapshotStateList<Message>,
    hashMap: HashMap<String, String>
) {

    val coroutineScope = rememberCoroutineScope()
    val keyboardController = LocalSoftwareKeyboardController.current
    val bringIntoViewRequester = remember { BringIntoViewRequester() }

    var text by remember { mutableStateOf("") }

    Column(
        verticalArrangement = Arrangement.Bottom,
        horizontalAlignment = Alignment.CenterHorizontally,
        modifier = Modifier.bringIntoViewRequester(bringIntoViewRequester)
    ) {
        Row(
            modifier = Modifier.fillMaxWidth(),
            verticalAlignment = Alignment.Bottom,
            horizontalArrangement = Arrangement.Center
        ) {
            OutlinedTextField(
                modifier = Modifier
                    .padding(8.dp)
                    .onFocusEvent { focusState ->
                        if (focusState.isFocused) {
                            coroutineScope.launch {
                                bringIntoViewRequester.bringIntoView()
                            }
                        }
                    },
                keyboardOptions = KeyboardOptions(imeAction = androidx.compose.ui.text.input.ImeAction.Done),
                keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }),
                value = text,
                onValueChange = { text = it },
                label = { Text("send message") })
            IconButton(onClick = {
                if (text.isNotEmpty()) {

                    list.add(
                        Message(
                            text,
                            SEND_ID,
                            Timestamp(System.currentTimeMillis()).toString()
                        )
                    )
                    hashMap.put(listOfMessageKeys[index - 1], text)
                    customBotMessage(listOfMessages[index], list)

                    index += 1

                }
                text = ""
            }) {
                Icon(
                    modifier = Modifier.padding(8.dp),
                    painter = painterResource(id = R.drawable.ic_baseline_send_24),
                    contentDescription = "send message img"
                )
            }
        }
    }
}

private fun customBotMessage(message: String, list: SnapshotStateList<Message>) {

    GlobalScope.launch {
        delay(1000)
        withContext(Dispatchers.Main) {
            list.add(Message(message, RECEIVE_ID, Timestamp(System.currentTimeMillis()).toString()))
        }
    }
}
</code>```

LazyColumn - Item

```<code>@OptIn(ExperimentalFoundationApi::class, ExperimentalComposeUiApi::class)
@Composable
fun Item(
    message : Message,
    person  : String,
   ){

    val coroutineScope = rememberCoroutineScope()
    val keyboardController = LocalSoftwareKeyboardController.current
    val bringIntoViewRequester = remember { BringIntoViewRequester() }

    Card(
        modifier = Modifier
            .padding(10.dp)
            .bringIntoViewRequester(bringIntoViewRequester),
        elevation = 10.dp
    ) {
        Column(
            horizontalAlignment = Alignment.CenterHorizontally,
            verticalArrangement = Arrangement.Top,
            modifier = Modifier
                .padding(10.dp)
                .height(IntrinsicSize.Min)){
            Row(
                horizontalArrangement = Arrangement.SpaceEvenly,
                verticalAlignment = Alignment.CenterVertically,
                modifier = Modifier.padding(4.dp)
            ){
                Text(
                    buildAnnotatedString {
                        withStyle(style = SpanStyle(fontWeight = FontWeight.Light)) {
                            append("$person: ")
                        }
                    },
                    modifier = Modifier
                        .padding(4.dp)
                        .onFocusEvent { focusState ->
                            if (focusState.isFocused) {
                                coroutineScope.launch {
                                    bringIntoViewRequester.bringIntoView()
                                }
                            }
                        }
                )
                Text(
                    buildAnnotatedString {
                        withStyle(
                            style = SpanStyle(
                                fontWeight = FontWeight.W900,
                                color = Color(0xFF4552B8)
                            ))
                        {
                            append(message.message)
                        }
                    },
                    modifier = Modifier.onFocusEvent { focusState ->
                        if (focusState.isFocused) {
                            coroutineScope.launch {
                                bringIntoViewRequester.bringIntoView()
                            }
                        }
                    }
                )
            }
        }
    }
}
</code>```

Body:
I'm just at the beginning of a chat bot application and I'm showing dialogs with lazycolumn. I also have a textfield, the bot responds to the texts entered in this textfield and cards appear on the screen, but when the keyboard is opened, my lazycolumn items slide upwards and the textfield does not appear properly. To solve this, I used something called bringIntoViewRequester and

I added the following to
my

manifest android:windowSoftInputMode="adjustResize"

MainActivity window.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_ADJUST_PAN)

I'll share my codes below.

How can I solve this problem? also this method as far as I know is experimental, in my opinion if there is another non experimental method you know it would be better

my first screen

var index = 1

@Composable
fun FirstScreen() {

    val list = remember { mutableStateListOf<Message>() }

    val botList = listOf("Peter", "Francesca", "Luigi", "Igor")
    val random = (0..3).random()
    val botName: String = botList[random]

    val hashMap: HashMap<String, String> = HashMap<String, String>()

    customBotMessage(message = Message1, list)

    LazyColumn {
        items(list.size) { i ->
            if (list[i].id == RECEIVE_ID)
                Item(message = list[i], botName)
            else
                Item(message = list[i], "User")
        }
    }
    SimpleOutlinedTextFieldSample(list, hashMap)

}

@OptIn(ExperimentalComposeUiApi::class, ExperimentalFoundationApi::class)
@Composable
fun SimpleOutlinedTextFieldSample(
    list: SnapshotStateList<Message>,
    hashMap: HashMap<String, String>
) {

    val coroutineScope = rememberCoroutineScope()
    val keyboardController = LocalSoftwareKeyboardController.current
    val bringIntoViewRequester = remember { BringIntoViewRequester() }

    var text by remember { mutableStateOf("") }

    Column(
        verticalArrangement = Arrangement.Bottom,
        horizontalAlignment = Alignment.CenterHorizontally,
        modifier = Modifier.bringIntoViewRequester(bringIntoViewRequester)
    ) {
        Row(
            modifier = Modifier.fillMaxWidth(),
            verticalAlignment = Alignment.Bottom,
            horizontalArrangement = Arrangement.Center
        ) {
            OutlinedTextField(
                modifier = Modifier
                    .padding(8.dp)
                    .onFocusEvent { focusState ->
                        if (focusState.isFocused) {
                            coroutineScope.launch {
                                bringIntoViewRequester.bringIntoView()
                            }
                        }
                    },
                keyboardOptions = KeyboardOptions(imeAction = androidx.compose.ui.text.input.ImeAction.Done),
                keyboardActions = KeyboardActions(onDone = { keyboardController?.hide() }),
                value = text,
                onValueChange = { text = it },
                label = { Text("send message") })
            IconButton(onClick = {
                if (text.isNotEmpty()) {

                    list.add(
                        Message(
                            text,
                            SEND_ID,
                            Timestamp(System.currentTimeMillis()).toString()
                        )
                    )
                    hashMap.put(listOfMessageKeys[index - 1], text)
                    customBotMessage(listOfMessages[index], list)

                    index += 1

                }
                text = ""
            }) {
                Icon(
                    modifier = Modifier.padding(8.dp),
                    painter = painterResource(id = R.drawable.ic_baseline_send_24),
                    contentDescription = "send message img"
                )
            }
        }
    }
}

private fun customBotMessage(message: String, list: SnapshotStateList<Message>) {

    GlobalScope.launch {
        delay(1000)
        withContext(Dispatchers.Main) {
            list.add(Message(message, RECEIVE_ID, Timestamp(System.currentTimeMillis()).toString()))
        }
    }
}

LazyColumn - Item

@OptIn(ExperimentalFoundationApi::class, ExperimentalComposeUiApi::class)
@Composable
fun Item(
    message : Message,
    person  : String,
   ){

    val coroutineScope = rememberCoroutineScope()
    val keyboardController = LocalSoftwareKeyboardController.current
    val bringIntoViewRequester = remember { BringIntoViewRequester() }

    Card(
        modifier = Modifier
            .padding(10.dp)
            .bringIntoViewRequester(bringIntoViewRequester),
        elevation = 10.dp
    ) {
        Column(
            horizontalAlignment = Alignment.CenterHorizontally,
            verticalArrangement = Arrangement.Top,
            modifier = Modifier
                .padding(10.dp)
                .height(IntrinsicSize.Min)){
            Row(
                horizontalArrangement = Arrangement.SpaceEvenly,
                verticalAlignment = Alignment.CenterVertically,
                modifier = Modifier.padding(4.dp)
            ){
                Text(
                    buildAnnotatedString {
                        withStyle(style = SpanStyle(fontWeight = FontWeight.Light)) {
                            append("$person: ")
                        }
                    },
                    modifier = Modifier
                        .padding(4.dp)
                        .onFocusEvent { focusState ->
                            if (focusState.isFocused) {
                                coroutineScope.launch {
                                    bringIntoViewRequester.bringIntoView()
                                }
                            }
                        }
                )
                Text(
                    buildAnnotatedString {
                        withStyle(
                            style = SpanStyle(
                                fontWeight = FontWeight.W900,
                                color = Color(0xFF4552B8)
                            ))
                        {
                            append(message.message)
                        }
                    },
                    modifier = Modifier.onFocusEvent { focusState ->
                        if (focusState.isFocused) {
                            coroutineScope.launch {
                                bringIntoViewRequester.bringIntoView()
                            }
                        }
                    }
                )
            }
        }
    }
}


来源: stackexchange

问:
Creating stateful application with some identifier in Kubernetes
In my current application server which currently runs not in a Kubernetes environment, we use IPS in order to communicate with a specific instance of the same application agent.

the application is stateful and therefore we have to communicate each time with the same instance, with IP as an identifier.

Now we want to deploy this agent application to Kubernetes, however, because it's a stateful application I am a bit confused. How can I communicate each time I start a session with the same instance application? Can I have an IP or some another identifier of the pod? how will it work with the Ingress resource?

I looked at the Statefulset object but also did not understand how can it help me.
I also looked at "sticky session", but I don't want to define an amount of time in order to define one session. I want to be able to access the same pod, and if the pod dies I want to get an exception.

How can I do it in Kubernetes? is it possible?

ContentLicense: CC BY-SA 4.0


问:
Raycasting is not working as expected in the Bar chart (code implemented using AFrame and ARjs)
I tried to implement interactive bar graph using AFrame, ARjs and aframe-charts-component libraries, i am able to create the graph but raycasting not working as expected on mobile screen. (my requirement is whenever i touch particular bar in the bar chart that particular bar needs to be scale up little bit but it is not working as expected. the problem i am facing is whenever i touch some x bar some times touched bar(x bar) is not responding and some times neighbour bars responding (scaling up).

I have also added zoom in zoom out functionality to the graph, when i zoom in(increases graph size) the graph on the mobile screen, its working better compared to small size graph but not working accurately.

When ever i zoom in (increasing graph size) -> some times touched bar responding and some times neighbour bar responding
when ever i zoom out (decreasing graph size) -> no bar is responding(scale up) even i tried to touch/click all bars in the bar chart

Below images taken after zoom in the bar chart

Below images is taken when graph size(scale) is small (in this case if i try to click all bars one by one, no one is responding)

How can i scale up a bar once it is clicked/touched on mobile screen. (scale up bar when it is clicked code is written in achart component library)
Here i want to understand why different bar is responding when i click different bar (why ray colliding with different bar)

Here is the code

```<code><!DOCTYPE html>
<html>
<head>
    <title>A-Frame</title>
    <script src="https://aframe.io/releases/1.3.0/aframe.min.js"></script>
    <script src="https://unpkg.com/aframe-charts-component/dist/aframe-charts-component.min.js"></script>
    <script src="https://raw.githack.com/AR-js-org/AR.js/master/aframe/build/aframe-ar.js"></script>
    <script src="https://raw.githack.com/fcor/arjs-gestures/master/dist/gestures.js"></script>
</head>
<body>
    <a-scene arjs embedded cursor="rayOrigin: mouse" renderer="logarithmicDepthBuffer: true;" vr-mode-ui="enabled: false" gesture-detector id="scene">
        <a-marker preset="hiro" raycaster="objects: .clickable; showLine: true; lineColor: red; far=100" emitevents="true" id="markerA">
            <a-entity
                id="bar-model"
                charts="type: cylinder; dataPoints: Data/bar_data.json; axis_nagative: false; axis_tick_separation: 2; axis_tick_length: 0.4"
                position="-1 0 0"
                rotation="300 0 0"
                scale="0.5 0.5 0.5"
                class="clickable"
                gesture-handler
            >
            </a-entity>
        </a-marker>
        <a-entity id="camera" camera="userHeight: 1.6"></a-entity>
    </a-scene>
</body>
</html>
</code>```

Body:
I tried to implement interactive bar graph using AFrame, ARjs and aframe-charts-component libraries, i am able to create the graph but raycasting not working as expected on mobile screen. (my requirement is whenever i touch particular bar in the bar chart that particular bar needs to be scale up little bit but it is not working as expected. the problem i am facing is whenever i touch some x bar some times touched bar(x bar) is not responding and some times neighbour bars responding (scaling up).

I have also added zoom in zoom out functionality to the graph, when i zoom in(increases graph size) the graph on the mobile screen, its working better compared to small size graph but not working accurately.

When ever i zoom in (increasing graph size) -> some times touched bar responding and some times neighbour bar responding
when ever i zoom out (decreasing graph size) -> no bar is responding(scale up) even i tried to touch/click all bars in the bar chart

Below images taken after zoom in the bar chart

Below images is taken when graph size(scale) is small (in this case if i try to click all bars one by one, no one is responding)

How can i scale up a bar once it is clicked/touched on mobile screen. (scale up bar when it is clicked code is written in achart component library)
Here i want to understand why different bar is responding when i click different bar (why ray colliding with different bar)

Here is the code

<!DOCTYPE html>

    <title>A-Frame</title>


问:
Cannot match xml nodes in XSLT
I am writing a basic xslt program. I cannot get to select the nodes i want. I am targetting to see /Events/Event/System/Computer

```<code>    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">
      <html>
      <body>
      <h2>Event</h2>
        <table>
            <tr>
            <xsl:apply-templates/>
            </tr>
        </table>
      </body>
      </html>
    </xsl:template>

    <xsl:template match="Event">
        <td><xsl:apply-templates select="System"/> </td>
    </xsl:template>

    <xsl:template match="System">
        <xsl:apply-templates select="Computer"/>
    </xsl:template>

    <xsl:template match="Computer">
      Computer: <span style="color:#ff0000">
      <xsl:value-of select="."/></span>
      <br />
    </xsl:template>

    </xsl:stylesheet>
</code>```

Above is my style sheet, I am trying to print computer value on a loop.
In my example XML below, what is required is to print the computer name twice.

```<code>XML code
---------
`<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Events>
    <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'>
        <System>
            <Provider Name='Application Error'/>
            <EventID Qualifiers='0'>1000</EventID>
            <Version>0</Version>
            <Level>2</Level>
            <Task>100</Task>
            <Opcode>0</Opcode>
            <Keywords>0x80000000000000</Keywords>
            <TimeCreated SystemTime='2023-01-11T10:22:54.9821986Z'/>
            <EventRecordID>85280</EventRecordID>
            <Correlation/>
            <Execution ProcessID='0' ThreadID='0'/>
            <Channel>Application</Channel>
            <Computer>Peru-Desktop</Computer>
            <Security/>
        </System>
        <EventData>
            <Data>RuntimeBroker.exe</Data>
            <Data>10.0.19041.746</Data>
            <Data>5b78739c</Data>
            <Data>ntdll.dll</Data>
            <Data>10.0.19041.2130</Data>
            <Data>b5ced1c6</Data>
            <Data>c0000374</Data>
            <Data>00000000000ff6a9</Data>
            <Data>28c0</Data>
            <Data>01d9259e77eefd6c</Data>
            <Data>C:\Windows\System32\RuntimeBroker.exe</Data>
            <Data>C:\Windows\SYSTEM32\ntdll.dll</Data>
            <Data>66a01ef8-5dc9-4305-8670-d39ef7144aaf</Data>
            <Data>Microsoft.Windows.Search_1.14.7.19041_neutral_neutral_cw5n1h2txyewy</Data>
            <Data>runtimebroker07f4358a809ac99a64a67c1</Data>
        </EventData>
    </Event>
    <Event
        xmlns='http://schemas.microsoft.com/win/2004/08/events/event'>
        <System>
            <Provider Name='Application Error'/>
            <EventID Qualifiers='0'>1000</EventID>
            <Version>0</Version>
            <Level>2</Level>
            <Task>100</Task>
            <Opcode>0</Opcode>
            <Keywords>0x80000000000000</Keywords>
            <TimeCreated SystemTime='2023-01-11T05:17:35.3925442Z'/>
            <EventRecordID>85258</EventRecordID>
            <Correlation/>
            <Execution ProcessID='0' ThreadID='0'/>
            <Channel>Application</Channel>
            <Computer>Peru-Desktop</Computer>
            <Security/>
        </System>
        <EventData>
            <Data>ftnlsv.exe</Data>
            <Data>3.3.10.0</Data>
            <Data>5fa14984</Data>
            <Data>ntdll.dll</Data>
            <Data>10.0.19041.2130</Data>
            <Data>b5ced1c6</Data>
            <Data>c0000409</Data>
            <Data>000000000008c67f</Data>
            <Data>15bc</Data>
            <Data>01d925799d1bd691</Data>
            <Data>C:\Program Files\Common Files\VMware\DeviceRedirectionCommon\ftnlsv.exe</Data>
            <Data>C:\Windows\SYSTEM32\ntdll.dll</Data>
            <Data>96b01680-a7d7-4e54-b2a8-b350ed24498d</Data>
            <Data></Data>
            <Data></Data>
        </EventData>
    </Event>
</Events>`
</code>```

Currently I print everything including  and all values under Event, This is not what i was wondering.

```<code>`<!DOCTYPE html>
<html>
   <body>
      <h2>Event</h2>
      <table>
         <tr><td>Computer: <span style="color:#ff0000">Peru-Desktop</span><br /></td></tr>
         <tr><td>Computer: <span style="color:#ff0000">Peru-Desktop</span><br /></td></tr>
</table></body></html>`
</code>```

Title: Cannot match xml nodes in XSLT

Body:
I am writing a basic xslt program. I cannot get to select the nodes i want. I am targetting to see /Events/Event/System/Computer

    <?xml version="1.0" encoding="UTF-8"?>
    <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output method="html" indent="yes"/>
    <xsl:template match="/">

Event

            <xsl:apply-templates/>

    </xsl:template>

    <xsl:template match="Event">
        <xsl:apply-templates select="System"/>
    </xsl:template>

    <xsl:template match="System">
        <xsl:apply-templates select="Computer"/>
    </xsl:template>

    <xsl:template match="Computer">
      Computer:
      <xsl:value-of select="."/>

    </xsl:template>

    </xsl:stylesheet>

Above is my style sheet, I am trying to print computer value on a loop.
In my example XML below, what is required is to print the computer name twice.

XML code
---------
`<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<Events>
    <Event xmlns='http://schemas.microsoft.com/win/2004/08/events/event'>
        <System>
            <Provider Name='Application Error'/>
            <EventID Qualifiers='0'>1000</EventID>
            <Version>0</Version>
            <Level>2</Level>
            <Task>100</Task>
            <Opcode>0</Opcode>
            <Keywords>0x80000000000000</Keywords>
            <TimeCreated SystemTime='2023-01-11T10:22:54.9821986Z'/>
            <EventRecordID>85280</EventRecordID>
            <Correlation/>
            <Execution ProcessID='0' ThreadID='0'/>
            <Channel>Application</Channel>
            <Computer>Peru-Desktop</Computer>
            <Security/>
        </System>
        <EventData>
            <Data>RuntimeBroker.exe</Data>
            <Data>10.0.19041.746</Data>
            <Data>5b78739c</Data>
            <Data>ntdll.dll</Data>
            <Data>10.0.19041.2130</Data>
            <Data>b5ced1c6</Data>
            <Data>c0000374</Data>
            <Data>00000000000ff6a9</Data>
            <Data>28c0</Data>
            <Data>01d9259e77eefd6c</Data>
            <Data>C:\Windows\System32\RuntimeBroker.exe</Data>
            <Data>C:\Windows\SYSTEM32\ntdll.dll</Data>
            <Data>66a01ef8-5dc9-4305-8670-d39ef7144aaf</Data>
            <Data>Microsoft.Windows.Search_1.14.7.19041_neutral_neutral_cw5n1h2txyewy</Data>
            <Data>runtimebroker07f4358a809ac99a64a67c1</Data>
        </EventData>
    </Event>
    <Event
        xmlns='http://schemas.microsoft.com/win/2004/08/events/event'>
        <System>
            <Provider Name='Application Error'/>
            <EventID Qualifiers='0'>1000</EventID>
            <Version>0</Version>
            <Level>2</Level>
            <Task>100</Task>
            <Opcode>0</Opcode>
            <Keywords>0x80000000000000</Keywords>
            <TimeCreated SystemTime='2023-01-11T05:17:35.3925442Z'/>
            <EventRecordID>85258</EventRecordID>
            <Correlation/>
            <Execution ProcessID='0' ThreadID='0'/>
            <Channel>Application</Channel>
            <Computer>Peru-Desktop</Computer>
            <Security/>
        </System>
        <EventData>
            <Data>ftnlsv.exe</Data>
            <Data>3.3.10.0</Data>
            <Data>5fa14984</Data>
            <Data>ntdll.dll</Data>
            <Data>10.0.19041.2130</Data>
            <Data>b5ced1c6</Data>
            <Data>c0000409</Data>
            <Data>000000000008c67f</Data>
            <Data>15bc</Data>
            <Data>01d925799d1bd691</Data>
            <Data>C:\Program Files\Common Files\VMware\DeviceRedirectionCommon\ftnlsv.exe</Data>
            <Data>C:\Windows\SYSTEM32\ntdll.dll</Data>
            <Data>96b01680-a7d7-4e54-b2a8-b350ed24498d</Data>
            <Data></Data>
            <Data></Data>
        </EventData>
    </Event>
</Events>`

Currently I print everything including  and all values under Event, This is not what i was wondering.

`<!DOCTYPE html>

Event

Computer: Peru-Desktop

Computer: Peru-Desktop

`


问:
How to use SetDisplayConfig (windows-rs) to force screen re-detection?
I am using windows-rs (Latest version from GitHub, because it contains some fixes the stable version on Crates.io doesn't have).

My goal is to develop a small software that automatically forces the screen to be re-detected and set to the highest resolution (It's for a school with a weird setup where teachers have to turn projectors on before the PC for resolutions to get detected, but often forget that, leading the PCs to have a very low resolution, and the higher resolutions not being detected).

For re-initializing the screen, I have the following function:

```<code>// Some imports may be unused here, I haven't checked them yet, the full file has more functions
use windows::Win32::Graphics::Gdi::{ChangeDisplaySettingsA, EnumDisplaySettingsA, DEVMODEA, SDC_FORCE_MODE_ENUMERATION, SDC_APPLY, SDC_SAVE_TO_DATABASE, SDC_USE_SUPPLIED_DISPLAY_CONFIG, QDC_ALL_PATHS};
use windows::Win32::Media::Audio::Endpoints::IAudioEndpointVolume;
use windows::Win32::Media::Audio::{IMMDeviceEnumerator, MMDeviceEnumerator};
use windows::Win32::Devices::Display::{GetDisplayConfigBufferSizes, QueryDisplayConfig, SetDisplayConfig, DISPLAYCONFIG_TOPOLOGY_ID};

use windows::core::GUID;
use windows::Win32::System::Com::{CoInitialize, CoCreateInstance, CLSCTX_ALL};

// Forces Windows to reinit display settings
pub fn force_reinit_screen() -> i32 {
    let mut path_count = 0;
    let mut mode_count = 0;
    let result = unsafe { GetDisplayConfigBufferSizes(QDC_ALL_PATHS, &mut path_count, &mut mode_count) };
    println!("GetDisplayConfigBufferSizes returned {}", result);
    let mut path_array = Vec::with_capacity(path_count as usize);
    let mut mode_array = Vec::with_capacity(mode_count as usize);
    let result = unsafe {
        QueryDisplayConfig(
            QDC_ALL_PATHS,
            &mut path_count,
            path_array.as_mut_ptr(),
            &mut mode_count,
            mode_array.as_mut_ptr(),
            ::core::mem::transmute(::core::ptr::null::<DISPLAYCONFIG_TOPOLOGY_ID>()),
        )
    };
    println!("QueryDisplayConfig returned {}", result);
    let flags = SDC_FORCE_MODE_ENUMERATION | SDC_APPLY | SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_SAVE_TO_DATABASE;

   let result = unsafe { SetDisplayConfig(Some(&path_array), Some(&mode_array), flags) };
   result
}
</code>```

However, it does not work on any computer I've tried this on (Returns code 87, which seems to mean bad parameters). What am I doing wrong?

Body:
I am using windows-rs (Latest version from GitHub, because it contains some fixes the stable version on Crates.io doesn't have).

My goal is to develop a small software that automatically forces the screen to be re-detected and set to the highest resolution (It's for a school with a weird setup where teachers have to turn projectors on before the PC for resolutions to get detected, but often forget that, leading the PCs to have a very low resolution, and the higher resolutions not being detected).

For re-initializing the screen, I have the following function:

// Some imports may be unused here, I haven't checked them yet, the full file has more functions
use windows::Win32::Graphics::Gdi::{ChangeDisplaySettingsA, EnumDisplaySettingsA, DEVMODEA, SDC_FORCE_MODE_ENUMERATION, SDC_APPLY, SDC_SAVE_TO_DATABASE, SDC_USE_SUPPLIED_DISPLAY_CONFIG, QDC_ALL_PATHS};
use windows::Win32::Media::Audio::Endpoints::IAudioEndpointVolume;
use windows::Win32::Media::Audio::{IMMDeviceEnumerator, MMDeviceEnumerator};
use windows::Win32::Devices::Display::{GetDisplayConfigBufferSizes, QueryDisplayConfig, SetDisplayConfig, DISPLAYCONFIG_TOPOLOGY_ID};

use windows::core::GUID;
use windows::Win32::System::Com::{CoInitialize, CoCreateInstance, CLSCTX_ALL};

// Forces Windows to reinit display settings
pub fn force_reinit_screen() -> i32 {
    let mut path_count = 0;
    let mut mode_count = 0;
    let result = unsafe { GetDisplayConfigBufferSizes(QDC_ALL_PATHS, &mut path_count, &mut mode_count) };
    println!("GetDisplayConfigBufferSizes returned {}", result);
    let mut path_array = Vec::with_capacity(path_count as usize);
    let mut mode_array = Vec::with_capacity(mode_count as usize);
    let result = unsafe {
        QueryDisplayConfig(
            QDC_ALL_PATHS,
            &mut path_count,
            path_array.as_mut_ptr(),
            &mut mode_count,
            mode_array.as_mut_ptr(),
            ::core::mem::transmute(::core::ptr::null::<DISPLAYCONFIG_TOPOLOGY_ID>()),
        )
    };
    println!("QueryDisplayConfig returned {}", result);
    let flags = SDC_FORCE_MODE_ENUMERATION | SDC_APPLY | SDC_USE_SUPPLIED_DISPLAY_CONFIG | SDC_SAVE_TO_DATABASE;

   let result = unsafe { SetDisplayConfig(Some(&path_array), Some(&mode_array), flags) };
   result
}

However, it does not work on any computer I've tried this on (Returns code 87, which seems to mean bad parameters). What am I doing wrong?


问:
Changing text to image with php variables
I am building a slot machine and am trying to create a shop where you can buy images to replace the text. If I click the button it just resets my money to zero and doesn't replace any text with images. How can I fix this without compromising any functionality or adding hundreds of lines of code?</p>
```<code><html
<?php
  //shop
    if (isset($_POST['shop']))
    {
      if ($credit = 50 or $credit > 50)
      {
        $credit = $credit - 50;
        strtr($str, array(
    'Zero' => "<img src=img/Zero.png />",
    'Bar' => "<img src=img/Bar.png />",
    'Double Bar' => "<img src=img/DoubleBar.png />",
    'Triple Bar' => "<img src=img/TripleBar.png />",
    'Cherry' => "<img src=img/Cherry.png />",
    'Seven' => "<img src=img/Seven.png />",
    'Diamond' => "<img src=img/Diamond.png />",
    'Clover' => "<img src=img/Clover.png />",
        ));
      }
      else
      {
        $message = "You don't have enough money!";
      }
    }

<!-- display -->
<?php if (!$bust) { ?>
<div id="slots">
 <?=join(' | ', $slot_result)?>
</div>
<br/>
<br/>
<?=$message?>
<?php } else { ?>
<?=$message?>
<?php } ?>
<br/>
  <br/>
  Total cash: €<?=$credit?>
    <form method='post'>
        <input type='submit' name='spin' value='Spin' />
        <input type='hidden' name='credit' value='<?php echo $credit; ?>' />
        <input type='submit' name='reset' value='Reset' />
        <br>
        <br>
        <input type='submit' name='shop' value='Change Style - €50' />
    </form>
</body>
</html>

</code>```

Body:
I am building a slot machine and am trying to create a shop where you can buy images to replace the text. If I click the button it just resets my money to zero and doesn't replace any text with images. How can I fix this without compromising any functionality or adding hundreds of lines of code?

<html
<?php
  //shop
    if (isset($_POST['shop']))
    {
      if ($credit = 50 or $credit > 50)
      {
        $credit = $credit - 50;
        strtr($str, array(
    'Zero' => "",
    'Bar' => "",
    'Double Bar' => "",
    'Triple Bar' => "",
    'Cherry' => "",
    'Seven' => "",
    'Diamond' => "",
    'Clover' => "",
        ));
      }
      else
      {
        $message = "You don't have enough money!";
      }
    }

<?php if (!$bust) { ?>

 <?=join(' | ', $slot_result)?>

<?=$message?>
<?php } else { ?>
<?=$message?>
<?php } ?>

  Total cash: €<?=$credit?>
    <form method='post'>
        <input type='submit' name='spin' value='Spin' />
        <input type='hidden' name='credit' value='<?php echo $credit; ?>' />
        <input type='submit' name='reset' value='Reset' />

        <input type='submit' name='shop' value='Change Style - €50' />
    </form>


问:
How to correctly initialize subclass in Python (parent class being SQLAlchemy Table)
I am new to python and currently I am trying to initialize subclass Cpty with SQLAlchemy engine as a single attribute (I want the other attributes to be set up in parent classes)

I have this setup:

defaultTable.py

from sqlalchemy import Table, MetaData

class Default_table(Table):

    def __init__(self, table_name, autoload, autoload_with):
        metadata = MetaData(schema='dbo')
        super(Default_table, self).__init__(table_name, metadata, autoload=autoload, autoload_with=autoload_with)

    def output(self):
        print('ahoj')
```
<p>counterparty.py</p>
<pre class="lang-py prettyprint-override"><code>from .default_table import Default_table

class Cpty(Default_table):

    def __init__(self, engine):
        table_name = 'CPTY'
        autoload = True
        super(Cpty, self).__init__(table_name, autoload=autoload, autoload_with=engine)
</code>```

and now I want to initialize the the Cpty Class, where connection.engine is SQLAlchemy engine

cpty = Cpty(connection.engine)
```
<p>I receive Exception - TypeError</p>
<pre class="lang-none prettyprint-override"><code>Exception has occurred: TypeError
Table() takes at least two positional-only arguments 'name' and 'metadata'
</code>```

I understand that I do not initialize the Table class with correct set of attributes, but I can not find out, how should I handle this problem as I am quite new to the python.

I expect that by initializind cpty = Cpty(engine) that a class Table is initialized with attributes defined in parent __init__ functions

Body:
I am new to python and currently I am trying to initialize subclass Cpty with SQLAlchemy engine as a single attribute (I want the other attributes to be set up in parent classes)

I have this setup:

defaultTable.py

from sqlalchemy import Table, MetaData

class Default_table(Table):

    def __init__(self, table_name, autoload, autoload_with):
        metadata = MetaData(schema='dbo')
        super(Default_table, self).__init__(table_name, metadata, autoload=autoload, autoload_with=autoload_with)

    def output(self):
        print('ahoj')

counterparty.py

from .default_table import Default_table

class Cpty(Default_table):

    def __init__(self, engine):
        table_name = 'CPTY'
        autoload = True
        super(Cpty, self).__init__(table_name, autoload=autoload, autoload_with=engine)

and now I want to initialize the the Cpty Class, where connection.engine is SQLAlchemy engine

cpty = Cpty(connection.engine)

I receive Exception - TypeError

Exception has occurred: TypeError
Table() takes at least two positional-only arguments 'name' and 'metadata'

I understand that I do not initialize the Table class with correct set of attributes, but I can not find out, how should I handle this problem as I am quite new to the python.

I expect that by initializind cpty = Cpty(engine) that a class Table is initialized with attributes defined in parent __init__ functions


问:
Why does the component open without animation when I add dynamically? (in nextjs v13 )
my project have sidebar in layout. inside the sidebar there is data from the database.
i am getting hydration error. So i use dynamic import

layout.tsx

```<code>const  ComponentName = dynamic(() => import('../components/sidebar'), { suspense: true,ssr: false })
</code>```

normally the sidebar slides open but when i use dynamic import , my sidebar pops up suddenly.

hydration is fixed this way, but my sidebar does not open properly, how can I fix it?

sidebar.tsx

```<code><div className={`top-0 left-0 w-80 bg-slate-50  text-sky-900 fixed h-full z-50  ease-in-out duration-500 rounded-r-xl overflow-hidden ${
          props.showSidebar
            ? "translate-x-0 "
            : "-translate-x-full"
        }`}
      >
.....
</div>
</code>```

Body:
my project have sidebar in layout. inside the sidebar there is data from the database.
i am getting hydration error. So i use dynamic import

layout.tsx

const  ComponentName = dynamic(() => import('../components/sidebar'), { suspense: true,ssr: false })

normally the sidebar slides open but when i use dynamic import , my sidebar pops up suddenly.

hydration is fixed this way, but my sidebar does not open properly, how can I fix it?

sidebar.tsx

.....


问:
Can I Break, Change, and Resume Selenium/Node.js code in Visual Studio Code?
I'm running a Selenium webdriver in Firefox, coded in javascript and node.js. However, the page I'm testing is a hot mess, and accessing the various elements often results in errors, forcing me to reset the project.

But as the project requires a manual, third party app, login that can't be automated, and sends my selenium instance on a wild goose chase before I can reach the parts that I'm working with, I'd like to be able to simply catch the error, change the code (specifically the driver.findElement(By.xpath) references, and resume the execution from where it was.

Is that possible?


问:
Keras Lambda Layer: can't pickle _thread.RLock objects
I am trying to save the full keras model. I tried to replicate the following error in a smaller example but I failed, so here is the actual code causing the error in the full model.

The MaskRNN model for image segmentation has a lambda layer defined as:

```<code>gt_boxes = KL.Lambda(lambda x: norm_boxes_graph(x, K.shape(input_image)[1:3]))(input_gt_boxes)
</code>```

This layer calls the method below:

```<code>def norm_boxes_graph(self, boxes, shape):
        """Converts boxes from pixel coordinates to normalized coordinates.
        boxes: [..., (y1, x1, y2, x2)] in pixel coordinates
        shape: [..., (height, width)] in pixels

        Note: In pixel coordinates (y2, x2) is outside the box. But in normalized
        coordinates it's inside the box.

        Returns:
            [..., (y1, x1, y2, x2)] in normalized coordinates
        """
        h, w = tf.split(tf.cast(shape, tf.float32), 2)
        scale = tf.concat([h, w, h, w], axis=-1) - tf.constant(1.0)
        shift = tf.constant([0., 0., 1., 1.])
        fin = tf.divide(boxes - shift, scale)
        return fin
</code>```

When trying to save the full model(not only the weights) it throughs the error:

```<code>can't pickle _thread.RLock objects
</code>```

Checking for serializability:

```<code>Checking Serializability of {'class_name': 'Lambda',
'config': {'name': 'norm_boxes_lambda', 'trainable': True, 'dtype': 'float32', 'function': ('4wEAAAAAAAAAAQAAAAQAAAATAAAAcw4AAACIAHwAiAGIAoMBgwJTACkBTqkAKQHaAXgpA9oPZ2V0\nX25vcm1fYm94ZXNf2hBnZXRfc2hhcGVfaW1hZ2Vf2gtpbnB1dF9pbWFnZXIBAAAA+lEvaG9tZS9p\nYWkvbWluaWNvbmRhMi9lbnZzL3B5dG9yY2gyL2xpYi9weXRob24zLjcvc2l0ZS1wYWNrYWdlcy9N\nYXNrX1JDTk4vbW9kZWwucHnaCDxsYW1iZGE+mwcAAPMAAAAA\n', None, (<function MaskRCNN.build.<locals>.get_norm_boxes_ at 0x7f272b8b59e0>, <function MaskRCNN.build.<locals>.get_shape_image_ at 0x7f270c4817a0>, <tf.Tensor 'input_image:0' shape=(None, None, None, 3) dtype=float32>)),
'function_type': 'lambda',
'module': 'Mask_RCNN.model',
'output_shape': None,
'output_shape_type': 'raw', 'output_shape_module': None,
'arguments': {}}}

!!! FAIL serialization: can't pickle _thread.RLock objects
WARNING: Did not find non-serializable object in {'class_name': 'Lambda', 'config': {'name': 'norm_boxes_lambda', 'trainable': True, 'dtype': 'float32', 'function': ('4wEAAAAAAAAAAQAAAAQAAAATAAAAcw4AAACIAHwAiAGIAoMBgwJTACkBTqkAKQHaAXgpA9oPZ2V0\nX25vcm1fYm94ZXNf2hBnZXRfc2hhcGVfaW1hZ2Vf2gtpbnB1dF9pbWFnZXIBAAAA+lEvaG9tZS9p\nYWkvbWluaWNvbmRhMi9lbnZzL3B5dG9yY2gyL2xpYi9weXRob24zLjcvc2l0ZS1wYWNrYWdlcy9N\nYXNrX1JDTk4vbW9kZWwucHnaCDxsYW1iZGE+mwcAAPMAAAAA\n', None, (<function MaskRCNN.build.<locals>.get_norm_boxes_ at 0x7f272b8b59e0>, <function MaskRCNN.build.<locals>.get_shape_image_ at 0x7f270c4817a0>, <tf.Tensor 'input_image:0' shape=(None, None, None, 3) dtype=float32>)), 'function_type': 'lambda', 'module': 'Mask_RCNN.model', 'output_shape': None, 'output_shape_type': 'raw', 'output_shape_module': None, 'arguments': {}}}. This may be an oversight.

========================
Variable:

    FailTuple(test [obj={'class_name': 'Lambda', 'config': {'name': 'norm_boxes_lambda', 'trainable': True, 'dtype': 'float32', 'function': ('4wEAAAAAAAAAAQAAAAQAAAATAAAAcw4AAACIAHwAiAGIAoMBgwJTACkBTqkAKQHaAXgpA9oPZ2V0\nX25vcm1fYm94ZXNf2hBnZXRfc2hhcGVfaW1hZ2Vf2gtpbnB1dF9pbWFnZXIBAAAA+lEvaG9tZS9p\nYWkvbWluaWNvbmRhMi9lbnZzL3B5dG9yY2gyL2xpYi9weXRob24zLjcvc2l0ZS1wYWNrYWdlcy9N\nYXNrX1JDTk4vbW9kZWwucHnaCDxsYW1iZGE+mwcAAPMAAAAA\n', None, (<function MaskRCNN.build.<locals>.get_norm_boxes_ at 0x7f272b8b59e0>, <function MaskRCNN.build.<locals>.get_shape_image_ at 0x7f270c4817a0>, <tf.Tensor 'input_image:0' shape=(None, None, None, 3) dtype=float32>)), 'function_type': 'lambda', 'module': 'Mask_RCNN.model', 'output_shape': None, 'output_shape_type': 'raw', 'output_shape_module': None, 'arguments': {}}}, parent=None])

was found to be non-serializable. There may be multiple other undetected variables that were non-serializable.
Consider either removing the instantiation/imports of these variables or moving the instantiation into the scope of the function/class.
If you have any suggestions on how to improve this error message, please reach out to the Ray developers on github.com/ray-project/ray/issues/
</code>```

Useful related info:
Keras Custom Layer gives errors when saving the full model

I also used unsuccessfully the closure method described here:
Checkpointing keras model: TypeError: can't pickle _thread.lock objects

Any help is greatly appreciated!

Body:
I am trying to save the full keras model. I tried to replicate the following error in a smaller example but I failed, so here is the actual code causing the error in the full model.

The MaskRNN model for image segmentation has a lambda layer defined as:

gt_boxes = KL.Lambda(lambda x: norm_boxes_graph(x, K.shape(input_image)[1:3]))(input_gt_boxes)

This layer calls the method below:

def norm_boxes_graph(self, boxes, shape):
        """Converts boxes from pixel coordinates to normalized coordinates.
        boxes: [..., (y1, x1, y2, x2)] in pixel coordinates
        shape: [..., (height, width)] in pixels

        Note: In pixel coordinates (y2, x2) is outside the box. But in normalized
        coordinates it's inside the box.

        Returns:
            [..., (y1, x1, y2, x2)] in normalized coordinates
        """
        h, w = tf.split(tf.cast(shape, tf.float32), 2)
        scale = tf.concat([h, w, h, w], axis=-1) - tf.constant(1.0)
        shift = tf.constant([0., 0., 1., 1.])
        fin = tf.divide(boxes - shift, scale)
        return fin

When trying to save the full model(not only the weights) it throughs the error:

can't pickle _thread.RLock objects

Checking for serializability:

Checking Serializability of {'class_name': 'Lambda',
'config': {'name': 'norm_boxes_lambda', 'trainable': True, 'dtype': 'float32', 'function': ('4wEAAAAAAAAAAQAAAAQAAAATAAAAcw4AAACIAHwAiAGIAoMBgwJTACkBTqkAKQHaAXgpA9oPZ2V0\nX25vcm1fYm94ZXNf2hBnZXRfc2hhcGVfaW1hZ2Vf2gtpbnB1dF9pbWFnZXIBAAAA+lEvaG9tZS9p\nYWkvbWluaWNvbmRhMi9lbnZzL3B5dG9yY2gyL2xpYi9weXRob24zLjcvc2l0ZS1wYWNrYWdlcy9N\nYXNrX1JDTk4vbW9kZWwucHnaCDxsYW1iZGE+mwcAAPMAAAAA\n', None, (<function MaskRCNN.build.<locals>.get_norm_boxes_ at 0x7f272b8b59e0>, <function MaskRCNN.build.<locals>.get_shape_image_ at 0x7f270c4817a0>, <tf.Tensor 'input_image:0' shape=(None, None, None, 3) dtype=float32>)),
'function_type': 'lambda',
'module': 'Mask_RCNN.model',
'output_shape': None,
'output_shape_type': 'raw', 'output_shape_module': None,
'arguments': {}}}

!!! FAIL serialization: can't pickle _thread.RLock objects
WARNING: Did not find non-serializable object in {'class_name': 'Lambda', 'config': {'name': 'norm_boxes_lambda', 'trainable': True, 'dtype': 'float32', 'function': ('4wEAAAAAAAAAAQAAAAQAAAATAAAAcw4AAACIAHwAiAGIAoMBgwJTACkBTqkAKQHaAXgpA9oPZ2V0\nX25vcm1fYm94ZXNf2hBnZXRfc2hhcGVfaW1hZ2Vf2gtpbnB1dF9pbWFnZXIBAAAA+lEvaG9tZS9p\nYWkvbWluaWNvbmRhMi9lbnZzL3B5dG9yY2gyL2xpYi9weXRob24zLjcvc2l0ZS1wYWNrYWdlcy9N\nYXNrX1JDTk4vbW9kZWwucHnaCDxsYW1iZGE+mwcAAPMAAAAA\n', None, (<function MaskRCNN.build.<locals>.get_norm_boxes_ at 0x7f272b8b59e0>, <function MaskRCNN.build.<locals>.get_shape_image_ at 0x7f270c4817a0>, <tf.Tensor 'input_image:0' shape=(None, None, None, 3) dtype=float32>)), 'function_type': 'lambda', 'module': 'Mask_RCNN.model', 'output_shape': None, 'output_shape_type': 'raw', 'output_shape_module': None, 'arguments': {}}}. This may be an oversight.

========================
Variable:

    FailTuple(test [obj={'class_name': 'Lambda', 'config': {'name': 'norm_boxes_lambda', 'trainable': True, 'dtype': 'float32', 'function': ('4wEAAAAAAAAAAQAAAAQAAAATAAAAcw4AAACIAHwAiAGIAoMBgwJTACkBTqkAKQHaAXgpA9oPZ2V0\nX25vcm1fYm94ZXNf2hBnZXRfc2hhcGVfaW1hZ2Vf2gtpbnB1dF9pbWFnZXIBAAAA+lEvaG9tZS9p\nYWkvbWluaWNvbmRhMi9lbnZzL3B5dG9yY2gyL2xpYi9weXRob24zLjcvc2l0ZS1wYWNrYWdlcy9N\nYXNrX1JDTk4vbW9kZWwucHnaCDxsYW1iZGE+mwcAAPMAAAAA\n', None, (<function MaskRCNN.build.<locals>.get_norm_boxes_ at 0x7f272b8b59e0>, <function MaskRCNN.build.<locals>.get_shape_image_ at 0x7f270c4817a0>, <tf.Tensor 'input_image:0' shape=(None, None, None, 3) dtype=float32>)), 'function_type': 'lambda', 'module': 'Mask_RCNN.model', 'output_shape': None, 'output_shape_type': 'raw', 'output_shape_module': None, 'arguments': {}}}, parent=None])

was found to be non-serializable. There may be multiple other undetected variables that were non-serializable.
Consider either removing the instantiation/imports of these variables or moving the instantiation into the scope of the function/class.
If you have any suggestions on how to improve this error message, please reach out to the Ray developers on github.com/ray-project/ray/issues/

Useful related info:
Keras Custom Layer gives errors when saving the full model

I also used unsuccessfully the closure method described here:
Checkpointing keras model: TypeError: can't pickle _thread.lock objects

Any help is greatly appreciated!


问:
azure amqp EventHubClientBuilder proxyOptions testing
I wanted to test my azure eventhub connection while using proxy options
Using a sample proxy server to test: http://103.199.139.174:80
this is my code

```<code> private static void setupProxy(EventHubClientBuilder eventHubClientBuilder) {
    // replace with right proxy port
    int proxyPort = 80;
    String proxyHost = "{hostname}";
    Proxy proxyAddress = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));

    ProxyOptions proxyOptions = new ProxyOptions(ProxyAuthenticationType.NONE, proxy, null, null);

    eventHubClientBuilder.proxyOptions(proxyOptions);
    eventHubClientBuilder.transportType(AmqpTransportType.AMQP_WEB_SOCKETS);

    EventHubConsumerClient consumer = eventHubClientBuilder.buildConsumerClient()
    IterableStream<String> partitionIds = consumer.getPartitionIds();

</code>```

connection 'MF_64bd1b_1673439799445' not opened within AmqpRetryOptions.tryTimeout(): PT1M, errorContext[NAMESPACE: 103.199.139.174. ERROR CONTEXT: N/A]

com.azure.core.amqp.exception.AmqpException: Connection 'MF_64bd1b_1673439799445' not opened within AmqpRetryOptions.tryTimeout(): PT1M, errorContext[NAMESPACE: 103.199.139.174. ERROR CONTEXT: N/A]

can any one let me know if anything is wrong in the code or the proxy server which i am using?

Body:
I wanted to test my azure eventhub connection while using proxy options
Using a sample proxy server to test: http://103.199.139.174:80
this is my code

 private static void setupProxy(EventHubClientBuilder eventHubClientBuilder) {
    // replace with right proxy port
    int proxyPort = 80;
    String proxyHost = "{hostname}";
    Proxy proxyAddress = new Proxy(Proxy.Type.HTTP, new InetSocketAddress(proxyHost, proxyPort));

    ProxyOptions proxyOptions = new ProxyOptions(ProxyAuthenticationType.NONE, proxy, null, null);

    eventHubClientBuilder.proxyOptions(proxyOptions);
    eventHubClientBuilder.transportType(AmqpTransportType.AMQP_WEB_SOCKETS);

    EventHubConsumerClient consumer = eventHubClientBuilder.buildConsumerClient()
    IterableStream<String> partitionIds = consumer.getPartitionIds();

connection 'MF_64bd1b_1673439799445' not opened within AmqpRetryOptions.tryTimeout(): PT1M, errorContext[NAMESPACE: 103.199.139.174. ERROR CONTEXT: N/A]

com.azure.core.amqp.exception.AmqpException: Connection 'MF_64bd1b_1673439799445' not opened within AmqpRetryOptions.tryTimeout(): PT1M, errorContext[NAMESPACE: 103.199.139.174. ERROR CONTEXT: N/A]

can any one let me know if anything is wrong in the code or the proxy server which i am using?


问:
Very slow many to many eager loading in sequelize
Recently one of my colleague pointed out that many-to-many association in sequelize query has O(n²) of time complexity, about which I didn't find anywhere online. Since this association is frequently observed in b/w real-world data and I have aready used it at many places in my projects it is very alarming for the developers that this downside isn't mentioned anywhere on the internet.
Consider one case where I have defined following query between two tables A & B.

db.A.findAll({
   include: [
     { modal: db.B },
     { modal: db.C }
   ]
})
```
<p>Here A & B have many to many association b/w them.
If B and C has large no of associated content(let's say around 100) the query becomes very slow. It takes about 40-50 second to execute this query.
This slow execution time can only be explained if sequelize is checking each entries in both the table sequentially by permutating through them.
I also tried researching about how mysql queries with eager loading are internally implemented in sequelize but got nothing on it.
Can someone explain the more concrete reason behind this? I used eager loading this way assuming that Sequelize internally go through Join table before fetching the content from B & C table.</p>
<p><strong>EDIT:</strong></p>
<p>The relationship between them is defined as follows:</p>
<pre class="lang-js prettyprint-override"><code>db.A.belongsToMany(models.B, { through: AB, foreignKey: 'aId' });
db.B.belongsToMany(models.A, { through: AB, foreignKey: 'bId' });
</code>```

Body:
Recently one of my colleague pointed out that many-to-many association in sequelize query has O(n²) of time complexity, about which I didn't find anywhere online. Since this association is frequently observed in b/w real-world data and I have aready used it at many places in my projects it is very alarming for the developers that this downside isn't mentioned anywhere on the internet.
Consider one case where I have defined following query between two tables A & B.

db.A.findAll({
   include: [
     { modal: db.B },
     { modal: db.C }
   ]
})

Here A & B have many to many association b/w them.
If B and C has large no of associated content(let's say around 100) the query becomes very slow. It takes about 40-50 second to execute this query.
This slow execution time can only be explained if sequelize is checking each entries in both the table sequentially by permutating through them.
I also tried researching about how mysql queries with eager loading are internally implemented in sequelize but got nothing on it.
Can someone explain the more concrete reason behind this? I used eager loading this way assuming that Sequelize internally go through Join table before fetching the content from B & C table.

EDIT:

The relationship between them is defined as follows:

db.A.belongsToMany(models.B, { through: AB, foreignKey: 'aId' });
db.B.belongsToMany(models.A, { through: AB, foreignKey: 'bId' });


问:
Expo - How to install package from a github pull request?
I'm trying to override the @expo/vector-icons with https://github.com/gauel/vector-icons :

```<code>"overrides": {
    "expo": {
      "@expo/vector-icons": "git+https://github.com/gauel/vector-icons"
    }
  },
</code>```

defaut expo package.json

```<code>"dependencies": {
   "@expo/vector-icons": "^13.0.0",

}
</code>```

How can i override the default package from expo ?

Body:
I'm trying to override the @expo/vector-icons with https://github.com/gauel/vector-icons :

"overrides": {
    "expo": {
      "@expo/vector-icons": "git+https://github.com/gauel/vector-icons"
    }
  },

defaut expo package.json

"dependencies": {
   "@expo/vector-icons": "^13.0.0",

}

How can i override the default package from expo ?


问:
How to select all fields greater than specific value in Influxdb
I have a database in Influxdb 1.7 with several columns and no tag key.
I want to receive  only fields where the value is greater than 0 (zero)
(I'm using grafana to show)

like:

table1:

| time     | A | B | C | D | E | F |....| AD | AE | ...

|167344...| 0    | 0    | 2    | 0    | 12   | 0    |....| 0     | 0      |

|167356... | 0    | 0    | 2    | 0    | 0    | 0    |....| 0     | 12     |

|167376... | 0    | 0    | 2    | 0    | 1    | 0    |....| 0     | 0      |

|167384... | 1    | 4    | 0    | 0    | 0    | 0    |....| 0     | 1      |

I would like to receive:

| time     | A | B | AE |

|167384... | 1    | 4 | 1 |

I've tried:

select last("*") from "table1" where * > 0

select last(*) from "table1" where * > 0

select last(*) as bbb from "table1" where bbb > 0

and other similar queries, but doen't work


问:
There is no red error text in pine editor
I add some error in my pine editor,but there is no red error text display which it should.
It works fine severl hours ago,but now it doesn't.

I tried to restart tradingview,but error still


问:
Is there a method in R to find confidence interval of a proportion by non-parametric percentile bootstrap method
I have a table which has been generated in one of the publication and I am trying to do similar analysis for another study. please help me out to find CI by non-parametric percentile bootstrap method.

here is the table

I want to know how the ci for 1-RR is calculated.
here is the statistical explanation for it:

We used the Kaplan-Meier estimator18 to construct
cumulative incidence curves and to estimate the risk for
each outcome. The risks were compared via ratios and
differences. We estimated the risk ratio for each outcome
using only matched pairs in which both individuals were
still at risk 7 days after receipt of the third vaccine dose in
those vaccinated. We analysed outcomes in the full
population and in subgroups defined by strata of age,
sex, and number of comorbidities. 95% CIs were
calculated using the nonparametric percentile bootstrap
method with 1000 repetitions. The effectiveness of the
third dose was estimated as 1 – risk ratio. As a sensitivity
analysis, vaccine effectiveness was also estimated as
1 – incidence rate ratio derived from a Poisson regression
using the same dataset, with no further adjustment.
Analyses were done using R software (version 4.0.4)."

How to calculate CI.


问:
Add external library to vs code c++ linux
I'm trying to use libxl in my c++ project on visual studio code. This is my directory map:

```<code>├── ken.code-workspace
└── src
    ├── include
    │   ├── AutoFilterA.h
    │   ├── AutoFilterW.h
    │   ├── BookA.h
    │   ├── BookW.h
    │   ├── enum.h
    │   ├── FilterColumnA.h
    │   ├── FilterColumnW.h
    │   ├── FontA.h
    │   ├── FontW.h
    │   ├── FormatA.h
    │   ├── FormatW.h
    │   ├── FormControlA.h
    │   ├── FormControlW.h
    │   ├── handle.h
    │   ├── libxl.h
    │   ├── RichStringA.h
    │   ├── RichStringW.h
    │   ├── setup.h
    │   ├── SheetA.h
    │   └── SheetW.h
    ├── ken.cpp
    └── lib
        └── libxl.so
</code>```

And this is my ken.cpp:

#include <iostream>
#include <vector>
#include <string>
#include "include/libxl.h"

using namespace std;
using namespace libxl;

int main()
{
    cout << "Hello babe :)" << endl;
    Book* book = xlCreateBook();
}
```
<p>But I get these errors while trying to compile:</p>
```/run/media/mahdi/Mahdi/Projects/ken/src/ken.cpp:7:17: error: ‘libxl’ is not a namespace-name
    7 | using namespace libxl;
      |                 ^~~~~
/run/media/mahdi/Mahdi/Projects/ken/src/ken.cpp: In function ‘int main()’:
/run/media/mahdi/Mahdi/Projects/ken/src/ken.cpp:12:5: error: ‘Book’ was not declared in this scope
   12 |     Book* book = xlCreateBook();
      |     ^~~~
/run/media/mahdi/Mahdi/Projects/ken/src/ken.cpp:12:11: error: ‘book’ was not declared in this scope; did you mean ‘bool’?
   12 |     Book* book = xlCreateBook();
      |           ^~~~
      |           bool
```

I've never added an external library to visual studio code project before. Can I know what I'm doing wrong?

Body:
I'm trying to use libxl in my c++ project on visual studio code. This is my directory map:

├── ken.code-workspace
└── src
    ├── include
    │   ├── AutoFilterA.h
    │   ├── AutoFilterW.h
    │   ├── BookA.h
    │   ├── BookW.h
    │   ├── enum.h
    │   ├── FilterColumnA.h
    │   ├── FilterColumnW.h
    │   ├── FontA.h
    │   ├── FontW.h
    │   ├── FormatA.h
    │   ├── FormatW.h
    │   ├── FormControlA.h
    │   ├── FormControlW.h
    │   ├── handle.h
    │   ├── libxl.h
    │   ├── RichStringA.h
    │   ├── RichStringW.h
    │   ├── setup.h
    │   ├── SheetA.h
    │   └── SheetW.h
    ├── ken.cpp
    └── lib
        └── libxl.so

And this is my ken.cpp:

#include <iostream>
#include <vector>
#include <string>
#include "include/libxl.h"

using namespace std;
using namespace libxl;

int main()
{
    cout << "Hello babe :)" << endl;
    Book* book = xlCreateBook();
}

But I get these errors while trying to compile:

/run/media/mahdi/Mahdi/Projects/ken/src/ken.cpp:7:17: error: ‘libxl’ is not a namespace-name
    7 | using namespace libxl;
      |                 ^~~~~
/run/media/mahdi/Mahdi/Projects/ken/src/ken.cpp: In function ‘int main()’:
/run/media/mahdi/Mahdi/Projects/ken/src/ken.cpp:12:5: error: ‘Book’ was not declared in this scope
   12 |     Book* book = xlCreateBook();
      |     ^~~~
/run/media/mahdi/Mahdi/Projects/ken/src/ken.cpp:12:11: error: ‘book’ was not declared in this scope; did you mean ‘bool’?
   12 |     Book* book = xlCreateBook();
      |           ^~~~
      |           bool

I've never added an external library to visual studio code project before. Can I know what I'm doing wrong?


问:
BLE broadcaster device
I would like my BLE device (running on Linux) to be a broadcaster (broadcast data) - no connection is to be allowed. Following are the questions I have:

Which BLE profile would be most suitable for this requirement?

I understand that GATT is mandatory - does it mean I should use GATT and advertise my data in beacon and disallow any connection?

I have seen that Windows doesn't scan a BLE device which is simply a broadcaster i.e doesn't allow connection. Why so and what should I do for Windows to detect my broadcaster device?

Regards

Title: BLE broadcaster device


问:
How yii2 handles multiple databases in console?
I have a Yii2 backend app with the following database schema (hundred of databases).

```<code>  return [
      'components' => [
          'db1' => [
              'class' => 'yii\db\Connection',
              'dsn' => 'mysql:host=localhost;dbname=mydb1',
              'username' => 'my_username1',
              'password' => 'my_password1',
          ],
          'db2' => [
              'class' => 'yii\db\Connection',
              'dsn' => 'mysql:host=localhost;dbname=mydb2',
              'username' => 'my_username2',
              'password' => 'my_password2',
          ],
          ....

      ],
  ];
</code>```

The app is used by multiple companies.
Every time a user of a company logs in I save the company identifier in a session variable to be able to access the specific database of each company through getDb().
My problem is that I can't run console commands because I don't have access to the session.
Any idea to solve this problem?
Thanks in advance.

Body:
I have a Yii2 backend app with the following database schema (hundred of databases).

  return [
      'components' => [
          'db1' => [
              'class' => 'yii\db\Connection',
              'dsn' => 'mysql:host=localhost;dbname=mydb1',
              'username' => 'my_username1',
              'password' => 'my_password1',
          ],
          'db2' => [
              'class' => 'yii\db\Connection',
              'dsn' => 'mysql:host=localhost;dbname=mydb2',
              'username' => 'my_username2',
              'password' => 'my_password2',
          ],
          ....

      ],
  ];

The app is used by multiple companies.
Every time a user of a company logs in I save the company identifier in a session variable to be able to access the specific database of each company through getDb().
My problem is that I can't run console commands because I don't have access to the session.
Any idea to solve this problem?
Thanks in advance.


问:
Reality Composer: How to replace object without losing behaviours?
I have a 3D model which I'm setting up for AR using Reality Composer on a Mac. I've assigned a few basic behaviours to the model. For example, making certain objects spin when tapped.

The problem: I will need to make changes to the model based on client requests. When I make the changes and import the new model into Reality Composer the behaviours seem to be "unlinked". I'm hoping there's a way to import an updated model without having to set up the behaviours every time.

I'm new to Reality Composer so I might be missing something obvious.

I tried using the built-in "replace" option in the right-click menu. This does replace the model, but not without breaking the behaviours.


问:
SQL Spatial filtering - by DB query or by code
I have a SpringBoot application with MariaDB/MySQL database, and I want to know what is the best approach when using Spatial Data in the DB.

I have a SQL database with a table of Cities. Among other data each City has a Geometry defining its polygon shape.

Then I have a Point and I want to know if it belongs to any of my cities. This can be done by a SQL query or by code. And I would like to know if there's a preferred choice for this dilemma.

For the SQL-query-way, I would do this:

CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<City> query = builder.createQuery(City.class);
Root<City> root = query.from(City.class);
Expression<Geometry> limitPolygon = root.get("limitPolygon").as(Geometry.class);
ParameterExpression<Point> filterParam = builder.parameter(Point.class);

query.where(builder.isTrue(builder.function("intersects", Boolean.class, limitPolygon, filterParam)));

TypedQuery<City> typedQuery = entityManager.createQuery(query);
typedQuery.setParameter(filterParam, point);
City city = typedQuery.getSingleResult();
```
<p>And for the code-way, I would do this:</p>
<pre class="lang-java prettyprint-override"><code>List<City> cities = cityRepository.findAll();
City containerCity = null;
for (City city : cities){
    boolean contained = city.getLimitPolygon().intersects(point);
    if (contained){
        containerCity = city;
        break;
    }
}
</code>```

Some notes about the implementation:

Each City has no points in common with other City

Assume a total of 100 Cities in the DB (if the size of the table matters in the choice)

I've been reading that as a rule of thumb it's always preferred the SQL way, but I do not know if this applies to Spatial Data as well.

Body:
I have a SpringBoot application with MariaDB/MySQL database, and I want to know what is the best approach when using Spatial Data in the DB.

I have a SQL database with a table of Cities. Among other data each City has a Geometry defining its polygon shape.

Then I have a Point and I want to know if it belongs to any of my cities. This can be done by a SQL query or by code. And I would like to know if there's a preferred choice for this dilemma.

For the SQL-query-way, I would do this:

CriteriaBuilder builder = entityManager.getCriteriaBuilder();
CriteriaQuery<City> query = builder.createQuery(City.class);
Root<City> root = query.from(City.class);
Expression<Geometry> limitPolygon = root.get("limitPolygon").as(Geometry.class);
ParameterExpression<Point> filterParam = builder.parameter(Point.class);

query.where(builder.isTrue(builder.function("intersects", Boolean.class, limitPolygon, filterParam)));

TypedQuery<City> typedQuery = entityManager.createQuery(query);
typedQuery.setParameter(filterParam, point);
City city = typedQuery.getSingleResult();

And for the code-way, I would do this:

List<City> cities = cityRepository.findAll();
City containerCity = null;
for (City city : cities){
    boolean contained = city.getLimitPolygon().intersects(point);
    if (contained){
        containerCity = city;
        break;
    }
}

Some notes about the implementation:

Each City has no points in common with other City

Assume a total of 100 Cities in the DB (if the size of the table matters in the choice)

I've been reading that as a rule of thumb it's always preferred the SQL way, but I do not know if this applies to Spatial Data as well.


问:
How to solve this ==31==error Address sanitizer heap buffer overflow error?
```<code>/**
 * Note: The returned array must be malloced, assume caller calls free().
 */

char memo[10];
int count[500]={0,};

typedef struct Trie{
    int count;
    struct Trie * next[26];
}Trie;

void Initnode(struct Trie *node){
    node->count=0;
    for(int i=0;i<26;i++){
        node->next[i]=NULL;
    }
}

void fixtrie(struct Trie *root, char *wordsitem){
    int pw=0;
    struct Trie* cur=root;
    while(wordsitem[pw]!='\0'){
        if(cur->next[wordsitem[pw]-'a']==NULL){
            cur->next[wordsitem[pw]-'a']=malloc(sizeof(struct Trie));
            Initnode(cur->next[wordsitem[pw]-'a']);
            cur=cur->next[wordsitem[pw]-'a'];
            pw++;
        }
        else{
            cur=cur->next[wordsitem[pw]-'a'];
            pw++;
        }
    }
    (cur->count)++;
}

void dfs(struct Trie *root, char**result, int k,int pm){

    if(root->count>0){
        for(int i=0;i<k;i++){
            if(root->count >count[i]){
                for(int j=k-1;j>i;j--){
                    for(int c=0;c<10;c++) result[j][c]=result[j-1][c];
                    count[j]=count[j-1];
                }
                count[i]=root->count;

                for(int j=0;j<10;j++) result[i][j]=0;

                for(int j=0;j<pm;j++){
                    result[i][j]=memo[j];
                }
                printf("// %s //",result[i]);
                break;
            }
        }
    }
    printf(" %d ",pm);

    for(int i=0;i<26;i++){
       if(root->next[i]!=NULL){
           printf(" %d ",pm);
           memo[pm]= i+'a';
           printf("%s",memo);
           dfs(root->next[i],result,k,pm+1);
       }
    }
    return;
}

char ** topKFrequent(char ** words, int wordsSize, int k, int* returnSize){

    for(int j=0;j<500;j++){
        count[j]=0;
    }
    for(int j=0;j<10;j++){
        memo[j]=0;
    }
    *returnSize=k;
    struct Trie* root=malloc(sizeof(struct Trie)*1);
    Initnode(root);
    for(int i=0;i<wordsSize;i++){
        fixtrie(root,words[i]);
    }

    for(int i=0;i<26;i++){
       if(root->next[i]!=NULL){
       }
    }

    char**result=(char**) malloc (sizeof(char*)*k);

    for(int i=0;i<k;i++){
        result[i]=malloc(sizeof(char)*10);
    }

    dfs(root,result,k,0);

    printf("happy");

    for(int i=0;i<k;i++){
        printf("\n %s",result[i]);
    }

    printf("\n");
    return result;

}
</code>```

This problem is 692.problem of Leetcode.
I detect when words[I].length equals to 10, error occurs. but I don't know how to fix this code.

Input which occurs error is that ["glarko","zlfiwwb","nsfspyox","pwqvwmlgri","qggx","qrkgmliewc","zskaqzwo","zskaqzwo","ijy","htpvnmozay","jqrlad","ccjel","qrkgmliewc","qkjzgws","fqizrrnmif","jqrlad","nbuorw","qrkgmliewc","htpvnmozay","nftk","glarko","hdemkfr","axyak","hdemkfr","nsfspyox","nsfspyox","qrkgmliewc","nftk","nftk","ccjel","qrkgmliewc","ocgjsu","ijy","glarko","nbuorw","nsfspyox","qkjzgws","qkjzgws","fqizrrnmif","pwqvwmlgri","nftk","qrkgmliewc","jqrlad","nftk","zskaqzwo","glarko","nsfspyox","zlfiwwb","hwlvqgkdbo","htpvnmozay","nsfspyox","zskaqzwo","htpvnmozay","zskaqzwo","nbuorw","qkjzgws","zlfiwwb","pwqvwmlgri","zskaqzwo","qengse","glarko","qkjzgws","pwqvwmlgri","fqizrrnmif","nbuorw","nftk","ijy","hdemkfr","nftk","qkjzgws","jqrlad","nftk","ccjel","qggx","ijy","qengse","nftk","htpvnmozay","qengse","eonrg","qengse","fqizrrnmif","hwlvqgkdbo","qengse","qengse","qggx","qkjzgws","qggx","pwqvwmlgri","htpvnmozay","qrkgmliewc","qengse","fqizrrnmif","qkjzgws","qengse","nftk","htpvnmozay","qggx","zlfiwwb","bwp","ocgjsu","qrkgmliewc","ccjel","hdemkfr","nsfspyox","hdemkfr","qggx","zlfiwwb","nsfspyox","ijy","qkjzgws","fqizrrnmif","qkjzgws","qrkgmliewc","glarko","hdemkfr","pwqvwmlgri"]
14

I expect well answer.

But it occurs
enter image description here

How to fix my code?

Body:
/**
 * Note: The returned array must be malloced, assume caller calls free().
 */

char memo[10];
int count[500]={0,};

typedef struct Trie{
    int count;
    struct Trie * next[26];
}Trie;

void Initnode(struct Trie *node){
    node->count=0;
    for(int i=0;i<26;i++){
        node->next[i]=NULL;
    }
}

void fixtrie(struct Trie *root, char *wordsitem){
    int pw=0;
    struct Trie* cur=root;
    while(wordsitem[pw]!='\0'){
        if(cur->next[wordsitem[pw]-'a']==NULL){
            cur->next[wordsitem[pw]-'a']=malloc(sizeof(struct Trie));
            Initnode(cur->next[wordsitem[pw]-'a']);
            cur=cur->next[wordsitem[pw]-'a'];
            pw++;
        }
        else{
            cur=cur->next[wordsitem[pw]-'a'];
            pw++;
        }
    }
    (cur->count)++;
}

void dfs(struct Trie *root, char**result, int k,int pm){

    if(root->count>0){
        for(int i=0;i<k;i++){
            if(root->count >count[i]){
                for(int j=k-1;j>i;j--){
                    for(int c=0;c<10;c++) result[j][c]=result[j-1][c];
                    count[j]=count[j-1];
                }
                count[i]=root->count;

                for(int j=0;j<10;j++) result[i][j]=0;

                for(int j=0;j<pm;j++){
                    result[i][j]=memo[j];
                }
                printf("// %s //",result[i]);
                break;
            }
        }
    }
    printf(" %d ",pm);

    for(int i=0;i<26;i++){
       if(root->next[i]!=NULL){
           printf(" %d ",pm);
           memo[pm]= i+'a';
           printf("%s",memo);
           dfs(root->next[i],result,k,pm+1);
       }
    }
    return;
}

char ** topKFrequent(char ** words, int wordsSize, int k, int* returnSize){

    for(int j=0;j<500;j++){
        count[j]=0;
    }
    for(int j=0;j<10;j++){
        memo[j]=0;
    }
    *returnSize=k;
    struct Trie* root=malloc(sizeof(struct Trie)*1);
    Initnode(root);
    for(int i=0;i<wordsSize;i++){
        fixtrie(root,words[i]);
    }

    for(int i=0;i<26;i++){
       if(root->next[i]!=NULL){
       }
    }

    char**result=(char**) malloc (sizeof(char*)*k);

    for(int i=0;i<k;i++){
        result[i]=malloc(sizeof(char)*10);
    }

    dfs(root,result,k,0);

    printf("happy");

    for(int i=0;i<k;i++){
        printf("\n %s",result[i]);
    }

    printf("\n");
    return result;

}

This problem is 692.problem of Leetcode.
I detect when words[I].length equals to 10, error occurs. but I don't know how to fix this code.

Input which occurs error is that ["glarko","zlfiwwb","nsfspyox","pwqvwmlgri","qggx","qrkgmliewc","zskaqzwo","zskaqzwo","ijy","htpvnmozay","jqrlad","ccjel","qrkgmliewc","qkjzgws","fqizrrnmif","jqrlad","nbuorw","qrkgmliewc","htpvnmozay","nftk","glarko","hdemkfr","axyak","hdemkfr","nsfspyox","nsfspyox","qrkgmliewc","nftk","nftk","ccjel","qrkgmliewc","ocgjsu","ijy","glarko","nbuorw","nsfspyox","qkjzgws","qkjzgws","fqizrrnmif","pwqvwmlgri","nftk","qrkgmliewc","jqrlad","nftk","zskaqzwo","glarko","nsfspyox","zlfiwwb","hwlvqgkdbo","htpvnmozay","nsfspyox","zskaqzwo","htpvnmozay","zskaqzwo","nbuorw","qkjzgws","zlfiwwb","pwqvwmlgri","zskaqzwo","qengse","glarko","qkjzgws","pwqvwmlgri","fqizrrnmif","nbuorw","nftk","ijy","hdemkfr","nftk","qkjzgws","jqrlad","nftk","ccjel","qggx","ijy","qengse","nftk","htpvnmozay","qengse","eonrg","qengse","fqizrrnmif","hwlvqgkdbo","qengse","qengse","qggx","qkjzgws","qggx","pwqvwmlgri","htpvnmozay","qrkgmliewc","qengse","fqizrrnmif","qkjzgws","qengse","nftk","htpvnmozay","qggx","zlfiwwb","bwp","ocgjsu","qrkgmliewc","ccjel","hdemkfr","nsfspyox","hdemkfr","qggx","zlfiwwb","nsfspyox","ijy","qkjzgws","fqizrrnmif","qkjzgws","qrkgmliewc","glarko","hdemkfr","pwqvwmlgri"]
14

I expect well answer.

But it occurs
enter image description here

How to fix my code?


问:
How to make HTML Page that will make cards from .csv file?
I need to make website that will display information from .csv (or whatever you will advice). That information should look like: every string is individual card.

scheme of design

sample of csv

i tried to search information of DOM and d3js, but doesnt understand how to create every object individually and how to pic only on part of Table


问:
Hyperledger fabric2.5 peer lifecycle chaincode approveformyorg Error: timed out waiting for txid on all peers
I am running HyperledgerFabric 2.5 and I would like to deploy a 3 organizations network with multi peers when I commitChaincodeDefinition i faced an "Error: timed out waiting for txid on all peers"

i already tried to fix it after doing research and saw that it DNS error people solved it by adding an extra host but i couldn't fix it.
Any suggestion will be appreciated


问:
Bash Script - Not collateral after echo due to new line
I'm trying to get below output but always output comes with one more newline. How can I obtain desired output?

Desired output:  3 number of line detected

Actual output:

3

number of line is detected.

```<code>linecount= awk '{/^./ && c++};END{print c}' < test.txt //// (or cat text.txt | wc -l (both is ok))

if [ -s test.txt ]; then
        echo  $linecount number of line detected
        echo
else
        echo No line detected.
        echo
</code>```

Body:
I'm trying to get below output but always output comes with one more newline. How can I obtain desired output?

Desired output:  3 number of line detected

Actual output:

3

number of line is detected.

linecount= awk '{/^./ && c++};END{print c}' < test.txt //// (or cat text.txt | wc -l (both is ok))

if [ -s test.txt ]; then
        echo  $linecount number of line detected
        echo
else
        echo No line detected.
        echo


问:
TypeError: Argument 'isBinary' is not convertable to bool
I am trying to load the model of yolov3 model using cv2 as shown bellow

net = cv2.dnn.readNetFromTorch('yolov3-tiny.cfg','yolov3-tiny.pt')

It is showing the following Type Error

TypeError: Argument 'isBinary' is not convertable to bool

For caffe model of Mobilenet it worked fine
net = cv2.dnn.readNetFromCaffe('MobileNetSSD_deploy.prototxt.txt', 'MobileNetSSD_deploy.caffemodel')

But for yolo torch model, what files need to be send into cv2.dnn.readNetTorch()
Please help, I highly appreciate the help. thank you.

For YOLO there are .cfg, .yaml, .pt files are there. so, what exact files need to be sent into cv2.dnn.readNetTorch()? For all combinations, I am getting the same TypeError mentioned above.


问:
Populating value from an object array to multiple (pre)selected option in Vue.JS
I Try to add the value of (pre)selected options into the multiple dropdowns but I get only the first value rendered.

I try to add data below into multiple select>options, but I got only first(same) value from input and quidoId on every input/quidoId value

```<code>stationButtons: [
  {
    "buttonId": 1,
    "quidoId": "101",
    "input": "11"
  },
  {
    "buttonId": 2,
    "quidoId": "102",
    "input": "22"
  },
  {
    "buttonId": 3,
    "quidoId": "103",
    "input": "33"
  },
  {
    "buttonId": 4,
    "quidoId": "104",
    "input": "44"
  }
]
</code>```

Output values

I got this issue because I got every dropdown rendered dynamically because I got values(options to choose from) from API. Here is a sample of the code where I render the quidoId(TEST 101) and input(11).

```<code>
<tr
            v-for="(btn, index) in filteredButtonList"
            v-bind:key="btn.id"
            style="border: 1px solid #6b6b6b; font-size: 14px; width: 100%"
          >
            <td>{{ btn.buttonListName }}</td>
            <td>{{ btn.buttonListDesc }}</td>
            <td>
              <select
                @change="onQuidoIdChange($event)"
                class="form-select form-control required"
                v-bind:id="index + 1"
                style="border: 1px solid #6b6b6b"
              >
                <option
                  class="quido-id"
                  v-for="entry in selectedQuidoId"
                  :value="entry.quidoId"
                  selected
                  disabled
                  hidden
                  :key="entry.quidoId"
                >
                  {{ entry.quidoName }}
                </option>
                <option
                  v-for="quido in filteredQuidosList"
                  :value="quido.quidoId"
                  v-bind:key="quido.quidoId"
                  v-bind:id="quido.quidoId"
                >
                  {{ quido.quidoName }}
                </option>
              </select>
            </td>
            <td>
              <tr>
                <td>
                  <input
                    @change="onInputChange($event)"
                    type="number"
                    class="input-custom"
                    :placeholder="`Input ${index + 1} `"
                    v-for="input in selectedInput"
                    :value=input.input
                    v-bind:id="index + 1"
                    v-bind:key="input.input"
                    style="font-size: 12px; border: 1px solid #6b6b6b; text-align: center"
                  />
                </td>
              </tr>
            </td>
          </tr>
</code>```

SCRIPT TAG

```<code><script>
export default {
  inheritAttrs: false,
  data() {
    return {
      index: 0,
      station: {
        line: "",
        physLine: "",
        wsType: "",
        ws: "",
        name: "",
        desc: null,
        isValid: true,
        order: "",
        stationGroupId: "",
        stationButtons: [],
      },
      editIsClicked: false,
      deleteIsClicked: false,
      selectedQuidoId: [],
      selectedStationGroupId: [],
      selectedInput: [],
    };
  },
  props: [
    "id",
    "lineNum",
    "physLine",
    "wsType",
    "ws",
    "name",
    "isValid",
    "stationGroupId",
    "stationGroupName",
    "order",
  ],
  computed: {
    filteredStations() {
      return this.$store.getters["stations/stations"];
    },
    filteredButtonList() {
      return this.$store.getters["stations/buttonListGetter"];
    },
    filteredQuidosList() {
      return this.$store.getters["stations/quidosListGetter"];
    },
    filteredStationGroups() {
      return this.$store.getters["stations/stationGroups"];
    },
    filteredStationButtons() {
      return this.$store.getters["stations/stationButtonsGetter"];
    },
  },
  methods: {
    editStation(event) {
      this.editIsClicked = !this.editIsClicked;

      let idFromClickedButton = parseInt(event.target.id);

      let idFromStationListResultsId = this.filteredStations.value.find(
        (el) => el.id === idFromClickedButton
      );

      if (idFromStationListResultsId) {
        this.station = idFromStationListResultsId;
      } else {
        alert("This ID does not exist");
      }

      let quidoFromStationListResults = idFromStationListResultsId.stationButtons;

      let quidoForEditing = quidoFromStationListResults.find((el) => el.quidoId);

      let quidoFromOriginalArr = this.filteredQuidosList.find(
        (el) => el.quidoId === quidoForEditing.quidoId
      );

      if (quidoFromOriginalArr) {
        this.selectedQuidoId.push(quidoFromOriginalArr);
      }

      let inputFromStationListResults = idFromStationListResultsId.stationButtons;

      let inputForEditing = inputFromStationListResults.find((el) => el.input);

      if (inputForEditing) {
        this.selectedInput.push(inputForEditing);
      }

      let stationGroupsIdFromStationListArr = idFromStationListResultsId.stationGroupId;

      let stationGroupIdFromStationGroupslArr = this.filteredStationGroups.find(
        (el) => el.stationGroupsId == stationGroupsIdFromStationListArr
      );

      if (stationGroupsIdFromStationListArr) {
        this.selectedStationGroupId.push(stationGroupIdFromStationGroupslArr);
      } else {
        alert("This Id does not exist!");
      }
    },
  },
};
</script>
</code>```

I need only help with the logic behind this solution, how to assign every value to every dropdown?
If I missed some important information which can help please let me know, I will be glad to share more.

CODE SANDBOX EXAMPLE

Body:
I Try to add the value of (pre)selected options into the multiple dropdowns but I get only the first value rendered.

I try to add data below into multiple select>options, but I got only first(same) value from input and quidoId on every input/quidoId value

stationButtons: [
  {
    "buttonId": 1,
    "quidoId": "101",
    "input": "11"
  },
  {
    "buttonId": 2,
    "quidoId": "102",
    "input": "22"
  },
  {
    "buttonId": 3,
    "quidoId": "103",
    "input": "33"
  },
  {
    "buttonId": 4,
    "quidoId": "104",
    "input": "44"
  }
]

Output values

I got this issue because I got every dropdown rendered dynamically because I got values(options to choose from) from API. Here is a sample of the code where I render the quidoId(TEST 101) and input(11).

            {{ btn.buttonListName }}
            {{ btn.buttonListDesc }}

              <select
                @change="onQuidoIdChange($event)"
                class="form-select form-control required"
                v-bind:id="index + 1"
                style="border: 1px solid #6b6b6b"
              >
                <option
                  class="quido-id"
                  v-for="entry in selectedQuidoId"
                  :value="entry.quidoId"
                  selected
                  disabled
                  hidden
                  :key="entry.quidoId"
                >
                  {{ entry.quidoName }}
                </option>
                <option
                  v-for="quido in filteredQuidosList"
                  :value="quido.quidoId"
                  v-bind:key="quido.quidoId"
                  v-bind:id="quido.quidoId"
                >
                  {{ quido.quidoName }}
                </option>
              </select>

                  <input
                    @change="onInputChange($event)"
                    type="number"
                    class="input-custom"
                    :placeholder="`Input ${index + 1} `"
                    v-for="input in selectedInput"
                    :value=input.input
                    v-bind:id="index + 1"
                    v-bind:key="input.input"
                    style="font-size: 12px; border: 1px solid #6b6b6b; text-align: center"
                  />

SCRIPT TAG

I need only help with the logic behind this solution, how to assign every value to every dropdown?
If I missed some important information which can help please let me know, I will be glad to share more.

CODE SANDBOX EXAMPLE


问:
Send document with preview using Telegram API
I'm creating a bot which task is just to show the document with the preview. So firstly we send the document itself and the preview after that. I added screenshot of the desired result, but the actual result is just the doc itself. I don't understand why Thumb property is just ignored. By the way I tried telebot lib as well.

```<code>bot, err := tgbotapi.NewBotAPI(viper.GetString("tg_api_key"))
if err != nil {
    panic(err)
}

u := tgbotapi.NewUpdate(0)
u.Timeout = 60

var docId tgbotapi.FileID

updates := bot.GetUpdatesChan(u)
for update := range updates {
    msg := update.Message
    if msg == nil {
        continue
    }

    var reply []string
    switch {
    case msg.Text == "/start":
        reply = []string{"Send me the document to be previewed"}
    case msg.Document != nil:
        docId = tgbotapi.FileID(msg.Document.FileID)
        reply = []string{"Now send me the thumbnail"}
    case msg.Photo != nil:
        doc := tgbotapi.NewDocument(msg.Chat.ID, docId)
        doc.Thumb = tgbotapi.FileID(msg.Photo[0].FileID)
        bot.Send(doc)
        continue
    default:
        reply = []string{"Unknown command"}
    }

    result := tgbotapi.NewMessage(msg.Chat.ID, strings.Join(reply, "\n"))
    bot.Send(result)
}
</code>```

Body:
I'm creating a bot which task is just to show the document with the preview. So firstly we send the document itself and the preview after that. I added screenshot of the desired result, but the actual result is just the doc itself. I don't understand why Thumb property is just ignored. By the way I tried telebot lib as well.

bot, err := tgbotapi.NewBotAPI(viper.GetString("tg_api_key"))
if err != nil {
    panic(err)
}

u := tgbotapi.NewUpdate(0)
u.Timeout = 60

var docId tgbotapi.FileID

updates := bot.GetUpdatesChan(u)
for update := range updates {
    msg := update.Message
    if msg == nil {
        continue
    }

    var reply []string
    switch {
    case msg.Text == "/start":
        reply = []string{"Send me the document to be previewed"}
    case msg.Document != nil:
        docId = tgbotapi.FileID(msg.Document.FileID)
        reply = []string{"Now send me the thumbnail"}
    case msg.Photo != nil:
        doc := tgbotapi.NewDocument(msg.Chat.ID, docId)
        doc.Thumb = tgbotapi.FileID(msg.Photo[0].FileID)
        bot.Send(doc)
        continue
    default:
        reply = []string{"Unknown command"}
    }

    result := tgbotapi.NewMessage(msg.Chat.ID, strings.Join(reply, "\n"))
    bot.Send(result)
}


问:
How to await dispatching an invalidateTags in RTK Query
I have a chat app where you can create group chat. Once the group chat is created I invalidate the Users tags which is provided when getting all users and related groupchats. I also want to run a query for each user to get the messages for each instance, however the getMessages query needs to be ran after the Invalidate Tag is complete and all the users data has been refetched. So is there a way to await the invalidate Tag including the re-fetching. I could just use a setTimeout for the query to get the messages but I can't say for sure how long it would take for to re-fetch the users.

This is my implementation so far:
await Promise.resolve(dispatch(apiSlice.util.invalidateTags([{ type: 'Users' as const, id: 'LIST' }]))); dispatch(startApp({ refetch: true }));

But I don't think Promise.resolve() has an effect or also affects the refetch time


问:
DetoxRuntimeError: Detox worker instance has not been installed in this context (DetoxSecondaryContext). when running Expo-Detox-Typescript
I want to test an Expo app with Detox v20.1.1 in Typescript. I have been following multiple guides, but they all seem kind of outdated. Right now, I have managed to get the test to start, but I get this error:

```<code>    DetoxRuntimeError: Detox worker instance has not been installed in this context (DetoxSecondaryContext).

    HINT: If you are using Detox with Jest according to the latest guide, please report this issue on our GitHub tracker:
    https://github.com/wix/Detox/issues
    Otherwise, make sure you call detox.installWorker() beforehand.

      3 | describe('Example', () => {
      4 |   beforeAll(async () => {
    > 5 |     await device.launchApp()
        |                  ^
      6 |   })
      7 |
      8 |   beforeEach(async () => {
</code>```

Do you know what's that all about? I wanted to use detox.init(), but that is no longer defined. Shouldn't this be covered in globalSetup that I define in jest.config.js?

detoxrc:

```<code>/** @type {Detox.DetoxConfig} */
module.exports = {
  testRunner: {
    args: {
      $0: 'jest',
      args: {
        config: 'test/e2e/jest.config.js',
      },
    },
    jest: {
      setupTimeout: 120000,
    },
  },
  apps: {
    ios: {
      type: 'ios.app',
      binaryPath: 'bin/Exponent.app',
      build: 'npm run ios',
    },
  },
  devices: {
    simulator: {
      type: 'ios.simulator',
      device: {
        type: 'iPhone SE (3rd generation)',
      },
    },
  },
  configurations: {
    'ios.sim': {
      device: 'simulator',
      app: 'ios',
    },
  },
}
</code>```

test/e2e/jest.config.js

```<code>module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  rootDir: '..',
  testMatch: ['<rootDir>/**/*.test.ts'],
  testTimeout: 120000,
  maxWorkers: 1,
  reporters: ['detox/runners/jest/reporter'],
  globalSetup: 'detox/runners/jest/globalSetup',
  globalTeardown: 'detox/runners/jest/globalTeardown',
  verbose: true,
}
</code>```

Please help :(

Body:
I want to test an Expo app with Detox v20.1.1 in Typescript. I have been following multiple guides, but they all seem kind of outdated. Right now, I have managed to get the test to start, but I get this error:

    DetoxRuntimeError: Detox worker instance has not been installed in this context (DetoxSecondaryContext).

    HINT: If you are using Detox with Jest according to the latest guide, please report this issue on our GitHub tracker:
    https://github.com/wix/Detox/issues
    Otherwise, make sure you call detox.installWorker() beforehand.

      3 | describe('Example', () => {
      4 |   beforeAll(async () => {
    > 5 |     await device.launchApp()
        |                  ^
      6 |   })
      7 |
      8 |   beforeEach(async () => {

Do you know what's that all about? I wanted to use detox.init(), but that is no longer defined. Shouldn't this be covered in globalSetup that I define in jest.config.js?

detoxrc:

/** @type {Detox.DetoxConfig} */
module.exports = {
  testRunner: {
    args: {
      $0: 'jest',
      args: {
        config: 'test/e2e/jest.config.js',
      },
    },
    jest: {
      setupTimeout: 120000,
    },
  },
  apps: {
    ios: {
      type: 'ios.app',
      binaryPath: 'bin/Exponent.app',
      build: 'npm run ios',
    },
  },
  devices: {
    simulator: {
      type: 'ios.simulator',
      device: {
        type: 'iPhone SE (3rd generation)',
      },
    },
  },
  configurations: {
    'ios.sim': {
      device: 'simulator',
      app: 'ios',
    },
  },
}

test/e2e/jest.config.js

module.exports = {
  preset: 'ts-jest',
  testEnvironment: 'node',
  rootDir: '..',
  testMatch: ['<rootDir>/**/*.test.ts'],
  testTimeout: 120000,
  maxWorkers: 1,
  reporters: ['detox/runners/jest/reporter'],
  globalSetup: 'detox/runners/jest/globalSetup',
  globalTeardown: 'detox/runners/jest/globalTeardown',
  verbose: true,
}

Please help :(


问:
Deploying Hasura on container app with existing Postgresql Flexible Server
How can be deploy Hasura on Container App with postgresql Flexible Server using dockerfile or docker compose.</p>


问:
Android studio project build error: Linking CXX shared FAILED
I'm asking for help in building a project for Android (my knowledge in this tends to 0).
There is a rather old project. I'm trying to build it in AndroidStudio, I get the following error:

Build command failed.
Error while executing process C:\Users\User\AppData\Local\Android\Sdk\cmake\3.18.1\bin\ninja.exe with arguments {-C C:\Users\User\IdeaProjects\1\stouch-task-hardware-upgrade-investigation\app.cxx\RelWithDebInfo\2a9512e2\armeabi-v7a stouch}
ninja: Entering directory `C:\Users\User\IdeaProjects\1\stouch-task-hardware-upgrade-investigation\app.cxx\RelWithDebInfo\2a9512e2\armeabi-v7a'
[1/1] Linking CXX shared library ........\build\intermediates\cxx\RelWithDebInfo\2a9512e2\obj\armeabi-v7a\libstouch.so

I tried different versions of studio, java, gradle but the result is always the same.

How do I fix it?

Update:

2023-01-12 23:41:37,079 [e-1136-b06]   WARN -
ea.gradle.project.sync.SdkSync - Replacing invalid NDK path
C:\Users\User\AppData\Local\Android\Sdk\ndk-bundle with
C:\Users\User\AppData\Local\Android\Sdk\ndk-bundle  2023-01-12
23:41:37,079 [e-1136-b06]   INFO - e.project.sync.GradleSyncState -
Started sync with Gradle for project 'stouch'.  2023-01-12
23:41:37,080 [e-1136-b06]   INFO - idea.project.IndexingSuspender -
Consuming IndexingSuspender activation event: SYNC_STARTED  2023-01-12
23:41:37,080 [e-1136-b06]   INFO - idea.project.IndexingSuspender -
Starting batch update for project: Project
'C:\Users\User\IdeaProjects\AS\9\stouch' stouch  2023-01-12
23:41:37,087 [thread 116]   INFO - s.plugins.gradle.GradleManager -
Instructing gradle to use java from C:/Program Files/Android/Android
Studio/jre  2023-01-12 23:41:37,088 [thread 116]   INFO -
s.plugins.gradle.GradleManager - Instructing gradle to use java from
C:/Program Files/Android/Android Studio/jre  2023-01-12 23:41:37,101
[thread 116]   INFO - xecution.GradleExecutionHelper - Passing
command-line args to Gradle Tooling API: -Didea.version=3.2
-Djava.awt.headless=true -Pandroid.injected.build.model.only=true -Pandroid.injected.build.model.only.advanced=true -Pandroid.injected.invoked.from.ide=true -Pandroid.injected.build.model.only.versioned=3 -Pandroid.injected.studio.version=3.2.1.0 -Pandroid.builder.sdkDownload=false --init-script C:\Users\User\AppData\Local\Temp\ijinit17.gradle  2023-01-12
23:41:37,770 [thread 116]   INFO - .project.GradleProjectResolver -
Gradle project resolve error  org.gradle.tooling.BuildException: Could
not run build action using Gradle distribution
'https://services.gradle.org/distributions/gradle-4.2-all.zip'.   at
org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:51)
at
org.gradle.tooling.internal.consumer.ExceptionTransformer.transform(ExceptionTransformer.java:29)
at
org.gradle.tooling.internal.consumer.ResultHandlerAdapter.onFailure(ResultHandlerAdapter.java:41)


问:
Purview deleting a classification
I have created a custom classification in Purview which is looking for a specific column name from a SQL Server source.

The scan does pick up the classification and assign it to the column accordingly, however when i delete the classification rule, I select "Delete this rule and delete all applied classifications", the column that was detected still has the classification assigned to it, and I am unable to delete the custom classification as it is still referenced by the column.

The workaround is to manually remove it from the column first which is not ideal, especially if it is assigned to multiple columns.

In purview, create custom classification to detect specific column text.

Perform scan, new classification is applied to column.

Delete custom classification rules and select "Delete this rule and delete all applied classifications"

Try and delete custom classification - unable to as it is still referenced by the column that was detected by the scan.

Title: Purview deleting a classification


问:
Using axios to submit a form without
As you can see the code blow I tried to submit the form using axios but every time i try to submit the form i get a bad request error. but if submit this way it works! BUT then it redirect to /api/user/.

I'm using Next.js.

```<code>        <Form
          // onSubmit={(e) => {
          //   e.preventDefault();
          //   axios({
          //     method: "POST",
          //     url: "/api/user",
          //     data: {
          //       name: e.currentTarget.userName.value,
          //       email: e.currentTarget.userEmail.value,
          //       password: e.currentTarget.usePass.value,
          //     },
          //   }).then((res) => {
          //     prompt("Success", JSON.stringify(res.data));
          //   });
          // }}
          action="/api/user"
          method="POST"
        >
</code>```

Title: Using axios to submit a form without

Body:
As you can see the code blow I tried to submit the form using axios but every time i try to submit the form i get a bad request error. but if submit this way it works! BUT then it redirect to /api/user/.

I'm using Next.js.

        <Form
          // onSubmit={(e) => {
          //   e.preventDefault();
          //   axios({
          //     method: "POST",
          //     url: "/api/user",
          //     data: {
          //       name: e.currentTarget.userName.value,
          //       email: e.currentTarget.userEmail.value,
          //       password: e.currentTarget.usePass.value,
          //     },
          //   }).then((res) => {
          //     prompt("Success", JSON.stringify(res.data));
          //   });
          // }}
          action="/api/user"
          method="POST"
        >