问:
Can't import OpenZeppelin contracts when using Yarn package manager and Truffle
I'm writing my first smart contract and I'm trying a few new things at once. One of which is using Yarn 3 (which apparently works very different from the older versions).

When running yarn truffle compile, I get this error:

Using network 'test'.

Compiling your contracts...
===========================
> Compiling ./contracts/HelloWorld.sol

CompileError: ParserError: Source "@openzeppelin/contracts/utils/Strings.sol" not found
 --> project:/contracts/HelloWorld.sol:5:1:
  |
5 | import "@openzeppelin/contracts/utils/Strings.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Compilation failed. See above.
    at /Users/craig/Code/ethereum-hello-world/.yarn/unplugged/truffle-npm-5.6.8-9c74c1574e/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/run.js:95:1
    at Generator.next (<anonymous>)
    at fulfilled (/Users/craig/Code/ethereum-hello-world/.yarn/unplugged/truffle-npm-5.6.8-9c74c1574e/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/run.js:28:43)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
```
<p>When I remove this line, it compiles just fine:</p>
<pre class="lang-js prettyprint-override"><code>import "@openzeppelin/contracts/utils/Strings.sol";
</code>```

This is my package.json:

{
  "name": "ethereum-hello-world",
  "version": "0.0.1",
  "packageManager": "yarn@3.3.0",
  "scripts": {
    "test": "mocha"
  },
  "dependencies": {
    "truffle": "^5.6.8"
  },
  "devDependencies": {
    "@openzeppelin/contracts": "^4.8.0",
    "@openzeppelin/test-helpers": "^0.5.16",
    "chai": "^4.3.7"
  }
}

```
<p>(To add the openzeppelin/contracts above, I used <code>yarn add -D @openzeppelin/contracts</code>.)</p>
<p>This is my <code>HelloWorld.sol</code>:</p>
<pre class="lang-js prettyprint-override"><code>// SPDX-License-Identifier: ISC
pragma solidity ^0.8.17;

import "@openzeppelin/contracts/utils/Strings.sol";

contract HelloWorld {
    string public text = "Hello World";

    constructor() {
        // Do nothing
    }
}
</code>```

What am I doing wrong?

Body:
I'm writing my first smart contract and I'm trying a few new things at once. One of which is using Yarn 3 (which apparently works very different from the older versions).

When running yarn truffle compile, I get this error:

Using network 'test'.

Compiling your contracts...
===========================
> Compiling ./contracts/HelloWorld.sol

CompileError: ParserError: Source "@openzeppelin/contracts/utils/Strings.sol" not found
 --> project:/contracts/HelloWorld.sol:5:1:
  |
5 | import "@openzeppelin/contracts/utils/Strings.sol";
  | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Compilation failed. See above.
    at /Users/craig/Code/ethereum-hello-world/.yarn/unplugged/truffle-npm-5.6.8-9c74c1574e/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/run.js:95:1
    at Generator.next (<anonymous>)
    at fulfilled (/Users/craig/Code/ethereum-hello-world/.yarn/unplugged/truffle-npm-5.6.8-9c74c1574e/node_modules/truffle/build/webpack:/packages/compile-solidity/dist/run.js:28:43)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)

When I remove this line, it compiles just fine:

import "@openzeppelin/contracts/utils/Strings.sol";

This is my package.json:

{
  "name": "ethereum-hello-world",
  "version": "0.0.1",
  "packageManager": "yarn@3.3.0",
  "scripts": {
    "test": "mocha"
  },
  "dependencies": {
    "truffle": "^5.6.8"
  },
  "devDependencies": {
    "@openzeppelin/contracts": "^4.8.0",
    "@openzeppelin/test-helpers": "^0.5.16",
    "chai": "^4.3.7"
  }
}

(To add the openzeppelin/contracts above, I used yarn add -D @openzeppelin/contracts.)

This is my HelloWorld.sol:

// SPDX-License-Identifier: ISC
pragma solidity ^0.8.17;

import "@openzeppelin/contracts/utils/Strings.sol";

contract HelloWorld {
    string public text = "Hello World";

    constructor() {
        // Do nothing
    }
}

What am I doing wrong?


来源: stackexchange

问:
Possible Notion API bug - Can't create Database Page with URL data
I have a Notion database that I'm trying to write to via the API.

I can write to text fields, but when I try to write to a URL field, I receive the following error:

```<code>{
    "object": "error",
    "status": 400,
    "code": "validation_error",
    "message": "body failed validation. Fix one:\nbody.properties.O?HT.id should be defined, instead was `undefined`.\nbody.properties.O?HT.name should be defined, instead was `undefined`.\nbody.properties.O?HT.start should be defined, instead was `undefined`."
}
</code>```

This is the API description of that field:

```<code>"LinkedIn": {
    "id": "O%3FHT",
    "name": "LinkedIn",
    "type": "url",
    "url": {}
},
</code>```

This is the body of the API POST request that's failing:

```<code>{
    "parent": {
        "database_id": "f016c02beeff4a34bf298ceb8a8a079f"
    },
    "properties": {
        "title": [
            {
                "text": {
                    "content": "Mark Zuckerberg"
                }
            }
        ],
        "%3DCzE": [
            {
                "text": {
                    "content": "CEO"
                }
            }
        ],
        "HihI": [
            {
                "text": {
                    "content": "Facebook"
                }
            }
        ],
        "JC%3BS": [
            {
                "text": {
                    "content": "Menlo Park, CA"
                }
            }
        ],
        "O%3FHT": {
                "url": "https://www.linkedin.com/in/mark-zuckerberg/"
        },
        "wS%7BN": {
                "url": "https://www.linkedin.com/company/facebook/mycompany/verification/"
        }
    }
}
</code>```

I'm basing the body contents on the Postman docs provided by Notion: https://www.postman.com/notionhq/workspace/notion-s-api-workspace/documentation/15568543-d990f9b7-98d3-47d3-9131-4866ab9c6df2

ContentLicense: CC BY-SA 4.0

Body:
I have a Notion database that I'm trying to write to via the API.

I can write to text fields, but when I try to write to a URL field, I receive the following error:

{
    "object": "error",
    "status": 400,
    "code": "validation_error",
    "message": "body failed validation. Fix one:\nbody.properties.O?HT.id should be defined, instead was `undefined`.\nbody.properties.O?HT.name should be defined, instead was `undefined`.\nbody.properties.O?HT.start should be defined, instead was `undefined`."
}

This is the API description of that field:

"LinkedIn": {
    "id": "O%3FHT",
    "name": "LinkedIn",
    "type": "url",
    "url": {}
},

This is the body of the API POST request that's failing:

{
    "parent": {
        "database_id": "f016c02beeff4a34bf298ceb8a8a079f"
    },
    "properties": {
        "title": [
            {
                "text": {
                    "content": "Mark Zuckerberg"
                }
            }
        ],
        "%3DCzE": [
            {
                "text": {
                    "content": "CEO"
                }
            }
        ],
        "HihI": [
            {
                "text": {
                    "content": "Facebook"
                }
            }
        ],
        "JC%3BS": [
            {
                "text": {
                    "content": "Menlo Park, CA"
                }
            }
        ],
        "O%3FHT": {
                "url": "https://www.linkedin.com/in/mark-zuckerberg/"
        },
        "wS%7BN": {
                "url": "https://www.linkedin.com/company/facebook/mycompany/verification/"
        }
    }
}

I'm basing the body contents on the Postman docs provided by Notion: https://www.postman.com/notionhq/workspace/notion-s-api-workspace/documentation/15568543-d990f9b7-98d3-47d3-9131-4866ab9c6df2


问:
Why won't my React app send HTTP-only cookies in WebSocket upgrade requests in production?
I'm currently building a full-stack TypeScript live chat app with React + Vite on the frontend and Node on the backend. I have two separate servers running: one is a REST API and OAuth2 auth server built with Express and Passport.js and the other one is a WebSockets server built with the ws package. They run independently (no interprocess communication whatsoever) and use stateless auth in the form of JWTs.

Here's how my current flow works: users first log in with either their Google or GitHub account, and once the first server has verified their identity, it sends an HTTP-only cookie down to the client. This cookie is send back to the server on all subsequent requests and I have some middleware that runs on the REST API to parse and verify the JWTs on protected routes. Once it has the cookie, the client then initiates a WS connection with the second server, which also checks for the JWT cookie in the incoming HTTP Upgrade request and verifies its signature before allowing the new client to continue exchanging messages:

import { WebSocket, WebSocketServer } from "ws";
import { baseDataSchema } from "./zod/schemas";
import prisma from "./prisma";
import { asyncJWTverify } from "./misc/jwt";
import { UserJwtReceived } from "../types/jwt";
import { handleJoinGroup } from "./websockets-handlers/join-group";

// Websockets server setup
const wss = new WebSocketServer({ port: Number(process.env.WS_PORT) });

const userSocketMap = new Map<string, WebSocket>();

wss.on("listening", () => {
  console.log(`WebSockets server started on port ${process.env.WS_PORT}`);
});

wss.on("connection", async function connection(ws, req) {
  // authenticate incoming websocket connection
  const cookies = req.headers.cookie;
  if (!cookies) return ws.close();
  let currentUser: UserJwtReceived = { id: "", iat: 0 };

  try {
    // Decode auth JWT
    const token = cookies.split("=")[1];
    currentUser = (await asyncJWTverify(
      token,
      process.env.JWT_SECRET as string
    )) as UserJwtReceived;
  } catch (err) {
    console.error(err);
    return ws.close();
  }

  // check for JWT expiry
  const expiryTime = Number(process.env.JWT_EXPIRY);
  if (Math.round(Date.now() / 1000) - currentUser.iat > expiryTime) {
    return ws.close();
  }

  // Bind user ID to WebSocket, add it to map
  // TypeScript doesn't complain about this because I've extended ws's WebSocket interface
  ws.userId = currentUser.id;
  userSocketMap.set(currentUser.id, ws);

  console.log(`User ID ${ws.userId} connected`);

  ws.on("message", async function message(rawData) => {
     // ... actual app logic goes here
  })

  ws.on("close", function () {
    if (!ws.userId) return;
    console.log(`User ID ${ws.userId} has disconnected`);
    userSocketMap.delete(ws.userId);
  });

})
```

Both servers and the React frontend app run on different URLs, both on local dev and prod, so all requests are cross-origin, but CORS is enabled on the REST API/auth server and as far as I know the WebSockets protocol doesn't implement any CORS policies...

The problem I'm currently facing is that in my local dev environment, the cookie that contains the JWT is sent along with Upgrade request no problem, but after deploying my app to AWS Lightsail (it's a VPS service similar to EC2) and setting up NGINX, my React frontend is no longer able to include the cookie with the upgrade request.

After spending literally the whole day debugging, I've been able to rule out a faulty NGINX config as the root of the problem, since I can use wscat to connect (and most importantly, successfully authenticate) to my production WS server by manually including the Cookie header.

I still have no idea why my React app won't properly send the HTTP-only auth cookie to my WS server. Does anyone have any clue as to why this is happening?

I expected the HTTP-only cookie containing the JWT to be sent along with the HTTP Upgrade request, just like I've been able to do in my local dev environment, but no luck.

Body:
I'm currently building a full-stack TypeScript live chat app with React + Vite on the frontend and Node on the backend. I have two separate servers running: one is a REST API and OAuth2 auth server built with Express and Passport.js and the other one is a WebSockets server built with the ws package. They run independently (no interprocess communication whatsoever) and use stateless auth in the form of JWTs.

Here's how my current flow works: users first log in with either their Google or GitHub account, and once the first server has verified their identity, it sends an HTTP-only cookie down to the client. This cookie is send back to the server on all subsequent requests and I have some middleware that runs on the REST API to parse and verify the JWTs on protected routes. Once it has the cookie, the client then initiates a WS connection with the second server, which also checks for the JWT cookie in the incoming HTTP Upgrade request and verifies its signature before allowing the new client to continue exchanging messages:

import { WebSocket, WebSocketServer } from "ws";
import { baseDataSchema } from "./zod/schemas";
import prisma from "./prisma";
import { asyncJWTverify } from "./misc/jwt";
import { UserJwtReceived } from "../types/jwt";
import { handleJoinGroup } from "./websockets-handlers/join-group";

// Websockets server setup
const wss = new WebSocketServer({ port: Number(process.env.WS_PORT) });

const userSocketMap = new Map<string, WebSocket>();

wss.on("listening", () => {
  console.log(`WebSockets server started on port ${process.env.WS_PORT}`);
});

wss.on("connection", async function connection(ws, req) {
  // authenticate incoming websocket connection
  const cookies = req.headers.cookie;
  if (!cookies) return ws.close();
  let currentUser: UserJwtReceived = { id: "", iat: 0 };

  try {
    // Decode auth JWT
    const token = cookies.split("=")[1];
    currentUser = (await asyncJWTverify(
      token,
      process.env.JWT_SECRET as string
    )) as UserJwtReceived;
  } catch (err) {
    console.error(err);
    return ws.close();
  }

  // check for JWT expiry
  const expiryTime = Number(process.env.JWT_EXPIRY);
  if (Math.round(Date.now() / 1000) - currentUser.iat > expiryTime) {
    return ws.close();
  }

  // Bind user ID to WebSocket, add it to map
  // TypeScript doesn't complain about this because I've extended ws's WebSocket interface
  ws.userId = currentUser.id;
  userSocketMap.set(currentUser.id, ws);

  console.log(`User ID ${ws.userId} connected`);

  ws.on("message", async function message(rawData) => {
     // ... actual app logic goes here
  })

  ws.on("close", function () {
    if (!ws.userId) return;
    console.log(`User ID ${ws.userId} has disconnected`);
    userSocketMap.delete(ws.userId);
  });

})

Both servers and the React frontend app run on different URLs, both on local dev and prod, so all requests are cross-origin, but CORS is enabled on the REST API/auth server and as far as I know the WebSockets protocol doesn't implement any CORS policies...

The problem I'm currently facing is that in my local dev environment, the cookie that contains the JWT is sent along with Upgrade request no problem, but after deploying my app to AWS Lightsail (it's a VPS service similar to EC2) and setting up NGINX, my React frontend is no longer able to include the cookie with the upgrade request.

After spending literally the whole day debugging, I've been able to rule out a faulty NGINX config as the root of the problem, since I can use wscat to connect (and most importantly, successfully authenticate) to my production WS server by manually including the Cookie header.

I still have no idea why my React app won't properly send the HTTP-only auth cookie to my WS server. Does anyone have any clue as to why this is happening?

I expected the HTTP-only cookie containing the JWT to be sent along with the HTTP Upgrade request, just like I've been able to do in my local dev environment, but no luck.


问:
Why adding a type annotation eliminates the borrow error?
I was learning Rust and all the references and borrowing stuff when I came across this weird case:

fn main() {
    let mut n = 42u32;

    let ref1 = &mut n;
    let ref2 = ref1;   // line 5

    ref2;
    ref1;              // line 8
}
```
<p>This snippet does not compile since <code>ref1</code> is moved in line 5 and can not be used in line 8, which I understand.</p>
<p>But when I added a type annotation (which seems totally extraneous and should not affect anything at all since <code>rust-analyzer</code> reports the exactly same type) to ref2:</p>
<pre class="lang-rust prettyprint-override"><code>fn main() {
    let mut n = 42u32;

    let ref1 = &mut n;
    let ref2: &mut u32 = ref1;
    //      ++++++++++
    ref2;
    ref1;
}
</code>```

It suddenly compiles! (You can try it at the playground)

What is going on? I am currently using rustc 1.65.0, is this some kind of bug? Or is there something I missed?

I tried this using different version of rustc in Compiler Explorer and it seems that 1.36.0 is the first version that successfully compiles the second snippet. So I checked the annocement and noticed they introduced something called 'Non-Lexical Lifetimes' in that version, I am not sure whether this is relevant but I noticed the error msg from rustc 1.35.0 is:

```<code>error[E0505]: cannot move out of `ref1` because it is borrowed -->
<source>:9:5
  |
6 |     let ref2: &mut u32 = ref1;
  |                          ---- borrow of `*ref1` occurs here
...
9 |     ref1;
  |     ^^^^ move out of `ref1` occurs here
error: aborting due to previous error
</code>```

which is different from the error for the first snippet that basically says that you can not use ref1 after it is moved. How can I understand this?

Body:
I was learning Rust and all the references and borrowing stuff when I came across this weird case:

fn main() {
    let mut n = 42u32;

    let ref1 = &mut n;
    let ref2 = ref1;   // line 5

    ref2;
    ref1;              // line 8
}

This snippet does not compile since ref1 is moved in line 5 and can not be used in line 8, which I understand.

But when I added a type annotation (which seems totally extraneous and should not affect anything at all since rust-analyzer reports the exactly same type) to ref2:

fn main() {
    let mut n = 42u32;

    let ref1 = &mut n;
    let ref2: &mut u32 = ref1;
    //      ++++++++++
    ref2;
    ref1;
}

It suddenly compiles! (You can try it at the playground)

What is going on? I am currently using rustc 1.65.0, is this some kind of bug? Or is there something I missed?

I tried this using different version of rustc in Compiler Explorer and it seems that 1.36.0 is the first version that successfully compiles the second snippet. So I checked the annocement and noticed they introduced something called 'Non-Lexical Lifetimes' in that version, I am not sure whether this is relevant but I noticed the error msg from rustc 1.35.0 is:

error[E0505]: cannot move out of `ref1` because it is borrowed -->
<source>:9:5
  |
6 |     let ref2: &mut u32 = ref1;
  |                          ---- borrow of `*ref1` occurs here
...
9 |     ref1;
  |     ^^^^ move out of `ref1` occurs here
error: aborting due to previous error

which is different from the error for the first snippet that basically says that you can not use ref1 after it is moved. How can I understand this?


问:
Should an Entity Framework savepoint have a unique name?
Not really a problem, but curiosity. Should a savepoint name in EF be unique? Since I thought each of the names refers to a transaction for each client.

```<code>using ShortId;

string uniqueID = ShortId.Generate();

transaction.CreateSavePoint($"Save_{uniqueID}");
</code>```

I've searched for this case before but haven't found anything.

Should a savepoint be unique?

Body:
Not really a problem, but curiosity. Should a savepoint name in EF be unique? Since I thought each of the names refers to a transaction for each client.

using ShortId;

string uniqueID = ShortId.Generate();

transaction.CreateSavePoint($"Save_{uniqueID}");

I've searched for this case before but haven't found anything.

Should a savepoint be unique?


问:
Elements are not rendered immediately when scrolling in Webview(react) Android
Elements are not rendered immediately when scrolling in Webview Android.

I'm a junior front-end developer.

running "react" in webview (ios (swift) , android (kotlin)

explain problem picture

'A', 'B', 'C' and 'D' are drawn on my screen, and 'E' and 'F' can be seen when scrolling up.

I scroll up to see 'E' and 'F'

Because of scrolling up, 'A' and 'B' disappeared from the screen. However, the 'E' and 'F' that should appear on the screen are not visible on the screen.

Only on Android!! (google chrome)

When i touch somewhere on the screen, 'E' and 'F' appear on the screen.

Again, When I scroll down to see 'A' and 'B', 'A' and 'B' are not immediately visible on the screen like 'E' and 'F'.

It works normally on iOS, but on Android, the above phenomenon occurs, so I don't know if it's a problem with "react" or Android.

How do I solve this?

sorry, i dont know anything.. I didn't know what the problem was, so I couldn't find it


问:
Bootstrap 5 create a modal with javascript when Modal.show() the dialog is moved into iFrame
There is a page with iFrame and the div modal dialog on this page. I want to trigger the modal from the page inside iFrame (the modal is on the parent page), when the modal is shown the div modal dialog is moved into the iFrame page under body. How can I fix it?

Parent page

```<code><div id="MyModal" class="modal fade bd-example-modal-md modal-mention" role="dialog" aria-hidden="true">
        <div class="modal-dialog modal-dialog-centered ps-modal" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h4 class="modal-title">MyModal
                        <span class="modal-title-desc"></span>
                    </h4>
                    <button id="btClose" type="button" data-bs-dismiss="modal" class="close" aria-label="Close"></button>
                </div>
                <div class="modal-body">
                    ...
                </div>
                <div class="modal-footer">
               ..     .
                </div>
            </div>
            <!-- /.modal-content -->
        </div>
        <!-- /.modal-dialog -->
    </div>
</code>```

Page in iFrame

```<code> var myModal = new bootstrap.Modal(parent.document.getElementById('MyModal'), {
                keyboard: true,
                backdrop: 'static'
            });

myModal.show();
</code>```

Before show modal

After modal is shown

Now I work around with move the div modal back when the modal is hidden.

Body:
There is a page with iFrame and the div modal dialog on this page. I want to trigger the modal from the page inside iFrame (the modal is on the parent page), when the modal is shown the div modal dialog is moved into the iFrame page under body. How can I fix it?

Parent page

MyModal

                    <button id="btClose" type="button" data-bs-dismiss="modal" class="close" aria-label="Close"></button>

                    ...

               ..     .

Page in iFrame

 var myModal = new bootstrap.Modal(parent.document.getElementById('MyModal'), {
                keyboard: true,
                backdrop: 'static'
            });

myModal.show();

Before show modal

After modal is shown

Now I work around with move the div modal back when the modal is hidden.


问:
Mui - remove props from being passed from parent <Tabs to child <ToggleButton - this is to hard to solve i think
Mui - How do you NOT PASS specific props from being passed down from the parent ( <Tabs ) to child ( <ToggleButton )?

i needed the <Tabs functions, with toggle buttons - so I combined them

note: i use the <popper mui function on the <ToggleButton ( <Tab will not work, need to use <Tabs + <ToggleButton )

```<code><Tabs
// stop specific props from being
// passed to the child button
// sx={ don’t pass the these ( error 1, error 2, error 3 - see below errors ) props to child <ToggleButton }
>

<ToggleButton>

<icon/>

</ToggleButton>

</Tabs>
</code>```

ref

https://mui.com/material-ui/react-tabs/#main-content

https://mui.com/system/getting-started/the-sx-prop/

Was unable to figure out a solution to NOT PASS the props - errors resulting from the default passing of the props from parent <Tabs to child <ToggleButton

I’m thinking we can control that at the parent <Tabs level possibly using the sx={} prop

NOTE: there are 45 <ToggleButtons - NOT PASSING these prop values AT the <Tabs level would be cool and more efficient

error 1

next-dev.js?3515:20 Warning: Received false for a non-boolean attribute indicator.

error 2

Warning: React does not recognize the selectionFollowsFocus prop on a DOM element.

error 3

Warning: React does not recognize the textColor prop on a DOM element.

Body:
Mui - How do you NOT PASS specific props from being passed down from the parent ( <Tabs ) to child ( <ToggleButton )?

i needed the <Tabs functions, with toggle buttons - so I combined them

note: i use the <popper mui function on the <ToggleButton ( <Tab will not work, need to use <Tabs + <ToggleButton )

<Tabs
// stop specific props from being
// passed to the child button
// sx={ don’t pass the these ( error 1, error 2, error 3 - see below errors ) props to child <ToggleButton }
>

<ToggleButton>

<icon/>

</ToggleButton>

</Tabs>

ref

https://mui.com/material-ui/react-tabs/#main-content

https://mui.com/system/getting-started/the-sx-prop/

Was unable to figure out a solution to NOT PASS the props - errors resulting from the default passing of the props from parent <Tabs to child <ToggleButton

I’m thinking we can control that at the parent <Tabs level possibly using the sx={} prop

NOTE: there are 45 <ToggleButtons - NOT PASSING these prop values AT the <Tabs level would be cool and more efficient

error 1

next-dev.js?3515:20 Warning: Received false for a non-boolean attribute indicator.

error 2

Warning: React does not recognize the selectionFollowsFocus prop on a DOM element.

error 3

Warning: React does not recognize the textColor prop on a DOM element.


问:
C#: How to log stack trace of AccessViolationException before application crash?
I have some unsafe methods may throw AccessViolationException, it will stop at the line of code with debugger attached. but if run the application without debugger, the application just crashes, cannot log the stack trance to file.

Is there any way to find out which line causes the exception?

I'm using .NET 6


问:
Debugging Typescript in VS Code - doesn't work when using an import
I have a simple file to debug, index.ts.

It will debug fine until I add this line to the top of the code page:

import * as dotenv from 'dotenv';

Then I can see it starts to go into debug mode and then exits wihtout hitting a breakpoint.

Is there a work-around for this?

New Info:

I added the line debugger;

and this was the output in the debug console:

Uncaught SyntaxError d:\Apps\TS\ts_01_AD\index.ts:1 import * as dotenv
from 'dotenv'; ^^^^^^

SyntaxError: Cannot use import statement outside a module
at compileFunction (vm:360:18)
at wrapSafe (internal/modules/cjs/loader:1055:15)
at Module._compile (internal/modules/cjs/loader:1090:27)
at Module._extensions..js (internal/modules/cjs/loader:1180:10)
at Module.load (internal/modules/cjs/loader:1004:32)
at Module._load (internal/modules/cjs/loader:839:12)
at executeUserEntryPoint (internal/modules/run_main:81:12)
at  (internal/main/run_main_module:17:47) No debugger available, can not send 'variables'


问:
Tkinter get tuple eror
I'm trying to make a program that can later show the number and value of some entries list. I made it using nested loop. What I was expecting is this value:  [(1,101,102,103,104), (2,105,106,107,108), (3,109,110,111,112)] when I press print button, but the number displayed is only number 2 and there is an error like this: AttributeError: 'tuple' object has no attribute 'get'. Can you help me with my code? Thank you

Here is my code:

```<code>from tkinter import *

master = Tk()
a=StringVar()
b=[]
c=[]
d=[]

for i in range(3):
    e = Entry(master, textvariable=a, state='readonly')
    e.grid(row=i,column=1,pady=5)

    for j in range( 4 ):
        e1= Entry(master,)
        e1.grid(row=i,column=j+2,pady=5)
        a.set(str(i))
        b.append(e1)
    c.append(e)
d.append((c,b))

but=Button(master, text='print', command= lambda:show())
but.grid(row=4, columnspan=3)

def show():
    for io in d:
        print(io.get())

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

Title: Tkinter get tuple eror

Body:
I'm trying to make a program that can later show the number and value of some entries list. I made it using nested loop. What I was expecting is this value:  [(1,101,102,103,104), (2,105,106,107,108), (3,109,110,111,112)] when I press print button, but the number displayed is only number 2 and there is an error like this: AttributeError: 'tuple' object has no attribute 'get'. Can you help me with my code? Thank you

Here is my code:

from tkinter import *

master = Tk()
a=StringVar()
b=[]
c=[]
d=[]

for i in range(3):
    e = Entry(master, textvariable=a, state='readonly')
    e.grid(row=i,column=1,pady=5)

    for j in range( 4 ):
        e1= Entry(master,)
        e1.grid(row=i,column=j+2,pady=5)
        a.set(str(i))
        b.append(e1)
    c.append(e)
d.append((c,b))

but=Button(master, text='print', command= lambda:show())
but.grid(row=4, columnspan=3)

def show():
    for io in d:
        print(io.get())

master.mainloop()


问:
How to use fetch to upload files to web api(parameter problem)
My aspnetcore web api side is

[ApiController]
[Route("api/[controller]")]
public class SoundController : ControllerBase
{
    [HttpPost]
    public async Task<IActionResult> OnPostUploadAsync(List<IFormFile> files0)
    {
       var files = Request.Form.Files;
       .....
       return Ok(new { count = files.Count, size });
    }
}
```
<p>My script to post file is as follows:</p>
```const blob = new Blob(chunks, { type: "audio/mp3" });
let formData = new FormData();
formData.append("abcd", blob, "a.mp3");
let response = await fetch("api/sound", {
    method: 'post',
    body: formData
});
if (response.ok) {
    var data = await response.json();
    console.log(`response.status=${response.status}, data.count==${data.count},
        data.size=${data.size}`);
}
```

My question is:

Although fetch DO reach the OnPostUploadAsync function,

but the parameter files0 is of length 0.

hower inside OnPostUploadAsync function, we can use Request.Form.Files to get the file uploaded by fetch.

what am I wrong? parameter type issue?

Body:
My aspnetcore web api side is

[ApiController]
[Route("api/[controller]")]
public class SoundController : ControllerBase
{
    [HttpPost]
    public async Task<IActionResult> OnPostUploadAsync(List<IFormFile> files0)
    {
       var files = Request.Form.Files;
       .....
       return Ok(new { count = files.Count, size });
    }
}

My script to post file is as follows:

const blob = new Blob(chunks, { type: "audio/mp3" });
let formData = new FormData();
formData.append("abcd", blob, "a.mp3");
let response = await fetch("api/sound", {
    method: 'post',
    body: formData
});
if (response.ok) {
    var data = await response.json();
    console.log(`response.status=${response.status}, data.count==${data.count},
        data.size=${data.size}`);
}

My question is:

Although fetch DO reach the OnPostUploadAsync function,

but the parameter files0 is of length 0.

hower inside OnPostUploadAsync function, we can use Request.Form.Files to get the file uploaded by fetch.

what am I wrong? parameter type issue?


问:
R Vegan: evaluate pairwise permanova significance between comparisons
I'm looking for a statistical test that will allow me to evaluate whether pairwise comparisons are statistically different from one another. I'm using ecological community count (abundance) data sampled across multiple sites before, during, and after an environmental perturbation inside and outside of treatment plots. I'm specifically interested in:

whether treatment before vs. during and/or treatment before vs. after is significant, AND the same for control.

Importantly, whether the pairwise comparisons above are statistically different.

The first task is straightforward and easy to acquire using pairwise.adonis2(). However, I am not sure how to approach the second task. I'd specifically like to evaluate:

whether Treatment before vs. during is significantly different from Control before vs. during, and likewise...

whether Treatment before vs. after is different from Control before vs. after.

I've modified dune to fit my treatment (control, treatment) and period (before, during, after) levels simply for illustrative purposes. Is there a way to statistically evaluate these pairwise comparisons?

```<code>
require(vegan)
require(pairwiseAdonis)
require(dplyr)

# Species and environmental data
dune <- read.delim ('https://raw.githubusercontent.com/zdealveindy/anadat-r/master/data/dune2.spe.txt', row.names = 1)

dune.env <- read.delim ('https://raw.githubusercontent.com/zdealveindy/anadat-r/master/data/dune2.env.txt', row.names = 1)

#rename
dune.env$Use <- recode_factor(dune.env$Use, "Haypastu" = "before")
dune.env$Use <- recode_factor(dune.env$Use, "Hayfield" = "during")
dune.env$Use <- recode_factor(dune.env$Use, "Pasture" = "after")

dune.env$Management <- recode_factor(dune.env$Management, "HF" = "SF")
dune.env$Management <- recode_factor(dune.env$Management, "NM" = "BF")
dune.env$Management <- recode_factor(dune.env$Management, "SF" = "Control")
dune.env$Management <- recode_factor(dune.env$Management, "BF" = "Treatment")

#define pairwise comparisons

dune.env1 <- dune.env %>% mutate(contrast = paste(Management, Use))

#create distmat
dune_distmat <- vegdist(dune, method="bray")

#pairwise permanova
pair_perm <- pairwise.adonis2(dune_distmat ~ contrast,
                                    data = dune.env1, permutations = 999)
</code>```

Body:
I'm looking for a statistical test that will allow me to evaluate whether pairwise comparisons are statistically different from one another. I'm using ecological community count (abundance) data sampled across multiple sites before, during, and after an environmental perturbation inside and outside of treatment plots. I'm specifically interested in:

whether treatment before vs. during and/or treatment before vs. after is significant, AND the same for control.

Importantly, whether the pairwise comparisons above are statistically different.

The first task is straightforward and easy to acquire using pairwise.adonis2(). However, I am not sure how to approach the second task. I'd specifically like to evaluate:

whether Treatment before vs. during is significantly different from Control before vs. during, and likewise...

whether Treatment before vs. after is different from Control before vs. after.

I've modified dune to fit my treatment (control, treatment) and period (before, during, after) levels simply for illustrative purposes. Is there a way to statistically evaluate these pairwise comparisons?

require(vegan)
require(pairwiseAdonis)
require(dplyr)

# Species and environmental data
dune <- read.delim ('https://raw.githubusercontent.com/zdealveindy/anadat-r/master/data/dune2.spe.txt', row.names = 1)

dune.env <- read.delim ('https://raw.githubusercontent.com/zdealveindy/anadat-r/master/data/dune2.env.txt', row.names = 1)

#rename
dune.env$Use <- recode_factor(dune.env$Use, "Haypastu" = "before")
dune.env$Use <- recode_factor(dune.env$Use, "Hayfield" = "during")
dune.env$Use <- recode_factor(dune.env$Use, "Pasture" = "after")

dune.env$Management <- recode_factor(dune.env$Management, "HF" = "SF")
dune.env$Management <- recode_factor(dune.env$Management, "NM" = "BF")
dune.env$Management <- recode_factor(dune.env$Management, "SF" = "Control")
dune.env$Management <- recode_factor(dune.env$Management, "BF" = "Treatment")

#define pairwise comparisons

dune.env1 <- dune.env %>% mutate(contrast = paste(Management, Use))

#create distmat
dune_distmat <- vegdist(dune, method="bray")

#pairwise permanova
pair_perm <- pairwise.adonis2(dune_distmat ~ contrast,
                                    data = dune.env1, permutations = 999)


问:
How to delete background of rounded corner popup window?
I created a popup window with rounded corners in a fragment but when I open it I can see a dark background behind the popup. Can you tell how to delete it or make ir transparent?

I'm using kotlin.

This is my fragment code (the activity with an image that opens the popup on click):

`

```<code>class ProfileFragment : Fragment() {

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_profile, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val bpMore: ImageView = view.findViewById(R.id.ic_bp_more)

        bpMore.setOnClickListener {
            val showPopUp = BadgesPopUpFragment()
            showPopUp.show((activity as AppCompatActivity).supportFragmentManager, "showPopUp")
        }
    }
</code>```

`

And this is my popup fragment code (popup window):

`

```<code>class BadgesPopUpFragment : DialogFragment() {

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_badges_pop_up, container, false)
    }
}
</code>```

`

Body:
I created a popup window with rounded corners in a fragment but when I open it I can see a dark background behind the popup. Can you tell how to delete it or make ir transparent?

I'm using kotlin.

This is my fragment code (the activity with an image that opens the popup on click):

`

class ProfileFragment : Fragment() {

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_profile, container, false)
    }

    override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val bpMore: ImageView = view.findViewById(R.id.ic_bp_more)

        bpMore.setOnClickListener {
            val showPopUp = BadgesPopUpFragment()
            showPopUp.show((activity as AppCompatActivity).supportFragmentManager, "showPopUp")
        }
    }

`

And this is my popup fragment code (popup window):

`

class BadgesPopUpFragment : DialogFragment() {

    override fun onCreateView(
        inflater: LayoutInflater, container: ViewGroup?,
        savedInstanceState: Bundle?
    ): View? {
        // Inflate the layout for this fragment
        return inflater.inflate(R.layout.fragment_badges_pop_up, container, false)
    }
}

`


问:
Replace shape(autoshape) not working when contains text in PowerPoint vba
Need little help from this forum.

I want to replace shape(autoshape) with other autoshape in my project & found a solution here http://www.vbaexpress.com/forum/showthread.php?68760-Change-Fill-color-using-VBA-in-PowerPoint.

But in my project there are some shapes which contains text(I did not use textbox).

The code are select shape(which will be replaced) by some critaria
ie

by height 2. by weidth 3. fill colour 4. by top position.

As textbox is not a autoshape thats why I used shape which contains text & to give text backgroung transparent I used 'shape fill' to 'no fill'.

In my project there are shapes(not contains text) which are same size & same top position(ie the shape just behind the text shape).

Code is working fine for those shape which did not contains text.When I select the text shape & run the code  it replaced all the shape behind the text shape ie
not replace the text shape(which I want to replace).

I tried a lot but not getting the solution.I also tried with changeing the weidth of the shape behind the textshape but not get desire result.

Sir any solution will be highly appreaciate.

```<code>Option Explicit

Dim oShapeAfterChange As Shape, oShapeToChange As Shape
Dim tShapeAfterChange As MsoAutoShapeType, tShapeToChange As MsoAutoShapeType
Dim iShapeAfterChangeRGB As Long, iShapeAfterChangeHeight As Double, iShapeAfterChangeWidth As Double, iShapeAfterChangeTop As Double

Sub Step1()

    If MsgBox("This is Step 1 of a two step process" & vbCrLf & vbCrLf & _
        "1. You must already have inserted and selected a new Shape to change to" & vbCrLf & _
        "2. After running, Step1 will remember the new type of shape" & vbCrLf & _
        "3. Select one of the shapes to be changed" & vbCrLf & _
        "4. Run the Step2 Macro", vbOKCancel + vbInformation, "Change Shapes") = vbCancel Then
        Exit Sub
    End If
    Set oShapeAfterChange = Nothing
    On Error Resume Next
    Set oShapeAfterChange = ActiveWindow.Selection.ShapeRange(1)
    oShapeAfterChange.PickUp
    tShapeAfterChange = oShapeAfterChange.AutoShapeType
    On Error GoTo 0

    If oShapeAfterChange Is Nothing Then
        Call MsgBox("You must select an AutoShape", vbCritical + vbOKOnly, "Change Shapes")
        Exit Sub
    End If

    Call MsgBox("Destination Shape type memorized", vbOK + vbInformation, "Change Shapes")

End Sub

Sub Step2()
    Dim oPres As Presentation
    Dim oSlide As Slide
    Dim oShape As Shape, oShapeInGroup As Shape

    If MsgBox("This is Step 2 of a two step process" & vbCrLf & vbCrLf & _
        "1. You must already have selected an instance of a Shape to change" & vbCrLf & _
        "2. All instances on all slides of that type of Shape will be changed", vbOKCancel + vbInformation, "Change Shapes") = vbCancel Then
        Exit Sub
    End If
    If oShapeAfterChange Is Nothing Then
        Call MsgBox("1. You must select an example of a new Shape to change the shapes to" & vbCrLf & _
            "2. Re-run Step1", vbCritical + vbOKOnly, "Change Shapes")
        Exit Sub
    End If

    Set oShapeToChange = Nothing
    Set oShapeToChange = ActiveWindow.Selection.ShapeRange(1)

    If oShapeToChange.Type = msoGroup Then
        If ActiveWindow.Selection.HasChildShapeRange Then
            If ActiveWindow.Selection.ChildShapeRange.Count <> 1 Then
                Call MsgBox("You must select exactly one Shape within the Group of the type to be changed", vbCritical + vbOKOnly, "Change Shapes")
                Exit Sub
            Else
                Set oShapeToChange = ActiveWindow.Selection.ChildShapeRange(1)
            End If
        End If
    End If

    If oShapeToChange Is Nothing Then
        Call MsgBox("You must select a Shape of the type to be changed", vbCritical + vbOKOnly, "Change Shapes")
        Exit Sub
    End If

    With oShapeToChange
        tShapeToChange = .AutoShapeType
        iShapeAfterChangeRGB = .Fill.ForeColor.RGB
       iShapeAfterChangeHeight = Round(.Height, 0)
        iShapeAfterChangeWidth = Round(.Width, 0)
        iShapeAfterChangeTop = Round(.Top, 0)
    End With

    Set oPres = ActivePresentation

    For Each oSlide In oPres.Slides
        For Each oShape In oSlide.Shapes
            If oShape.Type = msoGroup Then
                For Each oShapeInGroup In oShape.GroupItems
                    Call pvtChangeAutoShapeType(oShapeInGroup)
                Next
            Else
                Call pvtChangeAutoShapeType(oShape)
            End If
        Next
    Next

    oShapeAfterChange.Delete
    MsgBox "Shapes updated successfully"
End Sub

Private Sub pvtChangeAutoShapeType(o As Shape)
    Dim CenterTop As Double, CenterLeft As Double

    With o
        If .Type <> msoAutoShape Then Exit Sub
        If .AutoShapeType <> tShapeToChange Then Exit Sub

        If .Fill.ForeColor.RGB <> iShapeAfterChangeRGB Then Exit Sub
        If Round(.Height, 0) <> iShapeAfterChangeHeight Then Exit Sub
        If Round(.Width, 0) <> iShapeAfterChangeWidth Then Exit Sub
        If Round(.Top, 0) <> iShapeAfterChangeTop Then Exit Sub

        .AutoShapeType = tShapeAfterChange

        CenterTop = .Top + .Height / 2#
        CenterLeft = .Left + .Width / 2#

        .Height = oShapeAfterChange.Height
        .Width = oShapeAfterChange.Width
        .Left = CenterLeft - oShapeAfterChange.Width / 2#
        .Top = CenterTop - oShapeAfterChange.Height / 2#
        .Apply
    End With

End Sub

</code>```

Body:
Need little help from this forum.

I want to replace shape(autoshape) with other autoshape in my project & found a solution here http://www.vbaexpress.com/forum/showthread.php?68760-Change-Fill-color-using-VBA-in-PowerPoint.

But in my project there are some shapes which contains text(I did not use textbox).

The code are select shape(which will be replaced) by some critaria
ie

by height 2. by weidth 3. fill colour 4. by top position.

As textbox is not a autoshape thats why I used shape which contains text & to give text backgroung transparent I used 'shape fill' to 'no fill'.

In my project there are shapes(not contains text) which are same size & same top position(ie the shape just behind the text shape).

Code is working fine for those shape which did not contains text.When I select the text shape & run the code  it replaced all the shape behind the text shape ie
not replace the text shape(which I want to replace).

I tried a lot but not getting the solution.I also tried with changeing the weidth of the shape behind the textshape but not get desire result.

Sir any solution will be highly appreaciate.

Option Explicit

Dim oShapeAfterChange As Shape, oShapeToChange As Shape
Dim tShapeAfterChange As MsoAutoShapeType, tShapeToChange As MsoAutoShapeType
Dim iShapeAfterChangeRGB As Long, iShapeAfterChangeHeight As Double, iShapeAfterChangeWidth As Double, iShapeAfterChangeTop As Double

Sub Step1()

    If MsgBox("This is Step 1 of a two step process" & vbCrLf & vbCrLf & _
        "1. You must already have inserted and selected a new Shape to change to" & vbCrLf & _
        "2. After running, Step1 will remember the new type of shape" & vbCrLf & _
        "3. Select one of the shapes to be changed" & vbCrLf & _
        "4. Run the Step2 Macro", vbOKCancel + vbInformation, "Change Shapes") = vbCancel Then
        Exit Sub
    End If
    Set oShapeAfterChange = Nothing
    On Error Resume Next
    Set oShapeAfterChange = ActiveWindow.Selection.ShapeRange(1)
    oShapeAfterChange.PickUp
    tShapeAfterChange = oShapeAfterChange.AutoShapeType
    On Error GoTo 0

    If oShapeAfterChange Is Nothing Then
        Call MsgBox("You must select an AutoShape", vbCritical + vbOKOnly, "Change Shapes")
        Exit Sub
    End If

    Call MsgBox("Destination Shape type memorized", vbOK + vbInformation, "Change Shapes")

End Sub

Sub Step2()
    Dim oPres As Presentation
    Dim oSlide As Slide
    Dim oShape As Shape, oShapeInGroup As Shape

    If MsgBox("This is Step 2 of a two step process" & vbCrLf & vbCrLf & _
        "1. You must already have selected an instance of a Shape to change" & vbCrLf & _
        "2. All instances on all slides of that type of Shape will be changed", vbOKCancel + vbInformation, "Change Shapes") = vbCancel Then
        Exit Sub
    End If
    If oShapeAfterChange Is Nothing Then
        Call MsgBox("1. You must select an example of a new Shape to change the shapes to" & vbCrLf & _
            "2. Re-run Step1", vbCritical + vbOKOnly, "Change Shapes")
        Exit Sub
    End If

    Set oShapeToChange = Nothing
    Set oShapeToChange = ActiveWindow.Selection.ShapeRange(1)

    If oShapeToChange.Type = msoGroup Then
        If ActiveWindow.Selection.HasChildShapeRange Then
            If ActiveWindow.Selection.ChildShapeRange.Count <> 1 Then
                Call MsgBox("You must select exactly one Shape within the Group of the type to be changed", vbCritical + vbOKOnly, "Change Shapes")
                Exit Sub
            Else
                Set oShapeToChange = ActiveWindow.Selection.ChildShapeRange(1)
            End If
        End If
    End If

    If oShapeToChange Is Nothing Then
        Call MsgBox("You must select a Shape of the type to be changed", vbCritical + vbOKOnly, "Change Shapes")
        Exit Sub
    End If

    With oShapeToChange
        tShapeToChange = .AutoShapeType
        iShapeAfterChangeRGB = .Fill.ForeColor.RGB
       iShapeAfterChangeHeight = Round(.Height, 0)
        iShapeAfterChangeWidth = Round(.Width, 0)
        iShapeAfterChangeTop = Round(.Top, 0)
    End With

    Set oPres = ActivePresentation

    For Each oSlide In oPres.Slides
        For Each oShape In oSlide.Shapes
            If oShape.Type = msoGroup Then
                For Each oShapeInGroup In oShape.GroupItems
                    Call pvtChangeAutoShapeType(oShapeInGroup)
                Next
            Else
                Call pvtChangeAutoShapeType(oShape)
            End If
        Next
    Next

    oShapeAfterChange.Delete
    MsgBox "Shapes updated successfully"
End Sub

Private Sub pvtChangeAutoShapeType(o As Shape)
    Dim CenterTop As Double, CenterLeft As Double

    With o
        If .Type <> msoAutoShape Then Exit Sub
        If .AutoShapeType <> tShapeToChange Then Exit Sub

        If .Fill.ForeColor.RGB <> iShapeAfterChangeRGB Then Exit Sub
        If Round(.Height, 0) <> iShapeAfterChangeHeight Then Exit Sub
        If Round(.Width, 0) <> iShapeAfterChangeWidth Then Exit Sub
        If Round(.Top, 0) <> iShapeAfterChangeTop Then Exit Sub

        .AutoShapeType = tShapeAfterChange

        CenterTop = .Top + .Height / 2#
        CenterLeft = .Left + .Width / 2#

        .Height = oShapeAfterChange.Height
        .Width = oShapeAfterChange.Width
        .Left = CenterLeft - oShapeAfterChange.Width / 2#
        .Top = CenterTop - oShapeAfterChange.Height / 2#
        .Apply
    End With

End Sub


问:
RISC-V Loop Termination
So I'm trying things out with assembly and I have a problem that involves counting set bits in a register. I have the code below but I can't seem to figure out how I'll stop this loop cause it goes on and on shifting the bits and ends up with an invalid count.</p>
```<code>addi x9, x0, 0xff00
addi x10, x0, 1 # adding counter for AND function
addi x11, x0, 0 # bit counter count
addi x12, x0, 0 # to compare 0

and x13, x9, x10
#bge x10, x9, func_c             # this somehow works with positive numbers only
bne x13, x12,func_a  # go to func_a if not equal to 0
beq x13, x12, func_b # else go to funcb_b

func_a:
addi x11, x11, 1     # add one to bit count
slli x10, x10, 1     # shift left
and x13, x9, x10     # new x13
bne x13, x12, func_a # not equal to 0
beq x13, x12, func_b

func_b:
slli x10, x10, 1 # shift left
and x13, x9, x10
#jal x0, -40 # go to line 7      # this jumped to the commented `bge` instruction above
jal x0, -36 # go to line 8

func_c:
add x20, x0, x11 # store final count
</code>```

Title: RISC-V Loop Termination

Body:
So I'm trying things out with assembly and I have a problem that involves counting set bits in a register. I have the code below but I can't seem to figure out how I'll stop this loop cause it goes on and on shifting the bits and ends up with an invalid count.

addi x9, x0, 0xff00
addi x10, x0, 1 # adding counter for AND function
addi x11, x0, 0 # bit counter count
addi x12, x0, 0 # to compare 0

and x13, x9, x10
#bge x10, x9, func_c             # this somehow works with positive numbers only
bne x13, x12,func_a  # go to func_a if not equal to 0
beq x13, x12, func_b # else go to funcb_b

func_a:
addi x11, x11, 1     # add one to bit count
slli x10, x10, 1     # shift left
and x13, x9, x10     # new x13
bne x13, x12, func_a # not equal to 0
beq x13, x12, func_b

func_b:
slli x10, x10, 1 # shift left
and x13, x9, x10
#jal x0, -40 # go to line 7      # this jumped to the commented `bge` instruction above
jal x0, -36 # go to line 8

func_c:
add x20, x0, x11 # store final count


问:
conda-build fails to recognise libraries
I am trying to build a package using conda-build. This is my first time trying to build a conda package, and I am having far more problems than I expected too.

Here is my build.sh

```<code>CMAKE_PLATFORM_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE="${RECIPE_DIR}/cross-linux.cmake")
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$PREFIX ${CMAKE_PLATFORM_FLAGS[@]} .
make
cp surveyor.py random_pos_generator.py $PREFIX/bin/
cp add_filtering_info call_insertions clip_consensus_builder dc_remapper filter normalise reads_categorizer $PREFIX/bin/

</code>```

And here is my meta.yaml:

```<code>{% set name = "insurveyor" %}
{% set version = "1.0.1" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://github.com/kensung-lab/INSurVeyor/archive/refs/tags/1.0.2.tar.gz
  sha256: 33c85157892d3256abc96bb2a9053f05da9dcf55befeed720e965577db0b78b5

build:
  skip: True # [not linux]
  number: 0

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - cmake >=3.5
    - autoconf ==2.69
  host:
    - libcurl
    - bzip2
    - xz
    - zlib
    - libdeflate
    - openssl
    - htslib >=1.13
  run:
    - python
    - numpy >=1.21.2

test:
  source_files:
    - demo/

about:
  home: https://github.com/kensung-lab/INSurVeyor
  summary: 'An insertion caller for Illumina paired-end WGS data.'
  description: XXX
  license: GPL-3.0-only
  license_file: LICENSE

extra:
  recipe-maintainers:
    - Mesh89
</code>```

And here is the output of the process:

https://justpaste.it/3gfzf

(stack overflow would think the log is spam)

There are plenty of worrying messages, for example:

```<code>Warning: rpath /home/user/anaconda3/conda-bld/insurveyor_1670384223059/_build_env/lib is outside prefix /home/user/anaconda3/conda-bld/insurveyor_1670384223059/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_ (removing it)
Unknown format
</code>```
```<code>WARNING :: Failed to get_static_lib_exports(/home/user/anaconda3/conda-bld/insurveyor_1670384223059/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/libssl.a)
Unknown format
</code>```

Binary doesn't have a program header

When I try to run any executable, I get

```<code>symbol lookup error: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined symbol: ffi_type_pointer, version LIBFFI_BASE_7.0
</code>```

I have spent a long time trying to figure out what is wrong and I am completely lost. When I google the warning/error messages, I cannot find any results.
I wonder if there is something fundamental that I misunderstand about the build process.
For example, why does conda complain about the rpath of the executables pointing to the build environment? Why those "Unknown format" warnings regarding the static libraries?

Body:
I am trying to build a package using conda-build. This is my first time trying to build a conda package, and I am having far more problems than I expected too.

Here is my build.sh

CMAKE_PLATFORM_FLAGS+=(-DCMAKE_TOOLCHAIN_FILE="${RECIPE_DIR}/cross-linux.cmake")
cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$PREFIX ${CMAKE_PLATFORM_FLAGS[@]} .
make
cp surveyor.py random_pos_generator.py $PREFIX/bin/
cp add_filtering_info call_insertions clip_consensus_builder dc_remapper filter normalise reads_categorizer $PREFIX/bin/

And here is my meta.yaml:

{% set name = "insurveyor" %}
{% set version = "1.0.1" %}

package:
  name: {{ name|lower }}
  version: {{ version }}

source:
  url: https://github.com/kensung-lab/INSurVeyor/archive/refs/tags/1.0.2.tar.gz
  sha256: 33c85157892d3256abc96bb2a9053f05da9dcf55befeed720e965577db0b78b5

build:
  skip: True # [not linux]
  number: 0

requirements:
  build:
    - {{ compiler('c') }}
    - {{ compiler('cxx') }}
    - cmake >=3.5
    - autoconf ==2.69
  host:
    - libcurl
    - bzip2
    - xz
    - zlib
    - libdeflate
    - openssl
    - htslib >=1.13
  run:
    - python
    - numpy >=1.21.2

test:
  source_files:
    - demo/

about:
  home: https://github.com/kensung-lab/INSurVeyor
  summary: 'An insertion caller for Illumina paired-end WGS data.'
  description: XXX
  license: GPL-3.0-only
  license_file: LICENSE

extra:
  recipe-maintainers:
    - Mesh89

And here is the output of the process:

https://justpaste.it/3gfzf

(stack overflow would think the log is spam)

There are plenty of worrying messages, for example:

Warning: rpath /home/user/anaconda3/conda-bld/insurveyor_1670384223059/_build_env/lib is outside prefix /home/user/anaconda3/conda-bld/insurveyor_1670384223059/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_ (removing it)
Unknown format

WARNING :: Failed to get_static_lib_exports(/home/user/anaconda3/conda-bld/insurveyor_1670384223059/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_/lib/libssl.a)
Unknown format

Binary doesn't have a program header

When I try to run any executable, I get

symbol lookup error: /lib/x86_64-linux-gnu/libp11-kit.so.0: undefined symbol: ffi_type_pointer, version LIBFFI_BASE_7.0

I have spent a long time trying to figure out what is wrong and I am completely lost. When I google the warning/error messages, I cannot find any results.
I wonder if there is something fundamental that I misunderstand about the build process.
For example, why does conda complain about the rpath of the executables pointing to the build environment? Why those "Unknown format" warnings regarding the static libraries?


问:
Using Python XLWT to set style to a range of cells (without merging or writing)
I want to add bold border around range of cells that includes table header and data (e.g. B2:G75) excluding borders between cells. I know that I can make a bunch of styles for each corner of the table and apply them while writing data (checking first/last row and first/last item in row), but I assume this is a bad practice. write_merge won't help me either since it will merge cells.

Below you can find an example of what I want.

Is there a way to apply style to a range of cells using xlwt without merging or writing? Or should I switch to a different Excel library?


问:
Using css, keep button visibility hidden until sibling input expanded or contains text
Got a search component in ReactJS I'm working on. Here's an example https://codepen.io/illusionfactory/pen/ZERwyxv

When the input field has focus, it expands and so does its parent container. The input has a sibling button.

With css (without JS), is it possible to only show the button when
a) the input field is expanded, or
b) input field has text? Otherwise the button is hidden?

Wondering if it can be done using css, without JS. I was attempting :focus-within on the container and :last-child but didn't have much luck.


问:
How does Facebook represent bold word
The bold letter of Facebook does not match with normal word

For example:-

Thailand smart city expo 2022 is different from      how can I match them.

This is what I try

```<code>str = '    '

x = str.find("Thailand Smart City")
</code>```

it returns -1

Title: How does Facebook represent bold word

Body:
The bold letter of Facebook does not match with normal word

For example:-

Thailand smart city expo 2022 is different from      how can I match them.

This is what I try

str = '    '

x = str.find("Thailand Smart City")

it returns -1


问:
Push data from DB update to client without polling
I built a live auction platform primarily in php/JQuery/JS/MySQL many years ago. It basically had a back end where i would poll the DB for any bids, if there was/were i would push the data to all users via PubNub mechanism. If there were no bids after 5 seconds, i would close that lot off and move onto the next one and update all users via the same PubNub mechanism.

I am now redesigning the platform to be fully automated. I am looking to implement web sockets as the connection method. I want to implement a trigger which fires when a new bid comes in then pushes the info to all users. I also want to create a stored procedure which automatically checks if news bids have come in in the last 5 seconds, if not, close the active lot and set new active lot to n+1. This would be wrapped in an event which fires every second. That seems pretty straight forward.

My question is, once the stored procedure has determined that its time to move onto a new lot OR a new bid has come in, how can i push that information to the user?

Most of the solutions out there seem to be 6-8 years old, and i was wondering if there is any way to do this without constantly polling from the users end, as this does not seem to be a scalable solution. Or does it?

I have looked at UDF/sys_exec() as a solution but a) a lot of people says its bad practise and its not designed to do that, and b) if i do execute a secondary .php script would there be a way to push the data to the user via the same websocket connection already established?

Thanks.


问:
Eclipse 2022-09: Maven Update Failed >>> org.eclipse.m2e.core.project
org.eclipse.m2e.core.project.configurator.ProjectConfigurationRequest.getProject()'

I'm having this issue and wasn't able to proceed on Updating Project.

I already checked on this post...
Eclipse 2022-09: Maven update failure

But somehow I already dont have the m2e-apt and still not working on my end.
Please see the attached image

This is a newly installed eclipse.

Thank you for help.


问:
eslint: no return assign
So I'm having a problem with a no return assign but my script seems good can someone help me with it?

The script is:

```<code>(function() {
    'use strict';
    let root = document.querySelector(":root");
    root.style.setProperty("--tv-color-pane-background", "#000");

    setTimeout(() => document.querySelector("html.theme-dark .tv-floating-toolbar").style.backgroundColor = "black", 1000);
})();
</code>```

on the settimeout line It's giving me this error:enter image description here

Title: eslint: no return assign

Body:
So I'm having a problem with a no return assign but my script seems good can someone help me with it?

The script is:

(function() {
    'use strict';
    let root = document.querySelector(":root");
    root.style.setProperty("--tv-color-pane-background", "#000");

    setTimeout(() => document.querySelector("html.theme-dark .tv-floating-toolbar").style.backgroundColor = "black", 1000);
})();

on the settimeout line It's giving me this error:enter image description here


问:
Running stateful commands in PowerShell through Node.js
Context: I have a javascript file that activates PowerShell's native SpeechSynthesizer module. The script receives a message and passes that through to PowerShell, where it is rendered as speech.

Problem: there is horrible latency (~5sec) between execution and response. This is because the script creates an entirely new PowerShell session and SpeechSynthesizer object with every execution.

Objective: I want to change the script so that a single PowerShell session and SpeechSynthesizer object is persisted and used across multiple sessions. I believe this will eradicate the latency completely.

Limiting Factor: this modification requires making the PowerShell execution stateful. Currently, I don't know how to incorporate stateful commands for the PowerShell in a javascript file.

Code:

```<code>const path = require('path');
const Max = require('max-api');
const { exec } = require('child_process');

// This will be printed directly to the Max console
Max.post(`Loaded the ${path.basename(__filename)} script`);

const execCommand = command => {
    // Max.post(`Running command: ${command}`);
    exec(command, {'shell':'powershell.exe'}, (err, stdout, stderr) => {
        if (err) {
        // node couldn't execute the command
          Max.error(stderr);
          Max.error(err);
          return;
        }
        // the *entire* stdout and stderr (buffered)
        Max.outletBang()
      });
}

// Use the 'outlet' function to send messages out of node.script's outlet
Max.addHandler("speak", (msg) => {
    let add = 'Add-Type -AssemblyName System.speech'
    let create = '\$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer'
    let speak = `\$speak.Speak(\'${msg}\')`

    let command = ([add,create,speak]).join('; ')

    execCommand(command)
});
</code>```

Objective, Re-stated: I want to move the add and create commands to a 'create' handler which will only be ran once. The speak command will be run an arbitrary amount of times afterward.

Attempted Solution: I've found one package (https://github.com/bitsofinfo/powershell-command-executor) that supposedly supports stateful PowerShell commands, but it's very complicated. Also, the author mentions a risk of command injection and other insecurities, of which I have no knowledge of.

Any and all suggestions are welcome. Thanks!

Body:
Context: I have a javascript file that activates PowerShell's native SpeechSynthesizer module. The script receives a message and passes that through to PowerShell, where it is rendered as speech.

Problem: there is horrible latency (~5sec) between execution and response. This is because the script creates an entirely new PowerShell session and SpeechSynthesizer object with every execution.

Objective: I want to change the script so that a single PowerShell session and SpeechSynthesizer object is persisted and used across multiple sessions. I believe this will eradicate the latency completely.

Limiting Factor: this modification requires making the PowerShell execution stateful. Currently, I don't know how to incorporate stateful commands for the PowerShell in a javascript file.

Code:

const path = require('path');
const Max = require('max-api');
const { exec } = require('child_process');

// This will be printed directly to the Max console
Max.post(`Loaded the ${path.basename(__filename)} script`);

const execCommand = command => {
    // Max.post(`Running command: ${command}`);
    exec(command, {'shell':'powershell.exe'}, (err, stdout, stderr) => {
        if (err) {
        // node couldn't execute the command
          Max.error(stderr);
          Max.error(err);
          return;
        }
        // the *entire* stdout and stderr (buffered)
        Max.outletBang()
      });
}

// Use the 'outlet' function to send messages out of node.script's outlet
Max.addHandler("speak", (msg) => {
    let add = 'Add-Type -AssemblyName System.speech'
    let create = '\$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer'
    let speak = `\$speak.Speak(\'${msg}\')`

    let command = ([add,create,speak]).join('; ')

    execCommand(command)
});

Objective, Re-stated: I want to move the add and create commands to a 'create' handler which will only be ran once. The speak command will be run an arbitrary amount of times afterward.

Attempted Solution: I've found one package (https://github.com/bitsofinfo/powershell-command-executor) that supposedly supports stateful PowerShell commands, but it's very complicated. Also, the author mentions a risk of command injection and other insecurities, of which I have no knowledge of.

Any and all suggestions are welcome. Thanks!


问:
how to run job after build project in eclipse RCP?
I need to run a job/workspaceJob after building project. I already have a code but it is not consistent. I need to finish the building because I need the updated file in my process.Here's my code:`

```<code> private void doSomething(final ModelResource selected) throws Exception{
    WorkspaceJob doSomethingJob= new WorkspaceJob("doSomething") {
      @Override
      public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
        buildProject();
        return Status.OK_STATUS;
      }
    };
    doSomethingJob.addJobChangeListener(new JobChangeAdapter() {
      @Override
      public void done(IJobChangeEvent event) {
        Display.getDefault().asyncExec(new Runnable() {
          @Override
          public void run() {
            doThis();
          }
        });
      }
    });
    doSomethingJob.schedule();
  }
</code>```

`

I did the code above but no luck. I am expecting doThis() to execute after the job is done but it building always comes last.

Body:
I need to run a job/workspaceJob after building project. I already have a code but it is not consistent. I need to finish the building because I need the updated file in my process.Here's my code:`

 private void doSomething(final ModelResource selected) throws Exception{
    WorkspaceJob doSomethingJob= new WorkspaceJob("doSomething") {
      @Override
      public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
        buildProject();
        return Status.OK_STATUS;
      }
    };
    doSomethingJob.addJobChangeListener(new JobChangeAdapter() {
      @Override
      public void done(IJobChangeEvent event) {
        Display.getDefault().asyncExec(new Runnable() {
          @Override
          public void run() {
            doThis();
          }
        });
      }
    });
    doSomethingJob.schedule();
  }

`

I did the code above but no luck. I am expecting doThis() to execute after the job is done but it building always comes last.


问:
Swift TvOS: Overriding pressesBegan disables didSelectItemAt?
I was previously able to use the method didSelectItemAt for a collectionView, but ever since implementing a function override for pressesBegan in its corresponding cells, didSelectItemAt no longer seems to be getting invoked.

```<code>func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    // This used to work before overriding pressesBegan()...
}
</code>```

The pressesBegan override in the corresponding cell:

```<code>override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
    super.pressesEnded(presses, with: event)
}
</code>```

Are there adjustments I need to make so didSelectItemAt continues to work? Thanks.

Body:
I was previously able to use the method didSelectItemAt for a collectionView, but ever since implementing a function override for pressesBegan in its corresponding cells, didSelectItemAt no longer seems to be getting invoked.

func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
    // This used to work before overriding pressesBegan()...
}

The pressesBegan override in the corresponding cell:

override func pressesBegan(_ presses: Set<UIPress>, with event: UIPressesEvent?) {
    super.pressesEnded(presses, with: event)
}

Are there adjustments I need to make so didSelectItemAt continues to work? Thanks.


问:
libgit2sharp : Clone does not work with Latest Nuget version
I am trying to clone a repository which is available in BitBucket. Providing correct proxy settings in my git.config file, Clone works only with a specific version of LibGit2Sharp(0.22.0).
With all other latest versions it fails with exception => "failed to send request: The server name or address could not be resolved"

We want to use the latest available version of LibGit2Sharp always. Currently stuck with only version 0.22.0.

Does latest version of LibGit2Sharp does not support Proxy authentication? How latest version of LibGit2Sharp could be used ?


问:
network image showing in flutter web but not showing in mobile flutter
When i run flutter in web with command

flutter run -d chrome --web-renderer html --no-sound-null-safety

Network Image show in flutter web but when i run in mobile it not show 3

Error :

```<code>======== Exception caught by image resource service ================================================
The following NetworkImageLoadException was thrown resolving an image codec:
HTTP request failed, statusCode: 403, https://shop.znindia.com/public/uploads/all/a4llgBQ6ExlDcp94FeFFhkJyFEqQsCyi88EDAl5D9CEvBt4nPa.jpg

When the exception was thrown, this was the stack:
#0      NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:117:9)
<asynchronous suspension>
Image provider: NetworkImage("https://shop.znindia.com/public/uploads/all/a4llgBQ6ExlDcp94FeFFhkJyFEqQsCyi88EDAl5D9CEvBt4nPa.jpg", scale: 1.0)
Image key: NetworkImage("https://shop.znindia.com/public/uploads/all/a4llgBQ6ExlDcp94FeFFhkJyFEqQsCyi88EDAl5D9CEvBt4nPa.jpg", scale: 1.0)
====================================================================================================
</code>```

When i open the image url in the browser image shows perfectly.
My image show code is

```<code>SizedBox(
  height: MediaQuery.of(context).size.height * 0.1,
  width: MediaQuery.of(context).size.height * 0.1,
  child: FadeInImage(
    placeholder: const AssetImage("assets/logo.png"),
    image: NetworkImage(
      productImage,
    ),
  ),
),
</code>```

My manifest code

```<code><manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.znindia.stock">

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
</code>```

Calling in list view

```<code>return ProductWidget(
  context,
  productId: products[index][0],
  productImage: products[index][8],
  productName: products[index][1],
  onDeleteOptionClick: () {
    deleteProduct(
      id: products[index][0],
      name: products[index][1],
      categoryId: products[index][2],
      brandId: products[index][3],
      qty: products[index][4],
      purchasePrice: products[index][5],
      salePrice: products[index][6],
      hsnCode: products[index][7],
      image: products[index][8],
      tax: products[index][9],
    );
  },
);
</code>```

and ProductWidget is

```<code>ProductWidget(context,
    {required int productId,
    required String productImage,
    required String productName,
    required VoidCallback onDeleteOptionClick}) {
  return buildCustomButtonCard(
    Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        SizedBox(
          width: MediaQuery.of(context).size.width * 0.20,
          child: (productImage == "")
              ? Container()
              : SizedBox(
                  height: MediaQuery.of(context).size.height * 0.1,
                  width: MediaQuery.of(context).size.height * 0.1,
                  child: Image.network(
                    productImage,
                  ),
                ),
</code>```

Body:
When i run flutter in web with command

flutter run -d chrome --web-renderer html --no-sound-null-safety

Network Image show in flutter web but when i run in mobile it not show 3

Error :

======== Exception caught by image resource service ================================================
The following NetworkImageLoadException was thrown resolving an image codec:
HTTP request failed, statusCode: 403, https://shop.znindia.com/public/uploads/all/a4llgBQ6ExlDcp94FeFFhkJyFEqQsCyi88EDAl5D9CEvBt4nPa.jpg

When the exception was thrown, this was the stack:
#0      NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:117:9)
<asynchronous suspension>
Image provider: NetworkImage("https://shop.znindia.com/public/uploads/all/a4llgBQ6ExlDcp94FeFFhkJyFEqQsCyi88EDAl5D9CEvBt4nPa.jpg", scale: 1.0)
Image key: NetworkImage("https://shop.znindia.com/public/uploads/all/a4llgBQ6ExlDcp94FeFFhkJyFEqQsCyi88EDAl5D9CEvBt4nPa.jpg", scale: 1.0)
====================================================================================================

When i open the image url in the browser image shows perfectly.
My image show code is

SizedBox(
  height: MediaQuery.of(context).size.height * 0.1,
  width: MediaQuery.of(context).size.height * 0.1,
  child: FadeInImage(
    placeholder: const AssetImage("assets/logo.png"),
    image: NetworkImage(
      productImage,
    ),
  ),
),

My manifest code

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:tools="http://schemas.android.com/tools"
    package="com.znindia.stock">

    <uses-permission android:name="android.permission.CAMERA" />
    <uses-permission android:name="android.permission.INTERNET" />
    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
    <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

Calling in list view

return ProductWidget(
  context,
  productId: products[index][0],
  productImage: products[index][8],
  productName: products[index][1],
  onDeleteOptionClick: () {
    deleteProduct(
      id: products[index][0],
      name: products[index][1],
      categoryId: products[index][2],
      brandId: products[index][3],
      qty: products[index][4],
      purchasePrice: products[index][5],
      salePrice: products[index][6],
      hsnCode: products[index][7],
      image: products[index][8],
      tax: products[index][9],
    );
  },
);

and ProductWidget is

ProductWidget(context,
    {required int productId,
    required String productImage,
    required String productName,
    required VoidCallback onDeleteOptionClick}) {
  return buildCustomButtonCard(
    Row(
      mainAxisAlignment: MainAxisAlignment.spaceBetween,
      children: [
        SizedBox(
          width: MediaQuery.of(context).size.width * 0.20,
          child: (productImage == "")
              ? Container()
              : SizedBox(
                  height: MediaQuery.of(context).size.height * 0.1,
                  width: MediaQuery.of(context).size.height * 0.1,
                  child: Image.network(
                    productImage,
                  ),
                ),


问:
Custom Web Elements / Lit Elements - Render child elements only when a parent element is present and way to transfer data among all child elements?
New to Stack Overflow and Lit.

I'm building something using Lit and wanted to know how do I render element/s only if a parent element is present. I am trying to add a login element dependency which will let user to use these elements only if the login element is present.

Example of what should be allowed.

```<code><login-element>
    <child-element-button> </child-element-button>
</login-element>
</code>```

Example of what should not be allowed.
<child-element-button> </child-element-button>

Another problem that I have is a way for the child elements to share data, it can be to and from sibling elements, children elements, grandchildren element and so on. I do not have a solution for data sharing currently and would like to know the possible ways to achieve this.

Is there a way to achieve all of this without making <login-element> the parent element? something like this?

```<code><login-element> </login-element>
<div> ... </div>
<my-custom-button> </my-custom-button>
<p> ... </p>
<my-colors> </my-colors>
<my-custom-footer> </my-custom-footer>
</code>```

In short, I need users to be able to use custom elements only if <login-element> if present anywhere in the document and the custom elements that are present should be able to communicate between each other. For instance, a <my-colors> element should be able to send active color data to <display-image> element which will render an image with a specific background color received from `.

Currently, I read the child elements of <login-element>, copy the nodes, run loop, delete original nodes and append with those copied nodes. Additionally, in every child elements, I check if <login-element> is present in DOM or not, if present, render, else render a error element. As for passing and receiving data to and from other components, I have not tried anything.

Than you for your time.

Body:
New to Stack Overflow and Lit.

I'm building something using Lit and wanted to know how do I render element/s only if a parent element is present. I am trying to add a login element dependency which will let user to use these elements only if the login element is present.

Example of what should be allowed.

<login-element>
    <child-element-button> </child-element-button>
</login-element>

Example of what should not be allowed.
<child-element-button> </child-element-button>

Another problem that I have is a way for the child elements to share data, it can be to and from sibling elements, children elements, grandchildren element and so on. I do not have a solution for data sharing currently and would like to know the possible ways to achieve this.

Is there a way to achieve all of this without making <login-element> the parent element? something like this?

<login-element> </login-element>

 ...

<my-custom-button> </my-custom-button>

 ...

<my-colors> </my-colors>
<my-custom-footer> </my-custom-footer>

In short, I need users to be able to use custom elements only if <login-element> if present anywhere in the document and the custom elements that are present should be able to communicate between each other. For instance, a <my-colors> element should be able to send active color data to <display-image> element which will render an image with a specific background color received from `.

Currently, I read the child elements of <login-element>, copy the nodes, run loop, delete original nodes and append with those copied nodes. Additionally, in every child elements, I check if <login-element> is present in DOM or not, if present, render, else render a error element. As for passing and receiving data to and from other components, I have not tried anything.

Than you for your time.


问:
Monitor system logins and queries history in the database
I am authorized to access 1 database X on 1 server A with full rights on this database (same as administrator of database X). I want to monitor the history of all access and queries on database X (only database X, not server). I have tried to find ways but all are access and query management on the server. I don't have admin rights on the server so I can't do this. Is there any possible solution for this? Please share if any!
Many thanks!</p>


问:
How can I select all the text I typed in vsc integrated terminal
How can I select all the text I typed in vsc integrated terminal? This https://code.visualstudio.com/docs/terminal/basics#_select-all selects the entire terminal text instead of just text that I typed

i.e.


问:
Axios get unexpected data in Nextjs
I used getStaticProps like bellow to get a list of post in mockapi:

```<code>export const getStaticProps = async() => {
     const res = await
     axios.get("https://62135a53f43692c9c6015aed.mockapi.io/post")
     console.log(res.data);

  return {
    props: {
      posts: res.data
    }
  }
}
</code>```

But I get

```<code>    x���[o‼I►������&1Y`y�l@��6K�i�C��<.��%}��E�wN��☻3c      �_�Ȟ���:�U��o3��↨����61��↨↨����-���▼��Wח↨�o.g/fΆ���◄��-?&�E$����$����?ı�O�ؓ�՝�����(�l�
�!�������s�5E◄8
va�zK��57��c�����Z>�&��R���$��M.��☼)♀�����V▼�Mnx�����'�_[�6��Px�!zF�?R~☼�;Ӱ������*9�↓↨&�g↓�↨}V♠Aܓa��↕�$�'��e���} ⌂�▼H�bK�h��l�▲X��▲��D�Y‼�Z���H‼��J|�↑�▼☺��)����E��?�aM����9��������!�,T�↓�.W☺�84�-5R=#♫�]►c'�)���cM'��►�\KE~h��3R�*↨��W��3��a��`��Ώ"#@�♂��(�r ♫�԰^��Z'��H����◄↑�V���Q♦;]�↕�↓�a♥�ƺ��♂ ��>&↕�7�
m[
</code>```

I can use fetch to resolve this issue but can anyone tell me why I get this problem?

Title: Axios get unexpected data in Nextjs

Body:
I used getStaticProps like bellow to get a list of post in mockapi:

export const getStaticProps = async() => {
     const res = await
     axios.get("https://62135a53f43692c9c6015aed.mockapi.io/post")
     console.log(res.data);

  return {
    props: {
      posts: res.data
    }
  }
}

But I get

    x���[o‼I►������&1Y`y�l@��6K�i�C��<.��%}��E�wN��☻3c      �_�Ȟ���:�U��o3��↨����61��↨↨����-���▼��Wח↨�o.g/fΆ���◄��-?&�E$����$����?ı�O�ؓ�՝�����(�l�
�!�������s�5E◄8
va�zK��57��c�����Z>�&��R���$��M.��☼)♀�����V▼�Mnx�����'�_[�6��Px�!zF�?R~☼�;Ӱ������*9�↓↨&�g↓�↨}V♠Aܓa��↕�$�'��e���} ⌂�▼H�bK�h��l�▲X��▲��D�Y‼�Z���H‼��J|�↑�▼☺��)����E��?�aM����9��������!�,T�↓�.W☺�84�-5R=#♫�]►c'�)���cM'��►�\KE~h��3R�*↨��W��3��a��`��Ώ"#@�♂��(�r ♫�԰^��Z'��H����◄↑�V���Q♦;]�↕�↓�a♥�ƺ��♂ ��>&↕�7�
m[

I can use fetch to resolve this issue but can anyone tell me why I get this problem?


问:
Ant mail task worked in Java 11, failed in Java 17 with "JSSE not in classpath" error?
I'm using Apache Ant 1.10.12, and I have a problem with this mail task:

```<code><mail mailhost="${email.host}" mailport="${email.port}" ssl="${email.ssl}" user="${email.smtp.user}" password="${email.smtp.password}"
          replyto="${email.from}" from="${email.from}" tolist="${email.to}" cclist="${email.cc}"
          subject="The ${build.version} build has completed">
</code>```

This task works when I am using Java 11, but fails when I switch to Java 17. The error I get is this:

```<code>Failed to send email: could not instantiate ssl security provider, check that you have JSSE in your classpath
</code>```

Java 11 debug output: https://controlc.com/7f283040

Java 17 debug output: https://controlc.com/6476775d

Body:
I'm using Apache Ant 1.10.12, and I have a problem with this mail task:

<mail mailhost="${email.host}" mailport="${email.port}" ssl="${email.ssl}" user="${email.smtp.user}" password="${email.smtp.password}"
          replyto="${email.from}" from="${email.from}" tolist="${email.to}" cclist="${email.cc}"
          subject="The ${build.version} build has completed">

This task works when I am using Java 11, but fails when I switch to Java 17. The error I get is this:

Failed to send email: could not instantiate ssl security provider, check that you have JSSE in your classpath

Java 11 debug output: https://controlc.com/7f283040

Java 17 debug output: https://controlc.com/6476775d


问:
Can I create a commercial app using telegram API?
First question: Can I create a different type of commercial app using telegram API?

For example, can I create a dating app based on Telegram API using groups as chat rooms for my users?

Second question: Do I have to publish my code to GitHub?

I see bunch of unofficial Telegram apps on Play Store and I can't find their code on Github. But it is mentioned that 'Unofficial Telegram apps that is based on Telegram API must publish their code to Github to meet the license requirements' in Telegram license.


问:
How to install python plawright dependencies in custom location on linux
I am trying to run a script using Firefox playwright on a Linux server, and I am unable to install the dependencies for it to the usual /lib64 path. Is there a way I can install them locally, like I was able to do with the main playwright package itself?

I have tried to install glibc locally, but didn't get far enough to test it as the configure script complained about an outdated install of gcc and make. I am not able to update these on the root level, so I would probably have to install custom versions of these too and change a lot of path variables.


问:
Jenkinsfile clear gradle cache and retry on failure
Current scenario: We have configured CI pipeline and running a jenkinsfile.groovy script for a gradle build. The pipeline is working fine and now we are planning to enable an error handling functionality into the groovy script.

Reason of this functionality: Sometimes, the gradle build is unable to download all the dependencies due to the network glitch or could be any reason. So, as a part of this functionality, we wants to add the following steps in the existing pipeline:

throw an error message of the failure

clear the cache from the gradle home directory

rebuild failed jenkins job

stop the existing failed build

Following code is included in the pipeline to enable the functionality:

```<code>catch (err) {

    echo "Build failed for ${env.JOB_NAME}, clearing cache from the $GRADLE_HOME and retrying"
    sh "rm -rf $GRADLE_HOME"
    build "${env.JOB_NAME}"
    throw err
}

</code>```

Testing of new functionality: We are now in testing phase of the above code which is working fine, and three steps of the functionality is achieved, however, throw err (last step) doesn't stop the existing failed build after triggering same build again and keeps waiting for the build to complete.

Success of the new functionality in the existing pipeline:

throw an error message of the failure : ACHIEVED

clear the cache from the gradle home directory : ACHIEVED

rebuild failed jenkins job : ACHIEVED

stop the existing failed build : NOT ACHIEVED
 this fourth and the last step is not working as expected and doesn't stop the failed build. The failed build keeps waiting for the next job to complete. We have tried adding exit 1 as well but no luck.

Any help would be really appreciable. TIA

Body:
Current scenario: We have configured CI pipeline and running a jenkinsfile.groovy script for a gradle build. The pipeline is working fine and now we are planning to enable an error handling functionality into the groovy script.

Reason of this functionality: Sometimes, the gradle build is unable to download all the dependencies due to the network glitch or could be any reason. So, as a part of this functionality, we wants to add the following steps in the existing pipeline:

throw an error message of the failure

clear the cache from the gradle home directory

rebuild failed jenkins job

stop the existing failed build

Following code is included in the pipeline to enable the functionality:

catch (err) {

    echo "Build failed for ${env.JOB_NAME}, clearing cache from the $GRADLE_HOME and retrying"
    sh "rm -rf $GRADLE_HOME"
    build "${env.JOB_NAME}"
    throw err
}

Testing of new functionality: We are now in testing phase of the above code which is working fine, and three steps of the functionality is achieved, however, throw err (last step) doesn't stop the existing failed build after triggering same build again and keeps waiting for the build to complete.

Success of the new functionality in the existing pipeline:

throw an error message of the failure : ACHIEVED

clear the cache from the gradle home directory : ACHIEVED

rebuild failed jenkins job : ACHIEVED

stop the existing failed build : NOT ACHIEVED
 this fourth and the last step is not working as expected and doesn't stop the failed build. The failed build keeps waiting for the next job to complete. We have tried adding exit 1 as well but no luck.

Any help would be really appreciable. TIA