问:
How to access A/B test results from Google Play Android Developer API?
I would like to get access to the test results of A/B tests from the Google Play Android Developer API. I would like the test results for: icons, images and titles. Is this possible?

I would also like to publish new A/B tests on the Google Play console using the API.

I have looked at the documentation  but I could not find anything for A/B testing and Google Play experiments.


来源: stackexchange

问:
How to allow only 15 digits with the slash bot discord command? in python
How to allow only 15 digits with the slash bot discord command? in python

I'm trying to program a bot for discord that allows you to delete an imgur image with the deletehash , what I'm trying to do is that it can only allow 15 digits since the deletehash has 15 digits, but when adding less than 15 digits it throws me error in the console (CMD)

This is the error it shows me:

```<code>An exception has occurred while executing command `borrar1`:
    Traceback (most recent call last):
      File "C:\Users\iroke\AppData\Local\Programs\Python\Python37\lib\site-packages\discord_slash\client.py", line 1352, in invoke_command
        await func.invoke(ctx, **args)
      File "C:\Users\iroke\AppData\Local\Programs\Python\Python37\lib\site-packages\discord_slash\model.py", line 210, in invoke
        return await self.func(*args, **kwargs)
      File "C:\xampp\htdocs\imgur\imgur\img\cu.py", line 31, in borrar1
        while len(borrar_imagen)  !=15:
    TypeError: object of type 'SlashMessage' has no len()

</code>```

This is the code I'm using:

```<code> import discord
    from discord.ext import commands
    from discord_slash import SlashCommand
    from discord_slash.utils.manage_commands import create_choice, create_option
    from discord_slash import SlashCommand, SlashContext
    import requests

        bot = commands.Bot(command_prefix = '/')
        bot.remove_command("help") # Borra el comando por defecto !help
        slash = SlashCommand(bot, sync_commands=True)
        @slash.slash(
            name="borrar1", description="Escribe La id para borrar la iamgen",
            options=[
                        create_option(
                          name="borrar_imagen",
                          description="Escribe el ID para borrar la imagen",
                          option_type=3,
                          required=True
                        ),

            ])

        async def borrar1(ctx:SlashContext, borrar_imagen:str):
            url = f"https://api.imgur.com/3/image/{borrar_imagen}"
            while len(borrar_imagen) !=15:
                borrar_imagen = await ctx.send("Sólo 15 digitos")
            payload={}
            files={}

            headers = {
                'Authorization': "Bearer "}
            response = requests.request("DELETE", url, headers=headers, data=payload, files=files)

            embed=discord.Embed(title="", description="Imagen borrada con exito!", color=0x00ff11)
            if response.json()["status"] == 200:
                    await ctx.send(embed=embed, hidden=True)

            embed=discord.Embed(title="", description="No está permitido paginas webs", color=0xff0019)
            if response.json()["status"] == 400:
                await ctx.send(embed=embed, hidden=True)

            embed=discord.Embed(title="", description="Error!", color=0xff0019)
            if response.json()["status"] == 403:
                await ctx.send(embed=embed, hidden=True)

    bot.run("")
</code>```

This is the part that is failing:

```<code>while len(borrar_imagen) !=15:
            borrar_imagen = await ctx.send("Sólo 15 digitos")
</code>```

I don't know how to fix it

Could someone help me, thank you very much!

ContentLicense: CC BY-SA 4.0

Body:
How to allow only 15 digits with the slash bot discord command? in python

I'm trying to program a bot for discord that allows you to delete an imgur image with the deletehash , what I'm trying to do is that it can only allow 15 digits since the deletehash has 15 digits, but when adding less than 15 digits it throws me error in the console (CMD)

This is the error it shows me:

An exception has occurred while executing command `borrar1`:
    Traceback (most recent call last):
      File "C:\Users\iroke\AppData\Local\Programs\Python\Python37\lib\site-packages\discord_slash\client.py", line 1352, in invoke_command
        await func.invoke(ctx, **args)
      File "C:\Users\iroke\AppData\Local\Programs\Python\Python37\lib\site-packages\discord_slash\model.py", line 210, in invoke
        return await self.func(*args, **kwargs)
      File "C:\xampp\htdocs\imgur\imgur\img\cu.py", line 31, in borrar1
        while len(borrar_imagen)  !=15:
    TypeError: object of type 'SlashMessage' has no len()

This is the code I'm using:

 import discord
    from discord.ext import commands
    from discord_slash import SlashCommand
    from discord_slash.utils.manage_commands import create_choice, create_option
    from discord_slash import SlashCommand, SlashContext
    import requests

        bot = commands.Bot(command_prefix = '/')
        bot.remove_command("help") # Borra el comando por defecto !help
        slash = SlashCommand(bot, sync_commands=True)
        @slash.slash(
            name="borrar1", description="Escribe La id para borrar la iamgen",
            options=[
                        create_option(
                          name="borrar_imagen",
                          description="Escribe el ID para borrar la imagen",
                          option_type=3,
                          required=True
                        ),

            ])

        async def borrar1(ctx:SlashContext, borrar_imagen:str):
            url = f"https://api.imgur.com/3/image/{borrar_imagen}"
            while len(borrar_imagen) !=15:
                borrar_imagen = await ctx.send("Sólo 15 digitos")
            payload={}
            files={}

            headers = {
                'Authorization': "Bearer "}
            response = requests.request("DELETE", url, headers=headers, data=payload, files=files)

            embed=discord.Embed(title="", description="Imagen borrada con exito!", color=0x00ff11)
            if response.json()["status"] == 200:
                    await ctx.send(embed=embed, hidden=True)

            embed=discord.Embed(title="", description="No está permitido paginas webs", color=0xff0019)
            if response.json()["status"] == 400:
                await ctx.send(embed=embed, hidden=True)

            embed=discord.Embed(title="", description="Error!", color=0xff0019)
            if response.json()["status"] == 403:
                await ctx.send(embed=embed, hidden=True)

    bot.run("")

This is the part that is failing:

while len(borrar_imagen) !=15:
            borrar_imagen = await ctx.send("Sólo 15 digitos")

I don't know how to fix it

Could someone help me, thank you very much!


问:
Getting all keys from a LMDB database using a cursor in Rust
I am writing a module to store the nodes and edges of a graph in an LMDB database:

lmdb-rkv = "0.14.0"
```
<pre class="lang-rust prettyprint-override"><code>use lmdb::{
    Cursor, Database, DatabaseFlags, Environment, Error, Iter, RoCursor, RwTransaction,
    Transaction, WriteFlags,
};

pub struct DB {
    env: Environment,
    meta: Database,
    nodes: Database,
    edge_values: Database,
    ref_count: Database,
    path: PathBuf,
    num_nodes: u64,
    version: Version,
}
</code>```

I have a method that is supposed to return all of the keys in the "nodes" database as an iterator:

type DBIter<'txn> = Map<Iter<'txn>, fn(lmdb::Result<(&'txn [u8], &'txn [u8])>) -> String>;
```
<pre class="lang-rust prettyprint-override"><code>impl DB {
    ...

    fn get_keys<T: Transaction>(&self, db: Database, txn: &T) -> DBIter {
        let mut cursor = txn.open_ro_cursor(db).unwrap();
        cursor.iter().map(|x| {
            let (x, _) = x.unwrap();
            String::from_utf8(x.to_vec()).unwrap()
        })
    }

    pub fn get_nodes(&self) -> DBIter {
        let txn = self.env.begin_ro_txn().unwrap();
        self.get_keys(self.nodes, &txn)
    }

    ...
}
</code>```

When I run my test:

#[cfg(test)]
mod tests {
    ...

    #[test]
    fn get_nodes() {
        let dir = tempdir().unwrap();
        let db = DB::new(dir.path());
        let nodes = gen_nodes(100);
        {
            let mut txn = db.env.begin_rw_txn().unwrap();
            let mut curosr = txn.open_rw_cursor(db.nodes).unwrap();

            for node in nodes.keys() {
                let mut hasher = DefaultHasher::new();
                node.hash(&mut hasher);
                let hash = hasher.finish();
                curosr
                    .put(
                        &hash.to_le_bytes(),
                        &node.as_bytes(),
                        WriteFlags::NO_OVERWRITE,
                    )
                    .unwrap()
            }
        }

        for node in db.get_nodes() {
            assert!(&nodes.contains_key(&node));
        }
    }
}
```
<p>I get:</p>
```called `Result::unwrap()` on an `Err` value: BadTxn
thread 'database::tests::get_nodes' panicked at 'called `Result::unwrap()` on an `Err` value: BadTxn', src/database.rs:144:28
stack backtrace:
   0: rust_begin_unwind
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/result.rs:1785:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/result.rs:1107:23
   4: graph_store::database::DB::get_keys::{{closure}}
             at ./src/database.rs:144:26
   5: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
   6: core::ops::function::FnMut::call_mut
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:164:5
   7: core::ops::function::impls::<impl core::ops::function::FnOnce for &mut F>::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:306:13
   8: core::option::Option<T>::map
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/option.rs:929:29
   9: <core::iter::adapters::map::Map as core::iter::traits::iterator::Iterator>::next
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/iter/adapters/map.rs:103:9
  10: graph_store::database::tests::get_nodes
             at ./src/database.rs:398:21
  11: graph_store::database::tests::get_nodes::{{closure}}
             at ./src/database.rs:376:5
  12: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
  13: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
```

I have read/skimmed:

http://www.lmdb.tech/doc/group__errors.html#gadcc86b34304f2ae761e3ba7c2eb88ba9

https://docs.rs/lmdb-rkv/latest/lmdb/index.html

https://docs.oracle.com/database/bdb181/html/gsg_txn/CXX/index.html

https://docs.oracle.com/database/bdb181/html/gsg/CXX/Cursors.html

http://www.lmdb.tech/doc/group__mdb.html#ga9ff5d7bd42557fd5ee235dc1d62613aa

I'm a Rust and LMDB novice, so please excuse any obvious mistakes that I might have made.

Body:
I am writing a module to store the nodes and edges of a graph in an LMDB database:

lmdb-rkv = "0.14.0"

use lmdb::{
    Cursor, Database, DatabaseFlags, Environment, Error, Iter, RoCursor, RwTransaction,
    Transaction, WriteFlags,
};

pub struct DB {
    env: Environment,
    meta: Database,
    nodes: Database,
    edge_values: Database,
    ref_count: Database,
    path: PathBuf,
    num_nodes: u64,
    version: Version,
}

I have a method that is supposed to return all of the keys in the "nodes" database as an iterator:

type DBIter<'txn> = Map<Iter<'txn>, fn(lmdb::Result<(&'txn [u8], &'txn [u8])>) -> String>;

impl DB {
    ...

    fn get_keys<T: Transaction>(&self, db: Database, txn: &T) -> DBIter {
        let mut cursor = txn.open_ro_cursor(db).unwrap();
        cursor.iter().map(|x| {
            let (x, _) = x.unwrap();
            String::from_utf8(x.to_vec()).unwrap()
        })
    }

    pub fn get_nodes(&self) -> DBIter {
        let txn = self.env.begin_ro_txn().unwrap();
        self.get_keys(self.nodes, &txn)
    }

    ...
}

When I run my test:

#[cfg(test)]
mod tests {
    ...

    #[test]
    fn get_nodes() {
        let dir = tempdir().unwrap();
        let db = DB::new(dir.path());
        let nodes = gen_nodes(100);
        {
            let mut txn = db.env.begin_rw_txn().unwrap();
            let mut curosr = txn.open_rw_cursor(db.nodes).unwrap();

            for node in nodes.keys() {
                let mut hasher = DefaultHasher::new();
                node.hash(&mut hasher);
                let hash = hasher.finish();
                curosr
                    .put(
                        &hash.to_le_bytes(),
                        &node.as_bytes(),
                        WriteFlags::NO_OVERWRITE,
                    )
                    .unwrap()
            }
        }

        for node in db.get_nodes() {
            assert!(&nodes.contains_key(&node));
        }
    }
}

I get:

called `Result::unwrap()` on an `Err` value: BadTxn
thread 'database::tests::get_nodes' panicked at 'called `Result::unwrap()` on an `Err` value: BadTxn', src/database.rs:144:28
stack backtrace:
   0: rust_begin_unwind
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/std/src/panicking.rs:584:5
   1: core::panicking::panic_fmt
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/panicking.rs:142:14
   2: core::result::unwrap_failed
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/result.rs:1785:5
   3: core::result::Result<T,E>::unwrap
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/result.rs:1107:23
   4: graph_store::database::DB::get_keys::{{closure}}
             at ./src/database.rs:144:26
   5: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
   6: core::ops::function::FnMut::call_mut
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:164:5
   7: core::ops::function::impls::<impl core::ops::function::FnOnce for &mut F>::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:306:13
   8: core::option::Option<T>::map
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/option.rs:929:29
   9: <core::iter::adapters::map::Map as core::iter::traits::iterator::Iterator>::next
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/iter/adapters/map.rs:103:9
  10: graph_store::database::tests::get_nodes
             at ./src/database.rs:398:21
  11: graph_store::database::tests::get_nodes::{{closure}}
             at ./src/database.rs:376:5
  12: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
  13: core::ops::function::FnOnce::call_once
             at /rustc/897e37553bba8b42751c67658967889d11ecd120/library/core/src/ops/function.rs:248:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.

I have read/skimmed:

http://www.lmdb.tech/doc/group__errors.html#gadcc86b34304f2ae761e3ba7c2eb88ba9

https://docs.rs/lmdb-rkv/latest/lmdb/index.html

https://docs.oracle.com/database/bdb181/html/gsg_txn/CXX/index.html

https://docs.oracle.com/database/bdb181/html/gsg/CXX/Cursors.html

http://www.lmdb.tech/doc/group__mdb.html#ga9ff5d7bd42557fd5ee235dc1d62613aa

I'm a Rust and LMDB novice, so please excuse any obvious mistakes that I might have made.


问:
The "Is" type-testing operator behaving unexpectedly in DartPad
It was my understanding that is type testing operator in Dart should return "True if the object has a certain type."

So why is this happening in DartPad??

```<code>void main() {

  // as
  // is
  // is!

  double d = 3.0;
  bool result = d is int;
  print(result); // prints true!

}
</code>```

Body:
It was my understanding that is type testing operator in Dart should return "True if the object has a certain type."

So why is this happening in DartPad??

void main() {

  // as
  // is
  // is!

  double d = 3.0;
  bool result = d is int;
  print(result); // prints true!

}


问:
vscode can't find delve even though environment variables are set in launch.json
My launch.json:

```<code>{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch test function",
            "type": "go",
            "request": "launch",
            "mode": "test",
            "program": "${workspaceFolder}/checkers/x/checkers/keeper",
            "args": [

            ],
            "env": {"GOPATH":"/home/alain/go", "PATH":"/home/alain/go/bin", "GO15VENDOREXPERIMENT": 1}
        }

    ]
}
</code>```

The dlv binary is in /home/alain/go/bin and works perfectly. Even outside of that directory it works.

However, when trying to launch debuggin in vscode, I am still getting the error:
Failed to continue "Cannot find delve debugger. Install from https://github.com/go-delve/delve & ensure it is in your Go tools path, "GOPATH/bin" or "PATH"

For reference: I did install delve from https://github.com/go-delve/delve

Body:
My launch.json:

{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch test function",
            "type": "go",
            "request": "launch",
            "mode": "test",
            "program": "${workspaceFolder}/checkers/x/checkers/keeper",
            "args": [

            ],
            "env": {"GOPATH":"/home/alain/go", "PATH":"/home/alain/go/bin", "GO15VENDOREXPERIMENT": 1}
        }

    ]
}

The dlv binary is in /home/alain/go/bin and works perfectly. Even outside of that directory it works.

However, when trying to launch debuggin in vscode, I am still getting the error:
Failed to continue "Cannot find delve debugger. Install from https://github.com/go-delve/delve & ensure it is in your Go tools path, "GOPATH/bin" or "PATH"

For reference: I did install delve from https://github.com/go-delve/delve


问:
moviepy slideshow with transitions, stuck at adding crossfade transition
Making a slideshow in moviepy works without issue but i just cant figure out how to add a crossfade transition between each frame. I'm very new to python and moviepy and could really use some help. Thanks</p>
```<code>img_clips = []
path_list = []

for image in os.listdir('E:/moviepy'):
    if image.endswith(".png"):
        path_list.append(os.path.join('E:/moviepy/', image))

# creating slide for each image
for img_path in path_list:
    slide = ImageClip(img_path, duration=0.2)
    img_clips.append(slide)

# concatenating slides
video_slides = concatenate_videoclips(img_clips, method='compose')
# exporting final video
video_slides.write_videofile("E:/moviepy/output_video.mp4", fps=30)
</code>```

Body:
Making a slideshow in moviepy works without issue but i just cant figure out how to add a crossfade transition between each frame. I'm very new to python and moviepy and could really use some help. Thanks

img_clips = []
path_list = []

for image in os.listdir('E:/moviepy'):
    if image.endswith(".png"):
        path_list.append(os.path.join('E:/moviepy/', image))

# creating slide for each image
for img_path in path_list:
    slide = ImageClip(img_path, duration=0.2)
    img_clips.append(slide)

# concatenating slides
video_slides = concatenate_videoclips(img_clips, method='compose')
# exporting final video
video_slides.write_videofile("E:/moviepy/output_video.mp4", fps=30)


问:
Get interactive shell with node js when invoking c program
I want to build an online interactive shell that runs c programming but as soon I put scanf in my code  it just ignores all the code until I give it all the inputs at first and then it gives me buffered code at once.

Here is my code:

childProcess = cp.spawn("/output.out")

childProcess.stdout.on("data", (data) => {
  io.to(clientId).emit("result", data.toString() + "\n")
})

childProcess.on("data", (data) => {
  io.to(clientId).emit("result", data.toString())
})

childProcess.on("error", (err) => {
  io.to(clientId).emit("result", err.message.toString())
})
```
<pre class="lang-c prettyprint-override"><code>#include <stdio.h>
int main()
{
    float num1;
    double num2;

    printf("Enter a number: ");
    scanf("%f", &num1);
    printf("Enter another number: ");
    scanf("%lf", &num2);

    printf("num1 = %f\n", num1);
    printf("num2 = %lf", num2);

    return 0;
}
</code>```

The output (it's waiting for me to give the input at first then it runs the code)

```<code>5
5
Enter a number: Enter another number: num1 = 5.000000
num2 = 5.000000
</code>```

The expected output should be

```<code>Enter a number: 5
Enter another number: 5
num1 = 5.000000
num2 = 5.000000
</code>```

Is there a way around this?

Body:
I want to build an online interactive shell that runs c programming but as soon I put scanf in my code  it just ignores all the code until I give it all the inputs at first and then it gives me buffered code at once.

Here is my code:

childProcess = cp.spawn("/output.out")

childProcess.stdout.on("data", (data) => {
  io.to(clientId).emit("result", data.toString() + "\n")
})

childProcess.on("data", (data) => {
  io.to(clientId).emit("result", data.toString())
})

childProcess.on("error", (err) => {
  io.to(clientId).emit("result", err.message.toString())
})

#include <stdio.h>
int main()
{
    float num1;
    double num2;

    printf("Enter a number: ");
    scanf("%f", &num1);
    printf("Enter another number: ");
    scanf("%lf", &num2);

    printf("num1 = %f\n", num1);
    printf("num2 = %lf", num2);

    return 0;
}

The output (it's waiting for me to give the input at first then it runs the code)

5
5
Enter a number: Enter another number: num1 = 5.000000
num2 = 5.000000

The expected output should be

Enter a number: 5
Enter another number: 5
num1 = 5.000000
num2 = 5.000000

Is there a way around this?


问:
Need help importing object from mdx file into pages/index.js
I am trying to create a blog in next js using mdx.

I am having trouble importing the meta object from my project-setup.mdx file into pages/index.js.

Error:

require() of ES Module
/Users/user/Desktop/blog/node_modules/@mdx-js/react/index.js from
/Users/user/Desktop/blog/.next/server/pages/index.js not supported.
Instead change the require of
/Users/blog/Desktop/blog/node_modules/@mdx-js/react/index.js in
/Users/user/Desktop/blog/.next/server/pages/index.js to a dynamic
import() which is available in all CommonJS modules.

project-setup.mdx

example taken from next.js's website of their mdx setup tutorial

export const meta = {
   author: 'Rich Haines'
}

# My MDX Page with a Layout

This is a list in markdown:

- One
- Two
- Three

Checkout my React component:
```
<p><strong>pages/index.js</strong></p>
```const Home = ({ posts }) => {
    const meta = require('../posts/project-setup.mdx');
    return (

          {posts.map((post, index) => (
          ))}

    )
}

export const getStaticProps = async () => {
    ...
}
```

Body:
I am trying to create a blog in next js using mdx.

I am having trouble importing the meta object from my project-setup.mdx file into pages/index.js.

Error:

require() of ES Module
/Users/user/Desktop/blog/node_modules/@mdx-js/react/index.js from
/Users/user/Desktop/blog/.next/server/pages/index.js not supported.
Instead change the require of
/Users/blog/Desktop/blog/node_modules/@mdx-js/react/index.js in
/Users/user/Desktop/blog/.next/server/pages/index.js to a dynamic
import() which is available in all CommonJS modules.

project-setup.mdx

example taken from next.js's website of their mdx setup tutorial

export const meta = {
   author: 'Rich Haines'
}

# My MDX Page with a Layout

This is a list in markdown:

- One
- Two
- Three

Checkout my React component:

pages/index.js

const Home = ({ posts }) => {
    const meta = require('../posts/project-setup.mdx');
    return (

          {posts.map((post, index) => (
          ))}

    )
}

export const getStaticProps = async () => {
    ...
}


问:
How can I emit an UTF-8 character to another application with QT?
I want to send an UTF-8 character to another application from within my QT application (which is targeting Linux and Windows).

I have already found this discussion https://stackoverflow.com/a/62070166/972052 , but it is only about sending regular KeyEvents, but there is no KeyEvent for  for example.

Is this possible somehow?

A fallback idea I had was to put the  into the clip board and send a Ctrl + V afterwards, but honestly, that does not feel good, as some applications like a terminal emulator for example, might have a different key binding for inserting the clip board content.

Best regards!


问:
Tensorflow: How to use timestamped dict training data?
I'm currently studying TensorFlow and I fail to find proper documentation on using python dictionaries as structured training dataset.
From the doc, for the x arg of Input data. It could be:[...] A dict mapping input names to the corresponding array/tensors, if the model has named inputs.
From this dataset, I would like my inputs x to be temp and yesterday_temp_diff and output y to be tomorrow_temp_diff

```<code>db['2021-12-10']={'temp': 19, 'humidity':0.51, 'yesterday_temp_diff':1, 'tomorrow_temp_diff':2}
db['2021-12-11']={'temp': 21, 'humidity':0.41, 'yesterday_temp_diff':2, 'tomorrow_temp_diff':-3}
db['2021-12-12']={'temp': 18, 'humidity':0.45, 'yesterday_temp_diff':-3, 'tomorrow_temp_diff':1}
db['2021-12-13']={'temp': 19, 'humidity':0.65, 'yesterday_temp_diff':1, 'tomorrow_temp_diff':-2}
db['2021-12-14']={'temp': 17, 'humidity':0.55, 'yesterday_temp_diff':-2, 'tomorrow_temp_diff':1}
</code>```

enter image description here

How could a timestamped python dict be converted to a proper dataset?

I tried converting it to dataframes and CSV files, but they offer extra steps I would like to avoid.

Body:
I'm currently studying TensorFlow and I fail to find proper documentation on using python dictionaries as structured training dataset.
From the doc, for the x arg of Input data. It could be:[...] A dict mapping input names to the corresponding array/tensors, if the model has named inputs.
From this dataset, I would like my inputs x to be temp and yesterday_temp_diff and output y to be tomorrow_temp_diff

db['2021-12-10']={'temp': 19, 'humidity':0.51, 'yesterday_temp_diff':1, 'tomorrow_temp_diff':2}
db['2021-12-11']={'temp': 21, 'humidity':0.41, 'yesterday_temp_diff':2, 'tomorrow_temp_diff':-3}
db['2021-12-12']={'temp': 18, 'humidity':0.45, 'yesterday_temp_diff':-3, 'tomorrow_temp_diff':1}
db['2021-12-13']={'temp': 19, 'humidity':0.65, 'yesterday_temp_diff':1, 'tomorrow_temp_diff':-2}
db['2021-12-14']={'temp': 17, 'humidity':0.55, 'yesterday_temp_diff':-2, 'tomorrow_temp_diff':1}

enter image description here

How could a timestamped python dict be converted to a proper dataset?

I tried converting it to dataframes and CSV files, but they offer extra steps I would like to avoid.


问:
@use rule must be on top, but what if I need it on the bottom? Any alternative? (beside @import)
@use rule is very useful when it comes to loading all of your components into the main file, but what I what if I want to add it to the end of the code? I need to connect the media queries that I have in a separate folder and they have to be imported to the bottom of main.scss. I used @import for that before, but that was looking messy, because you need to add each of @import one by one. But now I can't do the same with @use, because it says '@use rules must be written before any other rules.'. Any suggestions?</p>
```<code>@use 'abstracts' as *;

body {
  background-color: #fff;
  font-family: sans-serif;
}

@use 'media-queries' as *;

</code>```

Body:
@use rule is very useful when it comes to loading all of your components into the main file, but what I what if I want to add it to the end of the code? I need to connect the media queries that I have in a separate folder and they have to be imported to the bottom of main.scss. I used @import for that before, but that was looking messy, because you need to add each of @import one by one. But now I can't do the same with @use, because it says '@use rules must be written before any other rules.'. Any suggestions?

@use 'abstracts' as *;

body {
  background-color: #fff;
  font-family: sans-serif;
}

@use 'media-queries' as *;


问:
A yellow triangle Warning sign is showing in the corner of code line
I am hosting a website using NODEJS and EXPRESS. but while editing the app.js file in cpanel editor a yellow sign icon is showing in front of code with some irrelevant suggestions. Photo for clarity of question. Server is showing error 503 which means unavailable. There is no problem in code as it is smoothly working in localhost, But in Cpanel!?

const http = require('http');
const port = process.env.PORT;

const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const con = require('./model/user');

const app = express();

app.use('/', express.static(path.join(__dirname,'static')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));

app.post('/register', async (req, res) => {

    var username = req.body.username;
    var password = req.body.password;

    con.connect(function(error){
        if (error) throw error;

        var sql = "INSERT INTO customers(username, password) Values('"+username+"','"+password+"')";
        con.query(sql,function(error, result){
            if (error) throw error;
            res.send('registration succesfully');
        });
    });

    res.json({ status: 'ok'})
});

app.listen(port, ()=> {
    console.log('Server')
})

```
<p>i was expecting that my server will run as it was running with this code</p>
```const http = require('http');
const port = process.env.PORT;
const express = require('express');
const app = express();
const path = require('path');
const bodyParser = require('body-parser');

app.use('/', express.static(path.join(__dirname,'static')))
app.use(bodyParser.json())

app.listen(port, ()=>{

});
```

Body:
I am hosting a website using NODEJS and EXPRESS. but while editing the app.js file in cpanel editor a yellow sign icon is showing in front of code with some irrelevant suggestions. Photo for clarity of question. Server is showing error 503 which means unavailable. There is no problem in code as it is smoothly working in localhost, But in Cpanel!?

const http = require('http');
const port = process.env.PORT;

const express = require('express');
const path = require('path');
const bodyParser = require('body-parser');
const con = require('./model/user');

const app = express();

app.use('/', express.static(path.join(__dirname,'static')));
app.use(bodyParser.json());
app.use(bodyParser.urlencoded({extended:true}));

app.post('/register', async (req, res) => {

    var username = req.body.username;
    var password = req.body.password;

    con.connect(function(error){
        if (error) throw error;

        var sql = "INSERT INTO customers(username, password) Values('"+username+"','"+password+"')";
        con.query(sql,function(error, result){
            if (error) throw error;
            res.send('registration succesfully');
        });
    });

    res.json({ status: 'ok'})
});

app.listen(port, ()=> {
    console.log('Server')
})

i was expecting that my server will run as it was running with this code

const http = require('http');
const port = process.env.PORT;
const express = require('express');
const app = express();
const path = require('path');
const bodyParser = require('body-parser');

app.use('/', express.static(path.join(__dirname,'static')))
app.use(bodyParser.json())

app.listen(port, ()=>{

});


问:
How to create a table with flexible column widths but fixed minimum that triggers a horizontal scroll if window is too small?
Using Flutter Web

I am able to achieve a fixed-width table (see below) that allows for horizontal scroll if the window is too narrow (i.e. on a phone). I also found a way to make a flexible width table that worked nicely using Flexible, but it broke when placed inside of a SingleChildScrollView. Does anyone know how to achieve this?

Specific needs:

Table row with column 1 wider than the rest of the columns

All columns widen evenly if window is widened

Table row has minimum width

If the window is smaller than the minimum row width, user can scroll horizontally to see the overflow content

Thanks for any ideas!

```<code>                        SingleChildScrollView(
                          scrollDirection: Axis.horizontal,
                          child: Column(
                            mainAxisSize: MainAxisSize.max,
                            children: [
                              Container(
                                child: Row( // Table header
                                  mainAxisSize: MainAxisSize.min,
                                  children: [
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnLargeWidthMin, maxWidth: tableColumnLargeWidthMax, maxHeight: tableColumnLargeHeightMax, minHeight: tableColumnLargeHeightMin),
                                        child: Text(
                                            'Nerve',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnSmallWidthMin, maxWidth: tableColumnSmallWidthMax, maxHeight: tableColumnSmallHeightMax, minHeight: tableColumnSmallHeightMin),
                                        child: Text(
                                            'Amp (uV)',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnSmallWidthMin, maxWidth: tableColumnSmallWidthMax, maxHeight: tableColumnSmallHeightMax, minHeight: tableColumnSmallHeightMin),
                                        child: Text(
                                            'Lat (ms)',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnSmallWidthMin, maxWidth: tableColumnSmallWidthMax, maxHeight: tableColumnSmallHeightMax, minHeight: tableColumnSmallHeightMin),
                                        child: Text(
                                            'Dist (cm)',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnSmallWidthMin, maxWidth: tableColumnSmallWidthMax, maxHeight: tableColumnSmallHeightMax, minHeight: tableColumnSmallHeightMin),
                                        child: Text(
                                            'CV (m/s)',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                              Divider(color: colorStructurePrimary),
                              for(var i in tableRowNCSSensory) i,
                            ],
                          ),
                        ),
</code>```

Body:
Using Flutter Web

I am able to achieve a fixed-width table (see below) that allows for horizontal scroll if the window is too narrow (i.e. on a phone). I also found a way to make a flexible width table that worked nicely using Flexible, but it broke when placed inside of a SingleChildScrollView. Does anyone know how to achieve this?

Specific needs:

Table row with column 1 wider than the rest of the columns

All columns widen evenly if window is widened

Table row has minimum width

If the window is smaller than the minimum row width, user can scroll horizontally to see the overflow content

Thanks for any ideas!

                        SingleChildScrollView(
                          scrollDirection: Axis.horizontal,
                          child: Column(
                            mainAxisSize: MainAxisSize.max,
                            children: [
                              Container(
                                child: Row( // Table header
                                  mainAxisSize: MainAxisSize.min,
                                  children: [
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnLargeWidthMin, maxWidth: tableColumnLargeWidthMax, maxHeight: tableColumnLargeHeightMax, minHeight: tableColumnLargeHeightMin),
                                        child: Text(
                                            'Nerve',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnSmallWidthMin, maxWidth: tableColumnSmallWidthMax, maxHeight: tableColumnSmallHeightMax, minHeight: tableColumnSmallHeightMin),
                                        child: Text(
                                            'Amp (uV)',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnSmallWidthMin, maxWidth: tableColumnSmallWidthMax, maxHeight: tableColumnSmallHeightMax, minHeight: tableColumnSmallHeightMin),
                                        child: Text(
                                            'Lat (ms)',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnSmallWidthMin, maxWidth: tableColumnSmallWidthMax, maxHeight: tableColumnSmallHeightMax, minHeight: tableColumnSmallHeightMin),
                                        child: Text(
                                            'Dist (cm)',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                    Flexible(
                                      child: Container(
                                        constraints: BoxConstraints(minWidth: tableColumnSmallWidthMin, maxWidth: tableColumnSmallWidthMax, maxHeight: tableColumnSmallHeightMax, minHeight: tableColumnSmallHeightMin),
                                        child: Text(
                                            'CV (m/s)',
                                            textAlign: TextAlign.center,
                                            style: TextStyle(
                                                fontSize: 15,
                                                color: colorTextLight,
                                                fontWeight: FontWeight.bold
                                            )
                                        ),
                                      ),
                                    ),
                                  ],
                                ),
                              ),
                              Divider(color: colorStructurePrimary),
                              for(var i in tableRowNCSSensory) i,
                            ],
                          ),
                        ),


问:
How can I retrieve the event Id from single instance of recurring series using Advanced Calendar Service and Calendar API?
When I use the Spreadsheet App service .getId() on a single instance of a recurring event, it returns the IcalUID for the recurring series, and not the individual event Id. This is a problem because I am trying to log individual instances to a spreadsheet and I want to find the unique identifier of the instance to reference the event and copy the details to the corresponding row, but I am only getting details from the first instance of the series.

I looked through the documentation on Advanced Calendar Service and it appears that I will need to use the Calendar API to achieve this. I have enabled the Calendar API and created an API key. How can I modify my previous script to return the event Id from a single instance in a recurring series using the Calendar API?

```<code>
function updateEventsGeneric() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("EventsRange");
  var cal = CalendarApp.getCalendarById(id_cal);

  var date = new Date();

    let day = date.getDate() ;
    let month = date.getMonth() + 1;
    let year = date.getFullYear();
    let year_short = year.toString().slice(-2)

  var currentDate = `${month}-${day}-${year}`;

  var events = cal.getEventsForDay(new Date(currentDate));
  var row = sheet.getLastRow()+1
  var values = [];

  for (var i = 0; i < events.length; i++) {
    var title = events[i].getTitle();
    var clientName = '';
    var event_date = new Date(events[i].getStartTime().toDateString());
    var employEmail = [];
    var clientEmail = [];
    var start_time = events[i].getStartTime();
    var end_time = events[i].getEndTime();
    var loc = events[i].getLocation();
    var event_id = events[i].getId();

    for (var j = 0; j < guestList.length; j++) {
      var email = guestList[j].getEmail();

      employees.some(({emailad}) => emailad === email) ? employEmail.push(email): clientEmail.push(email)

    };

  values.push([title, formulaString, event_date, employEmail, clientEmail, start_time, end_time, `=G${i + row}-F${i + row}`, loc, event_id]);
  }

  sheet.getRange(row , 1, values.length, values[0].length).setValues(values);
  var cellValue = sheet.getRange(row, 2, values.length, 1).getValues();
  sheet.getRange(row, 2, values.length, 1).setValues(cellValue);
  sheet.getRange(row, 6, values.length,2).setNumberFormat("MM/dd/yyyy hh:mm:ss am/pm");
  sheet.getRange(row, 8, values.length,1).setNumberFormat("[hh]:mm:ss");

}

function listEventsFromOneCalendar() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet()
        .getSheetByName("ExistingEvents");

  var source = "testemail@group.calendar.google.com";
  var srcCalId = Calendar.Calendars.get(source).id;

  var syncdays = 30;
  var now = new Date();
  var min = new Date(now.getFullYear(), now.getMonth(), now.getDate());
  var max = new Date(now.getFullYear(), now.getMonth(), now.getDate() + syncdays);

  var srcEvents = Calendar.Events.list(srcCalId, {
    timeMin: min.toISOString(),
    timeMax: max.toISOString(),
    singleEvents: true,
    orderBy: 'startTime',
  }).items;

  /*
   * To store events data in a spreadsheet we need
   * to construct a 2-dim array
   *
   */
  var output = [];

  /*
   * 'srcEvents' is an array of event objects.
   *
   * Every event object is passed as 'e' to the anonymous
   * function.
   *
   */
  srcEvents.forEach(function(e){
    // Construct an event array (1-dim)
    var event = [];

    /*
     * Returns "" if object value is 'null' or 'undefined'
     *   otherwise returns the object value.
     *
     */
    event.push(e.summary || "");
    event.push(e.start.dateTime || "");
    event.push(e.end.dateTime || "");
    event.push(e.id || "");
    event.push(e.location || "");

    // Push each event array to output (2-dim array).
    output.push(event);
  });

  var header = [
                 "Title/Subject",
                 "Start Time",
                 "End Time",
                 "Description",
                 "Location"
               ];

  // Insert header at the top of the output.
  output.unshift(header);

  sheet.clearContents();

  sheet.getRange(1, 1, output.length, header.length)
  .setValues(output);
}

</code>```

Body:
When I use the Spreadsheet App service .getId() on a single instance of a recurring event, it returns the IcalUID for the recurring series, and not the individual event Id. This is a problem because I am trying to log individual instances to a spreadsheet and I want to find the unique identifier of the instance to reference the event and copy the details to the corresponding row, but I am only getting details from the first instance of the series.

I looked through the documentation on Advanced Calendar Service and it appears that I will need to use the Calendar API to achieve this. I have enabled the Calendar API and created an API key. How can I modify my previous script to return the event Id from a single instance in a recurring series using the Calendar API?

function updateEventsGeneric() {

  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheetByName("EventsRange");
  var cal = CalendarApp.getCalendarById(id_cal);

  var date = new Date();

    let day = date.getDate() ;
    let month = date.getMonth() + 1;
    let year = date.getFullYear();
    let year_short = year.toString().slice(-2)

  var currentDate = `${month}-${day}-${year}`;

  var events = cal.getEventsForDay(new Date(currentDate));
  var row = sheet.getLastRow()+1
  var values = [];

  for (var i = 0; i < events.length; i++) {
    var title = events[i].getTitle();
    var clientName = '';
    var event_date = new Date(events[i].getStartTime().toDateString());
    var employEmail = [];
    var clientEmail = [];
    var start_time = events[i].getStartTime();
    var end_time = events[i].getEndTime();
    var loc = events[i].getLocation();
    var event_id = events[i].getId();

    for (var j = 0; j < guestList.length; j++) {
      var email = guestList[j].getEmail();

      employees.some(({emailad}) => emailad === email) ? employEmail.push(email): clientEmail.push(email)

    };

  values.push([title, formulaString, event_date, employEmail, clientEmail, start_time, end_time, `=G${i + row}-F${i + row}`, loc, event_id]);
  }

  sheet.getRange(row , 1, values.length, values[0].length).setValues(values);
  var cellValue = sheet.getRange(row, 2, values.length, 1).getValues();
  sheet.getRange(row, 2, values.length, 1).setValues(cellValue);
  sheet.getRange(row, 6, values.length,2).setNumberFormat("MM/dd/yyyy hh:mm:ss am/pm");
  sheet.getRange(row, 8, values.length,1).setNumberFormat("[hh]:mm:ss");

}

function listEventsFromOneCalendar() {
  var sheet = SpreadsheetApp.getActiveSpreadsheet()
        .getSheetByName("ExistingEvents");

  var source = "testemail@group.calendar.google.com";
  var srcCalId = Calendar.Calendars.get(source).id;

  var syncdays = 30;
  var now = new Date();
  var min = new Date(now.getFullYear(), now.getMonth(), now.getDate());
  var max = new Date(now.getFullYear(), now.getMonth(), now.getDate() + syncdays);

  var srcEvents = Calendar.Events.list(srcCalId, {
    timeMin: min.toISOString(),
    timeMax: max.toISOString(),
    singleEvents: true,
    orderBy: 'startTime',
  }).items;

  /*
   * To store events data in a spreadsheet we need
   * to construct a 2-dim array
   *
   */
  var output = [];

  /*
   * 'srcEvents' is an array of event objects.
   *
   * Every event object is passed as 'e' to the anonymous
   * function.
   *
   */
  srcEvents.forEach(function(e){
    // Construct an event array (1-dim)
    var event = [];

    /*
     * Returns "" if object value is 'null' or 'undefined'
     *   otherwise returns the object value.
     *
     */
    event.push(e.summary || "");
    event.push(e.start.dateTime || "");
    event.push(e.end.dateTime || "");
    event.push(e.id || "");
    event.push(e.location || "");

    // Push each event array to output (2-dim array).
    output.push(event);
  });

  var header = [
                 "Title/Subject",
                 "Start Time",
                 "End Time",
                 "Description",
                 "Location"
               ];

  // Insert header at the top of the output.
  output.unshift(header);

  sheet.clearContents();

  sheet.getRange(1, 1, output.length, header.length)
  .setValues(output);
}


问:
The current path, products/ didn't match any of these
I am watching a Django tutorial however even though my code is exactly the same as shown in the video for some reason I get this message:

```<code>The current path, products/, didn’t match any of these.
</code>```

I am using python 3.1 and Django 4.1.4, here is my code:

PyShop/products/views.py:

```<code>from django.http import HttpResponse
from django.shortcuts import render

# URL ----> Uniform resourse locator

def index(request):
    return HttpResponse('Hello world ')

</code>```

PyShop/pyshop/urls.py:

```<code>from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path("admin/", admin.site.urls),
    path("products/", include ('products.urls'))

</code>```

PyShop/products/urls.py:

```<code>from django.urls import path
from . import views

urlpatterns = [
    path (' ', views.index)
]
</code>```

I was expecting to get a message saying hello world when I type products/ in the search bar. I rewatched the tutorial a couple of times and I am pretty sure that I have the same code as the person on the tutorial`

Body:
I am watching a Django tutorial however even though my code is exactly the same as shown in the video for some reason I get this message:

The current path, products/, didn’t match any of these.

I am using python 3.1 and Django 4.1.4, here is my code:

PyShop/products/views.py:

from django.http import HttpResponse
from django.shortcuts import render

# URL ----> Uniform resourse locator

def index(request):
    return HttpResponse('Hello world ')

PyShop/pyshop/urls.py:

from django.contrib import admin
from django.urls import path, include

urlpatterns = [
    path("admin/", admin.site.urls),
    path("products/", include ('products.urls'))

PyShop/products/urls.py:

from django.urls import path
from . import views

urlpatterns = [
    path (' ', views.index)
]

I was expecting to get a message saying hello world when I type products/ in the search bar. I rewatched the tutorial a couple of times and I am pretty sure that I have the same code as the person on the tutorial`


问:
I'm working on a rock paper scissors project in tkinter and i dont know why it doesnt show the winner doesnt work?
I was writing a rock paper scissors program with tkinter which has rock paper scissors buttons and a button for spinning and a place for showing rock, paper or scissors.
My problem starts where i fixed the errors which was for the variable "user_choice_value" which wasn't defined.Then I ran my code and happily it showed everything but the win_lose_label.pack() at the if/else statements doesnt work.
I would be happy if u help me :)
this is my code:
(btw you can download any pic u want doesnt matter)
`

```<code>from tkinter import *
from random import *

# making the window and settings of it
window = Tk()
window.title("Rock Paper Scissor game")
window.geometry("600x600")
window.config(bg="grey")

#defining the user choices etc.
def user_choice_value(args):
   if args == "Rock":
      user_choice_value = 0
   if args == "Paper":
      user_choice_value = 1
   if args == "Scissors":
      user_choice_value = 2
   return user_choice_value

#bringing the images
rock = PhotoImage(file="python/image/rock.png")
paper = PhotoImage(file="python/image/paper.png")
scissor = PhotoImage(file="python/image/scissor.png")

#throwing and image
images_list = [rock, paper, scissor]
random_number = randint(0,2)
disp_image = Label(window, image=images_list[random_number], height=250, width=250)
disp_image.pack(pady=50)

#Determining the winner.
win_lose_label = Label(window)

if user_choice_value == random_number:
   win_lose_label.config(text="Your choice is same as computer's choice... It's a Tie!")
   win_lose_label.pack()
elif user_choice_value == 0:
   if random_number == 2:
      win_lose_label.config(text="You won!!! Your choice was rock and the computer's choice was scissors.")
      win_lose_label.pack()
   else:
      win_lose_label.config(text="You lost!!! Your choice was rock and the computer's choice was paper.")
      win_lose_label.pack()
elif user_choice_value == 1:
   if random_number == 0:
      win_lose_label.config(text="You won!!! Your choice was paper and the computers choice was rock.")
      win_lose_label.pack()
   else:
      win_lose_label.config(text="You lost!!! Your choice was paper but the computers choice was scissors.")
      win_lose_label.pack()

elif user_choice_value == 2:
   if random_number == 1:
      win_lose_label.config(text="You won!!! Your choice was scissors but the computers choice was paper.")
      win_lose_label.pack()
   else:
      win_lose_label.config(text="You lost!!! Your choice was scissors but the computer's choice was rock.")
      win_lose_label.pack()

#spin button to bring a random image
def spin_button():
   random_number = randint(0,2)
   disp_image.config(image=images_list[random_number])

spin_button = Button(window, text="Spin!", command=spin_button, width=5)
spin_button.pack()

#rock, paper, scissor buttons
rock_button = Button(window, text="Rock", width=5)
rock_button.place(x = 232, y = 320)

paper_button = Button(window, text="Paper", width=5)
paper_button.place(x = 282, y = 320)

scissor_button = Button(window, text="Scissor", width=5)
scissor_button.place(x = 332, y = 320)

window.mainloop()
</code>```

`

I tried manipulate some things like parantheses or change the position some of the labels and these stuff but it didn't work.
Also this is the video that I've been watching it for making a rock paper scissors game in python w/ tkinter: https://www.youtube.com/watch?v=ZDiPqfFF7pw&ab_channel=Codemy.com

Body:
I was writing a rock paper scissors program with tkinter which has rock paper scissors buttons and a button for spinning and a place for showing rock, paper or scissors.
My problem starts where i fixed the errors which was for the variable "user_choice_value" which wasn't defined.Then I ran my code and happily it showed everything but the win_lose_label.pack() at the if/else statements doesnt work.
I would be happy if u help me :)
this is my code:
(btw you can download any pic u want doesnt matter)
`

from tkinter import *
from random import *

# making the window and settings of it
window = Tk()
window.title("Rock Paper Scissor game")
window.geometry("600x600")
window.config(bg="grey")

#defining the user choices etc.
def user_choice_value(args):
   if args == "Rock":
      user_choice_value = 0
   if args == "Paper":
      user_choice_value = 1
   if args == "Scissors":
      user_choice_value = 2
   return user_choice_value

#bringing the images
rock = PhotoImage(file="python/image/rock.png")
paper = PhotoImage(file="python/image/paper.png")
scissor = PhotoImage(file="python/image/scissor.png")

#throwing and image
images_list = [rock, paper, scissor]
random_number = randint(0,2)
disp_image = Label(window, image=images_list[random_number], height=250, width=250)
disp_image.pack(pady=50)

#Determining the winner.
win_lose_label = Label(window)

if user_choice_value == random_number:
   win_lose_label.config(text="Your choice is same as computer's choice... It's a Tie!")
   win_lose_label.pack()
elif user_choice_value == 0:
   if random_number == 2:
      win_lose_label.config(text="You won!!! Your choice was rock and the computer's choice was scissors.")
      win_lose_label.pack()
   else:
      win_lose_label.config(text="You lost!!! Your choice was rock and the computer's choice was paper.")
      win_lose_label.pack()
elif user_choice_value == 1:
   if random_number == 0:
      win_lose_label.config(text="You won!!! Your choice was paper and the computers choice was rock.")
      win_lose_label.pack()
   else:
      win_lose_label.config(text="You lost!!! Your choice was paper but the computers choice was scissors.")
      win_lose_label.pack()

elif user_choice_value == 2:
   if random_number == 1:
      win_lose_label.config(text="You won!!! Your choice was scissors but the computers choice was paper.")
      win_lose_label.pack()
   else:
      win_lose_label.config(text="You lost!!! Your choice was scissors but the computer's choice was rock.")
      win_lose_label.pack()

#spin button to bring a random image
def spin_button():
   random_number = randint(0,2)
   disp_image.config(image=images_list[random_number])

spin_button = Button(window, text="Spin!", command=spin_button, width=5)
spin_button.pack()

#rock, paper, scissor buttons
rock_button = Button(window, text="Rock", width=5)
rock_button.place(x = 232, y = 320)

paper_button = Button(window, text="Paper", width=5)
paper_button.place(x = 282, y = 320)

scissor_button = Button(window, text="Scissor", width=5)
scissor_button.place(x = 332, y = 320)

window.mainloop()

`

I tried manipulate some things like parantheses or change the position some of the labels and these stuff but it didn't work.
Also this is the video that I've been watching it for making a rock paper scissors game in python w/ tkinter: https://www.youtube.com/watch?v=ZDiPqfFF7pw&ab_channel=Codemy.com


问:
C# Console window, Escape Sequences Not Working
When I write code to write an escape sequence:
Console.WriteLine("\x1b[94m Blue Text \x1b[0m");

The code prints as:
←[94m Blue Text ←[0m

Does anyone know how this is caused? I am on .NET 6.0

I tried writing the escape sequence in a variable but this doesn't change anything. When I use Console.Clear(); and rewrite the code with the same window it sometimes works.


问:
Blazor wasm how to handle number formating if cultureinfo isnt valid for html
I have a pretty specific problem in my blazor app.

In my app I support multiple languages. For now thats english and  german.

Where the issue is coming in is if I do something like this:

```<code><div class="bar-container" style="width: @(barWidth)px; height: @(barHeigth)px;">
    <div class="bar" style="">
        <div class="bar-text">Some Text</div>
    </div>
</div>

@code
{
    double barWidth = 120.5;
    double barHeigth = 20;
}
</code>```

For this code, if I run it with the english cultureinfo everything works fine as it renders to

```<code><div class="bar-container" style="width: 120.5px; height: 20px;">
    <div class="bar" style="">
        <div class="bar-text">Some Text</div>
    </div>
</div>
</code>```

But in the case of german the result is

```<code><div class="bar-container" style="width: 120,5px; height: 20px;">
    <div class="bar" style="">
        <div class="bar-text">Some Text</div>
    </div>
</div>
</code>```

This is because in german the decimal point is a comma. Now html does have an issue interpreting 120,5px and returns weird results.

What is the best way to handle this?

Some ideas I have are:

Setting the coltureinfo to english in the setup and handling localization another way

Adding the english cultureinfo everytime I use a .ToString

Always rounding to the next Int

Body:
I have a pretty specific problem in my blazor app.

In my app I support multiple languages. For now thats english and  german.

Where the issue is coming in is if I do something like this:

Some Text

@code
{
    double barWidth = 120.5;
    double barHeigth = 20;
}

For this code, if I run it with the english cultureinfo everything works fine as it renders to

Some Text

But in the case of german the result is

Some Text

This is because in german the decimal point is a comma. Now html does have an issue interpreting 120,5px and returns weird results.

What is the best way to handle this?

Some ideas I have are:

Setting the coltureinfo to english in the setup and handling localization another way

Adding the english cultureinfo everytime I use a .ToString

Always rounding to the next Int


问:
Create a query based on multiple tables by foreign id
i have two tables

the first one for user

```<code>+----------------------------------------
| ID | name                 | age       |
+----------------------------------------
| 1  | name 1               | 24         |
| 2  | name 2               | 20         |
| 4  | name 3               | 18         |
| 5  | name 4               | 30         |
----------------------------------------+
</code>```

second one for user images with foreign key

```<code>+---------------------------------------+
| ID | imageurl_id          | image     |
+---------------------------------------+
| 1  | 1                    | pic 1.jpg |
| 2  | 2                    | pic 2.jpg |
| 3  | 2                    | pic 3.jpg |
| 4  | 4                    | pic 4.jpg |
| 5  | 4                    | pic 5.jpg |
| 6  | 4                    | pic 6.jpg |
+---------------------------------------+
</code>```

some users have more than one image and some have no image.

I use Nodejs API.

I want to collect this tow table by SQL query with out Repetition like this.

```<code>
{
 "info":[
  {
  "id": 1,
  "name": "name 1",
  "age": 24,
  },
  ]
 "image": [
    {
   "imageurl_id": 1,
   "image": "pic 1.jpg "
    }
  ]
 "info":[
  {
  "id": 1,
  "name": "name 2",
  "age": 20,

  },
  ]
 "image": [
    {
   "imageurl_id": 2,
   "image": "pic 2.jpg "
    }
    {
   "imageurl_id": 2,
   "image": " pic 3.jpg "
    }
  ]
}
</code>```

and when is there no images for the user it give me empty image [].

Body:
i have two tables

the first one for user

+----------------------------------------
| ID | name                 | age       |
+----------------------------------------
| 1  | name 1               | 24         |
| 2  | name 2               | 20         |
| 4  | name 3               | 18         |
| 5  | name 4               | 30         |
----------------------------------------+

second one for user images with foreign key

+---------------------------------------+
| ID | imageurl_id          | image     |
+---------------------------------------+
| 1  | 1                    | pic 1.jpg |
| 2  | 2                    | pic 2.jpg |
| 3  | 2                    | pic 3.jpg |
| 4  | 4                    | pic 4.jpg |
| 5  | 4                    | pic 5.jpg |
| 6  | 4                    | pic 6.jpg |
+---------------------------------------+

some users have more than one image and some have no image.

I use Nodejs API.

I want to collect this tow table by SQL query with out Repetition like this.

{
 "info":[
  {
  "id": 1,
  "name": "name 1",
  "age": 24,
  },
  ]
 "image": [
    {
   "imageurl_id": 1,
   "image": "pic 1.jpg "
    }
  ]
 "info":[
  {
  "id": 1,
  "name": "name 2",
  "age": 20,

  },
  ]
 "image": [
    {
   "imageurl_id": 2,
   "image": "pic 2.jpg "
    }
    {
   "imageurl_id": 2,
   "image": " pic 3.jpg "
    }
  ]
}

and when is there no images for the user it give me empty image [].


问:
How to escape double backslash Ansible
I am trying to use the ansible.windows.win_powershell module to automate mapping a network file share to a Virtual Machine in Azure. I have the following task within my playbook:

```<code> - name: "Map network file share"
      ansible.windows.win_powershell:
        script: |
          $connectTestResult = Test-NetConnection -ComputerName host.file.core.windows.net -Port 445
          if ($connectTestResult.TcpTestSucceeded) {
              # Save the password so the drive will persist on reboot
              cmd.exe /C "cmdkey /add:`"<placeholder>`" /user:`"localhost\host`" /pass:`"`""
              # Mount the drive
              New-PSDrive -Name Z -PSProvider FileSystem -Root "\\storageaccount.file.core.windows.net\fs" -Persist
          }
          else {
              Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
          }
</code>```

My playbook however is failing on line 6 of the task:

```<code>New-PSDrive : The network resource type is not correct
</code>```

The displayRoot value:

```<code>"DisplayRoot": "\\\\storageaccount.file.core.windows.net\\fs",
</code>```

My assumption is that this is happening because of my double backslashes within the argument passed to -Root aren't being escaped. I have tried many variations:

```<code>"\\storageaccount.file.core.windows.net\fs"
'\\storageaccount.file.core.windows.net\fs'
`"\\storageaccount.file.core.windows.net\fs`"
\"\\storageaccount.file.core.windows.net\fs'\"
</code>```

According to https://docs.ansible.com/ansible/2.5/user_guide/windows_usage.html I should be able to use \" to initialise a quote. If I paste and execute the script directly on the VM itself rather than via the run book, it works perfectly. I am obviously doing something incorrectly and wondered if someone has had this issue or can see where I am going wrong?

Title: How to escape double backslash Ansible

Body:
I am trying to use the ansible.windows.win_powershell module to automate mapping a network file share to a Virtual Machine in Azure. I have the following task within my playbook:

 - name: "Map network file share"
      ansible.windows.win_powershell:
        script: |
          $connectTestResult = Test-NetConnection -ComputerName host.file.core.windows.net -Port 445
          if ($connectTestResult.TcpTestSucceeded) {
              # Save the password so the drive will persist on reboot
              cmd.exe /C "cmdkey /add:`"<placeholder>`" /user:`"localhost\host`" /pass:`"`""
              # Mount the drive
              New-PSDrive -Name Z -PSProvider FileSystem -Root "\\storageaccount.file.core.windows.net\fs" -Persist
          }
          else {
              Write-Error -Message "Unable to reach the Azure storage account via port 445. Check to make sure your organization or ISP is not blocking port 445, or use Azure P2S VPN, Azure S2S VPN, or Express Route to tunnel SMB traffic over a different port."
          }

My playbook however is failing on line 6 of the task:

New-PSDrive : The network resource type is not correct

The displayRoot value:

"DisplayRoot": "\\\\storageaccount.file.core.windows.net\\fs",

My assumption is that this is happening because of my double backslashes within the argument passed to -Root aren't being escaped. I have tried many variations:

"\\storageaccount.file.core.windows.net\fs"
'\\storageaccount.file.core.windows.net\fs'
`"\\storageaccount.file.core.windows.net\fs`"
\"\\storageaccount.file.core.windows.net\fs'\"

According to https://docs.ansible.com/ansible/2.5/user_guide/windows_usage.html I should be able to use \" to initialise a quote. If I paste and execute the script directly on the VM itself rather than via the run book, it works perfectly. I am obviously doing something incorrectly and wondered if someone has had this issue or can see where I am going wrong?


问:
How to make binary file using numba?
As I understand, numba compiles Python function, save the binary code to cache and then run it from there. Is it possible to get this binary to file and then run from terminal?

For example I have function:

```<code>from numba import jit

@jit
def my_function(x, y):
    return x + y
</code>```

now I want to get exactly binary of this and save it to file:

```<code>with open('my_function.exe', 'w+') as f:
    f.write(tool_to_read_from_cache('my_function'))
</code>```

after that I want to run it from terminal, for example:

```<code>./my_function.exe -x 1 -y 2
</code>```

any advices are welcome!!

Title: How to make binary file using numba?

Body:
As I understand, numba compiles Python function, save the binary code to cache and then run it from there. Is it possible to get this binary to file and then run from terminal?

For example I have function:

from numba import jit

@jit
def my_function(x, y):
    return x + y

now I want to get exactly binary of this and save it to file:

with open('my_function.exe', 'w+') as f:
    f.write(tool_to_read_from_cache('my_function'))

after that I want to run it from terminal, for example:

./my_function.exe -x 1 -y 2

any advices are welcome!!


问:
Keep only a certain string from an array value in php
I'm tying to fetch some data from Shopify admin REST API via php.

When I fetch orders data, It includes the date and the time of order initially created as created_at

```<code> "created_at" => "2022-12-16T08:51:48+05:30"
</code>```

I created a new array from the existing orders array which only includes those created_at key values.

```<code>// Store all the gateways to a new array
            $newArr_createdAt = array_column($result_3['orders'] , "created_at");
</code>```

This gives me the following output

```<code>array:8 [▼
  0 => "2022-12-16T08:51:48+05:30"
  1 => "2022-12-14T11:45:59+05:30"
  2 => "2022-12-12T15:52:49+05:30"
  3 => "2022-12-12T09:56:56+05:30"
  4 => "2022-12-12T09:46:03+05:30"
  5 => "2022-12-10T10:45:43+05:30"
  6 => "2022-11-30T09:54:49+05:30"
  7 => "2022-11-30T09:53:25+05:30"
]
</code>```

Now I want to draw a google bar chart to display the number of orders V time.

But I'm struggling to separate the time from the initial created_at value which is something like,

2022-12-16T08:51:48+05:30

I need just the 08:51:48

and create a new array which only contains the time

```<code>array:8 [▼
  0 => "08:51:48"
  1 => "11:45:59"
  2 => "15:52:49"
  3 => "09:56:56"
  4 => "09:46:03"
  5 => "10:45:43"
  6 => "09:54:49"
  7 => "09:53:25"
]
</code>```

Body:
I'm tying to fetch some data from Shopify admin REST API via php.

When I fetch orders data, It includes the date and the time of order initially created as created_at

 "created_at" => "2022-12-16T08:51:48+05:30"

I created a new array from the existing orders array which only includes those created_at key values.

// Store all the gateways to a new array
            $newArr_createdAt = array_column($result_3['orders'] , "created_at");

This gives me the following output

array:8 [▼
  0 => "2022-12-16T08:51:48+05:30"
  1 => "2022-12-14T11:45:59+05:30"
  2 => "2022-12-12T15:52:49+05:30"
  3 => "2022-12-12T09:56:56+05:30"
  4 => "2022-12-12T09:46:03+05:30"
  5 => "2022-12-10T10:45:43+05:30"
  6 => "2022-11-30T09:54:49+05:30"
  7 => "2022-11-30T09:53:25+05:30"
]

Now I want to draw a google bar chart to display the number of orders V time.

But I'm struggling to separate the time from the initial created_at value which is something like,

2022-12-16T08:51:48+05:30

I need just the 08:51:48

and create a new array which only contains the time

array:8 [▼
  0 => "08:51:48"
  1 => "11:45:59"
  2 => "15:52:49"
  3 => "09:56:56"
  4 => "09:46:03"
  5 => "10:45:43"
  6 => "09:54:49"
  7 => "09:53:25"
]


问:
How does Azure App Service work internally in order to reproduce it in self-hosted environment
I'm trying to host my own infrastructure and therefore I was curious of how Azure app service works on the back-end.

I've seen other questions about it but no answer really answered it the way I understand it.

I looked online and and it says that it's basically an http web-server that hosts containers and makes it accessible to the internet.

I was thinking, is it possible to create a web-server with apache2 and put my Blazor or Xamarin.Forms app in a Docker container, upload the container to the web-server, make it accessible to the internet and would that be what Azure app service is ?


问:
multiple components with tables in one page with a same @HostListener keyboard shortcut
i have multiple components in the same page with table inside. Each of these table has a @HostListener waiting for the "Ctr + B" keyboard shortcut to be pressed when this happens a row added in the specific table. How i can focus in specific table ? with my current implementation row added to all tables in the same time</p>
```<code>    @HostListener('document:keypress', ['$event'])
    handleKeyboardEvent($event: KeyboardEvent) {
        let keyCode = $event.key;

        if(($event.ctrlKey || $event.metaKey) && keyCode == '\x02') {
            console.log('CTRL + B');
            this.onAdd();
        }

        console.log($event);
    }
</code>```

Body:
i have multiple components in the same page with table inside. Each of these table has a @HostListener waiting for the "Ctr + B" keyboard shortcut to be pressed when this happens a row added in the specific table. How i can focus in specific table ? with my current implementation row added to all tables in the same time

    @HostListener('document:keypress', ['$event'])
    handleKeyboardEvent($event: KeyboardEvent) {
        let keyCode = $event.key;

        if(($event.ctrlKey || $event.metaKey) && keyCode == '\x02') {
            console.log('CTRL + B');
            this.onAdd();
        }

        console.log($event);
    }


问:
Question about complex Java Beans Validation with Spring Boot and Vaadin in the front-end
I've got an Entity class with lots of fields, including a status to represent the progression of an object thru its life cycle, say "INITIAL", "READY", "SUSPENDED" and "CLOSED". While at the "INITIAL" stage, all fields can be changed, a few can be changed while the object is "SUSPENDED", very few fields can be changed while in the "READY" status, and once "CLOSED", nothing more can be changed for that object.

So, setName(@NotBlank String name) is fine, but that is not enough, as as the name can only be changed when status is NOT CLOSED, but setCurrency(@NotBlank String currency) can only be applied when status is INITIAL, or SUSPENDED if other conditions are also valid.  Thus, I need varying validations applied as pre-conditions to the set... method execution, not as Class-level validation.

There is more. The status is implemented as an enum, with a Finite State Machine defining the valid transitions from one state to another. And at each state transition, a number of business rules need to be applied to validate the data surrounding the core entity. So instead of using setStatus(Status newStatus), I'm using setStatusReady(), setStatusSuspended()...

From all that I've found, most tutorials, articles, best practices and solutions cater for the syntactical validations at field or class level and cross-parameter method validations, while I'd need access to whole Bean instance at the time of the method execution.

So far, the "best" solution is from OVAL (see https://sebthom.github.io/oval/USERGUIDE.html#using-validate_with_method), but that framework is not longer under development and OVal is not JSR303/JSR380 compliant.

So, what are your suggestions?

Thank you all.

*** EDITED *** In response to CFRICK, thank you

First, I don't mean any disregard or disrespect for anybody's recommendations. I'm genuinely trying to find a "better" solution for my situation.

Vaadin handles JSR303/JSR380 validation rather nicely at the front-end.

The validation still has to be done on the back-end, ideally under the JSR303/JSR380 umbrella.  So, moving anything to the front-end is just replicating the validation to make a nice and consistent presentation of the errors when they happen.

I like the concept of entities taking care of their status, not being just data skeletons. I could repeat some "validation" to the front-end at Binder (in vaadin) and still make full use of the vaadin great features. Enable and disable field editing depending on the entity status is fairly easy to do.

I will try again with the suggested multiple DTOs option for the front-end.  My first attempt just turn ugly to handle in a single view, or make multiple views of the "same thing" at the presentation level.

I still like the simplicity of the OVal solution, but that will force me into "hacking" the Validator/ValidatorFactory or use more advanced features of Spring/Hibernate, which I need to research.

Perhaps, the access to the root bean during the method validation will come as a new feature in future releases of Spring/Hibernate validation.


问:
Display success message on login and operation
Hello I just started with Express and I am stuck on an issue.

I am building an attendance tracker where going to a certain route automatically marks attendance. However, this route has basic authentication control. On successful authentication a success message is to be shown:

```<code>router.get("/api/attend/:id", (req, res, next) => {
    /*Password control*/
    const reject = () => {
      res.setHeader("www-authenticate", "Basic");
      res.sendStatus(401);
    };

    const authorization = req.headers.authorization;

    if (!authorization) {
      return reject();
    }

    const [username, password] = Buffer.from(
      authorization.replace("Basic ", ""),
      "base64"
    )
    .toString()
    .split(":");

    if (!(users.includes(username) && pass.includes(password))) {
      return reject();
    }
    /*Password end*/

    var now = new Date();
    var today = now.toISOString();
    var data = {
        id: req.params.id,
        date: today,
        attend: 'TRUE'
    }
    var sql ='INSERT INTO attendance (id, date, attendance) VALUES (?,?,?)'
    var params =[data.id, data.date, data.attend]
    db.run(sql, params, function (err, result) {
        if (err){
            res.status(400).json({"error": err.message})
            return;
        }
        res.json({
            "message": "success",
            "data": data,
            "id" : this.lastID
        })
        //res.type('html'); //Added later to check if header was the issue
        //res.render("attend", {"welcome": "Thank you for marking your attendance for today's class ", "date": today});
    });
  });
</code>```

The code above works as expected and I am getting a json response as expected. However, if I uncomment the res.render and comment the res.json above it, I am just getting a blank page. This was not an issue when I did not have the authentication code. My guess is that this behaviour is a result of the setting the headers in the authentication code. But, I just started with Express today and thus am not sure.

Body:
Hello I just started with Express and I am stuck on an issue.

I am building an attendance tracker where going to a certain route automatically marks attendance. However, this route has basic authentication control. On successful authentication a success message is to be shown:

router.get("/api/attend/:id", (req, res, next) => {
    /*Password control*/
    const reject = () => {
      res.setHeader("www-authenticate", "Basic");
      res.sendStatus(401);
    };

    const authorization = req.headers.authorization;

    if (!authorization) {
      return reject();
    }

    const [username, password] = Buffer.from(
      authorization.replace("Basic ", ""),
      "base64"
    )
    .toString()
    .split(":");

    if (!(users.includes(username) && pass.includes(password))) {
      return reject();
    }
    /*Password end*/

    var now = new Date();
    var today = now.toISOString();
    var data = {
        id: req.params.id,
        date: today,
        attend: 'TRUE'
    }
    var sql ='INSERT INTO attendance (id, date, attendance) VALUES (?,?,?)'
    var params =[data.id, data.date, data.attend]
    db.run(sql, params, function (err, result) {
        if (err){
            res.status(400).json({"error": err.message})
            return;
        }
        res.json({
            "message": "success",
            "data": data,
            "id" : this.lastID
        })
        //res.type('html'); //Added later to check if header was the issue
        //res.render("attend", {"welcome": "Thank you for marking your attendance for today's class ", "date": today});
    });
  });

The code above works as expected and I am getting a json response as expected. However, if I uncomment the res.render and comment the res.json above it, I am just getting a blank page. This was not an issue when I did not have the authentication code. My guess is that this behaviour is a result of the setting the headers in the authentication code. But, I just started with Express today and thus am not sure.


问:
How can I hide all proof terms?
I am assuming proof-irrelevance, so proof terms (i.e., terms of propositions) take up a lot of space in proof mode and don't give me any relevant information.  Is there any way I can have them all display as _?

Title: How can I hide all proof terms?


问:
Formatting time on a time series matplotlib plot
I am plotting temperature in a dynamic, ie. ever increasing, time series plot using matplotlib.

My xaxis is:

```<code>g_my_globals.t_array.append(datetime.datetime.now())
g_my_globals.y_array.append(fahrMash) #temperature from a sensor
g_my_globals.axis.plot(t_array,y_array)
</code>```

Without any further statements, the plot I generate shows (horizontally) hh:mm:ss. If I rotate the xlabels:

```<code>g_my_globals.axis.set_xticklabels(t_array,rotation="vertical")
</code>```

I see the entire time structure, ie. MM/DD/YYY HH:MM:SS, squishing the actual plot. All my attempts to format the xticklabels to be just '$H:%M:%S' have failed. Reaching out, hoping someone can point me in the right direction.

Body:
I am plotting temperature in a dynamic, ie. ever increasing, time series plot using matplotlib.

My xaxis is:

g_my_globals.t_array.append(datetime.datetime.now())
g_my_globals.y_array.append(fahrMash) #temperature from a sensor
g_my_globals.axis.plot(t_array,y_array)

Without any further statements, the plot I generate shows (horizontally) hh:mm:ss. If I rotate the xlabels:

g_my_globals.axis.set_xticklabels(t_array,rotation="vertical")

I see the entire time structure, ie. MM/DD/YYY HH:MM:SS, squishing the actual plot. All my attempts to format the xticklabels to be just '$H:%M:%S' have failed. Reaching out, hoping someone can point me in the right direction.


问:
Company Branding from Microsoft Graph: Azure B2C
We want to set company branding for our B2C tenant. We are able to achieve that from Portal but our usecase is to do it programmatically that too Microsoft Graph.

We have Organization.ReadWrite.All permission that allows us to read and write organization information.

Found this to do company branding from Microsoft Graph:

```<code>PATCH https://graph.microsoft.com/v1.0/organization/tID/branding

{
    "backgroundColor" : ""
}
</code>```

How to set logo or background image from Microsoft Graph? Any idea

Body:
We want to set company branding for our B2C tenant. We are able to achieve that from Portal but our usecase is to do it programmatically that too Microsoft Graph.

We have Organization.ReadWrite.All permission that allows us to read and write organization information.

Found this to do company branding from Microsoft Graph:

PATCH https://graph.microsoft.com/v1.0/organization/tID/branding

{
    "backgroundColor" : ""
}

How to set logo or background image from Microsoft Graph? Any idea


问:
React: How to use different layouts for different routes, when the layouts share components?
In the following react app, I have a Layout component which contains a Navbar and a Footer (these are the same for all pages and thus they never need to be re-rendered) ...

```<code><BrowserRouter>
   <Layout>
      <Navbar />
      <Footer />
      <Routes>
         <Route path="/" element={<Home />} />
         <Route path="/about" element={<About />} />
         <Route path="/contact" element={<Contact />} />
      </Routes>
   </Layout>
</BrowserRouter>
</code>```

... and a Content and a Sidebar -- these depend on the page, and thus they are rendered from the page component, for example:

```<code>const About = () => {
    return (
       <>
          <Content>
             ...
          </Content>
          <Sidebar>
             ...
          </Sidebar>
       </>
   )
}
</code>```

I want Contact to use a different layout: same Navbar and a Footer but no Sidebar and different dimensions for content (i.e. I cannot just not render the sidebar). Is there a way to do this without having to declare <Navbar/> and  in multiple places?

The only way I see is to use nested layouts, i.e. a parent layout with navbar and footer, and then child layouts either with sidebar and smaller content or without sidebar and bigger content. However, I'd like to avoid nested layouts if possible.

Body:
In the following react app, I have a Layout component which contains a Navbar and a Footer (these are the same for all pages and thus they never need to be re-rendered) ...

<BrowserRouter>
   <Layout>
      <Navbar />

      <Routes>
         <Route path="/" element={<Home />} />
         <Route path="/about" element={<About />} />
         <Route path="/contact" element={<Contact />} />
      </Routes>
   </Layout>
</BrowserRouter>

... and a Content and a Sidebar -- these depend on the page, and thus they are rendered from the page component, for example:

const About = () => {
    return (
       <>
          <Content>
             ...
          </Content>
          <Sidebar>
             ...
          </Sidebar>
       </>
   )
}

I want Contact to use a different layout: same Navbar and a Footer but no Sidebar and different dimensions for content (i.e. I cannot just not render the sidebar). Is there a way to do this without having to declare <Navbar/> and  in multiple places?

The only way I see is to use nested layouts, i.e. a parent layout with navbar and footer, and then child layouts either with sidebar and smaller content or without sidebar and bigger content. However, I'd like to avoid nested layouts if possible.


问:
Getting null value of Name Propperty and Saving to Mysql using Spring JPA CrudRepository
I am facing issue regarding getting null value of Name Property and Saving to Mysql using Spring bootJPA using interface CrudRepository. It saved all data to mysql db for all other fields but saving null for Name fields in MySql Db. I am using MySql database.

POJO Class

```<code>@Entity
public class Registration
{
    @Id
    String username;
    String name;
    String password;
    String email;
    String rollno;
    String dob;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getRollno() {
        return rollno;
    }
    public void setRollno(String rollno) {
        this.rollno = rollno;
    }
    public String getDob() {
        return dob;
    }
    public void setDob(String dob) {
        this.dob = dob;
    }
    @Override
    public String toString() {
        return "Register [username=" + username + ", name=" + name + ", password=" + password + ", email=" + email
                + ", rollno=" + rollno + ", dob=" + dob + "]";
    }

}
</code>```

Controller Class

```<code>@Controller
public class RegisterController
{
    @Autowired
    QuizDAO reg;
    @RequestMapping("/Reg")
    public String Reg(Registration register)
    {

        reg.save(register);
        return "Login.jsp";
    }
}
</code>```

application.properties

```<code>spring.h2.console.enabled=true
spring.datasource.name=eman
spring.datasource.url=jdbc:mysql://localhost:3306/eman
spring.datasource.username=root
spring.datasource.password=eman2022
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL55Dialect
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.ddl-auto=update
</code>```

QuizDAO Class

```<code>import org.springframework.data.repository.CrudRepository;

import com.klp.JPA.model.Registration;
public interface QuizDAO extends CrudRepository<Registration,String>
{

}
</code>```

Body:
I am facing issue regarding getting null value of Name Property and Saving to Mysql using Spring bootJPA using interface CrudRepository. It saved all data to mysql db for all other fields but saving null for Name fields in MySql Db. I am using MySql database.

POJO Class

@Entity
public class Registration
{
    @Id
    String username;
    String name;
    String password;
    String email;
    String rollno;
    String dob;
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getUsername() {
        return username;
    }
    public void setUsername(String username) {
        this.username = username;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public String getRollno() {
        return rollno;
    }
    public void setRollno(String rollno) {
        this.rollno = rollno;
    }
    public String getDob() {
        return dob;
    }
    public void setDob(String dob) {
        this.dob = dob;
    }
    @Override
    public String toString() {
        return "Register [username=" + username + ", name=" + name + ", password=" + password + ", email=" + email
                + ", rollno=" + rollno + ", dob=" + dob + "]";
    }

}

Controller Class

@Controller
public class RegisterController
{
    @Autowired
    QuizDAO reg;
    @RequestMapping("/Reg")
    public String Reg(Registration register)
    {

        reg.save(register);
        return "Login.jsp";
    }
}

application.properties

spring.h2.console.enabled=true
spring.datasource.name=eman
spring.datasource.url=jdbc:mysql://localhost:3306/eman
spring.datasource.username=root
spring.datasource.password=eman2022
spring.datasource.driver-class-name=com.mysql.jdbc.Driver
spring.jpa.properties.hibernate.dialect=org.hibernate.dialect.MySQL55Dialect
spring.jpa.hibernate.naming.physical-strategy=org.hibernate.boot.model.naming.PhysicalNamingStrategyStandardImpl
spring.jpa.hibernate.ddl-auto=update

QuizDAO Class

import org.springframework.data.repository.CrudRepository;

import com.klp.JPA.model.Registration;
public interface QuizDAO extends CrudRepository<Registration,String>
{

}


问:
Android I want to make the corners of the primary secondary or secondary color right-angled, how do I do this?
I need to use Slider instead of Seekbar.

```<code><com.google.android.material.slider.Slider
    android:id="@+id/slider"
    style="@style/SliderStyle"
    android:layout_width="300dp"
    android:layout_height="wrap_content"
    android:stepSize="2"
    android:value="10"
    android:valueFrom="0.0"
    android:valueTo="20"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:thumbColor="@android:color/holo_blue_light"
    app:tickVisible="false"
    app:trackHeight="20dp" />
</code>```

style

cornerRadius is not work.

```<code><style name="SliderStyle" parent="@style/Widget.MaterialComponents.Slider">
    <item name="materialThemeOverlay">@style/ThemeOverlay.Slider</item>
</style>
<style name="ThemeOverlay.Slider" parent="">
    <item name="cornerRadius">0dp</item>
</style>
</code>```

Can Slider bar be at right angles?

Body:
I need to use Slider instead of Seekbar.

<com.google.android.material.slider.Slider
    android:id="@+id/slider"
    style="@style/SliderStyle"
    android:layout_width="300dp"
    android:layout_height="wrap_content"
    android:stepSize="2"
    android:value="10"
    android:valueFrom="0.0"
    android:valueTo="20"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent"
    app:thumbColor="@android:color/holo_blue_light"
    app:tickVisible="false"
    app:trackHeight="20dp" />

style

cornerRadius is not work.

Can Slider bar be at right angles?