问:
Lateinit property factory has not been initialized ViewModelFactory when returning to fragment - Android
I have this LevelsViewModelFactory like bellow:

```<code>class LevelsViewModelFactory(
    private val networkAvailable: NetworkAvailable,
    private val app: Application,
    private val getLevelsUseCase: GetLevelsUseCase,
    private var dataStoreUseCases: DataStoreUseCases
) : ViewModelProvider.Factory {
    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        @Suppress("UNCHECKED_CAST")
        return LevelsViewModel(
            networkAvailable,
            app,
            getLevelsUseCase,
            dataStoreUseCases
        ) as T
    }
}
</code>```

And LevelsModule is like:

```<code>@Module
@InstallIn(SingletonComponent::class)
class LevelsModule {

    @Singleton
    @Provides
    fun provideLevelsViewModelFactory(
        networkAvailable: NetworkAvailable,
        application: Application,
        getLevelsUseCase: GetLevelsUseCase,
        dataStoreUseCases: DataStoreUseCases
    ): LevelsViewModelFactory {
        return LevelsViewModelFactory(
            networkAvailable,
            application,
            getLevelsUseCase,
            dataStoreUseCases
        )
    }
}
</code>```

And UseCaseModule:

```<code>@Module
@InstallIn(SingletonComponent::class)
class UseCaseModule {
@Singleton
    @Provides
    fun provideGetLevelsUseCase(levellsRepository: LevelsRepository): GetLevelsUseCase {
        return GetLevelsUseCase(levellsRepository)
    }
}
</code>```

And RepositoryModule:

```<code>@Module
@InstallIn(SingletonComponent::class)
class RepositoryModule {
  @Provides
    @Singleton
    fun provideLevelsRepository(
        levelsRemoteDatasource: LevelsRemoteDatasource
    ): LevelsRepository {
        return LevelsRepositoryImpl(
            levelsRemoteDatasource
        )
    }
}
</code>```

And RemoteDataModule:

```<code>@Module
@InstallIn(SingletonComponent::class)
class RemoteDataModule {
      @Singleton
    @Provides
    fun provideLevelsRemoteDataSource(
        webServices: WebServices
    ): LevelsRemoteDatasource {
        return LevelsRemoteDataSourceImpl(webServices)
    }
}
</code>```

when I use from bellow line, it good work:

```<code>@AndroidEntryPoint
class LessonsFragment : Fragment() {

    @Inject
    lateinit var factory: LevelsViewModelFactory

   override fun onCreateView(
    inflater: LayoutInflater,
    container: ViewGroup?,
    savedInstanceState: Bundle?
): View {
    levelsViewModel =
        ViewModelProvider(
            this,
            factory
        )[LevelsViewModel::class.java]
}
.....
}
</code>```

But when I return to fragment get bellow error:

```<code>lateinit property factory has not been initialized
</code>```

for this line :

```<code>@Inject
lateinit var factory: LevelsViewModelFactory
</code>```

Body:
I have this LevelsViewModelFactory like bellow:

class LevelsViewModelFactory(
    private val networkAvailable: NetworkAvailable,
    private val app: Application,
    private val getLevelsUseCase: GetLevelsUseCase,
    private var dataStoreUseCases: DataStoreUseCases
) : ViewModelProvider.Factory {
    override fun <T : ViewModel> create(modelClass: Class<T>): T {
        @Suppress("UNCHECKED_CAST")
        return LevelsViewModel(
            networkAvailable,
            app,
            getLevelsUseCase,
            dataStoreUseCases
        ) as T
    }
}

And LevelsModule is like:

@Module
@InstallIn(SingletonComponent::class)
class LevelsModule {

    @Singleton
    @Provides
    fun provideLevelsViewModelFactory(
        networkAvailable: NetworkAvailable,
        application: Application,
        getLevelsUseCase: GetLevelsUseCase,
        dataStoreUseCases: DataStoreUseCases
    ): LevelsViewModelFactory {
        return LevelsViewModelFactory(
            networkAvailable,
            application,
            getLevelsUseCase,
            dataStoreUseCases
        )
    }
}

And UseCaseModule:

@Module
@InstallIn(SingletonComponent::class)
class UseCaseModule {
@Singleton
    @Provides
    fun provideGetLevelsUseCase(levellsRepository: LevelsRepository): GetLevelsUseCase {
        return GetLevelsUseCase(levellsRepository)
    }
}

And RepositoryModule:

@Module
@InstallIn(SingletonComponent::class)
class RepositoryModule {
  @Provides
    @Singleton
    fun provideLevelsRepository(
        levelsRemoteDatasource: LevelsRemoteDatasource
    ): LevelsRepository {
        return LevelsRepositoryImpl(
            levelsRemoteDatasource
        )
    }
}

And RemoteDataModule:

@Module
@InstallIn(SingletonComponent::class)
class RemoteDataModule {
      @Singleton
    @Provides
    fun provideLevelsRemoteDataSource(
        webServices: WebServices
    ): LevelsRemoteDatasource {
        return LevelsRemoteDataSourceImpl(webServices)
    }
}

when I use from bellow line, it good work:

@AndroidEntryPoint
class LessonsFragment : Fragment() {

    @Inject
    lateinit var factory: LevelsViewModelFactory

   override fun onCreateView(
    inflater: LayoutInflater,
    container: ViewGroup?,
    savedInstanceState: Bundle?
): View {
    levelsViewModel =
        ViewModelProvider(
            this,
            factory
        )[LevelsViewModel::class.java]
}
.....
}

But when I return to fragment get bellow error:

lateinit property factory has not been initialized

for this line :

@Inject
lateinit var factory: LevelsViewModelFactory


来源: stackexchange

问:
How to disable the Debugging Console of Raylib, without disabling also the other outputs?
Sometimes I want to print the value of a variable (or something else) in the console with printf. The problem is that, when compiling the C-Programm with GCC and adding the flags "-Wl,--subsystem,windows", not only Raylib prints are disabled but also the other prints. Is it possible to disable JUST the prints of raylib?

Until now I tried so:
gcc main.c -O3 -o snake.exe -lm -lz -lcurl -O1 -Wall -std=c99 -Wno-missing-braces -I include/ -L lib/ -lraylib -lopengl32 -lgdi32 -lwinmm -lcurl -Wl,--subsystem,windows && snake.exe

What do I have to change?

ContentLicense: CC BY-SA 4.0


问:
how to use sql server for creating window application and installing the application on other systems
When I create window form application it works fine but when I install on other system it shows database error. so how to develop an application where the connection string is changed by the time of installation or what type of database should be used.

I installed sql server databases, sql management studio in the target system but failed. please show me how applications are built which requires no installation of sql server etc. or a method in which confection string is changed by the time of installation.


问:
I am trying to view/download pdf in mobile browser but iframe not working in mobile browsers source is in Blob pdf
iframe working perfectly in web browser but its not working in mobile browser both andriod and iPhone.
The source is in blob. I have also tried google doc but working preview error.

This is how to works in web browser

here is the code

```<code>const response = await axiosInstance.post('/api/employee/generatepdf', {
    workOrder,
    customerId,
  });

  const blob = base64ToBlob(response.data.attachment, 'application/pdf');
  const url = URL.createObjectURL(blob);
  const pdfWindow = window.open('');
  pdfWindow.document.write(
    "<iframe width='100%' height='100%' src='" + url + "'></iframe>"
  );
</code>```

I tried using anchor tag even uses href, nothing works

I just want that it either show/download pdf in mobile devices

Body:
iframe working perfectly in web browser but its not working in mobile browser both andriod and iPhone.
The source is in blob. I have also tried google doc but working preview error.

This is how to works in web browser

here is the code

const response = await axiosInstance.post('/api/employee/generatepdf', {
    workOrder,
    customerId,
  });

  const blob = base64ToBlob(response.data.attachment, 'application/pdf');
  const url = URL.createObjectURL(blob);
  const pdfWindow = window.open('');
  pdfWindow.document.write(
    ""
  );

I tried using anchor tag even uses href, nothing works

I just want that it either show/download pdf in mobile devices


问:
Django HttpResponse does not redirect after Javascript Post with fetch
With the following Post using Javascript

```<code>    function send_dialog() {
        fetch('dialog', {
            method: 'POST',
            body: JSON.stringify({
                id_to_dialog
            })

        })
        .then(response => response.json())
        .then(result => {
            // Print result
            console.log(result);
        });
    }
</code>```

and the corresponding function of the django view:

```<code>     @csrf_exempt
     def dialog(request):
            print(request)
            data = json.loads(request.body)
            print(data)
            return HttpResponse("HEY")
</code>```

I'm able to print out the data, but the website doesn't get redirected to the simple page showing "Hey".

So far I've tried several other methods reverse, redirect etc. from django, but could never successfully redirect to the "hey" page.

Body:
With the following Post using Javascript

    function send_dialog() {
        fetch('dialog', {
            method: 'POST',
            body: JSON.stringify({
                id_to_dialog
            })

        })
        .then(response => response.json())
        .then(result => {
            // Print result
            console.log(result);
        });
    }

and the corresponding function of the django view:

     @csrf_exempt
     def dialog(request):
            print(request)
            data = json.loads(request.body)
            print(data)
            return HttpResponse("HEY")

I'm able to print out the data, but the website doesn't get redirected to the simple page showing "Hey".

So far I've tried several other methods reverse, redirect etc. from django, but could never successfully redirect to the "hey" page.


问:
Two-layered X-Axis in Altair (Python)
I have a DataFrame consisting of four columns: Year (int64), Month (object/string), Company (object/string), Score (int64).

I want to illustrate the development of the core over the months and years, but I can't figure out how to create this x-axis as shown below with Altair.

```<code>    Year    Month Company   NPS
0   2019    Jan   Competitor A  29
1   2019    Feb   Competitor B  29
2   2019    Mar   Competitor C  31
...
</code>```

That's what I've tried so far, but it won't work

```<code>chart = alt.Chart(df).mark_line().encode(
  x=alt.X('Month:N'),
  y=alt.Y('NPS:Q', scale=alt.Scale(domain=[0,60])),
  color=alt.Color('company:N', scale=alt.Scale(domain=['Our Company', 'Competitor A', 'Competitor B', 'Competitor C', 'Competitor D'], range=['#000', '#c8c8c8', '#c8c8c8', '#c8c8c8', '#c8c8c8']))
)
</code>```

It gives me this output:

This below is my goal:

Title: Two-layered X-Axis in Altair (Python)

Body:
I have a DataFrame consisting of four columns: Year (int64), Month (object/string), Company (object/string), Score (int64).

I want to illustrate the development of the core over the months and years, but I can't figure out how to create this x-axis as shown below with Altair.

    Year    Month Company   NPS
0   2019    Jan   Competitor A  29
1   2019    Feb   Competitor B  29
2   2019    Mar   Competitor C  31
...

That's what I've tried so far, but it won't work

chart = alt.Chart(df).mark_line().encode(
  x=alt.X('Month:N'),
  y=alt.Y('NPS:Q', scale=alt.Scale(domain=[0,60])),
  color=alt.Color('company:N', scale=alt.Scale(domain=['Our Company', 'Competitor A', 'Competitor B', 'Competitor C', 'Competitor D'], range=['#000', '#c8c8c8', '#c8c8c8', '#c8c8c8', '#c8c8c8']))
)

It gives me this output:

This below is my goal:


问:
Media Query Issues | DW21.3 | Missing Breakpoints
Morning all

I've employed media query breakpoints in order for my site to be responsive as is required in the modern age. For some reason, one of my breakpoints has just disappeared in the HTML document despite my CSS covering all breakpoints up to

```<code>@media only screen and (min-width: 1200px)
</code>```

I can also confirm that my CSS document is in the root folder, situated as follows:

<link href="../styles.css" rel="stylesheet" type="text/css">
```

I've no third-party plugins installed on DW, but I do have Google Translate and Font Awesome.

Not aware as to the media query version but is the version which came with the software.

I appreciate this is specifically a coding site, not a DW-orientated forum so if it is something to do with DW glitching out, please disregard this post. However, if you feel there is an error in my coding, let us know!

[enter image description here](https://i.stack.imgur.com/9OYjk.png)

Not specifically coding-oriented but tried reinstalling DW, reverting back to previous versions of the software in order to rule out any DW-related problems.

I have removed the Google Translate plugin as well as the Font Awesome plugin to see if this WAS interfering with Media Query.

Body:
Morning all

I've employed media query breakpoints in order for my site to be responsive as is required in the modern age. For some reason, one of my breakpoints has just disappeared in the HTML document despite my CSS covering all breakpoints up to

@media only screen and (min-width: 1200px)

I can also confirm that my CSS document is in the root folder, situated as follows:

<link href="../styles.css" rel="stylesheet" type="text/css">

I've no third-party plugins installed on DW, but I do have Google Translate and Font Awesome.

Not aware as to the media query version but is the version which came with the software.

I appreciate this is specifically a coding site, not a DW-orientated forum so if it is something to do with DW glitching out, please disregard this post. However, if you feel there is an error in my coding, let us know!

[enter image description here](https://i.stack.imgur.com/9OYjk.png)

Not specifically coding-oriented but tried reinstalling DW, reverting back to previous versions of the software in order to rule out any DW-related problems.

I have removed the Google Translate plugin as well as the Font Awesome plugin to see if this WAS interfering with Media Query.


问:
Android Using "Flow + asLiveData" or using LiveData End to End
I want to achieve the following:

If I put the app in background for more than 5 seconds and then bring it to the foreground, then the activity should not refresh the recycleAdaptor with data from the database (provided the data is unchanged) Since this is unnecessary duplicate processing.

Precondition

Using android activity wired with a recycleAdaptor

Using room database

Observation

LiveData: Goal of non duplication achieved

Converting Flow to LiveData in ViewModel using "asLiveData" : Goal of non duplication not achieved

This confuses me, because i thought flow.asLiveData was better than just using livedata.


问:
fabric.js canvas responsiveness and tainted
First of all, I am sorry if this is a duplicate by any change, I am surfing the web and chatGPT for a few days now and I can't seem to figure out the problem.
I have this code here:
your texthttp://jsfiddle.net/Wishz/eb2w4L3y/170/

The problem which I can't figure out is the tainted canvas. I can't seem to successfully convert the canvas to a blob or dataURL (I would prefer blob but everytime it throws an error saying x.toBlob is not a function.
If i change it to dataURL, it throws an tainted canvas error.

The second problem is that I can't make the canvas responsive..The canvas should be 6144x3072px, pretty big, but i want it to fit inside the div parent.
If i scale the windows, it overlaps the entire website and so on..

And the third problem is that if I change the sources of any fabric object, it requires a click on the canvas so the sources refresh, for some reason. I don't want that, when the src is changed I want it to "instantly" appear on the object position.

Any tips please? And sorry for troubles, I am new to coding. Have a nice day!

I tried multiple methods found on the web and even tried to use chatGPT to fix this as it helped me before in other functions but no luck.


问:
My Histplot looks like a part of a displot
I have created a couple of sns histplots, but they dont look like a normal histogram.

Dataframe name = vehicledata_cleaned
Fuel - Diesal, Petrol, Hyrid, other.
Price - 0, 100, 1000, 1100 1200, 3000, 3500, 4000 etc

```<code>`plt.figure(figsize=(15,15))
plt.subplot(4,1,1)
sns.histplot(x="fuelType",y="price",data=vehicledata_cleaned,)
plt.subplot(4,1,2)
sns.histplot(x="fuelType",y="price",data=vehicledata_cleaned, hue='transmission', multiple="stack")`
</code>```

internet example

I was hoping for something like the attached example (just image of internet)

but I got
my code result

Body:
I have created a couple of sns histplots, but they dont look like a normal histogram.

Dataframe name = vehicledata_cleaned
Fuel - Diesal, Petrol, Hyrid, other.
Price - 0, 100, 1000, 1100 1200, 3000, 3500, 4000 etc

`plt.figure(figsize=(15,15))
plt.subplot(4,1,1)
sns.histplot(x="fuelType",y="price",data=vehicledata_cleaned,)
plt.subplot(4,1,2)
sns.histplot(x="fuelType",y="price",data=vehicledata_cleaned, hue='transmission', multiple="stack")`

internet example

I was hoping for something like the attached example (just image of internet)

but I got
my code result


问:
How to build a django web app using huggingface model api's
I am a beginner and I want to build Django app having hugging face model api to do a specific task in that app. but I am not getting any helping material. please help me guide me about how can I do that.

I tried but I failed. I am a beginner to this


问:
Solving libjscexecutor.so error appearing in Crashlytics
I am constantly seeing the following error in the application on the Crashlytics. Since this error did not occur on my own device, I cannot see if my fixes will work. What is the exact solution to this problem and what do I need to do so that my own devices can see this issue?


问:
How does DynamoDB go beyond 10gb partition?
In the AWS DynamoDB doc, it is written that 1 item will be stored in one partition based on its partition key.

The max size of a partition is 10GB.

Hence, in the case I am inserting lots of items using a composite primary key with the same partition key, how will it work when the sum of the items exceed 10GB ?

Will I be able to insert new items with same partition key ?


问:
How should I approach this situation in React with Childs getting data from an API?
I decided to learn React during the winter holidays and decided that I would like to consume an API designed to create and list comments.

By following the React documentation, I achieved to create comments and get them via an API call using axios and render those on child components. However, I would like to re-render the ListComments component whenever I create a new comment.

I observed from the documentation that a possible solution would be using the useCallback hook when adding a comment and sending a "signal" to the ListComments component via props, but I have not being successful due to my lack of understanding.

Please refer to the following code:

Parent component

```<code>function ExercisePage() {

    //Load task
    const [task, setTask] = useState([]);

    //Get task
    const loadTask = async () => {
        const response = await axios.get("http://localhost:8080/tasks/1");
        setTask(response.data)
    }

    //On function load, fetch data
    useEffect(
        () => {
            console.log("Loading task")
            loadTask();
        }, [])

    return (
        <div align="center">

            <a href="/home">Home</a>
            <h2>{task.taskName}</h2>
            <br></br>
            <img
                src="http://clipart-library.com/data_images/6103.png"
                alt="test image"/>
            <h2>Detalles del ejercicio</h2>
            <p>
                {task.details}
            </p>
            <br></br>
            <button>Completado?</button>
            <br></br>

            <AddComment/>
            <br></br>
            <ListComments/>
        </div>
    )
}

export default ExercisePage;
</code>```

Child component for creating comments

```<code>class AddComment extends Component {

constructor(props) {
    super(props);

    this.state = {
        content: '',
        creationDate: ''
    }
//Bind functions
this.handleInputChange = this.handleInputChange.bind(this)
this.onSubmit = this.onSubmit.bind(this)
}

handleInputChange(event) {
    const target = event.target;
    const value = target.value
    const name = target.name

    this.setState({
        [name]: value   //Dynamically allocate to data <- value
    })
}

//Handle the click event from a button/input (onClick)
onSubmit = async (event) => {
    event.preventDefault();
    console.log("Click")

    const date = new Date();

    await axios.post('http://localhost:8080/task/'+1+'/comment' ,
    {
    'comment':
    {
        'content': this.state.content,
        'creationDate': date,
    },
    'username': 'user1',
    'taskId': 1
    }).then(res => {
        console.log('sending to proooood')
        console.log(res.data)
    }).catch(err => {
        console.log("ERROR " + err.message)
    })}

render() {
    return (
        <div>
            <h2>Deja aquí tu comentario</h2>
            <form
                onSubmit={(event) => this.onSubmit(event)}>
                    <input

      id='content-input'
                            name='content'
                            placeholder=''
                            type='text'
                            onChange={this.handleInputChange}
                        />
                        <br></br>
                        <button>Comenta</button>
                </form>
            </div>
        )
    }
}

export default AddComment;
</code>```

Child component for reading comments

```<code>function ListComments(props) {

    const [comments, setComments] = useState([])

    const loadComments = async () => {
        const result = await axios.get('http://localhost:8080/task/'+1+'/comments');
        setComments(result.data);
        console.log(result.data)
    }

    useEffect(() => {
        console.log("Populating comments")
            loadComments()
    }, [])

return (
        <div>
            <h2>Comentarios</h2>
            <ul>
                {comments.map((comment,_) => (
                    <li>{comment.content} || {comment.user.username} || {comment.user.email}</li>
                ))}
            </ul>
        </div>
)

}

export default ListComments;
</code>```

If you have a better suggestion on how could I approach the consumption of the API, please do so. I am open to learn new strategies and best practices to improve.

My main objective with this question is to achieve the intention of refreshing a component when new data is added.

Body:
I decided to learn React during the winter holidays and decided that I would like to consume an API designed to create and list comments.

By following the React documentation, I achieved to create comments and get them via an API call using axios and render those on child components. However, I would like to re-render the ListComments component whenever I create a new comment.

I observed from the documentation that a possible solution would be using the useCallback hook when adding a comment and sending a "signal" to the ListComments component via props, but I have not being successful due to my lack of understanding.

Please refer to the following code:

Parent component

function ExercisePage() {

    //Load task
    const [task, setTask] = useState([]);

    //Get task
    const loadTask = async () => {
        const response = await axios.get("http://localhost:8080/tasks/1");
        setTask(response.data)
    }

    //On function load, fetch data
    useEffect(
        () => {
            console.log("Loading task")
            loadTask();
        }, [])

    return (

            Home

{task.taskName}

Detalles del ejercicio

                {task.details}

            <button>Completado?</button>

            <AddComment/>

            <ListComments/>

    )
}

export default ExercisePage;

Child component for creating comments

class AddComment extends Component {

constructor(props) {
    super(props);

    this.state = {
        content: '',
        creationDate: ''
    }
//Bind functions
this.handleInputChange = this.handleInputChange.bind(this)
this.onSubmit = this.onSubmit.bind(this)
}

handleInputChange(event) {
    const target = event.target;
    const value = target.value
    const name = target.name

    this.setState({
        [name]: value   //Dynamically allocate to data <- value
    })
}

//Handle the click event from a button/input (onClick)
onSubmit = async (event) => {
    event.preventDefault();
    console.log("Click")

    const date = new Date();

    await axios.post('http://localhost:8080/task/'+1+'/comment' ,
    {
    'comment':
    {
        'content': this.state.content,
        'creationDate': date,
    },
    'username': 'user1',
    'taskId': 1
    }).then(res => {
        console.log('sending to proooood')
        console.log(res.data)
    }).catch(err => {
        console.log("ERROR " + err.message)
    })}

render() {
    return (

Deja aquí tu comentario

            <form
                onSubmit={(event) => this.onSubmit(event)}>
                    <input

      id='content-input'
                            name='content'
                            placeholder=''
                            type='text'
                            onChange={this.handleInputChange}
                        />

                        <button>Comenta</button>
                </form>

        )
    }
}

export default AddComment;

Child component for reading comments

function ListComments(props) {

    const [comments, setComments] = useState([])

    const loadComments = async () => {
        const result = await axios.get('http://localhost:8080/task/'+1+'/comments');
        setComments(result.data);
        console.log(result.data)
    }

    useEffect(() => {
        console.log("Populating comments")
            loadComments()
    }, [])

return (

Comentarios

                {comments.map((comment,_) => (

{comment.content} || {comment.user.username} || {comment.user.email}

                ))}

)

}

export default ListComments;

If you have a better suggestion on how could I approach the consumption of the API, please do so. I am open to learn new strategies and best practices to improve.

My main objective with this question is to achieve the intention of refreshing a component when new data is added.


问:
How to have people opt out of your app's beta program in google play store?
I have an android app published in play store. It was running a beta program for almost a year.
Now I want to reduce the number of beta testers present.

Is there a way to send a opt-out URL or have them manually removed from the beta program ?

If I pause the open testing track in play console, what would happen ? Will the user be moved out of beta ?


问:
Could not find a declaration file for module 'react-tree-graph'
I am trying to create tree visualization to my react project.
When I added a package 'react-tree-graph' and import Tree module from it:

```<code>import Tree from 'react-tree-graph'
</code>```

it shows me this error:

Could not find a declaration file for module 'react-tree-graph'. 'd:/Downloads/CureAssure/F22-011-R-CureAssure/node_modules/react-tree-graph/dist/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/react-tree-graph if it exists or add a new declaration (.d.ts) file containing declare module 'react-tree-graph';

I added the package using

```<code>yarn add react-tree-graph
</code>```

Because I am using Yarn Package Manager.

I thought it might solved by using, npm, So I tried

```<code>npm install react-tree-graph --save
</code>```

But the error remains same.

I visited the question Typescript react - Could not find a declaration file for module ''react-materialize'. 'path/to/module-name.js' implicitly has an any type, and came to know that the error maybe due to .d.ts file, but I don't know why it is not in the folder.

In node_modules, there exists a folder react-tree-graph with these files:

```<code>│   CHANGELOG.md
│   LICENSE
│   package.json
│   README.md
│
├───dist
│   │   index.js
│   │   index.min.js
│   │   style.css
│   │   style.min.css
│   │
│   └───module
│       │   d3.js
│       │   index.js
│       │   wrapHandlers.js
│       │
│       └───components
│               animated.js
│               animatedTree.js
│               container.js
│               link.js
│               node.js
│               tree.js
│
├───node_modules
│   └───@babel
├───src
│   │   d3.js
│   │   index.js
│   │   wrapHandlers.js
│   │
│   └───components
│           animated.js
│           animatedTree.js
│           container.js
│           link.js
│           node.js
│           tree.js
│
└───styles
        style.css
</code>```

Body:
I am trying to create tree visualization to my react project.
When I added a package 'react-tree-graph' and import Tree module from it:

import Tree from 'react-tree-graph'

it shows me this error:

Could not find a declaration file for module 'react-tree-graph'. 'd:/Downloads/CureAssure/F22-011-R-CureAssure/node_modules/react-tree-graph/dist/index.js' implicitly has an 'any' type.
Try npm i --save-dev @types/react-tree-graph if it exists or add a new declaration (.d.ts) file containing declare module 'react-tree-graph';

I added the package using

yarn add react-tree-graph

Because I am using Yarn Package Manager.

I thought it might solved by using, npm, So I tried

npm install react-tree-graph --save

But the error remains same.

I visited the question Typescript react - Could not find a declaration file for module ''react-materialize'. 'path/to/module-name.js' implicitly has an any type, and came to know that the error maybe due to .d.ts file, but I don't know why it is not in the folder.

In node_modules, there exists a folder react-tree-graph with these files:

│   CHANGELOG.md
│   LICENSE
│   package.json
│   README.md
│
├───dist
│   │   index.js
│   │   index.min.js
│   │   style.css
│   │   style.min.css
│   │
│   └───module
│       │   d3.js
│       │   index.js
│       │   wrapHandlers.js
│       │
│       └───components
│               animated.js
│               animatedTree.js
│               container.js
│               link.js
│               node.js
│               tree.js
│
├───node_modules
│   └───@babel
├───src
│   │   d3.js
│   │   index.js
│   │   wrapHandlers.js
│   │
│   └───components
│           animated.js
│           animatedTree.js
│           container.js
│           link.js
│           node.js
│           tree.js
│
└───styles
        style.css


问:
setOnItemClickListener not working in list view
setOnItemClickListener not working with custom Item. I wanna transition from one Activity to another by clicking ListView item

Here is my java code

```<code>SimpleCursorAdapter simpleCursorAdapter = dbHandler.ShowTransaction();
        transactionListView = findViewById(R.id.transaction_list);
        transactionListView.setAdapter(simpleCursorAdapter);
        transactionListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Cursor cursor = (Cursor) simpleCursorAdapter.getItem(i);
                int _id = cursor.getInt(0);
                String _variable = cursor.getString(1);
                float _amount = cursor.getFloat(2);
                Intent intent = new Intent(TransactionDisplayActivity.this,UpdateTransaction.class);
                intent.putExtra("id", _id);
                intent.putExtra("money", _amount);
                intent.putExtra("v_name", _variable);
                startActivity(intent);
            }
        });

</code>```

Here is my xml

```<code><ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/transaction_list"
        android:divider="@null"
        android:clickable="true"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:dividerHeight="40dp"
        android:smoothScrollbar="true"/>
</code>```

Here is the custom list-view item

```<code><?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="horizontal"
    android:layout_margin="10dp"
    android:gravity="center_horizontal">

    <com.google.android.material.card.MaterialCardView
        android:layout_width="60dp"
        android:layout_height="75dp"
        android:backgroundTint="@color/orange"
        app:cardCornerRadius="20dp">

        <com.google.android.material.imageview.ShapeableImageView
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:src="@drawable/payments_48px"
            android:layout_gravity="center"/>

    </com.google.android.material.card.MaterialCardView>

    <LinearLayout
        android:layout_width="170dp"
        android:layout_height="75dp"
        android:orientation="vertical"
        android:layout_marginLeft="20dp"
        android:gravity="center">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Spotify"
            android:id="@+id/transaction_name_display"
            android:textSize="18sp"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="sdfasdffdsdfsdfsdf dsfsdfdf"
            android:id="@+id/date_display"
            android:layout_marginTop="10dp"/>

    </LinearLayout>

    <com.google.android.material.chip.Chip
        android:layout_width="80dp"
        android:layout_height="40dp"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="15dp"
        android:text="150"
        android:id="@+id/amount_display"
        android:textAlignment="center"
        app:chipBackgroundColor="@color/yellow"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="1"
        android:id="@+id/id_display"
        android:layout_marginTop="10dp"
        android:visibility="gone"/>

</LinearLayout>
</code>```

I made a custom item for list-view. I wanted to make something happen by clicking on listview item but I don't know why its not working

Body:
setOnItemClickListener not working with custom Item. I wanna transition from one Activity to another by clicking ListView item

Here is my java code

SimpleCursorAdapter simpleCursorAdapter = dbHandler.ShowTransaction();
        transactionListView = findViewById(R.id.transaction_list);
        transactionListView.setAdapter(simpleCursorAdapter);
        transactionListView.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> adapterView, View view, int i, long l) {
                Cursor cursor = (Cursor) simpleCursorAdapter.getItem(i);
                int _id = cursor.getInt(0);
                String _variable = cursor.getString(1);
                float _amount = cursor.getFloat(2);
                Intent intent = new Intent(TransactionDisplayActivity.this,UpdateTransaction.class);
                intent.putExtra("id", _id);
                intent.putExtra("money", _amount);
                intent.putExtra("v_name", _variable);
                startActivity(intent);
            }
        });

Here is my xml

<ListView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/transaction_list"
        android:divider="@null"
        android:clickable="true"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:dividerHeight="40dp"
        android:smoothScrollbar="true"/>

Here is the custom list-view item

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    android:orientation="horizontal"
    android:layout_margin="10dp"
    android:gravity="center_horizontal">

    <com.google.android.material.card.MaterialCardView
        android:layout_width="60dp"
        android:layout_height="75dp"
        android:backgroundTint="@color/orange"
        app:cardCornerRadius="20dp">

        <com.google.android.material.imageview.ShapeableImageView
            android:layout_width="48dp"
            android:layout_height="48dp"
            android:src="@drawable/payments_48px"
            android:layout_gravity="center"/>

    </com.google.android.material.card.MaterialCardView>

    <LinearLayout
        android:layout_width="170dp"
        android:layout_height="75dp"
        android:orientation="vertical"
        android:layout_marginLeft="20dp"
        android:gravity="center">

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="Spotify"
            android:id="@+id/transaction_name_display"
            android:textSize="18sp"/>

        <TextView
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:text="sdfasdffdsdfsdfsdf dsfsdfdf"
            android:id="@+id/date_display"
            android:layout_marginTop="10dp"/>

    </LinearLayout>

    <com.google.android.material.chip.Chip
        android:layout_width="80dp"
        android:layout_height="40dp"
        android:layout_marginLeft="20dp"
        android:layout_marginTop="15dp"
        android:text="150"
        android:id="@+id/amount_display"
        android:textAlignment="center"
        app:chipBackgroundColor="@color/yellow"/>

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:text="1"
        android:id="@+id/id_display"
        android:layout_marginTop="10dp"
        android:visibility="gone"/>

</LinearLayout>

I made a custom item for list-view. I wanted to make something happen by clicking on listview item but I don't know why its not working


问:
Issue with tqdm in Colab
I'm running an .sh file, which use tqdm library in Colab. I want to hide any information other than the percentage and the progress bar by using the bar_format like this:

```<code>for vid in tqdm(data.keys(), desc='Preparing data', bar_format='{l_bar}{bar}')
</code>```

so the expected result should be

```<code>Preparing data: 100% 200/200
</code>```

but instead, the output is

```<code>Preparing data: 100% 200/200 [00:06<00:00, 28.91it/s]
</code>```

The desc argument runs fine (I tried to delete it and the prefix was gone), but the bar_format doesn't work as expected. I also checked tqdm version, and it returned 4.64.1, which does support the bar_format argument.

Title: Issue with tqdm in Colab

Body:
I'm running an .sh file, which use tqdm library in Colab. I want to hide any information other than the percentage and the progress bar by using the bar_format like this:

for vid in tqdm(data.keys(), desc='Preparing data', bar_format='{l_bar}{bar}')

so the expected result should be

Preparing data: 100% 200/200

but instead, the output is

Preparing data: 100% 200/200 [00:06<00:00, 28.91it/s]

The desc argument runs fine (I tried to delete it and the prefix was gone), but the bar_format doesn't work as expected. I also checked tqdm version, and it returned 4.64.1, which does support the bar_format argument.


问:
How can I improve my neural network and genetic algorithm?
I have already implemented all parts of race simulation, but it doesn't work as I have planned. I have track and bunch of cars, cars know distance to walls in the direction of the ray.

Image of raycasting

Neural network has 1 input, 2 hidden and 1 output layers. Input layer has number of neurons equals to number or rays (9 in my case). Hidden layers have 6 and 5 neurons. Output layer has 2 neurons: first - rotation (right if greater than 0.5, else - left), second - engine power

Genetic algorithm doesn't have anything special (implementation)

When simulation starts, cars just spin around. Even if one of the cars has successful weights and drives much further than the others, on next iteration it acts like others

Spinning cars

I have tried to change parameters of the neural network, the genetic algorithm, but no significant changes occurred


问:
Comparing String literal to String object's literal in Java
When we create a String using = we create (if it does not exist) a new String literal in the String pool. I know the String pool contains only unique values.

Step 1:

String var1 = "Java";
```
<p>OK. We now have 1 literal in the String pool and 1 object created in the Heap.
Now if we create String using new String() with the same literal value:</p>
<p>Step 2:</p>
<pre class="lang-java prettyprint-override"><code>String var2 = new String("Java");
</code>```

We now have 2 different objects created in the heap.
The main question is: Do both String literals refer to the one in the String pool or do we have one String literal var1 - "Java" and one that's outside that String pool var2 - "Java"?

I just want to know do we have one literal or two literals or 1 in the String pool and one outside (waiting to be added to the String pool).

Body:
When we create a String using = we create (if it does not exist) a new String literal in the String pool. I know the String pool contains only unique values.

Step 1:

String var1 = "Java";

OK. We now have 1 literal in the String pool and 1 object created in the Heap.
Now if we create String using new String() with the same literal value:

Step 2:

String var2 = new String("Java");

We now have 2 different objects created in the heap.
The main question is: Do both String literals refer to the one in the String pool or do we have one String literal var1 - "Java" and one that's outside that String pool var2 - "Java"?

I just want to know do we have one literal or two literals or 1 in the String pool and one outside (waiting to be added to the String pool).


问:
How to change dropdown language? my language always show Bangla in dropdown
I am using google translate to translate the next js app. but problem is my dropdown menu item always show in bangla. How to convert bangla to English in dropdown.
My code:

```<code> const googleTranslateElementInit =()=>{
  new google.translate.TranslateElement({ pageLanguage:'en', includedLanguages: 'en,es,pt',autoDisplay: true, layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element');
 }

        <script type="text/javascript" src="https://translate.google.com/translate_a/element.js?cb=googleTranslateElementInit" ></script>
</code>```

In my given picture its shows the dropdown List In Bangla.

I am expecting the dropdown shows me English language.

enter image description here

Body:
I am using google translate to translate the next js app. but problem is my dropdown menu item always show in bangla. How to convert bangla to English in dropdown.
My code:

 const googleTranslateElementInit =()=>{
  new google.translate.TranslateElement({ pageLanguage:'en', includedLanguages: 'en,es,pt',autoDisplay: true, layout: google.translate.TranslateElement.InlineLayout.SIMPLE }, 'google_translate_element');
 }

In my given picture its shows the dropdown List In Bangla.

I am expecting the dropdown shows me English language.

enter image description here


问:
Batch - find process that contains name in tasklist
I have a constantly changing process name where the only constant in it is the substring "-Installer". For other proccesess I have used eq like this:

```<code>tasklist /fi "ImageName eq %INSTALLER_NAME%" /fo csv 2>NUL | find /I %INSTALLER_NAME%>NUL
if "%ERRORLEVEL%"=="0" (
    echo %INSTALLER_NAME% is running, possible installation going on
    exit /B
)
</code>```

How do I change it to find a process that contains the substring?

Body:
I have a constantly changing process name where the only constant in it is the substring "-Installer". For other proccesess I have used eq like this:

tasklist /fi "ImageName eq %INSTALLER_NAME%" /fo csv 2>NUL | find /I %INSTALLER_NAME%>NUL
if "%ERRORLEVEL%"=="0" (
    echo %INSTALLER_NAME% is running, possible installation going on
    exit /B
)

How do I change it to find a process that contains the substring?


问:
mysql container access denied for user - docker compose
I have a docker-compose.yml file which defines 3 containers: frontend, backend, and mysql database.

In my backend container I have a python code which uses "mysql" and "mysql.connector" libraries to connect to the database container.

However, when I run

```<code>docker-compose up
</code>```

the container of the backend exits with code 1.
and I get this error:

my docker-compose.yml file looks like that:

```<code>version: '3'
services:
  mydb:
    container_name: mydb
    image: mysql
    env_file:
      - .env.mysql
    volumes:
      - ./mysqld:/var/run/mysqld
      - ./db:/var/lib/mysql
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_HOST:%
    #command: sh -c "mysql --execute="UPDATE mysql.user SET host='%' WHERE user='root';""
    # && mysql --execute="FLUSH PRIVILEGES;""
    healthcheck:
      test: "mysqladmin ping -h localhost" #this is mysql command to monitor if the localhost database is alive
      interval: 1s
      timeout: 1s
      retries: 60

  backend:
    container_name: backend
    build:
      context: .
      dockerfile: back-dockerfile
    ports:
      - "90:90"
    depends_on:
      - mydb

  frontend:
    container_name: frontend
    build:
      context: .
      dockerfile: front-dockerfile
    ports:
      - "8501:8501"

</code>```

the ".env.mysql" file which defines the environment variables for the mysql container is:

```<code>MYSQL_ROOT_PASSWORD=123456
MYSQL_ROOT_HOST=%
MYSQL_DATABASE=eass
</code>```

and to make sure the container configured correctly here is a screenshot that shows the command env from inside the mysql container :

The piece of code that is used to connect to the mysql database is:

```<code>import mysql
import mysql.connector

db = mysql.connector.connect(
    host="mydb",
    user="root",
    passwd="123456",
    database="eass",
    auth_plugin='mysql_native_password'
)
</code>```

how can I connect to the mysql database correctly?
thanks.

I tried to give MYSQL_ROOT_HOST either value of % or 172.20.0.04/255.0.0.0 - as i seen this was suggested on other closed discussions here.
I was expecting that the mysql container would accept the env % as all ips are granted to use root.

Body:
I have a docker-compose.yml file which defines 3 containers: frontend, backend, and mysql database.

In my backend container I have a python code which uses "mysql" and "mysql.connector" libraries to connect to the database container.

However, when I run

docker-compose up

the container of the backend exits with code 1.
and I get this error:

my docker-compose.yml file looks like that:

version: '3'
services:
  mydb:
    container_name: mydb
    image: mysql
    env_file:
      - .env.mysql
    volumes:
      - ./mysqld:/var/run/mysqld
      - ./db:/var/lib/mysql
    ports:
      - "3306:3306"
    environment:
      - MYSQL_ROOT_HOST:%
    #command: sh -c "mysql --execute="UPDATE mysql.user SET host='%' WHERE user='root';""
    # && mysql --execute="FLUSH PRIVILEGES;""
    healthcheck:
      test: "mysqladmin ping -h localhost" #this is mysql command to monitor if the localhost database is alive
      interval: 1s
      timeout: 1s
      retries: 60

  backend:
    container_name: backend
    build:
      context: .
      dockerfile: back-dockerfile
    ports:
      - "90:90"
    depends_on:
      - mydb

  frontend:
    container_name: frontend
    build:
      context: .
      dockerfile: front-dockerfile
    ports:
      - "8501:8501"

the ".env.mysql" file which defines the environment variables for the mysql container is:

MYSQL_ROOT_PASSWORD=123456
MYSQL_ROOT_HOST=%
MYSQL_DATABASE=eass

and to make sure the container configured correctly here is a screenshot that shows the command env from inside the mysql container :

The piece of code that is used to connect to the mysql database is:

import mysql
import mysql.connector

db = mysql.connector.connect(
    host="mydb",
    user="root",
    passwd="123456",
    database="eass",
    auth_plugin='mysql_native_password'
)

how can I connect to the mysql database correctly?
thanks.

I tried to give MYSQL_ROOT_HOST either value of % or 172.20.0.04/255.0.0.0 - as i seen this was suggested on other closed discussions here.
I was expecting that the mysql container would accept the env % as all ips are granted to use root.


问:
postgresql bytea image insert, retrieve in nodejs
I have to upload image in to postgresql bytea type and need to retrieve back the image.

For Inserting, I am trying like

```<code>INSERT INTO todos(id, name, data) VALUES(1, 'test', pg_read_binary_file('E:\WorkSpace\img\xyz.jpeg')::bytea);
</code>```

and it stores like,

I need to retrieve the image now. Like,

```<code>app.get('/getBackImage', function(req, res) {
  await q = 'select * from todos'
  res.send(//html)
})
</code>```

In this response I need to see the image. Any solution for this.

Body:
I have to upload image in to postgresql bytea type and need to retrieve back the image.

For Inserting, I am trying like

INSERT INTO todos(id, name, data) VALUES(1, 'test', pg_read_binary_file('E:\WorkSpace\img\xyz.jpeg')::bytea);

and it stores like,

I need to retrieve the image now. Like,

app.get('/getBackImage', function(req, res) {
  await q = 'select * from todos'
  res.send(//html)
})

In this response I need to see the image. Any solution for this.


问:
File not found error in Eclipse while using Spring Boot
I am using eclipse 2022-12 in Ubuntu 22.04 LTS.
While using spring boot i am facing java.io.FileNotFoundException with each xml and it is working fine with windows 10 and vscode in Ubuntu. Is there any solution?

I tried reinstalling it twice. Does I have to downgrade?


问:
removing index number/rowname in vector in r
Consider a data table with a column named final:

a = data.table::data.table(final = c("name1","name2","name3"))
```
<p>I want to use each element of the column final in a loop but I want it without its index number.</p>
<p>Even when I do</p>
<pre class="lang-r prettyprint-override"><code>rownames(a) <- NULL
</code>```

and try

a$final[1]
```
<p>it shows</p>
```[1] name1
```
<p>I want this without the index number <code>[1]</code>, i.e, just</p>
```name1
```

Body:
Consider a data table with a column named final:

a = data.table::data.table(final = c("name1","name2","name3"))

I want to use each element of the column final in a loop but I want it without its index number.

Even when I do

rownames(a) <- NULL

and try

a$final[1]

it shows

[1] name1

I want this without the index number [1], i.e, just

name1


问:
GridView delegates are not being created in SwipeView Page on another qml
i am trying to have a custom keyboard and use it in my application. But when i add my keyboard inside of Page{} component, nothing shows up on delegates.

Created a qml to use custom keyboard, and here is the first row of it. Here is my TestBoard.qml

```<code>import QtQuick 2.14
import QtQuick.Controls 2.3
import QtQuick.Window 2.2

Item {

id: mainKeyboard

Image {
    z:900
    source: "/images/textArea"
    width:textfield_width
    height: textfield_height
    x:textfield_x
    y:textfield_y
}

Text{
    id: testbox
    text: "Program Name"
    font.pixelSize: 30
    anchors.top : parent.top
    anchors.topMargin: 50
    anchors.horizontalCenter: parent.horizontalCenter
}

TextField {
    id:valueArea
    width:textfield_width;
    height:35
    x:textfield_x
    y:textfield_y +1
    background:Rectangle{color: "transparent"}
    font.family: "SF Pro Text"
    font.pixelSize:  12
    z: 999
    color: "white"
    font.weight: 600
    placeholderText: "Placeholder"
    placeholderTextColor: "#F6F2F2"
    onAccepted: focus = false
    Keys.onEscapePressed: undo()
}

property int  button_width: 44
property int button_height: 44
property int  button_width_del: 90
property int button_height_del: 44
property int  button_width_shift: 87
property int button_height_shift: 44
property int  button_width_space: 175
property int button_height_space: 44
property int textfield_width: 662
property int textfield_height: 22
property int textfield_x : 69
property int textfield_y : 218
property bool shiftPressed : false

property string  button_press_source_1: "/images/keyboardButton_press_1"
property string  button_press_source_2: "/images/keyboardButton_press_2"
property string  button_press_source_3: "/images/keyboardButton_press_3"
property string  button_press_source_4: "/images/keyboardButton_press_4"
property string  button_release_source_1: "/images/keyboardButton_release_1"
property string  button_release_source_2: "/images/keyboardButton_release_2"
property string  button_release_source_3: "/images/keyboardButton_release_3"
property string  button_release_source_4: "/images/keyboardButton_release_4"

property string  button_press_source_1_del: "/images/keyboardButton_press_1_delete"
property string  button_press_source_1_shift: "/images/keyboardButton_press_1_shift"
property string  button_press_source_1_space: "/images/keyboardButton_press_1_space"
property string  button_release_source_1_del: "/images/keyboardButton_release_1_delete"
property string  button_release_source_1_shift: "/images/keyboardButton_release_1_shift"
property string  button_release_source_1_space: "/images/keyboardButton_release_1_space"

//First Row

ListModel {
    id: keyboardFirstRowListModel
    property int letterSize: 20

    Component.onCompleted: {
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "Q" , pixelSize: letterSize , releasedState: button_release_source_1, pressedState: button_press_source_1, keyValue: Qt.Key_Q, secondKeyValue : Qt.Key_Q})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "W" , pixelSize: letterSize , releasedState: button_release_source_1, pressedState: button_press_source_1, keyValue: Qt.Key_W})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "E" , pixelSize: letterSize , releasedState: button_release_source_1, pressedState: button_press_source_1, keyValue: Qt.Key_E})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "R" , pixelSize: letterSize , releasedState: button_release_source_1, pressedState: button_press_source_1, keyValue: Qt.Key_R})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "T" , pixelSize: letterSize , releasedState: button_release_source_2, pressedState: button_press_source_2, keyValue: Qt.Key_T})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "Y" , pixelSize: letterSize , releasedState: button_release_source_2, pressedState: button_press_source_2, keyValue: Qt.Key_Y})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "U" , pixelSize: letterSize , releasedState: button_release_source_2, pressedState: button_press_source_2, keyValue: Qt.Key_U})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "I" , pixelSize: letterSize , releasedState: button_release_source_3, pressedState: button_press_source_3, keyValue: Qt.Key_I})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "O" , pixelSize: letterSize , releasedState: button_release_source_3, pressedState: button_press_source_3, keyValue: Qt.Key_O})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "P" , pixelSize: letterSize , releasedState: button_release_source_4, pressedState: button_press_source_4, keyValue: Qt.Key_P})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLowerLetter: "[" , buttonUpperLetter: "{",  pixelSize: letterSize , releasedState: button_release_source_4, pressedState: button_press_source_4, keyValue: Qt.Key_BracketLeft, secondKeyValue: Qt.Key_BraceLeft})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLowerLetter: "]" , buttonUpperLetter: "}", pixelSize: letterSize , releasedState: button_release_source_4, pressedState: button_press_source_4, keyValue: Qt.Key_BracketRight, secondKeyValue: Qt.Key_BraceRight})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLowerLetter: "\\" , buttonUpperLetter: "|", pixelSize: letterSize , releasedState: button_release_source_4, pressedState: button_press_source_4, keyValue: Qt.Key_Backslash, secondKeyValue: Qt.Key_Bar})

    }

}

GridView{
    id: keyboardFirstRowGridView
    model: keyboardFirstRowListModel
    boundsBehavior: Flickable.StopAtBounds
    interactive: false
    anchors.fill: parent
    anchors.leftMargin: 69
    anchors.topMargin: 259
    cellHeight: 52
    cellWidth: 52
    delegate: Button {

        width:buttonWidth
        height:buttonHeight
        focusPolicy: Qt.NoFocus
        background: Rectangle {
            color: "transparent" }
        Text{
            text: buttonLetter
            color: "white"
            font.family: "SF Pro Text"
            font.pixelSize:  pixelSize
            font.weight: 500
            z: 999
            anchors.top: parent.top
           // anchors.left: parent.left
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.topMargin: 7
        }
        Text{
            text: buttonLowerLetter
            color: "white"
            font.family: "SF Pro Text"
            font.pixelSize:  15
            font.weight: 500
            z: 999
            anchors.top: parent.top
           // anchors.left: parent.left
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.topMargin: 20
        }
        Text{
            text: buttonUpperLetter
            color: "white"
            font.family: "SF Pro Text"
            font.pixelSize:  15
            font.weight: 500
            z: 999
            anchors.top: parent.top
           // anchors.left: parent.left
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.topMargin: 0
        }
        Image {
            id: firstRowButtons
            source: releasedState
            anchors.centerIn: parent
        }
        onPressed:{
            if(shiftPressed===false){
                keyEmitter.emitkey(keyValue)
                firstRowButtons.source = pressedState
            }else{
                keyEmitter.emitkey(secondKeyValue)
                firstRowButtons.source = pressedState
            }

        }
        onReleased: firstRowButtons.source = releasedState
    }
}

}
</code>```

When i call this qml in another qml named TestPage.qml with this way

```<code>import QtQuick 2.14
import QtQuick.Controls 2.3
import QtQuick.Window 2.2

    Item{

    TestBoard{
        id: testBoardKeyboard
        opacity: 1
    }

}
</code>```

it gives me the result below

But when i make the same call in another page which includes an Item>SwipeView>Page with code below

```<code>import QtQuick 2.6
import QtQuick.Controls 2.0
import QtQuick.Window 2.0

Item {
    id: programSwipe

    SwipeView {
        id: swipeView
        anchors.fill: parent
        currentIndex: 0

        Page {
            background: null
            id: programPage

            TestBoard{
                id: testBoardTest123
                opacity: 1
            }
        }
    }
 }
</code>```

It gives me this

So "Page" component is blocking something, and wasn't able to figure out how. Any ideas?

Body:
i am trying to have a custom keyboard and use it in my application. But when i add my keyboard inside of Page{} component, nothing shows up on delegates.

Created a qml to use custom keyboard, and here is the first row of it. Here is my TestBoard.qml

import QtQuick 2.14
import QtQuick.Controls 2.3
import QtQuick.Window 2.2

Item {

id: mainKeyboard

Image {
    z:900
    source: "/images/textArea"
    width:textfield_width
    height: textfield_height
    x:textfield_x
    y:textfield_y
}

Text{
    id: testbox
    text: "Program Name"
    font.pixelSize: 30
    anchors.top : parent.top
    anchors.topMargin: 50
    anchors.horizontalCenter: parent.horizontalCenter
}

TextField {
    id:valueArea
    width:textfield_width;
    height:35
    x:textfield_x
    y:textfield_y +1
    background:Rectangle{color: "transparent"}
    font.family: "SF Pro Text"
    font.pixelSize:  12
    z: 999
    color: "white"
    font.weight: 600
    placeholderText: "Placeholder"
    placeholderTextColor: "#F6F2F2"
    onAccepted: focus = false
    Keys.onEscapePressed: undo()
}

property int  button_width: 44
property int button_height: 44
property int  button_width_del: 90
property int button_height_del: 44
property int  button_width_shift: 87
property int button_height_shift: 44
property int  button_width_space: 175
property int button_height_space: 44
property int textfield_width: 662
property int textfield_height: 22
property int textfield_x : 69
property int textfield_y : 218
property bool shiftPressed : false

property string  button_press_source_1: "/images/keyboardButton_press_1"
property string  button_press_source_2: "/images/keyboardButton_press_2"
property string  button_press_source_3: "/images/keyboardButton_press_3"
property string  button_press_source_4: "/images/keyboardButton_press_4"
property string  button_release_source_1: "/images/keyboardButton_release_1"
property string  button_release_source_2: "/images/keyboardButton_release_2"
property string  button_release_source_3: "/images/keyboardButton_release_3"
property string  button_release_source_4: "/images/keyboardButton_release_4"

property string  button_press_source_1_del: "/images/keyboardButton_press_1_delete"
property string  button_press_source_1_shift: "/images/keyboardButton_press_1_shift"
property string  button_press_source_1_space: "/images/keyboardButton_press_1_space"
property string  button_release_source_1_del: "/images/keyboardButton_release_1_delete"
property string  button_release_source_1_shift: "/images/keyboardButton_release_1_shift"
property string  button_release_source_1_space: "/images/keyboardButton_release_1_space"

//First Row

ListModel {
    id: keyboardFirstRowListModel
    property int letterSize: 20

    Component.onCompleted: {
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "Q" , pixelSize: letterSize , releasedState: button_release_source_1, pressedState: button_press_source_1, keyValue: Qt.Key_Q, secondKeyValue : Qt.Key_Q})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "W" , pixelSize: letterSize , releasedState: button_release_source_1, pressedState: button_press_source_1, keyValue: Qt.Key_W})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "E" , pixelSize: letterSize , releasedState: button_release_source_1, pressedState: button_press_source_1, keyValue: Qt.Key_E})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "R" , pixelSize: letterSize , releasedState: button_release_source_1, pressedState: button_press_source_1, keyValue: Qt.Key_R})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "T" , pixelSize: letterSize , releasedState: button_release_source_2, pressedState: button_press_source_2, keyValue: Qt.Key_T})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "Y" , pixelSize: letterSize , releasedState: button_release_source_2, pressedState: button_press_source_2, keyValue: Qt.Key_Y})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "U" , pixelSize: letterSize , releasedState: button_release_source_2, pressedState: button_press_source_2, keyValue: Qt.Key_U})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "I" , pixelSize: letterSize , releasedState: button_release_source_3, pressedState: button_press_source_3, keyValue: Qt.Key_I})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "O" , pixelSize: letterSize , releasedState: button_release_source_3, pressedState: button_press_source_3, keyValue: Qt.Key_O})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLetter: "P" , pixelSize: letterSize , releasedState: button_release_source_4, pressedState: button_press_source_4, keyValue: Qt.Key_P})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLowerLetter: "[" , buttonUpperLetter: "{",  pixelSize: letterSize , releasedState: button_release_source_4, pressedState: button_press_source_4, keyValue: Qt.Key_BracketLeft, secondKeyValue: Qt.Key_BraceLeft})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLowerLetter: "]" , buttonUpperLetter: "}", pixelSize: letterSize , releasedState: button_release_source_4, pressedState: button_press_source_4, keyValue: Qt.Key_BracketRight, secondKeyValue: Qt.Key_BraceRight})
        append ({ buttonWidth: button_width , buttonHeight: button_height , buttonLowerLetter: "\\" , buttonUpperLetter: "|", pixelSize: letterSize , releasedState: button_release_source_4, pressedState: button_press_source_4, keyValue: Qt.Key_Backslash, secondKeyValue: Qt.Key_Bar})

    }

}

GridView{
    id: keyboardFirstRowGridView
    model: keyboardFirstRowListModel
    boundsBehavior: Flickable.StopAtBounds
    interactive: false
    anchors.fill: parent
    anchors.leftMargin: 69
    anchors.topMargin: 259
    cellHeight: 52
    cellWidth: 52
    delegate: Button {

        width:buttonWidth
        height:buttonHeight
        focusPolicy: Qt.NoFocus
        background: Rectangle {
            color: "transparent" }
        Text{
            text: buttonLetter
            color: "white"
            font.family: "SF Pro Text"
            font.pixelSize:  pixelSize
            font.weight: 500
            z: 999
            anchors.top: parent.top
           // anchors.left: parent.left
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.topMargin: 7
        }
        Text{
            text: buttonLowerLetter
            color: "white"
            font.family: "SF Pro Text"
            font.pixelSize:  15
            font.weight: 500
            z: 999
            anchors.top: parent.top
           // anchors.left: parent.left
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.topMargin: 20
        }
        Text{
            text: buttonUpperLetter
            color: "white"
            font.family: "SF Pro Text"
            font.pixelSize:  15
            font.weight: 500
            z: 999
            anchors.top: parent.top
           // anchors.left: parent.left
            anchors.horizontalCenter: parent.horizontalCenter
            anchors.topMargin: 0
        }
        Image {
            id: firstRowButtons
            source: releasedState
            anchors.centerIn: parent
        }
        onPressed:{
            if(shiftPressed===false){
                keyEmitter.emitkey(keyValue)
                firstRowButtons.source = pressedState
            }else{
                keyEmitter.emitkey(secondKeyValue)
                firstRowButtons.source = pressedState
            }

        }
        onReleased: firstRowButtons.source = releasedState
    }
}

}

When i call this qml in another qml named TestPage.qml with this way

import QtQuick 2.14
import QtQuick.Controls 2.3
import QtQuick.Window 2.2

    Item{

    TestBoard{
        id: testBoardKeyboard
        opacity: 1
    }

}

it gives me the result below

But when i make the same call in another page which includes an Item>SwipeView>Page with code below

import QtQuick 2.6
import QtQuick.Controls 2.0
import QtQuick.Window 2.0

Item {
    id: programSwipe

    SwipeView {
        id: swipeView
        anchors.fill: parent
        currentIndex: 0

        Page {
            background: null
            id: programPage

            TestBoard{
                id: testBoardTest123
                opacity: 1
            }
        }
    }
 }

It gives me this

So "Page" component is blocking something, and wasn't able to figure out how. Any ideas?


问:
Find character set encoding of a column in a spark dataframe
I have a dataframe built using pyspark. It has 3 columns "col1", "col2", "col3". I want to find character set encoding for "col1".

How can I achieve this?


问:
I created a discord currency bot i have saving money command but i need reading command
hello I am creating a discord bot with a currency system,

I created saving money but I need members to know how much money they have, so I created a balance command but it doesn´t work the bot just crash, here is the command for saving data:

 module.exports = {
    name: 'currency',
    description: 'currency data create',
    execute(message, args) {
        const filepath = '././data/members/stats.json';
        const fs = require('fs');
        let data = null;
        if (fs.existsSync(filepath)) {
            const jsonfile = fs.readFileSync(filepath);
            const object = JSON.parse(jsonfile);
            data = object;
          } else {
            data = {};
          }

        const memberid = message.author.id;
        if (!data[memberid]) data[memberid] = {};
        if (!data[memberid].money) data[memberid].money = 1000;
        fs.writeFileSync(filepath, JSON.stringify(data, null, 2) );
        message.channel.send("hotovo");
      }
    };
```

This is the balance code
I have been looking on internet for like 2 hours but im kinda dumb mby.

Body:
hello I am creating a discord bot with a currency system,

I created saving money but I need members to know how much money they have, so I created a balance command but it doesn´t work the bot just crash, here is the command for saving data:

 module.exports = {
    name: 'currency',
    description: 'currency data create',
    execute(message, args) {
        const filepath = '././data/members/stats.json';
        const fs = require('fs');
        let data = null;
        if (fs.existsSync(filepath)) {
            const jsonfile = fs.readFileSync(filepath);
            const object = JSON.parse(jsonfile);
            data = object;
          } else {
            data = {};
          }

        const memberid = message.author.id;
        if (!data[memberid]) data[memberid] = {};
        if (!data[memberid].money) data[memberid].money = 1000;
        fs.writeFileSync(filepath, JSON.stringify(data, null, 2) );
        message.channel.send("hotovo");
      }
    };

This is the balance code
I have been looking on internet for like 2 hours but im kinda dumb mby.


问:
Strange behavior when use #includ "file" in the source code of qt designer plugin
I tried to create in inherited widget for the qt designer and explored a strange behavior. When I put the code of the parent class in an include file, the designer plugin is not loaded.

As basis I used the AnalogClock example.

The declaration of the parent class is:

```<code>class ParentAnalogClock : public QWidget
{
    Q_OBJECT

public:
    ParentAnalogClock(QWidget *parent = nullptr):QWidget(parent) {} ;
};
</code>```

I changed the class declaration of AnalogClock to

```<code>//class QDESIGNER_WIDGET_EXPORT AnalogClock : public QWidget
class QDESIGNER_WIDGET_EXPORT AnalogClock : public ParentAnalogClock
</code>```

and the code in analogclock.cpp to

```<code>AnalogClock::AnalogClock(QWidget *parent)
//    : QWidget(parent)
    : ParentAnalogClock(parent)
</code>```

I can compile the plugin and every thing works as expected. Then I put the code of the parent class in to “ParentAnalogClock.h” and include this file.

```<code>#define USE_INCLUDE

#ifdef USE_INCLUDE
    #include "ParentAnalogClock.h"
#else
    class ParentAnalogClock : public QWidget
    {
        Q_OBJECT

      public:
        ParentAnalogClock(QWidget *parent = nullptr):QWidget(parent) {} ;
    };
#endif
</code>```

There are no compiler errors and the plugin is created well.

But when I start the designer, the AnalogClock is NOT available. What is wrong ? --------------------------------------------------------------------------------------------

```<code>Qt version 5.15.3. #
#############################################################################
# Makefile for building: libcustomwidgetplugin.so
# Generated by qmake (3.1) (Qt 5.15.3)
# Project:  customwidgetplugin.pro
# Template: lib
# Command: /usr/lib/qt5/bin/qmake -o Makefile customwidgetplugin.pro
#############################################################################
</code>```

Body:
I tried to create in inherited widget for the qt designer and explored a strange behavior. When I put the code of the parent class in an include file, the designer plugin is not loaded.

As basis I used the AnalogClock example.

The declaration of the parent class is:

class ParentAnalogClock : public QWidget
{
    Q_OBJECT

public:
    ParentAnalogClock(QWidget *parent = nullptr):QWidget(parent) {} ;
};

I changed the class declaration of AnalogClock to

//class QDESIGNER_WIDGET_EXPORT AnalogClock : public QWidget
class QDESIGNER_WIDGET_EXPORT AnalogClock : public ParentAnalogClock

and the code in analogclock.cpp to

AnalogClock::AnalogClock(QWidget *parent)
//    : QWidget(parent)
    : ParentAnalogClock(parent)

I can compile the plugin and every thing works as expected. Then I put the code of the parent class in to “ParentAnalogClock.h” and include this file.

#define USE_INCLUDE

#ifdef USE_INCLUDE
    #include "ParentAnalogClock.h"
#else
    class ParentAnalogClock : public QWidget
    {
        Q_OBJECT

      public:
        ParentAnalogClock(QWidget *parent = nullptr):QWidget(parent) {} ;
    };
#endif

There are no compiler errors and the plugin is created well.

But when I start the designer, the AnalogClock is NOT available. What is wrong ? --------------------------------------------------------------------------------------------

Qt version 5.15.3. #
#############################################################################
# Makefile for building: libcustomwidgetplugin.so
# Generated by qmake (3.1) (Qt 5.15.3)
# Project:  customwidgetplugin.pro
# Template: lib
# Command: /usr/lib/qt5/bin/qmake -o Makefile customwidgetplugin.pro
#############################################################################


问:
How to write a search/filter function for table data?
I have a table in react with many fields (date,name,id,phonenumber) . Id is a list ids i.e if any one id matches then its a success, rest of them are normal strings.

I am storing all the search data inside an object like

```<code>let searchData = {date:"2022-10-11",id:["123","456"],phonenumber:"123456"}
</code>```

How do I write a filter function on a data of 4000 records such that if user searches for one or more field in the table it checks all of them.

I wrote something like this but its not working

```<code>setFilterData(
    data.filter((item) => {
      if (
        searchData.date &&
        searchData.date !=
          dayjs(item.timestamp)
            .tz(constants.TIME_ZONE)
            .format(Constants.DATEFORMAT)
      )
        return false;

      if (
        searchData.Id &&
        searchData.Id.map((id) => id.value).indexOf(item.Id) == -1
      )
        return false;

      if (searchData.phone && searchData.phone != item.phone) return false;

      return true;
    })
  );
</code>```

Body:
I have a table in react with many fields (date,name,id,phonenumber) . Id is a list ids i.e if any one id matches then its a success, rest of them are normal strings.

I am storing all the search data inside an object like

let searchData = {date:"2022-10-11",id:["123","456"],phonenumber:"123456"}

How do I write a filter function on a data of 4000 records such that if user searches for one or more field in the table it checks all of them.

I wrote something like this but its not working

setFilterData(
    data.filter((item) => {
      if (
        searchData.date &&
        searchData.date !=
          dayjs(item.timestamp)
            .tz(constants.TIME_ZONE)
            .format(Constants.DATEFORMAT)
      )
        return false;

      if (
        searchData.Id &&
        searchData.Id.map((id) => id.value).indexOf(item.Id) == -1
      )
        return false;

      if (searchData.phone && searchData.phone != item.phone) return false;

      return true;
    })
  );


问:
Black backgrounds on interactive windows launched from a service
I am implementing a Windows service in C#.  This service calls a separate application that launches interactive windows.  I have been able to work through the problems imposed by Session 0 Isolation by using the following series of steps:

LogonUser() to get a logon token for the user who will execute the separate application

SetTokenInformation() to transfer the user's logon token into session 1

CreateProcessAsUser() to launch the application in the user's session.

This works; When the service launches the application, I see the application's windows appear in my console session. However, the application's windows have black backgrounds and all of the controls are invisible.  If I click in an area where I know there is a button, the window responds, so it is clearly able to receive user input.

Here is (a simplified and stripped down version of) the code I'm using:

```<code>IntPtr logonToken;
LogonUser(username, domain, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, out logonToken);

SetTokenInformation(logonToken, TOKEN_INFORMATION_CLASS.TokenSessionId, sessionIdValuePtr, sessionIdSize);

STARTUPINFO startupinfo = new STARTUPINFO();
startupinfo.cb = Marshal.SizeOf(startupinfo);
startupinfo.lpDesktop = @"winsta0\default";

PROCESS_INFORMATION processinfo;
SECURITY_ATTRIBUTES processAttributes = new SECURITY_ATTRIBUTES();
SECURITY_ATTRIBUTES threadAttributes = new SECURITY_ATTRIBUTES();

ImpersonateLoggedOnUser(logonToken);

CreateProcessAsUser(
    logonToken,
    null,
    cmdLine,
    ref processAttributes,
    ref threadAttributes,
    false,
    0,
    IntPtr.Zero,
    workingDirectory,
    ref startupinfo,
    out processinfo)

RevertToSelf();
</code>```

I have tried adding code to load the user's profile before calling CreateProcessAsUser, but this did not help.

What could be causing the black backgrounds on my windows, and how should I go about fixing this problem?  Any help would be most appreciated.

UPDATE: This appears to be very similar to the problem in this question: CreateProcessAsUser doesn't draw the GUI.  He is using XP SP3, and I am having this problem in Windows 7 and Server 2008, meaning that I have the additional problem of dealing with Session 0 Isolation, but the symptoms in the two cases seem similar.

ContentLicense: CC BY-SA 3.0

Body:
I am implementing a Windows service in C#.  This service calls a separate application that launches interactive windows.  I have been able to work through the problems imposed by Session 0 Isolation by using the following series of steps:

LogonUser() to get a logon token for the user who will execute the separate application

SetTokenInformation() to transfer the user's logon token into session 1

CreateProcessAsUser() to launch the application in the user's session.

This works; When the service launches the application, I see the application's windows appear in my console session. However, the application's windows have black backgrounds and all of the controls are invisible.  If I click in an area where I know there is a button, the window responds, so it is clearly able to receive user input.

Here is (a simplified and stripped down version of) the code I'm using:

IntPtr logonToken;
LogonUser(username, domain, password, LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, out logonToken);

SetTokenInformation(logonToken, TOKEN_INFORMATION_CLASS.TokenSessionId, sessionIdValuePtr, sessionIdSize);

STARTUPINFO startupinfo = new STARTUPINFO();
startupinfo.cb = Marshal.SizeOf(startupinfo);
startupinfo.lpDesktop = @"winsta0\default";

PROCESS_INFORMATION processinfo;
SECURITY_ATTRIBUTES processAttributes = new SECURITY_ATTRIBUTES();
SECURITY_ATTRIBUTES threadAttributes = new SECURITY_ATTRIBUTES();

ImpersonateLoggedOnUser(logonToken);

CreateProcessAsUser(
    logonToken,
    null,
    cmdLine,
    ref processAttributes,
    ref threadAttributes,
    false,
    0,
    IntPtr.Zero,
    workingDirectory,
    ref startupinfo,
    out processinfo)

RevertToSelf();

I have tried adding code to load the user's profile before calling CreateProcessAsUser, but this did not help.

What could be causing the black backgrounds on my windows, and how should I go about fixing this problem?  Any help would be most appreciated.

UPDATE: This appears to be very similar to the problem in this question: CreateProcessAsUser doesn't draw the GUI.  He is using XP SP3, and I am having this problem in Windows 7 and Server 2008, meaning that I have the additional problem of dealing with Session 0 Isolation, but the symptoms in the two cases seem similar.


问:
how to import .aab in Android studio code
I am new to to android studio code. I developed an app in mit app inventor so if i could import .aab file to android studio code . It would be really helpful

i tried searching online but couldn't get any


问:
Create custom dimesion to detect product image for shopify product page with Google Analytics 4 (GA4)
I'm going to getting started with Google Analytics 4 (GA4). I'm reading docs about
Google API. I have a way to create a custom dimension

```<code>  const customDimensions = {
    'ab_page_image': 'AB Image',
  }
  for (let p in customDimensions) {
      await analyticsAdminClient.createCustomDimension({
          parent: `properties/${propertyId}`,
          customDimension: {
              scope: 'EVENT',
              parameterName: p,
              displayName: customDimensions[p],
          }
      }).catch(console.error)
  }
</code>```

It works fine, but I confused that how to connect my custom dimension (ab_page_image in this case) to shopify so GA4 can detect then return value of ab_page_image for me?

Body:
I'm going to getting started with Google Analytics 4 (GA4). I'm reading docs about
Google API. I have a way to create a custom dimension

  const customDimensions = {
    'ab_page_image': 'AB Image',
  }
  for (let p in customDimensions) {
      await analyticsAdminClient.createCustomDimension({
          parent: `properties/${propertyId}`,
          customDimension: {
              scope: 'EVENT',
              parameterName: p,
              displayName: customDimensions[p],
          }
      }).catch(console.error)
  }

It works fine, but I confused that how to connect my custom dimension (ab_page_image in this case) to shopify so GA4 can detect then return value of ab_page_image for me?


问:
Why backslash ( \ ) causes ValuesError when using CDLIB?
I am working on community detection algorithms on graphs. I have an edge list that its nodes are strings such as: names, addresses,IDs and ,...
There was something interesting with edge list. When there is backslash ( \ ) in edgelist such as \template1\  the program raises this Error: ValueError: invalid literal for int() with base 10: but when I remove backslashes and \template1\  becames as template1  everything works well. Is there any way to handle and solve this problem? because I dont want to change the actual words in edge list and i dont want to remove backslashes.

I use this code to build a graph and detect communities:

```<code>from cdlib import algorithms
import networkx as nx
Txtfile = open("ProgramFolders/result/edgelist.txt", encoding='utf-8')
G = nx.read_weighted_edgelist(Txtfile)
Txtfile.close()

coms = algorithms.louvain(G)

</code>```

and this is a small part of my edge list:

```<code>\template1\      \192.168.100.30
\template1\      200.02483421
\template1\      \192.168.100.70
\template1\      //192.167.100.30:70/service
\template1\      \192.168
\template1\      //192.168.44
\template1\      240.54625187
\template1\      //192.167.100/service
...
</code>```

Update

this is the traceback log:

```<code>Traceback (most recent call last):
  File "C:\Users\vaio\PycharmProjects\community.py", line 315, in <module>
    coms = algorithms.louvain(G, weight='weight')
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\algorithms\crisp_partition.py", line 518, in louvain
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\classes\node_clustering.py", line 31, in __init__
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\classes\clustering.py", line 42, in __init__
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\classes\clustering.py", line 21, in __convert_back_to_original_nodes_names_if_needed
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\classes\clustering.py", line 21, in <listcomp>
ValueError: invalid literal for int() with base 10: 'template1\\'
</code>```

I really appreciate answers which solves this problem

Body:
I am working on community detection algorithms on graphs. I have an edge list that its nodes are strings such as: names, addresses,IDs and ,...
There was something interesting with edge list. When there is backslash ( \ ) in edgelist such as \template1\  the program raises this Error: ValueError: invalid literal for int() with base 10: but when I remove backslashes and \template1\  becames as template1  everything works well. Is there any way to handle and solve this problem? because I dont want to change the actual words in edge list and i dont want to remove backslashes.

I use this code to build a graph and detect communities:

from cdlib import algorithms
import networkx as nx
Txtfile = open("ProgramFolders/result/edgelist.txt", encoding='utf-8')
G = nx.read_weighted_edgelist(Txtfile)
Txtfile.close()

coms = algorithms.louvain(G)

and this is a small part of my edge list:

\template1\      \192.168.100.30
\template1\      200.02483421
\template1\      \192.168.100.70
\template1\      //192.167.100.30:70/service
\template1\      \192.168
\template1\      //192.168.44
\template1\      240.54625187
\template1\      //192.167.100/service
...

Update

this is the traceback log:

Traceback (most recent call last):
  File "C:\Users\vaio\PycharmProjects\community.py", line 315, in <module>
    coms = algorithms.louvain(G, weight='weight')
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\algorithms\crisp_partition.py", line 518, in louvain
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\classes\node_clustering.py", line 31, in __init__
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\classes\clustering.py", line 42, in __init__
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\classes\clustering.py", line 21, in __convert_back_to_original_nodes_names_if_needed
  File "C:\Users\vaio\AppData\Local\Programs\Python\Python39\lib\site-packages\cdlib-0.2.4-py3.9.egg\cdlib\classes\clustering.py", line 21, in <listcomp>
ValueError: invalid literal for int() with base 10: 'template1\\'

I really appreciate answers which solves this problem


问:
How to get UI fields to post instead of Response Body in Swagger UI
I have an entity controller that gets and posts from my localdb.
However, I'm getting response body to edit and post values in my [httppost] for database in the entity controller whereas I used to get HTML like fields before.

I don't know what I changed that it is producing a response body, it used to show UI fields before which is the result I'm trying to achieve. Like the image below.

I tried recreating the same project again, it's never giving fields for entering post parameters like before. I only get a response body template to edit from :(


问:
How to resolve a JSON-LD value?

{
  "@context": {
    "mkdocs": "https://mkdocs.iolanta.tech/",
    "table": "https://mkdocs.iolanta.tech/tables/",

    "description": "mkdocs:description",

    "table:rows": {
      "@type": "@id"
    },
    "table:columns": {
      "@id": "table:columns",
      "@type": "@id",
      "@container": "@list"
    }
  },

  "$id": "table",
  "table:columns": [
    "description"
  ],
  "table:rows": [
    {
      "description": "foo"
    }
  ]
}

```
<p>In JSON-LD playground, I am testing a simple document that has to describe a piece of tabular data.</p>
<p>I want to interpret the word <code>description</code> to resolve into <code>mkdocs:description</code>. The expanded form shows that this doesn't happen for every place where that word is used:</p>
<pre class="lang-json prettyprint-override"><code>[
  {
    "https://mkdocs.iolanta.tech/tables/columns": [
      {
        "@list": [
          {
            "@id": "https://dvcs.w3.org/hg/json-ld/raw-file/default/playground/description"
          }
        ]
      }
    ],
    "https://mkdocs.iolanta.tech/tables/rows": [
      {
        "https://mkdocs.iolanta.tech/description": [
          {
            "@value": "foo"
          }
        ]
      }
    ]
  }
]
</code>```

In table:rows block, the term description is a key; in table:columns, it is a value. I assume that is the reason for it not being resolved.

Is there a way for me to construct a JSON-LD description in such a way that description in table:columns block is resolved into mkdocs:description and any other keyword (such as some-random-column) is resolved against the base URL of the document (which in this case happens to be the URL of the JSON-LD playground)?

Title: How to resolve a JSON-LD value?

Body:
{
  "@context": {
    "mkdocs": "https://mkdocs.iolanta.tech/",
    "table": "https://mkdocs.iolanta.tech/tables/",

    "description": "mkdocs:description",

    "table:rows": {
      "@type": "@id"
    },
    "table:columns": {
      "@id": "table:columns",
      "@type": "@id",
      "@container": "@list"
    }
  },

  "$id": "table",
  "table:columns": [
    "description"
  ],
  "table:rows": [
    {
      "description": "foo"
    }
  ]
}

In JSON-LD playground, I am testing <a href="https://dvcs.w3.org/hg/json-ld/raw-file/default/playground/index.html#startTab=tab-expanded&json-ld=%7B%22%40context%22%3A%7B%22mkdocs%22%3A%22https%3A%2F%2Fmkdocs.iolanta.tech%2F%22%2C%22table%22%3A%22https%3A%2F%2Fmkdocs.iolanta.tech%2Ftables%2F%22%2C%22description%22%3A%22mkdocs%3Adescription%22%2C%22table%3Arows%22%3A%7B%22%40type%22%3A%22%40id%22%7D%2C%22table%3Acolumns%22%3A%7B%22%40id%22%3A%22table%3Acolumns%22%2C%22%40type%22%3A%22%40id%22%2C%22%40container%22%3A%22%40list%22%7D%7D%2C%22%24id%22%3A%22table%22%2C%22table%3Acolumns%22%3A%5B%22description%22%5D%2C%22table%3Arows%22%3A%5B%7B%22description%22%3A%22foo%22%7D%5D%7D" rel="nofollow noreferrer">a simple document that has to describe a piece of tabular data.

I want to interpret the word description to resolve into mkdocs:description. The expanded form shows that this doesn't happen for every place where that word is used:

[
  {
    "https://mkdocs.iolanta.tech/tables/columns": [
      {
        "@list": [
          {
            "@id": "https://dvcs.w3.org/hg/json-ld/raw-file/default/playground/description"
          }
        ]
      }
    ],
    "https://mkdocs.iolanta.tech/tables/rows": [
      {
        "https://mkdocs.iolanta.tech/description": [
          {
            "@value": "foo"
          }
        ]
      }
    ]
  }
]

In table:rows block, the term description is a key; in table:columns, it is a value. I assume that is the reason for it not being resolved.

Is there a way for me to construct a JSON-LD description in such a way that description in table:columns block is resolved into mkdocs:description and any other keyword (such as some-random-column) is resolved against the base URL of the document (which in this case happens to be the URL of the JSON-LD playground)?


问:
How to create only one sitemap in nextjs
I'm using next-sitemap package for creating sitemap.
I have dynamic and static pages.

this is my next-sitemap.config.js file:

```<code>module.exports = {
    siteUrl: 'https://example.com',
    generateRobotsTxt: false,
    exclude: ['/server-sitemap-index.xml'], // <= exclude here
    robotsTxtOptions: {
      additionalSitemaps: [
        'https://example.com/server-sitemap-index.xml', // <==== Add here
      ],
    },
  }
</code>```

but this config generate two sitemaps.

robots.txt:

```<code>Sitemap: https://example.com/sitemap.xml
</code>```

content of above link:

```<code><sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
<script/>
<sitemap>
<loc>https://example.com/sitemap-0.xml</loc>
</sitemap>
<sitemap>
<loc>https://example.com/server-sitemap-index.xml</loc>
</sitemap>
</sitemapindex>
</code>```

sitemap-0.xml is static links and server-sitemap-index.xml is dynamic links.

but I want to have only one site map for example:

https://example.com/sitemap.xml

```<code>static links
....
dynamic links
</code>```

Body:
I'm using next-sitemap package for creating sitemap.
I have dynamic and static pages.

this is my next-sitemap.config.js file:

module.exports = {
    siteUrl: 'https://example.com',
    generateRobotsTxt: false,
    exclude: ['/server-sitemap-index.xml'], // <= exclude here
    robotsTxtOptions: {
      additionalSitemaps: [
        'https://example.com/server-sitemap-index.xml', // <==== Add here
      ],
    },
  }

but this config generate two sitemaps.

robots.txt:

Sitemap: https://example.com/sitemap.xml

content of above link:

<sitemapindex xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">


问:
Flutter image picker not working on web release mode
I have a function to pick images in my webapp using the image_picker package, The code works when on localhost but once the webapp is live it wont allow image picker function to work, how can I fix this?

My code looks like this.

```<code>Future<void> pickImage() async {
    if (!kIsWeb) {
      final imagePicker = ImagePicker();
      XFile? imageFile =
          await imagePicker.pickImage(source: ImageSource.gallery);

      if (imageFile != null) {
        // Upload the image
        var selected = File(imageFile.path);
        setState(() {
          _pickedImage = selected;
        });
      } else {
        // print('No image selected');
      }
    } else if (kIsWeb) {
      final imagePicker = ImagePicker();
      XFile? imageFile =
          await imagePicker.pickImage(source: ImageSource.gallery);

      if (imageFile != null) {
        // Upload the image
        var f = await imageFile.readAsBytes();
        setState(() {
          webImage = f;
          _pickedImage = File('a');
        });
      } else {
        // print('No image selected');
      }
    } else {
      // print('Something went wrong');
    }
  }
</code>```

I have also initialized the following fields

```<code>File? _pickedImage;
Uint8List webImage = Uint8List(8);
</code>```

Body:
I have a function to pick images in my webapp using the image_picker package, The code works when on localhost but once the webapp is live it wont allow image picker function to work, how can I fix this?

My code looks like this.

Future<void> pickImage() async {
    if (!kIsWeb) {
      final imagePicker = ImagePicker();
      XFile? imageFile =
          await imagePicker.pickImage(source: ImageSource.gallery);

      if (imageFile != null) {
        // Upload the image
        var selected = File(imageFile.path);
        setState(() {
          _pickedImage = selected;
        });
      } else {
        // print('No image selected');
      }
    } else if (kIsWeb) {
      final imagePicker = ImagePicker();
      XFile? imageFile =
          await imagePicker.pickImage(source: ImageSource.gallery);

      if (imageFile != null) {
        // Upload the image
        var f = await imageFile.readAsBytes();
        setState(() {
          webImage = f;
          _pickedImage = File('a');
        });
      } else {
        // print('No image selected');
      }
    } else {
      // print('Something went wrong');
    }
  }

I have also initialized the following fields

File? _pickedImage;
Uint8List webImage = Uint8List(8);