问:
Why next-auth google provider work in development but always returns "Try signing in with a different account" in production?
OAuth login with google fails and always returns "Try signing in with a different account", however it works pretty fine in development.

I have created credentials for my OAuth service

Added the development and production domains:

http://localhost:3000

https://affiliatenetwork.help

Authorized redirect URIs

http://localhost:3000/api/auth/callback/google

https://affiliatenetwork.help/api/auth/callback/google

Set the app to production mode

OAuth consent screen

Scopes

but login only works in a development environment

When I used debug mode "checks.state argument is missing" Error has been raised

[next-auth][error][OAUTH_CALLBACK_ERROR]
https://next-auth.js.org/errors#oauth_callback_error checks.state argument is missing {
error: TypeError: checks.state argument is missing
at Client.callback (/home/emadu/arab-deals/node_modules/openid-client/lib/client.js:387:13)
at oAuthCallback (/home/emadu/arab-deals/node_modules/next-auth/core/lib/oauth/callback.js:127:29)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async Object.callback (/home/emadu/arab-deals/node_modules/next-auth/core/routes/callback.js:52:11)
at async AuthHandlerInternal (/home/emadu/arab-deals/node_modules/next-auth/core/index.js:167:28)
at async AuthHandler (/home/emadu/arab-deals/node_modules/next-auth/core/index.js:309:28)
at async NextAuthHandler (/home/emadu/arab-deals/node_modules/next-auth/next/index.js:24:20)
at async /home/emadu/arab-deals/node_modules/next-auth/next/index.js:50:32
at async Object.apiResolver (/home/emadu/arab-deals/node_modules/next/dist/server/api-utils/node.js:363:9)
at async DevServer.runApi (/home/emadu/arab-deals/node_modules/next/dist/server/next-server.js:474:9) {
name: 'OAuthCallbackError',
code: undefined
},
providerId: 'google',
message: 'checks.state argument is missing'
}


来源: stackexchange

问:
Android Material icon not changing in color despite changing of theme (Kotlin)
I have tried numerous solutions but none seems to work, I have been trying to change the color of the icon I have in a menu, I am working with two activities both of which contains different menus, I have attached two images for references

The image represents the MainActivity Menu, it works fine between light and dark theme

The image represents the SecondActivity Menu, the icons refuses to change its color despite manually specifying the iconTint in the menu xml file

Here is the menu of the secondActivity

```<code><menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
    android:title="More"
    android:icon="@drawable/detail_menu"
    android:iconTint="@color/white"
    app:showAsAction="always">
    <menu>
        <item
            android:id="@+id/browse_news"
            android:title="View Full Article"
            android:iconTint="@color/white"
            android:icon="@drawable/reading_fullarticle"
            app:showAsAction="never" />

        <item
            android:id="@+id/share_news"
            android:title="Share Article"
            android:iconTint="@color/white"
            android:icon="@drawable/read_sharearticle"
            app:showAsAction="never" />

        <item
            android:id="@+id/save_news"
            android:title="Save article"
            android:iconTint="@color/white"
            android:icon="@drawable/read_savearticle"
            app:showAsAction="never" />

    </menu>

</item>
</code>```

Here is an image of how the menu icon is supposed to look like according to the xml, I don't think I have overridden any of the styles in the styles XML. Any clues on why this is happening?

ContentLicense: CC BY-SA 4.0

Body:
I have tried numerous solutions but none seems to work, I have been trying to change the color of the icon I have in a menu, I am working with two activities both of which contains different menus, I have attached two images for references

The image represents the MainActivity Menu, it works fine between light and dark theme

The image represents the SecondActivity Menu, the icons refuses to change its color despite manually specifying the iconTint in the menu xml file

Here is the menu of the secondActivity

<menu xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto">
<item
    android:title="More"
    android:icon="@drawable/detail_menu"
    android:iconTint="@color/white"
    app:showAsAction="always">
    <menu>
        <item
            android:id="@+id/browse_news"
            android:title="View Full Article"
            android:iconTint="@color/white"
            android:icon="@drawable/reading_fullarticle"
            app:showAsAction="never" />

        <item
            android:id="@+id/share_news"
            android:title="Share Article"
            android:iconTint="@color/white"
            android:icon="@drawable/read_sharearticle"
            app:showAsAction="never" />

        <item
            android:id="@+id/save_news"
            android:title="Save article"
            android:iconTint="@color/white"
            android:icon="@drawable/read_savearticle"
            app:showAsAction="never" />

    </menu>

</item>

Here is an image of how the menu icon is supposed to look like according to the xml, I don't think I have overridden any of the styles in the styles XML. Any clues on why this is happening?


问:
Polling Variable Refresh Rate of a Monitor using python
I'm attempting to create a Python tool that polls or displays the real-time VRR values for a monitor that supports VRR (G-Sync or Free-Sync). The code I use to display the monitor's refresh rate, which varies depending on whether the in-game or default refresh rate is changed, is shown below. However, I wanted to poll the real-run refresh rate because it fluctuates depending on the needs of the scenes. How could I  proceed with this?</p>
```<code>import tkinter as tk
import win32api

class RefreshRateMonitor(tk.Tk):
    def __init__(self):
        super().__init__()
        self.label = tk.Label(self, text="Refresh rate:")
        self.label.pack()
        self.refresh_rate_timer = self.after(1000, self.update_refresh_rate)

    def update_refresh_rate(self):
        refresh_rate = get_refresh_rate(None)
        self.label.config(text=f"Refresh rate: {refresh_rate} Hz")
        self.refresh_rate_timer = self.after(1000, self.update_refresh_rate)

def get_refresh_rate(device_name):
    display_settings = win32api.EnumDisplaySettings(device_name, -1)
    refresh_rate = display_settings.DisplayFrequency
    return refresh_rate

app = RefreshRateMonitor()
app.mainloop()
Footer
</code>```

Body:
I'm attempting to create a Python tool that polls or displays the real-time VRR values for a monitor that supports VRR (G-Sync or Free-Sync). The code I use to display the monitor's refresh rate, which varies depending on whether the in-game or default refresh rate is changed, is shown below. However, I wanted to poll the real-run refresh rate because it fluctuates depending on the needs of the scenes. How could I  proceed with this?

import tkinter as tk
import win32api

class RefreshRateMonitor(tk.Tk):
    def __init__(self):
        super().__init__()
        self.label = tk.Label(self, text="Refresh rate:")
        self.label.pack()
        self.refresh_rate_timer = self.after(1000, self.update_refresh_rate)

    def update_refresh_rate(self):
        refresh_rate = get_refresh_rate(None)
        self.label.config(text=f"Refresh rate: {refresh_rate} Hz")
        self.refresh_rate_timer = self.after(1000, self.update_refresh_rate)

def get_refresh_rate(device_name):
    display_settings = win32api.EnumDisplaySettings(device_name, -1)
    refresh_rate = display_settings.DisplayFrequency
    return refresh_rate

app = RefreshRateMonitor()
app.mainloop()
Footer


问:
Laravel Form and Submitting to DB, is there anothe rway for this function
I am creating a vehicle inspection with approx 54 different checks, the form has Red, Amber, Green for the checks and if Red is selected it opens a repeater form where the user can select various defects from a select form.

I have no issues with the form updating the DB but I am just wondering if there is an  easier way to create this function.

Currently I am using this in the InspectionsController

```<code>public function StoreInspection(Request $request, $id) {
    $data = Inspection::find($id);

    $data->external_lights_result = $request->external_lights_result;
    $data->external_lights = $request->external_lights;

    for($i = 0; $i < count($request->external_lights); $i++){}

    $data->dash_lights_result = $request->dash_lights_result;
    $data->dash_lights = $request->dash_lights;

    for($i = 0; $i < count($request->dash_lights); $i++){}

    $data->update();

    $notification = array(
        'message' => 'Inspection Added Successfully',
        'alert-type' => 'success'
    );

    return redirect()->route('frontend.vehicle.view')->with($notification);
}
</code>```

So the question is: do I have to repeat this process 54 times or is there a shortcut or other way I could approach this to reduce the amount of code I will have to write for this single function?

A bit more insight into my code: This is where the user has selected red, amber or green

```<code>$data->external_lights_result = $request->external_lights_result;
</code>```

And obviously this is the Repeater form selections

```<code>$data->external_lights = $request->external_lights;

for($i = 0; $i < count($request->external_lights); $i++){}
</code>```

Any help on this one would be grealty appreicated and if it is the case that I have to repeat this step 54 times then so be it

Thanks

Body:
I am creating a vehicle inspection with approx 54 different checks, the form has Red, Amber, Green for the checks and if Red is selected it opens a repeater form where the user can select various defects from a select form.

I have no issues with the form updating the DB but I am just wondering if there is an  easier way to create this function.

Currently I am using this in the InspectionsController

public function StoreInspection(Request $request, $id) {
    $data = Inspection::find($id);

    $data->external_lights_result = $request->external_lights_result;
    $data->external_lights = $request->external_lights;

    for($i = 0; $i < count($request->external_lights); $i++){}

    $data->dash_lights_result = $request->dash_lights_result;
    $data->dash_lights = $request->dash_lights;

    for($i = 0; $i < count($request->dash_lights); $i++){}

    $data->update();

    $notification = array(
        'message' => 'Inspection Added Successfully',
        'alert-type' => 'success'
    );

    return redirect()->route('frontend.vehicle.view')->with($notification);
}

So the question is: do I have to repeat this process 54 times or is there a shortcut or other way I could approach this to reduce the amount of code I will have to write for this single function?

A bit more insight into my code: This is where the user has selected red, amber or green

$data->external_lights_result = $request->external_lights_result;

And obviously this is the Repeater form selections

$data->external_lights = $request->external_lights;

for($i = 0; $i < count($request->external_lights); $i++){}

Any help on this one would be grealty appreicated and if it is the case that I have to repeat this step 54 times then so be it

Thanks


问:
how to run puppeteer application in replit?
i want to run whatsapp-web.js module in replit using node.js
I tried the program in the library documentation. namely as follows

```<code>const qrcode = require('qrcode-terminal');
const { Client, LocalAuth } = require('whatsapp-web.js');

const client = new Client({
    authStrategy: new LocalAuth()
});

client.on('qr', qr => {
    qrcode.generate(qr, { small: true });
});

client.on('ready', () => {
    console.log('Client is ready!');
});

client.on('message', async msg => {

    const text = msg.body.toLowerCase() || '';

    //check status
    if (text === '!ping') {
        msg.reply('pong');
    }

});

client.initialize();
</code>```

but when run. i get an error like this

```<code>/home/runner/coba-puppeteer/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241
            reject(new Error([
                   ^

Error: Failed to launch the browser process!
/home/runner/coba-puppeteer/node_modules/whatsapp-web.js/node_modules/puppeteer/.local-chromium/linux-982053/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/home/runner/coba-puppeteer/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20)
    at Interface.<anonymous> (/home/runner/coba-puppeteer/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:231:68)
    at Interface.emit (node:events:525:35)
    at Interface.emit (node:domain:489:12)
    at Interface.close (node:readline:590:8)
    at Socket.onend (node:readline:280:10)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1358:12)
repl process died unexpectedly: exit status 1
</code>```

I've found the problem I may be having is that it doesn't have the libraries required by puppeteer on the system. For example, the error message says "libgobject-2.0.so.0" could not be found. It may be a library that puppeteer needs to run. try installing the required libraries by running the following command in your terminal: sudo apt-get install libgobject-2.0-0

however replit cannot use sudo command
with error sudo: The "no new privileges" flag is set, which prevents sudo from running as root.

has anyone ever managed to run a program using whatsapp-web.js in replit?
i am very confused what should i do

the expected output is that it will print the qrcode from whatsapp on the terminal

Body:
i want to run whatsapp-web.js module in replit using node.js
I tried the program in the library documentation. namely as follows

const qrcode = require('qrcode-terminal');
const { Client, LocalAuth } = require('whatsapp-web.js');

const client = new Client({
    authStrategy: new LocalAuth()
});

client.on('qr', qr => {
    qrcode.generate(qr, { small: true });
});

client.on('ready', () => {
    console.log('Client is ready!');
});

client.on('message', async msg => {

    const text = msg.body.toLowerCase() || '';

    //check status
    if (text === '!ping') {
        msg.reply('pong');
    }

});

client.initialize();

but when run. i get an error like this

/home/runner/coba-puppeteer/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241
            reject(new Error([
                   ^

Error: Failed to launch the browser process!
/home/runner/coba-puppeteer/node_modules/whatsapp-web.js/node_modules/puppeteer/.local-chromium/linux-982053/chrome-linux/chrome: error while loading shared libraries: libgobject-2.0.so.0: cannot open shared object file: No such file or directory

TROUBLESHOOTING: https://github.com/puppeteer/puppeteer/blob/main/docs/troubleshooting.md

    at onClose (/home/runner/coba-puppeteer/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:241:20)
    at Interface.<anonymous> (/home/runner/coba-puppeteer/node_modules/whatsapp-web.js/node_modules/puppeteer/lib/cjs/puppeteer/node/BrowserRunner.js:231:68)
    at Interface.emit (node:events:525:35)
    at Interface.emit (node:domain:489:12)
    at Interface.close (node:readline:590:8)
    at Socket.onend (node:readline:280:10)
    at Socket.emit (node:events:525:35)
    at Socket.emit (node:domain:489:12)
    at endReadableNT (node:internal/streams/readable:1358:12)
repl process died unexpectedly: exit status 1

I've found the problem I may be having is that it doesn't have the libraries required by puppeteer on the system. For example, the error message says "libgobject-2.0.so.0" could not be found. It may be a library that puppeteer needs to run. try installing the required libraries by running the following command in your terminal: sudo apt-get install libgobject-2.0-0

however replit cannot use sudo command
with error sudo: The "no new privileges" flag is set, which prevents sudo from running as root.

has anyone ever managed to run a program using whatsapp-web.js in replit?
i am very confused what should i do

the expected output is that it will print the qrcode from whatsapp on the terminal


问:
ReactJs: How to add two reCaptcha on conditional login form and signup form, it shows only one
I have a react app and implementing reCaptcha on the login/signup page initially, signup is not loading after I click on create account button the login hide and signup show and vice-versa.

I added individual reCaptcha for each forms (Login and Signup) If I enable login page the reCaptcha will load for login but for not signup and if I do the same for signup, reCaptcha will not load for login.

I am using this npm package for reCaptcha: https://www.npmjs.com/package/react-google-recaptcha

below is my component:

```<code>import { useState } from "react";
import { useNavigate } from "react-router-dom";
import ReCAPTCHA from "react-google-recaptcha";
import CheckLogin from "./CheckLogin";

function LoginSignup() {
    const reCaptchaKey = process.env.REACT_APP_SITE_KEY;
    const loginEndpoint = process.env.REACT_APP_API_LOGIN_ENDPOINT;

    const [isLoginVerfied, setIsLoginVerified] = useState(false);
    const [isSignupVerfied, setIsSignupVerified] = useState(false);

    const [signupEmail, setSignupEmail] = useState('');
    const [signupPassword, setSignupPassword] = useState('');
    const [signupPasswordConfirm, setSignupPasswordConfirm] = useState('');
    const [signupName, setSignupName] = useState('');

    const [loginEmail, setLoginEmail] = useState('');
    const [loginPassword, setLoginPassword] = useState('');

    const [captchaValue, setCaptchaValue] = useState('');

    const [spinner, setSpinner] = useState(false);

    const [loginStatus, setLoginStatus] = useState(false);

    const [isLoginBlock, setIsLoginBlock] = useState(true);

    const navigate = useNavigate();

    const toggleLoginSignup = () => {
        if (isLoginBlock === true) setIsLoginBlock(false);
        else setIsLoginBlock(true);
    }

    const handleLoginSubmit = async (e) => {
        setSpinner(true)
        e.preventDefault();

        try {
            await fetch(loginEndpoint, {
                method: "POST",
                headers: new Headers({
                    'Content-type': 'application/json',
                    'recaptcha': captchaValue,
                }),
                body: JSON.stringify({
                    username: loginEmail,
                    userpassword: loginPassword
                }),
            }).then(async function (data) {
                let resJson = await data.text();
                localStorage.setItem('login', JSON.stringify({
                    loginStatus: true,
                    token: resJson
                }))
                setLoginStatus(true);
                setSpinner(false)
                navigate("/dashboard");
            });

        }
        catch (err) {
            console.error(err);
            setSpinner(false)
        }
    }
    const recaptchaLogin = (value) => {
        setCaptchaValue(value)
        setIsLoginVerified(true);
    }
    const recaptchaSignup = (value) => {
        setIsSignupVerified(true);
    }

    return (

        <div className="login-page-container">
            <CheckLogin />
            {isLoginBlock ?
                <div className="login-block flex flex-col items-center justify-center">
                    <div className="w-full max-w-4xl p-4 bg-white border border-gray-200 rounded-lg shadow-md sm:p-6 md:p-8 dark:bg-gray-800 dark:border-gray-700">

                        <form className="space-y-6" onSubmit={handleLoginSubmit} method="post">
                            <h5 className="text-xl font-medium text-gray-900 dark:text-white">Welcom to loign.</h5>
                            <div>
                                <label htmlFor="email_login" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white input_label">Your email</label>
                                <input type="email" name="email_login"
                                    value={loginEmail}
                                    onChange={(e) => setLoginEmail(e.target.value)}
                                    id="email_login" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" placeholder="email@company.com" required />
                            </div>
                            <div>
                                <label htmlFor="password" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white input_label">Your password</label>
                                <input type="password" name="password_login"
                                    value={loginPassword}
                                    onChange={(e) => setLoginPassword(e.target.value)}
                                    id="password_login" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />
                            </div>
                            <div className="flex items-start">
                                <div className="flex items-start">
                                    <div className="flex items-center h-5">
                                        <input id="remember" type="checkbox" value="" className="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800" required />
                                    </div>
                                    <label htmlFor="remember" className="ml-2 text-sm font-medium text-gray-900 dark:text-gray-300">Remember me</label>
                                </div>
                                <p className="ml-auto text-sm text-blue-700 hover:underline dark:text-blue-500">Lost Password?</p>
                            </div>

                            <ReCAPTCHA
                                sitekey={reCaptchaKey}
                                onChange={recaptchaLogin}
                                id='login-recaptcha-container'
                            />

                            <div className="flex flex-col items-center">
                                <button type="submit" className="w-full text-white bg-hightlight-700 hover:bg-hightlight-800 focus:ring-4 focus:outline-none focus:ring-hightlight-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-hightlight-600 dark:hover:bg-hightlight-700 dark:focus:ring-hightlight-800 control_button_sign_in_up" disabled={!isLoginVerfied}>
                                    {spinner ?
                                        <svg role="status" className="inline mr-3 w-4 h-4 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
                                            <path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB" />
                                            <path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor" />
                                        </svg> : ''}Login to your account</button>
                            </div>
                            <div className="text-sm font-medium text-gray-500 dark:text-gray-300">
                                Not registered? <span onClick={toggleLoginSignup} className="text-blue-700 hover:underline dark:text-blue-500 clickLink">Create account</span>
                            </div>
                        </form>
                    </div>
                </div >
                :
                <div className="flex flex-col items-center justify-center mx-3 my-3">
                    <div className="w-full max-w-4xl p-4 bg-white border border-gray-200 rounded-lg shadow-md sm:p-6 md:p-8 dark:bg-gray-800 dark:border-gray-700">

                        <form className="space-y-6" onSubmit={handleLoginSubmit} method="post">
                            <h5 id="label_sign-up_header" className="text-center">Registrierung</h5>
                            <h5 className="text-xl font-medium text-gray-900 dark:text-white text-center" id="label_sign-up_description">Welcome to sign up.</h5>
                            <div>
                                <label htmlFor="first_name" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white input_label">Name
                                </label>
                                <input type="text" name="first_name"
                                    value={signupName} onChange={(e) => setSignupName(e.target.value)}
                                    id="first_name" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />
                            </div>
                            <div>
                                <label htmlFor="signup_email" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white input_label">Email</label>
                                <input type="email" name="signup_email" value={signupEmail} onChange={(e) => setSignupEmail(e.target.value)} id="signup_email" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />
                            </div>
                            <div>
                                <label htmlFor="password" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white input_label">Password</label>
                                <input type="password" name="signup_password" value={signupPassword} onChange={(e) => setSignupPassword(e.target.value)} id="signup_password" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />
                            </div>
                            <div>
                                <label htmlFor="password" className="block mb-2 text-sm font-medium text-gray-900 dark:text-white input_label">rePassword
                                </label>
                                <input type="password" name="repeat_password"
                                    value={signupPasswordConfirm} onChange={(e) => setSignupPasswordConfirm(e.target.value)}
                                    id="repeat_password" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />
                            </div>

                            <ReCAPTCHA
                                sitekey={reCaptchaKey}
                                onChange={recaptchaSignup}
                                id='signup-recaptcha-container'
                            />

                            <div className="flex flex-col items-center">
                                <button type="submit" className=" text-white bg-hightlight-700 hover:bg-hightlight-800 focus:ring-4 focus:outline-none focus:ring-hightlight-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-hightlight-600 dark:hover:bg-hightlight-700 dark:focus:ring-hightlight-800 text-center control_button_sign_in_up" disabled={!isSignupVerfied}>Register</button>
                            </div>
                        </form>
                    </div>
                </div>
            }

        </div >
    );
}

export default LoginSignup;
</code>```

Body:
I have a react app and implementing reCaptcha on the login/signup page initially, signup is not loading after I click on create account button the login hide and signup show and vice-versa.

I added individual reCaptcha for each forms (Login and Signup) If I enable login page the reCaptcha will load for login but for not signup and if I do the same for signup, reCaptcha will not load for login.

I am using this npm package for reCaptcha: https://www.npmjs.com/package/react-google-recaptcha

below is my component:

import { useState } from "react";
import { useNavigate } from "react-router-dom";
import ReCAPTCHA from "react-google-recaptcha";
import CheckLogin from "./CheckLogin";

function LoginSignup() {
    const reCaptchaKey = process.env.REACT_APP_SITE_KEY;
    const loginEndpoint = process.env.REACT_APP_API_LOGIN_ENDPOINT;

    const [isLoginVerfied, setIsLoginVerified] = useState(false);
    const [isSignupVerfied, setIsSignupVerified] = useState(false);

    const [signupEmail, setSignupEmail] = useState('');
    const [signupPassword, setSignupPassword] = useState('');
    const [signupPasswordConfirm, setSignupPasswordConfirm] = useState('');
    const [signupName, setSignupName] = useState('');

    const [loginEmail, setLoginEmail] = useState('');
    const [loginPassword, setLoginPassword] = useState('');

    const [captchaValue, setCaptchaValue] = useState('');

    const [spinner, setSpinner] = useState(false);

    const [loginStatus, setLoginStatus] = useState(false);

    const [isLoginBlock, setIsLoginBlock] = useState(true);

    const navigate = useNavigate();

    const toggleLoginSignup = () => {
        if (isLoginBlock === true) setIsLoginBlock(false);
        else setIsLoginBlock(true);
    }

    const handleLoginSubmit = async (e) => {
        setSpinner(true)
        e.preventDefault();

        try {
            await fetch(loginEndpoint, {
                method: "POST",
                headers: new Headers({
                    'Content-type': 'application/json',
                    'recaptcha': captchaValue,
                }),
                body: JSON.stringify({
                    username: loginEmail,
                    userpassword: loginPassword
                }),
            }).then(async function (data) {
                let resJson = await data.text();
                localStorage.setItem('login', JSON.stringify({
                    loginStatus: true,
                    token: resJson
                }))
                setLoginStatus(true);
                setSpinner(false)
                navigate("/dashboard");
            });

        }
        catch (err) {
            console.error(err);
            setSpinner(false)
        }
    }
    const recaptchaLogin = (value) => {
        setCaptchaValue(value)
        setIsLoginVerified(true);
    }
    const recaptchaSignup = (value) => {
        setIsSignupVerified(true);
    }

    return (

            <CheckLogin />
            {isLoginBlock ?

                        <form className="space-y-6" onSubmit={handleLoginSubmit} method="post">

Welcom to loign.

                                Your email
                                <input type="email" name="email_login"
                                    value={loginEmail}
                                    onChange={(e) => setLoginEmail(e.target.value)}
                                    id="email_login" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" placeholder="email@company.com" required />

                                Your password
                                <input type="password" name="password_login"
                                    value={loginPassword}
                                    onChange={(e) => setLoginPassword(e.target.value)}
                                    id="password_login" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />

                                        <input id="remember" type="checkbox" value="" className="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800" required />

                                    Remember me

Lost Password?

                            <ReCAPTCHA
                                sitekey={reCaptchaKey}
                                onChange={recaptchaLogin}
                                id='login-recaptcha-container'
                            />

                                <button type="submit" className="w-full text-white bg-hightlight-700 hover:bg-hightlight-800 focus:ring-4 focus:outline-none focus:ring-hightlight-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-hightlight-600 dark:hover:bg-hightlight-700 dark:focus:ring-hightlight-800 control_button_sign_in_up" disabled={!isLoginVerfied}>
                                    {spinner ?
                                        <svg role="status" className="inline mr-3 w-4 h-4 text-white animate-spin" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
                                            <path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="#E5E7EB" />
                                            <path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentColor" />
                                        </svg> : ''}Login to your account</button>

                                Not registered? Create account

                        </form>

                :

                        <form className="space-y-6" onSubmit={handleLoginSubmit} method="post">

Registrierung

Welcome to sign up.

                                Name

                                <input type="text" name="first_name"
                                    value={signupName} onChange={(e) => setSignupName(e.target.value)}
                                    id="first_name" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />

                                Email
                                <input type="email" name="signup_email" value={signupEmail} onChange={(e) => setSignupEmail(e.target.value)} id="signup_email" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />

                                Password
                                <input type="password" name="signup_password" value={signupPassword} onChange={(e) => setSignupPassword(e.target.value)} id="signup_password" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />

                                rePassword

                                <input type="password" name="repeat_password"
                                    value={signupPasswordConfirm} onChange={(e) => setSignupPasswordConfirm(e.target.value)}
                                    id="repeat_password" className="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-600 dark:border-gray-500 dark:placeholder-gray-400 dark:text-white input-style" required />

                            <ReCAPTCHA
                                sitekey={reCaptchaKey}
                                onChange={recaptchaSignup}
                                id='signup-recaptcha-container'
                            />

                                <button type="submit" className=" text-white bg-hightlight-700 hover:bg-hightlight-800 focus:ring-4 focus:outline-none focus:ring-hightlight-300 font-medium rounded-lg text-sm px-5 py-2.5 dark:bg-hightlight-600 dark:hover:bg-hightlight-700 dark:focus:ring-hightlight-800 text-center control_button_sign_in_up" disabled={!isSignupVerfied}>Register</button>

                        </form>

            }

    );
}

export default LoginSignup;


问:
How to specify python interpreter on windows 10
I have both python 3.11.1 and 3.10.9 installed on my windows 10 system with the appropriate PATH variables configured. I can run python from the command line to access the latest versions interpreter, but python3.10.9, python3.10 and python310 all return with a CommandNotFoundException error. The documentation have led me to believe that using python 3.10.9 would be the correct way to do that, but it seems like this may only apply to unix based systems.

I've tried running C:\Users\user\AppData\Local\Programs\Python\Python310\python as per this thread but that does not work when attempting to pass an argument (e.g. venv) because it treats the second string as path to a file to run with the python executable. C:\Users\operator\AppData\Local\Programs\Python\Python310\python venv app-venv returns:

C:\Users\user\AppData\Local\Programs\Python\Python310\python.exe: can't open file 'D:\app\venv': [Errno 2]
No such file or directory

I am mainly trying to create virtual environments using different python versions, but there may be other reasons I need this in the future.


问:
Is there a way to hide a textfield but keep the keyboard open?
I am creating a PIN input view (basically the same thing as iPhones already have, I just could not find a way to reuse the existing to authenticate my users from my user pool).

I made 4 circles with a stroke that represent the PIN code, when a user taps a button on my custom PIN keyboard, I append the key tapped char to the pinAttemption string and make the circle representing the digit of the PIN filled.

I made a custom keyboard for this with UIKit's UIInputView, that I attach to a custom UITextField and wrap the whole thing in a UIViewRepresentable to expose it in SwiftUI. I make the UITextField firstResponder to make sure the keyboard is presented as soon as the user navigates to the PinInputView.

My plan was that I hide the UITextField and somehow render only the dots.

My problem:

I cannot hide the UITextField with .hidden() as that will also hide the keyboard. I also don't just want to set the opacity to 0, because I guess in that case the user could still tap the field again? I feel like that is not appropriate?

What would be a good way to go about this?

p.s. I am a beginner with SwitUI and UIKit.


问:
PHP/MYSQL: Saving array data in table rows to mysql database using checkbox
I have an order table in my project. I am pulling the products from the database to this table using foreach. I show the quantity and unit price calculation information on the table instantly with jquery. I want to save the data in this table from the row selected with the checkbox to the database. I tried a few things with foreach but it looped so it created a new record for each row in the database. I want to print arrays with implode using commas between them. For example, the data in the rows entered in the quantity field in the table should be entered in the quantity field in the database as 1,2,3,4. If I have to explain briefly, I want to make an insert in one go.

Table:

Table & Form Code:

```<code><form action="" method="POST">
   <table class="table table-sm mb-3 text-center align-middle">
      <thead>
         <tr>
            <th>Choose</th>
            <th>Product Name</th>
            <th width="137px">Quantity</th>
            <th>Unit Price</th>
            <th>Total Price</th>
         </tr>
      </thead>
      <tbody>
         <?php foreach($ProductTbl as $product){ ?>
         <tr>
            <th scope="row">
               <div class="form-check form-check-success">
               <input class="form-check-input" name="check[]" type="checkbox" value="
                  <?= $product-> productid">
                     </div>
                     </th>
                     <td>
                     <?= $product->productname ?>
                  </td>
                  <td>
                  <input class=" w-25 text-center quantity" type="text" name="quantity[]" value="0">
               </td>
            <td>
               <input class="w-25 text-center unitprice" type="text" name="unitprice[]" value="
                  <?= $product->unitprice ?>" disabled="disabled"> €
            </td>
            <td>
               <input class="w-25 text-center totalprice" type="text" name="totalprice[]" value="" disabled="disabled"> €
            </td>
         </tr>
         <?php } ?>
      </tbody>
   </table>
   <div class="text-center">
      <button class="btn btn-success col-md-2" type="submit" name="add">Offer Preview</button>
      <button class="btn btn-warning col-md-1" type="reset">Reset</button>
      <a href="#">
      <button class="btn btn-danger col-md-1" type="button">Cancel</button>
      </a>
   </div>
</form>

//The code structure I tried

if(isset($_POST['add'])){
   $check = $_POST['check'];
   $quantity = implode(',', $_POST['quantity']);
   $totalprice = implode(',', $_POST['totalprice']);

   if (!empty($check)) {
    foreach ($check as $chk => $value){

         // I printed it for testing.
         echo $value.' - product id in the checked checkbox<br>';
         print_r($quantity);
         print_r($totalprice);
       }
   }
}

</code>```

How does this code work the way I want?

Body:
I have an order table in my project. I am pulling the products from the database to this table using foreach. I show the quantity and unit price calculation information on the table instantly with jquery. I want to save the data in this table from the row selected with the checkbox to the database. I tried a few things with foreach but it looped so it created a new record for each row in the database. I want to print arrays with implode using commas between them. For example, the data in the rows entered in the quantity field in the table should be entered in the quantity field in the database as 1,2,3,4. If I have to explain briefly, I want to make an insert in one go.

Table:

Table & Form Code:

<form action="" method="POST">

            Choose
            Product Name
            Quantity
            Unit Price
            Total Price

         <?php foreach($ProductTbl as $product){ ?>

               <input class="form-check-input" name="check[]" type="checkbox" value="
                  <?= $product-> productid">

                     <?= $product->productname ?>

                  <input class=" w-25 text-center quantity" type="text" name="quantity[]" value="0">

               <input class="w-25 text-center unitprice" type="text" name="unitprice[]" value="
                  <?= $product->unitprice ?>" disabled="disabled"> €

               <input class="w-25 text-center totalprice" type="text" name="totalprice[]" value="" disabled="disabled"> €

         <?php } ?>

      <button class="btn btn-success col-md-2" type="submit" name="add">Offer Preview</button>
      <button class="btn btn-warning col-md-1" type="reset">Reset</button>

      <button class="btn btn-danger col-md-1" type="button">Cancel</button>

</form>

//The code structure I tried

if(isset($_POST['add'])){
   $check = $_POST['check'];
   $quantity = implode(',', $_POST['quantity']);
   $totalprice = implode(',', $_POST['totalprice']);

   if (!empty($check)) {
    foreach ($check as $chk => $value){

         // I printed it for testing.
         echo $value.' - product id in the checked checkbox
';
         print_r($quantity);
         print_r($totalprice);
       }
   }
}

How does this code work the way I want?


问:
How can i over come expo error while running on a device?
am having this error after build expo app with EAS. when i run the app using expo start --dev-client i get this error
Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.

I tried re-building but still i am getting the same error. Any assistance?

```<code>
TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNCWebView.isFileUploadSupported')
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:null in handleError
at node_modules\@react-native\polyfills\error-guard.js:null in ErrorUtils.reportFatalError
at node_modules\metro-runtime\src\polyfills\require.js:null in guardedLoadModule
at http://192.168.0.100:8081/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&app=com.futuredesigns.cityfoods&modulesOnly=false&runModule=true:null in global code

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:null in handleError
at node_modules\@react-native\polyfills\error-guard.js:null in ErrorUtils.reportFatalError
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in callFunctionReturnFlushedQueue
</code>```

Body:
am having this error after build expo app with EAS. when i run the app using expo start --dev-client i get this error
Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.

I tried re-building but still i am getting the same error. Any assistance?

TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNCWebView.isFileUploadSupported')
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:null in handleError
at node_modules\@react-native\polyfills\error-guard.js:null in ErrorUtils.reportFatalError
at node_modules\metro-runtime\src\polyfills\require.js:null in guardedLoadModule
at http://192.168.0.100:8081/node_modules/expo/AppEntry.bundle?platform=android&dev=true&minify=false&app=com.futuredesigns.cityfoods&modulesOnly=false&runModule=true:null in global code

Invariant Violation: Failed to call into JavaScript module method AppRegistry.runApplication(). Module has not been registered as callable. Registered callable JavaScript modules (n = 11): Systrace, JSTimers, HeapCapture, SamplingProfiler, RCTLog, RCTDeviceEventEmitter, RCTNativeAppEventEmitter, GlobalPerformanceLogger, JSDevSupportModule, HMRClient, RCTEventEmitter.
        A frequent cause of the error is that the application entry file path is incorrect. This can also happen when the JS bundle is corrupt or there is an early initialization error when loading React Native.
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in reportException
at node_modules\react-native\Libraries\Core\ExceptionsManager.js:null in handleException
at node_modules\react-native\Libraries\Core\setUpErrorHandling.js:null in handleError
at node_modules\@react-native\polyfills\error-guard.js:null in ErrorUtils.reportFatalError
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in __guard
at node_modules\react-native\Libraries\BatchedBridge\MessageQueue.js:null in callFunctionReturnFlushedQueue


问:
Why nuxt.config.js build.babel is ignored on app start, but work on app update?
My nuxt.config.js file has the following section

```<code>  build: {
    babel: {
      presets (_, [_1, _2]) {
        return [['@babel/preset-env', {}]]
      },
      plugins: [
        ['@babel/plugin-transform-runtime',
          {
            regenerator: true
          }]
      ]
    }
  }
</code>```

If I start my app (yarn dev), this section is ignored, and I've got regeneratorRuntime is not defined error instead of backend answer when I call my REST API (server middleware). But if after that (while server is up and running) I perform some changes in nuxt.config.js (i.e. set regenerator to false and then again to true), app is beeing regenerated and my REST API starts working fine.

yarn generate fails with ERROR  ServerMiddleware Error: regeneratorRuntime is not defined

How to make it working always?

Body:
My nuxt.config.js file has the following section

  build: {
    babel: {
      presets (_, [_1, _2]) {
        return [['@babel/preset-env', {}]]
      },
      plugins: [
        ['@babel/plugin-transform-runtime',
          {
            regenerator: true
          }]
      ]
    }
  }

If I start my app (yarn dev), this section is ignored, and I've got regeneratorRuntime is not defined error instead of backend answer when I call my REST API (server middleware). But if after that (while server is up and running) I perform some changes in nuxt.config.js (i.e. set regenerator to false and then again to true), app is beeing regenerated and my REST API starts working fine.

yarn generate fails with ERROR  ServerMiddleware Error: regeneratorRuntime is not defined

How to make it working always?


问:
Django Customer can't be null
I have an issues with the error return 1048, “Column ‘user_id’ cannot be null” and checked the code but can't find any mistake in it, does somebody else have an idea?

…/store/Serializers.py

class Meta:

model = Customer

fields = ['id', 'user_id', 'phone', 'birth_date', 'membership']

…/store/views.py

class CustomerViewSet(CreateModelMixin, RetrieveModelMixin, UpdateModelMixin, GenericViewSet):

queryset = Customer.objects.all()

serializer_class = CustomerSerializer

@action(detail=False, methods=['GET', 'PUT'])

def me(self, request):

(customer, created) = Customer.objects.get_or_create(user_id=request.user.id)

if request.method == 'GET':

serializer = CustomerSerializer(customer)

return Response(serializer.data)

elif request.method == 'PUT':

serializer = CustomerSerializer(customer, data=request.data)

serializer.is_valid(raise_exception=True)

serializer.save()

return Response(serializer.data)

…/store/models.py

class Customer(models.Model):

MEMBERSHIP_BRONZE = ‘B’

MEMBERSHIP_SILVER = ‘S’

MEMBERSHIP_GOLD = ‘G’

MEMBERSHIP_CHOICES = [

(MEMBERSHIP_BRONZE, 'Bronze'),

(MEMBERSHIP_SILVER, 'Silver'),

(MEMBERSHIP_GOLD, 'Gold'),

]

phone = models.CharField(max_length=255)

birth_date = models.DateField(null=True, blank=True)

membership = models.CharField(

max_length=1, choices=MEMBERSHIP_CHOICES, default=MEMBERSHIP_BRONZE)

user = models.OneToOneField(settings.AUTH_USER_MODEL, on_delete=models.CASCADE)

def str(self):

return f'{self.user.first_name} {self.user.last_name}'

@admin.display(ordering='user__first_name')

def first_name(self):

return self.user.first_name

@admin.display(ordering='user__last_name')

def last_name(self):

return self.user.last_name

class Meta:

ordering = ['user__first_name', 'user__last_name']

…/core/serializers.py

class UserCreateSerializer(BaseUserCreateSerializer):

class Meta(BaseUserCreateSerializer.Meta):

fields = [‘id’, ‘username’, ‘password’, ‘email’, ‘first_name’, ‘last_name’]

class UserSerializer(BaseUserSerializer):

class Meta(BaseUserSerializer.Meta):

fields = [‘id’, ‘username’, ‘email’, ‘first_name’, ‘last_name’]

ERROR MESSAGE!!!

Traceback (most recent call last):

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/core/handlers/exception.py”, line 55, in inner

response = get_response(request)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/core/handlers/base.py”, line 197, in _get_response

response = wrapped_callback(request, *callback_args, **callback_kwargs)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/views/decorators/csrf.py”, line 54, in wrapped_view

return view_func(*args, **kwargs)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/viewsets.py”, line 125, in view
return self.dispatch(request, *args, **kwargs)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/views.py”, line 509, in dispatch
response = self.handle_exception(exc)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/views.py”, line 469, in handle_exception
self.raise_uncaught_exception(exc)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/views.py”, line 480, in raise_uncaught_exception
raise exc

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/rest_framework/views.py”, line 506, in dispatch
response = handler(request, *args, **kwargs)

File “/Users/rogerlooser/Documents/Privat_Roger/Schule/Python/storefront/store/views.py”, line 91, in me
(customer, created) = Customer.objects.get_or_create(user_id=request.user.id)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/query.py”, line 935, in get_or_create
return self.create(**params), True

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/query.py”, line 671, in create
obj.save(force_insert=True, using=self.db)
File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/base.py”, line 812, in save
self.save_base(

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/base.py”, line 863, in save_base
updated = self._save_table(

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/base.py”, line 1006, in _save_table
results = self._do_insert(

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/base.py”, line 1047, in _do_insert
return manager._insert(

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/manager.py”, line 85, in manager_method
return getattr(self.get_queryset(), name)(*args, **kwargs)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/query.py”, line 1790, in _insert
return query.get_compiler(using=using).execute_sql(returning_fields)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/models/sql/compiler.py”, line 1660, in execute_sql
cursor.execute(sql, params)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/src/django-debug-toolbar/debug_toolbar/panels/sql/tracking.py”, line 230, in execute
return self._record(self.cursor.execute, sql, params)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/src/django-debug-toolbar/debug_toolbar/panels/sql/tracking.py”, line 154, in _record
return method(sql, params)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/utils.py”, line 103, in execute
return super().execute(sql, params)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/utils.py”, line 67, in execute
return self._execute_with_wrappers(

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/utils.py”, line 80, in _execute_with_wrappers
return executor(sql, params, many, context)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/utils.py”, line 89, in _execute
return self.cursor.execute(sql, params)

File “/Users/rogerlooser/.local/share/virtualenvs/storefront-JGOY8xqq/lib/python3.10/site-packages/django/db/backends/mysql/base.py”, line 80, in execute
raise IntegrityError(*tuple(e.args))

django.db.utils.IntegrityError: (1048, “Column ‘user_id’ cannot be null”)
[26/Dec/2022 15:16:38] “GET /store/customers/me/ HTTP/1.1” 500 206743
/Users/rogerlooser/Documents/Privat_Roger/Schule/Python/storefront/store/views.py changed, reloading.
Watching for file changes with StatReloader
Performing system checks…

Maybe somebody of you guys find the issue

Title: Django Customer can't be null


问:
Flutter iOS app not running after updating Firebase to latest versions - Terminating with uncaught exception of type NSException
After updating Firebase versions, iOS Flutter app does not run (even after building successfully).

The error I'm getting is:

```<code>libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Object for handle already exists: 1'
terminating with uncaught exception of type NSException
</code>```

As of today, these are the latest versions I've updated.

  firebase_core: 2.4.0
  firebase_crashlytics: 3.0.8
  firebase_analytics: 10.0.8
  firebase_performance: 0.9.0+8
  firebase_remote_config: 3.0.8
```

P.S: Android version builds and runs with no problem after this update.

Body:
After updating Firebase versions, iOS Flutter app does not run (even after building successfully).

The error I'm getting is:

libc++abi: terminating with uncaught exception of type NSException
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: 'Object for handle already exists: 1'
terminating with uncaught exception of type NSException

As of today, these are the latest versions I've updated.

  firebase_core: 2.4.0
  firebase_crashlytics: 3.0.8
  firebase_analytics: 10.0.8
  firebase_performance: 0.9.0+8
  firebase_remote_config: 3.0.8

P.S: Android version builds and runs with no problem after this update.


问:
Create a pivot table using a macro
Question) I am recording a macro to create a pivot table, When I am running the macro with a new workbook it gives me Invalid procedure call or argument. I think in Tabledestination the code is picking up the previous file name which is creating this error. I have tried to put new workbook name as a variable in a code. It is still not working. Please someone can help with this. Below is the code.

```<code>  ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "Table1", Version:=8).CreatePivotTable TableDestination:="5list!R12C18", _
        TableName:="PivotTable1", DefaultVersion:=8
</code>```

I have tried to put new workbook name as a variable in a code. It is still not working.

Title: Create a pivot table using a macro

Body:
Question) I am recording a macro to create a pivot table, When I am running the macro with a new workbook it gives me Invalid procedure call or argument. I think in Tabledestination the code is picking up the previous file name which is creating this error. I have tried to put new workbook name as a variable in a code. It is still not working. Please someone can help with this. Below is the code.

  ActiveWorkbook.PivotCaches.Create(SourceType:=xlDatabase, SourceData:= _
        "Table1", Version:=8).CreatePivotTable TableDestination:="5list!R12C18", _
        TableName:="PivotTable1", DefaultVersion:=8

I have tried to put new workbook name as a variable in a code. It is still not working.


问:
How to make the angular renderer act as if animations had been disabled
Question

How do I really disable angular animations for a certain component? (i.e. for part of the DOM)

My goal is to call ViewContainerRef.clear() and for the effect of that (the removal of the child elements) to be immediate. Out-of-the-box it is, but as soon as I add BrowserAnimationsModule or even just NoopAnimationsModule it is delayed (Also see this old, closed issue). Apparently the underlying renderer still operates differently than if the module has never been added.

I've tried adding [@.disabled]="true" to the component as well as calling ChangeDetectorRef.detectChanges() right after clear, but to no avail - the removal is always being delayed.

Why do I want this?

To help solve this issue in my open source lib: https://github.com/lentschi/ngx-nested-ellipsis/issues/17 - Here's the line that doesn't remove the child nodes immediately if any AnimationModule has been imported: https://github.com/lentschi/ngx-nested-ellipsis/blob/v2.1.1/projects/ngx-nested-ellipsis/src/lib/directives/nested-ellipsis.directive.ts#L302 (I could, of course, just make it async by finding out when the elements have actually been removed using a MutationObserver, but that would be very bad for the lib's performance.)


问:
GET request to server `http://desktopName` over LAN through mobile
My app is trying to lock desktop's mouse and keyboard using a mobile app, which is already working.

I am already using the desktop IP but now trying to use http://desktopName as GET URL for my android app but it is not working.

I am using Framework7 app.request.get for my client.

CLIENT

```<code>    // var server = "http://192.168.31.147:8089" // working in mobile browser and app
    var server = "http://desktop-s5n5hiq:8089" // not working in mobile browser and app

    $$("#server").html(server)
    app.request.get(server+"/connect").then((res) => {
      var data = res.data
</code>```

I am using node http module for my server.

SERVER

This server is already working without issue.

```<code>var http = require('http');
var host = "desktop-s5n5hiq"
var port = 8089

http.createServer(function (req, res) {
...
}).listen(port,host,()=>{
    console.log("running server: http://"+host+":"+port)
});
</code>```

My server IP is constantly changing because my router has no IP lock or IP reservation option, that's why I want to use the desktop name instead (http://desktopName), however, I am not getting any response from my server when I use the desktopName

These are already working:

Connect to http://desktopName using desktop and laptop browser

Connect to IPs http://192.168.1.* using desktop, laptop and mobile browser

Not working:

Connect to http://desktopName using mobile browser. (No "Desktop is connected" log)

Any comment is much appreciated.

Edited:

I forgot to mention that we have 2 routers one is an extender. The main one has this 192.168.1.1 DNS server, however, the other has 192.168.31.1. During desktop boot, it sometimes connects to the main router and sometimes to the extender.

I have tried this solution https://kb.netgear.com/27476/How-do-I-set-a-static-IP-address-in-Windows (added 192.168.1.5) but I think it will cause an issue if the PC connected to the extender.

Body:
My app is trying to lock desktop's mouse and keyboard using a mobile app, which is already working.

I am already using the desktop IP but now trying to use http://desktopName as GET URL for my android app but it is not working.

I am using Framework7 app.request.get for my client.

CLIENT

    // var server = "http://192.168.31.147:8089" // working in mobile browser and app
    var server = "http://desktop-s5n5hiq:8089" // not working in mobile browser and app

    $$("#server").html(server)
    app.request.get(server+"/connect").then((res) => {
      var data = res.data

I am using node http module for my server.

SERVER

This server is already working without issue.

var http = require('http');
var host = "desktop-s5n5hiq"
var port = 8089

http.createServer(function (req, res) {
...
}).listen(port,host,()=>{
    console.log("running server: http://"+host+":"+port)
});

My server IP is constantly changing because my router has no IP lock or IP reservation option, that's why I want to use the desktop name instead (http://desktopName), however, I am not getting any response from my server when I use the desktopName

These are already working:

Connect to http://desktopName using desktop and laptop browser

Connect to IPs http://192.168.1.* using desktop, laptop and mobile browser

Not working:

Connect to http://desktopName using mobile browser. (No "Desktop is connected" log)

Any comment is much appreciated.

Edited:

I forgot to mention that we have 2 routers one is an extender. The main one has this 192.168.1.1 DNS server, however, the other has 192.168.31.1. During desktop boot, it sometimes connects to the main router and sometimes to the extender.

I have tried this solution https://kb.netgear.com/27476/How-do-I-set-a-static-IP-address-in-Windows (added 192.168.1.5) but I think it will cause an issue if the PC connected to the extender.


问:
Expo Notification on Android
I have setup the expo push notification in my app. I am able to get the device token for both android and ios in my expo go app. when i publish my app to test-flight i am able to get the device token as well. But when i publish the app to PLaystore for testing i notice the device token is not working because i am saving the token to my laravel backend.

below is my code

```<code>const registerForPushNotificationsAsync = async () => {
</code>```

let token;

if (Device.isDevice) {

```<code>const { status: existingStatus } =
  await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;

if (existingStatus !== "granted") {

  const { status } = await Notifications.requestPermissionsAsync();
  finalStatus = status;
}
if (finalStatus !== "granted") {

  alert("Failed to get push token for push notification!");
  return;
}

token = (await Notifications.getExpoPushTokenAsync()).data;

sendDeviceTokenToBackend(token)
</code>```

} else {

```<code>alert("Must use physical device for Push Notifications");
</code>```

}

if (Platform.OS === "android") {
Notifications.setNotificationChannelAsync("default", {
name: "default",
importance: Notifications.AndroidImportance.MAX,
vibrationPattern: [0, 250, 250, 250],
lightColor: "#FF231F7C",
});
}

return token;
};

Below is the code i use to send to my backend

```<code>const sendDeviceTokenToBackend=(token)={
  const obj = {
     device_token: data,
  };
  const response = await db.communicate(
   "POST",
   "/device/tokens",
   obj,
    "auth"
   );
 }
</code>```

i read a couple of answers on stackoverflow that i need to configure FCM in order for my android noticifation to work. but here i will be using php sdk for my notification configuration so i am saving the device token to the backend. so i have a few questions

if i am to use firebase to save my device token how will i send my device token to my php backend from firebase .

since i will be managing it on my php server instead of expo push notification how do i get the token in andriod when i publish it to playstore
any help on this i will appreciate

Title: Expo Notification on Android

Body:
I have setup the expo push notification in my app. I am able to get the device token for both android and ios in my expo go app. when i publish my app to test-flight i am able to get the device token as well. But when i publish the app to PLaystore for testing i notice the device token is not working because i am saving the token to my laravel backend.

below is my code

const registerForPushNotificationsAsync = async () => {

let token;

if (Device.isDevice) {

const { status: existingStatus } =
  await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;

if (existingStatus !== "granted") {

  const { status } = await Notifications.requestPermissionsAsync();
  finalStatus = status;
}
if (finalStatus !== "granted") {

  alert("Failed to get push token for push notification!");
  return;
}

token = (await Notifications.getExpoPushTokenAsync()).data;

sendDeviceTokenToBackend(token)

} else {

alert("Must use physical device for Push Notifications");

}

if (Platform.OS === "android") {
Notifications.setNotificationChannelAsync("default", {
name: "default",
importance: Notifications.AndroidImportance.MAX,
vibrationPattern: [0, 250, 250, 250],
lightColor: "#FF231F7C",
});
}

return token;
};

Below is the code i use to send to my backend

const sendDeviceTokenToBackend=(token)={
  const obj = {
     device_token: data,
  };
  const response = await db.communicate(
   "POST",
   "/device/tokens",
   obj,
    "auth"
   );
 }

i read a couple of answers on stackoverflow that i need to configure FCM in order for my android noticifation to work. but here i will be using php sdk for my notification configuration so i am saving the device token to the backend. so i have a few questions

if i am to use firebase to save my device token how will i send my device token to my php backend from firebase .

since i will be managing it on my php server instead of expo push notification how do i get the token in andriod when i publish it to playstore
any help on this i will appreciate


问:
url.pathname sending the pathname followed by https,www
I have a URL object that is made from a link. When I generate the object like so

var post = new URL("https://www.reddit.com/r/BetterDiscord/comments/vz6xq7/i_forgot_the_name_of_this_plugin");
```
<p>The pathname is /r/BetterDiscord/comments/vz6xq7/i_forgot_the_name_of_this_plugin,https,www.</p>
<p>and here's the thing. It's only THIS URL (at least as far as I can tell, when generating a different URL (take https://www.reddit.com/r/BetterDiscord/comments/yuoqv/better_discord_plugins/?utm_source=share&utm_medium=web2x&context=3)</p>
<p>it works just fine</p>
<p>(that being the pathname is r/BetterDiscord/comments/yuoqv/better_discord_plugins/)</p>
<p>I have tried bodging it like so</p>
<pre class="lang-js prettyprint-override"><code>Logger.info(url.pathname.split(",")[0])
</code>```

I don't understand why either of them aren't working.

Body:
I have a URL object that is made from a link. When I generate the object like so

var post = new URL("https://www.reddit.com/r/BetterDiscord/comments/vz6xq7/i_forgot_the_name_of_this_plugin");

The pathname is /r/BetterDiscord/comments/vz6xq7/i_forgot_the_name_of_this_plugin,https,www.

and here's the thing. It's only THIS URL (at least as far as I can tell, when generating a different URL (take https://www.reddit.com/r/BetterDiscord/comments/yuoqv/better_discord_plugins/?utm_source=share&utm_medium=web2x&context=3)

it works just fine

(that being the pathname is r/BetterDiscord/comments/yuoqv/better_discord_plugins/)

I have tried bodging it like so

Logger.info(url.pathname.split(",")[0])

I don't understand why either of them aren't working.


问:
why is "t" imported as turtle not working inside the for loop inside while loop neither is "new_turtle" working and its turtle we have to use there
```<code>import random
import turtle as t

is_race_on = False
screen = t.Screen()
screen.setup(width=500, height=400)
user_bet = screen.textinput(title="Make your bet", prompt="Which tutle will win the race? Enter a colour ")
colors = ["red", "orange", "yellow", "green", "blue", "purple"]
y_axis = -100
all_turtles = []

for colour in colors:
    new_turtle = t.Turtle(shape="turtle")
    new_turtle.color(colour)
    new_turtle.pu()
    new_turtle.goto(x=-230, y=y_axis)
    all_turtles.append(new_turtle)
    y_axis += 50

if user_bet:
    is_race_on = True

while is_race_on:
    for turtle in all_turtles:
        distance = random.randint(0, 10)
        turtle.fd(distance)

screen.exitonclick()

</code>```

I was expecting the turtle.forward() should be t.forward() or new_turtle.fd(), but those are not working and it is saying not defined

Body:
import random
import turtle as t

is_race_on = False
screen = t.Screen()
screen.setup(width=500, height=400)
user_bet = screen.textinput(title="Make your bet", prompt="Which tutle will win the race? Enter a colour ")
colors = ["red", "orange", "yellow", "green", "blue", "purple"]
y_axis = -100
all_turtles = []

for colour in colors:
    new_turtle = t.Turtle(shape="turtle")
    new_turtle.color(colour)
    new_turtle.pu()
    new_turtle.goto(x=-230, y=y_axis)
    all_turtles.append(new_turtle)
    y_axis += 50

if user_bet:
    is_race_on = True

while is_race_on:
    for turtle in all_turtles:
        distance = random.randint(0, 10)
        turtle.fd(distance)

screen.exitonclick()

I was expecting the turtle.forward() should be t.forward() or new_turtle.fd(), but those are not working and it is saying not defined


问:
Why is the data lost in the parent constructor?
I have a class like this:

```<code>class BaseApiController extends Controller
{
    protected $user;

    function __construct()
    {
        $this->configHeaderRequest();
        $this->validateToken();
    }

    protected function validateToken()
    {
        $this->middleware(function ($request, $next) {
            if (Auth::guard('web')->user()) {
                $this->user = Auth::guard('web')->user();
            }

            var_dump($this->user); //=> This is "user object" as well

            return $next($request);
        });
    }
}
</code>```

And another class that is extended from the class above:

```<code>class NewsController extends BaseApiController
{
    public function __construct(Request $request)
    {
        parent::__construct($request);

        $this->middleware(function ($request, $next) {
            if (empty($this->user)) {
                return $this->sendFailedResponse('Unauthorized Request', 401);
            }

            return $next($request);
        });
    }

    public function search(Request $request): JsonResponse
    {
        var_dump($this->user); //=> but there is "null"
    }
}
</code>```

As you can see, $this->user will be null when I needed the user's object inside the search(Request $request) method while surprisingly the user's object exists inside the validateToken() method. Why? And how can I access the user's object there?

Body:
I have a class like this:

class BaseApiController extends Controller
{
    protected $user;

    function __construct()
    {
        $this->configHeaderRequest();
        $this->validateToken();
    }

    protected function validateToken()
    {
        $this->middleware(function ($request, $next) {
            if (Auth::guard('web')->user()) {
                $this->user = Auth::guard('web')->user();
            }

            var_dump($this->user); //=> This is "user object" as well

            return $next($request);
        });
    }
}

And another class that is extended from the class above:

class NewsController extends BaseApiController
{
    public function __construct(Request $request)
    {
        parent::__construct($request);

        $this->middleware(function ($request, $next) {
            if (empty($this->user)) {
                return $this->sendFailedResponse('Unauthorized Request', 401);
            }

            return $next($request);
        });
    }

    public function search(Request $request): JsonResponse
    {
        var_dump($this->user); //=> but there is "null"
    }
}

As you can see, $this->user will be null when I needed the user's object inside the search(Request $request) method while surprisingly the user's object exists inside the validateToken() method. Why? And how can I access the user's object there?


问:
How to add android fields to my expo react-native default config?
I have a managed expo project that uses react-native.  I am getting an error when building for android that is essentially this error: https://github.com/dooboolab/react-native-iap/issues/1373

I see the solution is to add the following code to the default config

```<code>{ missingDimensionStrategy 'store', 'play' }
</code>```

I have a managed project, so my default config is not setup like the ones in that thread.  My question is where can i add this missingDimensionStrategy in my project so that it builds for android properly?

Here is my metroconfig.js file, which I think is where i would add something like this, but am unsure how.

```<code>const { getDefaultConfig } = require('expo/metro-config');

const config = getDefaultConfig(__dirname);
module.exports = config;
</code>```

or should i add something in my app.json?

```<code>{
  "expo": {
    "name": "x",
    "slug": "x",
    "privacy": "unlisted",
    "owner": "x",
    "platforms": [
      "ios",
      "android"
    ],
    "version": "1.2.288",
    "orientation": "portrait",
    "icon": "./assets/images/icon-transparent.png",
    "scheme": "lifemax",
    "splash": {
      "image": "./assets/images/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#78a6ff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0,
      "enabled": false,
      "checkAutomatically": "ON_ERROR_RECOVERY",
      "url": "https://u.expo.dev/e43c36bd-cfdb-4be9-9d69-135ea8a56c86"
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "x",
      "buildNumber": "1.2.288",
      "requireFullScreen": true,
      "icon": "./assets/images/icon.png",
      "backgroundColor": "#78a6ff",
      "infoPlist": {
        "UIUserInterfaceStyle": "Light"
      }
    },
    "android": {
      "package": "x",
      "versionCode": 288,
      "backgroundColor": "#78a6ff",
      "icon": "./assets/images/icon-transparent.png",
      "adaptiveIcon": {
        "foregroundImage": "./assets/images/icon-android-adaptive.png",
        "backgroundColor": "#78a6ff"
      },
      "permissions": []
    },
    "androidStatusBar": {
      "hidden": true,
      "barStyle": "light-content",
      "backgroundColor": "#78a6ff",
      "translucent": false
    },
    "androidNavigationBar": {
      "visible": "immersive",
      "barStyle": "light-content",
      "backgroundColor": "#78a6ff"
    },
    "notification": {
      "icon": "./assets/images/icon-notification.png",
      "iosDisplayInForeground": false,
      "androidMode": "collapse",
      "androidCollapsedTitle": "Assess your Life!",
      "color": "#000000"
    },
    "extra": {
      "eas": {
        "projectId": "e43c36bd-cfdb-4be9-9d69-135ea8a56c86"
      }
    },
    "runtimeVersion": {
      "policy": "sdkVersion"
    },
    "plugins": [
      [ "expo-build-properties",
        {
          "ios": {
            "deploymentTarget": "15.0"
          }
        }
      ]
    ]
  }
}

</code>```

Body:
I have a managed expo project that uses react-native.  I am getting an error when building for android that is essentially this error: https://github.com/dooboolab/react-native-iap/issues/1373

I see the solution is to add the following code to the default config

{ missingDimensionStrategy 'store', 'play' }

I have a managed project, so my default config is not setup like the ones in that thread.  My question is where can i add this missingDimensionStrategy in my project so that it builds for android properly?

Here is my metroconfig.js file, which I think is where i would add something like this, but am unsure how.

const { getDefaultConfig } = require('expo/metro-config');

const config = getDefaultConfig(__dirname);
module.exports = config;

or should i add something in my app.json?

{
  "expo": {
    "name": "x",
    "slug": "x",
    "privacy": "unlisted",
    "owner": "x",
    "platforms": [
      "ios",
      "android"
    ],
    "version": "1.2.288",
    "orientation": "portrait",
    "icon": "./assets/images/icon-transparent.png",
    "scheme": "lifemax",
    "splash": {
      "image": "./assets/images/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#78a6ff"
    },
    "updates": {
      "fallbackToCacheTimeout": 0,
      "enabled": false,
      "checkAutomatically": "ON_ERROR_RECOVERY",
      "url": "https://u.expo.dev/e43c36bd-cfdb-4be9-9d69-135ea8a56c86"
    },
    "assetBundlePatterns": [
      "**/*"
    ],
    "ios": {
      "supportsTablet": true,
      "bundleIdentifier": "x",
      "buildNumber": "1.2.288",
      "requireFullScreen": true,
      "icon": "./assets/images/icon.png",
      "backgroundColor": "#78a6ff",
      "infoPlist": {
        "UIUserInterfaceStyle": "Light"
      }
    },
    "android": {
      "package": "x",
      "versionCode": 288,
      "backgroundColor": "#78a6ff",
      "icon": "./assets/images/icon-transparent.png",
      "adaptiveIcon": {
        "foregroundImage": "./assets/images/icon-android-adaptive.png",
        "backgroundColor": "#78a6ff"
      },
      "permissions": []
    },
    "androidStatusBar": {
      "hidden": true,
      "barStyle": "light-content",
      "backgroundColor": "#78a6ff",
      "translucent": false
    },
    "androidNavigationBar": {
      "visible": "immersive",
      "barStyle": "light-content",
      "backgroundColor": "#78a6ff"
    },
    "notification": {
      "icon": "./assets/images/icon-notification.png",
      "iosDisplayInForeground": false,
      "androidMode": "collapse",
      "androidCollapsedTitle": "Assess your Life!",
      "color": "#000000"
    },
    "extra": {
      "eas": {
        "projectId": "e43c36bd-cfdb-4be9-9d69-135ea8a56c86"
      }
    },
    "runtimeVersion": {
      "policy": "sdkVersion"
    },
    "plugins": [
      [ "expo-build-properties",
        {
          "ios": {
            "deploymentTarget": "15.0"
          }
        }
      ]
    ]
  }
}


问:
Wordpress Plugin conficts with JQuery/JQMIGRATE and CSS and other plugins when is active
I just started my first plugin for wordpress.
The functions runs with Vanilla JS.
When the plugin is activated some kind of conflict is happening with JQuery.
Nothing that needs jquery runs in the website and I see it in browser console that there is problem with every plugin files or wordpress jquery files. (check photo below and see the console with my plugin turned on)

When I turn off my plugin I notice, before anything starts to load, there is something called JQMIGRATE that is installed first and then everything else runs normal. When I turn on my plugin, I don't see any JQMIGRATE on top successfully installed, (check photo below and see the console with my plugin turned off)

I tried to find a way to declare that the file Im loading do not need jquery, cause I believe it tries to run a higher version of jquery and thats why JQMIGRATE is not working well. But I can't find how to declare it, any help? (Below you see how I enqueue the js and css files)

```<code>function enqueue_css_js() {
  wp_register_style('adaptivebutton', plugins_url('adaptivebutton.css',__FILE__ ));
  wp_enqueue_style('adaptivebutton');
  wp_register_script( 'adaptivebutton', plugins_url('adaptivebutton.js',__FILE__ ));
  wp_enqueue_script('adaptivebutton');
}

add_action( 'wp_enqueue_scripts','enqueue_css_js');
</code>```

My conclusion about the JQuery version, came after I notice how the page imports the files. After I noticed the version ( "?ver=6.1.1" ) on the end of each js file.

This is mine:

```<code><script type='text/javascript' src='https://landofgods.eu/wp-content/plugins/adaptivebutton/adaptivebutton.js?ver=6.1.1' id='adaptivebutton-js'>
</code>```

These was there:

```<code><link rel='prefetch' href='https://landofgods.eu/wp-content/themes/flatsome/assets/js/chunk.tooltips.js?ver=3.16.4' />
<link rel='prefetch' href='https://landofgods.eu/wp-content/themes/flatsome/assets/js/chunk.vendors-popups.js?ver=3.16.4' />
<link rel='prefetch' href='https://landofgods.eu/wp-content/themes/flatsome/assets/js/chunk.vendors-slider.js?ver=3.16.4' />
</code>```

(CHECKPOINT) Then I tried to change the order of the "add_action" and it worked! JQMIGRATE works again. ( Check how I changed the enqueue function below )

```<code>function enqueue_css_js() {
  wp_register_script( 'adaptivebutton', plugins_url('adaptivebutton.js',__FILE__ ));
  wp_enqueue_script('adaptivebutton');
  wp_register_style('adaptivebutton', plugins_url('adaptivebutton.css',__FILE__ ));
  wp_enqueue_style('adaptivebutton');
}

add_action( 'wp_enqueue_scripts','enqueue_css_js', 99);
</code>```

But now I have problem/conflict with css files, the page loads ( I thing all css files ) but does not apply css properties from all files to pages (all pages). NOTICE: even if I turn off/comment the css enqueue, it still conflict with the other css files

Body:
I just started my first plugin for wordpress.
The functions runs with Vanilla JS.
When the plugin is activated some kind of conflict is happening with JQuery.
Nothing that needs jquery runs in the website and I see it in browser console that there is problem with every plugin files or wordpress jquery files. (check photo below and see the console with my plugin turned on)

When I turn off my plugin I notice, before anything starts to load, there is something called JQMIGRATE that is installed first and then everything else runs normal. When I turn on my plugin, I don't see any JQMIGRATE on top successfully installed, (check photo below and see the console with my plugin turned off)

I tried to find a way to declare that the file Im loading do not need jquery, cause I believe it tries to run a higher version of jquery and thats why JQMIGRATE is not working well. But I can't find how to declare it, any help? (Below you see how I enqueue the js and css files)

function enqueue_css_js() {
  wp_register_style('adaptivebutton', plugins_url('adaptivebutton.css',__FILE__ ));
  wp_enqueue_style('adaptivebutton');
  wp_register_script( 'adaptivebutton', plugins_url('adaptivebutton.js',__FILE__ ));
  wp_enqueue_script('adaptivebutton');
}

add_action( 'wp_enqueue_scripts','enqueue_css_js');

My conclusion about the JQuery version, came after I notice how the page imports the files. After I noticed the version ( "?ver=6.1.1" ) on the end of each js file.

This is mine:


问:
Access DB data on a running spring boot in docker container like Ruby console script/console
I am wondering if is there a way to connect and interact with a running spring-boot application inside a docker container.
For example: In rails running application inside a docker container can be connected via the following commands, (let's say the name of the container is rails_app_1)

```<code>docket container exec -it rails_app_1 bash
script/console
</code>```

It will load the rails app in the proper context and I can interact with DB and also call/execute application code and even find the DB objects like

```<code>Employee.find(1234) // This finds the employee with Id 1234
</code>```

Is there a way to do a similar thing in Java for a spring-boot application running in the docker container and I can load some console in proper spring context in order to run some scripts?

Thanks

Body:
I am wondering if is there a way to connect and interact with a running spring-boot application inside a docker container.
For example: In rails running application inside a docker container can be connected via the following commands, (let's say the name of the container is rails_app_1)

docket container exec -it rails_app_1 bash
script/console

It will load the rails app in the proper context and I can interact with DB and also call/execute application code and even find the DB objects like

Employee.find(1234) // This finds the employee with Id 1234

Is there a way to do a similar thing in Java for a spring-boot application running in the docker container and I can load some console in proper spring context in order to run some scripts?

Thanks


问:
Error showing customs anotation in maps swift
I'm trying to show some custom anotation I can see the custom picture in its place but the text disappears and reapear every time I zoom in or out. I've checked several similar question but I don't know how to apply to my code. So please help!</p>
```<code>import UIKit
import MapKit

class LocalizacionViewController: UIViewController,MKMapViewDelegate {
    var evento: Evento?

    @IBOutlet weak var actIndicator: UIActivityIndicatorView!
    @IBOutlet weak var contenedorView: UIView!

    @IBOutlet weak var mkMapa: MKMapView!
    override func viewDidLoad() {
        mkMapa.delegate = self
        super.viewDidLoad()
        evento = eventos.eventoPulsado()

    }
    override func viewWillAppear(_ animated: Bool) {
       contenedorView.layer.borderWidth = 2
        contenedorView.aplicarFondoDegradado()
        contenedorView.layer.borderColor =  UIColor.white.cgColor
        contenedorView.layer.cornerRadius = 10
        customPin()
        let initialLocation = CLLocationCoordinate2D(latitude: (evento!.lat)!, longitude: (evento!.long)!)
        mkMapa.setCenter(initialLocation, animated: true)
        let region = MKCoordinateRegion(center: initialLocation,latitudinalMeters: 2000,longitudinalMeters: 2000)
        mkMapa.setRegion(region, animated: true)
    }

    func mapViewDidFinishLoadingMap(_ mapView: MKMapView) {
        actIndicator.isHidden = true
        actIndicator.stopAnimating()
    }
    func customPin(){
        let addAnotation = MKPointAnnotation()
        addAnotation.title = evento!.nombre
        addAnotation.coordinate = CLLocationCoordinate2D(latitude: evento!.lat!, longitude: evento!.long!)
        self.mkMapa.addAnnotation(addAnotation)
    }
    func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
        if annotation is MKUserLocation {
            return nil
        }
        var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "custom")

        if annotationView == nil {
            annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: "custom")
        } else {
            annotationView?.annotation = annotation
        }
       annotationView?.image = UIImage(named:"bars.png" )

        return annotationView
    }
}
</code>```

Body:
I'm trying to show some custom anotation I can see the custom picture in its place but the text disappears and reapear every time I zoom in or out. I've checked several similar question but I don't know how to apply to my code. So please help!

import UIKit
import MapKit

class LocalizacionViewController: UIViewController,MKMapViewDelegate {
    var evento: Evento?

    @IBOutlet weak var actIndicator: UIActivityIndicatorView!
    @IBOutlet weak var contenedorView: UIView!

    @IBOutlet weak var mkMapa: MKMapView!
    override func viewDidLoad() {
        mkMapa.delegate = self
        super.viewDidLoad()
        evento = eventos.eventoPulsado()

    }
    override func viewWillAppear(_ animated: Bool) {
       contenedorView.layer.borderWidth = 2
        contenedorView.aplicarFondoDegradado()
        contenedorView.layer.borderColor =  UIColor.white.cgColor
        contenedorView.layer.cornerRadius = 10
        customPin()
        let initialLocation = CLLocationCoordinate2D(latitude: (evento!.lat)!, longitude: (evento!.long)!)
        mkMapa.setCenter(initialLocation, animated: true)
        let region = MKCoordinateRegion(center: initialLocation,latitudinalMeters: 2000,longitudinalMeters: 2000)
        mkMapa.setRegion(region, animated: true)
    }

    func mapViewDidFinishLoadingMap(_ mapView: MKMapView) {
        actIndicator.isHidden = true
        actIndicator.stopAnimating()
    }
    func customPin(){
        let addAnotation = MKPointAnnotation()
        addAnotation.title = evento!.nombre
        addAnotation.coordinate = CLLocationCoordinate2D(latitude: evento!.lat!, longitude: evento!.long!)
        self.mkMapa.addAnnotation(addAnotation)
    }
    func mapView(_ mapView: MKMapView, viewFor annotation: MKAnnotation) -> MKAnnotationView? {
        if annotation is MKUserLocation {
            return nil
        }
        var annotationView = mapView.dequeueReusableAnnotationView(withIdentifier: "custom")

        if annotationView == nil {
            annotationView = MKAnnotationView(annotation: annotation, reuseIdentifier: "custom")
        } else {
            annotationView?.annotation = annotation
        }
       annotationView?.image = UIImage(named:"bars.png" )

        return annotationView
    }
}


问:
I want to set my service account in one of the services in DCOM settings of component service
I want to automate the setting of service account credentials in one of the services of DCOM settings of Components Services of windows instances. But, not able to find any command or script. Can anyone help on this?

I have tried the manual process and want to automate it.