问:
Install Vips-8.9.2 on UCRT64 windows11
I am trying to install vips-8.9.2 on UCRT64 for windows 11. And after "./configure" I got:

```<code>configure: creating ./config.status
config.status: creating vips.pc
config.status: creating vips-cpp.pc
config.status: creating Makefile
config.status: creating libvips/include/vips/version.h
config.status: creating libvips/include/Makefile
config.status: creating libvips/include/vips/Makefile
config.status: creating libvips/Makefile
config.status: creating libvips/arithmetic/Makefile
config.status: creating libvips/colour/Makefile
config.status: creating libvips/colour/profiles/Makefile
config.status: creating libvips/conversion/Makefile
config.status: creating libvips/convolution/Makefile
config.status: creating libvips/deprecated/Makefile
config.status: creating libvips/foreign/Makefile
config.status: creating libvips/freqfilt/Makefile
config.status: creating libvips/histogram/Makefile
config.status: creating libvips/draw/Makefile
config.status: creating libvips/iofuncs/Makefile
config.status: creating libvips/morphology/Makefile
config.status: creating libvips/mosaicing/Makefile
config.status: creating libvips/create/Makefile
config.status: creating libvips/resample/Makefile
config.status: creating cplusplus/include/Makefile
config.status: creating cplusplus/include/vips/Makefile
config.status: creating cplusplus/Makefile
config.status: creating tools/Makefile
config.status: creating tools/batch_crop
config.status: creating tools/batch_image_convert
config.status: creating tools/batch_rubber_sheet
config.status: creating tools/light_correct
config.status: creating tools/shrink_width
config.status: creating test/Makefile
config.status: creating test/variables.sh
config.status: creating test/test-suite/Makefile
config.status: creating test/test-suite/helpers/Makefile
config.status: creating man/Makefile
config.status: creating doc/Makefile
config.status: creating doc/libvips-docs.xml
config.status: creating po/Makefile.in
config.status: creating fuzz/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default-1 commands
config.status: executing libtool commands
* build options
native win32:                           yes
native OS X:                            no
open files in binary mode:              yes
enable debug:                           no
enable deprecated library components:   yes
enable docs with gtkdoc:                no
gobject introspection:                  yes
enable radiance support:                yes
enable analyze support:                 yes
enable PPM support:                     yes

* optional dependencies
use fftw3 for FFT:                      yes
Magick package:                         MagickCore
Magick API version:                     magick7
load with libMagick:                    yes
save with libMagick:                    yes
accelerate loops with orc:              yes
  (requires orc-0.4.11 or later)
ICC profile support with lcms:          yes (lcms2)
file import with niftiio:               no
file import with libheif:               yes
file import with OpenEXR:               yes
file import with OpenSlide:             yes
  (requires openslide-3.3.0 or later)
file import with matio:                 yes
PDF import with PDFium                  no
PDF import with poppler-glib:           yes
  (requires poppler-glib 0.16.0 or later)
SVG import with librsvg-2.0:            yes
  (requires librsvg-2.0 2.34.0 or later)
zlib:                                   yes
file import with cfitsio:               yes
file import/export with libwebp:        yes
  (requires libwebp, libwebpmux, libwebpdemux 0.6.0 or later)
text rendering with pangoft2:           yes
file import/export with libpng:         yes (pkg-config libpng >= 1.2.9)
  (requires libpng-1.2.9 or later)
support 8bpp PNG quantisation:          yes
  (requires libimagequant)
file import/export with libtiff:        yes (pkg-config libtiff-4)
file import/export with giflib:         yes (found by search)
file import/export with libjpeg:        yes (pkg-config)
image pyramid export:                   yes
  (requires libgsf-1 1.14.26 or later)
use libexif to load/save JPEG metadata: yes

</code>```

But when try to execute make, I got this:

```<code>svgload.c:377:10: fatal error: librsvg/librsvg-features.h: No such file or directory
  377 | #include <librsvg/librsvg-features.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:694: svgload.lo] Error 1
make[3]: Leaving directory '/home/Marco Moreno/dd/vips-8.9.2/libvips/foreign'
make[2]: *** [Makefile:875: all-recursive] Error 1
make[2]: Leaving directory '/home/Marco Moreno/dd/vips-8.9.2/libvips'
make[1]: *** [Makefile:629: all-recursive] Error 1
make[1]: Leaving directory '/home/Marco Moreno/dd/vips-8.9.2'
make: *** [Makefile:536: all] Error 2

</code>```

I´ve tried to change librsvg/rsvg-features.h name into librsvg/librsvg-features.h, and the file is on this path:"C:\msys64\ucrt64\include\librsvg-2.0\librsvg"

I will appreciate yor Help.

Also I have these warning when configure is executed:

```<code>configure: WARNING: Libtool does not cope well with whitespace in `pwd`
</code>```

Title: Install Vips-8.9.2 on UCRT64 windows11

Body:
I am trying to install vips-8.9.2 on UCRT64 for windows 11. And after "./configure" I got:

configure: creating ./config.status
config.status: creating vips.pc
config.status: creating vips-cpp.pc
config.status: creating Makefile
config.status: creating libvips/include/vips/version.h
config.status: creating libvips/include/Makefile
config.status: creating libvips/include/vips/Makefile
config.status: creating libvips/Makefile
config.status: creating libvips/arithmetic/Makefile
config.status: creating libvips/colour/Makefile
config.status: creating libvips/colour/profiles/Makefile
config.status: creating libvips/conversion/Makefile
config.status: creating libvips/convolution/Makefile
config.status: creating libvips/deprecated/Makefile
config.status: creating libvips/foreign/Makefile
config.status: creating libvips/freqfilt/Makefile
config.status: creating libvips/histogram/Makefile
config.status: creating libvips/draw/Makefile
config.status: creating libvips/iofuncs/Makefile
config.status: creating libvips/morphology/Makefile
config.status: creating libvips/mosaicing/Makefile
config.status: creating libvips/create/Makefile
config.status: creating libvips/resample/Makefile
config.status: creating cplusplus/include/Makefile
config.status: creating cplusplus/include/vips/Makefile
config.status: creating cplusplus/Makefile
config.status: creating tools/Makefile
config.status: creating tools/batch_crop
config.status: creating tools/batch_image_convert
config.status: creating tools/batch_rubber_sheet
config.status: creating tools/light_correct
config.status: creating tools/shrink_width
config.status: creating test/Makefile
config.status: creating test/variables.sh
config.status: creating test/test-suite/Makefile
config.status: creating test/test-suite/helpers/Makefile
config.status: creating man/Makefile
config.status: creating doc/Makefile
config.status: creating doc/libvips-docs.xml
config.status: creating po/Makefile.in
config.status: creating fuzz/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing default-1 commands
config.status: executing libtool commands
* build options
native win32:                           yes
native OS X:                            no
open files in binary mode:              yes
enable debug:                           no
enable deprecated library components:   yes
enable docs with gtkdoc:                no
gobject introspection:                  yes
enable radiance support:                yes
enable analyze support:                 yes
enable PPM support:                     yes

* optional dependencies
use fftw3 for FFT:                      yes
Magick package:                         MagickCore
Magick API version:                     magick7
load with libMagick:                    yes
save with libMagick:                    yes
accelerate loops with orc:              yes
  (requires orc-0.4.11 or later)
ICC profile support with lcms:          yes (lcms2)
file import with niftiio:               no
file import with libheif:               yes
file import with OpenEXR:               yes
file import with OpenSlide:             yes
  (requires openslide-3.3.0 or later)
file import with matio:                 yes
PDF import with PDFium                  no
PDF import with poppler-glib:           yes
  (requires poppler-glib 0.16.0 or later)
SVG import with librsvg-2.0:            yes
  (requires librsvg-2.0 2.34.0 or later)
zlib:                                   yes
file import with cfitsio:               yes
file import/export with libwebp:        yes
  (requires libwebp, libwebpmux, libwebpdemux 0.6.0 or later)
text rendering with pangoft2:           yes
file import/export with libpng:         yes (pkg-config libpng >= 1.2.9)
  (requires libpng-1.2.9 or later)
support 8bpp PNG quantisation:          yes
  (requires libimagequant)
file import/export with libtiff:        yes (pkg-config libtiff-4)
file import/export with giflib:         yes (found by search)
file import/export with libjpeg:        yes (pkg-config)
image pyramid export:                   yes
  (requires libgsf-1 1.14.26 or later)
use libexif to load/save JPEG metadata: yes

But when try to execute make, I got this:

svgload.c:377:10: fatal error: librsvg/librsvg-features.h: No such file or directory
  377 | #include <librsvg/librsvg-features.h>
      |          ^~~~~~~~~~~~~~~~~~~~~~~~~~~~

compilation terminated.
make[3]: *** [Makefile:694: svgload.lo] Error 1
make[3]: Leaving directory '/home/Marco Moreno/dd/vips-8.9.2/libvips/foreign'
make[2]: *** [Makefile:875: all-recursive] Error 1
make[2]: Leaving directory '/home/Marco Moreno/dd/vips-8.9.2/libvips'
make[1]: *** [Makefile:629: all-recursive] Error 1
make[1]: Leaving directory '/home/Marco Moreno/dd/vips-8.9.2'
make: *** [Makefile:536: all] Error 2

I´ve tried to change librsvg/rsvg-features.h name into librsvg/librsvg-features.h, and the file is on this path:"C:\msys64\ucrt64\include\librsvg-2.0\librsvg"

I will appreciate yor Help.

Also I have these warning when configure is executed:

configure: WARNING: Libtool does not cope well with whitespace in `pwd`


来源: stackexchange

问:
R: Optimally Sharing Cookies Within Groups of Friends
I am working with the R programming language.

Suppose there are 100 people - each person is denoted with an ID from 1:100. Each person can be friends with other people. The dataset can be represented in graph/network format and looks something like this:

```<code># Set the seed for reproducibility
set.seed(123)

# Generate a vector of ID's from 1 to 100
ids <- 1:100

# Initialize an empty data frame to store the "from" and "to" values
edges <- data.frame(from=integer(), to=integer(), stringsAsFactors=FALSE)

# Iterate through the ID's
for(id in ids) {
    # Randomly select a minimum of 1 and a maximum of 8 neighbors for the current ID
    neighbors <- sample(ids[ids != id], size=sample(1:8, size=1))

    # Add a new row to the data frame for each "to" value
    for(neighbor in neighbors) {
        edges <- rbind(edges, data.frame(from=id, to=neighbor))
    }
}
</code>```

As we can see, the data can be visualized to reveal the graph/network format:

```<code>library(igraph)
library(visNetwork)

# Convert the data frame to an igraph object
g <- graph_from_data_frame(edges, directed=FALSE)

# Plot the graph
plot(g)

# Optional visualization
#visIgraph(g)
</code>```

Now, suppose each person in this dataset has has a certain number of cookies. This looks something like this:

```<code>set.seed(123)

cookies = data.frame(id = 1:100, number_of_cookies = c(abs(as.integer(rnorm(25, 15, 5))), abs(as.integer(rnorm(75, 5, 5)))))

</code>```

Here is my question:

I want to make sure that no person in this dataset has less than 12 cookies - that is, if someone has less than 12 cookies, they can "pool" together their cookies with their neighbors (e.g. first-degree neighbors, second-degree neighbors, ... n-th degree neighbors ... until this condition is satisfied) and see if they now have more than 12 cookies

However, I also want to make sure that during this pooling process, no pooled group of friends has more than 20 cookies (i.e. this might require having to "un-pool" neighbors that were previously pooled together)

And finally, if someone is in a group with some other people - this person can not be then placed into another group (i.e. no "double dipping")

I wrote a function that takes an ID as an input and then returns the total number of cookies for this ID and all of this ID's neighbors:

```<code>library(data.table)
library(dplyr)

sum_cookies_for_id <- function(id) {

    # Get the connected IDs for the given ID
    connected_ids <- c(id, edges[edges$from == id | edges$to == id, "to"])

    # Sum the number of cookies for all connected IDs
    sum(cookies[cookies$id %in% connected_ids, "number_of_cookies"])
}

# Test the function
sum_cookies_for_id(23)
</code>```

But beyond this, I am not sure how to continue.

Can someone please show me how I might be able to continue writing the code for this problem? Can Dynamic Programming be used in such an example?

Thanks!

Notes:

I think that this problem might have a "stochastic" nature - that is, depending on which ID you begin with and which other ID's you group this specific ID with ... might eventually lead to fewer or more people with less than 12 cookies

I think that writing a "greedy" algorithm that performs random groupings might be the easiest option for such a problem?

In the future, I would be interested in seeing how more "sophisticated algorithms" (e.g. Genetic Algorithm) could be used to make groupings such that the fewest number of people with less than 12 cookies are left behind.

Food for Thought: Is it possible that perhaps some pre-existing graph/network clustering algorithm could be used for this problem while taking into consideration these total/sum constraints (e.g. Louvain Community Detection)?

ContentLicense: CC BY-SA 4.0

Body:
I am working with the R programming language.

Suppose there are 100 people - each person is denoted with an ID from 1:100. Each person can be friends with other people. The dataset can be represented in graph/network format and looks something like this:

# Set the seed for reproducibility
set.seed(123)

# Generate a vector of ID's from 1 to 100
ids <- 1:100

# Initialize an empty data frame to store the "from" and "to" values
edges <- data.frame(from=integer(), to=integer(), stringsAsFactors=FALSE)

# Iterate through the ID's
for(id in ids) {
    # Randomly select a minimum of 1 and a maximum of 8 neighbors for the current ID
    neighbors <- sample(ids[ids != id], size=sample(1:8, size=1))

    # Add a new row to the data frame for each "to" value
    for(neighbor in neighbors) {
        edges <- rbind(edges, data.frame(from=id, to=neighbor))
    }
}

As we can see, the data can be visualized to reveal the graph/network format:

library(igraph)
library(visNetwork)

# Convert the data frame to an igraph object
g <- graph_from_data_frame(edges, directed=FALSE)

# Plot the graph
plot(g)

# Optional visualization
#visIgraph(g)

Now, suppose each person in this dataset has has a certain number of cookies. This looks something like this:

set.seed(123)

cookies = data.frame(id = 1:100, number_of_cookies = c(abs(as.integer(rnorm(25, 15, 5))), abs(as.integer(rnorm(75, 5, 5)))))

Here is my question:

I want to make sure that no person in this dataset has less than 12 cookies - that is, if someone has less than 12 cookies, they can "pool" together their cookies with their neighbors (e.g. first-degree neighbors, second-degree neighbors, ... n-th degree neighbors ... until this condition is satisfied) and see if they now have more than 12 cookies

However, I also want to make sure that during this pooling process, no pooled group of friends has more than 20 cookies (i.e. this might require having to "un-pool" neighbors that were previously pooled together)

And finally, if someone is in a group with some other people - this person can not be then placed into another group (i.e. no "double dipping")

I wrote a function that takes an ID as an input and then returns the total number of cookies for this ID and all of this ID's neighbors:

library(data.table)
library(dplyr)

sum_cookies_for_id <- function(id) {

    # Get the connected IDs for the given ID
    connected_ids <- c(id, edges[edges$from == id | edges$to == id, "to"])

    # Sum the number of cookies for all connected IDs
    sum(cookies[cookies$id %in% connected_ids, "number_of_cookies"])
}

# Test the function
sum_cookies_for_id(23)

But beyond this, I am not sure how to continue.

Can someone please show me how I might be able to continue writing the code for this problem? Can Dynamic Programming be used in such an example?

Thanks!

Notes:

I think that this problem might have a "stochastic" nature - that is, depending on which ID you begin with and which other ID's you group this specific ID with ... might eventually lead to fewer or more people with less than 12 cookies

I think that writing a "greedy" algorithm that performs random groupings might be the easiest option for such a problem?

In the future, I would be interested in seeing how more "sophisticated algorithms" (e.g. Genetic Algorithm) could be used to make groupings such that the fewest number of people with less than 12 cookies are left behind.

Food for Thought: Is it possible that perhaps some pre-existing graph/network clustering algorithm could be used for this problem while taking into consideration these total/sum constraints (e.g. Louvain Community Detection)?


问:
How can I do Duncan's Multiple Range Test (DMRT) with python?
I have been searching for python packages to run  Duncan's Multiple Range Test (DMRT) on a data but couldn't find any. Does anyone know the package I can use?

I have checked the scikit-posthocs documentation but couldn't find a package for DMRT.


问:
OAuth2 Discord 'unsupported_grant_type'
So, I was making a website and I needed Discord's OAuth2

However, this error keeps popping up for me:

```<code>    data: { error: 'unsupported_grant_type' }
</code>```

This here is my code:

function getToken(code) {
    const data = new URLSearchParams({
        client_id: 'ops',
        client_secret: 'ops',
        code: code,
        grant_type: 'authorization_code',
        redirect_uri: 'http://localhost:5500/callback',
        scope: 'identify'
    })
    axios({
        url: 'https://discord.com/api/oauth2/token',
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        body: data.toString()
    }).then(response => {
        return response.data
    })
}
```

Just tried looking it up on the internet about. Since I was used to the old OAuth, I tried the old way. As I couldn't, I went after information in the Discord documentation. And I got this information.
However, without success.

Title: OAuth2 Discord 'unsupported_grant_type'

Body:
So, I was making a website and I needed Discord's OAuth2

However, this error keeps popping up for me:

    data: { error: 'unsupported_grant_type' }

This here is my code:

function getToken(code) {
    const data = new URLSearchParams({
        client_id: 'ops',
        client_secret: 'ops',
        code: code,
        grant_type: 'authorization_code',
        redirect_uri: 'http://localhost:5500/callback',
        scope: 'identify'
    })
    axios({
        url: 'https://discord.com/api/oauth2/token',
        method: 'POST',
        headers: {
            'Content-Type': 'application/x-www-form-urlencoded'
        },
        body: data.toString()
    }).then(response => {
        return response.data
    })
}

Just tried looking it up on the internet about. Since I was used to the old OAuth, I tried the old way. As I couldn't, I went after information in the Discord documentation. And I got this information.
However, without success.


问:
How to trigger iframe click event where iframe is inside another iframe?
I have code with iframe_a, where on click on this iframe, some function will be called.

```<code>
 <script>
         function OnIframeLoad() {
        $('#iframe_a').contents().on("mousedown, mouseup, click", function(event) {
            alert("iframe 'A' is clicked);
        });

    }

    </script>

   <iframe class="frame frame_toggled" id = "iframe_a" onLoad = "OnIframeLoad();"  name="iframe_a">
   </iframe>

</code>```

the code above works fine. However, if i have another iframe, lets say iframe_b inside my iframe_a, this is not working. For example i click on area where iframe_a ONLY, this funcion works. If i click on area where iframe_b is inside iframe_a, this function doesnt work.

```<code><iframe class="frame frame_toggled" id = "iframe_a" onLoad = "OnIframeLoad();"  name="iframe_a">

   <iframe  id = "iframe_b" name="iframe_b">
   </iframe>

   </iframe>
</code>```

I tried to make modify my function with iframe_b on click, also didnt work:

```<code>

 function OnIframeLoad() {

        $('#iframe_a').contents().on("mousedown, mouseup, click", function(event) {
            alert("iframe 'A' is clicked);
        });

 $('#iframe_b').contents().on("mousedown, mouseup, click", function(event) {
           alert("iframe 'B' is clicked);
        });

    }

</code>```

Body:
I have code with iframe_a, where on click on this iframe, some function will be called.

the code above works fine. However, if i have another iframe, lets say iframe_b inside my iframe_a, this is not working. For example i click on area where iframe_a ONLY, this funcion works. If i click on area where iframe_b is inside iframe_a, this function doesnt work.

I tried to make modify my function with iframe_b on click, also didnt work:

 function OnIframeLoad() {

        $('#iframe_a').contents().on("mousedown, mouseup, click", function(event) {
            alert("iframe 'A' is clicked);
        });

 $('#iframe_b').contents().on("mousedown, mouseup, click", function(event) {
           alert("iframe 'B' is clicked);
        });

    }


问:
Invalid argument call excel method defined name
i have an code for call a defined name in excel like nms[1].Name
from code :

```<code>procedure TForm2.Button1Click(Sender: TObject);
var
  Excel,Workbook : variant;
  ExcelFileName,name:string;
  nms,wks :Variant;
begin
  if not OpenDialog1.Execute then Exit;
  Excel := CreateOleObject('Excel.Application');
  ExcelFileName := OpenDialog1.FileName;
  Workbook := Excel.WorkBooks.Open(OpenDialog1.FileName);
  nms := Excel.ActiveWorkbook.Names;
  wks := Workbook.worksheets[1];
  name := nms[1].Name; --> i found error in here member not found
  ...
end;

</code>```

Body:
i have an code for call a defined name in excel like nms[1].Name
from code :

procedure TForm2.Button1Click(Sender: TObject);
var
  Excel,Workbook : variant;
  ExcelFileName,name:string;
  nms,wks :Variant;
begin
  if not OpenDialog1.Execute then Exit;
  Excel := CreateOleObject('Excel.Application');
  ExcelFileName := OpenDialog1.FileName;
  Workbook := Excel.WorkBooks.Open(OpenDialog1.FileName);
  nms := Excel.ActiveWorkbook.Names;
  wks := Workbook.worksheets[1];
  name := nms[1].Name; --> i found error in here member not found
  ...
end;


问:
pydroid3 python program converted to android app with buildozer will not start on android How can I debug?
I created a kivy app in python using pydroid3 It is quite simple, a single button. It works on the android device when run from pydroid3.

I successfully converted the python app to an android app using bulldozer.

Primary Question

I cannot get any debug feedback from the android device as to why the application crashes at start-up.

Can someone help find the location of some sort of android logs similar to syslog or PHP log in Ubuntu.

Here is what I have done to solve this problem myself:

I found documentation on how to properly configure the conversion with buildozer.spec. Soon I realized that I was adding all the python modules involved in the program - but most documentation says that buildozer scans the original files and imports the necessary modules, but still after numerous failures, I added as many as I determined needed to be included.

Each time I start the app on the android 10 device (a radio head), it just crashes upon opening. No error messages etc. I find it unexpected that there is no way to view some kind of Syslog in android. But still, I continued.

I installed android desktop (AD) on my Mac laptop and then connected it to the android head unit and setup the unit to allow USB debugging. I was able to get AD to spew out endless lines of real-time data in the Logcat display.

I was not able to identify anything related to my app in the output provided by logcat: a search using the filter resulted in nothing associated with my app's name. Further, nothing shows up searching for "error" "failure, "failure to load," etc -- that might have given me a clue.

Next Question

Are there any documents related to how to create a program in python, using buildozer, and then install and debug the app in android?

I am sure this is one simple missing module or a similar issue that should be glaring in an error log somewhere.

Thanks for any help.

Jack

.

see the information above


问:
How to allow user to Connect Twitter account (get access token permanently) after he is logged-in to next-js app using next-auth's Google provider?
Scenario :

User is logged in on my app using Google oauth (using next-auth Google provider)

Now I want to give user the option to connect their Twitter account permanently on Button click(i.e. store their Twitter access token somewhere in db).

Once the user connects and authorises my app using Twitter, my app can perform action on Twitter on behalf of the user.

Next time, user just has to login on my app using google auth, and he should be able to access and perform action (use Twitter API) without authorising again from twitter page

Main Question:

Q1. Does next-auth support different providers on different page? If yes, then how to call signIn() for each of them individually?

Q2. Can I implement point 2 to point 4 in next-auth? If yes, then how? If No, then what's the alternative approach?


问:
Can a navigation link to a view fill more than half a VStack?
I would like the NewView() that my button shows then the clicked to display over the whole VStack or Stack instead of just half of the VStack how can I do this? Is this possible or do I need to try a different method of aranging things?</p>
```<code>import SwiftUI

struct ContentView: View {

var body: some View {

    ZStack(){
        //Text("Map")

        VStack{
            HStack{
                Rectangle()
                Circle()
            }

            NavigationStack(){
                NavigationLink{
                    NewView()
                } label: {
                    Text("Button").background(Rectangle().fill(.black))

                }
            }
            .scaledToFit()
        }
    }
}
}

struct NewView: View{

var body: some View{
    HStack{
        Text("This is the new view")
    }

}

}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
    ContentView()
}
}

```
</code>```

Body:
I would like the NewView() that my button shows then the clicked to display over the whole VStack or Stack instead of just half of the VStack how can I do this? Is this possible or do I need to try a different method of aranging things?

import SwiftUI

struct ContentView: View {

var body: some View {

    ZStack(){
        //Text("Map")

        VStack{
            HStack{
                Rectangle()
                Circle()
            }

            NavigationStack(){
                NavigationLink{
                    NewView()
                } label: {
                    Text("Button").background(Rectangle().fill(.black))

                }
            }
            .scaledToFit()
        }
    }
}
}

struct NewView: View{

var body: some View{
    HStack{
        Text("This is the new view")
    }

}

}
struct ContentView_Previews: PreviewProvider {
static var previews: some View {
    ContentView()
}
}

```


问:
URLSession HTTP Error not updating back in view unless the action is initiated again
I have a view with a button that calls an API, the API either returns an HTTP code 200 or 400 based on a particular scenario.

The button works just fine and everything works smoothly if code 200 is returned, however if code 400 is returned, the view is not updated that the user have to click on the button once again to get the updated message.

I added the http code property as a published variable in the VM's class and the http is an observable, but it doesn't get updated in the view on the first API call, I'm not sure what I'm missing.

I made a lot of changes to the shared code just to help in demonstrating the actual problem.

Update: Also I think another part of the problem, is that the url function returns the value before the url session returns the data, I don't know why this is happening, that when I execute it a second time it uses the values from the previous execution.

```<code>HTTPError Class
</code>```
```<code>class HTTPError : Codable, ObservableObject {
var statusCode: Int?
var message: [String]?
var error: String?

init(statusCode: Int? = nil, message: [String]? = [], error: String? = nil){
    self.statusCode = statusCode
    self.message = message ?? []
    self.error = error
}

convenience required init(from decoder: Decoder) throws {
    self.init()
    let container = try decoder.container(keyedBy: CodingKeys.self)
    self.statusCode = try container.decodeIfPresent(Int.self, forKey: .statusCode)
    do {
        self.message = try container.decodeIfPresent([String].self, forKey: .message)
    } catch {
        guard let value = try container.decodeIfPresent(String.self, forKey:
        .message) else {return}
        self.message = []
        self.message?.append(value)
    }
    self.error = try container.decodeIfPresent(String.self, forKey: .error)
}
</code>```
```<code>VM Class
</code>```
```<code>class VM: ObservableObject {
@Published var isLoading = true
@Published var httpError = HTTPError()

 func checkDriverIn(_ record: DriverQRParam) async -> (Bool) {
    ...
    var request = URLRequest(url: url)
    ...
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    do {
        ...
        let task = URLSession.shared.dataTask(with: request) { (data, response,
            error) in
            guard let data = data, error == nil else {
                print(error ?? "Unknown error")
                return
            }
            self.httpError = try! JSONDecoder().decode(HTTPError.self, from: data)
            //gets updated just fine in this class//
        }
        task.resume()
    }catch {
        print("Couldn't encode data \(String(describing: error))")
    }

    if httpError.statusCode != nil && httpError.statusCode == 400 {
        return (false)
    } else {
        return (true)
    }
}
</code>```
```<code>View.Swift
</code>```
```<code> struct xyz: View {

 @State private var VM = VM()

 Button("click") {
 Task {
 await VM.checkDriverIn(driverParam)
 }
}

}
</code>```

Body:
I have a view with a button that calls an API, the API either returns an HTTP code 200 or 400 based on a particular scenario.

The button works just fine and everything works smoothly if code 200 is returned, however if code 400 is returned, the view is not updated that the user have to click on the button once again to get the updated message.

I added the http code property as a published variable in the VM's class and the http is an observable, but it doesn't get updated in the view on the first API call, I'm not sure what I'm missing.

I made a lot of changes to the shared code just to help in demonstrating the actual problem.

Update: Also I think another part of the problem, is that the url function returns the value before the url session returns the data, I don't know why this is happening, that when I execute it a second time it uses the values from the previous execution.

HTTPError Class

class HTTPError : Codable, ObservableObject {
var statusCode: Int?
var message: [String]?
var error: String?

init(statusCode: Int? = nil, message: [String]? = [], error: String? = nil){
    self.statusCode = statusCode
    self.message = message ?? []
    self.error = error
}

convenience required init(from decoder: Decoder) throws {
    self.init()
    let container = try decoder.container(keyedBy: CodingKeys.self)
    self.statusCode = try container.decodeIfPresent(Int.self, forKey: .statusCode)
    do {
        self.message = try container.decodeIfPresent([String].self, forKey: .message)
    } catch {
        guard let value = try container.decodeIfPresent(String.self, forKey:
        .message) else {return}
        self.message = []
        self.message?.append(value)
    }
    self.error = try container.decodeIfPresent(String.self, forKey: .error)
}

VM Class

class VM: ObservableObject {
@Published var isLoading = true
@Published var httpError = HTTPError()

 func checkDriverIn(_ record: DriverQRParam) async -> (Bool) {
    ...
    var request = URLRequest(url: url)
    ...
    request.setValue("application/json", forHTTPHeaderField: "Content-Type")
    do {
        ...
        let task = URLSession.shared.dataTask(with: request) { (data, response,
            error) in
            guard let data = data, error == nil else {
                print(error ?? "Unknown error")
                return
            }
            self.httpError = try! JSONDecoder().decode(HTTPError.self, from: data)
            //gets updated just fine in this class//
        }
        task.resume()
    }catch {
        print("Couldn't encode data \(String(describing: error))")
    }

    if httpError.statusCode != nil && httpError.statusCode == 400 {
        return (false)
    } else {
        return (true)
    }
}

View.Swift

 struct xyz: View {

 @State private var VM = VM()

 Button("click") {
 Task {
 await VM.checkDriverIn(driverParam)
 }
}

}


问:
RuntimeError: one of the variables needed for gradient computation has been modified by an inplace operation
```<code>import torch

# Define the sequence of integers and the targets
sequences = [i for i in range(0, 9)]
targets = [i+1 for i in range(0, 9)]

# Convert the sequences and targets to tensors
sequences = torch.tensor(sequences, dtype=torch.float32)
targets = torch.tensor(targets, dtype=torch.float32)

class LSTM(nn.Module):
  def __init__(self, input_size, output_size):
    super(LSTM, self).__init__()
    self.lstm = nn.LSTM(input_size, 11)
    self.fc = nn.Linear(11, output_size)

  def forward(self, x,hidden):
    x,(h,c) = self.lstm(x,hidden)

    x = self.fc(x)
    return x,(h,c)

# Define the linear layer
model = LSTM(1, 11)

# Define the loss function and optimization algorithm
loss_fn = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01,weight_decay=5e-4)

# Train the linear layer
for epoch in range(100):
  (h,c) = (torch.zeros(1, 11), torch.zeros(1, 11))
  # Forward pass
  for x,y in zip(sequences,targets):
    x=x.unsqueeze(0).unsqueeze(0)
    outputs,(h,c) = model(x,(h,c))

    y=y.unsqueeze(0).type(torch.LongTensor)
    loss = loss_fn(outputs, y)

    # Backward pass
    loss.backward(retain_graph=True)

   # Update the weights
    optimizer.step()

   # Reset the gradient
    optimizer.zero_grad()
</code>```

In this code we are passing the hidden (h,c) with every input. This code was written in google colab.

output:

```<code>RuntimeError: one of the variables needed for gradient computation has been
modified by an inplace operation: [torch.FloatTensor [11, 44]], which is output 0
of AsStridedBackward0, is at version 3; expected version 2 instead.
</code>```

Body:
import torch

# Define the sequence of integers and the targets
sequences = [i for i in range(0, 9)]
targets = [i+1 for i in range(0, 9)]

# Convert the sequences and targets to tensors
sequences = torch.tensor(sequences, dtype=torch.float32)
targets = torch.tensor(targets, dtype=torch.float32)

class LSTM(nn.Module):
  def __init__(self, input_size, output_size):
    super(LSTM, self).__init__()
    self.lstm = nn.LSTM(input_size, 11)
    self.fc = nn.Linear(11, output_size)

  def forward(self, x,hidden):
    x,(h,c) = self.lstm(x,hidden)

    x = self.fc(x)
    return x,(h,c)

# Define the linear layer
model = LSTM(1, 11)

# Define the loss function and optimization algorithm
loss_fn = torch.nn.CrossEntropyLoss()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01,weight_decay=5e-4)

# Train the linear layer
for epoch in range(100):
  (h,c) = (torch.zeros(1, 11), torch.zeros(1, 11))
  # Forward pass
  for x,y in zip(sequences,targets):
    x=x.unsqueeze(0).unsqueeze(0)
    outputs,(h,c) = model(x,(h,c))

    y=y.unsqueeze(0).type(torch.LongTensor)
    loss = loss_fn(outputs, y)

    # Backward pass
    loss.backward(retain_graph=True)

   # Update the weights
    optimizer.step()

   # Reset the gradient
    optimizer.zero_grad()

In this code we are passing the hidden (h,c) with every input. This code was written in google colab.

output:

RuntimeError: one of the variables needed for gradient computation has been
modified by an inplace operation: [torch.FloatTensor [11, 44]], which is output 0
of AsStridedBackward0, is at version 3; expected version 2 instead.


问:
Update dependent dropdown not showing specific data
I am trying to create a UPDATE page which contain dependent dropdown.
When the 1st dropdown is selected, the dependent dropdown does not show data for the specific data selected in the 1st dropdown.

It is showing "Select Option".
Below is what i have try so far.

```<code>1st dropdown
> <label>DEPARTMENT</label>
 <div class="col-sm-10">
 <select name="dept_ID" class="form-control">
 <option value="">Select Department</option>
 <option value="1" <?php if($data['dept_ID'] == '1'){ echo 'selected'; } ?>>Department One</option>
 <option value="6" <?php if($data['dept_ID'] == '6'){ echo 'selected'; } ?>>Department Six</option>
 <option value="2" <?php if($data['dept_ID'] == '2'){ echo 'selected'; } ?>>Department Two</option>
 <option value="3" <?php if($data['dept_ID'] == '3'){ echo 'selected'; } ?>>Department Three</option>

 </select>
 </div>

 >
Dependent dropdown
<label>SUPERVISOR : </label>
 <div class="col-sm-10">
  <select class="form-control" name="op_supervisor" id="selectID">
 <option>Select Option</option>
  <?php $sql = "SELECT * FROM supervisor JOIN DEPARTMENT ON supervisor.dept_ID = DEPARTMENT.dept_ID ";
     $result = mysqli_query($conn,$sql);
     while($row = mysqli_fetch_assoc($result)) {?>
 <option value="<?php echo $row['op_supervisor']  ?>"> <?php echo $row['dept_name'] ?>  -  <?php echo $row['op_supervisor'] ?></option>
 <?php }?>
  </select>
 </div>

</code>```

My expected result is the dependent dropdown will show specific data chosen in the department dropdown and what have been selected before.

Body:
I am trying to create a UPDATE page which contain dependent dropdown.
When the 1st dropdown is selected, the dependent dropdown does not show data for the specific data selected in the 1st dropdown.

It is showing "Select Option".
Below is what i have try so far.

1st dropdown
> DEPARTMENT

 <select name="dept_ID" class="form-control">
 <option value="">Select Department</option>
 <option value="1" <?php if($data['dept_ID'] == '1'){ echo 'selected'; } ?>>Department One</option>
 <option value="6" <?php if($data['dept_ID'] == '6'){ echo 'selected'; } ?>>Department Six</option>
 <option value="2" <?php if($data['dept_ID'] == '2'){ echo 'selected'; } ?>>Department Two</option>
 <option value="3" <?php if($data['dept_ID'] == '3'){ echo 'selected'; } ?>>Department Three</option>

 </select>

 >
Dependent dropdown
SUPERVISOR :

  <select class="form-control" name="op_supervisor" id="selectID">
 <option>Select Option</option>
  <?php $sql = "SELECT * FROM supervisor JOIN DEPARTMENT ON supervisor.dept_ID = DEPARTMENT.dept_ID ";
     $result = mysqli_query($conn,$sql);
     while($row = mysqli_fetch_assoc($result)) {?>
 <option value="<?php echo $row['op_supervisor']  ?>"> <?php echo $row['dept_name'] ?>  -  <?php echo $row['op_supervisor'] ?></option>
 <?php }?>
  </select>

My expected result is the dependent dropdown will show specific data chosen in the department dropdown and what have been selected before.


问:
Is there any MIPI payload restrictions in different SOC platform?
I know that the mipi payload should be a multiple of 8-bits. (That means each Mipi packet length should be a multiple of 8-bits.)
But in Qualcomm socs, I found it is better to make sure the mipi payload is a multiple of 8 bytes/ 16 bytes.
On the other SOCs, (for example MediaTek) is there any further length restriction of the Mipi payload?

I tried on Qualcomm SOCs. If the payload is not a multiple of 16 bytes, there will be padding numbers (zeros) at the end of each packet.


问:
How to automatically deploy main branch changes to staging site using Github Actions
I'm collaborating on a website using Github for source control. The site is hosted on a shared server on Dreamhost. I'd like to set up an easy way for myself and my collaborator to be able to see changes that have been merged into the main branch on the staging site then also run a couple of other shell commands (composer update, for example, after deploying the changes).

I'm new to this. I've found pieces of relevant documentation but have not been able to tie it all together. So far I am running into at least two issues.

Setting up github environments to point to development and staging environments

I looked into Github Workflows but it seemed Github Actions might be easier. I set up Github Environments called staging and development. When setting up the environments, I saw the option to add environment secrets but don't know what exactly to add here. So my environments in Github have names but don't really point to my development and staging environments. I think the first thing I need to figure out is how to link my Github Environments and actual development and staging environments together. I found Deploying with Github Actions but didn't find an answer there.

Invalid workflow file error

Also I found an action in Github Marketplace called branch-deploy. I created a yaml file under .github/workflows to test it. When this runs, I see an error on the workflow in Github of

Invalid workflow file
The workflow is not valid. .github/workflows/deploy.yml (Line: 2, Col: 1): Unexpected value 'id'

Not sure what is going on with this error because the "basic usage" example in the Marketplace page uses the same value for id.


问:
Trouble converting Values in Column into Row Names of Data Frame in R
I am trying to convert the first column of a data frame as Row names.

It works fine but the names of the data frame format changes!

It changes from like 100-21-0 to X100.21.0

First column is Character values: Code, CBT, DQY, DQX etc.
and the names (or the first row?) of the data frame (double) like: Code, 100-21-0, 1002-84-2, 100-47-0 etc.

Code
100-21-0

CBT
0

DQY
1

I am using the code similar to:

newdataframe <- data.frame(dataframe, row.names = 1)
```

It works fine but the names of the data frame change from 100-21-0, 1002-84-2, 100-47-0 to X100.21.0, X1002.84.2, X100.47.0 !!!

I am confused why? Can anyone help on this?

Body:
I am trying to convert the first column of a data frame as Row names.

It works fine but the names of the data frame format changes!

It changes from like 100-21-0 to X100.21.0

First column is Character values: Code, CBT, DQY, DQX etc.
and the names (or the first row?) of the data frame (double) like: Code, 100-21-0, 1002-84-2, 100-47-0 etc.

Code
100-21-0

CBT
0

DQY
1

I am using the code similar to:

newdataframe <- data.frame(dataframe, row.names = 1)

It works fine but the names of the data frame change from 100-21-0, 1002-84-2, 100-47-0 to X100.21.0, X1002.84.2, X100.47.0 !!!

I am confused why? Can anyone help on this?


问:
Mono to run Active Trader Pro on linux?
Is it possible to use mono to run Fidelity Active Trader Pro platform on linux mint.  From the forums it appears ATP is a .net program.  I tried downloading mono and playing around with it, but no luck.

I downloaded mono and tried to run ATP

Title: Mono to run Active Trader Pro on linux?


问:
bitnami/external-dns with Kubernetes on Docker Desktop does not work
What I'm trying to do

I have deployed an aps.net core gRpc service on Docker for Desktop (Kubernetes enabled). To do client-side load balancing, I want to expose the same via a headless service. The deployment and service definition YAML files are as provided by the link viz.  Deployment.yaml , service.yaml, and PV and PVC .yaml. When the deployment is run two replicas will be created. Now I want to expose them via a headless service and do a DNS lookup of the pods' IP addresses and do a client-side load balancing. For this, I installed the bitnami external-dns using the HELM charts. I did not make any modifications to the default chart values. Now when I try to do a nslookup of my service this is not working.

My expectation

Deploy the bitnami external-dns on Docker for Desktop with Kubernetes enabled and configured service to expose as DNS on the load balancer. I was expecting the nslookup to succeed in getting the pod IPs as a result

Can someone help me to get the same working?


问:
How to serve protected pages with Express and node
New to web development so sorry for the (probably) dumb question

I am building a web app which will need user accounts and verification. I would like to serve several pages (one of which is calendar.html) only if the user is logged in. I created an express endpoint /calendar which will successfully load the page using either ejs or sendFile, but only when the get request is recieved via a URL redirect:

```<code>response.render('calendar.ejs')
response.sendFile(path.join(__dirname, '/public/calendar.html'))
</code>```

The problem is, with a URL redirect eg window.location.href = calendar (I may be wrong here) I cannot send additional information like the user's email address or authentication key in the request header. I would also like to have clean URLs and not encode this data into the URL.

I know how to send these data in a get request using fetch(), however if I do that, the page does not render using either of the above methods. How can I send the credentials to the server, serve back calendar.html and display it, all with a clean URL?

Body:
New to web development so sorry for the (probably) dumb question

I am building a web app which will need user accounts and verification. I would like to serve several pages (one of which is calendar.html) only if the user is logged in. I created an express endpoint /calendar which will successfully load the page using either ejs or sendFile, but only when the get request is recieved via a URL redirect:

response.render('calendar.ejs')
response.sendFile(path.join(__dirname, '/public/calendar.html'))

The problem is, with a URL redirect eg window.location.href = calendar (I may be wrong here) I cannot send additional information like the user's email address or authentication key in the request header. I would also like to have clean URLs and not encode this data into the URL.

I know how to send these data in a get request using fetch(), however if I do that, the page does not render using either of the above methods. How can I send the credentials to the server, serve back calendar.html and display it, all with a clean URL?


问:
How can I resolve error when trying to open Maven JAR file via cmd: Could not find or load main class, Caused by: java.lang.NoClassDefFoundError
I have a JavaFX Maven project and I created a JAR file with the Maven package phase. Then, I wanted to open the created JAR file via the command line but instead of opening, a could not find main class error is displayed.

The JDK I use is Oracle OpenJDK v17.0.4. My IDE is Intelli Idea.

This is my project structure:
Project Structure

This is my pom.xml file:

```<code><?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>EmailSystem</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>EmailSystem</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit.version>5.9.0</junit.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>19</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>19</version>
        </dependency>
        <dependency>
            <groupId>org.controlsfx</groupId>
            <artifactId>controlsfx</artifactId>
            <version>11.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.bootstrapfx</groupId>
            <artifactId>bootstrapfx-core</artifactId>
            <version>0.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>5.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>23.0.0</version>
            <scope>compile</scope>
        </dependency>
        <!-- https://mvnrepository.com/artifact/javax.mail/javax.mail-api -->
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>javax.mail-api</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.6.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.8</version>
                <executions>
                    <execution>
                        <!-- Default configuration for running with: mvn clean javafx:run -->
                        <id>default-cli</id>
                        <configuration>
                            <mainClass>com.example.demo/com.example.demo.Application</mainClass>
                            <launcher>app</launcher>
                            <jlinkZipName>app</jlinkZipName>
                            <jlinkImageName>app</jlinkImageName>
                            <noManPages>true</noManPages>
                            <stripDebug>true</stripDebug>
                            <noHeaderFiles>true</noHeaderFiles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>com.example.demo.Application</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
            <!--
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>com.example.demo.Application</mainClass>
                        </manifest>
                    </archive>
                </configuration>
                <executions>
                    <execution>
                        <phase>package</phase>
                        <goals>
                            <goal>single</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            -->
        </plugins>
    </build>
</project>
</code>```

So, I have this JAR file in my target folder of my javafx maven project:
My JAR file in the target folder

This is the command I typed:

```<code>java -jar EmailSystem-1.0-SNAPSHOT.jar
</code>```

And this is the result of the command line:
Error message in cmd

The error:

```<code>> Error: Could not find or load main class com.example.demo.Application
> Caused by: java.lang.NoClassDefFoundError: javafx/application/Application
</code>```

So what is this NoClassDefFoundError about? How can I resolve that issue? And why javafx/application/Application ?

I seems so simple wanting to open a JAR file, so can anybody help me out with that humble task? :'D

I'd be really grateful, thank you :)

Body:
I have a JavaFX Maven project and I created a JAR file with the Maven package phase. Then, I wanted to open the created JAR file via the command line but instead of opening, a could not find main class error is displayed.

The JDK I use is Oracle OpenJDK v17.0.4. My IDE is Intelli Idea.

This is my project structure:
Project Structure

This is my pom.xml file:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>com.example</groupId>
    <artifactId>EmailSystem</artifactId>
    <version>1.0-SNAPSHOT</version>
    <name>EmailSystem</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <junit.version>5.9.0</junit.version>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-controls</artifactId>
            <version>19</version>
        </dependency>
        <dependency>
            <groupId>org.openjfx</groupId>
            <artifactId>javafx-fxml</artifactId>
            <version>19</version>
        </dependency>
        <dependency>
            <groupId>org.controlsfx</groupId>
            <artifactId>controlsfx</artifactId>
            <version>11.1.2</version>
        </dependency>
        <dependency>
            <groupId>org.kordamp.bootstrapfx</groupId>
            <artifactId>bootstrapfx-core</artifactId>
            <version>0.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-api</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.junit.jupiter</groupId>
            <artifactId>junit-jupiter-engine</artifactId>
            <version>${junit.version}</version>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>com.opencsv</groupId>
            <artifactId>opencsv</artifactId>
            <version>5.7.1</version>
        </dependency>
        <dependency>
            <groupId>org.jetbrains</groupId>
            <artifactId>annotations</artifactId>
            <version>23.0.0</version>
            <scope>compile</scope>
        </dependency>

        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>javax.mail-api</artifactId>
            <version>1.6.2</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>
        <dependency>
            <groupId>com.sun.mail</groupId>
            <artifactId>javax.mail</artifactId>
            <version>1.6.2</version>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.10.1</version>
                <configuration>
                    <source>17</source>
                    <target>17</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.openjfx</groupId>
                <artifactId>javafx-maven-plugin</artifactId>
                <version>0.0.8</version>
                <executions>
                    <execution>

                        <id>default-cli</id>
                        <configuration>
                            <mainClass>com.example.demo/com.example.demo.Application</mainClass>
                            <launcher>app</launcher>
                            <jlinkZipName>app</jlinkZipName>
                            <jlinkImageName>app</jlinkImageName>
                            <noManPages>true</noManPages>
                            <stripDebug>true</stripDebug>
                            <noHeaderFiles>true</noHeaderFiles>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>3.3.0</version>
                <configuration>
                    <archive>
                        <manifest>
                            <addClasspath>true</addClasspath>
                            <mainClass>com.example.demo.Application</mainClass>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>

        </plugins>
    </build>
</project>

So, I have this JAR file in my target folder of my javafx maven project:
My JAR file in the target folder

This is the command I typed:

java -jar EmailSystem-1.0-SNAPSHOT.jar

And this is the result of the command line:
Error message in cmd

The error:

> Error: Could not find or load main class com.example.demo.Application
> Caused by: java.lang.NoClassDefFoundError: javafx/application/Application

So what is this NoClassDefFoundError about? How can I resolve that issue? And why javafx/application/Application ?

I seems so simple wanting to open a JAR file, so can anybody help me out with that humble task? :'D

I'd be really grateful, thank you :)


问:
SOLVED: Updating async functions between modules
I have been working on a simple loading animation for backend node.js projects and I ran into a problem after trying to modularize it (so that I can just require() it in other projects)

When run, this loading bar creates a spinner out of braille characters in the console and tries to take three inputs (which used to be global variables before I tried to encapsulate the function, however, when that didn't work I added them to the exported variables in module.exports):

totalSteps: the total # of steps the given function has.

currentStep: the current step the function is on.

statusMessage: the message to display while the spinner loads.

every 100ms, the spinner function updates the frame on the animation which includes the spinner, a percentage of complete tasks, the fraction of done vs not done steps, the message, and three animated trailing dots.

for some reason I can not get this function to work now that I have put it in its own module. It does not wait for the provided function to end before it prints its "Done!" message. however, the variables do seem to be shared between the two scripts, as the final "Done!" message includes the message, and the step variables in it.

Here's my code so far for the loading.js file:

```<code>module.exports = {
    currentStep : 0,
    totalSteps : 0,
    statusMessage : '',

    spinner : async function (func) {
        // declare array of frames for the animation
        const spinnerAnimation = ['[⠋]', '[⠙]', '[⠹]', '[⠸]', '[⠼]', '[⠴]', '[⠦]', '[⠧]', '[⠇]', '[⠏]'];
        const dots = ['   ', '   ', '   ', '.', '.', '.', '.. ', '.. ', '.. ', '...', '...', '...'];
        let spinnerCounter = 0;
        let dotCounter = 0;
        // overwrite the line with the new frame every 100ms
        const intervalId = setInterval(() => {
            spinnerCounter = (spinnerCounter + 1) % spinnerAnimation.length;
            dotCounter = (dotCounter + 1) % dots.length;
            if (this.statusMessage == '') this.statusMessage = 'Loading';
            if (this.currentStep <= this.totalSteps && this.currentStep >= 0 && this.totalSteps >= 1) {
                // if the variables used for calculating the % value are in the correct range
                // show the % and the # of steps completed out of the total
                process.stdout.write(`\r\x1b[32m\x1b[?25l${spinnerAnimation[spinnerCounter]} ${Math.round(this.currentStep / this.totalSteps * 10000)/100}% (Step: ${this.currentStep}/${this.totalSteps} complete)\x1b[0m - ${this.statusMessage}${dots[dotCounter]}                                  `);
            } else {
                // if not, just dont show them. that way if it fails, the animation still shows but you dont get any weird errors (or NaN/undefined placeholders)
                process.stdout.write(`\r\x1b[32m\x1b[?25l${spinnerAnimation[spinnerCounter]}\x1b[0m - ${this.statusMessage}${dots[dotCounter]}                                        `);
            }

        }, 100);

        let error = null;
        try {
            // await some async operation
            await func();
        } catch (err) {
            error = err
        } finally {
            clearInterval(intervalId);
            if (this.statusMessage == '') this.statusMessage = 'Loading';
            if (error) {
                // if an error was caught, mark the bar as "Failed!" and post the message
                if (this.currentStep <= this.totalSteps && this.currentStep >= 0 && this.totalSteps >= 1) {
                    process.stdout.write(`\r\x1b[31m[✓] ${Math.round(this.currentStep / this.totalSteps * 10000)/100}% (Step: ${this.currentStep}/${this.totalSteps})\x1b[0m - ${this.statusMessage}... >> FAILED!\x1b[?25h                                                \n`);
                } else {
                    process.stdout.write(`\r\x1b[32m[✓]\x1b[0m - ${this.statusMessage}... >> FAILED!\x1b[?25h                                                \n`);
                }
                console.error(`\x1b[31m └-${error}\x1b[?25h\x1b[0m`);
                this.currentStep = 0;
                this.totalSteps = 0;
                this.statusMessage = '';
                return error;
            } else {
                // if there was no error, stop the bar and return to the script
                if (this.currentStep <= this.totalSteps && this.currentStep >= 0 && this.totalSteps >= 1) {
                    process.stdout.write(`\r\x1b[32m[✓] ${Math.round(this.currentStep / this.totalSteps * 10000)/100}% (Step: ${this.currentStep}/${this.totalSteps})\x1b[0m - ${this.statusMessage}... >> Done!\x1b[?25h                                                \n`);
                } else {
                    process.stdout.write(`\r\x1b[32m[✓]\x1b[0m - ${this.statusMessage}... >> Done!\x1b[?25h                                                \n`);
                }
                this.currentStep = 0;
                this.totalSteps = 0;
                this.statusMessage = '';
                return;
            }
        }
    }
}
</code>```

And for the index.js:

```<code>const loading = require('./loading.js');

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

async function something() {
  loading.totalSteps = 3;
  loading.statusMessage = "doing something";
  sleep(20000);
  loading.currentStep = 1;
  loading.statusMessage = "working harder";
  sleep(2000);
  loading.currentStep = 2;
  loading.statusMessage = "almost done";
  sleep(2000);
  loading.currentStep = 3;
}

async function main() {
  await loading.spinner(something);
}

main();
</code>```

The output for index.js script is as follows:

```<code>[✓] 100% (Step: 3/3) - almost done... >> Done!
</code>```

This is shown almost as soon as it is run, without waiting for the something() function to finish waiting, however the program does not close until the something() function finishes waiting. I don't understand why the spinner never shows up though. any ideas?

on a side note, Is there any way to make it so that the entire line is overwritten every frame? for example, if the statusMessage text is shorter than the frame before it, the end of the last frame persists into the second one because the rest was not overwritten with new text. My hacky solution to this was to just append a lot of spaces to the end of each line so that so long as the message text is short you wont see it but I realize it wont fix the problem, how does one measure the length of the last line and append the correct number of spaces to the end of the new line or clear the line entirely before writing the next one.

I understand this is probably a lot of stuff to go through so I apologize. Thank you in advance! If there's any other information I should provide please ask!

Body:
I have been working on a simple loading animation for backend node.js projects and I ran into a problem after trying to modularize it (so that I can just require() it in other projects)

When run, this loading bar creates a spinner out of braille characters in the console and tries to take three inputs (which used to be global variables before I tried to encapsulate the function, however, when that didn't work I added them to the exported variables in module.exports):

totalSteps: the total # of steps the given function has.

currentStep: the current step the function is on.

statusMessage: the message to display while the spinner loads.

every 100ms, the spinner function updates the frame on the animation which includes the spinner, a percentage of complete tasks, the fraction of done vs not done steps, the message, and three animated trailing dots.

for some reason I can not get this function to work now that I have put it in its own module. It does not wait for the provided function to end before it prints its "Done!" message. however, the variables do seem to be shared between the two scripts, as the final "Done!" message includes the message, and the step variables in it.

Here's my code so far for the loading.js file:

module.exports = {
    currentStep : 0,
    totalSteps : 0,
    statusMessage : '',

    spinner : async function (func) {
        // declare array of frames for the animation
        const spinnerAnimation = ['[⠋]', '[⠙]', '[⠹]', '[⠸]', '[⠼]', '[⠴]', '[⠦]', '[⠧]', '[⠇]', '[⠏]'];
        const dots = ['   ', '   ', '   ', '.', '.', '.', '.. ', '.. ', '.. ', '...', '...', '...'];
        let spinnerCounter = 0;
        let dotCounter = 0;
        // overwrite the line with the new frame every 100ms
        const intervalId = setInterval(() => {
            spinnerCounter = (spinnerCounter + 1) % spinnerAnimation.length;
            dotCounter = (dotCounter + 1) % dots.length;
            if (this.statusMessage == '') this.statusMessage = 'Loading';
            if (this.currentStep <= this.totalSteps && this.currentStep >= 0 && this.totalSteps >= 1) {
                // if the variables used for calculating the % value are in the correct range
                // show the % and the # of steps completed out of the total
                process.stdout.write(`\r\x1b[32m\x1b[?25l${spinnerAnimation[spinnerCounter]} ${Math.round(this.currentStep / this.totalSteps * 10000)/100}% (Step: ${this.currentStep}/${this.totalSteps} complete)\x1b[0m - ${this.statusMessage}${dots[dotCounter]}                                  `);
            } else {
                // if not, just dont show them. that way if it fails, the animation still shows but you dont get any weird errors (or NaN/undefined placeholders)
                process.stdout.write(`\r\x1b[32m\x1b[?25l${spinnerAnimation[spinnerCounter]}\x1b[0m - ${this.statusMessage}${dots[dotCounter]}                                        `);
            }

        }, 100);

        let error = null;
        try {
            // await some async operation
            await func();
        } catch (err) {
            error = err
        } finally {
            clearInterval(intervalId);
            if (this.statusMessage == '') this.statusMessage = 'Loading';
            if (error) {
                // if an error was caught, mark the bar as "Failed!" and post the message
                if (this.currentStep <= this.totalSteps && this.currentStep >= 0 && this.totalSteps >= 1) {
                    process.stdout.write(`\r\x1b[31m[✓] ${Math.round(this.currentStep / this.totalSteps * 10000)/100}% (Step: ${this.currentStep}/${this.totalSteps})\x1b[0m - ${this.statusMessage}... >> FAILED!\x1b[?25h                                                \n`);
                } else {
                    process.stdout.write(`\r\x1b[32m[✓]\x1b[0m - ${this.statusMessage}... >> FAILED!\x1b[?25h                                                \n`);
                }
                console.error(`\x1b[31m └-${error}\x1b[?25h\x1b[0m`);
                this.currentStep = 0;
                this.totalSteps = 0;
                this.statusMessage = '';
                return error;
            } else {
                // if there was no error, stop the bar and return to the script
                if (this.currentStep <= this.totalSteps && this.currentStep >= 0 && this.totalSteps >= 1) {
                    process.stdout.write(`\r\x1b[32m[✓] ${Math.round(this.currentStep / this.totalSteps * 10000)/100}% (Step: ${this.currentStep}/${this.totalSteps})\x1b[0m - ${this.statusMessage}... >> Done!\x1b[?25h                                                \n`);
                } else {
                    process.stdout.write(`\r\x1b[32m[✓]\x1b[0m - ${this.statusMessage}... >> Done!\x1b[?25h                                                \n`);
                }
                this.currentStep = 0;
                this.totalSteps = 0;
                this.statusMessage = '';
                return;
            }
        }
    }
}

And for the index.js:

const loading = require('./loading.js');

const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

async function something() {
  loading.totalSteps = 3;
  loading.statusMessage = "doing something";
  sleep(20000);
  loading.currentStep = 1;
  loading.statusMessage = "working harder";
  sleep(2000);
  loading.currentStep = 2;
  loading.statusMessage = "almost done";
  sleep(2000);
  loading.currentStep = 3;
}

async function main() {
  await loading.spinner(something);
}

main();

The output for index.js script is as follows:

[✓] 100% (Step: 3/3) - almost done... >> Done!

This is shown almost as soon as it is run, without waiting for the something() function to finish waiting, however the program does not close until the something() function finishes waiting. I don't understand why the spinner never shows up though. any ideas?

on a side note, Is there any way to make it so that the entire line is overwritten every frame? for example, if the statusMessage text is shorter than the frame before it, the end of the last frame persists into the second one because the rest was not overwritten with new text. My hacky solution to this was to just append a lot of spaces to the end of each line so that so long as the message text is short you wont see it but I realize it wont fix the problem, how does one measure the length of the last line and append the correct number of spaces to the end of the new line or clear the line entirely before writing the next one.

I understand this is probably a lot of stuff to go through so I apologize. Thank you in advance! If there's any other information I should provide please ask!


问:
How to upload Image in Android Studio
this is my .java class

```<code>package com.example.gas4u;

    private void showImagePickDialog() {
        //options to display in dialog
        String[] options = {"Camera","Gallery"};
        //dialog
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Pick Image")
                .setItems(options, new DialogInterface.OnClickListener(){
                    @Override
                    public void onClick(DialogInterface dialog, int which){
                        //handle items clicks
                        if (which == 0){
                            //camera clicked
                            if (checkCameraPermission()){
                                //permission granted
                                pickFromCamera();
                            }
                            else{
                                //permission not granted, request
                                requestCameraPermission();
                            }
                        }
                        else{
                            //gallery clicked
                            if (checkStoragePermission()){
                                //permission granted
                                pickFromGallery();
                            }
                            else{
                                //permission not granted
                                requestStoragePermission();
                            }
                        }
                    }
                }).show();
    }

    // You can do the assignment inside onAttach or onCreate, i.e, before the activity is displayed
    ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
            new ActivityResultContracts.StartActivityForResult(),
            new ActivityResultCallback<ActivityResult>() {
                @Override
                public void onActivityResult(ActivityResult result ) {
                    if (result.getResultCode() == Activity.RESULT_OK) {
                        // There are no request codes
                        Intent data = result.getData();

                        if (result.getResultCode() == IMAGE_PICK_GALLERY_CODE){
                            //image picked from gallery

                            //save picked image uri
                            image_uri = data.getData();

                            //set image
                            productIconIv.setImageURI(image_uri);
                        }
                        else if (result.getResultCode() == IMAGE_PICK_CAMERA_CODE){
                            //image picked from camera

                            productIconIv.setImageURI(image_uri);
                        }

                    }
                }
            });

    private void pickFromGallery(){
        //intent to pick image from gallery
        Intent intent = new Intent(Intent.ACTION_PICK);
        intent.setType("image/*");
        someActivityResultLauncher.launch(intent);
        //(intent, IMAGE_PICK_GALLERY_CODE);
    }

    private void pickFromCamera(){
        //intent to pick image from camera

        //using media store to pick high/original quality image
        ContentValues contentValues = new ContentValues();
        contentValues.put(MediaStore.Images.Media.TITLE, "Temp_Image_Title");
        contentValues.put(MediaStore.Images.Media.DESCRIPTION, "Temp_Image_Description");

        image_uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);

        Intent intent= new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, image_uri);
        someActivityResultLauncher.launch(intent);
        //startActivityForResult(intent, IMAGE_PICK_CAMERA_CODE);
    }

    private boolean checkStoragePermission(){
        boolean result = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) ==
                (PackageManager.PERMISSION_GRANTED);
        return result; //returns true or false
    }

    private void requestStoragePermission(){
        ActivityCompat.requestPermissions(this, storagePermission, STORAGE_REQUEST_CODE);
    }

    private boolean checkCameraPermission(){
        boolean result = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) ==
                (PackageManager.PERMISSION_GRANTED);

        boolean result1 = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) ==
                (PackageManager.PERMISSION_GRANTED);

        return result && result1;
    }

    private void requestCameraPermission(){
        ActivityCompat.requestPermissions(this, cameraPermissions, CAMERA_REQUEST_CODE);
    }

    //handle permission results
    public void onRequestPermissionResult(int requestCode, @NonNull String[] permission, @NonNull int[] grantResults){
        switch (requestCode){
            case CAMERA_REQUEST_CODE:{
                if (grantResults.length>0){
                    boolean cameraAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
                    boolean storageAccepted = grantResults[1] == PackageManager.PERMISSION_GRANTED;
                    if (cameraAccepted && storageAccepted){
                        //both permission granted
                        pickFromCamera();
                    }
                    else{
                        //both or one permissions denied
                        Toast.makeText(this, "Camera & Storage permissions are required...", Toast.LENGTH_SHORT).show();
                    }
                }
            }
            case STORAGE_REQUEST_CODE:{
                if (grantResults.length>0){
                    boolean storageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
                    if (storageAccepted){
                        //permission granted
                        pickFromGallery();
                    }else{
                        //permission denied
                        Toast.makeText(this, "Storage permissions is required...", Toast.LENGTH_SHORT).show();
                    }
                }
            }
        }
        super.onRequestPermissionsResult(requestCode, permission, grantResults);

</code>```

I do not know how to upload an image into Android Studio, I have looked into many videos in Youtube but I am not sure if I implement it correctly, since StartActivityForResult has been fabricated I try to follow the video in the Youtube how to implement it the new way, however it is not working. Can anyone help me with this?

Title: How to upload Image in Android Studio

Body:
this is my .java class

package com.example.gas4u;

    private void showImagePickDialog() {
        //options to display in dialog
        String[] options = {"Camera","Gallery"};
        //dialog
        AlertDialog.Builder builder = new AlertDialog.Builder(this);
        builder.setTitle("Pick Image")
                .setItems(options, new DialogInterface.OnClickListener(){
                    @Override
                    public void onClick(DialogInterface dialog, int which){
                        //handle items clicks
                        if (which == 0){
                            //camera clicked
                            if (checkCameraPermission()){
                                //permission granted
                                pickFromCamera();
                            }
                            else{
                                //permission not granted, request
                                requestCameraPermission();
                            }
                        }
                        else{
                            //gallery clicked
                            if (checkStoragePermission()){
                                //permission granted
                                pickFromGallery();
                            }
                            else{
                                //permission not granted
                                requestStoragePermission();
                            }
                        }
                    }
                }).show();
    }

    // You can do the assignment inside onAttach or onCreate, i.e, before the activity is displayed
    ActivityResultLauncher<Intent> someActivityResultLauncher = registerForActivityResult(
            new ActivityResultContracts.StartActivityForResult(),
            new ActivityResultCallback<ActivityResult>() {
                @Override
                public void onActivityResult(ActivityResult result ) {
                    if (result.getResultCode() == Activity.RESULT_OK) {
                        // There are no request codes
                        Intent data = result.getData();

                        if (result.getResultCode() == IMAGE_PICK_GALLERY_CODE){
                            //image picked from gallery

                            //save picked image uri
                            image_uri = data.getData();

                            //set image
                            productIconIv.setImageURI(image_uri);
                        }
                        else if (result.getResultCode() == IMAGE_PICK_CAMERA_CODE){
                            //image picked from camera

                            productIconIv.setImageURI(image_uri);
                        }

                    }
                }
            });

    private void pickFromGallery(){
        //intent to pick image from gallery
        Intent intent = new Intent(Intent.ACTION_PICK);
        intent.setType("image/*");
        someActivityResultLauncher.launch(intent);
        //(intent, IMAGE_PICK_GALLERY_CODE);
    }

    private void pickFromCamera(){
        //intent to pick image from camera

        //using media store to pick high/original quality image
        ContentValues contentValues = new ContentValues();
        contentValues.put(MediaStore.Images.Media.TITLE, "Temp_Image_Title");
        contentValues.put(MediaStore.Images.Media.DESCRIPTION, "Temp_Image_Description");

        image_uri = getContentResolver().insert(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, contentValues);

        Intent intent= new Intent(MediaStore.ACTION_IMAGE_CAPTURE);
        intent.putExtra(MediaStore.EXTRA_OUTPUT, image_uri);
        someActivityResultLauncher.launch(intent);
        //startActivityForResult(intent, IMAGE_PICK_CAMERA_CODE);
    }

    private boolean checkStoragePermission(){
        boolean result = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) ==
                (PackageManager.PERMISSION_GRANTED);
        return result; //returns true or false
    }

    private void requestStoragePermission(){
        ActivityCompat.requestPermissions(this, storagePermission, STORAGE_REQUEST_CODE);
    }

    private boolean checkCameraPermission(){
        boolean result = ContextCompat.checkSelfPermission(this, Manifest.permission.CAMERA) ==
                (PackageManager.PERMISSION_GRANTED);

        boolean result1 = ContextCompat.checkSelfPermission(this, Manifest.permission.WRITE_EXTERNAL_STORAGE) ==
                (PackageManager.PERMISSION_GRANTED);

        return result && result1;
    }

    private void requestCameraPermission(){
        ActivityCompat.requestPermissions(this, cameraPermissions, CAMERA_REQUEST_CODE);
    }

    //handle permission results
    public void onRequestPermissionResult(int requestCode, @NonNull String[] permission, @NonNull int[] grantResults){
        switch (requestCode){
            case CAMERA_REQUEST_CODE:{
                if (grantResults.length>0){
                    boolean cameraAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
                    boolean storageAccepted = grantResults[1] == PackageManager.PERMISSION_GRANTED;
                    if (cameraAccepted && storageAccepted){
                        //both permission granted
                        pickFromCamera();
                    }
                    else{
                        //both or one permissions denied
                        Toast.makeText(this, "Camera & Storage permissions are required...", Toast.LENGTH_SHORT).show();
                    }
                }
            }
            case STORAGE_REQUEST_CODE:{
                if (grantResults.length>0){
                    boolean storageAccepted = grantResults[0] == PackageManager.PERMISSION_GRANTED;
                    if (storageAccepted){
                        //permission granted
                        pickFromGallery();
                    }else{
                        //permission denied
                        Toast.makeText(this, "Storage permissions is required...", Toast.LENGTH_SHORT).show();
                    }
                }
            }
        }
        super.onRequestPermissionsResult(requestCode, permission, grantResults);

I do not know how to upload an image into Android Studio, I have looked into many videos in Youtube but I am not sure if I implement it correctly, since StartActivityForResult has been fabricated I try to follow the video in the Youtube how to implement it the new way, however it is not working. Can anyone help me with this?


问:
Hide chosen column in table Bootstrap
i want to hide 2 of my columns(td and tr) that i choose in my table when the screen minimized with Bootstrap css but it doesn't work for me.</p>
```<code><table class="table table-bordered table-fixed">
    <thead>
        <tr>
            <th>#</th>
            <th>Judul</th>
            <th class="d-none d-sm-block">Batas Tanggal</th>
            <th class="d-none d-sm-block">Ket</th>
            <th>Status</th>
            <th>Action</th>
        </tr>
    </thead>
    <tbody>
            <tr>
                <td>1</td>
                <td>Test</td>
                <td class="d-none d-sm-block">29/12/2022</td>
                <td class="d-none d-sm-block">60.000
                </td>
                <td>
                    <span class="btn btn-danger rounded-circle"><i class="fa fa-times"></i></span>
                </td>
                <td class="text-center">
                    <a href="#" class="btn btn-info mr-1"><i class="fas fa-eye"></i></a>
                    <a href="#" class="btn btn-primary mr-1"><i class="fas fa-edit"></i></a>
                    <form action="#" method="post" class="d-inline">
                        <button class="btn btn-warning delete" onclick="return confirm('Are you sure?')"><i class="fas fa-trash"></i></button>
                    </form>
                </td>
            </tr>
            <tr>
                <td colspan="6" class="text-center">No Task</td>
            </tr>
    </tbody>
</table>
</code>```

Title: Hide chosen column in table Bootstrap

Body:
i want to hide 2 of my columns(td and tr) that i choose in my table when the screen minimized with Bootstrap css but it doesn't work for me.

            #
            Judul
            Batas Tanggal
            Ket
            Status
            Action

                1
                Test
                29/12/2022
                60.000

                    <form action="#" method="post" class="d-inline">
                        <button class="btn btn-warning delete" onclick="return confirm('Are you sure?')"></button>
                    </form>

                No Task


问:
csv file to MOngoDB, with `pymongo.errors.ServerSelectionTimeoutError: Connection refused`
I'm running the script wish to save the csv file to MOngoDB, and face pymongo.errors.ServerSelectionTimeoutError:  Connection refused

(ps. '1xx.xx.xx.1:27017' is correct mongoDB ip)

the python script

```<code>import

import pandas as pd
from pymongo import MongoClient

client = MongoClient('1xx.xx.xx.1:27017')
db = client ['(practice_12_29)img_to_text-001_new']
collection = db ['img_to_text_listOfElems']

data = pd.read_csv('file_listOfElems.csv',encoding = 'UTF-8')
data_json = json.loads(data.to_json(orient='records'))
collection.insert(data_json)
</code>```

this is the output

```<code>jetson@jetson-desktop:~/Desktop/test_12.26$ python3 csv_to_mongoDB.py
Traceback (most recent call last):
  File "csv_to_mongoDB.py", line 13, in <module>
    collection.insert(data_json)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/collection.py", line 3182, in insert
    check_keys, manipulate, write_concern)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/collection.py", line 646, in _insert
    blk.execute(write_concern, session=session)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/bulk.py", line 511, in execute
    return self.execute_command(generator, write_concern, session)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/bulk.py", line 344, in execute_command
    with client._tmp_session(session) as s:
  File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1820, in _tmp_session
    s = self._ensure_session(session)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1807, in _ensure_session
    return self.__start_session(True, causal_consistency=False)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1760, in __start_session
    server_session = self._get_server_session()
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1793, in _get_server_session
    return self._topology.get_server_session()
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/topology.py", line 477, in get_server_session
    None)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/topology.py", line 205, in _select_servers_loop
    self._error_message(selector))
pymongo.errors.ServerSelectionTimeoutError: 1xx.xx.xx.1:27017: [Errno 111] Connection refused
</code>```

(tried 01)

I tried one of the similar issue's solution,but is not work too

Pymongo keeps refusing the connection at 27017

```<code>jetson@jetson-desktop:~/Desktop/test_12.26$ sudo rm /var/lib/mongodb/mongod.lock
rm: cannot remove '/var/lib/mongodb/mongod.lock': No such file or directory
</code>```

(tried 02)
I also find this  https://stackoverflow.com/a/68608172/20861658

but how do I know the <username> , <password> and cluster-details , my last time experience with other computer can just upload excel with below code

```<code># this worked fine, that I don't remember I put user name and password

import pandas as pd
from pymongo import MongoClient

aaa = pd.read_excel("T1_new.xls")

print(aaa.head)

client = MongoClient('1xx.xx.xx.1:27017')
db = client['sample_data_in_DB']
collection = db['sample_collection']

collection.insert_many(aaa.to_dict('records'))
</code>```

if any idea just let me knogw

Body:
I'm running the script wish to save the csv file to MOngoDB, and face pymongo.errors.ServerSelectionTimeoutError:  Connection refused

(ps. '1xx.xx.xx.1:27017' is correct mongoDB ip)

the python script

import

import pandas as pd
from pymongo import MongoClient

client = MongoClient('1xx.xx.xx.1:27017')
db = client ['(practice_12_29)img_to_text-001_new']
collection = db ['img_to_text_listOfElems']

data = pd.read_csv('file_listOfElems.csv',encoding = 'UTF-8')
data_json = json.loads(data.to_json(orient='records'))
collection.insert(data_json)

this is the output

jetson@jetson-desktop:~/Desktop/test_12.26$ python3 csv_to_mongoDB.py
Traceback (most recent call last):
  File "csv_to_mongoDB.py", line 13, in <module>
    collection.insert(data_json)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/collection.py", line 3182, in insert
    check_keys, manipulate, write_concern)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/collection.py", line 646, in _insert
    blk.execute(write_concern, session=session)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/bulk.py", line 511, in execute
    return self.execute_command(generator, write_concern, session)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/bulk.py", line 344, in execute_command
    with client._tmp_session(session) as s:
  File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__
    return next(self.gen)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1820, in _tmp_session
    s = self._ensure_session(session)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1807, in _ensure_session
    return self.__start_session(True, causal_consistency=False)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1760, in __start_session
    server_session = self._get_server_session()
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/mongo_client.py", line 1793, in _get_server_session
    return self._topology.get_server_session()
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/topology.py", line 477, in get_server_session
    None)
  File "/home/jetson/.local/lib/python3.6/site-packages/pymongo/topology.py", line 205, in _select_servers_loop
    self._error_message(selector))
pymongo.errors.ServerSelectionTimeoutError: 1xx.xx.xx.1:27017: [Errno 111] Connection refused

(tried 01)

I tried one of the similar issue's solution,but is not work too

Pymongo keeps refusing the connection at 27017

jetson@jetson-desktop:~/Desktop/test_12.26$ sudo rm /var/lib/mongodb/mongod.lock
rm: cannot remove '/var/lib/mongodb/mongod.lock': No such file or directory

(tried 02)
I also find this  https://stackoverflow.com/a/68608172/20861658

but how do I know the <username> , <password> and cluster-details , my last time experience with other computer can just upload excel with below code

# this worked fine, that I don't remember I put user name and password

import pandas as pd
from pymongo import MongoClient

aaa = pd.read_excel("T1_new.xls")

print(aaa.head)

client = MongoClient('1xx.xx.xx.1:27017')
db = client['sample_data_in_DB']
collection = db['sample_collection']

collection.insert_many(aaa.to_dict('records'))

if any idea just let me knogw


问:
Visual Studio 2022 -Crystal reports Application - Crystal Reports presents a blank report
I recently installed Visual Studio 2022 along with Crystal Reports for Visual Studio (RforVS6413SP33_0-80007712)

I am able to preview data in the dataset but my report shows no data whatsoever.

Getting desperate/

It was supposed to be simple.

Any clue ?

I tried everything that I could think of, really ... Including making a test report with just one table (no joins or anything)

I am using Visual Studio for windows and it's a VB app.

Windows 10 Pro and SQL server Express.


问:
Nebula-br backup data to local error: E_LIST_CLUSTER_NO_AGENT_FAILURE
Ask NebulaGraph Database: Nebula-BR backup data to local reports an error!

The cluster has three machines, all they all have deployed metad, graphd and storaged services respectively.

All three machines have deployed agents, all with actual ip addresses, not

```<code>127.0.0.1
. /agent --agent="10.128.22.109:8888" --meta="10.128.22.109:9559"
</code>```

Body:
Ask NebulaGraph Database: Nebula-BR backup data to local reports an error!

The cluster has three machines, all they all have deployed metad, graphd and storaged services respectively.

All three machines have deployed agents, all with actual ip addresses, not

127.0.0.1
. /agent --agent="10.128.22.109:8888" --meta="10.128.22.109:9559"


问:
how do I make a progressive line chart for the equation y=2x
I would like to plot the values of x and y  suing a progressive line chart for my presentation. Any pointer to the right direction or where I can read I will appreciate. So far the closest I have gotten is chart.js here https://github.com/chartjs/Chart.js/blob/master/docs/samples/animations/progressive-line.md

sample of expected resyult

I would like the graph to grow progressively upto a maximum set value of Y as represented by point k


问:
Error Converting Keras HDF5 Model to Tensorflow Protobuf Model
I am having trouble converting a keras model which is in .h5 to a .pb tensorflow model. Provided below is my code and the error I encountered.


问:
Android studio copy paste R.* always pastes as com.google.android.gms.ads.R.* - how to prevent?
In Android studio, for the longest time, whenever I copy anything with R.* and then paste it, it comes out as com.google.android.gms.ads.R.*.

For example, copying R.layout.l and then pasting it will result in com.google.android.gms.ads.R.layout.l being pasted.

How to prevent it?

I am currently using Android Studio Dolphin | 2021.3.1 Patch 1.