问:
How do you predict an outcome using a single value in a multiple logistic regression using statsmodels?
```<code>#import the needed pandas module
import pandas as pd
import statsmodels.formula.api as smf

#Upload the contents of an excel file to a DataFrame
df= pd.read_excel("C:/Users/ME/OneDrive/Desktop/weather.xlsx")

#Create a multiple logistic regression model
logRegModel = smf.logit('sunny ~ temp + barom', data = df)

#Fit the data in df into the model
results = logRegModel.fit()

#Print the results summary
print(results.summary())

#plot the scatterplot with the actual data
z = df.sunny
x = df.temp
y = df.barom

#make a prediction for a given temp x and barometer y reading
prediction = results.predict(pd.DataFrame({'temp': [21],'barom':[12]})
prediction.summary_frame(alpha=0.05)

# Creating figure
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure(figsize = (10, 7))
ax = plt.axes(projection ="3d")

# Creating plot
ax.scatter3D(x, y, z, color = "blue")
plt.title("3D scatter plot")

# show plot
plt.show()
</code>```

I ran the code above. Everything works fine until it hits the code for making a prediction using a single x and a single y value. When I run the code to include:

```<code>#make a prediction for a given temp x and barometer y reading
prediction = results.predict(pd.DataFrame({'temp': [21],'barom':[12]})
prediction.summary_frame(alpha=0.05)
</code>```

I recieve the following error:

```<code> File "<ipython-input-78-b26a4bf65d01>", line 36
    from mpl_toolkits import mplot3d
       ^
SyntaxError: invalid syntax
</code>```

This is so incredibly odd??? WHy does it run perfectly  without the two prediction lines above and then when I include them it tells me a simple import function is a syntax error? It is my understanding reading the statsmodels docs, that in order to make a prediction for a multiple logistic regression model I need to pass a dataFrame into the predict function. Wasn't this done correctly above? My logistic regression is trying to predict if there is a sunny day from temperature and barameter reading. WHen I comment out the import statement above and run it I receive another error on another import statement. This is so strange. WHy soes it not accept my import statements? I ran the code on multiple IDEs and receive the same results. Thank you everyone in advance.

Body:
#import the needed pandas module
import pandas as pd
import statsmodels.formula.api as smf

#Upload the contents of an excel file to a DataFrame
df= pd.read_excel("C:/Users/ME/OneDrive/Desktop/weather.xlsx")

#Create a multiple logistic regression model
logRegModel = smf.logit('sunny ~ temp + barom', data = df)

#Fit the data in df into the model
results = logRegModel.fit()

#Print the results summary
print(results.summary())

#plot the scatterplot with the actual data
z = df.sunny
x = df.temp
y = df.barom

#make a prediction for a given temp x and barometer y reading
prediction = results.predict(pd.DataFrame({'temp': [21],'barom':[12]})
prediction.summary_frame(alpha=0.05)

# Creating figure
from mpl_toolkits import mplot3d
import numpy as np
import matplotlib.pyplot as plt

fig = plt.figure(figsize = (10, 7))
ax = plt.axes(projection ="3d")

# Creating plot
ax.scatter3D(x, y, z, color = "blue")
plt.title("3D scatter plot")

# show plot
plt.show()

I ran the code above. Everything works fine until it hits the code for making a prediction using a single x and a single y value. When I run the code to include:

#make a prediction for a given temp x and barometer y reading
prediction = results.predict(pd.DataFrame({'temp': [21],'barom':[12]})
prediction.summary_frame(alpha=0.05)

I recieve the following error:

 File "<ipython-input-78-b26a4bf65d01>", line 36
    from mpl_toolkits import mplot3d
       ^
SyntaxError: invalid syntax

This is so incredibly odd??? WHy does it run perfectly  without the two prediction lines above and then when I include them it tells me a simple import function is a syntax error? It is my understanding reading the statsmodels docs, that in order to make a prediction for a multiple logistic regression model I need to pass a dataFrame into the predict function. Wasn't this done correctly above? My logistic regression is trying to predict if there is a sunny day from temperature and barameter reading. WHen I comment out the import statement above and run it I receive another error on another import statement. This is so strange. WHy soes it not accept my import statements? I ran the code on multiple IDEs and receive the same results. Thank you everyone in advance.


来源: stackexchange

问:
What is the current status of bi-directional gRPC support in React Native/in general as of 2023?
I am curious about the current status of bi-directional streaming gRPC support in React Native (iOS & Android) and in general? I have found a few articles and packages that are a few years old that have some conflicting data.

I am trying to build an RPC API endpoint that requires bi-directional streaming and Im trying to build the client in React Native. It seems that theres a couple main ways to implement in RN:

Implement as a Native Module through bridging (in order to support iOS)

Use improbable-eng/grpc-web (no client streaming AND RN support concurrently)

Im looking for someone more 'in-the-know' about this topic that could give an update as to the current best way to do bi-directional streaming in React Native.

According to documentation, RPC support still seems to be somewhat lacking across the board which worries me if its the right way to go.

ContentLicense: CC BY-SA 4.0


问:
Not redirecting after Sign in with Google
There is a problem that I don't even know where it originated from.
I used Google to enter the site and everything is fine.
But after entering the site, it does not redirect and the following page is displayed.

(I also have this problem when entering Discord)

Thank you for helping me find where the problem comes from :)

My Website Is : https://twitter.ro-ox.com/

I updated Hybridauth and checked everything

But I don't understand where the problem is


问:
How to add Zinke's book house to Android Studio?
I have entered this code in gradle.build:app and it is not downloaded in any way:

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

dependencies {

```<code>implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
implementation 'com.google.android.gms:play-services-vision:20.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
</code>```

}

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

What should I do?

```<code>I have entered this code in gradle.build:app and it is not downloaded in any way:
</code>```
```<code>dependencies {

    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'
    implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}
</code>```
```<code>What should I do?
</code>```

Body:
I have entered this code in gradle.build:app and it is not downloaded in any way:

dependencies {

implementation 'androidx.appcompat:appcompat:1.5.1'
implementation 'com.google.android.material:material:1.7.0'
implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
implementation 'com.google.android.gms:play-services-vision:20.1.3'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'

}

What should I do?

I have entered this code in gradle.build:app and it is not downloaded in any way:

dependencies {

    implementation 'androidx.appcompat:appcompat:1.5.1'
    implementation 'com.google.android.material:material:1.7.0'
    implementation 'com.journeyapps:zxing-android-embedded:3.4.0'
    implementation 'com.google.android.gms:play-services-vision:20.1.3'
    testImplementation 'junit:junit:4.13.2'
    androidTestImplementation 'androidx.test.ext:junit:1.1.4'
    androidTestImplementation 'androidx.test.espresso:espresso-core:3.5.0'
}

What should I do?


问:
TypeScript w/ Svelte, how to set the typing for: `Parent.Child`
What I want is a way to export a group of related components as one component. Using an Accordion component as an example, what I want to be able to do is:

<Accordion>
  <Accordion.Item> /* ish */ </Accordion.Item>
  <Accordion.Item> /* ish */ </Accordion.Item>
</Accordion>
```
<p>If my project were JS, I could simple do:</p>
<pre class="lang-js prettyprint-override"><code>// src/lib/components/Accordion/index.js
import Accordion from "./Accordion.svelte";
import AccordionItem from "./AccordionItem.svelte";

Accordion.Item = AccordionItem;

export { Accordion };
</code>```

Or if this were React+TS (my primary skillset), I would do:

// Accordion.tsx
import { AccordionItem } from './AccordionItem';
export const Accordion: FC<Props> & { Item: FC<AccordionItemProps> } = (props) => { /* ish */ };
Accordion.Item = AccordionItem;
```

I've been looking through the TS/Svelte/SvelteKit docs and have no idea how to properly type Accordion so that it'll take AccordionItem without complaint.

PS, this is in a SvelteKit project, but I presume that this is more a Svelte/TS question.

Body:
What I want is a way to export a group of related components as one component. Using an Accordion component as an example, what I want to be able to do is:

<Accordion>
  <Accordion.Item> /* ish */ </Accordion.Item>
  <Accordion.Item> /* ish */ </Accordion.Item>
</Accordion>

If my project were JS, I could simple do:

// src/lib/components/Accordion/index.js
import Accordion from "./Accordion.svelte";
import AccordionItem from "./AccordionItem.svelte";

Accordion.Item = AccordionItem;

export { Accordion };

Or if this were React+TS (my primary skillset), I would do:

// Accordion.tsx
import { AccordionItem } from './AccordionItem';
export const Accordion: FC<Props> & { Item: FC<AccordionItemProps> } = (props) => { /* ish */ };
Accordion.Item = AccordionItem;

I've been looking through the TS/Svelte/SvelteKit docs and have no idea how to properly type Accordion so that it'll take AccordionItem without complaint.

PS, this is in a SvelteKit project, but I presume that this is more a Svelte/TS question.


问:
How can I send 2 messages to discord bot and get 2 strigns? One for led mode name and another for RGB values to set certain color
After I send a message and it is detected by on_message event I can't find a way to send another message with RGB values without using the same on_message event

Recently I created a discord bot that controls my argb leds with arduino. With some tutorials I managed to make it work for easy messages like "red", "blue", "rainbow" etc. But that works because every light mode is previously set up in arduino. My python code looks like this:

main.py:

```<code>import bot

if __name__ == '__main__':
    bot.run_discord_bot()

</code>```

bot.py:

```<code>
import discord
import responses

async def send_message(message, user_message, is_private):
    try:
        response = responses.get_response(user_message)
        await message.author.send(response) if is_private else await message.channel.send(response)

    except Exception as e:
        print(e)

def run_discord_bot():
    TOKEN = 'my_token'
    intents = discord.Intents.default()
    intents.message_content = True
    client = discord.Client(intents=intents)

    @client.event
    async def on_ready():
        print(f'{client.user} is now running!')

    @client.event
    async def on_message(message):
        if message.author == client.user:
            return

        username = str(message.author)
        user_message = str(message.content)
        channel = str(message.channel)

        print(f'{username} said: "{user_message}" ({channel})')

        if user_message[0] == '?':
            user_message = user_message[1:]
            await send_message(message, user_message, is_private=True)
        else:
            await send_message(message, user_message, is_private=False)

    client.run(TOKEN)

</code>```

responses.py:

```<code>
import random
import serial.tools.list_ports
import discord

intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)

ports = serial.tools.list_ports.comports()
serialInst = serial.Serial()

serialInst.baudrate = 9600
serialInst.port = "COM4"
serialInst.open()

def get_response(message: str) -> str:
    p_message = message.lower()
    if p_message == "off":
        serialInst.write("0".encode('utf-8'))
        return '`Off`'

    if p_message == "rainbow":
        serialInst.write("1".encode('utf-8'))
        return '`RAINBOW.`'

    if p_message == "rainbowfade":
        serialInst.write("2".encode('utf-8'))
        return '`RAINBOWFADE.`'

    if p_message == "strobe":
        serialInst.write("3".encode('utf-8'))
        return '`strobe.`'

    if p_message == "runninglights":
        serialInst.write("4".encode('utf-8'))
        return '`runningLights.`'

    if p_message == "color":
        serialInst.write("5".encode('utf-8'))
        serialInst.write(color.encode('utf-8'))
        return '`color`'

    if p_message == "strobee":
        serialInst.write("6".encode('utf-8'))
        return '`FadeInOut.`'

    if p_message == "theaterchaserainbow":
        serialInst.write("7".encode('utf-8'))
        return '`theaterChaseRainbow.`'

    if p_message == "red":
        serialInst.write("r".encode('utf-8'))
        return '`ColorWipe Red.`'

    if p_message == "green":
        serialInst.write("g".encode('utf-8'))
        return '`ColorWipe Green.`'

    if p_message == "blue":
        serialInst.write("b".encode('utf-8'))
        return '`ColorWipe Blue.`'

    if p_message == '!help':
        return '`This is a help message that you can modify.`'

    return 'I didn\'t understand what you wrote. Try typing "!help".'

</code>```

But now I want to send a message "color" and then in responses.py in if statement for "color" i want to be able to send another message to bot with RGB values (for example "255 50 244). But I have no idea how to do it. I was looking in internet but i found nothing that would help. All I need is to get this values as a string from second message that is only required in this one moment in code. Then arduino takes this string and decodes it to 3 numbers and set a color i choosed.

It is my first time writing a python code for a discord bot. Is it possible to do this or i have to rewrite my code? I hope my explenation is clear.

Body:
After I send a message and it is detected by on_message event I can't find a way to send another message with RGB values without using the same on_message event

Recently I created a discord bot that controls my argb leds with arduino. With some tutorials I managed to make it work for easy messages like "red", "blue", "rainbow" etc. But that works because every light mode is previously set up in arduino. My python code looks like this:

main.py:

import bot

if __name__ == '__main__':
    bot.run_discord_bot()

bot.py:

import discord
import responses

async def send_message(message, user_message, is_private):
    try:
        response = responses.get_response(user_message)
        await message.author.send(response) if is_private else await message.channel.send(response)

    except Exception as e:
        print(e)

def run_discord_bot():
    TOKEN = 'my_token'
    intents = discord.Intents.default()
    intents.message_content = True
    client = discord.Client(intents=intents)

    @client.event
    async def on_ready():
        print(f'{client.user} is now running!')

    @client.event
    async def on_message(message):
        if message.author == client.user:
            return

        username = str(message.author)
        user_message = str(message.content)
        channel = str(message.channel)

        print(f'{username} said: "{user_message}" ({channel})')

        if user_message[0] == '?':
            user_message = user_message[1:]
            await send_message(message, user_message, is_private=True)
        else:
            await send_message(message, user_message, is_private=False)

    client.run(TOKEN)

responses.py:

import random
import serial.tools.list_ports
import discord

intents = discord.Intents.default()
intents.message_content = True
client = discord.Client(intents=intents)

ports = serial.tools.list_ports.comports()
serialInst = serial.Serial()

serialInst.baudrate = 9600
serialInst.port = "COM4"
serialInst.open()

def get_response(message: str) -> str:
    p_message = message.lower()
    if p_message == "off":
        serialInst.write("0".encode('utf-8'))
        return '`Off`'

    if p_message == "rainbow":
        serialInst.write("1".encode('utf-8'))
        return '`RAINBOW.`'

    if p_message == "rainbowfade":
        serialInst.write("2".encode('utf-8'))
        return '`RAINBOWFADE.`'

    if p_message == "strobe":
        serialInst.write("3".encode('utf-8'))
        return '`strobe.`'

    if p_message == "runninglights":
        serialInst.write("4".encode('utf-8'))
        return '`runningLights.`'

    if p_message == "color":
        serialInst.write("5".encode('utf-8'))
        serialInst.write(color.encode('utf-8'))
        return '`color`'

    if p_message == "strobee":
        serialInst.write("6".encode('utf-8'))
        return '`FadeInOut.`'

    if p_message == "theaterchaserainbow":
        serialInst.write("7".encode('utf-8'))
        return '`theaterChaseRainbow.`'

    if p_message == "red":
        serialInst.write("r".encode('utf-8'))
        return '`ColorWipe Red.`'

    if p_message == "green":
        serialInst.write("g".encode('utf-8'))
        return '`ColorWipe Green.`'

    if p_message == "blue":
        serialInst.write("b".encode('utf-8'))
        return '`ColorWipe Blue.`'

    if p_message == '!help':
        return '`This is a help message that you can modify.`'

    return 'I didn\'t understand what you wrote. Try typing "!help".'

But now I want to send a message "color" and then in responses.py in if statement for "color" i want to be able to send another message to bot with RGB values (for example "255 50 244). But I have no idea how to do it. I was looking in internet but i found nothing that would help. All I need is to get this values as a string from second message that is only required in this one moment in code. Then arduino takes this string and decodes it to 3 numbers and set a color i choosed.

It is my first time writing a python code for a discord bot. Is it possible to do this or i have to rewrite my code? I hope my explenation is clear.


问:
Could not resolve dependency: npm ERR! @tensorflow-models/mobilenet@"*" from the root project
I tried to install @tensorflow-models/mobilenet using npm install @tensorflow-models/mobilenet. But following error popped up.

```<code>npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: @tensorflow/tfjs-converter@4.1.0
npm ERR! node_modules/@tensorflow/tfjs-converter
npm ERR!   @tensorflow/tfjs-converter@"4.1.0" from @tensorflow/tfjs@4.1.0
npm ERR!   node_modules/@tensorflow/tfjs
npm ERR!     @tensorflow/tfjs@"^4.1.0" from the root project
npm ERR!   @tensorflow/tfjs-converter@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @tensorflow-models/mobilenet@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @tensorflow/tfjs-converter@3.21.0
npm ERR! node_modules/@tensorflow/tfjs-converter
npm ERR!   peer @tensorflow/tfjs-converter@"^3.1.0" from @tensorflow-
models/mobilenet@2.1.0
npm ERR!   node_modules/@tensorflow-models/mobilenet
npm ERR!     @tensorflow-models/mobilenet@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /home/thesilentguy/.npm/_logs/2022-12-30T19_26_56_164Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/thesilentguy/.npm/_logs/2022-12-30T19_26_56_164Z-debug-0.log
</code>```

How to install this @tensorflow-models/mobilenet? Please help.

Body:
I tried to install @tensorflow-models/mobilenet using npm install @tensorflow-models/mobilenet. But following error popped up.

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: undefined@undefined
npm ERR! Found: @tensorflow/tfjs-converter@4.1.0
npm ERR! node_modules/@tensorflow/tfjs-converter
npm ERR!   @tensorflow/tfjs-converter@"4.1.0" from @tensorflow/tfjs@4.1.0
npm ERR!   node_modules/@tensorflow/tfjs
npm ERR!     @tensorflow/tfjs@"^4.1.0" from the root project
npm ERR!   @tensorflow/tfjs-converter@"*" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! @tensorflow-models/mobilenet@"*" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @tensorflow/tfjs-converter@3.21.0
npm ERR! node_modules/@tensorflow/tfjs-converter
npm ERR!   peer @tensorflow/tfjs-converter@"^3.1.0" from @tensorflow-
models/mobilenet@2.1.0
npm ERR!   node_modules/@tensorflow-models/mobilenet
npm ERR!     @tensorflow-models/mobilenet@"*" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR!
npm ERR! For a full report see:
npm ERR! /home/thesilentguy/.npm/_logs/2022-12-30T19_26_56_164Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/thesilentguy/.npm/_logs/2022-12-30T19_26_56_164Z-debug-0.log

How to install this @tensorflow-models/mobilenet? Please help.


问:
Problems in processing raw images
I'm currently writing a python script to streamline the post processing for my raw images taken from cameras. For now I don't need fancy editing features, but just want to convert the raw files into more distributable file types like jpg or png.

The code below works fine for photos taken in daylight, but really screws up for those taken at night. Examples shown here:

good one:

bad one:

bad one simply exporting from using an editing software:

And here is the code:

```<code>def arw2jpg(fileName):
  with rp.imread(fileName) as raw:

    post_image1 = raw.postprocess(use_auto_wb=True)
    post_image2 = raw.postprocess(use_camera_wb=True)
    print(f'image shape{post_image2.shape}')
    post_image3 = cv2.fastNlMeansDenoisingColored(post_image2, None, 2.7, 10, 7, 21)
    plt.imsave(b + fileName.split('.')[0] + '-test' + '.jpg', post_image3)
    print(fileName, flush=True)

for a,b in zip(src_dir, dst_dir):
  print(a, b)
  os.chdir(a) # current raw working directory
  dir_list = [photo.split('.')[0] for photo in os.listdir(b)]
  idx = lambda i: int(i.split('.')[0][4:])
  work_list = [photo for photo in os.listdir(a) if photo.split('.')[0] not in dir_list]
  print(f'work_list is {work_list}')

  with Pool() as pool:
    progress_bar = tqdm(total=len(work_list))
    results = tqdm(pool.imap(arw2jpg, work_list), total=len(work_list))
    tuple(results)

</code>```

I know I missed some very important pieces in the process, and the photos taken in the dark shouldn't look like what they are right now. Any thoughts are welcomed. Appreciated.

I saw the editing software does some resampling before exporting, but that doesn't seem to help.

I don't need to take it up to AI models for now, but if implementing in pytorch helps with the performance it's also welcomed.

Title: Problems in processing raw images

Body:
I'm currently writing a python script to streamline the post processing for my raw images taken from cameras. For now I don't need fancy editing features, but just want to convert the raw files into more distributable file types like jpg or png.

The code below works fine for photos taken in daylight, but really screws up for those taken at night. Examples shown here:

good one:

bad one:

bad one simply exporting from using an editing software:

And here is the code:

def arw2jpg(fileName):
  with rp.imread(fileName) as raw:

    post_image1 = raw.postprocess(use_auto_wb=True)
    post_image2 = raw.postprocess(use_camera_wb=True)
    print(f'image shape{post_image2.shape}')
    post_image3 = cv2.fastNlMeansDenoisingColored(post_image2, None, 2.7, 10, 7, 21)
    plt.imsave(b + fileName.split('.')[0] + '-test' + '.jpg', post_image3)
    print(fileName, flush=True)

for a,b in zip(src_dir, dst_dir):
  print(a, b)
  os.chdir(a) # current raw working directory
  dir_list = [photo.split('.')[0] for photo in os.listdir(b)]
  idx = lambda i: int(i.split('.')[0][4:])
  work_list = [photo for photo in os.listdir(a) if photo.split('.')[0] not in dir_list]
  print(f'work_list is {work_list}')

  with Pool() as pool:
    progress_bar = tqdm(total=len(work_list))
    results = tqdm(pool.imap(arw2jpg, work_list), total=len(work_list))
    tuple(results)

I know I missed some very important pieces in the process, and the photos taken in the dark shouldn't look like what they are right now. Any thoughts are welcomed. Appreciated.

I saw the editing software does some resampling before exporting, but that doesn't seem to help.

I don't need to take it up to AI models for now, but if implementing in pytorch helps with the performance it's also welcomed.


问:
Inserting Elements into database using basic html
new to php and database stuff . I am required to make a system to record and save user data inside a database table that I called USER_INFO . the system works fine except when I make it inter User_ID (which is the only PRIMARY KEY data type) . whats more wierd to me is that when putting an id from inside the php code it takes it fine nd creates the new element , but when I make it take the data intered by a user in a form , it doesnt work .

Here is my PHP code to insert new data :

```<code><?php

try {

    /*** connect to SQLite database ***/

    $dbh = new PDO("sqlite:ses.sdb");

    $sql = "SELECT * FROM USER_INFO";

    $Id_ok =$_GET['user_id'];

        if($Id_ok != 0){
            foreach ($dbh->query($sql) as $row) {
                $name =$_GET['user_name'];
                $ID= $_GET['user_id'];
                $phone = $_GET['phone'];
                $address = $_GET['address'];
                $Email = $_GET['email'];

                // Just simple thing so I check the new elements
                print 'USER NAME='.$row['name']. ' ,  '.
                        'USER ID="'.$row['id']. '" ,  '.
                        'PHONE="'.$row['telephone']. '<br>';

                $sql2 = "INSERT INTO USER_INFO
                            VALUES ('.$name.', '.$ID.', '.$phone.',
                                    'work2', 'perhaps')"; // problrm here in $ID .

                $dbh->exec($sql2);
            }
        }
        echo "New record created";
      // Close the connetion
        $dbh = null;
    } catch(PDOException $e) {
        echo $e->getMessage();
    }
?>
</code>```

--the function I use to submit the form :

```<code>function Register(){

    if(userID_Ok_Register() == false){return;}

    users= new Array();

    for(var i=0;i<index;i++){
        users=user[i].split('#');
        if(users[2]==document.user_info.user_id.value){
            alert("ID alreadys exists");
            return;
        }
        document.realForm.user_name.value = document.user_info.user_name.value;
        document.realForm.user_id.value = document.user_info.user_id.value;
        document.realForm.phone.value = document.user_info.phone.value;
        document.realForm.address.value = document.user_info.address.value;
        document.realForm.email.value = document.user_info.email.value;

        document.realForm.submit();
    }
}
</code>```

I am also using WampServer , don't know if it matters or not  , any help and tips helps alot :>

Tried to take user_id data and put it into a PRIMARY KEY slot in a database table .

I expected it to work as good as it did when I entered  data from within the php code , as in I put 889 or such thing in the ID slot and it worked .

what actully happened is that it wouldn't take the user_ID that is taken from the form , and I have tested , The user_iD is fine , it just wouldn't be inserted into the database .

Body:
new to php and database stuff . I am required to make a system to record and save user data inside a database table that I called USER_INFO . the system works fine except when I make it inter User_ID (which is the only PRIMARY KEY data type) . whats more wierd to me is that when putting an id from inside the php code it takes it fine nd creates the new element , but when I make it take the data intered by a user in a form , it doesnt work .

Here is my PHP code to insert new data :

<?php

try {

    /*** connect to SQLite database ***/

    $dbh = new PDO("sqlite:ses.sdb");

    $sql = "SELECT * FROM USER_INFO";

    $Id_ok =$_GET['user_id'];

        if($Id_ok != 0){
            foreach ($dbh->query($sql) as $row) {
                $name =$_GET['user_name'];
                $ID= $_GET['user_id'];
                $phone = $_GET['phone'];
                $address = $_GET['address'];
                $Email = $_GET['email'];

                // Just simple thing so I check the new elements
                print 'USER NAME='.$row['name']. ' ,  '.
                        'USER ID="'.$row['id']. '" ,  '.
                        'PHONE="'.$row['telephone']. '
';

                $sql2 = "INSERT INTO USER_INFO
                            VALUES ('.$name.', '.$ID.', '.$phone.',
                                    'work2', 'perhaps')"; // problrm here in $ID .

                $dbh->exec($sql2);
            }
        }
        echo "New record created";
      // Close the connetion
        $dbh = null;
    } catch(PDOException $e) {
        echo $e->getMessage();
    }
?>

--the function I use to submit the form :

function Register(){

    if(userID_Ok_Register() == false){return;}

    users= new Array();

    for(var i=0;i<index;i++){
        users=user[i].split('#');
        if(users[2]==document.user_info.user_id.value){
            alert("ID alreadys exists");
            return;
        }
        document.realForm.user_name.value = document.user_info.user_name.value;
        document.realForm.user_id.value = document.user_info.user_id.value;
        document.realForm.phone.value = document.user_info.phone.value;
        document.realForm.address.value = document.user_info.address.value;
        document.realForm.email.value = document.user_info.email.value;

        document.realForm.submit();
    }
}

I am also using WampServer , don't know if it matters or not  , any help and tips helps alot :>

Tried to take user_id data and put it into a PRIMARY KEY slot in a database table .

I expected it to work as good as it did when I entered  data from within the php code , as in I put 889 or such thing in the ID slot and it worked .

what actully happened is that it wouldn't take the user_ID that is taken from the form , and I have tested , The user_iD is fine , it just wouldn't be inserted into the database .


问:
how to install radium in a good way?
I installed radium by using this command npm install --save radium --legacy-peer-deps though it is installed with some vulnerabilities but my app is showing to me on browser without anything ??

I tried to install radium in a simple way like npm install --save radium but this didn't work due to some peer conflicts somehow it is installed with some vulnerabilities by using this command  npm install --save radium --legacy-peer-deps however my app is blank on browser while wrapping my app component i.e export default Radium(app) if I unwrap it i.e export default app it works...

Title: how to install radium in a good way?


问:
Docker CLI command to print an image's configuration JSON object?
For the life of me I can't figure out how to get the Docker CLI to print the configuration object of an image - the object that gets hashed to create the image ID.

docker inspect doesn't print this.

The only way I know of to get this is docker save <image> -o <image>.tar, untar the image, and get the <image id>.json file from the top-level. This is pretty clunky and inefficient though.


问:
Code assist in Eclipse when using library project for Android
When I use library project in Android, i can not access the resources of library project from main project by writing @drawable/ ..etc . Content assist shows nothing while I press ctrl + space. Each time I should write the resource name by hand.
Is there any method to fix this issue in Code Assist.

Thanks for replies.

ContentLicense: CC BY-SA 3.0


问:
Client Terminated
I'm having an error with izing.io when i try to start.

This is the part of the code that is failing:

```<code>const onDisconnect = (socket: Socket) => {
  socket.on("disconnect", async reason => {
    const { user } = socket.handshake.auth;

    const { tenantId } = user;
    const socketDataTenant = `socketData_${tenantId}`;
    const dataTenant = shared[socketDataTenant];
    if (dataTenant?.usersOnline) {
      if (dataTenant.usersOnline[user.id]) {
        const userSockets = dataTenant.usersOnline[user.id].sockets;
        if (size(userSockets) < 2) {
          delete dataTenant.usersOnline[user.id];
.
.
.
    if (reason === "transport error") {
      reason = "client terminated";   <- Here's the error. VisualStudio says: Type '"client terminated"' is not assignable to type 'DisconnectReason'
    }
.
.
.
</code>```

Title: Client Terminated

Body:
I'm having an error with izing.io when i try to start.

This is the part of the code that is failing:

const onDisconnect = (socket: Socket) => {
  socket.on("disconnect", async reason => {
    const { user } = socket.handshake.auth;

    const { tenantId } = user;
    const socketDataTenant = `socketData_${tenantId}`;
    const dataTenant = shared[socketDataTenant];
    if (dataTenant?.usersOnline) {
      if (dataTenant.usersOnline[user.id]) {
        const userSockets = dataTenant.usersOnline[user.id].sockets;
        if (size(userSockets) < 2) {
          delete dataTenant.usersOnline[user.id];
.
.
.
    if (reason === "transport error") {
      reason = "client terminated";   <- Here's the error. VisualStudio says: Type '"client terminated"' is not assignable to type 'DisconnectReason'
    }
.
.
.


问:
Webdriverio test breaks when running in lamdatest, it works good on chrome on my local, but when running on lamdatest getting the following error
Failed to fetch browser webSocket URL from http://localhost:53017/json/version: request to http://localhost:53017/json/version failed, reason: connect ECONNREFUSED 127.0.0.1:53017
I am using webdriverio v7 version with node v16.6.0

How can this issue be solved?


问:
EF7: exclude design-time dependencies in release build
In my web API application I have some EF7 classes used just at design-time, such as implementations of IDesignTimeServices, IPluralizer, etc.

I'd like them and their dependencies (e.g.: Microsoft.EntityFrameworkCore.Design) to be excluded from the release build.

Is there a way of doing so (possibly somehow better than using #if DEBUG pragmas)?


问:
Is there a way to add user sessions to twisted/klein web framework?
I used the twisted/klein micro framework to build a small web app. I would now like to add a part to the app which is password protected. Is there a way to do that? It seems like twisted has a way to do it, but I cannot figure out how to roll it into the klein framework? Does someone have an example that shows how this can be accomplished?</p>


问:
Android How to set popup windows on toolbar
I have set up a toolbar and added a menu item
My toolbar

But I want to change the menu to popup windows, resulting in my main active button
My main active button

I am a novice, so I may have used a stupid method.
I try to do like my mainActivity, but when I click on it, nothing happens

This is my code

```<code>@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.toolbar_set_menu,menu);
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.toolbar_set) {
        Button button;
        myDialog.setContentView(R.layout.activity_popup_windows_settings);
        button = (Button) myDialog.findViewById(R.id.dismiss);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myDialog.dismiss();
            }
        });
        myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        myDialog.show();
    }

    return super.onOptionsItemSelected(item);
}
</code>```

This is my toolbar.xml

```<code><androidx.appcompat.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="1dp"
    android:background="@color/brown"
    android:minHeight="?attr/actionBarSize"

    android:theme="@style/ToolbarTheme"
    app:layout_constraintStart_toStartOf="parent"

    app:layout_constraintTop_toTopOf="parent"
    app:menu="@menu/toolbar_set_menu"
    app:navigationIcon="@drawable/app_icon"

    app:title="PET NEVERLAND"
    app:titleMarginTop="12dp"
    app:titleTextAppearance="@style/tool_bar_style" />
</code>```

This is my menu

```<code><item
    android:icon="@drawable/navigation_icon2"
    app:showAsAction="always"
    android:title="Settings"
    android:id="@+id/toolbar_set"
    />
</code>```

My mainactivity(I want the same result so I tried copy paste to my toolbar)

```<code>public class MainActivity extends AppCompatActivity implements AdapterView.OnClickListener {

    TextView txv;
    ImageButton star;
    int counter = 0;
    Dialog myDialog;

    public void ShowPopup(View v) {
        Button button;
        myDialog.setContentView(R.layout.activity_popup_windows_settings);
        button = (Button) myDialog.findViewById(R.id.dismiss);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myDialog.dismiss();
                }
            });
            myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        myDialog.show();
    }
</code>```

Body:
I have set up a toolbar and added a menu item
My toolbar

But I want to change the menu to popup windows, resulting in my main active button
My main active button

I am a novice, so I may have used a stupid method.
I try to do like my mainActivity, but when I click on it, nothing happens

This is my code

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.toolbar_set_menu,menu);
    return super.onCreateOptionsMenu(menu);
}

@Override
public boolean onOptionsItemSelected(@NonNull MenuItem item) {
    int id = item.getItemId();
    if (id == R.id.toolbar_set) {
        Button button;
        myDialog.setContentView(R.layout.activity_popup_windows_settings);
        button = (Button) myDialog.findViewById(R.id.dismiss);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myDialog.dismiss();
            }
        });
        myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        myDialog.show();
    }

    return super.onOptionsItemSelected(item);
}

This is my toolbar.xml

<androidx.appcompat.widget.Toolbar
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginStart="1dp"
    android:background="@color/brown"
    android:minHeight="?attr/actionBarSize"

    android:theme="@style/ToolbarTheme"
    app:layout_constraintStart_toStartOf="parent"

    app:layout_constraintTop_toTopOf="parent"
    app:menu="@menu/toolbar_set_menu"
    app:navigationIcon="@drawable/app_icon"

    app:title="PET NEVERLAND"
    app:titleMarginTop="12dp"
    app:titleTextAppearance="@style/tool_bar_style" />

This is my menu

<item
    android:icon="@drawable/navigation_icon2"
    app:showAsAction="always"
    android:title="Settings"
    android:id="@+id/toolbar_set"
    />

My mainactivity(I want the same result so I tried copy paste to my toolbar)

public class MainActivity extends AppCompatActivity implements AdapterView.OnClickListener {

    TextView txv;
    ImageButton star;
    int counter = 0;
    Dialog myDialog;

    public void ShowPopup(View v) {
        Button button;
        myDialog.setContentView(R.layout.activity_popup_windows_settings);
        button = (Button) myDialog.findViewById(R.id.dismiss);
        button.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                myDialog.dismiss();
                }
            });
            myDialog.getWindow().setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
        myDialog.show();
    }


问:
Decrypt Golang aes256ctr encrypted data through PHP
I have written a code in GoLang to encrypt data in AES-256-CTR and i am trying to decrypt that data through PHP but i am getting some random binary in PHP output.

Here are my Golang codes:

```<code>package main

import (
    "crypto/aes"
    "crypto/cipher"
    "fmt"
    "io/ioutil"
    "net/http"
    "net/url"
    "strings"
)

var IV = []byte("1234567812345678")

func main() {
    var plainText = "Hello Adam, This is a message."
    Encrypt(plainText)
}

func Encrypt(plainText string) {
    bytes := []byte(plainText)
    blockCipher, _ := aes.NewCipher([]byte("SJR9Z5htexfvMuYhNrl/3w=="))
    stream := cipher.NewCTR(blockCipher, IV)
    stream.XORKeyStream(bytes, bytes)
    _ = ioutil.WriteFile(fmt.Sprintf("encoded"), bytes, 0644)
}

func ReadFile(filename string) string {
    fileData, _ := ioutil.ReadFile(filename)
    fileString := string(fileData)
    return fileString
}
</code>```

Now, I am decrypting the data which is saved in encoded file through the above code in PHP:

```<code><?php
$password = "SJR9Z5htexfvMuYhNrl/3w==";
$method = 'aes-256-ctr';
$iv = "1234567812345678";
$decrypted = openssl_decrypt(file_get_contents("encoded"), $method, $password, OPENSSL_RAW_DATA, $iv);
echo 'decrypted to: ' . $decrypted . "\n\n";
?>
</code>```

These PHP codes are returning values like a compiled binary file or you can say the encrypted data. The below Go code is working fine when decrypting the encrypted data:

```<code>func decryption() []byte {
    bytes, err := ioutil.ReadFile(fmt.Sprintf("encoded"))
    if err != nil {
        log.Fatalf("Reading encrypted file: %s", err)
    }
    blockCipher, _ := aes.NewCipher([]byte("SJR9Z5htexfvMuYhNrl/3w=="))
    stream := cipher.NewCTR(blockCipher, IV)
    stream.XORKeyStream(bytes, bytes)
    return bytes
}
</code>```

Can anyone provide me a solution to decrypt the data in PHP?

I have tried changing OPENSSL_RAW_DATA but didn't got correct output. I am expecting a correct code to decrypt the data in PHP

Body:
I have written a code in GoLang to encrypt data in AES-256-CTR and i am trying to decrypt that data through PHP but i am getting some random binary in PHP output.

Here are my Golang codes:

package main

import (
    "crypto/aes"
    "crypto/cipher"
    "fmt"
    "io/ioutil"
    "net/http"
    "net/url"
    "strings"
)

var IV = []byte("1234567812345678")

func main() {
    var plainText = "Hello Adam, This is a message."
    Encrypt(plainText)
}

func Encrypt(plainText string) {
    bytes := []byte(plainText)
    blockCipher, _ := aes.NewCipher([]byte("SJR9Z5htexfvMuYhNrl/3w=="))
    stream := cipher.NewCTR(blockCipher, IV)
    stream.XORKeyStream(bytes, bytes)
    _ = ioutil.WriteFile(fmt.Sprintf("encoded"), bytes, 0644)
}

func ReadFile(filename string) string {
    fileData, _ := ioutil.ReadFile(filename)
    fileString := string(fileData)
    return fileString
}

Now, I am decrypting the data which is saved in encoded file through the above code in PHP:

<?php
$password = "SJR9Z5htexfvMuYhNrl/3w==";
$method = 'aes-256-ctr';
$iv = "1234567812345678";
$decrypted = openssl_decrypt(file_get_contents("encoded"), $method, $password, OPENSSL_RAW_DATA, $iv);
echo 'decrypted to: ' . $decrypted . "\n\n";
?>

These PHP codes are returning values like a compiled binary file or you can say the encrypted data. The below Go code is working fine when decrypting the encrypted data:

func decryption() []byte {
    bytes, err := ioutil.ReadFile(fmt.Sprintf("encoded"))
    if err != nil {
        log.Fatalf("Reading encrypted file: %s", err)
    }
    blockCipher, _ := aes.NewCipher([]byte("SJR9Z5htexfvMuYhNrl/3w=="))
    stream := cipher.NewCTR(blockCipher, IV)
    stream.XORKeyStream(bytes, bytes)
    return bytes
}

Can anyone provide me a solution to decrypt the data in PHP?

I have tried changing OPENSSL_RAW_DATA but didn't got correct output. I am expecting a correct code to decrypt the data in PHP


问:
Should I use free functions instead of a class with only public methods if I want to change variables inside a cpp file?
I have a module foo. It consists of a header foo.h and a cpp foo.cpp.

Inside the foo.cpp I have some variables/objects that are statically allocated.

They have to be statically allocated that's why I put them inside the cpp file.

I need to access those variables but I do not want to put any details inside the header file.

I do not want the client to know how the foo module operates and what it might contain.

I created a class that contains only public methods.

```<code>class Foo
{
public:
  void doThat();
  void doThis();
  int getA();
  int getB();
};
</code>```

Inside the cpp file I implemented the class like this.

```<code>#include "foo.h"
#include "module_a.h"

/*
 * Bar is declared and implemented here.
*/

static Bar bar;

void Foo::doThat()
{
  bar.doSomething("hello");
}

void Foo::doThis();
{
  bar.doSomethingElse();
  module_a_run(5);
}

int Foo::getA()
{
  int x = bar.getA();
  x = x + module_a_get();
  return x;
}

int Foo::getB()
{
  return bar.getX();
}
</code>```

Should I get rid of the class and replace everything with free functions with a namespace?

Body:
I have a module foo. It consists of a header foo.h and a cpp foo.cpp.

Inside the foo.cpp I have some variables/objects that are statically allocated.

They have to be statically allocated that's why I put them inside the cpp file.

I need to access those variables but I do not want to put any details inside the header file.

I do not want the client to know how the foo module operates and what it might contain.

I created a class that contains only public methods.

class Foo
{
public:
  void doThat();
  void doThis();
  int getA();
  int getB();
};

Inside the cpp file I implemented the class like this.

#include "foo.h"
#include "module_a.h"

/*
 * Bar is declared and implemented here.
*/

static Bar bar;

void Foo::doThat()
{
  bar.doSomething("hello");
}

void Foo::doThis();
{
  bar.doSomethingElse();
  module_a_run(5);
}

int Foo::getA()
{
  int x = bar.getA();
  x = x + module_a_get();
  return x;
}

int Foo::getB()
{
  return bar.getX();
}

Should I get rid of the class and replace everything with free functions with a namespace?


问:
React site build and deployment automation
I have a ReactJs site which I make numerous changes to almost daily. My workflow once I'm done with coding is to commit to GitHub -> run npm run deploy which builds and deploys to gh-pages -> check the live version on the internet.

I wanted to automate this process so I tried GitHub actions. I changed my repos pages setting from deploy from branch to gh-actions. I accepted the default yml file after skimming through the gh-actions docs (seemed to accomplish what I wanted so I just went with it).

However, when I pushed some code on the repo then checked live, the site only showed the ReadMe file from the master branch. I kinda get how the automatic deployment works but somehow it deploys the ReadMe from the master branch rather than the gh-pages branch.

I don't really know how to fix it so any help would be appreciated.

Here's the yml file:

```<code># Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["master"]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow one concurrent deployment
concurrency:
  group: "pages"
  cancel-in-progress: true

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup Pages
        uses: actions/configure-pages@v2
      - name: Build with Jekyll
        uses: actions/jekyll-build-pages@v1
        with:
          source: ./
          destination: ./_site
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v1
</code>```

I am trying to automatically build and deploy on changes to the master branch.

Body:
I have a ReactJs site which I make numerous changes to almost daily. My workflow once I'm done with coding is to commit to GitHub -> run npm run deploy which builds and deploys to gh-pages -> check the live version on the internet.

I wanted to automate this process so I tried GitHub actions. I changed my repos pages setting from deploy from branch to gh-actions. I accepted the default yml file after skimming through the gh-actions docs (seemed to accomplish what I wanted so I just went with it).

However, when I pushed some code on the repo then checked live, the site only showed the ReadMe file from the master branch. I kinda get how the automatic deployment works but somehow it deploys the ReadMe from the master branch rather than the gh-pages branch.

I don't really know how to fix it so any help would be appreciated.

Here's the yml file:

# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled

on:
  # Runs on pushes targeting the default branch
  push:
    branches: ["master"]

  # Allows you to run this workflow manually from the Actions tab
  workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
  contents: read
  pages: write
  id-token: write

# Allow one concurrent deployment
concurrency:
  group: "pages"
  cancel-in-progress: true

jobs:
  # Build job
  build:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v3
      - name: Setup Pages
        uses: actions/configure-pages@v2
      - name: Build with Jekyll
        uses: actions/jekyll-build-pages@v1
        with:
          source: ./
          destination: ./_site
      - name: Upload artifact
        uses: actions/upload-pages-artifact@v1

I am trying to automatically build and deploy on changes to the master branch.


问:
MassTransit Consumer - .NET 6.0 Console Application - Deployment Options
I'm relatively new to MassTransit and have been following the tutorials on the MassTransit website, which are all working as expected, but I have some questions regarding deployment.

Tutorials: https://masstransit-project.com/usage/consumers.html#consumer

I'm wondering at the most basic level how someone creating a MassTransit Consumer in a .NET 6.0 Console Application would deploy this console application on a Windows Server and ensure that it's always up and running to consume messages? Say for example the server was rebooted, etc...

Short of creating a Docker container, what other options exist? Run a WorkerService as a Windows Service?


问:
Type is not assignable to type - ts(2416)
I have the following interface and type (simplified):

```<code>type MyOwnColorType = "red" | "blue";

interface Title {
  id: string;
  color: MyOwnColorType;
}

export interface Example {
  title: Title;
}
</code>```

If i try to create a class using this interface it will throw the ts 2416 error:

```<code>class JustAExample implements Example {
  title = {
    id: "value",
    color: "red",
  }
}
</code>```

It works if i cast it but that kind of defeats the purpose:

```<code>class JustAExample implements Example {
  title = {
    id: "value",
    color: "red" as MyOwnColorType,
  }
}
</code>```

Normally I would just state the type but considering it's a literal object I honestly just don't know the syntax for it. If I would put in a number for the id field it would state that wrong value is used so it does work as intended.

How can I make sure that the color is the given type?

Body:
I have the following interface and type (simplified):

type MyOwnColorType = "red" | "blue";

interface Title {
  id: string;
  color: MyOwnColorType;
}

export interface Example {
  title: Title;
}

If i try to create a class using this interface it will throw the ts 2416 error:

class JustAExample implements Example {
  title = {
    id: "value",
    color: "red",
  }
}

It works if i cast it but that kind of defeats the purpose:

class JustAExample implements Example {
  title = {
    id: "value",
    color: "red" as MyOwnColorType,
  }
}

Normally I would just state the type but considering it's a literal object I honestly just don't know the syntax for it. If I would put in a number for the id field it would state that wrong value is used so it does work as intended.

How can I make sure that the color is the given type?


问:
Getting GHC to print unicode correctly
Using GHC(i) 9.2.5. (Thus, supposedly, after the fix mentioned here), trying to run the following snippet:

import Main.Utf8
import GHC.IO.Encoding (getLocaleEncoding)

main :: IO ()
main withUtf8 $ do
  locale <- getLocaleEncoding
  putStrLn $ show locale
  putStrLn "ˢᵐᵃˡˡ"
```
<p>(<code>withUtf8</code> is from this library, just a utility to wrap setting encoding. I have tried every variation I can come up with of setting the encoding myself manually, with the only difference being that without it I either get garbled nonsense or an encoding error instead of <code>?????</code>)</p>
<p>The result is always</p>
```UTF-8
?????
```

This is running on a Windows tablet, initially with Alacritty wrapping MSYS, but I've tried on the MSYS terminal emulators, and with Windows PowerShell, and the effect is always the same. Additionally, the text isn't mangled when writing to a file instead of stdout, which leads me to believe it's not lying about the encoding. Furthermore, all my locale environment variables are UTF-8, echo "ˢᵐᵃˡˡ" works fine, and I am able to run other command line programs and interpreters (node JS) without problem, so I'm fairly confident that the terminal(s) are perfectly capable of handling the output properly and it's uniquely GHC(i) that's messing this up. Using Text instead of String with UTF libraries has no impact.

This seems like it's probably a bug with GHC(i), but I've looked around their tracker and it seems like it's almost certainly already being talked about, and it doesn't honestly look like there's been all that much movement. So, in lieu of just giving them yet another ticket, is there any way that I can work around this and get unicode to properly print to stdout?

Title: Getting GHC to print unicode correctly

Body:
Using GHC(i) 9.2.5. (Thus, supposedly, after the fix mentioned here), trying to run the following snippet:

import Main.Utf8
import GHC.IO.Encoding (getLocaleEncoding)

main :: IO ()
main withUtf8 $ do
  locale <- getLocaleEncoding
  putStrLn $ show locale
  putStrLn "ˢᵐᵃˡˡ"

(withUtf8 is from this library, just a utility to wrap setting encoding. I have tried every variation I can come up with of setting the encoding myself manually, with the only difference being that without it I either get garbled nonsense or an encoding error instead of ?????)

The result is always

UTF-8
?????

This is running on a Windows tablet, initially with Alacritty wrapping MSYS, but I've tried on the MSYS terminal emulators, and with Windows PowerShell, and the effect is always the same. Additionally, the text isn't mangled when writing to a file instead of stdout, which leads me to believe it's not lying about the encoding. Furthermore, all my locale environment variables are UTF-8, echo "ˢᵐᵃˡˡ" works fine, and I am able to run other command line programs and interpreters (node JS) without problem, so I'm fairly confident that the terminal(s) are perfectly capable of handling the output properly and it's uniquely GHC(i) that's messing this up. Using Text instead of String with UTF libraries has no impact.

This seems like it's probably a bug with GHC(i), but I've looked around their tracker and it seems like it's almost certainly already being talked about, and it doesn't honestly look like there's been all that much movement. So, in lieu of just giving them yet another ticket, is there any way that I can work around this and get unicode to properly print to stdout?


问:
API requests are triggered in both SSR and browser

I'm looking for kind soul that can explain to me or point me to a resorce where I can learn about SSR in Angular.

My problem

At first a little background.

Using RouterModule I have added rule that every link (that was not cached earler) should use resolver like so:

const routes: Routes = [
    // other routes
    {
        path: "**",
        loadChildren: () => import("./static-page/static-page.module").then((m) => m.StaticPageModule),
        resolve: {
            staticPage: StaticPageResolver
        }
    }
];
```
<p>this resolver fetches data from API via HTTP call</p>
<p>next in my component there is a subscriber that collects fetched data and displays it on the page.</p>
<pre class="lang-js prettyprint-override"><code>this.router.data.subscribe((value) => {
    this.staticPage = (value["staticPage"] as StaticPage) ?? null;
    this.changeDetectionRef.markForCheck();
});
</code>```

now to the point.

This staticPage is fetched in SSR and then again in the browser.

I feel like this is a waste of resources which impacts performance. Some of those API calls are massive and last around .5s which in this configuration are doubled.

What I tried

I have tried disabling api calls in resolver when in browser wit h isPlatformBrowser but then my page loads with all the content and after constructor, ngOnInit or other lifecycle triggers whole page content dissapears like no api call was ever performed.

Moving these api calls to the browser is out of the question and my SEO master is going to kill me for this.

There isn't a lot that I have tried but honestly I'm out of ideas.

Body:
I'm looking for kind soul that can explain to me or point me to a resorce where I can learn about SSR in Angular.

My problem

At first a little background.

Using RouterModule I have added rule that every link (that was not cached earler) should use resolver like so:

const routes: Routes = [
    // other routes
    {
        path: "**",
        loadChildren: () => import("./static-page/static-page.module").then((m) => m.StaticPageModule),
        resolve: {
            staticPage: StaticPageResolver
        }
    }
];

this resolver fetches data from API via HTTP call

next in my component there is a subscriber that collects fetched data and displays it on the page.

this.router.data.subscribe((value) => {
    this.staticPage = (value["staticPage"] as StaticPage) ?? null;
    this.changeDetectionRef.markForCheck();
});

now to the point.

This staticPage is fetched in SSR and then again in the browser.

I feel like this is a waste of resources which impacts performance. Some of those API calls are massive and last around .5s which in this configuration are doubled.

What I tried

I have tried disabling api calls in resolver when in browser wit h isPlatformBrowser but then my page loads with all the content and after constructor, ngOnInit or other lifecycle triggers whole page content dissapears like no api call was ever performed.

Moving these api calls to the browser is out of the question and my SEO master is going to kill me for this.

There isn't a lot that I have tried but honestly I'm out of ideas.


问:
Filtering posts in Wordpress
basically I am trying to filter brokers based on the checkboxes selected.
here is a print screen

enter image description here

function selectData() {
<?php
$forex = new WP_Query(array(
                'posts_per_page' => -1,
                'category_name' => 'forex', // i dont need meta_query cause of this line?
                'post_type' => 'Broker',
              ));

              while($forex->have_posts()) {
                $forex->the_post();
                $forex->the_title();
                $forex->the_content();
              }; wp_reset_postdata();
?>
}
```
<p>The code above is wp_query that gets the posts for the forex checkbox of the above print screen.
(not going to post all wp_query as they are the same but retrieve data for each checkbox from above)</p>
<p>the next step is where I am stuck
As you can see there are 6 brokers for beginners, 8 broker for intermediate and 12 brokers for advanced.</p>
<p>enter image description here</p>
<p>The wp_query for 2nd print screen is as follow:</p>
<pre class="lang-js prettyprint-override"><code>$beginner = new WP_Query(array(
       'posts_per_page' => -1,
       'post_type' => 'Broker',
       'meta_key' => 'broker_type',
       'meta_query' =>  array(
         array(
          'key' => 'broker_type',
          'compare' => 'LIKE',
          'value' => 'Beginner',
        ),
     )
));
while($beginner->have_posts()) {
   $beginner->the_post();
                          the_title();
   $beginner->the_content();
}; wp_reset_postdata();
</code>```

However. I don't want to show all 6 brokers post for beginner, 8 broker for intermediate and 12 brokers for advanced (these are all the brokers in the database, they range from all 8 options). For this reason, I want to show the brokers based on the selected broker from the first print screen.
e.g: let says I select 3 options from the first step of the multi step form:
enter image description here

Then I click next:

enter image description here

How would I change the $beginner wp_query to only show the selected brokers? as I am trying not to show these 6 brokers for beginners, 8 broker for intermediate and 12 brokers for advanced. and only show the brokers based on the selected checkboxes?

how would I go about modifying my beginners wp_query for this?

I tried creating a function but it doesn't work (not even sure if I need to add a filter? or create this function?

function BrokersSelected($beginner) {
          selectData();  (the selectData() function contains the forex wp_query as shown above)
          selectData1(); (the selectData1() function contains the commodities wp_query)
          selectData2(); (this selectData2() function contains the crypto wp_query)
          selectData3();       etc etc.
          selectData4();
          selectData5();
          selectData6();
          selectData7();
          if (selectData().checked || selectData1().checked || selectData2().checked || selectData3().checked ||
              selectData4().checked || selectData5().checked || selectData6().checked || selectData7().checked)  {
            return $beginner; // this line here needs to change so confused/ not needed
          }
}
add_filter( 'get_broker_type_metadata' , 'BrokersSelected');
```

I also tried to create two filter functions but not sure why the javascript bit goes white(it stops working).
Any help would be appreciated. There are 8 checkbox in total the first functions is just me trying get these checkboxes and put it in an if statement.  but they are white so they don't work

enter image description here

I tried hard but nothing happened

Title: Filtering posts in Wordpress

Body:
basically I am trying to filter brokers based on the checkboxes selected.
here is a print screen

enter image description here

function selectData() {
<?php
$forex = new WP_Query(array(
                'posts_per_page' => -1,
                'category_name' => 'forex', // i dont need meta_query cause of this line?
                'post_type' => 'Broker',
              ));

              while($forex->have_posts()) {
                $forex->the_post();
                $forex->the_title();
                $forex->the_content();
              }; wp_reset_postdata();
?>
}

The code above is wp_query that gets the posts for the forex checkbox of the above print screen.
(not going to post all wp_query as they are the same but retrieve data for each checkbox from above)

the next step is where I am stuck
As you can see there are 6 brokers for beginners, 8 broker for intermediate and 12 brokers for advanced.

enter image description here

The wp_query for 2nd print screen is as follow:

$beginner = new WP_Query(array(
       'posts_per_page' => -1,
       'post_type' => 'Broker',
       'meta_key' => 'broker_type',
       'meta_query' =>  array(
         array(
          'key' => 'broker_type',
          'compare' => 'LIKE',
          'value' => 'Beginner',
        ),
     )
));
while($beginner->have_posts()) {
   $beginner->the_post();
                          the_title();
   $beginner->the_content();
}; wp_reset_postdata();

However. I don't want to show all 6 brokers post for beginner, 8 broker for intermediate and 12 brokers for advanced (these are all the brokers in the database, they range from all 8 options). For this reason, I want to show the brokers based on the selected broker from the first print screen.
e.g: let says I select 3 options from the first step of the multi step form:
enter image description here

Then I click next:

enter image description here

How would I change the $beginner wp_query to only show the selected brokers? as I am trying not to show these 6 brokers for beginners, 8 broker for intermediate and 12 brokers for advanced. and only show the brokers based on the selected checkboxes?

how would I go about modifying my beginners wp_query for this?

I tried creating a function but it doesn't work (not even sure if I need to add a filter? or create this function?

function BrokersSelected($beginner) {
          selectData();  (the selectData() function contains the forex wp_query as shown above)
          selectData1(); (the selectData1() function contains the commodities wp_query)
          selectData2(); (this selectData2() function contains the crypto wp_query)
          selectData3();       etc etc.
          selectData4();
          selectData5();
          selectData6();
          selectData7();
          if (selectData().checked || selectData1().checked || selectData2().checked || selectData3().checked ||
              selectData4().checked || selectData5().checked || selectData6().checked || selectData7().checked)  {
            return $beginner; // this line here needs to change so confused/ not needed
          }
}
add_filter( 'get_broker_type_metadata' , 'BrokersSelected');

I also tried to create two filter functions but not sure why the javascript bit goes white(it stops working).
Any help would be appreciated. There are 8 checkbox in total the first functions is just me trying get these checkboxes and put it in an if statement.  but they are white so they don't work

enter image description here

I tried hard but nothing happened


问:
Why is the application.properties of a dependency used over the main one when building an uber jar for a quarkus project?
I have a quarkus project with custom maven dependencies (one of which is another quarkus project). The reason is that the dependency project, which is supposed to be a library/template for a microservice, has route resources (@Path etc.) for the API which each of the other quarkus projects need to have. I dont want to repeat that code if it is 100% the same. When i build an uber-jar, so the compiled jar has the custom local maven repository projects included, it contains the application.properties file of the dependency rather than its own application.properties. Why is that? Some more context:

Example of project hierarchies:

base-quarkus-service (has classes of which some are @Path resources, but is not supposed to be a real service but only included in other quarkus microservice projects).

pom.xml with remote and quarkus dependencies.

src/main/java/... service classes with also some resources classes with @Path annotations etc.

src/main/java/resources/application.properties with some basic settings so the project can be compiled and packaged.

quarkus-service-1 (a real service which is supposed to include the code and also routes of base-quarkus-project alongside its own)

pom.xml with remote and quarkus dependencies AND local base-quarkus-service dependency.

src/main/java/resources/application.properties with actual settings for the real service (but the the packaged uber-jar for quarkus-service-1 contains application.properties of base-quarkus-service instead of its own)

I build the compiled project for base-quarkus-service so it is stored in the local m2 repository simply with:

```<code>mvn clean install -DskipTests
</code>```

In the quarkus-service-1 project i added the following config in application.properties (as explained here https://quarkus.io/guides/maven-tooling#uber-jar-maven), so an uber-jar will be generated when i run mvn clean install:

```<code>quarkus.package.type=uber-jar
</code>```

This works, as the output target directory contains an jar (called *-runner) with all the sources of the dependencies, including of base-quarkus_service, within - at least i am assuming this is the uber-jar. However, the project does not run due to failure to inject custom config properties into my code specified in application.properties. When i opened the generated uber-jar of quarkus-service-1 to check why, i saw that it contains the application.properties of base-quarkus-service instead of its own. Can someone explain to me how to fix this so it uses its own application.properties rather than the one of a dependency for the uber-jar?

(Content of the application.properties file here is of base-quarkus-service, not from quarkus-service-1as it should be)

Body:
I have a quarkus project with custom maven dependencies (one of which is another quarkus project). The reason is that the dependency project, which is supposed to be a library/template for a microservice, has route resources (@Path etc.) for the API which each of the other quarkus projects need to have. I dont want to repeat that code if it is 100% the same. When i build an uber-jar, so the compiled jar has the custom local maven repository projects included, it contains the application.properties file of the dependency rather than its own application.properties. Why is that? Some more context:

Example of project hierarchies:

base-quarkus-service (has classes of which some are @Path resources, but is not supposed to be a real service but only included in other quarkus microservice projects).

pom.xml with remote and quarkus dependencies.

src/main/java/... service classes with also some resources classes with @Path annotations etc.

src/main/java/resources/application.properties with some basic settings so the project can be compiled and packaged.

quarkus-service-1 (a real service which is supposed to include the code and also routes of base-quarkus-project alongside its own)

pom.xml with remote and quarkus dependencies AND local base-quarkus-service dependency.

src/main/java/resources/application.properties with actual settings for the real service (but the the packaged uber-jar for quarkus-service-1 contains application.properties of base-quarkus-service instead of its own)

I build the compiled project for base-quarkus-service so it is stored in the local m2 repository simply with:

mvn clean install -DskipTests

In the quarkus-service-1 project i added the following config in application.properties (as explained here https://quarkus.io/guides/maven-tooling#uber-jar-maven), so an uber-jar will be generated when i run mvn clean install:

quarkus.package.type=uber-jar

This works, as the output target directory contains an jar (called *-runner) with all the sources of the dependencies, including of base-quarkus_service, within - at least i am assuming this is the uber-jar. However, the project does not run due to failure to inject custom config properties into my code specified in application.properties. When i opened the generated uber-jar of quarkus-service-1 to check why, i saw that it contains the application.properties of base-quarkus-service instead of its own. Can someone explain to me how to fix this so it uses its own application.properties rather than the one of a dependency for the uber-jar?

(Content of the application.properties file here is of base-quarkus-service, not from quarkus-service-1as it should be)


问:
Pyspark map function behaving unexpectedly with given method
I have written a class to add values from a 2D list based on an ID column.

The class works just fine when called normally, and the merge function works as intended. However, when handed to the map function of an Pyspark rdd pipline the result errors whenever I call collect or try and apply the reduce function to it.

As far as I can tell from the error it looks like it is attempting to use the values from the class 'diction' variable, but I can't work out why.

```<code># To be used in the MapReduce
class CountAccumilator:
  def __init__(self, target, id_position, sum_position):
    self.id_position = id_position
    self.sum_position = sum_position
    self.diction = {}
    # Sums given group
    self.count(target)

  def count(self, iterable):
    for x in iterable:
      # Either adds value to current key or adds new key with base value
      if x[self.id_position] not in self.diction.keys():
        self.diction[x[self.id_position]] = x[self.sum_position]
      else:
        self.diction[x[self.id_position]] += x[self.sum_position]

  def merge(self, countAccumilator):
    # Same as count. Takes self instead
    for x in countAccumilator.diction.keys():
      if x not in self.diction.keys():
        self.diction[x] = countAccumilator.diction[x]
      else:
        self.diction[x] += countAccumilator.diction[x]

def accumilate_mapper(data):
  return CountAccumilator(data, 0, 1)

def accumilate_reducer(data1, data2):
  data1.merge(data2)
  return data1

testValues = [  ['John', 8],
  ['Sarah', 3],
  ['Mike', 7],
  ['Emily', 2],
  ['David', 1],
  ['Jessica', 6],
  ['Robert', 9],
  ['Ashley', 4],
  ['Chris', 5],
  ['Megan', 2],
  ['Laura', 8],
  ['James', 3],
  ['Emily', 7],
  ['William', 1],
  ['Ashley', 6],
  ['Michael', 9],
  ['Samantha', 4],
  ['Christopher', 5],
  ['Laura', 2],
  ['David', 8],
  ['Sarah', 3],
  ['Christopher', 7],
  ['Megan', 1],
  ['John', 6],
  ['Jessica', 9],
  ['Robert', 4],
  ['James', 5],
  ['Emily', 2],
  ['Michael', 8],
  ['William', 3],
  ['Ashley', 7],
  ['Chris', 1],
  ['Samantha', 6],
  ['Megan', 9],
  ['Laura', 4],
  ['David', 5],
  ['Sarah', 2],
  ['Christopher', 8],
  ['John', 3],
  ['Jessica', 7],
  ['Robert', 1],
  ['James', 6],
  ['Emily', 9],
  ['Michael', 4],
  ['William', 5],
  ['Ashley', 2],
  ['Chris', 8],
  ['Samantha', 3],
  ['Megan', 7],
  ['Laura', 1],
  ['David', 6],
  ['Sarah', 9]
]
test_data = sc.parallelize(testValues)

mapped_test = test_data.map(accumilate_mapper)
totals = mapped_test.reduce(accumilate_reducer)

print(totals.diction)

</code>```

Body:
I have written a class to add values from a 2D list based on an ID column.

The class works just fine when called normally, and the merge function works as intended. However, when handed to the map function of an Pyspark rdd pipline the result errors whenever I call collect or try and apply the reduce function to it.

As far as I can tell from the error it looks like it is attempting to use the values from the class 'diction' variable, but I can't work out why.

# To be used in the MapReduce
class CountAccumilator:
  def __init__(self, target, id_position, sum_position):
    self.id_position = id_position
    self.sum_position = sum_position
    self.diction = {}
    # Sums given group
    self.count(target)

  def count(self, iterable):
    for x in iterable:
      # Either adds value to current key or adds new key with base value
      if x[self.id_position] not in self.diction.keys():
        self.diction[x[self.id_position]] = x[self.sum_position]
      else:
        self.diction[x[self.id_position]] += x[self.sum_position]

  def merge(self, countAccumilator):
    # Same as count. Takes self instead
    for x in countAccumilator.diction.keys():
      if x not in self.diction.keys():
        self.diction[x] = countAccumilator.diction[x]
      else:
        self.diction[x] += countAccumilator.diction[x]

def accumilate_mapper(data):
  return CountAccumilator(data, 0, 1)

def accumilate_reducer(data1, data2):
  data1.merge(data2)
  return data1

testValues = [  ['John', 8],
  ['Sarah', 3],
  ['Mike', 7],
  ['Emily', 2],
  ['David', 1],
  ['Jessica', 6],
  ['Robert', 9],
  ['Ashley', 4],
  ['Chris', 5],
  ['Megan', 2],
  ['Laura', 8],
  ['James', 3],
  ['Emily', 7],
  ['William', 1],
  ['Ashley', 6],
  ['Michael', 9],
  ['Samantha', 4],
  ['Christopher', 5],
  ['Laura', 2],
  ['David', 8],
  ['Sarah', 3],
  ['Christopher', 7],
  ['Megan', 1],
  ['John', 6],
  ['Jessica', 9],
  ['Robert', 4],
  ['James', 5],
  ['Emily', 2],
  ['Michael', 8],
  ['William', 3],
  ['Ashley', 7],
  ['Chris', 1],
  ['Samantha', 6],
  ['Megan', 9],
  ['Laura', 4],
  ['David', 5],
  ['Sarah', 2],
  ['Christopher', 8],
  ['John', 3],
  ['Jessica', 7],
  ['Robert', 1],
  ['James', 6],
  ['Emily', 9],
  ['Michael', 4],
  ['William', 5],
  ['Ashley', 2],
  ['Chris', 8],
  ['Samantha', 3],
  ['Megan', 7],
  ['Laura', 1],
  ['David', 6],
  ['Sarah', 9]
]
test_data = sc.parallelize(testValues)

mapped_test = test_data.map(accumilate_mapper)
totals = mapped_test.reduce(accumilate_reducer)

print(totals.diction)


问:
How to track the time changed of datetime picker for `matInput`
I have the following datetime picker defined in my template:

```<code><td mat-cell *matCellDef="let element" >
                    <mat-form-field>
                        <input matInput [ngxMatDatetimePicker]="picker" [formControl]="dateControl"
                            (dateChange)="onScheduleDateChanged($event)"
                        placeholder="Choose a date" [(ngModel)]="element.date" [disabled]="true">

                        <mat-datepicker-toggle matIconSuffix [for]="$any(picker)"></mat-datepicker-toggle>

                        <ngx-mat-datetime-picker #picker [showSpinners]="true" [showSeconds]="true" [stepHour]="1"
                            [stepMinute]="1" [stepSecond]="1" [touchUi]="false" [color]="color" [enableMeridian]="true"
                            [disableMinute]="false" [hideTime]="false">
                        </ngx-mat-datetime-picker>
                        {{getDisplayDate(element.date)}}
                    </mat-form-field>
                </td>
</code>```

I want to catch when the time is changed. The problem I am having is that when my handler onScheduleDateChanged is called, the time is not reflected in an argument $event passed to my handler onScheduleDateChanged (it still contains the old time). I think this is because the handler handles the event dateChange not the time changed one. The question is how do I handle the time changed event.

Body:
I have the following datetime picker defined in my template:

                    <mat-form-field>
                        <input matInput [ngxMatDatetimePicker]="picker" [formControl]="dateControl"
                            (dateChange)="onScheduleDateChanged($event)"
                        placeholder="Choose a date" [(ngModel)]="element.date" [disabled]="true">

                        <mat-datepicker-toggle matIconSuffix [for]="$any(picker)"></mat-datepicker-toggle>

                        <ngx-mat-datetime-picker #picker [showSpinners]="true" [showSeconds]="true" [stepHour]="1"
                            [stepMinute]="1" [stepSecond]="1" [touchUi]="false" [color]="color" [enableMeridian]="true"
                            [disableMinute]="false" [hideTime]="false">
                        </ngx-mat-datetime-picker>
                        {{getDisplayDate(element.date)}}
                    </mat-form-field>

I want to catch when the time is changed. The problem I am having is that when my handler onScheduleDateChanged is called, the time is not reflected in an argument $event passed to my handler onScheduleDateChanged (it still contains the old time). I think this is because the handler handles the event dateChange not the time changed one. The question is how do I handle the time changed event.


问:
Visual Studio doesn't show output when using wxWidgets
I tried to print a debug message using cout but I am not getting any output although my app is running.

I am using the IMPLEMENT_APP macro.

Here is the code I tried to print some information:

```<code>std::cout << display->GetGeometry().GetSize().GetWidth() << " " << display->GetGeometry().GetSize().GetHeight();
</code>```

Can someone help me understand why am I not getting the output?

I am using Visual Studio 2022.

This is the only output I get when I build & run the program:

Build started...
1>------ Build started: Project: VideoEditor, Configuration: Debug x64 ------
1>App.cpp
1>VideoEditor.vcxproj -> D:\C++\VideoEditor\x64\Debug\VideoEditor.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========
```

Body:
I tried to print a debug message using cout but I am not getting any output although my app is running.

I am using the IMPLEMENT_APP macro.

Here is the code I tried to print some information:

std::cout << display->GetGeometry().GetSize().GetWidth() << " " << display->GetGeometry().GetSize().GetHeight();

Can someone help me understand why am I not getting the output?

I am using Visual Studio 2022.

This is the only output I get when I build & run the program:

Build started...
1>------ Build started: Project: VideoEditor, Configuration: Debug x64 ------
1>App.cpp
1>VideoEditor.vcxproj -> D:\C++\VideoEditor\x64\Debug\VideoEditor.exe
========== Build: 1 succeeded, 0 failed, 0 up-to-date, 0 skipped ==========


问:
Cannot resolve the name 'q1:MyCompanyDataInput' to a(n) 'type definition' component
I am trying to generate classes from wsdl using jaxws-maven-plugin
the plugin configuration is as follows :

```<code><plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>2.6</version>
    <configuration>

        <args>
            <arg>-B-XautoNameResolution</arg>
        </args>
        <wsdlUrls>
            <wsdlUrl>${project.basedir}/src/main/resources/wsdl/MyService.svc_singleWsdl.wsdl</wsdlUrl>
        </wsdlUrls>
        <vmArgs>
            <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
        </vmArgs>
        <packageName>com.mycompany.generatedClasses</packageName>
        <sourceDestDir>
            ${project.build.directory}/generated-sources/
        </sourceDestDir>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>wsimport</goal>
            </goals>
        </execution>
    </executions>
</plugin>
</code>```

WSDL:

```<code><wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                  xmlns:tns="urn:MOI.IT.eServices-V1"
                  xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
                  name="MyCompany_Service"
                  targetNamespace="urn:MOI.IT.eServices-V1">
    <wsp:Policy wsu:Id="BasicsEndPoint_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:TransportToken>
                            <wsp:Policy>
                                <sp:HttpsToken RequireClientCertificate="false"/>
                            </wsp:Policy>
                        </sp:TransportToken>
                        <sp:AlgorithmSuite>
                            <wsp:Policy>
                                <sp:Basic256/>
                            </wsp:Policy>
                        </sp:AlgorithmSuite>
                        <sp:Layout>
                            <wsp:Policy>
                                <sp:Strict/>
                            </wsp:Policy>
                        </sp:Layout>
                    </wsp:Policy>
                </sp:TransportBinding>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
                   targetNamespace="urn:MOI.IT.eServices-V1">
            <xs:import namespace="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo"/>
            <xs:import namespace="http://schemas.datacontract.org/2004/07/SamisObjectModel"/>
            <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
            <xs:element name="GetPersonDetails">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo"
                                    minOccurs="0" name="input" nillable="true"
                                    type="q1:MyCompanyDataInput"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

            <xs:element name="GetPersonDetailsResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element xmlns:q2="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo"
                                    minOccurs="0" name="GetPersonDetailsResult" nillable="true"
                                    type="q2:MyCompany_Person"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>

        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   xmlns:tns="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo"
                   elementFormDefault="qualified"
                   targetNamespace="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo">
            <xs:complexType name="MyCompanyDataInput">
                <xs:sequence>
                    <xs:element minOccurs="0" name="Id" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="MyCompanyDataInput" nillable="true" type="tns:MyCompanyDataInput"/>
            <xs:complexType name="MyCompany_Person">
                <xs:sequence>
                    <xs:element minOccurs="0" name="FullName" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="MyCompany_Person" nillable="true" type="tns:MyCompany_Person"/>
            <xs:complexType name="MyCompanyDataInputByBD">
                <xs:sequence>
                    <xs:element minOccurs="0" name="Id" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="MyCompanyDataInputByBD" nillable="true" type="tns:MyCompanyDataInputByBD"/>
        </xs:schema>

    </wsdl:types>

    <wsdl:message name="IMyCompany_SERVICE_GetPersonDetails_InputMessage">
        <wsdl:part name="parameters" element="tns:GetPersonDetails"/>
    </wsdl:message>
    <wsdl:message name="IMyCompany_SERVICE_GetPersonDetails_InputMessage_Headers">
        <wsdl:part xmlns:q1="http://NicWebServiceHeader" name="NICHeader" element="q1:NICHeader"/>
    </wsdl:message>
    <wsdl:message name="IMyCompany_SERVICE_GetPersonDetails_OutputMessage">
        <wsdl:part name="parameters" element="tns:GetPersonDetailsResponse"/>
    </wsdl:message>

    <wsdl:portType name="IMyCompany_SERVICE">

        <wsdl:operation name="GetPersonDetails">
            <wsdl:input wsaw:Action="urn:MOI.IT.eServices-V1/IMyCompany_SERVICE/GetPersonDetails"
                        message="tns:IMyCompany_SERVICE_GetPersonDetails_InputMessage"/>
            <wsdl:output wsaw:Action="urn:MOI.IT.eServices-V1/IMyCompany_SERVICE/GetPersonDetailsResponse"
                         message="tns:IMyCompany_SERVICE_GetPersonDetails_OutputMessage"/>
            <wsdl:fault wsaw:Action="urn:MOI.IT.eServices-V1/IMyCompany_SERVICE/GetPersonDetailsSamisWSFaultFault"
                        name="SamisWSFaultFault"
                        message="tns:IMyCompany_SERVICE_GetPersonDetails_SamisWSFaultFault_FaultMessage"/>
        </wsdl:operation>

    </wsdl:portType>

    <wsdl:binding name="BasicsEndPoint" type="tns:IMyCompany_SERVICE">
        <wsp:PolicyReference URI="#BasicsEndPoint_policy"/>
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetPersonDetails">
            <soap:operation soapAction="urn:MOI.IT.eServices-V1/IMyCompany_SERVICE/GetPersonDetails" style="document"/>
            <wsdl:input>
                <soap:header message="tns:IMyCompany_SERVICE_GetPersonDetails_InputMessage_Headers" part="NICHeader"
                             use="literal"/>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
            <wsdl:fault name="SamisWSFaultFault">
                <soap:fault use="literal" name="SamisWSFaultFault" namespace=""/>
            </wsdl:fault>
        </wsdl:operation>

    </wsdl:binding>
    <wsdl:service name="MyCompany_Service">
        <wsdl:port name="BasicsEndPoint" binding="tns:BasicsEndPoint">
            <soap:address location="https://localhost/SAMISWSProd/MyCompany/Service.svc"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>
</code>```

when I load the wsdl in SoapUI it loads fine and I can send request with no Issues
but when running maven install I get the following error:

```<code>src-resolve: Cannot resolve the name 'q1:MyCompanyDataInput' to a(n) 'type definition' component
</code>```

Body:
I am trying to generate classes from wsdl using jaxws-maven-plugin
the plugin configuration is as follows :

<plugin>
    <groupId>org.codehaus.mojo</groupId>
    <artifactId>jaxws-maven-plugin</artifactId>
    <version>2.6</version>
    <configuration>

        <args>
            <arg>-B-XautoNameResolution</arg>
        </args>
        <wsdlUrls>
            <wsdlUrl>${project.basedir}/src/main/resources/wsdl/MyService.svc_singleWsdl.wsdl</wsdlUrl>
        </wsdlUrls>
        <vmArgs>
            <vmArg>-Djavax.xml.accessExternalSchema=all</vmArg>
        </vmArgs>
        <packageName>com.mycompany.generatedClasses</packageName>
        <sourceDestDir>
            ${project.build.directory}/generated-sources/
        </sourceDestDir>
    </configuration>
    <executions>
        <execution>
            <goals>
                <goal>wsimport</goal>
            </goals>
        </execution>
    </executions>
</plugin>

WSDL:

<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsp="http://schemas.xmlsoap.org/ws/2004/09/policy"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd"
                  xmlns:tns="urn:MOI.IT.eServices-V1"
                  xmlns:wsaw="http://www.w3.org/2006/05/addressing/wsdl"
                  name="MyCompany_Service"
                  targetNamespace="urn:MOI.IT.eServices-V1">
    <wsp:Policy wsu:Id="BasicsEndPoint_policy">
        <wsp:ExactlyOne>
            <wsp:All>
                <sp:TransportBinding xmlns:sp="http://schemas.xmlsoap.org/ws/2005/07/securitypolicy">
                    <wsp:Policy>
                        <sp:TransportToken>
                            <wsp:Policy>
                                <sp:HttpsToken RequireClientCertificate="false"/>
                            </wsp:Policy>
                        </sp:TransportToken>
                        <sp:AlgorithmSuite>
                            <wsp:Policy>
                                <sp:Basic256/>
                            </wsp:Policy>
                        </sp:AlgorithmSuite>
                        <sp:Layout>
                            <wsp:Policy>
                                <sp:Strict/>
                            </wsp:Policy>
                        </sp:Layout>
                    </wsp:Policy>
                </sp:TransportBinding>
            </wsp:All>
        </wsp:ExactlyOne>
    </wsp:Policy>
    <wsdl:types>
        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified"
                   targetNamespace="urn:MOI.IT.eServices-V1">
            <xs:import namespace="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo"/>
            <xs:import namespace="http://schemas.datacontract.org/2004/07/SamisObjectModel"/>
            <xs:import namespace="http://schemas.microsoft.com/2003/10/Serialization/"/>
            <xs:element name="GetPersonDetails">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element xmlns:q1="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo"
                                    minOccurs="0" name="input" nillable="true"
                                    type="q1:MyCompanyDataInput"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>

            <xs:element name="GetPersonDetailsResponse">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element xmlns:q2="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo"
                                    minOccurs="0" name="GetPersonDetailsResult" nillable="true"
                                    type="q2:MyCompany_Person"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
        </xs:schema>

        <xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
                   xmlns:tns="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo"
                   elementFormDefault="qualified"
                   targetNamespace="http://schemas.datacontract.org/2004/07/SamisObjectModel.MyCompanyInfo">
            <xs:complexType name="MyCompanyDataInput">
                <xs:sequence>
                    <xs:element minOccurs="0" name="Id" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="MyCompanyDataInput" nillable="true" type="tns:MyCompanyDataInput"/>
            <xs:complexType name="MyCompany_Person">
                <xs:sequence>
                    <xs:element minOccurs="0" name="FullName" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="MyCompany_Person" nillable="true" type="tns:MyCompany_Person"/>
            <xs:complexType name="MyCompanyDataInputByBD">
                <xs:sequence>
                    <xs:element minOccurs="0" name="Id" nillable="true" type="xs:string"/>
                </xs:sequence>
            </xs:complexType>
            <xs:element name="MyCompanyDataInputByBD" nillable="true" type="tns:MyCompanyDataInputByBD"/>
        </xs:schema>

    </wsdl:types>

    <wsdl:message name="IMyCompany_SERVICE_GetPersonDetails_InputMessage">
        <wsdl:part name="parameters" element="tns:GetPersonDetails"/>
    </wsdl:message>
    <wsdl:message name="IMyCompany_SERVICE_GetPersonDetails_InputMessage_Headers">
        <wsdl:part xmlns:q1="http://NicWebServiceHeader" name="NICHeader" element="q1:NICHeader"/>
    </wsdl:message>
    <wsdl:message name="IMyCompany_SERVICE_GetPersonDetails_OutputMessage">
        <wsdl:part name="parameters" element="tns:GetPersonDetailsResponse"/>
    </wsdl:message>

    <wsdl:portType name="IMyCompany_SERVICE">

        <wsdl:operation name="GetPersonDetails">
            <wsdl:input wsaw:Action="urn:MOI.IT.eServices-V1/IMyCompany_SERVICE/GetPersonDetails"
                        message="tns:IMyCompany_SERVICE_GetPersonDetails_InputMessage"/>
            <wsdl:output wsaw:Action="urn:MOI.IT.eServices-V1/IMyCompany_SERVICE/GetPersonDetailsResponse"
                         message="tns:IMyCompany_SERVICE_GetPersonDetails_OutputMessage"/>
            <wsdl:fault wsaw:Action="urn:MOI.IT.eServices-V1/IMyCompany_SERVICE/GetPersonDetailsSamisWSFaultFault"
                        name="SamisWSFaultFault"
                        message="tns:IMyCompany_SERVICE_GetPersonDetails_SamisWSFaultFault_FaultMessage"/>
        </wsdl:operation>

    </wsdl:portType>

    <wsdl:binding name="BasicsEndPoint" type="tns:IMyCompany_SERVICE">
        <wsp:PolicyReference URI="#BasicsEndPoint_policy"/>
        <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:operation name="GetPersonDetails">
            <soap:operation soapAction="urn:MOI.IT.eServices-V1/IMyCompany_SERVICE/GetPersonDetails" style="document"/>
            <wsdl:input>
                <soap:header message="tns:IMyCompany_SERVICE_GetPersonDetails_InputMessage_Headers" part="NICHeader"
                             use="literal"/>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
            <wsdl:fault name="SamisWSFaultFault">
                <soap:fault use="literal" name="SamisWSFaultFault" namespace=""/>
            </wsdl:fault>
        </wsdl:operation>

    </wsdl:binding>
    <wsdl:service name="MyCompany_Service">
        <wsdl:port name="BasicsEndPoint" binding="tns:BasicsEndPoint">
            <soap:address location="https://localhost/SAMISWSProd/MyCompany/Service.svc"/>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

when I load the wsdl in SoapUI it loads fine and I can send request with no Issues
but when running maven install I get the following error:

src-resolve: Cannot resolve the name 'q1:MyCompanyDataInput' to a(n) 'type definition' component