问:
How to update a component according to the state?
I need to display a list of objects in my Explorer component.

In my app I use useReducer hook what wrapped by Context.

It works well when the data flow is in "input-mode" (when I update data in state). But it does not rerender the application after data was changed.

So, steps that I need to pass and get a positive result.

Press btn with file icon (or folder icon). This btn call hook that take a look into state and make a decision: where this file or folder should be placed in my simple fs.

Write file/folder name (this function doesn't exist yet).

Apply name by press enter or click mouse out of input (the same as 2 step).

Currently, I try to create file/folder with hardcoded name for testing 1-step. And I expect that dispatch function pass data to the state and it would be updated and rerendered. All process runs well except of rerender.

I explain the flow of 1-st step.

After I click btn, I call the func from hook for forming my instance.

Then, the new instance saving into local useState.

After local useState successfully was updated, I call dispatch in useEffect hook.

In reducer I modify my state and return it.

After this steps I expect that my app will automatically rerendered, but it isn't.

Code snippets, step by step.

First step.

  const handleFileClick = () => {
    formAnInstance('file');
    console.log('file btn click')
  };
```
<ol start="2">
<li>Second step.</li>
</ol>
<pre class="lang-js prettyprint-override"><code>// in useInstancesInteraction hook
const { state, dispatch } = useStateContext();
  const [instance, setInstance] = useState<IInstance>();

  const formAnInstance = (mode: Omit<Mode, 'root'>) => {
    if (
      typeof state?.currentFolder === 'undefined' ||
      state?.currentFolder === null
    ) {
      const target =
        mode === 'folder'
          ? (createInstance('folder', 'folder') as IInstance)
          : (createInstance('file', 'file') as IInstance);

      target['..'] = '/';
      setInstance(target);
    }

  };
</code>```

Third step.

// in useInstancesInteraction hook
useEffect(() => {
    const updateData = () => {
      if (dispatch && instance) {
        dispatch(createRootInstance(instance));
      }
    };

    updateData();
  }, [instance]);
```
<ol start="4">
<li>Fourth step.</li>
</ol>
<pre class="lang-js prettyprint-override"><code>export const initialState = {
  root: createInstance('/', 'root') as IInstance,
  currentFolder: null,
};

const reducer = (state = initialState, action: IAction) => {
  const { type, payload } = action;

  switch (type) {
    case ACTION_TYPES.CREATE_ROOT_INSTANCE:
      const myKey = payload['.'];
      Object.assign(state.root, { [myKey]: payload });
      console.log('Reducer', state?.root);

      return state;
    case ACTION_TYPES.CREATE_FILE:
      break;
    case ACTION_TYPES.UPLOAD_FILE:
      break;
    case ACTION_TYPES.RENAME_FILE:
      break;
    case ACTION_TYPES.DELETE_FILE:
      break;
    case ACTION_TYPES.CREATE_FOLDER:
      break;
    case ACTION_TYPES.RENAME_FOLDER:
      break;
    case ACTION_TYPES.DELETE_FOLDER:
      break;
    default:
      return state;
  }
};
</code>```

Here how my context file look like:

import React, { useContext, useReducer } from 'react';
import { IContext } from './index.types';
import reducer, { initialState } from './reducer';

const StateContext = React.createContext<IContext>({
  state: undefined,
  dispatch: null,
});

const StateProvider = ({
  children,
}: {
  children: JSX.Element | JSX.Element[];
}) => {
  const [state, dispatch] = useReducer(reducer, initialState);
  return (
    <StateContext.Provider value={{ state, dispatch }}>
      {children}
    </StateContext.Provider>
  );
};

export default StateProvider;

export const useStateContext = () => useContext(StateContext);
```

Body:
I need to display a list of objects in my Explorer component.

In my app I use useReducer hook what wrapped by Context.

It works well when the data flow is in "input-mode" (when I update data in state). But it does not rerender the application after data was changed.

So, steps that I need to pass and get a positive result.

Press btn with file icon (or folder icon). This btn call hook that take a look into state and make a decision: where this file or folder should be placed in my simple fs.

Write file/folder name (this function doesn't exist yet).

Apply name by press enter or click mouse out of input (the same as 2 step).

Currently, I try to create file/folder with hardcoded name for testing 1-step. And I expect that dispatch function pass data to the state and it would be updated and rerendered. All process runs well except of rerender.

I explain the flow of 1-st step.

After I click btn, I call the func from hook for forming my instance.

Then, the new instance saving into local useState.

After local useState successfully was updated, I call dispatch in useEffect hook.

In reducer I modify my state and return it.

After this steps I expect that my app will automatically rerendered, but it isn't.

Code snippets, step by step.

First step.

  const handleFileClick = () => {
    formAnInstance('file');
    console.log('file btn click')
  };

Second step.

// in useInstancesInteraction hook
const { state, dispatch } = useStateContext();
  const [instance, setInstance] = useState<IInstance>();

  const formAnInstance = (mode: Omit<Mode, 'root'>) => {
    if (
      typeof state?.currentFolder === 'undefined' ||
      state?.currentFolder === null
    ) {
      const target =
        mode === 'folder'
          ? (createInstance('folder', 'folder') as IInstance)
          : (createInstance('file', 'file') as IInstance);

      target['..'] = '/';
      setInstance(target);
    }

  };

Third step.

// in useInstancesInteraction hook
useEffect(() => {
    const updateData = () => {
      if (dispatch && instance) {
        dispatch(createRootInstance(instance));
      }
    };

    updateData();
  }, [instance]);

Fourth step.

export const initialState = {
  root: createInstance('/', 'root') as IInstance,
  currentFolder: null,
};

const reducer = (state = initialState, action: IAction) => {
  const { type, payload } = action;

  switch (type) {
    case ACTION_TYPES.CREATE_ROOT_INSTANCE:
      const myKey = payload['.'];
      Object.assign(state.root, { [myKey]: payload });
      console.log('Reducer', state?.root);

      return state;
    case ACTION_TYPES.CREATE_FILE:
      break;
    case ACTION_TYPES.UPLOAD_FILE:
      break;
    case ACTION_TYPES.RENAME_FILE:
      break;
    case ACTION_TYPES.DELETE_FILE:
      break;
    case ACTION_TYPES.CREATE_FOLDER:
      break;
    case ACTION_TYPES.RENAME_FOLDER:
      break;
    case ACTION_TYPES.DELETE_FOLDER:
      break;
    default:
      return state;
  }
};

Here how my context file look like:

import React, { useContext, useReducer } from 'react';
import { IContext } from './index.types';
import reducer, { initialState } from './reducer';

const StateContext = React.createContext<IContext>({
  state: undefined,
  dispatch: null,
});

const StateProvider = ({
  children,
}: {
  children: JSX.Element | JSX.Element[];
}) => {
  const [state, dispatch] = useReducer(reducer, initialState);
  return (
    <StateContext.Provider value={{ state, dispatch }}>
      {children}
    </StateContext.Provider>
  );
};

export default StateProvider;

export const useStateContext = () => useContext(StateContext);


来源: stackexchange

问:
How to add "free" user input to bash auto complete script?
I wrote a CLI using bash script to enable the user the option of using TAB to auto complete commands.
My issue is that I want to incorporate the use of flags with free input from the user, i.e.: the user may choose a command from a given list of commands using TAB,

```<code>run_my_prog
</code>```

then add a flag which the user may choose from a given list of flags,

```<code>run_my_prog --ip
</code>```

then enter free input,

```<code>run_my_prog --ip 10.10.0.8
</code>```

and then use Tab to choose the next flag for the same command,

```<code>run_my_prog --ip 10.10.0.8 --port 443
</code>```

I can't seem to under stand how to add the second flag after the user has entered an input not from the list of commands, in this example after he entered the ip, I can't add the "--port" flag.

here is basically what I did so far:

```<code>_cli_auto_complete(){

local cur prev
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}

case ${COMP_CWORD} in
    1)
        COMPREPLY=($(compgen -W "run_my_prog" -- ${cur}))
        ;;
    2)
        case ${prev} in # then comes the flag/flags
            run_my_prog)
                COMPREPLY=($(compgen -W "--ip" -- ${cur}))
                ;;
        esac
        ;;
    3)
        case ${prev} in
            --ip)
                COMPREPLY=($(compgen -W "--port" -- ${cur}))
                ;;
        esac
        ;;
}
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I wrote a CLI using bash script to enable the user the option of using TAB to auto complete commands.
My issue is that I want to incorporate the use of flags with free input from the user, i.e.: the user may choose a command from a given list of commands using TAB,

run_my_prog

then add a flag which the user may choose from a given list of flags,

run_my_prog --ip

then enter free input,

run_my_prog --ip 10.10.0.8

and then use Tab to choose the next flag for the same command,

run_my_prog --ip 10.10.0.8 --port 443

I can't seem to under stand how to add the second flag after the user has entered an input not from the list of commands, in this example after he entered the ip, I can't add the "--port" flag.

here is basically what I did so far:

_cli_auto_complete(){

local cur prev
cur=${COMP_WORDS[COMP_CWORD]}
prev=${COMP_WORDS[COMP_CWORD-1]}

case ${COMP_CWORD} in
    1)
        COMPREPLY=($(compgen -W "run_my_prog" -- ${cur}))
        ;;
    2)
        case ${prev} in # then comes the flag/flags
            run_my_prog)
                COMPREPLY=($(compgen -W "--ip" -- ${cur}))
                ;;
        esac
        ;;
    3)
        case ${prev} in
            --ip)
                COMPREPLY=($(compgen -W "--port" -- ${cur}))
                ;;
        esac
        ;;
}


问:
Reduce the number of parameters in ML model
I want to train the AWS xgBoost model for classification into two categories based on my dataset which contains 1000 Emails and the value to predict. Ex data -

abc@gmail -- high

123@yahoo -- low

xyz@gmail -- low

jkl@yahoo -- high

For training the model on 1000 rows of such data, as xgboost only expects numerical data, I had to use pd.getDummies() which converts this into 1000 columns by 1000 rows of data. Converts the result column into two - isHigh, isLow with values 0 and 1.

Now when I want predictions from my model, it expects an input of 1000 parameters for the REST API(which I created for predictions), ideally, I would like to provide an email as the parameter and get a result of high/low or isHigh value between 0 and 1.

Is the choice of Algorithm wrong?
Is there any other way so that when I ask the model to provide predictions it does not want 100 parameters?


问:
onAuthStateChanged() to restrict access using Firebase via JavaScript for Web Host?
I am trying to use onAuthStateChanged() to alert the user if they are logged into the database. I have setup realtime database and have created several accounts that can be successfully logged into. However, after log in I want the user to be able to view the content on the site if they are logged in and not view the content and redirect them to the login.htmlpage.

Therefore, the two test files I have are login.html and test4.html

login.html

```<code><html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
    <title>Login page</title>
    <link rel="stylesheet" href="cssFile.css">
  </head>
  <body>
    <div id="login-box">
      <div class="left" style="top: -26px; left: 134px; width: 329px; height: 800px;">
        <h1 id="status" style="text-align: center;"><span style="font-family: Sitka Text;"><b>Login</b></span></h1>

        <input id="email" name="email" placeholder="E-mail" type="text">
        <input id="password" name="password" placeholder="Password" type="password">
        <input id="signUp" name="signup_submit" value="Login" type="submit">
    </div>
    <script type="module">
  // Import the functions you need from the SDKs you need
  import { initializeApp } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-app.js";
  import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-analytics.js";
  import { getDatabase, set, ref, update } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-database.js";
  import { getAuth, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, signInWithEmailAndPassword, signOut, onAuthStateChanged } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-auth.js";
  const firebaseConfig = {
    apiKey: "",
    authDomain: "",
    projectId: "",
    storageBucket: "",
    messagingSenderId: "",
    appId: ""
  };
  const app = initializeApp(firebaseConfig);
  const database = getDatabase(app);
  const analytics = getAnalytics(app);
  const auth = getAuth();
  var x = 0;
  var y = 1;
  signUp.addEventListener('click', (e) => {
    var email = document.getElementById('email').value;
    var password = document.getElementById('password').value;
    signInWithEmailAndPassword(auth, email, password)
      .then((userCredential) => {
        // Signed in
        const user = userCredential.user;
                  var lgDate = new Date();
                  update(ref(database, 'users/' + user.uid), {
                    last_login: lgDate,
                  }).then(() => {
                      // Data saved successfully!
                      alert('Login successfully!');
                      window.location.href = "test4.html";
                    })
                    .catch((error) => {
                      // The write failed...
                      alert(error, 'Error account login failed! Please contact support!!');
                    });
                  }).catch((error) => {
                    const errorCode = error.code;
                    const errorMessage = error.message;
                    alert(errorMessage);
                  });
  });

</script>
  </body>
</html>
</code>```

test4.html

```<code>
<!DOCTYPE html>
<html>
  <head>
    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title></title>
  </head>
  <body>
    <p style="text-align: center;">Test Dummy Page!</p>
    <p id="hide">Hide me.</p>
    <script>
          import { initializeApp } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-app.js";
          import { getAnalytics } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-analytics.js";
          import { getDatabase, set, ref, update } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-database.js";
          import { getAuth, createUserWithEmailAndPassword, fetchSignInMethodsForEmail, signInWithEmailAndPassword, signOut, onAuthStateChanged } from "https://www.gstatic.com/firebasejs/9.14.0/firebase-auth.js";
            const firebaseConfig = {
            apiKey: "",
            authDomain: "",
            projectId: "",
            storageBucket: "",
            messagingSenderId: "",
            appId: ""
          };
          // Initialize Firebase
          const app = initializeApp(firebaseConfig);
          const database = getDatabase(app);
          const analytics = getAnalytics(app);
          const auth = getAuth();
        firebase.auth().onAuthStateChanged(function(user) {
        if(user) {
           //Here you can place the code that you want to run if the user is logged in
           alert('You are logged in, you may proceed!')
        } else {
            document.getElementById('hide').style.display = "none";
           alert('You are not logged in... Redirecting!!!');
           window.location.href = "login.html";
        }
        });
    </script>
  </body>
</html>
</code>```

I tried the code above; I was expecting it to alert the user if they are logged in or not, then do the proceeding actions shown in the test4.html code above, but nothing occurs. I tried refreshing the page and that did not work either.

Body:
I am trying to use onAuthStateChanged() to alert the user if they are logged into the database. I have setup realtime database and have created several accounts that can be successfully logged into. However, after log in I want the user to be able to view the content on the site if they are logged in and not view the content and redirect them to the login.htmlpage.

Therefore, the two test files I have are login.html and test4.html

login.html

    <meta http-equiv="content-type" content="text/html; charset=windows-1252">
    <title>Login page</title>
    <link rel="stylesheet" href="cssFile.css">

Login

        <input id="email" name="email" placeholder="E-mail" type="text">
        <input id="password" name="password" placeholder="Password" type="password">
        <input id="signUp" name="signup_submit" value="Login" type="submit">

test4.html

<!DOCTYPE html>

    <meta http-equiv="content-type" content="text/html; charset=UTF-8">
    <title></title>

Test Dummy Page!

Hide me.

I tried the code above; I was expecting it to alert the user if they are logged in or not, then do the proceeding actions shown in the test4.html code above, but nothing occurs. I tried refreshing the page and that did not work either.


问:
Could not load file or assembly CefSharp
I have a WPF net core project and it's using CEF ChromiumWebBrowser, in the debug mode it run ok. Then I create Setup Project to make file msi file for client but it has error "File 'CefSharp.Core.Runtime.dll' of project output 'Publish Items from CommunicateWithWeb (Active)' targeting 'x64' is not compatible with the project's target platform 'x86'" while building. After I change TargetPlatform of Setup Project to x64, build is successfully.
Then I run msi file to install app in my PC but I can't open this app by clicking exe file. I open event viewer and error is like picture below.

Anyone can help me this problem? I spent 2 days to research but can't solve it. Any comment is also important for me. Thank you.

Note: I use VS2022, CefSharp.WPF.NETCore ver 108.4.130. I also install MS Visual C++ 2015-2022 Redistributable (x64 and x86) ver 14.34.31931

https://i.stack.imgur.com/8JnS0.png

Update: I installed Orca and see that CefSharp assembly is already included in .msi file as picture below

https://i.stack.imgur.com/g7Ngj.png


问:
Access SQLite database using content provider from PHP page on the same Android device?
I have php page running on the Android device and have Android app installed on the same device. Is it possible to access SQLite database using content provider(content://com.example/table_name insert query) from PHP page on the same Android device?

Thanks,
Gaurav Kapoor


问:
how do you change an old bootstrap package without affecting the CSS in PHP
I am trying to use an online bootstrap instead of the old bootstrap package that I was using for my code.  The problem is that with the online bootstrap, functionalities work  but it messes up with css and appearances and with the old bootstrap package, the css and appearances work but messes up the functionalities (datatarget to be specific)

I expected this to work well for my code but it didn't...

```<code><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
</code>```
```<code><script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.14.7/dist/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
</code>```

Body:
I am trying to use an online bootstrap instead of the old bootstrap package that I was using for my code.  The problem is that with the online bootstrap, functionalities work  but it messes up with css and appearances and with the old bootstrap package, the css and appearances work but messes up the functionalities (datatarget to be specific)

I expected this to work well for my code but it didn't...

<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap@4.3.1/dist/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">


问:
Gitlab CI variable is not resolved in 'before_script' of YML file
In .gitlab-ci.yml file, I try to use plutil command to save CI's variable into a .plist file in iOS project, as below code snipper showed.

Basiclly, I want to save CI variable to local file(.plist) and to use it from iOS project's test code. And this Env_Jira_Variable is one of the variables stored in Gitlab CI's variable settings.

```<code>before_script:
  - echo $PATH
  - source $HOME/.bashrc
  - echo $PATH
  - export BUNDLE_GITLAB__COM=x-access-token:$PACKAGE_DEPLOY_TOKEN
  - export Env_Jira_Variable=$Env_Jira_Variable
  - gem install bundler
  - bundle install
  # Store CI variables to .plist file
  - plutil -insert Jira_Variable -string $Env_Jira_Variable ./iosApp/iosAppUITests/MyProject/variables.plist
</code>```

But I got this error in Gitlab CI for command plutil

```<code>'Insert' and 'Replace' require a key path, a type, and a value2.
</code>```

And if I change $Env_Jira_Variable to a plain text, the command could be success and related key and value are saved in .plist file. Our CI is using Mac M1 machine, and I think the format $var should be correct. And still unable to figure out what is the root cause, guys please give me any hint or advice.

Body:
In .gitlab-ci.yml file, I try to use plutil command to save CI's variable into a .plist file in iOS project, as below code snipper showed.

Basiclly, I want to save CI variable to local file(.plist) and to use it from iOS project's test code. And this Env_Jira_Variable is one of the variables stored in Gitlab CI's variable settings.

before_script:
  - echo $PATH
  - source $HOME/.bashrc
  - echo $PATH
  - export BUNDLE_GITLAB__COM=x-access-token:$PACKAGE_DEPLOY_TOKEN
  - export Env_Jira_Variable=$Env_Jira_Variable
  - gem install bundler
  - bundle install
  # Store CI variables to .plist file
  - plutil -insert Jira_Variable -string $Env_Jira_Variable ./iosApp/iosAppUITests/MyProject/variables.plist

But I got this error in Gitlab CI for command plutil

'Insert' and 'Replace' require a key path, a type, and a value2.

And if I change $Env_Jira_Variable to a plain text, the command could be success and related key and value are saved in .plist file. Our CI is using Mac M1 machine, and I think the format $var should be correct. And still unable to figure out what is the root cause, guys please give me any hint or advice.


问:
How to create a bridging header in a react native project
I am trying to integrate my react native iOS application with a third-party analytics tool and the integration process has a step of creating a bridging header in Xcode and including the import in that header.

The link in this image redirects me to the Apple documentation which provides the steps to create a bridging header.
https://developer.apple.com/documentation/swift/importing-objective-c-into-swift

I followed the exact steps which are:  File > New > File > [operating system] > Source > Header File (you can see the attached screenshot below).

But I dont see any swift compiler or a path to the bridging header file in the build settings. What do I need to do to successfully create the bridging header and import the package?


问:
PHP CURL giving 502 ERROR suddently. Server side all configurations checked and all are good
I am having 2 domains and name of each domain are: 1) a.com 2) b.com both this domain hosted on same server so all configurations are same as well.

Now, Main issue I am getting at this time is if I execute CURL with domain: a.com (with curl url like: a.com/curltesting.php) then its failing with 502 error. But if I execute CURL with b.com (with curl url like: b.com/curltesting.php) then its working well.

Now if I execute CURL with b.com (with curl url like: a.com/curltesting.php) then also failing. Because anything in "a.com" is failing to execute from any place.

I have tried to use all possible ways in CURL and made sure that all extentions etc working well, ip etc also not blocked so all settings are fine.

And this issue arised sudden from no where. So no changes happend but still this issue arised.

Here is code which I used (Code is working well but for other domain in same server. for 1 omain its not working but for other working):

```<code>$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.b.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1000);
curl_setopt($ch, CURLOPT_TIMEOUT, 1000);

$httpCode = curl_getinfo($ch , CURLINFO_HTTP_CODE);
$response = curl_exec($ch);

if ($response === false)
$response = curl_error($ch);

echo stripslashes($response);
curl_close($ch);
</code>```

Please help! Thanks.

I have explained full details of what I an facing issue with and what things I tried.

Body:
I am having 2 domains and name of each domain are: 1) a.com 2) b.com both this domain hosted on same server so all configurations are same as well.

Now, Main issue I am getting at this time is if I execute CURL with domain: a.com (with curl url like: a.com/curltesting.php) then its failing with 502 error. But if I execute CURL with b.com (with curl url like: b.com/curltesting.php) then its working well.

Now if I execute CURL with b.com (with curl url like: a.com/curltesting.php) then also failing. Because anything in "a.com" is failing to execute from any place.

I have tried to use all possible ways in CURL and made sure that all extentions etc working well, ip etc also not blocked so all settings are fine.

And this issue arised sudden from no where. So no changes happend but still this issue arised.

Here is code which I used (Code is working well but for other domain in same server. for 1 omain its not working but for other working):

$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://www.b.com");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 1000);
curl_setopt($ch, CURLOPT_TIMEOUT, 1000);

$httpCode = curl_getinfo($ch , CURLINFO_HTTP_CODE);
$response = curl_exec($ch);

if ($response === false)
$response = curl_error($ch);

echo stripslashes($response);
curl_close($ch);

Please help! Thanks.

I have explained full details of what I an facing issue with and what things I tried.


问:
Enable image upload in WebView app Android studio
I'm creating a WebView app with WordPress website link my WebView has an image upload option in app it is not allowed to upload images can anybody help me or give me any references to code which needed to implement to upload images. I tried some code but they're not working it ask for permission to access media but not open gallery to select images what do i do to open gallery and upload images in my WebView</p>


问:
pyinstaller NoModuleFoundError: _tkinter due to updating python?
I have a pyinstaller problem with tkinter.
The program below works with python3 but does NOT with pyinstaller.
I think the problem is a kind of version conflict
because I updated python by downloading it from the python.org.

cxfreeze suggests below, even though it works with!
import _tkinter # If this fails your Python may not be configured for Tk

Some google suggests there is "hook" error, which I have no idea of.

I am completely stacked here.

My questions:

Is there any ways to fix this error?

Do we have any option --onefile (as in PyInstaller) in py2app as well? (py2app successfully enables tk.)

Is there any ways to clean-install python3 so that I can try this in a clean environment?

Details:
The Minimim Code below does not work in case of pyinstaller.
It works with no problem with python3.

```<code>% python3 no_module_found_error.py.  # just create a window with no problem.
</code>```

Minimal Code: no_module_found_error_tkinter.py

```<code>import tkinter
window = tkinter.Tk()
window.geometry("400x300")
window.title("NO Module Found Error: _tkinter")
btn = tkinter.Button(window, text="button")
btn.place(x=125, y=230, width=150, height=40)
window.mainloop()
</code>```

Once pyinstaller was applied, IT DOES NOT WORK.

```<code>% pyinstaller no_module_found_error_tkinter.py --onefile --windowed --hidden-import=tkinter
% dist/no_module_found_error_tkinter

Traceback (most recent call last):
   File "no_module_found_error_tkinter.py", line 1, in <module>
    import tkinter
   File "PyInstaller/loader/pyimod02_importers.py", line 499, in exec_module
   File "tkinter/__init__.py", line 38, in <module>
 ModuleNotFoundError: No module named '_tkinter'
[43491] Failed to execute script 'no_module_found_error_tkinter' due to unhandled exception: No module named '_tkinter'
[43491] Traceback:
Traceback (most recent call last):
   File "no_module_found_error_tkinter.py", line 1, in <module>
    import tkinter
   File "PyInstaller/loader/pyimod02_importers.py", line 499, in exec_module
   File "tkinter/__init__.py", line 38, in <module>
ModuleNotFoundError: No module named '_tkinter'
</code>```

macOS 12.6 Monterey.
Note: tk from macOS 12.6 is somehow buggy, for example properTree does not work properly and python update is suggested, and that is why python was updated in the first place. (properTree did work after the update.)

```<code>% python3 -V
Python 3.10.7
% pyinstaller -v
5.7.0
</code>```

cxfreeze suggests
import _tkinter # If this fails your Python may not be configured for Tk

Google search suggests:

```<code>% pip install tk
Requirement already satisfied: tk in  /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.1.0)

% pip install tk-dev
ERROR: Could not find a version that satisfies the requirement tk-dev (from  versions: none)
ERROR: No matching distribution found for tk-dev

% pip install tcl
Requirement already satisfied: tcl in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.2)

% pip install tcl8
ERROR: Could not find a version that satisfies the requirement tcl8 (from versions: none)
ERROR: No matching distribution found for tcl8
</code>```

Note:
I am not sure that pyinstaller with tkinter works properly BEFORE python is updated,
since I did not try this before the update.

Thank you very much for your help!
Have a nice day!

Doctor-KK.

Reply to the comment below:

Thank you very much for your reply.

There are many possible solutions in the post you suggested.
I tried just one by one.
Nothing worked.

Summary of what I did:

#1. % pyinstaller no_module_found_error_tkinter.py --onefile --windowed --hidden-import=tkinter --hidden-impo#rt=_tkinter -F

#2. % rm -rf ./build ./dist *.spec  and then command #1.

#3. modify no_module_found_error_tkinter.spec to modify pathex

```<code>a = Analysis(
    ['no_module_found_error_tkinter.py'],
    pathex=["/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.1.0)"],
    binaries=[],
    datas=[],
    hiddenimports=['tkinter', '_tkinter'],
</code>```

#4. there is no __pscache__ directory.

#5. No virtual environment.

I don't know how I can remove __init__.py which is also mentioned in the post without how to do it exactly.

Thank you very much!
Have a nice day :)

Body:
I have a pyinstaller problem with tkinter.
The program below works with python3 but does NOT with pyinstaller.
I think the problem is a kind of version conflict
because I updated python by downloading it from the python.org.

cxfreeze suggests below, even though it works with!
import _tkinter # If this fails your Python may not be configured for Tk

Some google suggests there is "hook" error, which I have no idea of.

I am completely stacked here.

My questions:

Is there any ways to fix this error?

Do we have any option --onefile (as in PyInstaller) in py2app as well? (py2app successfully enables tk.)

Is there any ways to clean-install python3 so that I can try this in a clean environment?

Details:
The Minimim Code below does not work in case of pyinstaller.
It works with no problem with python3.

% python3 no_module_found_error.py.  # just create a window with no problem.

Minimal Code: no_module_found_error_tkinter.py

import tkinter
window = tkinter.Tk()
window.geometry("400x300")
window.title("NO Module Found Error: _tkinter")
btn = tkinter.Button(window, text="button")
btn.place(x=125, y=230, width=150, height=40)
window.mainloop()

Once pyinstaller was applied, IT DOES NOT WORK.

% pyinstaller no_module_found_error_tkinter.py --onefile --windowed --hidden-import=tkinter
% dist/no_module_found_error_tkinter

Traceback (most recent call last):
   File "no_module_found_error_tkinter.py", line 1, in <module>
    import tkinter
   File "PyInstaller/loader/pyimod02_importers.py", line 499, in exec_module
   File "tkinter/__init__.py", line 38, in <module>
 ModuleNotFoundError: No module named '_tkinter'
[43491] Failed to execute script 'no_module_found_error_tkinter' due to unhandled exception: No module named '_tkinter'
[43491] Traceback:
Traceback (most recent call last):
   File "no_module_found_error_tkinter.py", line 1, in <module>
    import tkinter
   File "PyInstaller/loader/pyimod02_importers.py", line 499, in exec_module
   File "tkinter/__init__.py", line 38, in <module>
ModuleNotFoundError: No module named '_tkinter'

macOS 12.6 Monterey.
Note: tk from macOS 12.6 is somehow buggy, for example properTree does not work properly and python update is suggested, and that is why python was updated in the first place. (properTree did work after the update.)

% python3 -V
Python 3.10.7
% pyinstaller -v
5.7.0

cxfreeze suggests
import _tkinter # If this fails your Python may not be configured for Tk

Google search suggests:

% pip install tk
Requirement already satisfied: tk in  /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.1.0)

% pip install tk-dev
ERROR: Could not find a version that satisfies the requirement tk-dev (from  versions: none)
ERROR: No matching distribution found for tk-dev

% pip install tcl
Requirement already satisfied: tcl in /Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.2)

% pip install tcl8
ERROR: Could not find a version that satisfies the requirement tcl8 (from versions: none)
ERROR: No matching distribution found for tcl8

Note:
I am not sure that pyinstaller with tkinter works properly BEFORE python is updated,
since I did not try this before the update.

Thank you very much for your help!
Have a nice day!

Doctor-KK.

Reply to the comment below:

Thank you very much for your reply.

There are many possible solutions in the post you suggested.
I tried just one by one.
Nothing worked.

Summary of what I did:

#1. % pyinstaller no_module_found_error_tkinter.py --onefile --windowed --hidden-import=tkinter --hidden-impo#rt=_tkinter -F

#2. % rm -rf ./build ./dist *.spec  and then command #1.

#3. modify no_module_found_error_tkinter.spec to modify pathex

a = Analysis(
    ['no_module_found_error_tkinter.py'],
    pathex=["/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages (0.1.0)"],
    binaries=[],
    datas=[],
    hiddenimports=['tkinter', '_tkinter'],

#4. there is no __pscache__ directory.

#5. No virtual environment.

I don't know how I can remove __init__.py which is also mentioned in the post without how to do it exactly.

Thank you very much!
Have a nice day :)


问:
How to call android native activity and its methods from Unity
I am creating one plugin for Unity using android Katlin  in which I am using an activity and inside the activity calling "Media Projection screen capture intent" but when I am calling this activity and its public and static methods, Unity gives me error

java.lang.NoClassDefFound: Failed resolution of:Landroidx/appcompat/app/AppCompatActivity

How to fix this issue?

I've tried one solution by extending UnityPlayerActivity (form com.unity3d.player package) and than added methods to this activity . Unity able to call this UnityPlayerActivity form unity but for this unity have to insert this activity into manifest with different package name, But I do not want to extends UnityPlayerActivity form  com.unity3d.player package , please suggest any other way to call android activity and its methods form unity.


问:
Results order are different in two elasticsearch index
I have an elasticsearch7 index, with some documents and a second index with the same documents (change only _id)

If I run a query in first index results order are different than run query on second index, but documents are the same! Why?

```<code>{"query": {"bool":
{"must": [{"bool": {"must": [{"match": {"distretto": "MI"}}],
"should": []}}], "should": []}},
"_source": ["annosentenza", "cf_giudice",
"codiceoggetto", "controparte", "id", "nomegiudice", "parte", "text"]}
</code>```

The response, I search with only distretto:MI

civile index returns

eDmNh38BgYGzAMbAifcN -> MI 111002 CIGOLINI CHIARA

2jmNh38BgYGzAMbAlfcv -> MI 230999 INPS

instead paganotti_civile returns

98WLpIQBAcCrPawmBF_o -> MI 140112 SODALITAS SOC. COOP. SOCIALE ONLUS

-MWLpIQBAcCrPawmBV8M -> MI 140022 AM CASALI S.R.L.

I would want for paganotti_civile return the same first page as civile

MI 111002 CIGOLINI CHIARA

MI 230999 INPS

First index(civile)

```<code>{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 2.7262077,
    "hits" : [
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "eDmNh38BgYGzAMbAifcN",
        "_score" : 2.7262077,
        "_source" : {
          "codiceoggetto" : "111002",
          "controparte" : "CIGOLINI CHIARA",
          "nomegiudice" : "BONIOLO FLAVIANA",
          "annosentenza" : "",
          "cf_giudice" : "BNLFVN76A56F205I",
          "parte" : "ARCAINI GIUSEPPE",
          "id" : "GLMI 87088946 123646"
        }
      },
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "2jmNh38BgYGzAMbAlfcv",
        "_score" : 2.7262077,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "230999",
          "controparte" : "INPS",
          "nomegiudice" : "FEDELE EMANUELA",
          "annosentenza" : "",
          "cf_giudice" : "FDLMNL64D52B300E",
          "parte" : "CIFALDI NICOLA",
          "id" : "GLMI 99957367 27427"
        }
      },
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "ATmNh38BgYGzAMbAmfhY",
        "_score" : 2.7262077,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "220050",
          "controparte" : "ROMEO GESTIONI SPA",
          "nomegiudice" : "FEDELE EMANUELA",
          "annosentenza" : "",
          "cf_giudice" : "FDLMNL64D52B300E",
          "parte" : "RISI LORENA",
          "id" : "GLMI 98349767 27599"
        }
      },
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "LTmNh38BgYGzAMbAnvgM",
        "_score" : 2.7262077,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "144032",
          "controparte" : "BALDINI ILEANA",
          "nomegiudice" : "ROCA GRAZIA CONCETTA",
          "annosentenza" : "",
          "cf_giudice" : "RCOGZC84P50D643J",
          "parte" : "P.C.E. PRODUZIONE CABLAGGI ELETTRICI S.R.L.",
          "id" : "GLMI 75594601 109890"
        }
      },
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "hzmNh38BgYGzAMbAqPjU",
        "_score" : 2.7262077,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "220040",
          "controparte" : "COMUNE OGGIONA CON SANTO STEFANO",
          "nomegiudice" : "FEDELE EMANUELA",
          "annosentenza" : "",
          "cf_giudice" : "FDLMNL64D52B300E",
          "parte" : "MAGISTRI MARCO EMILIO",
          "id" : "GLMI 100942914 26946"
        }
      },
</code>```

Second index(paganotti_civile)

```<code>{
  "took" : 138,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 0.4119706,
    "hits" : [
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "98WLpIQBAcCrPawmBF_o",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140112",
          "controparte" : "SODALITAS SOC. COOP. SOCIALE ONLUS",
          "nomegiudice" : "PERTILE ROBERTO",
          "annosentenza" : "",
          "cf_giudice" : "PRTRRT58A14L872W",
          "parte" : "RANZANI GIUSEPPINA",
          "id" : "GLMI 100944044 1964905"
        }
      },
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "-MWLpIQBAcCrPawmBV8M",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140022",
          "controparte" : "AM CASALI S.R.L.",
          "nomegiudice" : "CAPPELLO ADA",
          "annosentenza" : "",
          "cf_giudice" : "CPPDAA87T59C351D",
          "parte" : "BOSSI GIANCARLO",
          "id" : "GLMI 75970798 113201"
        }
      },
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "-cWLpIQBAcCrPawmBV8g",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140051",
          "controparte" : "BUCCI GIORGIO",
          "nomegiudice" : "FERRARI FRANCESCO MATTEO",
          "annosentenza" : "2021",
          "cf_giudice" : "FRRFNC67M20F205B",
          "parte" : "POZZA OTTAVIANO ALVISE",
          "id" : "GLMI 135138291 2299283"
        }
      },
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "-sWLpIQBAcCrPawmBV81",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140041",
          "controparte" : "DI LAURO GENNARO  (AVV.)",
          "nomegiudice" : "RAINERI CARLA ROMANA",
          "annosentenza" : "2020",
          "cf_giudice" : "RNRCLR55E52G535U",
          "parte" : "MONTE DEI PASCHI DI SIENA SPA",
          "id" : "GLMI 101233632 100541"
        }
      },
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "-8WLpIQBAcCrPawmBV9D",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140022",
          "controparte" : "CO.GE.T. SOCIETA  COOPERATIVA IN LIQUIDAZIONE",
          "nomegiudice" : "MANTOVANI ANNA",
          "annosentenza" : "2021",
          "cf_giudice" : "MNTNNA58A68F205S",
          "parte" : "AMIACQUE SRL",
          "id" : "GLMI 131465321 114225"
        }
      },
</code>```

Body:
I have an elasticsearch7 index, with some documents and a second index with the same documents (change only _id)

If I run a query in first index results order are different than run query on second index, but documents are the same! Why?

{"query": {"bool":
{"must": [{"bool": {"must": [{"match": {"distretto": "MI"}}],
"should": []}}], "should": []}},
"_source": ["annosentenza", "cf_giudice",
"codiceoggetto", "controparte", "id", "nomegiudice", "parte", "text"]}

The response, I search with only distretto:MI

civile index returns

eDmNh38BgYGzAMbAifcN -> MI 111002 CIGOLINI CHIARA

2jmNh38BgYGzAMbAlfcv -> MI 230999 INPS

instead paganotti_civile returns

98WLpIQBAcCrPawmBF_o -> MI 140112 SODALITAS SOC. COOP. SOCIALE ONLUS

-MWLpIQBAcCrPawmBV8M -> MI 140022 AM CASALI S.R.L.

I would want for paganotti_civile return the same first page as civile

MI 111002 CIGOLINI CHIARA

MI 230999 INPS

First index(civile)

{
  "took" : 3,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 2.7262077,
    "hits" : [
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "eDmNh38BgYGzAMbAifcN",
        "_score" : 2.7262077,
        "_source" : {
          "codiceoggetto" : "111002",
          "controparte" : "CIGOLINI CHIARA",
          "nomegiudice" : "BONIOLO FLAVIANA",
          "annosentenza" : "",
          "cf_giudice" : "BNLFVN76A56F205I",
          "parte" : "ARCAINI GIUSEPPE",
          "id" : "GLMI 87088946 123646"
        }
      },
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "2jmNh38BgYGzAMbAlfcv",
        "_score" : 2.7262077,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "230999",
          "controparte" : "INPS",
          "nomegiudice" : "FEDELE EMANUELA",
          "annosentenza" : "",
          "cf_giudice" : "FDLMNL64D52B300E",
          "parte" : "CIFALDI NICOLA",
          "id" : "GLMI 99957367 27427"
        }
      },
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "ATmNh38BgYGzAMbAmfhY",
        "_score" : 2.7262077,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "220050",
          "controparte" : "ROMEO GESTIONI SPA",
          "nomegiudice" : "FEDELE EMANUELA",
          "annosentenza" : "",
          "cf_giudice" : "FDLMNL64D52B300E",
          "parte" : "RISI LORENA",
          "id" : "GLMI 98349767 27599"
        }
      },
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "LTmNh38BgYGzAMbAnvgM",
        "_score" : 2.7262077,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "144032",
          "controparte" : "BALDINI ILEANA",
          "nomegiudice" : "ROCA GRAZIA CONCETTA",
          "annosentenza" : "",
          "cf_giudice" : "RCOGZC84P50D643J",
          "parte" : "P.C.E. PRODUZIONE CABLAGGI ELETTRICI S.R.L.",
          "id" : "GLMI 75594601 109890"
        }
      },
      {
        "_index" : "civile",
        "_type" : "_doc",
        "_id" : "hzmNh38BgYGzAMbAqPjU",
        "_score" : 2.7262077,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "220040",
          "controparte" : "COMUNE OGGIONA CON SANTO STEFANO",
          "nomegiudice" : "FEDELE EMANUELA",
          "annosentenza" : "",
          "cf_giudice" : "FDLMNL64D52B300E",
          "parte" : "MAGISTRI MARCO EMILIO",
          "id" : "GLMI 100942914 26946"
        }
      },

Second index(paganotti_civile)

{
  "took" : 138,
  "timed_out" : false,
  "_shards" : {
    "total" : 1,
    "successful" : 1,
    "skipped" : 0,
    "failed" : 0
  },
  "hits" : {
    "total" : {
      "value" : 10000,
      "relation" : "gte"
    },
    "max_score" : 0.4119706,
    "hits" : [
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "98WLpIQBAcCrPawmBF_o",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140112",
          "controparte" : "SODALITAS SOC. COOP. SOCIALE ONLUS",
          "nomegiudice" : "PERTILE ROBERTO",
          "annosentenza" : "",
          "cf_giudice" : "PRTRRT58A14L872W",
          "parte" : "RANZANI GIUSEPPINA",
          "id" : "GLMI 100944044 1964905"
        }
      },
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "-MWLpIQBAcCrPawmBV8M",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140022",
          "controparte" : "AM CASALI S.R.L.",
          "nomegiudice" : "CAPPELLO ADA",
          "annosentenza" : "",
          "cf_giudice" : "CPPDAA87T59C351D",
          "parte" : "BOSSI GIANCARLO",
          "id" : "GLMI 75970798 113201"
        }
      },
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "-cWLpIQBAcCrPawmBV8g",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140051",
          "controparte" : "BUCCI GIORGIO",
          "nomegiudice" : "FERRARI FRANCESCO MATTEO",
          "annosentenza" : "2021",
          "cf_giudice" : "FRRFNC67M20F205B",
          "parte" : "POZZA OTTAVIANO ALVISE",
          "id" : "GLMI 135138291 2299283"
        }
      },
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "-sWLpIQBAcCrPawmBV81",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140041",
          "controparte" : "DI LAURO GENNARO  (AVV.)",
          "nomegiudice" : "RAINERI CARLA ROMANA",
          "annosentenza" : "2020",
          "cf_giudice" : "RNRCLR55E52G535U",
          "parte" : "MONTE DEI PASCHI DI SIENA SPA",
          "id" : "GLMI 101233632 100541"
        }
      },
      {
        "_index" : "paganotti_civile",
        "_type" : "_doc",
        "_id" : "-8WLpIQBAcCrPawmBV9D",
        "_score" : 0.4119706,
        "_ignored" : [
          "text.keyword"
        ],
        "_source" : {
          "codiceoggetto" : "140022",
          "controparte" : "CO.GE.T. SOCIETA  COOPERATIVA IN LIQUIDAZIONE",
          "nomegiudice" : "MANTOVANI ANNA",
          "annosentenza" : "2021",
          "cf_giudice" : "MNTNNA58A68F205S",
          "parte" : "AMIACQUE SRL",
          "id" : "GLMI 131465321 114225"
        }
      },


问:
React DnD with iframes
I have a React application that uses react-dnd (tables). Components from this application are connected to another application (in Angular) via iframes. And I need that in another application, users could drag and drop elements between my components in different iframes.
In my own application on React I can drag and drop elements between tables. But when I connect them to another app via iframes DnD not working. Is it possible?

I tried to use <embed> and <object> to replace iframes but that didn't work. Tried to change the permissions of iframes, but that didn't work either.

Title: React DnD with iframes


问:
VB.Net: How can I read Getter logging level defined in Apache logging properties file?
I want to migrate to VB.Net a tracing class written in Java that is using Apache Log4j.

Log4J properties are defined in a flat file names log4j.Properties

```<code>log4j.rootLogger=DEBUG, file

log4j.logger.MsgStackLogger=INFO

log4j.logger.Sql2Excel=INFO
log4j.logger.Sql2Excel.CLASS=INFO
log4j.logger.Sql2Excel.METHOD=INFO
log4j.logger.Sql2Excel.EVENT=INFO

# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%m%n

# File appender
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=c:/Trace/${USERNAME}/Sql2Excel/Sql2Excel.${DATE-TIME}.log
log4j.appender.file.Layout=org.apache.log4j.PatternLayout
log4j.appender.file.Layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
log4j.appender.file.ImmediateFlush=true
log4j.appender.file.Threshold=debug
log4j.appender.file.Append=false
</code>```

Java code using Log4j and used for tracing is following

```<code>public String sLogClassRoot = "Program-or-Class-or-Module-Name";
private boolean isLoggable(String sCategory)
    {
    Logger oLog = Logger.getLogger(sLogClassRoot + "." + sCategory);
    boolean bReturn = (oLog.getLevel() == org.apache.log4j.Level.INFO);
    return bReturn;
    }

public XTraceStatic(String sName)
    {
    sLogClassRoot = sName;

    bTraceClass = isLoggable("CLASS");
    bTraceMethod = isLoggable("METHOD");
    bTraceEvent = isLoggable("EVENT");
    bTraceProperty = isLoggable("PROPERTY");
    bTraceMenu = isLoggable("MENU");
    bTraceCommand = isLoggable("COMMAND");
    }
</code>```

How can I do same thing using only VB.Net ?

How can I get logging's level given a specific string in log4j.Properties files ?

Can I do same job using only Microsoft.Extension.Logging or must I install a specific Nuget package ? Which ?

Body:
I want to migrate to VB.Net a tracing class written in Java that is using Apache Log4j.

Log4J properties are defined in a flat file names log4j.Properties

log4j.rootLogger=DEBUG, file

log4j.logger.MsgStackLogger=INFO

log4j.logger.Sql2Excel=INFO
log4j.logger.Sql2Excel.CLASS=INFO
log4j.logger.Sql2Excel.METHOD=INFO
log4j.logger.Sql2Excel.EVENT=INFO

# CONSOLE appender not used by default
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%m%n

# File appender
log4j.appender.file=org.apache.log4j.FileAppender
log4j.appender.file.File=c:/Trace/${USERNAME}/Sql2Excel/Sql2Excel.${DATE-TIME}.log
log4j.appender.file.Layout=org.apache.log4j.PatternLayout
log4j.appender.file.Layout.ConversionPattern=%d [%-15.15t] %-5p %-30.30c{1} - %m%n
log4j.appender.file.ImmediateFlush=true
log4j.appender.file.Threshold=debug
log4j.appender.file.Append=false

Java code using Log4j and used for tracing is following

public String sLogClassRoot = "Program-or-Class-or-Module-Name";
private boolean isLoggable(String sCategory)
    {
    Logger oLog = Logger.getLogger(sLogClassRoot + "." + sCategory);
    boolean bReturn = (oLog.getLevel() == org.apache.log4j.Level.INFO);
    return bReturn;
    }

public XTraceStatic(String sName)
    {
    sLogClassRoot = sName;

    bTraceClass = isLoggable("CLASS");
    bTraceMethod = isLoggable("METHOD");
    bTraceEvent = isLoggable("EVENT");
    bTraceProperty = isLoggable("PROPERTY");
    bTraceMenu = isLoggable("MENU");
    bTraceCommand = isLoggable("COMMAND");
    }

How can I do same thing using only VB.Net ?

How can I get logging's level given a specific string in log4j.Properties files ?

Can I do same job using only Microsoft.Extension.Logging or must I install a specific Nuget package ? Which ?


问:
How to change The WhereInput Property names to camelCase in Prisma?
I am using Prisma in a NestJs application and I have a requirement to change the Generated property names in WhereInput Type to camelCase.

This is my Cities models added in the Prisma.Schema file is given below.

model Cities {
  id         Int         @id(map: "PK_dbo.Cities") @default(autoincrement())
  name       String      @db.NVarChar(200)
  countryId  Int
  StateId    Int?
  CreatedOn  DateTime    @db.DateTime
  ModifiedOn DateTime    @db.DateTime
  PublicId   Int?
  Countries  Countries   @relation(fields: [countryId], references: [id], onUpdate: NoAction, map: "FK_dbo.Cities_dbo.Countries_CountryId")
  States     States?     @relation(fields: [StateId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "FK_dbo.Cities_dbo.States_StateId")
  Addresses  Addresses[]
}```
</div>
</div>
</p>
<p>The corresponding Generated WhereInput type is given below,</p>
<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-html lang-html prettyprint-override"><code> export type CitiesWhereInput = {
    AND?: Enumerable<CitiesWhereInput>
    OR?: Enumerable<CitiesWhereInput>
    NOT?: Enumerable<CitiesWhereInput>
    id?: IntFilter | number
    name?: StringFilter | string
    countryId?: IntFilter | number
    StateId?: IntNullableFilter | number | null
    CreatedOn?: DateTimeFilter | Date | string
    ModifiedOn?: DateTimeFilter | Date | string
    PublicId?: IntNullableFilter | number | null
    Countries?: XOR<CountriesRelationFilter, CountriesWhereInput>
    States?: XOR<StatesRelationFilter, StatesWhereInput> | null
    Addresses?: AddressesListRelationFilter
  }</code>```

I want to change the Property names to camelCase. Like "AND" to "and", "OR" to "or" So on.
Is it possible?

Body:
I am using Prisma in a NestJs application and I have a requirement to change the Generated property names in WhereInput Type to camelCase.

This is my Cities models added in the Prisma.Schema file is given below.

model Cities {
  id         Int         @id(map: "PK_dbo.Cities") @default(autoincrement())
  name       String      @db.NVarChar(200)
  countryId  Int
  StateId    Int?
  CreatedOn  DateTime    @db.DateTime
  ModifiedOn DateTime    @db.DateTime
  PublicId   Int?
  Countries  Countries   @relation(fields: [countryId], references: [id], onUpdate: NoAction, map: "FK_dbo.Cities_dbo.Countries_CountryId")
  States     States?     @relation(fields: [StateId], references: [id], onDelete: NoAction, onUpdate: NoAction, map: "FK_dbo.Cities_dbo.States_StateId")
  Addresses  Addresses[]
}

The corresponding Generated WhereInput type is given below,

 export type CitiesWhereInput = {
    AND?: Enumerable<CitiesWhereInput>
    OR?: Enumerable<CitiesWhereInput>
    NOT?: Enumerable<CitiesWhereInput>
    id?: IntFilter | number
    name?: StringFilter | string
    countryId?: IntFilter | number
    StateId?: IntNullableFilter | number | null
    CreatedOn?: DateTimeFilter | Date | string
    ModifiedOn?: DateTimeFilter | Date | string
    PublicId?: IntNullableFilter | number | null
    Countries?: XOR<CountriesRelationFilter, CountriesWhereInput>
    States?: XOR<StatesRelationFilter, StatesWhereInput> | null
    Addresses?: AddressesListRelationFilter
  }

I want to change the Property names to camelCase. Like "AND" to "and", "OR" to "or" So on.
Is it possible?


问:
Deploying Django app to Elastic Beanstalk Docker platform
Im'm trying to deploy a django app to single docker container platform on EB version Docker running on 64bit Amazon Linux 2/3.5.2.
This is what I've done so far:

Created Dockerfile and compose,

pushed the image to ECR,

Created Dockerrun.aws.json and it looks like this:

{
"AWSEBDockerrunVersion": "1",
"Image": {
"Name": "URI to the ECR repository",
"Update": "true"
},
"Ports": [
{
"ContainerPort": 8000,
"HostPort": 8000
}
]
}

Created sample app in Elastic Beanstalk.

Uploaded the Dockerrun.aws.json file as the source code

Now the EB url is taking to a "This site can't be reached" page but in the logs I can't find the specific error instead I see a message stating that deployment has succeeded

Also when I run eb locally like this eb local run --port 8080, eb local open, it's working just fine.

Let me know if there's anything else I need to share.


问:
PyQt table row background colour based on cell value with SQlite database
`hi, How to change row color based on the Yes/No column. I am using sqlite as a database.
Below is my code where i want to change color of cells

My PyQt table =====>
SQlite Database ===>
Expecting result all 1's to green in PyQt5 table widget ====>`

```<code>def check_table(self):
    try:
        cur = self.con.cursor()
        cur.execute("SELECT * FROM Curing ORDER BY Time DESC LIMIT 100")
        result = cur.fetchall()
        col = [i[0] for i in cur.description]

        if result:
            self.tb_ch_table.setRowCount(len(result))
            self.tb_ch_table.setColumnCount(len(col))

            self.tb_ch_table.setHorizontalHeaderLabels(col)

            # self.tb_ch_table.styleSheet("alternate-background-color: Lightgrey;background-color: white;")

            for row, item in enumerate(result):
                for column, data in enumerate(item):
                    self.tb_ch_table.setItem(row, column, QTableWidgetItem(str(data)))

        else:
            return
        QTimer.singleShot(5000, self.check_table)
    except Exception as e:
        self.frame_ch.setStyleSheet("background-color:rgb(255, 0, 0);")
        self.show_ch_msg(msg=str(e))

</code>```

Body:
`hi, How to change row color based on the Yes/No column. I am using sqlite as a database.
Below is my code where i want to change color of cells

My PyQt table =====>
SQlite Database ===>
Expecting result all 1's to green in PyQt5 table widget ====>`

def check_table(self):
    try:
        cur = self.con.cursor()
        cur.execute("SELECT * FROM Curing ORDER BY Time DESC LIMIT 100")
        result = cur.fetchall()
        col = [i[0] for i in cur.description]

        if result:
            self.tb_ch_table.setRowCount(len(result))
            self.tb_ch_table.setColumnCount(len(col))

            self.tb_ch_table.setHorizontalHeaderLabels(col)

            # self.tb_ch_table.styleSheet("alternate-background-color: Lightgrey;background-color: white;")

            for row, item in enumerate(result):
                for column, data in enumerate(item):
                    self.tb_ch_table.setItem(row, column, QTableWidgetItem(str(data)))

        else:
            return
        QTimer.singleShot(5000, self.check_table)
    except Exception as e:
        self.frame_ch.setStyleSheet("background-color:rgb(255, 0, 0);")
        self.show_ch_msg(msg=str(e))


问:
Flutter Stripe web payment show CORS error
I am working on a Flutter app that uses Stripe Payments.

The payment is working on android and on ios app, but not on the web app.

I have deployed the needed index.js file to Firebase Cloud Functions.

This is the file:

```<code>const functions = require("firebase-functions");
const stripe = require("stripe")("sk_...");

exports.stripePaymentIntentRequest = functions.https.onRequest(async (req, res) => {
    try {
        let customerId;

        //Gets the customer who's email id matches the one sent by the client
        const customerList = await stripe.customers.list({
            email: req.body.email,
            limit: 1
        });

        //Checks the if the customer exists, if not creates a new customer
        if (customerList.data.length !== 0) {
            customerId = customerList.data[0].id;
        }
        else {
            const customer = await stripe.customers.create({
                email: req.body.email
            });
            customerId = customer.data.id;
        }

        //Creates a temporary secret key linked with the customer
        const ephemeralKey = await stripe.ephemeralKeys.create(
            { customer: customerId },
            { apiVersion: '2020-08-27' }
        );

        //Creates a new payment intent with amount passed in from the client
        const paymentIntent = await stripe.paymentIntents.create({
            amount: parseInt(req.body.amount),
            currency: 'eur',
            customer: customerId,
        })

        res.status(200).send({
            paymentIntent: paymentIntent.client_secret,
            ephemeralKey: ephemeralKey.secret,
            customer: customerId,
            success: true,
        })

    } catch (error) {
        res.status(404).send({ success: false, error: error.message })
    }
});
</code>```

On the web app, trying to perform the payment, an error is launched:

And also at the browser inspect console it is shown following messages:

What can I do to solve that issue?

Body:
I am working on a Flutter app that uses Stripe Payments.

The payment is working on android and on ios app, but not on the web app.

I have deployed the needed index.js file to Firebase Cloud Functions.

This is the file:

const functions = require("firebase-functions");
const stripe = require("stripe")("sk_...");

exports.stripePaymentIntentRequest = functions.https.onRequest(async (req, res) => {
    try {
        let customerId;

        //Gets the customer who's email id matches the one sent by the client
        const customerList = await stripe.customers.list({
            email: req.body.email,
            limit: 1
        });

        //Checks the if the customer exists, if not creates a new customer
        if (customerList.data.length !== 0) {
            customerId = customerList.data[0].id;
        }
        else {
            const customer = await stripe.customers.create({
                email: req.body.email
            });
            customerId = customer.data.id;
        }

        //Creates a temporary secret key linked with the customer
        const ephemeralKey = await stripe.ephemeralKeys.create(
            { customer: customerId },
            { apiVersion: '2020-08-27' }
        );

        //Creates a new payment intent with amount passed in from the client
        const paymentIntent = await stripe.paymentIntents.create({
            amount: parseInt(req.body.amount),
            currency: 'eur',
            customer: customerId,
        })

        res.status(200).send({
            paymentIntent: paymentIntent.client_secret,
            ephemeralKey: ephemeralKey.secret,
            customer: customerId,
            success: true,
        })

    } catch (error) {
        res.status(404).send({ success: false, error: error.message })
    }
});

On the web app, trying to perform the payment, an error is launched:

And also at the browser inspect console it is shown following messages:

What can I do to solve that issue?


问:
Next.JS Hydration Failure (The Initial UI Does Not Match What was Rendered on The Server)
I'm currently learning Material UI with Next.JS so, my source code is a bit messy. But to keep things short, I've developed the website for over 3 hours with no issue but when I decided that I want to move the source code to another folder and files (I'm using Next.JS 12 pages folder system) the error suddenly pops!

What's weird is that undoing all the changes didn't seems to make the error goes away.. so I think there must be something wrong with my code but I just cannot tell where it exactly is. Any help and explanation in that regards, is highly appreciated!

Side notes:

I've checked the Next.JS web for my issue, it is said that invalid html (like putting div inside p) can cause the issue, but I'm not quite sure this caused mine because there are no case like this (or that I know of) inside my source code

I've checked some previous issue alike in stackoverflow as well.. but because of my limited experience I'm still unable to pinpoint where exactly is my mistake

There are no functionality yet on my website, I'm just trying to make the mock-up for some components that I want to use later

Below is my index.js source code for the page:

```<code>import Head from 'next/head';
import {
  Grid,
  Divider,
  TextField,
  Button,
  Box,
  Card,
  CardActions,
  CardContent,
  Typography,
  FormGroup,
  FormControlLabel,
  Checkbox,
  Stack
} from '@mui/material';

export default function ToDoList() {
  const bull = (
    <Box
      component="span"
      sx={{ display: 'inline-block', mx: '2px', transform: 'scale(0.8)' }}
    >
      •
    </Box>
  );
  return (
    <>
      <Head>
        <title>Quick To-Do List</title>
        <meta name="description" content="Generated by create next app" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="icon" href="/favicon.ico" />
      </Head>
      <main>
        <Box
          component="form"
          sx={{
            '& .MuiTextField-root': { width: '50ch' },
            height: '80vh',
            width: '80vw'
          }}
          noValidate
          autoComplete="off"
        >
          <Card sx={{ minWidth: 275 }}>
            <CardContent>
              <Box
                component="form"
                sx={{
                  '& .MuiTextField-root': { width: '50ch' },
                  margin: '2rem'
                }}
                noValidate
                autoComplete="off"
              >
                <Grid container>
                  <Grid item xs>
                    <Stack spacing={1}>
                      <TextField
                        id="standard-name"
                        label="What Do You Want to Do?"
                        value="Buy LARGE Trash Bags"
                        InputProps={{endAdornment: <Button variant="contained">Submit</Button>}}
                      />
                      <FormGroup>
                        <FormControlLabel control={<Checkbox defaultChecked />} label="Is It Done Yet?" />
                      </FormGroup>
                      <p>Your User ID is: <strong>eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9</strong></p>
                    </Stack>
                  </Grid>
                  <Divider orientation="vertical" flexItem>
                    Your Task Lists {'>'}
                  </Divider>
                  <Grid item xs>
                    <Box
                      sx={{
                        height: '30vh',
                        overflow: "hidden",
                        overflowY: "scroll"
                      }}
                    >
                      <Stack spacing={2}>
                        <Card sx={{ minWidth: 275 }}>
                          <CardContent>
                            <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
                              Word of the Day
                            </Typography>
                            <Typography variant="h5" component="div">
                              be{bull}nev{bull}o{bull}lent
                            </Typography>
                            <Typography sx={{ mb: 1.5 }} color="text.secondary">
                              adjective
                            </Typography>
                            <Typography variant="body2">
                              well meaning and kindly.
                              <br />
                              {'"a benevolent smile"'}
                            </Typography>
                          </CardContent>
                          <CardActions>
                            <FormGroup>
                              <FormControlLabel control={<Checkbox defaultChecked />} label="The Job is Done!" />
                            </FormGroup>
                          </CardActions>
                        </Card>
                        <Card sx={{ minWidth: 275 }}>
                          <CardContent>
                            <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
                              Word of the Day
                            </Typography>
                            <Typography variant="h5" component="div">
                              be{bull}nev{bull}o{bull}lent
                            </Typography>
                            <Typography sx={{ mb: 1.5 }} color="text.secondary">
                              adjective
                            </Typography>
                            <Typography variant="body2">
                              well meaning and kindly.
                              <br />
                              {'"a benevolent smile"'}
                            </Typography>
                          </CardContent>
                          <CardActions>
                            <FormGroup>
                              <FormControlLabel control={<Checkbox defaultChecked />} label="The Job is Done!" />
                            </FormGroup>
                          </CardActions>
                        </Card>
                        <Card sx={{ minWidth: 275 }}>
                          <CardContent>
                            <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
                              Word of the Day
                            </Typography>
                            <Typography variant="h5" component="div">
                              be{bull}nev{bull}o{bull}lent
                            </Typography>
                            <Typography sx={{ mb: 1.5 }} color="text.secondary">
                              adjective
                            </Typography>
                            <Typography variant="body2">
                              well meaning and kindly.
                              <br />
                              {'"a benevolent smile"'}
                            </Typography>
                          </CardContent>
                          <CardActions>
                            <FormGroup>
                              <FormControlLabel control={<Checkbox defaultChecked />} label="The Job is Done!" />
                            </FormGroup>
                          </CardActions>
                        </Card>
                        <Card sx={{ minWidth: 275 }}>
                          <CardContent>
                            <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
                              Word of the Day
                            </Typography>
                            <Typography variant="h5" component="div">
                              be{bull}nev{bull}o{bull}lent
                            </Typography>
                            <Typography sx={{ mb: 1.5 }} color="text.secondary">
                              adjective
                            </Typography>
                            <Typography variant="body2">
                              well meaning and kindly.
                              <br />
                              {'"a benevolent smile"'}
                            </Typography>
                          </CardContent>
                          <CardActions>
                            <FormGroup>
                              <FormControlLabel control={<Checkbox defaultChecked />} label="The Job is Done!" />
                            </FormGroup>
                          </CardActions>
                        </Card>
                      </Stack>
                    </Box>
                  </Grid>
                </Grid>
              </Box>
            </CardContent>
          </Card>
        </Box>
      </main>
    </>
  )
}
</code>```

===

Update:

Turns out my side note is wrong! I've put a Card inside a Box, which makes the error occurred! Putting the card outside the box fixed the issue for me.

Body:
I'm currently learning Material UI with Next.JS so, my source code is a bit messy. But to keep things short, I've developed the website for over 3 hours with no issue but when I decided that I want to move the source code to another folder and files (I'm using Next.JS 12 pages folder system) the error suddenly pops!

What's weird is that undoing all the changes didn't seems to make the error goes away.. so I think there must be something wrong with my code but I just cannot tell where it exactly is. Any help and explanation in that regards, is highly appreciated!

Side notes:

I've checked the Next.JS web for my issue, it is said that invalid html (like putting div inside p) can cause the issue, but I'm not quite sure this caused mine because there are no case like this (or that I know of) inside my source code

I've checked some previous issue alike in stackoverflow as well.. but because of my limited experience I'm still unable to pinpoint where exactly is my mistake

There are no functionality yet on my website, I'm just trying to make the mock-up for some components that I want to use later

Below is my index.js source code for the page:

import Head from 'next/head';
import {
  Grid,
  Divider,
  TextField,
  Button,
  Box,
  Card,
  CardActions,
  CardContent,
  Typography,
  FormGroup,
  FormControlLabel,
  Checkbox,
  Stack
} from '@mui/material';

export default function ToDoList() {
  const bull = (
    <Box
      component="span"
      sx={{ display: 'inline-block', mx: '2px', transform: 'scale(0.8)' }}
    >
      •
    </Box>
  );
  return (
    <>

        <title>Quick To-Do List</title>
        <meta name="description" content="Generated by create next app" />
        <meta name="viewport" content="width=device-width, initial-scale=1" />
        <link rel="icon" href="/favicon.ico" />

        <Box
          component="form"
          sx={{
            '& .MuiTextField-root': { width: '50ch' },
            height: '80vh',
            width: '80vw'
          }}
          noValidate
          autoComplete="off"
        >
          <Card sx={{ minWidth: 275 }}>
            <CardContent>
              <Box
                component="form"
                sx={{
                  '& .MuiTextField-root': { width: '50ch' },
                  margin: '2rem'
                }}
                noValidate
                autoComplete="off"
              >
                <Grid container>
                  <Grid item xs>
                    <Stack spacing={1}>
                      <TextField
                        id="standard-name"
                        label="What Do You Want to Do?"
                        value="Buy LARGE Trash Bags"
                        InputProps={{endAdornment: <Button variant="contained">Submit</Button>}}
                      />
                      <FormGroup>
                        <FormControlLabel control={<Checkbox defaultChecked />} label="Is It Done Yet?" />
                      </FormGroup>

Your User ID is: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9

                    </Stack>
                  </Grid>
                  <Divider orientation="vertical" flexItem>
                    Your Task Lists {'>'}
                  </Divider>
                  <Grid item xs>
                    <Box
                      sx={{
                        height: '30vh',
                        overflow: "hidden",
                        overflowY: "scroll"
                      }}
                    >
                      <Stack spacing={2}>
                        <Card sx={{ minWidth: 275 }}>
                          <CardContent>
                            <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
                              Word of the Day
                            </Typography>
                            <Typography variant="h5" component="div">
                              be{bull}nev{bull}o{bull}lent
                            </Typography>
                            <Typography sx={{ mb: 1.5 }} color="text.secondary">
                              adjective
                            </Typography>
                            <Typography variant="body2">
                              well meaning and kindly.

                              {'"a benevolent smile"'}
                            </Typography>
                          </CardContent>
                          <CardActions>
                            <FormGroup>
                              <FormControlLabel control={<Checkbox defaultChecked />} label="The Job is Done!" />
                            </FormGroup>
                          </CardActions>
                        </Card>
                        <Card sx={{ minWidth: 275 }}>
                          <CardContent>
                            <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
                              Word of the Day
                            </Typography>
                            <Typography variant="h5" component="div">
                              be{bull}nev{bull}o{bull}lent
                            </Typography>
                            <Typography sx={{ mb: 1.5 }} color="text.secondary">
                              adjective
                            </Typography>
                            <Typography variant="body2">
                              well meaning and kindly.

                              {'"a benevolent smile"'}
                            </Typography>
                          </CardContent>
                          <CardActions>
                            <FormGroup>
                              <FormControlLabel control={<Checkbox defaultChecked />} label="The Job is Done!" />
                            </FormGroup>
                          </CardActions>
                        </Card>
                        <Card sx={{ minWidth: 275 }}>
                          <CardContent>
                            <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
                              Word of the Day
                            </Typography>
                            <Typography variant="h5" component="div">
                              be{bull}nev{bull}o{bull}lent
                            </Typography>
                            <Typography sx={{ mb: 1.5 }} color="text.secondary">
                              adjective
                            </Typography>
                            <Typography variant="body2">
                              well meaning and kindly.

                              {'"a benevolent smile"'}
                            </Typography>
                          </CardContent>
                          <CardActions>
                            <FormGroup>
                              <FormControlLabel control={<Checkbox defaultChecked />} label="The Job is Done!" />
                            </FormGroup>
                          </CardActions>
                        </Card>
                        <Card sx={{ minWidth: 275 }}>
                          <CardContent>
                            <Typography sx={{ fontSize: 14 }} color="text.secondary" gutterBottom>
                              Word of the Day
                            </Typography>
                            <Typography variant="h5" component="div">
                              be{bull}nev{bull}o{bull}lent
                            </Typography>
                            <Typography sx={{ mb: 1.5 }} color="text.secondary">
                              adjective
                            </Typography>
                            <Typography variant="body2">
                              well meaning and kindly.

                              {'"a benevolent smile"'}
                            </Typography>
                          </CardContent>
                          <CardActions>
                            <FormGroup>
                              <FormControlLabel control={<Checkbox defaultChecked />} label="The Job is Done!" />
                            </FormGroup>
                          </CardActions>
                        </Card>
                      </Stack>
                    </Box>
                  </Grid>
                </Grid>
              </Box>
            </CardContent>
          </Card>
        </Box>

    </>
  )
}

===

Update:

Turns out my side note is wrong! I've put a Card inside a Box, which makes the error occurred! Putting the card outside the box fixed the issue for me.


问:
How to make a Jetpack Compose LazyVerticalGrid Not Scrollable
I would like to make a static grid using Jetpack Compose. Currently I am working on Compose Multiplatform and I am having issues with resizing the window - I would like all of my elements in the grid to have a static (square) aspect ratio, like so -

wanted

however on resizing the window I get something like this -

unwanted

which is not the behavior I want. I would rather only see part of the grid and keep the aspect ratio the same.

I was thinking the best way to do this would be to make a grid unscrollable in Compose, but not sure how to do this. Here is a code sample:

```<code>     @Composable
//@Preview
fun GridDisplay(
    modifier: Modifier,
    gridSizeX: Int,
    gridSizeY: Int,
    zoom: Int
) {

    val gridBorderSize: Dp = 1.dp

    Box(modifier = Modifier
        .height((zoom * gridSizeY).dp)
        .width((zoom * gridSizeX).dp)
        .border(BorderStroke(gridBorderSize, Color.LightGray))

    ){
        LazyVerticalGrid(
            modifier = Modifier
                .wrapContentSize()
                .padding(gridBorderSize),
            columns = GridCells.Fixed(gridSizeX),
            content = {
                items((gridSizeX * gridSizeY)){ index ->

                    Box(modifier = Modifier
                        .height(zoom.dp)
//                        .width(zoom.dp) doesnt do anything - limited by lazygrid
                        .border(BorderStroke(gridBorderSize, Color.LightGray))
                        .align(Alignment.Center)
                    ){
                        Text(
                            text = "index : $index"
                        )
                    }
                }
            }
        )
    }
</code>```

Body:
I would like to make a static grid using Jetpack Compose. Currently I am working on Compose Multiplatform and I am having issues with resizing the window - I would like all of my elements in the grid to have a static (square) aspect ratio, like so -

wanted

however on resizing the window I get something like this -

unwanted

which is not the behavior I want. I would rather only see part of the grid and keep the aspect ratio the same.

I was thinking the best way to do this would be to make a grid unscrollable in Compose, but not sure how to do this. Here is a code sample:

     @Composable
//@Preview
fun GridDisplay(
    modifier: Modifier,
    gridSizeX: Int,
    gridSizeY: Int,
    zoom: Int
) {

    val gridBorderSize: Dp = 1.dp

    Box(modifier = Modifier
        .height((zoom * gridSizeY).dp)
        .width((zoom * gridSizeX).dp)
        .border(BorderStroke(gridBorderSize, Color.LightGray))

    ){
        LazyVerticalGrid(
            modifier = Modifier
                .wrapContentSize()
                .padding(gridBorderSize),
            columns = GridCells.Fixed(gridSizeX),
            content = {
                items((gridSizeX * gridSizeY)){ index ->

                    Box(modifier = Modifier
                        .height(zoom.dp)
//                        .width(zoom.dp) doesnt do anything - limited by lazygrid
                        .border(BorderStroke(gridBorderSize, Color.LightGray))
                        .align(Alignment.Center)
                    ){
                        Text(
                            text = "index : $index"
                        )
                    }
                }
            }
        )
    }


问:
Module error while running in singularity
Was trying to run a programme build on singularity and was enncountering the following error:

/home/skhatri/anaconda3/envs/alphafold_v_2.3.0/bin/python3: can't find 'main' module in '/lustre/skhatri/alphafold-2.2.4/alphafold-2.2.4/alphafold_singularity'

Can someone help with what the 'main' module is ?

I was trying to build a programme in singulairty and this error appeared during execution of the .sif file in HPC using slurmm job scheduler.


问:
e.g is there is another way to write my echo command for having expected result?
i want to add this line at the end of enter image description heremy configuration file with echo but i didn't have what i expected to be.
i need help is there something can i change in my echo command ?

```<code>commande
</code>```

echo -e "\nlint:\e | \n  set -e\n  yamllint .\n  ansible-lint\n  flake8\n" >> initialize_role/molecule/default/molecule.yml

expected result
what i want

result
what i get

echo -e "\nlint:\e | \n  set -e\n  yamllint .\n  ansible-lint\n  flake8\n" >> initialize_role/molecule/default/molecule.yml

expected result
what i want

result
what i get

Body:
i want to add this line at the end of enter image description heremy configuration file with echo but i didn't have what i expected to be.
i need help is there something can i change in my echo command ?

commande

echo -e "\nlint:\e | \n  set -e\n  yamllint .\n  ansible-lint\n  flake8\n" >> initialize_role/molecule/default/molecule.yml

expected result
what i want

result
what i get

echo -e "\nlint:\e | \n  set -e\n  yamllint .\n  ansible-lint\n  flake8\n" >> initialize_role/molecule/default/molecule.yml

expected result
what i want

result
what i get


问:
Public variabes are unable to fetch its values after using @Refreshscope
I was able to get the public variable assigned in my one of configuration class. But after using the annotation @Refreshscope Im getting null value instead of actual. Im getting the value when using the getter but not getting while accessing like,

```<code>
@Autowired
ConfigProps configProps;

    @RestController
    public class MessageRestController {
    @RequestMapping("/name")
      String getName() {
        return configProps.name;
      }
    }
</code>```

My Configuration class is looks like below,

```<code>@Component
@Configuration
@EnableConfigurationProperties
@ConfigurationProperties
@Getter

public class ConfigProps {

    @Value("${config.name}")
    public name;

}
</code>```

The issue is comes only when annotating the class with @RefreshScope for Spring Config Client. Thank u very much for help in advance.

Body:
I was able to get the public variable assigned in my one of configuration class. But after using the annotation @Refreshscope Im getting null value instead of actual. Im getting the value when using the getter but not getting while accessing like,

@Autowired
ConfigProps configProps;

    @RestController
    public class MessageRestController {
    @RequestMapping("/name")
      String getName() {
        return configProps.name;
      }
    }

My Configuration class is looks like below,

@Component
@Configuration
@EnableConfigurationProperties
@ConfigurationProperties
@Getter

public class ConfigProps {

    @Value("${config.name}")
    public name;

}

The issue is comes only when annotating the class with @RefreshScope for Spring Config Client. Thank u very much for help in advance.


问:
Tinyproxy connects to host machine, maxing out the connection pool
I'm trying to set tinyproxy server in AWS so I can later connect to it from a frontend application I build.

I've installed tinyproxy on an ubuntu machine in AWS. For testing purposes I've configured the external ip address to be the proxy address in my firefox browser and I am able to run traffic through it.

The problem is that after a while tinyproxy refuses to accept new connection. When I'm running service tinyproxy status I'm getting the following line "Maximum number of connections reached. Refusing new connections.". I've set timeout property to 600 and it happened again.

I installed netstat to see what connection are open and this is what I see:

At the bottom of the list I see a similar image, but now the same port numbers that were on local address are on the foreign address:

Notes:

The IP address that is deleted is the external IP address of the AWS machine that tinyproxy is running on. The local address is the private address of the AWS machine.

I can see my "normal" connections from the browser when I am connected and I can see that they are deleted when I close the browsers.

My conf file is:

```<code>User tinyproxy
Group tinyproxy
Port 8888
Timeout 60
DefaultErrorFile "error.txt"
StatFile "stats.json"
LogLevel CONNECT
PidFile "/run/tinyproxy/tinyproxy.pid"
MaxClients 100
LogFile "/var/log/tinyproxy/tinyproxy.log"
Allow 0.0.0.0/0
Allow 127.0.0.1
Allow ::1
ViaProxyName "tinyproxy"
ConnectPort 443
ConnectPort 563
</code>```

I would appreciate any help figuring out what are those connections and how do I prevent them from maxing out my pool.

Body:
I'm trying to set tinyproxy server in AWS so I can later connect to it from a frontend application I build.

I've installed tinyproxy on an ubuntu machine in AWS. For testing purposes I've configured the external ip address to be the proxy address in my firefox browser and I am able to run traffic through it.

The problem is that after a while tinyproxy refuses to accept new connection. When I'm running service tinyproxy status I'm getting the following line "Maximum number of connections reached. Refusing new connections.". I've set timeout property to 600 and it happened again.

I installed netstat to see what connection are open and this is what I see:

At the bottom of the list I see a similar image, but now the same port numbers that were on local address are on the foreign address:

Notes:

The IP address that is deleted is the external IP address of the AWS machine that tinyproxy is running on. The local address is the private address of the AWS machine.

I can see my "normal" connections from the browser when I am connected and I can see that they are deleted when I close the browsers.

My conf file is:

User tinyproxy
Group tinyproxy
Port 8888
Timeout 60
DefaultErrorFile "error.txt"
StatFile "stats.json"
LogLevel CONNECT
PidFile "/run/tinyproxy/tinyproxy.pid"
MaxClients 100
LogFile "/var/log/tinyproxy/tinyproxy.log"
Allow 0.0.0.0/0
Allow 127.0.0.1
Allow ::1
ViaProxyName "tinyproxy"
ConnectPort 443
ConnectPort 563

I would appreciate any help figuring out what are those connections and how do I prevent them from maxing out my pool.


问:
How Akamei is packaging HLS and DASH videos?
Latlert I've been trying to create my own simple streaming service which converts an mp4 video to HLS or DASH. For the sake of simplicity, let's focus on only HLS.

Apple is the the one how created HLS (HTTP Live Streaming) which consists of a different resulotions playlist files, and each file consists of seperate sepemts (ts, mp4 or m4a) each segment is a time range of the original video.

I've noticed the Akamei are using the same mp4 video and a query param range to range over the video segements.

Example of a typical segments playlist:

```<code>#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:6.92,
240p_noaudio_dash1.ts

#EXT-X-ENDLIST
</code>```

Example of Akamei playlist:

```<code>#EXTM3U
#EXT-X-VERSION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:6
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=0-830"
#EXTINF:6.066667
../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=5975-2400598
#EXTINF:6.066667
../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=2400599-4512749
#EXTINF:6.033333
../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=4512750-6575755
#EXTINF:6.066667
../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=6575756-8651671
#EXT-X-ENDLIST
</code>```

How Akamei is gementing the same video on the fly to stream HLS and DASH?

I searched and read the HLS Specifications with no luck.

Body:
Latlert I've been trying to create my own simple streaming service which converts an mp4 video to HLS or DASH. For the sake of simplicity, let's focus on only HLS.

Apple is the the one how created HLS (HTTP Live Streaming) which consists of a different resulotions playlist files, and each file consists of seperate sepemts (ts, mp4 or m4a) each segment is a time range of the original video.

I've noticed the Akamei are using the same mp4 video and a query param range to range over the video segements.

Example of a typical segments playlist:

#EXTM3U
#EXT-X-TARGETDURATION:6
#EXT-X-VERSION:3
#EXT-X-MEDIA-SEQUENCE:1
#EXT-X-INDEPENDENT-SEGMENTS
#EXTINF:6.92,
240p_noaudio_dash1.ts

#EXT-X-ENDLIST

Example of Akamei playlist:

#EXTM3U
#EXT-X-VERSION:6
#EXT-X-MEDIA-SEQUENCE:0
#EXT-X-TARGETDURATION:6
#EXT-X-PLAYLIST-TYPE:VOD
#EXT-X-MAP:URI="../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=0-830"
#EXTINF:6.066667
../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=5975-2400598
#EXTINF:6.066667
../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=2400599-4512749
#EXTINF:6.033333
../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=4512750-6575755
#EXTINF:6.066667
../../../parcel/video/78619exa.mp4?r=dXMtd2VzdDE%3D&range=6575756-8651671
#EXT-X-ENDLIST

How Akamei is gementing the same video on the fly to stream HLS and DASH?

I searched and read the HLS Specifications with no luck.


问:
How to extract all user's email id under a workspace domain?
I want to extract all employees email id under our company workspace domain and I want to get them without using Admin SDK Api. Somebody please help me

The best way I vape found on the web was to use Admin SDK Api but my company's system admin is not willing to give me the credentials because it is capable of doing more than what I ask for.