问:
Share avariable from a class, that starts a diffrent class in threads, to threads
To simplify my question, I'm working here with 2 dummy classes.
Now let's assume, I have these classes:

```<code>import threading
import random
import time

class Engine:
    def __init__(self, ticker, args):
        pass

    def run(self):
        ... #<- Trading simulation
        self.balance += trade_return #<- this is the same variable as the otehr one with this comment

class Main:
    def __init__(self):
        self.balance = 1000 #<- this is the same variable as the otehr one with this comment
        self.tickers = ['BTCBUSD', 'ETHBUSD']
        self.args    = {'example_arg1':12, 'example_arg2':13}

    def launch_worker(self):
        threadlist = []
        for t in self.tickers:
            E = Engine(t, self.args)
            thread = threading.Thread(target=E.run, args=())
            threadlist.append(thread)

        for thread in threadlist:
            thread.start()

        for thread in threadlist:
            thread.join()

M = Main()
M.launch_worker()
</code>```

The variable I want to edit is the one with the comment. Now how would I, thread safe of course, add "trade_return" to this variable?

For better understanding, this is what I want the code to do, of the Main class would not exist:

```<code>import threading
import random

lock = threading.Lock()

balance = 1000

class Engine:
    def __init__(self, ticker):
        pass

    def run(self):
        global balance
        ... #<- Trading simulation
        trade_return = random.randint(0, 10)
        print(trade_return)
        with lock:
            balance += trade_return #<- this is the same variable as the otehr one with this comment

tickers    = ['BTCBUSD', 'ETHBUSD']
threadlist = []
for t in tickers:
    E = Engine(t)
    thread = threading.Thread(target=E.run, args=())
    threadlist.append(thread)

for thread in threadlist:
    thread.start()

for thread in threadlist:
    thread.join()

print(balance)
</code>```

Thanks in advance.

Body:
To simplify my question, I'm working here with 2 dummy classes.
Now let's assume, I have these classes:

import threading
import random
import time

class Engine:
    def __init__(self, ticker, args):
        pass

    def run(self):
        ... #<- Trading simulation
        self.balance += trade_return #<- this is the same variable as the otehr one with this comment

class Main:
    def __init__(self):
        self.balance = 1000 #<- this is the same variable as the otehr one with this comment
        self.tickers = ['BTCBUSD', 'ETHBUSD']
        self.args    = {'example_arg1':12, 'example_arg2':13}

    def launch_worker(self):
        threadlist = []
        for t in self.tickers:
            E = Engine(t, self.args)
            thread = threading.Thread(target=E.run, args=())
            threadlist.append(thread)

        for thread in threadlist:
            thread.start()

        for thread in threadlist:
            thread.join()

M = Main()
M.launch_worker()

The variable I want to edit is the one with the comment. Now how would I, thread safe of course, add "trade_return" to this variable?

For better understanding, this is what I want the code to do, of the Main class would not exist:

import threading
import random

lock = threading.Lock()

balance = 1000

class Engine:
    def __init__(self, ticker):
        pass

    def run(self):
        global balance
        ... #<- Trading simulation
        trade_return = random.randint(0, 10)
        print(trade_return)
        with lock:
            balance += trade_return #<- this is the same variable as the otehr one with this comment

tickers    = ['BTCBUSD', 'ETHBUSD']
threadlist = []
for t in tickers:
    E = Engine(t)
    thread = threading.Thread(target=E.run, args=())
    threadlist.append(thread)

for thread in threadlist:
    thread.start()

for thread in threadlist:
    thread.join()

print(balance)

Thanks in advance.


来源: stackexchange

问:
Python selenium not being able to slowly scroll to the bottom
I want to scroll down slowly on aliexpress to load all the elements.

The code seems to work on the first page but not on the second page.

while pages > 0:
    # input('next page \n')
    # Wait for the page to load
    wait = WebDriverWait(driver, 10)
    wait.until(EC.presence_of_element_located((By.ID, "search-key")))

    driver.implicitly_wait(10)

    last_height = driver.execute_script("return document.body.scrollHeight")

    while True:
        driver.execute_script("window.scrollBy(0, 800);")
        sleep(1)
        new_height = driver.execute_script("return document.body.scrollHeight")
        if new_height == last_height:
            print(new_height, last_height)
            break
        last_height = new_height

```

I thought that this would work as after the next button is clicked, I waited for the page to load.

ContentLicense: CC BY-SA 4.0

Body:
I want to scroll down slowly on aliexpress to load all the elements.

The code seems to work on the first page but not on the second page.

while pages > 0:
    # input('next page \n')
    # Wait for the page to load
    wait = WebDriverWait(driver, 10)
    wait.until(EC.presence_of_element_located((By.ID, "search-key")))

    driver.implicitly_wait(10)

    last_height = driver.execute_script("return document.body.scrollHeight")

    while True:
        driver.execute_script("window.scrollBy(0, 800);")
        sleep(1)
        new_height = driver.execute_script("return document.body.scrollHeight")
        if new_height == last_height:
            print(new_height, last_height)
            break
        last_height = new_height

I thought that this would work as after the next button is clicked, I waited for the page to load.


问:
GPU Instancing meshes appearing in scene view
What's the criteria for a GPU Instanced mesh to appear in the scene view?

In my project I'm instancing grass and tree leaves with the GPU (through DrawMeshInstancedIndirect). The grass doesn't appear in the scene view but leaves do.

If I had to choose, I'd like everything to appear in scene view. In game view they all appear and look perfect.


问:
How would I test react hooks with async storage cleanly?
Similar to How to test custom async/await hook with react-hooks-testing-library and Testing async custom hooks that useEffect with react-hooks-testing-library but I am trying to get rid of the act warnings (the tests themselves pass).

I have the hook

```<code>import AsyncStorage from "@react-native-async-storage/async-storage";
import {
    Dispatch,
    SetStateAction, useEffect, useState
} from "react";

/**
 * If the value is null on storage it will not use the state.  This is limited to strings.
 * @param storageKey AsyncStorage key
 * @param initialState initial state if not available in the storage.  If it is in the storage the value in the storage will be used.
 */
export function useStoredState(
  storageKey: string,
  initialState: (string | null) | (() => string | null)
): [string | null, Dispatch<SetStateAction<string | null>>] {
  const [state, setState] = useState<string | null>();
  useEffect(() => {
    (async () => {
      if (state === undefined) {
        const val = await AsyncStorage.getItem(storageKey);
        if (val !== null) {
          setState(val);
        } else {
          setState(initialState);
        }
      } else if (state === null) {
        await AsyncStorage.removeItem(storageKey);
      } else {
        await AsyncStorage.setItem(storageKey, state);
      }
    })();
  }, [storageKey, setState, state]);
  if (state === undefined && typeof initialState === "function") {
    return [
      initialState(),
      setState as Dispatch<SetStateAction<string | null>>,
    ];
  } else if (state === undefined && typeof initialState !== "function") {
    return [initialState, setState as Dispatch<SetStateAction<string | null>>];
  } else {
    return [
      state as string | null,
      setState as Dispatch<SetStateAction<string | null>>,
    ];
  }
}
</code>```

I mocked AsyncStorage as follows

```<code>import AsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock';
export default AsyncStorage;
</code>```

The test I have that works but has act errors is.

```<code>it.only("should work like normal with async storage check", async () => {
  const { result, unmount } = renderHook(() => useStoredState("foo", "bar"));
  let [state, setState] = result.current;
  expect(state).toBe("bar");
  act(() => setState("foo"));
  [state] = result.current;
  expect(state).toBe("foo");
  expect(await AsyncStorage.getItem("foo")).toBe("foo");
  unmount();
});

</code>```

I have more complicated tests that use await waitForNextUpdate(), but this is the simplest one that shows the problem.

Body:
Similar to How to test custom async/await hook with react-hooks-testing-library and Testing async custom hooks that useEffect with react-hooks-testing-library but I am trying to get rid of the act warnings (the tests themselves pass).

I have the hook

import AsyncStorage from "@react-native-async-storage/async-storage";
import {
    Dispatch,
    SetStateAction, useEffect, useState
} from "react";

/**
 * If the value is null on storage it will not use the state.  This is limited to strings.
 * @param storageKey AsyncStorage key
 * @param initialState initial state if not available in the storage.  If it is in the storage the value in the storage will be used.
 */
export function useStoredState(
  storageKey: string,
  initialState: (string | null) | (() => string | null)
): [string | null, Dispatch<SetStateAction<string | null>>] {
  const [state, setState] = useState<string | null>();
  useEffect(() => {
    (async () => {
      if (state === undefined) {
        const val = await AsyncStorage.getItem(storageKey);
        if (val !== null) {
          setState(val);
        } else {
          setState(initialState);
        }
      } else if (state === null) {
        await AsyncStorage.removeItem(storageKey);
      } else {
        await AsyncStorage.setItem(storageKey, state);
      }
    })();
  }, [storageKey, setState, state]);
  if (state === undefined && typeof initialState === "function") {
    return [
      initialState(),
      setState as Dispatch<SetStateAction<string | null>>,
    ];
  } else if (state === undefined && typeof initialState !== "function") {
    return [initialState, setState as Dispatch<SetStateAction<string | null>>];
  } else {
    return [
      state as string | null,
      setState as Dispatch<SetStateAction<string | null>>,
    ];
  }
}

I mocked AsyncStorage as follows

import AsyncStorage from '@react-native-async-storage/async-storage/jest/async-storage-mock';
export default AsyncStorage;

The test I have that works but has act errors is.

it.only("should work like normal with async storage check", async () => {
  const { result, unmount } = renderHook(() => useStoredState("foo", "bar"));
  let [state, setState] = result.current;
  expect(state).toBe("bar");
  act(() => setState("foo"));
  [state] = result.current;
  expect(state).toBe("foo");
  expect(await AsyncStorage.getItem("foo")).toBe("foo");
  unmount();
});

I have more complicated tests that use await waitForNextUpdate(), but this is the simplest one that shows the problem.


问:
Whenever scrolling on my website really fast some of the content disappears or the screen flashes before loading back in after a second
Whenever I scroll really fast on this page of my website (https://raiyantech.com/Articles.html) the screen flickers white.

It only happens for this one page of my website. Also, chunks of it do not load sometimes on startup. In addition, when zooming out, the page seems to flicker white on the outside for a second before loading back in.

Basically in short when scrolling really fast or zooming out, some parts disappear for like 0.5 seconds before appearing again.

Here are the main parts of the code(Also included the head because not sure but I think it could be a misplacement of files but changing the placement did not work).

Also here is a 4-second video of me reproducing the problem:
Short Video of Problem

body {
  background-color: black;
  background: #0f0c29;
  /* fallback for old browsers */
  background: -webkit-linear-gradient(to right, #24243e, #302b63, #0f0c29) background: linear-gradient(to right, #24243e, #302b63, #0f0c29);
  color: white;
}

.nav-link {
  color: rgb(255, 255, 255) !important;
}

.nav-link:hover {
  color: rgb(64, 0, 255) !important;
  text-shadow: 1px 1px 2px rgb(255, 255, 255), 0 0 1em rgb(255, 21, 0), 0 0 0.2em rgb(0, 157, 255);
}

.navbar-brand {
  color: rgb(255, 255, 255) !important;
  text-shadow: 1px 1px 2px red, 0 0 1em blue, 0 0 0.2em blue;
}

.col-glass-blur {
  text-align: center;
  margin: 10px;
  padding: 10px;
  border-radius: 25px;
  -webkit-box-shadow: 10px 10px 31px 0 rgb(0 0 0 / 80%);
  -moz-box-shadow: 10px 10px 31px 0 rgba(0, 0, 0, 0.8);
  box-shadow: 10px 10px 31px 0 rgb(0 0 0 / 80%);
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
}

.col-glass-blur:hover {
  background-color: rgba(155, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

#card {
  text-decoration: none;
}

h1,
p,
a {
  color: white;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Articles</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="Articles.css">
  <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.9.2/dist/umd/popper.min.js"></script>
  <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/js/bootstrap.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/5.0.1/js/bootstrap.min.js"></script>
</head>

<body>
  <nav class="navbar navbar-expand-lg navbar-light ">
    <div class="container-fluid">
      RaiyanTech
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
            <span class="navbar-toggler-icon"></span>
          </button>
      <div class="collapse navbar-collapse" id="navbarSupportedContent">
        <ul class="navbar-nav ">
          <li class="nav-item">
            Articles
          </li>
        </ul>
      </div>
    </div>
  </nav>
  <div class="conatiner">
    <div class="col-glass-blur">
      <h1>Articles(Click to Visit)</h1>
    </div>
  </div>

    <div class="conatiner" id="cardContainer">
      <div class="col-glass-blur">
        <h1>Programming Guide(2022)</h1>
        <p>This article is a roadmap for learning programming. It is intended for</p>
      </div>
    </div>

    <div class="conatiner" id="cardContainer">
      <div class="col-glass-blur">
        <h1>About Lucid Motors</h1>
        <p>Lucid Motors is an electric car company that has faced challenges</p>
      </div>
    </div>

</body>

</html></code>```

I have had this issue before and I had a weird fix of putting divs with the same background color in the background with high opacities, but I tried that here and it caused another problem with the col-glass-blur container which made the text disappear and the entire screen blurred when scrolling really fast before finally loading back.

The issue is on both mobile and pc. I was wondering if it was a repaint issue or if my bootstrap files were in the wrong place.

I know it is not a browser issue or a device issue because I tested it on quite a few devices and I also tested other pages of my website and other people's website and did not experience this same issue.

I also have a footer but when I delete it the issue persists so I know it is also not the footer.

Body:
Whenever I scroll really fast on this page of my website (https://raiyantech.com/Articles.html) the screen flickers white.

It only happens for this one page of my website. Also, chunks of it do not load sometimes on startup. In addition, when zooming out, the page seems to flicker white on the outside for a second before loading back in.

Basically in short when scrolling really fast or zooming out, some parts disappear for like 0.5 seconds before appearing again.

Here are the main parts of the code(Also included the head because not sure but I think it could be a misplacement of files but changing the placement did not work).

Also here is a 4-second video of me reproducing the problem:
Short Video of Problem

body {
  background-color: black;
  background: #0f0c29;
  /* fallback for old browsers */
  background: -webkit-linear-gradient(to right, #24243e, #302b63, #0f0c29) background: linear-gradient(to right, #24243e, #302b63, #0f0c29);
  color: white;
}

.nav-link {
  color: rgb(255, 255, 255) !important;
}

.nav-link:hover {
  color: rgb(64, 0, 255) !important;
  text-shadow: 1px 1px 2px rgb(255, 255, 255), 0 0 1em rgb(255, 21, 0), 0 0 0.2em rgb(0, 157, 255);
}

.navbar-brand {
  color: rgb(255, 255, 255) !important;
  text-shadow: 1px 1px 2px red, 0 0 1em blue, 0 0 0.2em blue;
}

.col-glass-blur {
  text-align: center;
  margin: 10px;
  padding: 10px;
  border-radius: 25px;
  -webkit-box-shadow: 10px 10px 31px 0 rgb(0 0 0 / 80%);
  -moz-box-shadow: 10px 10px 31px 0 rgba(0, 0, 0, 0.8);
  box-shadow: 10px 10px 31px 0 rgb(0 0 0 / 80%);
  background-color: rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(5px);
}

.col-glass-blur:hover {
  background-color: rgba(155, 255, 255, 0.2);
  backdrop-filter: blur(10px);
}

#card {
  text-decoration: none;
}

h1,
p,
a {
  color: white;
}

<!DOCTYPE html>

  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Articles</title>
  <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.1/dist/css/bootstrap.min.css" rel="stylesheet">
  <link rel="stylesheet" href="Articles.css">

      RaiyanTech
      <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">

          </button>

            Articles

Articles(Click to Visit)

Programming Guide(2022)

This article is a roadmap for learning programming. It is intended for

About Lucid Motors

Lucid Motors is an electric car company that has faced challenges

I have had this issue before and I had a weird fix of putting divs with the same background color in the background with high opacities, but I tried that here and it caused another problem with the col-glass-blur container which made the text disappear and the entire screen blurred when scrolling really fast before finally loading back.

The issue is on both mobile and pc. I was wondering if it was a repaint issue or if my bootstrap files were in the wrong place.

I know it is not a browser issue or a device issue because I tested it on quite a few devices and I also tested other pages of my website and other people's website and did not experience this same issue.

I also have a footer but when I delete it the issue persists so I know it is also not the footer.


问:
spotipy accessing data of an account associated with a client id, not the logged-in user
On Flask, I want to use Spotify's unofficial API, spotipy, for login authentication. After login, I want to get the user's library information, but instead, I get the data of the account associated with the Client id, not logged-in users.

And the weird thing is that in the follwing code, I get the same return from token_test and token_info.

```<code>sp_oauth = create_spotify_oauth()
code = request.args.get('code')
token_info = sp_oauth.get_access_token(code)
token_test = sp_oauth.get_access_token()
</code>```

I thought token_test should be the token information of logged-in user because I give it code, but I get the information of the account associated with the Client id.

the following information might not be regarding to this problem

I deleted .cache for just a experiment. Then, after logging in, the authentication URL began to open in multiple tabs, and every time I deleted one tab, another one would open, a behavior I don't understand.

the tab opens when the program hit
token_test = sp_oauth.get_access_token() then it goes back to the start of redirect.

full code around the auth

```<code>@app.route('/login', methods=['POST'])
def login():
  sp_oauth = create_spotify_oauth()
  auth_url = sp_oauth.get_authorize_url()
  return redirect(auth_url)

@app.route('/redirect')
def redirectPage():
  sp_oauth = create_spotify_oauth()
  session.clear()
  code = request.args.get('code')

  if not code is None:
    token_test = sp_oauth.get_access_token()
    print(token_test)
    token_info = sp_oauth.get_access_token(code)
    print(token_info)

    session[TOKEN_INFO] = token_info
  return redirect(url_for('loading', _external=True))
</code>```

Body:
On Flask, I want to use Spotify's unofficial API, spotipy, for login authentication. After login, I want to get the user's library information, but instead, I get the data of the account associated with the Client id, not logged-in users.

And the weird thing is that in the follwing code, I get the same return from token_test and token_info.

sp_oauth = create_spotify_oauth()
code = request.args.get('code')
token_info = sp_oauth.get_access_token(code)
token_test = sp_oauth.get_access_token()

I thought token_test should be the token information of logged-in user because I give it code, but I get the information of the account associated with the Client id.

the following information might not be regarding to this problem

I deleted .cache for just a experiment. Then, after logging in, the authentication URL began to open in multiple tabs, and every time I deleted one tab, another one would open, a behavior I don't understand.

the tab opens when the program hit
token_test = sp_oauth.get_access_token() then it goes back to the start of redirect.

full code around the auth

@app.route('/login', methods=['POST'])
def login():
  sp_oauth = create_spotify_oauth()
  auth_url = sp_oauth.get_authorize_url()
  return redirect(auth_url)

@app.route('/redirect')
def redirectPage():
  sp_oauth = create_spotify_oauth()
  session.clear()
  code = request.args.get('code')

  if not code is None:
    token_test = sp_oauth.get_access_token()
    print(token_test)
    token_info = sp_oauth.get_access_token(code)
    print(token_info)

    session[TOKEN_INFO] = token_info
  return redirect(url_for('loading', _external=True))


问:
Using Selenium to get elements by class name, but I want to limit based on the online status of another class
I am scraping pinnacle.com. Sometimes they have some offline bets and I want to adjust my web scraping to not include the title of the bet if the bet itself is offline. I am making a dataframe and I want the player name to be the index, but I can not do it as the selenium request gets title of the bets that are offline as well as the ones that are online, making the length of the index and data different. I want to be able to differentiate between the two but I am not sure how to do that.

This is my current code that gets all the elements in my list.

driver.get("https://www.pinnacle.com/en/basketball/nba/brooklyn-nets-vs-charlotte-hornets/1564479365#player-props")

#retrieve name of player/type of bet
player_name_bet_search = driver.find_elements(By.CLASS_NAME, "style_titleText__35WhH")

#retrieve over name raw values
odds_name_search = driver.find_elements(By.CLASS_NAME, "style_label__2KJur", "market-btn style_button__34Zqv style_pill__1NXWo style_horizontal__10PLW style_disabled__2uBLz")

#retrieve over odds raw values
odds_values_search = driver.find_elements(By.CLASS_NAME, "style_price__15SlF")
```

I have tried an 'and not' statement but it returns a boolean, and I can't include that as the index. Please help.

Body:
I am scraping pinnacle.com. Sometimes they have some offline bets and I want to adjust my web scraping to not include the title of the bet if the bet itself is offline. I am making a dataframe and I want the player name to be the index, but I can not do it as the selenium request gets title of the bets that are offline as well as the ones that are online, making the length of the index and data different. I want to be able to differentiate between the two but I am not sure how to do that.

This is my current code that gets all the elements in my list.

driver.get("https://www.pinnacle.com/en/basketball/nba/brooklyn-nets-vs-charlotte-hornets/1564479365#player-props")

#retrieve name of player/type of bet
player_name_bet_search = driver.find_elements(By.CLASS_NAME, "style_titleText__35WhH")

#retrieve over name raw values
odds_name_search = driver.find_elements(By.CLASS_NAME, "style_label__2KJur", "market-btn style_button__34Zqv style_pill__1NXWo style_horizontal__10PLW style_disabled__2uBLz")

#retrieve over odds raw values
odds_values_search = driver.find_elements(By.CLASS_NAME, "style_price__15SlF")

I have tried an 'and not' statement but it returns a boolean, and I can't include that as the index. Please help.


问:
Why doesn't my update from Laravel 8 to 9 seem to work?
===================================
UPDATE

As requested, here is the final stacktrace in Laravel.log for this project:

```<code>[2022-12-31 02:24:29] local.ERROR: Target class [db] does not exist. {"exception":"[object] (Illuminate\\Contracts\\Container\\BindingResolutionException(code: 0): Target class [db] does not exist. at C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php:879)
[stacktrace]
#0 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(758): Illuminate\\Container\\Container->build('db')
#1 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(851): Illuminate\\Container\\Container->resolve('db', Array, true)
#2 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(694): Illuminate\\Foundation\\Application->resolve('db', Array)
#3 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(836): Illuminate\\Container\\Container->make('db', Array)
#4 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(1419): Illuminate\\Foundation\\Application->make('db')
#5 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Schema.php(49): Illuminate\\Container\\Container->offsetGet('db')
#6 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(166): Illuminate\\Support\\Facades\\Schema::getFacadeAccessor()
#7 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(255): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()
#8 C:\\Laravel\\blog\\app\\Providers\\AppServiceProvider.php(7): Illuminate\\Support\\Facades\\Facade::__callStatic('defaultStringLe...', Array)
#9 C:\\Laravel\\blog\\vendor\\composer\\ClassLoader.php(571): include('C:\\\\Laravel\\\\blog...')
#10 C:\\Laravel\\blog\\vendor\\composer\\ClassLoader.php(428): Composer\\Autoload\\includeFile('C:\\\\Laravel\\\\blog...')
#11 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(208): Composer\\Autoload\\ClassLoader->loadClass('App\\\\Providers\\\\A...')
#12 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(144): Illuminate\\Foundation\\ProviderRepository->createProvider('App\\\\Providers\\\\A...')
#13 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(61): Illuminate\\Foundation\\ProviderRepository->compileManifest(Array)
#14 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(659): Illuminate\\Foundation\\ProviderRepository->load(Array)
#15 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#16 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(237): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#17 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#18 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#19 C:\\Laravel\\blog\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#20 {main}

[previous exception] [object] (ReflectionException(code: -1): Class \"db\" does not exist at C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php:877)
[stacktrace]
#0 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(877): ReflectionClass->__construct('db')
#1 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(758): Illuminate\\Container\\Container->build('db')
#2 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(851): Illuminate\\Container\\Container->resolve('db', Array, true)
#3 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(694): Illuminate\\Foundation\\Application->resolve('db', Array)
#4 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(836): Illuminate\\Container\\Container->make('db', Array)
#5 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(1419): Illuminate\\Foundation\\Application->make('db')
#6 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Schema.php(49): Illuminate\\Container\\Container->offsetGet('db')
#7 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(166): Illuminate\\Support\\Facades\\Schema::getFacadeAccessor()
#8 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(255): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()
#9 C:\\Laravel\\blog\\app\\Providers\\AppServiceProvider.php(7): Illuminate\\Support\\Facades\\Facade::__callStatic('defaultStringLe...', Array)
#10 C:\\Laravel\\blog\\vendor\\composer\\ClassLoader.php(571): include('C:\\\\Laravel\\\\blog...')
#11 C:\\Laravel\\blog\\vendor\\composer\\ClassLoader.php(428): Composer\\Autoload\\includeFile('C:\\\\Laravel\\\\blog...')
#12 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(208): Composer\\Autoload\\ClassLoader->loadClass('App\\\\Providers\\\\A...')
#13 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(144): Illuminate\\Foundation\\ProviderRepository->createProvider('App\\\\Providers\\\\A...')
#14 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(61): Illuminate\\Foundation\\ProviderRepository->compileManifest(Array)
#15 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(659): Illuminate\\Foundation\\ProviderRepository->load(Array)
#16 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#17 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(237): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#18 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#19 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#20 C:\\Laravel\\blog\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#21 {main}
"}
</code>```

===================================

I am trying to update some Laravel projects from Laravel 8 to 9. The first project updated okay with just a few of the changes from the Update Guide in the docs but my second project is not being so agreeable. This is what I'm getting from my composer update:

```<code>Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
Class App\Http\Controllers\PostController located in C:/Laravel/blog/app\Http\Controllers\PostController.old.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Models\Post located in C:/Laravel/blog/app\Models\Post.old.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Providers\AppServiceProvider located in C:/Laravel/blog/app\Providers\AppServiceProvider.old.php does not comply with psr-4 autoloading standard. Skipping.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Container.php line 879:

  Target class [db] does not exist.

In Container.php line 877:

  Class "db" does not exist

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
</code>```

First, I understand that swiftmailer has been deprecated and that I should be using symfony/mailer instead but my app doesn't do any emailing of any kind nor do I plan to add any emailing functionality to it. My composer.json file doesn't mention swiftmailer either but some other files on my system, none of which I wrote or edited, do reference it so I suppose that's why I'm getting the message recommending replacement of swiftmailer. Can I simply ignore that message or do I need to do something about this message? (I executed the two composer replace commands indicated in the Update Guide but that didn't make this message go away.

Second, I don't understand what I need to do about the three files that don't meet the psr-4 autoloading standards. From what I could find here in StackOverflow, these messages refer to the namespace statement in the file agreeing with the actual location of the file in my project and all three of the files meet that condition. What else do I need to do to make those three messages go away?

Third, am I safe in assuming that this line Illuminate\Foundation\ComposerScripts::postAutoloadDump is not an error message but is just telling me about the progress of the composer update? If it is an error message, what do I do about it?

Fourth, I don't know what to do about the messages about Container.php. I have four files named Container.php in my project, each in different folders, and the only one of them that  even has more than 879 lines and that one does not directly reference 'db' in either line 877 or 879. The file is Illuminate\Container\Container.php and both references are in method build() in the form of a parameter $concrete. I thought initially that this might be Laravel's way of saying that the database was not defined but I have defined the database and referenced it in my .env file. (It used to be in a different instance of XAMPP but got lost when I deleted that instance of XAMPP.) So what do I do about these two messages? I really don't know what I need to do.

As I said, I'm very new to upgrading Laravel so any guidance you could offer would be appreciated.

Body:
===================================
UPDATE

As requested, here is the final stacktrace in Laravel.log for this project:

[2022-12-31 02:24:29] local.ERROR: Target class [db] does not exist. {"exception":"[object] (Illuminate\\Contracts\\Container\\BindingResolutionException(code: 0): Target class [db] does not exist. at C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php:879)
[stacktrace]
#0 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(758): Illuminate\\Container\\Container->build('db')
#1 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(851): Illuminate\\Container\\Container->resolve('db', Array, true)
#2 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(694): Illuminate\\Foundation\\Application->resolve('db', Array)
#3 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(836): Illuminate\\Container\\Container->make('db', Array)
#4 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(1419): Illuminate\\Foundation\\Application->make('db')
#5 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Schema.php(49): Illuminate\\Container\\Container->offsetGet('db')
#6 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(166): Illuminate\\Support\\Facades\\Schema::getFacadeAccessor()
#7 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(255): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()
#8 C:\\Laravel\\blog\\app\\Providers\\AppServiceProvider.php(7): Illuminate\\Support\\Facades\\Facade::__callStatic('defaultStringLe...', Array)
#9 C:\\Laravel\\blog\\vendor\\composer\\ClassLoader.php(571): include('C:\\\\Laravel\\\\blog...')
#10 C:\\Laravel\\blog\\vendor\\composer\\ClassLoader.php(428): Composer\\Autoload\\includeFile('C:\\\\Laravel\\\\blog...')
#11 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(208): Composer\\Autoload\\ClassLoader->loadClass('App\\\\Providers\\\\A...')
#12 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(144): Illuminate\\Foundation\\ProviderRepository->createProvider('App\\\\Providers\\\\A...')
#13 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(61): Illuminate\\Foundation\\ProviderRepository->compileManifest(Array)
#14 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(659): Illuminate\\Foundation\\ProviderRepository->load(Array)
#15 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#16 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(237): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#17 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#18 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#19 C:\\Laravel\\blog\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#20 {main}

[previous exception] [object] (ReflectionException(code: -1): Class \"db\" does not exist at C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php:877)
[stacktrace]
#0 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(877): ReflectionClass->__construct('db')
#1 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(758): Illuminate\\Container\\Container->build('db')
#2 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(851): Illuminate\\Container\\Container->resolve('db', Array, true)
#3 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(694): Illuminate\\Foundation\\Application->resolve('db', Array)
#4 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(836): Illuminate\\Container\\Container->make('db', Array)
#5 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Container\\Container.php(1419): Illuminate\\Foundation\\Application->make('db')
#6 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Schema.php(49): Illuminate\\Container\\Container->offsetGet('db')
#7 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(166): Illuminate\\Support\\Facades\\Schema::getFacadeAccessor()
#8 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Support\\Facades\\Facade.php(255): Illuminate\\Support\\Facades\\Facade::getFacadeRoot()
#9 C:\\Laravel\\blog\\app\\Providers\\AppServiceProvider.php(7): Illuminate\\Support\\Facades\\Facade::__callStatic('defaultStringLe...', Array)
#10 C:\\Laravel\\blog\\vendor\\composer\\ClassLoader.php(571): include('C:\\\\Laravel\\\\blog...')
#11 C:\\Laravel\\blog\\vendor\\composer\\ClassLoader.php(428): Composer\\Autoload\\includeFile('C:\\\\Laravel\\\\blog...')
#12 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(208): Composer\\Autoload\\ClassLoader->loadClass('App\\\\Providers\\\\A...')
#13 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(144): Illuminate\\Foundation\\ProviderRepository->createProvider('App\\\\Providers\\\\A...')
#14 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\ProviderRepository.php(61): Illuminate\\Foundation\\ProviderRepository->compileManifest(Array)
#15 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(659): Illuminate\\Foundation\\ProviderRepository->load(Array)
#16 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Bootstrap\\RegisterProviders.php(17): Illuminate\\Foundation\\Application->registerConfiguredProviders()
#17 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Application.php(237): Illuminate\\Foundation\\Bootstrap\\RegisterProviders->bootstrap(Object(Illuminate\\Foundation\\Application))
#18 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(310): Illuminate\\Foundation\\Application->bootstrapWith(Array)
#19 C:\\Laravel\\blog\\vendor\\laravel\\framework\\src\\Illuminate\\Foundation\\Console\\Kernel.php(127): Illuminate\\Foundation\\Console\\Kernel->bootstrap()
#20 C:\\Laravel\\blog\\artisan(37): Illuminate\\Foundation\\Console\\Kernel->handle(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput))
#21 {main}
"}

===================================

I am trying to update some Laravel projects from Laravel 8 to 9. The first project updated okay with just a few of the changes from the Update Guide in the docs but my second project is not being so agreeable. This is what I'm getting from my composer update:

Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating optimized autoload files
Class App\Http\Controllers\PostController located in C:/Laravel/blog/app\Http\Controllers\PostController.old.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Models\Post located in C:/Laravel/blog/app\Models\Post.old.php does not comply with psr-4 autoloading standard. Skipping.
Class App\Providers\AppServiceProvider located in C:/Laravel/blog/app\Providers\AppServiceProvider.old.php does not comply with psr-4 autoloading standard. Skipping.
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Container.php line 879:

  Target class [db] does not exist.

In Container.php line 877:

  Class "db" does not exist

Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1

First, I understand that swiftmailer has been deprecated and that I should be using symfony/mailer instead but my app doesn't do any emailing of any kind nor do I plan to add any emailing functionality to it. My composer.json file doesn't mention swiftmailer either but some other files on my system, none of which I wrote or edited, do reference it so I suppose that's why I'm getting the message recommending replacement of swiftmailer. Can I simply ignore that message or do I need to do something about this message? (I executed the two composer replace commands indicated in the Update Guide but that didn't make this message go away.

Second, I don't understand what I need to do about the three files that don't meet the psr-4 autoloading standards. From what I could find here in StackOverflow, these messages refer to the namespace statement in the file agreeing with the actual location of the file in my project and all three of the files meet that condition. What else do I need to do to make those three messages go away?

Third, am I safe in assuming that this line Illuminate\Foundation\ComposerScripts::postAutoloadDump is not an error message but is just telling me about the progress of the composer update? If it is an error message, what do I do about it?

Fourth, I don't know what to do about the messages about Container.php. I have four files named Container.php in my project, each in different folders, and the only one of them that  even has more than 879 lines and that one does not directly reference 'db' in either line 877 or 879. The file is Illuminate\Container\Container.php and both references are in method build() in the form of a parameter $concrete. I thought initially that this might be Laravel's way of saying that the database was not defined but I have defined the database and referenced it in my .env file. (It used to be in a different instance of XAMPP but got lost when I deleted that instance of XAMPP.) So what do I do about these two messages? I really don't know what I need to do.

As I said, I'm very new to upgrading Laravel so any guidance you could offer would be appreciated.


问:
Trying to build vue frontend for production. Keep getting code: 'ERR_OSSL_EVP_UNSUPPORTED'? What's this mean?
I want to edit frontend, but when I try to build my edits I get this error:

```<code>opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'
</code>```

I'm using Node.js v19.3.0. This shows with both 'npm run build' and 'npm run serve'...wasn't happening before today. No clue what it means. I've tried searching around online but everything pertains to React.

Body:
I want to edit frontend, but when I try to build my edits I get this error:

opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
  library: 'digital envelope routines',
  reason: 'unsupported',
  code: 'ERR_OSSL_EVP_UNSUPPORTED'

I'm using Node.js v19.3.0. This shows with both 'npm run build' and 'npm run serve'...wasn't happening before today. No clue what it means. I've tried searching around online but everything pertains to React.


问:
Node JS and oracledb returning name of columns instead of values
off the bat I have looked and tried the following

```<code>     https://stackoverflow.com/questions/50679120/oracle-db-select-query-returning-the-data-in-form-of-array-instead-of-json-array
</code>```

^ this is my exact same problem and I have tried the solution and it doesn't work for me.

I also copied the exact same code for as the doucmentation

```<code>     https://github.com/oracle/node-   oracledb/blob/main/examples/example.js#L32:~:text=sql%20%3D%20%60SELECT%20*%20FROM%20no_example%60%3B,rows%2C%20%7B%20depth%3A%20null%20%7D)%3B]
</code>```

and it still doesn't work.

Below is my code which I am using with node v19.3.0, and oracledb 5.5 (please note it does connect to the DB correctly)

```<code>      if (err) {
         console.error(err.message);
         return;
      }
      else{
       options = {
        outFormat: oracledb.OUT_FORMAT_OBJECT,   // query result format
         //extendedMetaData: true               // get extra metadata
       };
       let query = "SELECT * FROM ACCOUNTS";
       binds = {};
       const result = await connection.execute(query, binds, options);
       console.log(result);
       doRelease(connection);
      }
</code>```

from this the output is

```<code>     {
       metaData: [ { name: 'USERNAME' }, { name: 'TOKENS' }, { name: 'PASSWORD' } ],
       rows: []
     }
    Connection released
</code>```

However if I run this exact same query in sql developer (obviously connected to the same DB and with same credentials) I get all accounts... Does anyone know what may be causing this? I am trying to get the values of the fields!

The expected output for this should have been the data inside the table which is 'test' 20, 'test@gmail.com'

Body:
off the bat I have looked and tried the following

     https://stackoverflow.com/questions/50679120/oracle-db-select-query-returning-the-data-in-form-of-array-instead-of-json-array

^ this is my exact same problem and I have tried the solution and it doesn't work for me.

I also copied the exact same code for as the doucmentation

     https://github.com/oracle/node-   oracledb/blob/main/examples/example.js#L32:~:text=sql%20%3D%20%60SELECT%20*%20FROM%20no_example%60%3B,rows%2C%20%7B%20depth%3A%20null%20%7D)%3B]

and it still doesn't work.

Below is my code which I am using with node v19.3.0, and oracledb 5.5 (please note it does connect to the DB correctly)

      if (err) {
         console.error(err.message);
         return;
      }
      else{
       options = {
        outFormat: oracledb.OUT_FORMAT_OBJECT,   // query result format
         //extendedMetaData: true               // get extra metadata
       };
       let query = "SELECT * FROM ACCOUNTS";
       binds = {};
       const result = await connection.execute(query, binds, options);
       console.log(result);
       doRelease(connection);
      }

from this the output is

     {
       metaData: [ { name: 'USERNAME' }, { name: 'TOKENS' }, { name: 'PASSWORD' } ],
       rows: []
     }
    Connection released

However if I run this exact same query in sql developer (obviously connected to the same DB and with same credentials) I get all accounts... Does anyone know what may be causing this? I am trying to get the values of the fields!

The expected output for this should have been the data inside the table which is 'test' 20, 'test@gmail.com'


问:
Writing a buffer of Bitmaps to an AVI file with the Windows API results in a corrupted AVI file
I have a buffer which contains 30 seconds of bitmaps of the user's screen. Since I am making a clipping software which clips the last 30 seconds of the user's screen, I am writing the buffer to an AVI file using the Vfw.h header.

Here is my code:

#include <Windows.h>
#include <Vfw.h>
#include <iostream>
#include <vector>

const int BUFFER_SIZE = 30 * 60; // 30 seconds at 60 fps

int main() {
    RECT desktop;
    const HWND hDesktop = GetDesktopWindow();
    HMONITOR hMonitor = MonitorFromWindow(hDesktop, MONITOR_DEFAULTTOPRIMARY);
    GetWindowRect(hDesktop, &desktop);
    int width = desktop.right;
    int height = desktop.bottom;
    HDC hDC = GetDC(NULL);

    HBITMAP hBitmap = CreateCompatibleBitmap(hDC, width, height);

    HDC hMemDC = CreateCompatibleDC(hDC);
    SelectObject(hMemDC, hBitmap);

    std::vector<HBITMAP> buffer(BUFFER_SIZE);
    int index = 0;

    while (true) {
        BitBlt(hMemDC, 0, 0, width, height, hDC, 0, 0, SRCCOPY);

        buffer[index] = hBitmap;
        index = (index + 1) % BUFFER_SIZE;

        if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) {
            std::cout << "Stopping now" << std::endl;
            break;
        }
    }

    PAVIFILE pFile;
    AVIFileInit();
    AVIFileOpenW(&pFile, L"screen_recording.avi", OF_WRITE | OF_CREATE, NULL);
    PAVISTREAM pStream;
    AVISTREAMINFO streamInfo;
    streamInfo.fccType = streamtypeVIDEO;
    streamInfo.fccHandler = comptypeDIB;
    streamInfo.dwScale = 1;
    streamInfo.dwRate = 60;
    AVIFileCreateStream(pFile, &pStream, &streamInfo);
    AVIStreamSetFormat(pStream, 0, &hBitmap, sizeof(BITMAPINFOHEADER));

    for (int i = 0; i < BUFFER_SIZE; i++) {
        std::cout << "Writing to buffer " << i << std::endl;
        AVIStreamWrite(pStream, i, 1, &buffer[i], sizeof(BITMAPINFOHEADER), AVIIF_KEYFRAME, NULL, NULL);
    }

    AVIStreamClose(pStream);
    AVIFileClose(pFile);

    ReleaseDC(NULL, hDC);
    DeleteDC(hMemDC);
    DeleteObject(hBitmap);

    return 0;
}
```

I am not sure what I have done wrong.

Body:
I have a buffer which contains 30 seconds of bitmaps of the user's screen. Since I am making a clipping software which clips the last 30 seconds of the user's screen, I am writing the buffer to an AVI file using the Vfw.h header.

Here is my code:

#include <Windows.h>
#include <Vfw.h>
#include <iostream>
#include <vector>

const int BUFFER_SIZE = 30 * 60; // 30 seconds at 60 fps

int main() {
    RECT desktop;
    const HWND hDesktop = GetDesktopWindow();
    HMONITOR hMonitor = MonitorFromWindow(hDesktop, MONITOR_DEFAULTTOPRIMARY);
    GetWindowRect(hDesktop, &desktop);
    int width = desktop.right;
    int height = desktop.bottom;
    HDC hDC = GetDC(NULL);

    HBITMAP hBitmap = CreateCompatibleBitmap(hDC, width, height);

    HDC hMemDC = CreateCompatibleDC(hDC);
    SelectObject(hMemDC, hBitmap);

    std::vector<HBITMAP> buffer(BUFFER_SIZE);
    int index = 0;

    while (true) {
        BitBlt(hMemDC, 0, 0, width, height, hDC, 0, 0, SRCCOPY);

        buffer[index] = hBitmap;
        index = (index + 1) % BUFFER_SIZE;

        if (GetAsyncKeyState(VK_ESCAPE) & 0x8000) {
            std::cout << "Stopping now" << std::endl;
            break;
        }
    }

    PAVIFILE pFile;
    AVIFileInit();
    AVIFileOpenW(&pFile, L"screen_recording.avi", OF_WRITE | OF_CREATE, NULL);
    PAVISTREAM pStream;
    AVISTREAMINFO streamInfo;
    streamInfo.fccType = streamtypeVIDEO;
    streamInfo.fccHandler = comptypeDIB;
    streamInfo.dwScale = 1;
    streamInfo.dwRate = 60;
    AVIFileCreateStream(pFile, &pStream, &streamInfo);
    AVIStreamSetFormat(pStream, 0, &hBitmap, sizeof(BITMAPINFOHEADER));

    for (int i = 0; i < BUFFER_SIZE; i++) {
        std::cout << "Writing to buffer " << i << std::endl;
        AVIStreamWrite(pStream, i, 1, &buffer[i], sizeof(BITMAPINFOHEADER), AVIIF_KEYFRAME, NULL, NULL);
    }

    AVIStreamClose(pStream);
    AVIFileClose(pFile);

    ReleaseDC(NULL, hDC);
    DeleteDC(hMemDC);
    DeleteObject(hBitmap);

    return 0;
}

I am not sure what I have done wrong.


问:
Bootstrap's Button Shifts my Other Text Out of the Center
I'm creating one of my first websites and i wanted to place some text in the center. That worked just fine. I typed--

```<code><!DOCTYPE html>
<html>
  <head>
    <title>The Grand Startup</title>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Google Fonts -->
    <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">    <!-- My own stylesheet -->
    <link href="style.css" rel="stylesheet">
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js" integrity="sha384-w76AqPfDkMBDXo30jS1Sgez6pr3x5MlQ1ZAGC+nuZB+EYdgRZgiwxhTBTkF7CXvN" crossorigin="anonymous"></script>
  </head>
  <body>
    <div class="container d-flex align-items-center h-100">
        <div class="row">
          <header class="text-center">
            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
            tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
            quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
            consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
            cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
            proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
          </header>
        </div>
</code>```

So far so good. The problem is that when I tried to add a button from bootstrap my previous text was shifted all the way to the right in a long row. I do not know why the button did not go below the text since that's the order I typed it in. Here's what follows the previous section of coding above--

```<code>
          <section class="text-center col-12">
            <hr>
            <a href="https://mailchi.mp/b65111b901a5/startup">
              <button type="button" class="btn btn-primary">I Want That Email!</button>
            </a>
          </section>
</code>```

Where did I go wrong?

I tried forcing the button to be smaller by providing a max width but it did not have any effect. It's like there's a bigger barrier of some kind that surrounds the button and that is what I cannot change.

Body:
I'm creating one of my first websites and i wanted to place some text in the center. That worked just fine. I typed--

<!DOCTYPE html>

    <title>The Grand Startup</title>

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <link href="https://fonts.googleapis.com/css?family=Montserrat" rel="stylesheet">
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.2.1/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-iYQeCzEYFbKjA/T2uDLTpkwGzCiq6soy8tYaI1GyVh/UjpbCx/TYkiZhlZB6+fzT" crossorigin="anonymous">
    <link href="style.css" rel="stylesheet">

            Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod
            tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam,
            quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo
            consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse
            cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non
            proident, sunt in culpa qui officia deserunt mollit anim id est laborum.

So far so good. The problem is that when I tried to add a button from bootstrap my previous text was shifted all the way to the right in a long row. I do not know why the button did not go below the text since that's the order I typed it in. Here's what follows the previous section of coding above--

              <button type="button" class="btn btn-primary">I Want That Email!</button>

Where did I go wrong?

I tried forcing the button to be smaller by providing a max width but it did not have any effect. It's like there's a bigger barrier of some kind that surrounds the button and that is what I cannot change.


问:
Issue with CLS (Cumulative Layout Shift) only in Desktop site
Cumulative Layout shift of 0.437 on desktop site

I don't understand how this causes or how to fix this..

I tried a lot of things like Disabling all plugins, disabling cloudflare cache, etc... I did make sure that everything has width and height set in css and removed all possible transitions also..

When I disable cloudflare, CLS becomes greater than this.

But, Whenever I purge cache, I don't see any CLS in pagespeed but after sometime its back.. and CLS become 1 sec if i disable cloudflare altogether.

Website: https://irfanhabeeb.com
Pagespeed: https://pagespeed.web.dev/report?url=https%3A%2F%2Firfanhabeeb.com%2Fios-custom-rom%2F&form_factor=desktop

CMS: Wordpress

CSS which causing CLS is

Help me fix it, I tried too many things till now, but nothing fixes this CLS Issue...

I tried disabling cloudflare cache, It makes the CLS even bigger


问:
How to do unsupervised clustering on sentences to find intents

I am working on chatbot for students.

So, I have chatlogs on conversation between student and tutor, which is on mathematical problems (no labels).

First thing I want to find is intents, such as whether given line is problem description from student , doubt from student or greetings.

For which I tried with sentence transformer with math bert to create embeddings and use umap with cosine as metric to do dimensional reduction, and then cluster them using hdbscan to find all intents possible, but the results weren't that great.

Also, tried with zero-shot classification with bart, which did not give better results.

Any idea on what could be better approach?


问:
Python or other libraries to decipher broken up text
I am interested in libraries that can decipher text that is disjointed or broken. Disjointed text can sometimes be the result of OCR extraction from scanned documents.

Google's search functionality can make one or two passes and fix such phrases.

For example, of you Google search for "aut omo tiv etran smiss ionflu id", Google will ask if you mean, "automotive transmission ionflu id". If you search on that phrase, Google will then suggest that you search for "automotive transmission fluid".

Are there readily available libraries that can perform this in Python or Java or other tools? Would these necessarily require online connectivity?

I am looking for assistance in finding tools. (Interestingly, I can't get Google's search function to recognize what I am looking for.)

Regards, James Mireles


Title: Conditional binary ranking

Body:
Lets consider N = 6 bits.

So there are 2^6 = 64 binary combinations.

We want to rank the combinations based on the following condition -

There must be <= k consecutive 0s in the binary number

If there are > k consecutive 0s in the binary number, it is excluded from ranking

How do we go about the method which calculates the rank only by iterating the N bits of the given binary number, and NOT by iterating 2^N numbers.

Can we determine a pattern.

Example 1 (max k = 1 consecutive 0s in 6-digit binary value):

Number      Rank    Binary rank
-------------------------------
000000       0      00000
000001       0      00000
000010       0      00000
000011       0      00000
000100       0      00000
000101       0      00000
000110       0      00000
000111       0      00000
001000       0      00000
001001       0      00000
001010       0      00000
001011       0      00000
001100       0      00000
001101       0      00000
001110       0      00000
001111       0      00000
010000       0      00000
010001       0      00000
010010       0      00000
010011       0      00000
010100       0      00000
010101       1      00001
010110       2      00010
010111       3      00011
011000       0      00000
011001       0      00000
011010       4      00100
011011       5      00101
011100       0      00000
011101       6      00110
011110       7      00111
011111       8      01000
100000       0      00000
100001       0      00000
100010       0      00000
100011       0      00000
100100       0      00000
100101       0      00000
100110       0      00000
100111       0      00000
101000       0      00000
101001       0      00000
101010       9      01001
101011      10      01010
101100       0      00000
101101      11      01011
101110      12      01100
101111      13      01101
110000       0      00000
110001       0      00000
110010       0      00000
110011       0      00000
110100       0      00000
110101      14      01110
110110      15      01111
110111      16      10000
111000       0      00000
111001       0      00000
111010      17      10001
111011      18      10010
111100       0      00000
111101      19      10011
111110      20      10100
111111      21      10101

Example 2 (max 2 consecutive 0s in 6-digit binary value):

Number      Rank    Binary rank
-------------------------------
000000       0      000000
000001       0      000000
000010       0      000000
000011       0      000000
000100       0      000000
000101       0      000000
000110       0      000000
000111       0      000000
001000       0      000000
001001       1      000001
001010       2      000010
001011       3      000011
001100       4      000100
001101       5      000101
001110       6      000110
001111       7      000111
010000       0      000000
010001       0      000000
010010       8      001000
010011       9      001001
010100      10      001010
010101      11      001011
010110      12      001100
010111      13      001101
011000       0      000000
011001      14      001110
011010      15      001111
011011      16      010000
011100      17      010001
011101      18      010010
011110      19      010011
011111      20      010100
100000       0      000000
100001       0      000000
100010       0      000000
100011       0      000000
100100      21      010101
100101      22      010110
100110      23      010111
100111      24      011000
101000       0      000000
101001      25      011001
101010      26      011010
101011      27      011011
101100      28      011100
101101      29      011101
101110      30      011110
101111      31      011111
110000       0      000000
110001       0      000000
110010      32      100000
110011      33      100001
110100      34      100010
110101      35      100011
110110      36      100100
110111      37      100101
111000       0      000000
111001      38      100110
111010      39      100111
111011      40      101000
111100      41      101001
111101      42      101010
111110      43      101011
111111      44      101100

One way is to iterate through all binary combinations, but it is not feasible for large N bits.

Is there a faster way to calculate it only by iterating the N bits of the given binary number.


问:
Single button -webkit-scrollbar-button does not work in OSX browsers
Selectors like these don't seem to work in OSX:

```<code>::-webkit-scrollbar-button:single-button { ... }

::-webkit-scrollbar-button:single-button:vertical:decrement { ... }
</code>```

Removing :single-button results in both the up and down arrows showing at the top AND at the bottom of the scrollbar. These selectors work fine in Window Chrome/IE Edge. Is it possible to get the single up arrow at the top of the scrollbar and a single down arrow at the bottom of the scrollbar in OSX?

Body:
Selectors like these don't seem to work in OSX:

::-webkit-scrollbar-button:single-button { ... }

::-webkit-scrollbar-button:single-button:vertical:decrement { ... }

Removing :single-button results in both the up and down arrows showing at the top AND at the bottom of the scrollbar. These selectors work fine in Window Chrome/IE Edge. Is it possible to get the single up arrow at the top of the scrollbar and a single down arrow at the bottom of the scrollbar in OSX?


问:
NetworkUtility.shouldRetryException: Unexpected response code 403
excuse me, for the first it works fine, when I click "Tambah data/add data" its force close all of sudden, when I check on logcat it's showing this

NetworkUtility.shouldRetryException: Unexpected response code 403 for http://10.0.2.3/folder_kerja/koneksi.php
```
<p><code>koneksi.php</code> was made on separate file, I was trying to connect through MySQL.</p>
<p>could you help me please?</p>
<p>Here's the code</p>
<pre class="lang-kotlin prettyprint-override"><code>package com.example.a2011500069_dwizahranf2

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.*
import com.android.volley.*
import com.android.volley.toolbox.*
import java.net.*
import androidx.recyclerview.widget.*
import org.json.*

class MainActivity : AppCompatActivity() {
    private lateinit var url: String
    private lateinit var sr: StringRequest
    private lateinit var rq: RequestQueue

    private lateinit var rvAlumni: RecyclerView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        title = "E-Book Alumni Universitas XYZ"

        rvAlumni = findViewById(R.id.rvAlumni)
        val btnTambah = findViewById<Button>(R.id.btnTambah)

        rvAlumni.setHasFixedSize(true)
        rvAlumni.layoutManager = LinearLayoutManager(this@MainActivity)

        btnTambah.setOnClickListener {
            startActivity(Intent(this@MainActivity, EntriAlumniActivity::class.java))
        }
    }

    private fun getDefaultGateway(): String? {
        var defaultGateway: String? = null
        try {
            val enumNetworkInterface = NetworkInterface.getNetworkInterfaces()
            while(enumNetworkInterface.hasMoreElements()) {
                val networkInterface = enumNetworkInterface.nextElement()
                val enumInetAddress = networkInterface.inetAddresses
                while(enumInetAddress.hasMoreElements()) {
                    val inetAddress = enumInetAddress.nextElement()
                    if(inetAddress.isSiteLocalAddress) defaultGateway = inetAddress.hostAddress
                }
            }
        } catch (_: SocketException) {
            defaultGateway = null
        }
        return defaultGateway
    }

    override fun onStart() {
        super.onStart()
        val ipSebelumnya = ip
        if (getDefaultGateway() != null) {
            try {
                for (i in 0..255) {
                    val kepalaIp =
                        getDefaultGateway()?.substring(0, getDefaultGateway()?.lastIndexOf(".") ?: -1)
                    val ipTemp = "$kepalaIp.$i"
                    url = "http://$ipTemp/folder_kerja/koneksi.php"
                    sr = StringRequest(Request.Method.GET, url, {
                        if (it.isNotEmpty()) {
                            ip = ipTemp
                            if(ip != ipSebelumnya) {
                                Toast.makeText(
                                    this@MainActivity,
                                    "Terhubung ke $ip",
                                    Toast.LENGTH_SHORT
                                ).show()
                            }
                        }
                    }, null)
                    rq = Volley.newRequestQueue(this@MainActivity)
                    rq.add(sr)
                }
            } catch (_: Exception) {
                ip = "10.0.2.2"
            }
        } else ip = "10.0.2.2"
        tampilData()
    }
    override fun onResume(){
        super.onResume()
        tampilData()
    }
    private fun tampilData(){
        val listAlumni = arrayListOf<Alumni>()
        val adapter = AdapterAlumni(listAlumni, this@MainActivity)

        url = "http://$ip/folder_kerja/tampil.php"
        sr = StringRequest(Request.Method.GET, url, {
            try {
                val obj = JSONObject(it)
                val array = obj.getJSONArray("data")
                for(i in 0 until array.length()) {
                    val ob = array.getJSONObject(i)
                    with(ob) {
                        listAlumni.add(
                            Alumni(
                            getString("nim"),
                            getString("nm_alumni"),
                            getString("prodi"),
                            getString("tmpt_lahir"),
                            getString("tgl_lahir"),
                            getString("alamat"),
                            getString("no_hp"),
                            getInt("thn_lulus")

                        )
                        )
                    }
                }
                rvAlumni.adapter = adapter
            } catch(_: JSONException) {
                Toast.makeText(this@MainActivity, "Tidak ada data...", Toast.LENGTH_LONG).show()
            }
        }, null)
        rq = Volley.newRequestQueue(this@MainActivity)
        rq.add(sr)
    }
}
</code>```

and this koneksi.php

<!doctype html>
<!DOCTYPE html>

<meta charset="utf-8">
<title>Untitled Document</title>

```

I've no idea what should I change, try to remove the url the result was same, changing the IP but theres no change

Body:
excuse me, for the first it works fine, when I click "Tambah data/add data" its force close all of sudden, when I check on logcat it's showing this

NetworkUtility.shouldRetryException: Unexpected response code 403 for http://10.0.2.3/folder_kerja/koneksi.php

koneksi.php was made on separate file, I was trying to connect through MySQL.

could you help me please?

Here's the code

package com.example.a2011500069_dwizahranf2

import android.content.Intent
import androidx.appcompat.app.AppCompatActivity
import android.os.Bundle
import android.widget.*
import com.android.volley.*
import com.android.volley.toolbox.*
import java.net.*
import androidx.recyclerview.widget.*
import org.json.*

class MainActivity : AppCompatActivity() {
    private lateinit var url: String
    private lateinit var sr: StringRequest
    private lateinit var rq: RequestQueue

    private lateinit var rvAlumni: RecyclerView

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        title = "E-Book Alumni Universitas XYZ"

        rvAlumni = findViewById(R.id.rvAlumni)
        val btnTambah = findViewById<Button>(R.id.btnTambah)

        rvAlumni.setHasFixedSize(true)
        rvAlumni.layoutManager = LinearLayoutManager(this@MainActivity)

        btnTambah.setOnClickListener {
            startActivity(Intent(this@MainActivity, EntriAlumniActivity::class.java))
        }
    }

    private fun getDefaultGateway(): String? {
        var defaultGateway: String? = null
        try {
            val enumNetworkInterface = NetworkInterface.getNetworkInterfaces()
            while(enumNetworkInterface.hasMoreElements()) {
                val networkInterface = enumNetworkInterface.nextElement()
                val enumInetAddress = networkInterface.inetAddresses
                while(enumInetAddress.hasMoreElements()) {
                    val inetAddress = enumInetAddress.nextElement()
                    if(inetAddress.isSiteLocalAddress) defaultGateway = inetAddress.hostAddress
                }
            }
        } catch (_: SocketException) {
            defaultGateway = null
        }
        return defaultGateway
    }

    override fun onStart() {
        super.onStart()
        val ipSebelumnya = ip
        if (getDefaultGateway() != null) {
            try {
                for (i in 0..255) {
                    val kepalaIp =
                        getDefaultGateway()?.substring(0, getDefaultGateway()?.lastIndexOf(".") ?: -1)
                    val ipTemp = "$kepalaIp.$i"
                    url = "http://$ipTemp/folder_kerja/koneksi.php"
                    sr = StringRequest(Request.Method.GET, url, {
                        if (it.isNotEmpty()) {
                            ip = ipTemp
                            if(ip != ipSebelumnya) {
                                Toast.makeText(
                                    this@MainActivity,
                                    "Terhubung ke $ip",
                                    Toast.LENGTH_SHORT
                                ).show()
                            }
                        }
                    }, null)
                    rq = Volley.newRequestQueue(this@MainActivity)
                    rq.add(sr)
                }
            } catch (_: Exception) {
                ip = "10.0.2.2"
            }
        } else ip = "10.0.2.2"
        tampilData()
    }
    override fun onResume(){
        super.onResume()
        tampilData()
    }
    private fun tampilData(){
        val listAlumni = arrayListOf<Alumni>()
        val adapter = AdapterAlumni(listAlumni, this@MainActivity)

        url = "http://$ip/folder_kerja/tampil.php"
        sr = StringRequest(Request.Method.GET, url, {
            try {
                val obj = JSONObject(it)
                val array = obj.getJSONArray("data")
                for(i in 0 until array.length()) {
                    val ob = array.getJSONObject(i)
                    with(ob) {
                        listAlumni.add(
                            Alumni(
                            getString("nim"),
                            getString("nm_alumni"),
                            getString("prodi"),
                            getString("tmpt_lahir"),
                            getString("tgl_lahir"),
                            getString("alamat"),
                            getString("no_hp"),
                            getInt("thn_lulus")

                        )
                        )
                    }
                }
                rvAlumni.adapter = adapter
            } catch(_: JSONException) {
                Toast.makeText(this@MainActivity, "Tidak ada data...", Toast.LENGTH_LONG).show()
            }
        }, null)
        rq = Volley.newRequestQueue(this@MainActivity)
        rq.add(sr)
    }
}

and this koneksi.php

<!doctype html>
<!DOCTYPE html>

<meta charset="utf-8">
<title>Untitled Document</title>

I've no idea what should I change, try to remove the url the result was same, changing the IP but theres no change


问:
how to update a table and return all table items without using find method in spring jpa
How can one update a table and return all table items without using find method in spring jpa?

Example:

```<code>    //InetAddress ipAddr = InetAddress.getLocalHost();
    Purchase p = new Purchase();
    //p.setDatebuy(new Date(System.currentTimeMillis()));
    p.setPurchase_id(post.getPurchase_id());
    p.setUserid(post.getUserid());
    p.setType_payment(post.getType_payment());
    p.setActive(post.getActive());
    //p.setIp(ipAddr.getHostAddress());
    Purchase ps = purchaseRepository.save(p);

logger.info(ps.getIp()+">>"+ps.getDatebuy());
</code>```

Body:
How can one update a table and return all table items without using find method in spring jpa?

Example:

    //InetAddress ipAddr = InetAddress.getLocalHost();
    Purchase p = new Purchase();
    //p.setDatebuy(new Date(System.currentTimeMillis()));
    p.setPurchase_id(post.getPurchase_id());
    p.setUserid(post.getUserid());
    p.setType_payment(post.getType_payment());
    p.setActive(post.getActive());
    //p.setIp(ipAddr.getHostAddress());
    Purchase ps = purchaseRepository.save(p);

logger.info(ps.getIp()+">>"+ps.getDatebuy());


问:
how to connect elasticsearch API through elassandra
I am using Elassandra. I want to make setup(windows 10) and hit queries
from elastic search url. I have installed Elassandra and start it is working
fine but  am not able to access elastic search url. I also tried to
configure host and http.port in elasticsearch.yml but it did not work.
From bin am running Cassandra -e. here is no error in logs but still not
able to access ES on localhost:9200
show the following error
curl: (7) Failed to connect to localhost port 9200: Connection refused

How can one connect elasticsearch in elassandra?


问:
How to specify a ProgrammingError exception
Sometimes I get this error when executing a to_sql() statement

Exception: ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near ','. (102) (SQLExecDirectW)")

I know exactly what I'd like to do with this error so I want to catch it, but I can't seem to do so. If I do a catch all, it works, but catching this error specifically hasn't seemed to work. Basically, here's what I've got below.

```<code>from pyodbc import ProgrammingError
try:
    #code
except ProgrammingError:
    #other code
</code>```

At first when I tried specifying the error, it said ProgrammingError wasn't defined so I just thought I'd give the import a shot, but no luck. I'd rather not do a catch all, how can I specify this exception?

Body:
Sometimes I get this error when executing a to_sql() statement

Exception: ProgrammingError: (pyodbc.ProgrammingError) ('42000', "[42000] [Microsoft][ODBC Driver 17 for SQL Server][SQL Server]Incorrect syntax near ','. (102) (SQLExecDirectW)")

I know exactly what I'd like to do with this error so I want to catch it, but I can't seem to do so. If I do a catch all, it works, but catching this error specifically hasn't seemed to work. Basically, here's what I've got below.

from pyodbc import ProgrammingError
try:
    #code
except ProgrammingError:
    #other code

At first when I tried specifying the error, it said ProgrammingError wasn't defined so I just thought I'd give the import a shot, but no luck. I'd rather not do a catch all, how can I specify this exception?


问:
Unity and Firebase Realtime database - How to read value data right from database (Beginning of the game)?
I'm developing a 3D game for Android platform in first person style. I'm using Firebase Realtime database as my data storing source. The idea is that in the beginning of the game, a variable is created to assign to it an instance of the table database itself. The table contains one key with one value only. This value is the number of seconds which is used as a timer straight from the start of the game (2,400 seconds). I want with a function to retrieve this timer float value (2,400) from the data snapshot (The table) for assigning it to another variable and let the timer running.

```<code>public void ReadTimeValue()
   {

   Debug.Log("read db function start");
    dbReference.GetValueAsync()
    .ContinueWithOnMainThread( Task => {
      if (Task.IsFaulted){
        Debug.Log("problem");
      }

      else if (Task.IsCompleted){
        DataSnapshot snapshot = Task.Result;
        Debug.Log(snapshot.Child("room_timer").Child("time_value").Value);
        time_value = (float)snapshot.Child("room_timer").Child("time_value").Value;
        Debug.Log("db import " + time_value);
      }}
    );
    Debug.Log("read db function end");

  }
</code>```

I created a function for it, but without a success. I have read different posts to solve the problem, but still my request doesn't succeed.

Every help/idea regarding the code is appreciated, particularly with the request for the DataSnapshot of the database. Thanks in advance!

Body:
I'm developing a 3D game for Android platform in first person style. I'm using Firebase Realtime database as my data storing source. The idea is that in the beginning of the game, a variable is created to assign to it an instance of the table database itself. The table contains one key with one value only. This value is the number of seconds which is used as a timer straight from the start of the game (2,400 seconds). I want with a function to retrieve this timer float value (2,400) from the data snapshot (The table) for assigning it to another variable and let the timer running.

public void ReadTimeValue()
   {

   Debug.Log("read db function start");
    dbReference.GetValueAsync()
    .ContinueWithOnMainThread( Task => {
      if (Task.IsFaulted){
        Debug.Log("problem");
      }

      else if (Task.IsCompleted){
        DataSnapshot snapshot = Task.Result;
        Debug.Log(snapshot.Child("room_timer").Child("time_value").Value);
        time_value = (float)snapshot.Child("room_timer").Child("time_value").Value;
        Debug.Log("db import " + time_value);
      }}
    );
    Debug.Log("read db function end");

  }

I created a function for it, but without a success. I have read different posts to solve the problem, but still my request doesn't succeed.

Every help/idea regarding the code is appreciated, particularly with the request for the DataSnapshot of the database. Thanks in advance!


问:
can I pass a two integer item in main function in command line?
I want to create a program in C language and in that i want to pass two integer value argument in main function is it possible if is it so how?
because i wrote a code for it it say that is segment fault help me please?

```<code>`#include<stdio.h>

//recurtion power
long rpow(int x, int n){
    if(n == 1)
        return x;
    return x * rpow(x, n-1);
}

int main(int a, int b){

    printf("power of %d^%d is %ld", a,b,rpow(a,b));
    return 0;
}

</code>```

I wrote this code and run it and it give-

mearjuntripathi@imubuntu:~/Documents/Programming/C_C++ Programming/C Programming$ gcc recurtion.c -o recurtion
mearjuntripathi@imubuntu:~/Documents/Programming/C_C++ Programming/C Programming$ ./recurtion 3 4
Segmentation fault (core dumped)
mearjuntripathi@imubuntu:~/Documents/Programming/C_C++ Programming/C Programming$

I want to create a program in C language and in that i want to pass two integer value argument in main function is it possible if is it so how?

Body:
I want to create a program in C language and in that i want to pass two integer value argument in main function is it possible if is it so how?
because i wrote a code for it it say that is segment fault help me please?

`#include<stdio.h>

//recurtion power
long rpow(int x, int n){
    if(n == 1)
        return x;
    return x * rpow(x, n-1);
}

int main(int a, int b){

    printf("power of %d^%d is %ld", a,b,rpow(a,b));
    return 0;
}

I wrote this code and run it and it give-

mearjuntripathi@imubuntu:~/Documents/Programming/C_C++ Programming/C Programming$ gcc recurtion.c -o recurtion
mearjuntripathi@imubuntu:~/Documents/Programming/C_C++ Programming/C Programming$ ./recurtion 3 4
Segmentation fault (core dumped)
mearjuntripathi@imubuntu:~/Documents/Programming/C_C++ Programming/C Programming$

I want to create a program in C language and in that i want to pass two integer value argument in main function is it possible if is it so how?


问:
How to fix pip3 install pygame error in macOS?
This is what happens everytime I run this code "pip3 install pygame"...

```<code>pip3 install pygame

Collecting pygame
  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]

      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using Darwin configuration...

      /bin/sh: sdl2-config: command not found
      /bin/sh: sdl2-config: command not found
      /bin/sh: sdl2-config: command not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/setup.py", line 359, in <module>
          buildconfig.config.main(AUTO_CONFIG)
        File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/buildconfig/config.py", line 225, in main
          deps = CFG.main(**kwds)
                 ^^^^^^^^^^^^^^^^
        File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/buildconfig/config_darwin.py", line 132, in main
          [DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/buildconfig/config_unix.py", line 39, in __init__
          self.ver = config[0].strip()
                     ~~~~~~^^^
      IndexError: list index out of range

      ---
      For help with compilation see:
          https://www.pygame.org/wiki/MacCompile
      To contribute to pygame development see:
          https://www.pygame.org/contribute.html
      ---

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.
</code>```

Just like PortAudio which helps in the installation of pyaudio I want to know which package will help the installation of pygame ??

pyaudio installation also throws same type of error before installation of PortAudio. I install PortAudio which the help of Homebrew by the help of code "brew install portaudio".

I want to know the name of package(like portaudio) which help in the installation of pygame.

Please help....

I tried pip3 install pygame and I was expecting pygame to installed successfully.

Body:
This is what happens everytime I run this code "pip3 install pygame"...

pip3 install pygame

Collecting pygame
  Using cached pygame-2.1.2.tar.gz (10.1 MB)
  Preparing metadata (setup.py) ... error
  error: subprocess-exited-with-error

  × python setup.py egg_info did not run successfully.
  │ exit code: 1
  ╰─> [31 lines of output]

      WARNING, No "Setup" File Exists, Running "buildconfig/config.py"
      Using Darwin configuration...

      /bin/sh: sdl2-config: command not found
      /bin/sh: sdl2-config: command not found
      /bin/sh: sdl2-config: command not found
      Traceback (most recent call last):
        File "<string>", line 2, in <module>
        File "<pip-setuptools-caller>", line 34, in <module>
        File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/setup.py", line 359, in <module>
          buildconfig.config.main(AUTO_CONFIG)
        File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/buildconfig/config.py", line 225, in main
          deps = CFG.main(**kwds)
                 ^^^^^^^^^^^^^^^^
        File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/buildconfig/config_darwin.py", line 132, in main
          [DependencyProg('SDL', 'SDL_CONFIG', 'sdl2-config', '2.0', ['sdl'])],
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
        File "/private/var/folders/tw/hbznyqms4x14ns6ypbmp30_h0000gn/T/pip-install-lv1fsdxk/pygame_bcddb2ed3bf34512afd9ccdced0074b3/buildconfig/config_unix.py", line 39, in __init__
          self.ver = config[0].strip()
                     ~~~~~~^^^
      IndexError: list index out of range

      ---
      For help with compilation see:
          https://www.pygame.org/wiki/MacCompile
      To contribute to pygame development see:
          https://www.pygame.org/contribute.html
      ---

      [end of output]

  note: This error originates from a subprocess, and is likely not a problem with pip.
error: metadata-generation-failed

× Encountered error while generating package metadata.
╰─> See above for output.

note: This is an issue with the package mentioned above, not pip.
hint: See above for details.

Just like PortAudio which helps in the installation of pyaudio I want to know which package will help the installation of pygame ??

pyaudio installation also throws same type of error before installation of PortAudio. I install PortAudio which the help of Homebrew by the help of code "brew install portaudio".

I want to know the name of package(like portaudio) which help in the installation of pygame.

Please help....

I tried pip3 install pygame and I was expecting pygame to installed successfully.


问:
"Error in xml_ns.xml_document(x) : external pointer is not valid"
I'm using the officer package to automate powerpoint reporting but I am encountering the below error:

```<code>"Error in xml_ns.xml_document(x) : external pointer is not valid"
</code>```

when I try to run the code below. Essentially I am trying to bold the word "specifically:" in line 4 of the code below. But when I run it I get that error message. I searched online and it seems to happen within other use cases such as this: Using rvest with drake: external pointer is not valid error

but I don't really understand how to incorporate their code chunk. Can anyone help?

#these 3 lines below create formatting such as bold, font size etc.

```<code>p_normal <- fp_text(font.size = 24)
fp_bold <- update(fp_normal, bold = TRUE) #created the bold option
fp_red <- update(fp_normal, color = "red")

#this line creates an object with the bold option incorporated
studyobjective1 <- block_list(fpar(ftext("Specifically:", fp_bold)),
                              fpar(ftext("red text", fp_red)))

#and this creates the powerpoint slides. I redacted some names but that shouldnt affect your understanding
#as they are text names not functions etc
#begin by adding slides now that we have named all slides in template and placeholders

trial <- df %>%
  add_slide(layout = "study objective", master = "rlayout")  %>%                           #new slide
  ph_with("Study Objective", location = ph_location_label(ph_label = "title")) %>%
  ph_with("Survey Global Sales - Specifically:",
          location = ph_location_label(ph_label = "center object")) %>%
  ph_with(studyobjective1, location = ph_location_label(ph_label = "lower object")) %>%
  print(target = "C:/Users/mi/Desktop/R/PPT/df.pptx")    #save in new location
</code>```

But when I print the powerpoint slide the word "specifically" isn't bolded which should be due to sudyobjective1 object containing the bold formatting. Instead I get the error in the title of this post. Any ideas?

Body:
I'm using the officer package to automate powerpoint reporting but I am encountering the below error:

"Error in xml_ns.xml_document(x) : external pointer is not valid"

when I try to run the code below. Essentially I am trying to bold the word "specifically:" in line 4 of the code below. But when I run it I get that error message. I searched online and it seems to happen within other use cases such as this: Using rvest with drake: external pointer is not valid error

but I don't really understand how to incorporate their code chunk. Can anyone help?

#these 3 lines below create formatting such as bold, font size etc.

p_normal <- fp_text(font.size = 24)
fp_bold <- update(fp_normal, bold = TRUE) #created the bold option
fp_red <- update(fp_normal, color = "red")

#this line creates an object with the bold option incorporated
studyobjective1 <- block_list(fpar(ftext("Specifically:", fp_bold)),
                              fpar(ftext("red text", fp_red)))

#and this creates the powerpoint slides. I redacted some names but that shouldnt affect your understanding
#as they are text names not functions etc
#begin by adding slides now that we have named all slides in template and placeholders

trial <- df %>%
  add_slide(layout = "study objective", master = "rlayout")  %>%                           #new slide
  ph_with("Study Objective", location = ph_location_label(ph_label = "title")) %>%
  ph_with("Survey Global Sales - Specifically:",
          location = ph_location_label(ph_label = "center object")) %>%
  ph_with(studyobjective1, location = ph_location_label(ph_label = "lower object")) %>%
  print(target = "C:/Users/mi/Desktop/R/PPT/df.pptx")    #save in new location

But when I print the powerpoint slide the word "specifically" isn't bolded which should be due to sudyobjective1 object containing the bold formatting. Instead I get the error in the title of this post. Any ideas?


问:
Getting Error : Cannot find name 'T'. using reactjs + material UI
I am trying to customize Dropdown . I am getting Cannot find name 'T'.(2304) why ?

I followed this link
MUI Props giving error: `requires between 4 and 5 type arguments`

here is my code
https://stackblitz.com/edit/react-ts-3mznzx?file=package.json,dropdown.tsx,App.tsx

```<code>import Autocomplete, { AutocompleteProps } from '@mui/material/Autocomplete';
import { styled } from '@mui/material/styles';
import * as React from 'react';

interface StyledAutocompleteProps
  extends AutocompleteProps<
    T,
    boolean | undefined,
    boolean | undefined,
    boolean | undefined
  > {
  error?: boolean;
}

const SmallAutocomplete = (
  props: AutocompleteProps<
    T,
    boolean | undefined,
    boolean | undefined,
    boolean | undefined
  >
) => <Autocomplete {...props} size="small" />;
const YDropDown = styled(SmallAutocomplete)<StyledAutocompleteProps>(
  ({ theme, disabled, error }) => {
    return {};
  }
);

export default YDropDown;
</code>```

Body:
I am trying to customize Dropdown . I am getting Cannot find name 'T'.(2304) why ?

I followed this link
MUI Props giving error: `requires between 4 and 5 type arguments`

here is my code
https://stackblitz.com/edit/react-ts-3mznzx?file=package.json,dropdown.tsx,App.tsx

import Autocomplete, { AutocompleteProps } from '@mui/material/Autocomplete';
import { styled } from '@mui/material/styles';
import * as React from 'react';

interface StyledAutocompleteProps
  extends AutocompleteProps<
    T,
    boolean | undefined,
    boolean | undefined,
    boolean | undefined
  > {
  error?: boolean;
}

const SmallAutocomplete = (
  props: AutocompleteProps<
    T,
    boolean | undefined,
    boolean | undefined,
    boolean | undefined
  >
) => <Autocomplete {...props} size="small" />;
const YDropDown = styled(SmallAutocomplete)