问:
Android Health Connect freezing when making a request after 15 seconds
I am using Health Connect to read records, like steps and exercises. I use Health Connect in a few different places in Kotlin, and the code generally looks something like:

```<code>suspend fun fetchStepData(
    healthConnectClient: HealthConnectClient,
    viewModel: StepViewViewModel,
): StepViewViewModel {
    kotlin.runCatching {
        val todayStart = Instant.now().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay();

        val response: ReadRecordsResponse<StepsRecord>
        try {
            response = healthConnectClient.readRecords(
                ReadRecordsRequest(
                    StepsRecord::class,
                    timeRangeFilter = TimeRangeFilter.after(todayStart)
                )
            )

            var steps: Long = 0;
            if (response.records.isNotEmpty()) {
                for (stepRecord in response.records) {
                    steps += stepRecord.count
                }
            }

            return viewModel

        } catch (e: Exception) {
            Log.e("StepUtil", "Unhandled exception, ", e)
        }
    }
    return viewModel
}
</code>```

I have an update function that is run when focus changes to ensure that the app is in the foreground.

```<code>override fun onWindowFocusChanged(hasFocus: Boolean) {
    super.onWindowFocusChanged(hasFocus)
    if (hasFocus) {
        binding.root.invalidate()

        val fragment =
            supportFragmentManager.findFragmentById(R.id.nav_host_fragment_activity_main)?.childFragmentManager?.primaryNavigationFragment
        if (fragment is MyFragment) {
            displayLoadingIndicator(true)
            runBlocking {
                if (fragment.fetchStepData(this@MainActivity.healthConnectClient, fragment.getViewModel()) != null) {
                    displayLoadingIndicator(false)
            }
        }
    }
</code>```

I have a loading indicator present when I am fetching the data.
I use a drawer, and if I wait about 15 seconds and press the drawer button corresponding with MyFragment, the application hangs on the loading indicator, never successfully dismissing it.

I've tried stepping through the application in debug mode, and as I do, I always hang on

```<code>response = healthConnectClient.readRecords(
                ReadRecordsRequest(
                    StepsRecord::class,
                    timeRangeFilter = TimeRangeFilter.after(todayStart)
                )
            )
</code>```

in fetchStepData. I did at one point have my application making multiple requests for HealthConnectClient.getOrCreate(context), but I have since consolidated them to one instantiation call. I'm thinking I may be reading the data wrong and maybe I need to use getChanges, or maybe I'm being rate limited. Does anyone have any insight? Thanks in advance!

Body:
I am using Health Connect to read records, like steps and exercises. I use Health Connect in a few different places in Kotlin, and the code generally looks something like:

suspend fun fetchStepData(
    healthConnectClient: HealthConnectClient,
    viewModel: StepViewViewModel,
): StepViewViewModel {
    kotlin.runCatching {
        val todayStart = Instant.now().atZone(ZoneId.systemDefault()).toLocalDate().atStartOfDay();

        val response: ReadRecordsResponse<StepsRecord>
        try {
            response = healthConnectClient.readRecords(
                ReadRecordsRequest(
                    StepsRecord::class,
                    timeRangeFilter = TimeRangeFilter.after(todayStart)
                )
            )

            var steps: Long = 0;
            if (response.records.isNotEmpty()) {
                for (stepRecord in response.records) {
                    steps += stepRecord.count
                }
            }

            return viewModel

        } catch (e: Exception) {
            Log.e("StepUtil", "Unhandled exception, ", e)
        }
    }
    return viewModel
}

I have an update function that is run when focus changes to ensure that the app is in the foreground.

override fun onWindowFocusChanged(hasFocus: Boolean) {
    super.onWindowFocusChanged(hasFocus)
    if (hasFocus) {
        binding.root.invalidate()

        val fragment =
            supportFragmentManager.findFragmentById(R.id.nav_host_fragment_activity_main)?.childFragmentManager?.primaryNavigationFragment
        if (fragment is MyFragment) {
            displayLoadingIndicator(true)
            runBlocking {
                if (fragment.fetchStepData(this@MainActivity.healthConnectClient, fragment.getViewModel()) != null) {
                    displayLoadingIndicator(false)
            }
        }
    }

I have a loading indicator present when I am fetching the data.
I use a drawer, and if I wait about 15 seconds and press the drawer button corresponding with MyFragment, the application hangs on the loading indicator, never successfully dismissing it.

I've tried stepping through the application in debug mode, and as I do, I always hang on

response = healthConnectClient.readRecords(
                ReadRecordsRequest(
                    StepsRecord::class,
                    timeRangeFilter = TimeRangeFilter.after(todayStart)
                )
            )

in fetchStepData. I did at one point have my application making multiple requests for HealthConnectClient.getOrCreate(context), but I have since consolidated them to one instantiation call. I'm thinking I may be reading the data wrong and maybe I need to use getChanges, or maybe I'm being rate limited. Does anyone have any insight? Thanks in advance!


来源: stackexchange

问:
Using LinkedList iterator not working in this case
Here I have the code that contains only one method that has 2 parameters. First one is of type linkedlist and second one is of type String. The idea here is that I call this function from the main method several time and each new item that gets added should be sorted from A-Z. But for some reason if I don't add return in the function (

```<code> else if(compareResult>0) {
                iterator.previous();
                iterator.add(element);
                return;
            }
</code>```

)

then I get empty list printed out. Why is that?

```<code>public class Main {

    public static void main(String[] args) {

        LinkedList<String> list=new LinkedList<>();

            addAndSortElements(list,"a");
        addAndSortElements(list,"b");
        addAndSortElements(list,"c");
        addAndSortElements(list,"f");
        addAndSortElements(list,"d");
        System.out.println(list);
    }

    private static void addAndSortElements(LinkedList<String> linkedList, String element) {

        var iterator= linkedList.listIterator();

        while (iterator.hasNext()) {

            String editedElement=element.toLowerCase();
            int compareResult=iterator.next().toLowerCase().compareTo(editedElement);

            if(compareResult==0) {
                System.out.println("Element is already on the list");
                ***return;***
            }
            else if(compareResult>0) {
                iterator.previous();
                iterator.add(element);
                return;
            }
            else {

            }
        }
        iterator.add(element);
    }
}

```
`

I have tried everything I said above.
```

ContentLicense: CC BY-SA 4.0

Body:
Here I have the code that contains only one method that has 2 parameters. First one is of type linkedlist and second one is of type String. The idea here is that I call this function from the main method several time and each new item that gets added should be sorted from A-Z. But for some reason if I don't add return in the function (

 else if(compareResult>0) {
                iterator.previous();
                iterator.add(element);
                return;
            }

)

then I get empty list printed out. Why is that?

public class Main {

    public static void main(String[] args) {

        LinkedList<String> list=new LinkedList<>();

            addAndSortElements(list,"a");
        addAndSortElements(list,"b");
        addAndSortElements(list,"c");
        addAndSortElements(list,"f");
        addAndSortElements(list,"d");
        System.out.println(list);
    }

    private static void addAndSortElements(LinkedList<String> linkedList, String element) {

        var iterator= linkedList.listIterator();

        while (iterator.hasNext()) {

            String editedElement=element.toLowerCase();
            int compareResult=iterator.next().toLowerCase().compareTo(editedElement);

            if(compareResult==0) {
                System.out.println("Element is already on the list");
                ***return;***
            }
            else if(compareResult>0) {
                iterator.previous();
                iterator.add(element);
                return;
            }
            else {

            }
        }
        iterator.add(element);
    }
}

```
`

I have tried everything I said above.


问:
apache-tomcat-9.0.12 is not running
Apache tomcat server is not running. After starting the server, process is running for a few sec and going down. From catalina logs identified that

```<code>From catalina logs identified the below errors
1. Could not load Logmanager "org.apache.logging.log4j.jul.LogManager
 2. com.apple.infosec.safecrypto.exceptions.KeyLoadingException: Error loading key
 3. SEVERE: Failed to initialize component
   [Connector[com.apple.ist.b2b.infosec.SafeCryptoHttp11Nio2Protocol-19150]]
 4. SEVERE: Exception looking up UserDatabase under key [UserDatabase]
java.lang.ClassCastException: class org.apache.naming.ResourceRef cannot be cast to class org.apache.catalina.UserDatabase (org.apache.naming.ResourceRef and org.apache.catalina.UserDatabase are in unnamed module of loader java.net.URLClassLoader @59fa1d9b)
 5. SEVERE: Failed to start [org.apache.catalina.realm.UserDatabaseRealm] realm
org.apache.catalina.LifecycleException: No UserDatabase component found under key [UserDatabase]
 6. INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jan 01, 2023 8:37:46 AM org.apache.catalina.core.ApplicationContext log
INFO: 3 Spring WebApplicationInitializers detected on classpath
</code>```

Please assist to fix the issue.

I tried starting the server, but process is going down. From the logs, identified that old process is running, checked the catalina.pid file there is a process running on it but not able to kill the process.

Expecting to start the server.

Title: apache-tomcat-9.0.12 is not running

Body:
Apache tomcat server is not running. After starting the server, process is running for a few sec and going down. From catalina logs identified that

From catalina logs identified the below errors
1. Could not load Logmanager "org.apache.logging.log4j.jul.LogManager
 2. com.apple.infosec.safecrypto.exceptions.KeyLoadingException: Error loading key
 3. SEVERE: Failed to initialize component
   [Connector[com.apple.ist.b2b.infosec.SafeCryptoHttp11Nio2Protocol-19150]]
 4. SEVERE: Exception looking up UserDatabase under key [UserDatabase]
java.lang.ClassCastException: class org.apache.naming.ResourceRef cannot be cast to class org.apache.catalina.UserDatabase (org.apache.naming.ResourceRef and org.apache.catalina.UserDatabase are in unnamed module of loader java.net.URLClassLoader @59fa1d9b)
 5. SEVERE: Failed to start [org.apache.catalina.realm.UserDatabaseRealm] realm
org.apache.catalina.LifecycleException: No UserDatabase component found under key [UserDatabase]
 6. INFO: At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
Jan 01, 2023 8:37:46 AM org.apache.catalina.core.ApplicationContext log
INFO: 3 Spring WebApplicationInitializers detected on classpath

Please assist to fix the issue.

I tried starting the server, but process is going down. From the logs, identified that old process is running, checked the catalina.pid file there is a process running on it but not able to kill the process.

Expecting to start the server.


问:
What is column and row in CSS Grid and what are the differences?
What are the differences between rows and columns in CSS Grid?

When I look at a Grid Model, it makes sense that the columns flow from left to right across the page and rows flow from top to bottom down the page.

Even the number of rows to columns match up and don't appear completely different from the standard definition.


问:
I am unable to render the image using multer
```<code>    if(req.user.id == req.params.id){
        try{
            let user = await User.findById(req.params.id)
            User.uploadedAvatar(req, res, function(err){
                if(err){
                    console.log("Error")
                }
                user.name = req.body.name;
                user.email = req.body.email;

                if(req.field){
                    user.avatar = User.avatarPath + "/"  + req.file.filename
                    req.flash("success", "Profile picture updated")
                }
                user.save();
                return res.redirect("back")
            })
        }catch{
            req.flash("error", "Error in uploading")
        return res.redirect("back")
        }
    }else{
        req.flash("error", "Unauthorized")
        return res.status(401).send("Unauthorized")
    }
}

---------------------------

</code>```
" alt="" width="100">

<% if(user.id == profileUser.id){ %>
" enctype="multipart/form-data" method="POST">
" required >
" required>

<%}else{%>

Name: <%= profileUser.name %>

Email: <%= profileUser.email %>

<%}%>

```<code>-------------------------

</code>```

app.use("/uplaods" ,express.static(__dirname + "/uploads"))

```<code>

I am trying to upload the images, but there is some error in the function.
</code>```

Body:
    if(req.user.id == req.params.id){
        try{
            let user = await User.findById(req.params.id)
            User.uploadedAvatar(req, res, function(err){
                if(err){
                    console.log("Error")
                }
                user.name = req.body.name;
                user.email = req.body.email;

                if(req.field){
                    user.avatar = User.avatarPath + "/"  + req.file.filename
                    req.flash("success", "Profile picture updated")
                }
                user.save();
                return res.redirect("back")
            })
        }catch{
            req.flash("error", "Error in uploading")
        return res.redirect("back")
        }
    }else{
        req.flash("error", "Unauthorized")
        return res.status(401).send("Unauthorized")
    }
}

---------------------------

" alt="" width="100">

<% if(user.id == profileUser.id){ %>
" enctype="multipart/form-data" method="POST">
" required >
" required>

<%}else{%>

Name: <%= profileUser.name %>

Email: <%= profileUser.email %>

<%}%>

-------------------------

app.use("/uplaods" ,express.static(__dirname + "/uploads"))

I am trying to upload the images, but there is some error in the function.


问:
How to add file to bundle based on another compilation in webpack
I run two compilations together: server-side and client-side. I wish to let webpack automatically import files into server bundle when it is referenced (imported) by somefile in the client bundle and when it pass some check, but not vice-versa. I'm looking for some sort of plugin (probably custom) which would control which files should be imported and adds them to the server bundle. It should also co-operate with hot module replacement. And when file is no longer imported by the client compilation, it should be also removed from server bundle. Or when the automatically imported file is changed, it should notice the change and recompile it.

I tried creating custom plugin but I am not able to get the file content into resulting bundle. I am also using babel, so maybe that could help somehow.


问:
Delete hyperlink and function not working on web page
I tried to add a delete "button"(link to file with function) it should delete a row from the database, but it didn't work. I looked for tutorials and answers on forums but found nothing how solve for my problem.

```<code><td><a href="includes/delete.inc.php?commentId=<?php echo $row["commentId"]; ?>">Delete</a></td>
</code>```

link from code:

The link works correctly, but when I tried to delete it just doesn't want to take 'commentId' variable and go back to test.php page

Table on website:

dbh.inc.php

```<code><?php

$serverName = "localhost";
$dBUsername = "root";
$dBPassword = "";
$dBName = "php-login";

$conn = mysqli_connect($serverName, $dBUsername, $dBPassword, $dBName);

if (!$conn){
    die("connection failed: " . mysqli_connect_error());
}
</code>```

test.php

```<code><?php
include_once 'header.php';
include "includes/dbh.inc.php";
include 'includes/test.inc.php';
?>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
</head>
<body>
    <div class="container">
        <div class="box">
            <h4 class="display-4 text-center">Comments</h4><br>
            <?php if (isset($_GET['success'])) { ?>
            <div class="alert alert-success" role="alert">
              <?php echo $_GET['success']; ?>
            </div>
            <?php } ?>
            <table class="table table-striped">
              <thead>
                <tr>
                  <th scope="col">#</th>

                  <th scope="col">Username</th>
                  <th scope="col">Comment</th>
                  <th scope="col">Action</th>
                </tr>
              </thead>
              <?php
                $i=0;
                while($row = mysqli_fetch_array($result)) {
                ?>

                <td><?php echo $row["commentId"]; ?></td>
                <td><?php echo $row["usersUid"]; ?></td>
                <td><?php echo $row["comment"]; ?></td>
                <td><a href="includes/delete.inc.php?commentId=<?php echo $row["commentId"]; ?>">Delete</a></td>
                </tr>
                <?php
                $i++;
                }
                ?>
            </table>
        </div>
    </div>
</body>
</html>
</code>```

test.inc.php

```<code><?php

include "dbh.inc.php";

$sql = "SELECT * FROM commenttb ORDER BY commentId DESC";
$result = mysqli_query($conn, $sql);
</code>```

delete.inc.php

```<code><?php

include "dbh.inc.php";
if(isset($_GET['commentId'])) {
   $id = $_GET['commentId'];
   $delete = "DELETE FROM `commenttb` WHERE `commentId` ='$id'";
   $result = mysqli_query($conn, $delete);
   if ($result) {
      header("Location: ../test.php?success=successfully deleted");
   } else {
      header("Location: ../test.php?error=unknown error occurred");
   }
}else {
   header("Location: ../test.php?error=smth gone wrong");
}
</code>```

If I press on the link "delete" it should take 'commentId' variable from row e.g. 5 and by SQL query from delete.inc.php file delete row with this id from my database

I tried change $_Get to $_POST and add method="POST" to link on delete.inc.php file, but it didn't work

Body:
I tried to add a delete "button"(link to file with function) it should delete a row from the database, but it didn't work. I looked for tutorials and answers on forums but found nothing how solve for my problem.

<a href="includes/delete.inc.php?commentId=<?php echo $row["commentId"]; ?>">Delete

link from code:

The link works correctly, but when I tried to delete it just doesn't want to take 'commentId' variable and go back to test.php page

Table on website:

dbh.inc.php

<?php

$serverName = "localhost";
$dBUsername = "root";
$dBPassword = "";
$dBName = "php-login";

$conn = mysqli_connect($serverName, $dBUsername, $dBPassword, $dBName);

if (!$conn){
    die("connection failed: " . mysqli_connect_error());
}

test.php

<?php
include_once 'header.php';
include "includes/dbh.inc.php";
include 'includes/test.inc.php';
?>

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">

Comments

            <?php if (isset($_GET['success'])) { ?>

              <?php echo $_GET['success']; ?>

            <?php } ?>

                  #

                  Username
                  Comment
                  Action

              <?php
                $i=0;
                while($row = mysqli_fetch_array($result)) {
                ?>

                <?php echo $row["commentId"]; ?>
                <?php echo $row["usersUid"]; ?>
                <?php echo $row["comment"]; ?>
                <a href="includes/delete.inc.php?commentId=<?php echo $row["commentId"]; ?>">Delete

                <?php
                $i++;
                }
                ?>

test.inc.php

<?php

include "dbh.inc.php";

$sql = "SELECT * FROM commenttb ORDER BY commentId DESC";
$result = mysqli_query($conn, $sql);

delete.inc.php

<?php

include "dbh.inc.php";
if(isset($_GET['commentId'])) {
   $id = $_GET['commentId'];
   $delete = "DELETE FROM `commenttb` WHERE `commentId` ='$id'";
   $result = mysqli_query($conn, $delete);
   if ($result) {
      header("Location: ../test.php?success=successfully deleted");
   } else {
      header("Location: ../test.php?error=unknown error occurred");
   }
}else {
   header("Location: ../test.php?error=smth gone wrong");
}

If I press on the link "delete" it should take 'commentId' variable from row e.g. 5 and by SQL query from delete.inc.php file delete row with this id from my database

I tried change $_Get to $_POST and add method="POST" to link on delete.inc.php file, but it didn't work


问:
How to marshal a struct
I have a c++ library that is used to interface with an rfid scanner. I am trying to use in my c# code but what I am struggling with is getting information about the scanner back in a struct.

This is the C struct and the method that scans for available devices connected to the computer.

typedef struct _FEUSB_SCANSEARCH
{
    int             iMask;
    char    cFamilyName[25];
    char    cDeviceName[25];
    char    cInterface[25];
    char    cDeviceID[16];
} FEUSB_SCANSEARCH;

int  DLL_EXT_FUNC FEUSB_Scan(int iScanOpt, FEUSB_SCANSEARCH* pSearchOpt);
```
<p>In my c# code I've created the struct like this</p>
<pre class="lang-csharp prettyprint-override"><code>[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct FEUSB_SCANSEARCH
{
    public int iMask;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 25)]
    public string cFamilyName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 25)]
    public string cDeviceName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 25)]
    public string cInterface;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
    public string cDeviceID;
}

[DllImport("feusb.dll")]
internal static extern int FEUSB_Scan(int iScanOpt, ref FEUSB_SCANSEARCH pSearchOpt);
</code>```

Here is the call to the method that scans connected devices

FEUSB_SCANSEARCH scansearch = new FEUSB_SCANSEARCH();
int devHndl = FEUSB_Scan(0x0000000F, ref scansearch);
```

I get a device handle back and I expect the information about the device to be in the struct but it contains only empty strings.
Am I doing the marshalling incorrectly for this struct?

Title: How to marshal a struct

Body:
I have a c++ library that is used to interface with an rfid scanner. I am trying to use in my c# code but what I am struggling with is getting information about the scanner back in a struct.

This is the C struct and the method that scans for available devices connected to the computer.

typedef struct _FEUSB_SCANSEARCH
{
    int             iMask;
    char    cFamilyName[25];
    char    cDeviceName[25];
    char    cInterface[25];
    char    cDeviceID[16];
} FEUSB_SCANSEARCH;

int  DLL_EXT_FUNC FEUSB_Scan(int iScanOpt, FEUSB_SCANSEARCH* pSearchOpt);

In my c# code I've created the struct like this

[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct FEUSB_SCANSEARCH
{
    public int iMask;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 25)]
    public string cFamilyName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 25)]
    public string cDeviceName;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 25)]
    public string cInterface;
    [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
    public string cDeviceID;
}

[DllImport("feusb.dll")]
internal static extern int FEUSB_Scan(int iScanOpt, ref FEUSB_SCANSEARCH pSearchOpt);

Here is the call to the method that scans connected devices

FEUSB_SCANSEARCH scansearch = new FEUSB_SCANSEARCH();
int devHndl = FEUSB_Scan(0x0000000F, ref scansearch);

I get a device handle back and I expect the information about the device to be in the struct but it contains only empty strings.
Am I doing the marshalling incorrectly for this struct?


问:
How can I use conditionals to determine which variables are used by a makefile?
I have been using a pretty simple makefile for my code but I'm trying to set it up so that it is more user-friendly, i.e. so that they do not have to edit the makefile themselves. Instead a bash script will read in variables from their input then write those to a makefile 'template' that is copied each time (which then just gets saved as 'Makefile') before running the make commands for them.

I have an issue when it comes to the section for submitting the jobs to a cluster. I have defined the necessary variables for either a Slurm or Torque based system, for personal use I just commented out whichever wasn't needed but this doesn't work with the "user-friendly" approach I'm trying to go for. I thought to use if statements with a variable "cluster_option" that gets set to one of those options, then have the variables inside if statements so that they're only defined for the appropriate option.

```<code>cluster_option = "Cluster_"

if [ "${cluster_option}" == 'slurm' ]; then\

SUBMIT_JOB_LIST        = "all.jobs"
SUBMIT_JOB_NAME        = "job_name_"
SUBMIT_JOB_NODES       = "--nodes=node_no_"
SUBMIT_JOB_PPN         = "--ntasks-per-node=node_tasks_"
SUBMIT_JOB_TIME        = "--time=time_"
SUBMIT_JOB_TASK        = "job_task/job_slurm.sh"
SUBMIT_JOB_CLUSTERTYPE = "SLURM"

elif [ "${cluster_option}" == 'torque' ]; then\
SUBMIT_JOB_LIST        = "all.jobs"
SUBMIT_JOB_TAG         = "job_name_"
SUBMIT_JOB_RESOURCES   = "nodes=node_no_:ppn=node_tasks_,walltime=time_"
SUBMIT_JOB_TASK        = "job_task/job.sh"
SUBMIT_JOB_CLUSTERTYPE = "TORQUE"

fi
</code>```

I'm not really sure if makefiles work this way and I'm not sure if I need to add ';' to the end of each line inside or not? Is there a better way of setting this up? I'm not sure if it's relevant, but this just calls multiple bash scripts to run and then submits one (or more) as a job to the cluster.

Body:
I have been using a pretty simple makefile for my code but I'm trying to set it up so that it is more user-friendly, i.e. so that they do not have to edit the makefile themselves. Instead a bash script will read in variables from their input then write those to a makefile 'template' that is copied each time (which then just gets saved as 'Makefile') before running the make commands for them.

I have an issue when it comes to the section for submitting the jobs to a cluster. I have defined the necessary variables for either a Slurm or Torque based system, for personal use I just commented out whichever wasn't needed but this doesn't work with the "user-friendly" approach I'm trying to go for. I thought to use if statements with a variable "cluster_option" that gets set to one of those options, then have the variables inside if statements so that they're only defined for the appropriate option.

cluster_option = "Cluster_"

if [ "${cluster_option}" == 'slurm' ]; then\

SUBMIT_JOB_LIST        = "all.jobs"
SUBMIT_JOB_NAME        = "job_name_"
SUBMIT_JOB_NODES       = "--nodes=node_no_"
SUBMIT_JOB_PPN         = "--ntasks-per-node=node_tasks_"
SUBMIT_JOB_TIME        = "--time=time_"
SUBMIT_JOB_TASK        = "job_task/job_slurm.sh"
SUBMIT_JOB_CLUSTERTYPE = "SLURM"

elif [ "${cluster_option}" == 'torque' ]; then\
SUBMIT_JOB_LIST        = "all.jobs"
SUBMIT_JOB_TAG         = "job_name_"
SUBMIT_JOB_RESOURCES   = "nodes=node_no_:ppn=node_tasks_,walltime=time_"
SUBMIT_JOB_TASK        = "job_task/job.sh"
SUBMIT_JOB_CLUSTERTYPE = "TORQUE"

fi

I'm not really sure if makefiles work this way and I'm not sure if I need to add ';' to the end of each line inside or not? Is there a better way of setting this up? I'm not sure if it's relevant, but this just calls multiple bash scripts to run and then submits one (or more) as a job to the cluster.


问:
npm ERR! Failed at the node-sass@4.14.1 postinstall script
I'm trying to install the npm package. However when i try to install it i get this error: npm ERR! Failed at the node-sass@4.14.1 postinstall script.

my node-sass verison is: 4.14.1

my node version is 12.14.0

I have removed package-lock.json and node_modules and cleared npm cache, and then installed the packages again but that didn't help.

Any idea what the issue is?


问:
Value of type 'CLBeacon' has no member 'deviceIdentifier'
I trying to make app like Find My to get AirTag informations, but when I try I get error
Value of type 'CLBeacon' has no member 'deviceIdentifier'
How to fix that?
`

```<code>import UIKit
import CoreLocation

class ViewController: UIViewController {

    let locationManager = CLLocationManager()

    override func viewDidLoad() {
        super.viewDidLoad()

        locationManager.requestAlwaysAuthorization()
    }

    @IBAction func tap(_ sender: Any) {
        locationManager.startRangingBeacons(satisfying: CLBeaconIdentityConstraint())
    }

    func locationManager(_ manager: CLLocationManager, didRange beacons: [CLBeacon], satisfying beaconConstraint: CLBeaconIdentityConstraint) {
        for beacon in beacons {
            let deviceIdentifier = beacon.deviceIdentifier
            let serialNumber = deviceIdentifier.uuidString
            print("AirTag serial number: \(serialNumber)")
            print("AirTag proximity: \(beacon.proximity)")
            print("AirTag RSSI: \(beacon.rssi)")
            print("AirTag accuracy: \(beacon.accuracy)")
        }
    }
}

</code>```

`

The program will compile to iPhone and it will show AirTag info

Body:
I trying to make app like Find My to get AirTag informations, but when I try I get error
Value of type 'CLBeacon' has no member 'deviceIdentifier'
How to fix that?
`

import UIKit
import CoreLocation

class ViewController: UIViewController {

    let locationManager = CLLocationManager()

    override func viewDidLoad() {
        super.viewDidLoad()

        locationManager.requestAlwaysAuthorization()
    }

    @IBAction func tap(_ sender: Any) {
        locationManager.startRangingBeacons(satisfying: CLBeaconIdentityConstraint())
    }

    func locationManager(_ manager: CLLocationManager, didRange beacons: [CLBeacon], satisfying beaconConstraint: CLBeaconIdentityConstraint) {
        for beacon in beacons {
            let deviceIdentifier = beacon.deviceIdentifier
            let serialNumber = deviceIdentifier.uuidString
            print("AirTag serial number: \(serialNumber)")
            print("AirTag proximity: \(beacon.proximity)")
            print("AirTag RSSI: \(beacon.rssi)")
            print("AirTag accuracy: \(beacon.accuracy)")
        }
    }
}

`

The program will compile to iPhone and it will show AirTag info


问:
How do I update my code so that way if multiple occurrences of value 20 occurs it will print out those indexes

values = [20, 50 , 20, 23, 252, 264, 664]

valueToSearch = 20

if valueToSearch in values:
    position = values.index(valueToSearch)
    print("Position found at index: ", position)

else:
    print("Value not found")
```


问:
Camera is not Working in Pygame, which is a library in Python
I am working on a camera in Pygame.

I used the following code, inspired by a tutorial:

https://www.youtube.com/watch?v=u7LPRqrzry8

The code:

import pygame,sys
from random import randint

pygame.init()

screensize = 1300,600

class CameraGroup(pygame.sprite.Group):
    def __init__(self):
        super().__init__()
        self.display_surface = pygame.display.get_surface()
        self.offset= pygame.math.Vector2()
        self.camera_borders = {'left': 100 , 'right': 100, 'top': 0, 'bottom' : -100}
        l= self.camera_borders['left']
        t= self.camera_borders['top']
        w = self.display_surface.get_size()[0] - (self.camera_borders['left']+ self.camera_borders['right'])
        h= self.display_surface.get_size()[0] - (self.camera_borders['top']+ self.camera_borders['bottom'])
        self.camera_rect = pygame.Rect(l,t,w,h)
        self.ground = pygame.image.load('C:\\Users\\----\\Documents\\Python\\BuildATown\\graphics\\background.jpg').convert_alpha()
        self.ground_rect = self.ground.get_rect(topleft = (0,-300))

    def mousecontrol(self):
        mouse = pygame.math.Vector2(pygame.mouse.get_pos())
        mouseoffset = pygame.math.Vector2()
        l_border = self.camera_borders['left']
        r_border = self.camera_borders['top']
        t_border = self.display_surface.get_size()[0] - self.camera_borders['right']
        b_border = self.display_surface.get_size()[1] - self.camera_borders['bottom']

        if t_border < mouse.y < b_border:
            if mouse.x < l_border:
                mouseoffset = mouse.x - l_border
                print("Something changed")
                pygame.mouse.set_pos((l_border, mouse.y))
            if mouse.x > r_border:
                mouseoffset = mouse.x - r_border
                print("Something changed")
                pygame.mouse.set_pos((r_border, mouse.y))
        self.offset += mouseoffset

    def customdraw(self,screen):
        self.mousecontrol()

        ground_offset = self.ground_rect.topleft - self.offset
        self.display_surface.blit(self.ground,ground_offset)
        for sprite in sorted(self.sprites(), key = lambda sprite: sprite.rect.centery):
          offset_pos = sprite.rect.topleft - self.offset
          screen.blit(sprite.image,offset_pos)

        pygame.draw.rect(self.display_surface, 'yellow', self.camera_rect, 5)

class Field(pygame.sprite.Sprite):
    def __init__(self,pos,group):
      super().__init__(group)
      self.image = pygame.image.load('C:\\Users\\-----\\Documents\\Python\\BuildATown\\graphics\\field.png').convert_alpha()
      self.rect = self.image.get_rect(topleft = pos)

screen = pygame.display.set_mode(screensize)
ticktock = pygame.time.Clock()

camera = CameraGroup()
for i in range(6):
    x=50+(115*i)
    y=200+(2*i)
    Field((x,y),camera)

is_window_open = True

while is_window_open:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            is_window_open = False

    screen.fill("red")
    camera.update()
    camera.customdraw(screen)
    pygame.display.update()
```

But the Camera won't work! any suggestions? I have tried check if there are any typos and/or indentation errors, but nothing worked. So please do you have any suggestions?

Body:
I am working on a camera in Pygame.

I used the following code, inspired by a tutorial:

https://www.youtube.com/watch?v=u7LPRqrzry8

The code:

import pygame,sys
from random import randint

pygame.init()

screensize = 1300,600

class CameraGroup(pygame.sprite.Group):
    def __init__(self):
        super().__init__()
        self.display_surface = pygame.display.get_surface()
        self.offset= pygame.math.Vector2()
        self.camera_borders = {'left': 100 , 'right': 100, 'top': 0, 'bottom' : -100}
        l= self.camera_borders['left']
        t= self.camera_borders['top']
        w = self.display_surface.get_size()[0] - (self.camera_borders['left']+ self.camera_borders['right'])
        h= self.display_surface.get_size()[0] - (self.camera_borders['top']+ self.camera_borders['bottom'])
        self.camera_rect = pygame.Rect(l,t,w,h)
        self.ground = pygame.image.load('C:\\Users\\----\\Documents\\Python\\BuildATown\\graphics\\background.jpg').convert_alpha()
        self.ground_rect = self.ground.get_rect(topleft = (0,-300))

    def mousecontrol(self):
        mouse = pygame.math.Vector2(pygame.mouse.get_pos())
        mouseoffset = pygame.math.Vector2()
        l_border = self.camera_borders['left']
        r_border = self.camera_borders['top']
        t_border = self.display_surface.get_size()[0] - self.camera_borders['right']
        b_border = self.display_surface.get_size()[1] - self.camera_borders['bottom']

        if t_border < mouse.y < b_border:
            if mouse.x < l_border:
                mouseoffset = mouse.x - l_border
                print("Something changed")
                pygame.mouse.set_pos((l_border, mouse.y))
            if mouse.x > r_border:
                mouseoffset = mouse.x - r_border
                print("Something changed")
                pygame.mouse.set_pos((r_border, mouse.y))
        self.offset += mouseoffset

    def customdraw(self,screen):
        self.mousecontrol()

        ground_offset = self.ground_rect.topleft - self.offset
        self.display_surface.blit(self.ground,ground_offset)
        for sprite in sorted(self.sprites(), key = lambda sprite: sprite.rect.centery):
          offset_pos = sprite.rect.topleft - self.offset
          screen.blit(sprite.image,offset_pos)

        pygame.draw.rect(self.display_surface, 'yellow', self.camera_rect, 5)

class Field(pygame.sprite.Sprite):
    def __init__(self,pos,group):
      super().__init__(group)
      self.image = pygame.image.load('C:\\Users\\-----\\Documents\\Python\\BuildATown\\graphics\\field.png').convert_alpha()
      self.rect = self.image.get_rect(topleft = pos)

screen = pygame.display.set_mode(screensize)
ticktock = pygame.time.Clock()

camera = CameraGroup()
for i in range(6):
    x=50+(115*i)
    y=200+(2*i)
    Field((x,y),camera)

is_window_open = True

while is_window_open:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            is_window_open = False

    screen.fill("red")
    camera.update()
    camera.customdraw(screen)
    pygame.display.update()

But the Camera won't work! any suggestions? I have tried check if there are any typos and/or indentation errors, but nothing worked. So please do you have any suggestions?


问:
how do I prevent system hangs during flutter-android development?
I am doing Flutter development (in nvim) for Android. In my set up I have the app running on the Android emulator.

Often, while I am doing heavy refactoring, I end up with my development system hanging. I suspect this is because flutter run is trying to rebuild my app at a moment in time when the app is mid-refactor and so is unbuildable. This results in runaway java processes consuming all of my system memory, such that I can't even kill them from a terminal.

Is there any way to temporarily ask flutter run to not rebuild my app, or do I need to have to go through the cycle of killing flutter run and rerunning it once my refactor is  complete and the app is buildable again?


问:
No intellisense import suggestions for a module
vscode doesn't give any Code Action import suggestions for a specific python module I install in the python environment (it's a module I created). I can manually add the import - works. I get import suggestions for all other modules I installed . I can also follow up code into the module (after I have the import, go to definition works). It seems it's only missing as a source of import suggestions.

Is the module missing something?


问:
Inserting mapshot image to a rmarkdown pdf document
I'm trying to put an image generetad by mapview::mapshot into a rmarkdown pdf document :

```<code>---
title: "test"
output: pdf_document
date: '2023-01-03'
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(fig.pos = 'h')
library(knitr)
library(mapview)
```

## R Markdown

## Including Plots

You can also embed plots, for example:

```{r fig1x, fig.align ='center',echo=FALSE, message=FALSE, warning=FALSE,out.width = "500px", out.height="400px",fig.cap="My test location"}
library(leaflet)
df = data.frame(long=4,lat=55,Name="myLocation")

imgs = leaflet(option=leafletOptions(zoomControl=FALSE),width = "100%") %>%
      addProviderTiles("OpenTopoMap", group = "MapQuestOpen.Aerial") %>%
      setView(lat = df$lat, lng = df$long,zoom = 10)%>%
      addScaleBar(position = 'topright') %>%
      addCircles(data = df,~long, ~lat, radius = 20,label = ~as.character(Name))%>%
      addPopups(data=df,~long,~lat,  'My location')
mapshot(imgs, file ="map1.png")
include_graphics(paste0("map1.png"))

```
</code>```

The image has lot of white space at the bottom so the caption is almost separated. Any idea how this can be fixed ?

Body:
I'm trying to put an image generetad by mapview::mapshot into a rmarkdown pdf document :

---
title: "test"
output: pdf_document
date: '2023-01-03'
---

```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
knitr::opts_chunk$set(fig.pos = 'h')
library(knitr)
library(mapview)
```

## R Markdown

## Including Plots

You can also embed plots, for example:

```{r fig1x, fig.align ='center',echo=FALSE, message=FALSE, warning=FALSE,out.width = "500px", out.height="400px",fig.cap="My test location"}
library(leaflet)
df = data.frame(long=4,lat=55,Name="myLocation")

imgs = leaflet(option=leafletOptions(zoomControl=FALSE),width = "100%") %>%
      addProviderTiles("OpenTopoMap", group = "MapQuestOpen.Aerial") %>%
      setView(lat = df$lat, lng = df$long,zoom = 10)%>%
      addScaleBar(position = 'topright') %>%
      addCircles(data = df,~long, ~lat, radius = 20,label = ~as.character(Name))%>%
      addPopups(data=df,~long,~lat,  'My location')
mapshot(imgs, file ="map1.png")
include_graphics(paste0("map1.png"))

```

The image has lot of white space at the bottom so the caption is almost separated. Any idea how this can be fixed ?


问:
Possible to create a kotlin js app gradle config without webpack/npm/yarn?
Is it possible to create a gradle config that uses the kotlin multiplatform plugin to create a project with a kotlin js client (and ktor/jvm back end) that does required the webpack/npm/yarn gymnastics which I have little use for? Even if I remove the webpack element from the config the build still seems to fail because of the yarn lock problem. (Can be worked around of course, but it just seems for simple apps all this complexity ideally could be avoided.)

Solutions that don't use gradle at all - like just calling the compiler(s) and other tools directly in a script - would also be welcome!


问:
Single quote ( ' ) vs double quote ( " ) in SQL or SQL in Google Cloud
When I write SQL queries, I sometimes get error messages and am not sure if it's because I am not using a backtick, or single quote, or double-quotation marks. I just keep trying different quotation marks until it works. Sometimes it doesn't require any.

When are you supposed to use quotes and how do you know which ones to use?


问:
Update npm package in pakcage.json and its dependencies in yarn.lock
In one of our application we are using loader-utils with version 1.3.5, Below is the exact entry from package.json

```<code>"loader-utils": "^1.3.5",
</code>```

I updated this package to version 1.4.1 by manually editing the package.json file and then running the yarn command. It updated the package in package.json file but in yarn.lock file there are still some instances where 1.3.5 version is being called, mainly on different dependencies. For example this is new code it added on yarn.lock file after I updated the package using yarn command

```<code>> loader-utils@^1.4.1:   version "1.4.2"   resolved
> "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd151fec01a3"
> integrity
> sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==
> dependencies:
>     big.js "^5.2.2"
>     emojis-list "^3.0.0"
>     json5 "^1.0.1"
</code>```

But upon searching on same yarn.lock file there are some instances where older version is being called, for example (in the last line)

```<code>webpack@~4.28:
  version "4.28.4"
  resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.28.4.tgz#1ddae6c89887d7efb752adf0c3cd2b9b07eacd0"
  integrity sha512-NxjD61WsK/a3JIdwWjtIpimmvE6UrRi3yG54/74Hk9rwNj5FPkA4DJCf1z4ByDWLk2ZhTZE+P3C/eh6UD5lDcw==
  dependencies:
    "@webassemblyjs/ast" "1.7.11"
    "@webassemblyjs/helper-module-context" "1.7.11"
    "@webassemblyjs/wasm-edit" "1.7.11"
    "@webassemblyjs/wasm-parser" "1.7.11"
    loader-utils "^1.1.0"
</code>```

Now my question is how can I update this one as well? Will I have to do it manually and just replace it with the latest version? Thanks

Body:
In one of our application we are using loader-utils with version 1.3.5, Below is the exact entry from package.json

"loader-utils": "^1.3.5",

I updated this package to version 1.4.1 by manually editing the package.json file and then running the yarn command. It updated the package in package.json file but in yarn.lock file there are still some instances where 1.3.5 version is being called, mainly on different dependencies. For example this is new code it added on yarn.lock file after I updated the package using yarn command

> loader-utils@^1.4.1:   version "1.4.2"   resolved
> "https://registry.yarnpkg.com/loader-utils/-/loader-utils-1.4.2.tgz#29a957f3a63973883eb684f10ffd151fec01a3"
> integrity
> sha512-I5d00Pd/jwMD2QCduo657+YM/6L3KZu++pmX9VFncxvHcru9jx1lBaFft+r4Mt2jK0Yhp41XlRAihzPxHNCg==
> dependencies:
>     big.js "^5.2.2"
>     emojis-list "^3.0.0"
>     json5 "^1.0.1"

But upon searching on same yarn.lock file there are some instances where older version is being called, for example (in the last line)

webpack@~4.28:
  version "4.28.4"
  resolved "https://registry.yarnpkg.com/webpack/-/webpack-4.28.4.tgz#1ddae6c89887d7efb752adf0c3cd2b9b07eacd0"
  integrity sha512-NxjD61WsK/a3JIdwWjtIpimmvE6UrRi3yG54/74Hk9rwNj5FPkA4DJCf1z4ByDWLk2ZhTZE+P3C/eh6UD5lDcw==
  dependencies:
    "@webassemblyjs/ast" "1.7.11"
    "@webassemblyjs/helper-module-context" "1.7.11"
    "@webassemblyjs/wasm-edit" "1.7.11"
    "@webassemblyjs/wasm-parser" "1.7.11"
    loader-utils "^1.1.0"

Now my question is how can I update this one as well? Will I have to do it manually and just replace it with the latest version? Thanks


问:
Uri.EscapeUriString for ASP.net binding value
I have a task to show live updating encoded URL. So I am taking user entered URL on the top input field and update it's encoded URL on bottom on time with key strokes in input field. But it didn't work.

Input:
@Html.TextBoxFor(m => m.url, new { @class = "form-ctrl", ng_model = "vm.url" })

Show

@Uri.EscapeUriString("{{vm.url}}")

Actual Output
Nothing

Expected Output
Encoded URL with each and every key strokes

Note:
But when I used
{{vm.url}}
, it will give live update. but it is not a encoded string. So can you please help me to get encoded value?

Actual Output
Nothing

Expected Output
Encoded URL with each and every key strokes

Note:
But when I used
{{vm.url}}
, it will give live update. but it is not a encoded string. So can you please help me to get encoded value?


问:
How to make docstrings from cythonized module available to Pylance?
I am working on a fully cython compiled python package, using setuptools and some reStructured Text docstrings to generate the pdf documentation using sphinx-autodoc with good success.

The docstrings are not displayed when loading the package in Jupyter Notebooks (using Pylance language server in VSCode). I did not test but suspect that the issue exists in other IDEs or frontends either. Switching to e.g. Jedi as a language server in VSCode did not help.

Using the help(...) command on the routines/classes yields the expected docstring, so the issue does not seem to be with the cython compilation.

There are quite a few issues about formatting issues popping up when searching for Docstrings and Pylance, the issue never seems to be that they simply can not be retrieved.

Since sphinx (autodoc) does not throw any errors and generates a full-package encompassing documentation set fine, this seems a lot like a problem with the language servers to me.

However, I suspect that there may be any compiler directive or setuptools option that I am unaware of that could help - but I do not know about these.

I do have

```<code>compiler_directives={'embedsignature': True}
</code>```

in the setup.py and since the docstrings do show up when using help(..), I do not think this is an issue.

I have also added

```<code>import Cython.Compiler.Options
Cython.Compiler.Options.docstrings = True

</code>```

even though that is indicated as being the default, and it did not change the behavior at all.

Scavenging through the options of Pylance in VSCode was unfruitful, too - I did not expect much there anyways, since obviously the display of the docstrings does work for plenty (all?) other packages that I looked at. Everything is on defaults.

Body:
I am working on a fully cython compiled python package, using setuptools and some reStructured Text docstrings to generate the pdf documentation using sphinx-autodoc with good success.

The docstrings are not displayed when loading the package in Jupyter Notebooks (using Pylance language server in VSCode). I did not test but suspect that the issue exists in other IDEs or frontends either. Switching to e.g. Jedi as a language server in VSCode did not help.

Using the help(...) command on the routines/classes yields the expected docstring, so the issue does not seem to be with the cython compilation.

There are quite a few issues about formatting issues popping up when searching for Docstrings and Pylance, the issue never seems to be that they simply can not be retrieved.

Since sphinx (autodoc) does not throw any errors and generates a full-package encompassing documentation set fine, this seems a lot like a problem with the language servers to me.

However, I suspect that there may be any compiler directive or setuptools option that I am unaware of that could help - but I do not know about these.

I do have

compiler_directives={'embedsignature': True}

in the setup.py and since the docstrings do show up when using help(..), I do not think this is an issue.

I have also added

import Cython.Compiler.Options
Cython.Compiler.Options.docstrings = True

even though that is indicated as being the default, and it did not change the behavior at all.

Scavenging through the options of Pylance in VSCode was unfruitful, too - I did not expect much there anyways, since obviously the display of the docstrings does work for plenty (all?) other packages that I looked at. Everything is on defaults.


问:
Why doesn't my modal transition after appearing?
i am using inertiajs(vue 3 laravel) the modal component.

the modal appear but the transition does not work.

```<code>    <teleport to="body">
        <transition leave-active-class="duration-200">
            <div
                v-show="show"
                class="fixed inset-0 overflow-y-auto z-50"
                scroll-region
            >
                <div
                    v-show="show"
                    class="fixed inset-0 transform transition-all"
                    @click="close"
                >
                    <div class="absolute inset-0 bg-black opacity-75" />
                </div>

                <transition
                    enter-active-class="ease-out duration-300"
                    enter-from-class="opacity-0"
                    enter-to-class="opacity-100"
                    leave-active-class="ease-in duration-200"
                    leave-from-class="opacity-100"
                    leave-to-class="opacity-0"
                >
                    <div
                        v-show="show"
                        style="max-width: 800px"
                        class="text-white bg-dark-btn px-6 py-4 rounded-t-2xl overflow-hidden shadow-xl transform transition-all fixed bottom-0 w-full mx-auto right-0 left-0"
                    >
                        <slot v-if="show" />
                    </div>
                </transition>
            </div>
        </transition>
    </teleport>

</code>```

And finally i would like to have a transition like which leaves the bottom like.

I changed the place of the transition tag everywhere.

Body:
i am using inertiajs(vue 3 laravel) the modal component.

the modal appear but the transition does not work.

    <teleport to="body">
        <transition leave-active-class="duration-200">

                <transition
                    enter-active-class="ease-out duration-300"
                    enter-from-class="opacity-0"
                    enter-to-class="opacity-100"
                    leave-active-class="ease-in duration-200"
                    leave-from-class="opacity-100"
                    leave-to-class="opacity-0"
                >

                        <slot v-if="show" />

                </transition>

        </transition>
    </teleport>

And finally i would like to have a transition like which leaves the bottom like.

I changed the place of the transition tag everywhere.


问:
Laravel Snappy PDF: Rotated text in
 cells NOT VISIBLE after first page
I'm having an issue when trying to generate PDF with rotated texts in table headers using Snappy PDF/Image Wrapper for Laravel.

The text is visible on first page but disappear from second page onwards. Have a look at the screenshots below.

First Page:

Second Page

I'm using the CSS below to rotate the texts in the cell:

```<code>thead { display: table-header-group; }
tr { page-break-inside: avoid; }
th.rotate,
td.rotate{
    padding: 5px;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    width: 1.5em;
}
th.rotate div,
td.rotate div {
    -moz-transform: rotate(-90.0deg);  /* FF3.5+ */
    -o-transform: rotate(-90.0deg);  /* Opera 10.5 */
    -webkit-transform: rotate(-90.0deg);  /* Saf3.1+, Chrome */
    filter:  progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083);  /* IE6,IE7 */
    -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083)"; /* IE8 */
    margin-left: -10em;
    margin-right: -10em;
}

<table>
  <thead>
    <th class="rotate" rowspan="3">
        <div> Yearly Register No </div>
    </th>
  </thead>
</table>
</code>```

Title: Laravel Snappy PDF: Rotated text in <thead> cells NOT VISIBLE after first page

Body:
I'm having an issue when trying to generate PDF with rotated texts in table headers using Snappy PDF/Image Wrapper for Laravel.

The text is visible on first page but disappear from second page onwards. Have a look at the screenshots below.

First Page:

Second Page

I'm using the CSS below to rotate the texts in the cell:

thead { display: table-header-group; }
tr { page-break-inside: avoid; }
th.rotate,
td.rotate{
    padding: 5px;
    text-align: center;
    white-space: nowrap;
    vertical-align: middle;
    width: 1.5em;
}
th.rotate div,
td.rotate div {
    -moz-transform: rotate(-90.0deg);  /* FF3.5+ */
    -o-transform: rotate(-90.0deg);  /* Opera 10.5 */
    -webkit-transform: rotate(-90.0deg);  /* Saf3.1+, Chrome */
    filter:  progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083);  /* IE6,IE7 */
    -ms-filter: "progid:DXImageTransform.Microsoft.BasicImage(rotation=0.083)"; /* IE8 */
    margin-left: -10em;
    margin-right: -10em;
}

 Yearly Register No


问:
How to combine Cascades with Pipelines
My backend API has public and authenticated methods.

I'm trying to encapsulate everything using Cascade and Pipelines, but the cascade seems to quit immediately after the first pipeline if the route isn't found.

In short, I want all requests to be logged using the logRequests middleware and the private requests to go through a custom middleware which validate credentials.

Here's the code:

```<code>final publicPipeline = Pipeline()
      .addMiddleware(logRequests())
      .addHandler(Router()
        ..head('/health', _health)
        ..post('/login', _login));

    final privatePipeline = Pipeline()
      .addMiddleware(_validateCredentials)
      .addHandler(Router()
        ..head('/get_data', _getData)
        ..post('/logout', _logout));

    final cascadeHandler = Cascade()
      .add(publicPipeline)
      .add(privatePipeline)
      .handler;

    await io.serve(cascadeHandler, '0.0.0.0', port);
</code>```

Removing the Pipelines and using only Routers works as expected, but then I lose the flexibility of using Middlewares.

Title: How to combine Cascades with Pipelines

Body:
My backend API has public and authenticated methods.

I'm trying to encapsulate everything using Cascade and Pipelines, but the cascade seems to quit immediately after the first pipeline if the route isn't found.

In short, I want all requests to be logged using the logRequests middleware and the private requests to go through a custom middleware which validate credentials.

Here's the code:

final publicPipeline = Pipeline()
      .addMiddleware(logRequests())
      .addHandler(Router()
        ..head('/health', _health)
        ..post('/login', _login));

    final privatePipeline = Pipeline()
      .addMiddleware(_validateCredentials)
      .addHandler(Router()
        ..head('/get_data', _getData)
        ..post('/logout', _logout));

    final cascadeHandler = Cascade()
      .add(publicPipeline)
      .add(privatePipeline)
      .handler;

    await io.serve(cascadeHandler, '0.0.0.0', port);

Removing the Pipelines and using only Routers works as expected, but then I lose the flexibility of using Middlewares.


问:
Accessing a property value 'nested' inside other property/variable
I am trying to access a property value deep inside another received variable. I don't know the terminolgy so apologies but cant describe it properly which the image below.

I am using a Library called CmdMessenger, to send/recevie data over serial port.
I receive data back from the serial port using the libray, no problem. But There is some data I need to extract which is 'nested' inside the variable as shown in the Locals screenshot below.
I receive the 'arugument' variable at the top, and can read its immediate 'Arguments' property fine, but I wish to extract the data from the other highlighted 'arguments' property at the bottom of the list, which currently has 'PBC' as its value. See screenshot:

```<code>public static void SendFirmwareVersion(ReceivedCommand arguments)
{
    //read value ok from root of that property.
    string[] x = arguments.Arguments;

    //Then need to read value from other property deep inside that?
}
</code>```

This is not soemthing i've had to do before, so quite frankly wouldnt know where to start, but it seems possible as there data is there?
PS: Feel free to edit the title that describes what I am trying to acheive.

Thanks.

Body:
I am trying to access a property value deep inside another received variable. I don't know the terminolgy so apologies but cant describe it properly which the image below.

I am using a Library called CmdMessenger, to send/recevie data over serial port.
I receive data back from the serial port using the libray, no problem. But There is some data I need to extract which is 'nested' inside the variable as shown in the Locals screenshot below.
I receive the 'arugument' variable at the top, and can read its immediate 'Arguments' property fine, but I wish to extract the data from the other highlighted 'arguments' property at the bottom of the list, which currently has 'PBC' as its value. See screenshot:

public static void SendFirmwareVersion(ReceivedCommand arguments)
{
    //read value ok from root of that property.
    string[] x = arguments.Arguments;

    //Then need to read value from other property deep inside that?
}

This is not soemthing i've had to do before, so quite frankly wouldnt know where to start, but it seems possible as there data is there?
PS: Feel free to edit the title that describes what I am trying to acheive.

Thanks.


问:
React Native Svg error: "Invariant Violation: requireNativeComponent: "RNSVGPath" was not found in the UIManager."
I have created a library of components and commands for react-native using "react-native-builder-bob" https://github.com/callstack/react-native-builder-bob.
Trying to create an "Icon" component I imported "react-native-svg" and "react-native-svg-transformer" and this is "dependencies" and "devDependencies" in my "package.json" .

```<code>    "dependencies": {
        "react-native-svg": "^13.6.0"
    },
    "devDependencies": {
        "@commitlint/config-conventional": "^17.0.2",
        "@react-native-community/eslint-config": "^3.0.2",
        "@release-it/conventional-changelog": "^5.0.0",
        "@tsconfig/react-native": "^2.0.3",
        "@types/jest": "^28.1.2",
        "@types/react": "~17.0.21",
        "@types/react-native": "0.70.0",
        "@typescript-eslint/eslint-plugin": "^5.48.0",
        "@typescript-eslint/parser": "^5.48.0",
        "commitlint": "^17.0.2",
        "del-cli": "^5.0.0",
        "eslint": "^8.4.1",
        "eslint-config-prettier": "^8.6.0",
        "eslint-plugin-import": "^2.26.0",
        "eslint-plugin-prettier": "^4.2.1",
        "eslint-plugin-react": "^7.31.11",
        "jest": "^28.1.1",
        "pod-install": "^0.1.0",
        "prettier": "^2.0.5",
        "react": "18.1.0",
        "react-native": "0.70.6",
        "react-native-builder-bob": "^0.20.0",
        "react-native-svg-transformer": "^1.0.0",
        "release-it": "^15.0.0",
        "typescript": "^4.5.2"
    },
</code>```

In my "Icon.tsx" component I added this code

```<code>import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';

import Svg, { Circle, SvgUri } from 'react-native-svg';

interface IconInterface {
  // varName: type;
  // varName: type;
  // functionName: () => void;
}

export default function Icon(props: IconInterface) {
  return (
    <View style={styles.container}>
      <SvgUri width="100%" height="100%" uri="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/debian.svg" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

</code>```

but when I compile the android app it gives me this error "Invariant Violation: requireNativeComponent: "RNSVGPath" was not found in the UIManager."

How can I fix?

Body:
I have created a library of components and commands for react-native using "react-native-builder-bob" https://github.com/callstack/react-native-builder-bob.
Trying to create an "Icon" component I imported "react-native-svg" and "react-native-svg-transformer" and this is "dependencies" and "devDependencies" in my "package.json" .

    "dependencies": {
        "react-native-svg": "^13.6.0"
    },
    "devDependencies": {
        "@commitlint/config-conventional": "^17.0.2",
        "@react-native-community/eslint-config": "^3.0.2",
        "@release-it/conventional-changelog": "^5.0.0",
        "@tsconfig/react-native": "^2.0.3",
        "@types/jest": "^28.1.2",
        "@types/react": "~17.0.21",
        "@types/react-native": "0.70.0",
        "@typescript-eslint/eslint-plugin": "^5.48.0",
        "@typescript-eslint/parser": "^5.48.0",
        "commitlint": "^17.0.2",
        "del-cli": "^5.0.0",
        "eslint": "^8.4.1",
        "eslint-config-prettier": "^8.6.0",
        "eslint-plugin-import": "^2.26.0",
        "eslint-plugin-prettier": "^4.2.1",
        "eslint-plugin-react": "^7.31.11",
        "jest": "^28.1.1",
        "pod-install": "^0.1.0",
        "prettier": "^2.0.5",
        "react": "18.1.0",
        "react-native": "0.70.6",
        "react-native-builder-bob": "^0.20.0",
        "react-native-svg-transformer": "^1.0.0",
        "release-it": "^15.0.0",
        "typescript": "^4.5.2"
    },

In my "Icon.tsx" component I added this code

import React, { useState, useEffect } from 'react';
import { StyleSheet, Text, View } from 'react-native';

import Svg, { Circle, SvgUri } from 'react-native-svg';

interface IconInterface {
  // varName: type;
  // varName: type;
  // functionName: () => void;
}

export default function Icon(props: IconInterface) {
  return (
    <View style={styles.container}>
      <SvgUri width="100%" height="100%" uri="https://dev.w3.org/SVG/tools/svgweb/samples/svg-files/debian.svg" />
    </View>
  );
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
  },
});

but when I compile the android app it gives me this error "Invariant Violation: requireNativeComponent: "RNSVGPath" was not found in the UIManager."

How can I fix?


问:
Django Server stuck after updating from python 3.9 to python 3.10 (using Django 4.1.5)
After upgrading python 3.9 to 3.10 the Django Server isn't working locally anymore (I'm using the Django Server Plugin for Pycharm). In my gitlab pipeline it seems to work allright.

Below you can see further details (click link to see screenshot):

With a Python 3.9 venv some errors occur, but the Django Server works nevertheless

With a Python 3.10 venv the same errors occur, but the Django Server doesn't start (after waiting 30 min)

(Working on linux and with pycharm)

I have the same requirements installed on both venv s except for the python version. I'd expect an error message, but it seems the execution is just stuck.


问:
How do I write Applescript to use hotkeys to control VLC Media Player in the background while typing on Word or Pages?
I would like to control VLC Media Player using hotkeys while typing in Word or Pages (without having to have VLC Media Player be the active window).

Can I use AppleScript to do this? I am editing video transcripts and, at the moment, have to toggle between programs to control the active window. I would love to be able to press hotkeys to:

rewind

jump back 5 seconds

play/pause

fast forward

jump forward 5 seconds

Thank you so much for any help you can offer. I've never used AppleScript and appreciate any help.

I used a free hotkey assigner called Spark and inserted Applescript for these functions, following a tutorial on how to do this for transcription, but it didn't work. (I did it for Quicktime but would actually prefer to use VLC Media Player. Either would be great, though).

https://www.engadget.com/2008-06-26-simplify-media-transcription-with-hotkeys-and-applescript.html

Jump back:

tell document 1 of application "QuickTime Player" to set current time to (current time - 2500)

Play/pause:

tell document 1 of application "QuickTime Player"
if playing is true then
pause
else
start
end if
end tell

Jump forward:

tell document 1 of application "QuickTime Player" to set current time to (current time + 2500)


问:
QueryDSL query failing when querying with entity with null ID
I have a DB with 40 columns, and a REST API in Spring Boot that can be used to query the DB with any combination of parameters, which necessitates the use of dynamic query creation, which is why I have chosen to use QueryDSL.

Before making the query, I convert the query params to the Entity object using an ObjectMapper, then do a count using something like:

```<code>queryFactory.select(qTableRequest.rowId.count()).from(qTableRequest).where(qTableRequest.eq(TableRequest))
</code>```

which works fine when the @Id column of the Entity is not null, but fails with

```<code>TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing
</code>```

when it's null.

Side note: I can't use Spring's Query by Example because there are cases where I need non-singular matching.

I tried to extract the non-null fields of the entity and construct the query using .and(), .or() etc. as a BooleanExpression and it works, but it requires a lot of boilerplate code and it would be nice to have a simple solution to query for the Entity directly.

My question is: is it possible to use an Entity in the query without an Id?

Entity:

```<code>@Entity
@Table(name = "table", schema = "schema")
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class TableRequest {

    @Id
    @Column(name = "row_id")
    public String rowId;

    @Column(name = "order_id")
    public String orderId;
    ... // 38 more rows
}
</code>```

Query:

```<code>private BooleanExpression constructQuery(SearchRequest searchRequest) {
    TableRequest searchRequestToEntity = objectMapper.convertValue(SearchRequest, TableRequest.class);

    BooleanExpression queryParameters = qTableRequest.eq(searchRequestToEntity);
    ...
}

public SearchResponse search(SearchRequest searchRequest) {
    BooleanExpression queryParameters = constructQuery(searchRequest);

    long rowCount = queryFactory.select(qTableRequest.rowId.count())
            .from(qTableRequest).where(queryParameters).fetchFirst();
    ...
}
</code>```

Body:
I have a DB with 40 columns, and a REST API in Spring Boot that can be used to query the DB with any combination of parameters, which necessitates the use of dynamic query creation, which is why I have chosen to use QueryDSL.

Before making the query, I convert the query params to the Entity object using an ObjectMapper, then do a count using something like:

queryFactory.select(qTableRequest.rowId.count()).from(qTableRequest).where(qTableRequest.eq(TableRequest))

which works fine when the @Id column of the Entity is not null, but fails with

TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing

when it's null.

Side note: I can't use Spring's Query by Example because there are cases where I need non-singular matching.

I tried to extract the non-null fields of the entity and construct the query using .and(), .or() etc. as a BooleanExpression and it works, but it requires a lot of boilerplate code and it would be nice to have a simple solution to query for the Entity directly.

My question is: is it possible to use an Entity in the query without an Id?

Entity:

@Entity
@Table(name = "table", schema = "schema")
@AllArgsConstructor
@NoArgsConstructor
@Getter
public class TableRequest {

    @Id
    @Column(name = "row_id")
    public String rowId;

    @Column(name = "order_id")
    public String orderId;
    ... // 38 more rows
}

Query:

private BooleanExpression constructQuery(SearchRequest searchRequest) {
    TableRequest searchRequestToEntity = objectMapper.convertValue(SearchRequest, TableRequest.class);

    BooleanExpression queryParameters = qTableRequest.eq(searchRequestToEntity);
    ...
}

public SearchResponse search(SearchRequest searchRequest) {
    BooleanExpression queryParameters = constructQuery(searchRequest);

    long rowCount = queryFactory.select(qTableRequest.rowId.count())
            .from(qTableRequest).where(queryParameters).fetchFirst();
    ...
}


问:
How can I deploy my app from github to Railway
I am at a loss as to why I am getting these errors.
Here is a screenshot of what I am talking about.

Can you please make sense of what these errors are telling me?

I tried to change the code on app.js file so it would make refer to local hosts.

My URL is https://web-production-68cf.up.railway.app/
but all I see is the static part of this web app.


问:
How does Spatial Dropout work in the inference compared to Dropout?
I would like to deploy a trained Keras model on a microcontroller. However, there is no support for Spatial Dropout layer. I thought about removing the layer from the graph similarly to the Dropout layer. However I didn't find any indication on how the Spatial Dropout works in inference.

I have tried to look into the documentations or similar problem but couldn't find any indication about it.


问:
Unable to connect to GitHub for 2 years, irregardless of network - any ideas?
Toku here.

I've been without GitHub for 2 years now, and I'm getting sick of it.

In terms of web connection, I get a basic "This site can't be reached" - ERR_CONNECTION_REFUSED.
Attempting to use the desktop app results in more information

Image of 443 port error - more connection refusals.

Image of curl command result

I'm running Win10 Home build 19044, connected to a private home network with no restrictions. What would be causing this?
Tried reconfiguring DNS, and it simply didn't change anything.
At the suggestion of FiddlingAway, I resynced my system time, to no effect.
For reference, I am living in the US, so there should be no issues connecting due to a countrywide ban. The web interface does not load, even on a VPN.


问:
Yet another .gitignore not ignoring .angular/cache entry
So I have looked at all the answers relating to the .angular/cache folder not being ignored when pushing a project to a remote repo. I have created a new project with Angular 14.

Here is my .gitignore file in root of the project (just part of the ignore file, this is the last entry in the file).

```<code># Angular
/.angular
</code>```

here is a screen shot of my project showing that the .angular folder is greyed out, which I am assuming means the folder is being ignored by git.
project structure

I have run the following commands:

```<code>git rm -r --cached .
git add .
git commit -m ".gitignore is now working"
</code>```

I have tried different entries in the .gitignore file

```<code>.angular/cache
/.angular/cache
.angular
.angular/
.angular/*
</code>```

I have tried removing from cache the .angular folder specifically

```<code>Massimos-MBP:paradolia-admin skypirate$ git rm -r --cached /.angular
fatal: /.angular: '/.angular' is outside repository at '/Users/skypirate/Projects/paradolia-admin'
</code>```

or this

```<code>Massimos-MBP:paradolia-admin skypirate$ git rm -r --cached .angular
fatal: pathspec '.angular' did not match any files
</code>```

I double checked and the folder .angular is definitely in the project folder root.

I have even tried removing the .angular folder completely from the project.

No matter what I try I get the following error when I run:

```<code>git push -u origin main
</code>```
```<code>Massimos-MBP:paradolia-admin skypirate$ git push -u origin main
Enumerating objects: 1691, done.
Counting objects: 100% (1691/1691), done.
Delta compression using up to 2 threads
Compressing objects: 100% (1667/1667), done.
Writing objects: 100% (1691/1691), 66.38 MiB | 2.30 MiB/s, done.
Total 1691 (delta 274), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (274/274), done.
remote: warning: File .angular/cache/15.0.2/angular-webpack/54656bafcc60881502aad32eb4a45285fa9bc9e6/1.pack is 98.46 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: Trace: 2fb04feb3b57a0caa4fd663ff04799796e001b6a7a7b055a5f6ed0120d4bbf0f
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File .angular/cache/15.0.2/angular-webpack/e3ac25d47496cbc2f9e3adbe205cac2ccb01848d/0.pack is 285.25 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File .angular/cache/15.0.2/angular-webpack/54656bafcc60881502aad32eb4a45285fa9bc9e6/0.pack is 112.29 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To https://github.com/Bluemax86/paradolia-admin.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/Bluemax86/paradolia-admin.git'
</code>```

Is there a path specified somewhere that tells git which .angular folder to look at?

Any help would be appreciated.

Body:
So I have looked at all the answers relating to the .angular/cache folder not being ignored when pushing a project to a remote repo. I have created a new project with Angular 14.

Here is my .gitignore file in root of the project (just part of the ignore file, this is the last entry in the file).

# Angular
/.angular

here is a screen shot of my project showing that the .angular folder is greyed out, which I am assuming means the folder is being ignored by git.
project structure

I have run the following commands:

git rm -r --cached .
git add .
git commit -m ".gitignore is now working"

I have tried different entries in the .gitignore file

.angular/cache
/.angular/cache
.angular
.angular/
.angular/*

I have tried removing from cache the .angular folder specifically

Massimos-MBP:paradolia-admin skypirate$ git rm -r --cached /.angular
fatal: /.angular: '/.angular' is outside repository at '/Users/skypirate/Projects/paradolia-admin'

or this

Massimos-MBP:paradolia-admin skypirate$ git rm -r --cached .angular
fatal: pathspec '.angular' did not match any files

I double checked and the folder .angular is definitely in the project folder root.

I have even tried removing the .angular folder completely from the project.

No matter what I try I get the following error when I run:

git push -u origin main

Massimos-MBP:paradolia-admin skypirate$ git push -u origin main
Enumerating objects: 1691, done.
Counting objects: 100% (1691/1691), done.
Delta compression using up to 2 threads
Compressing objects: 100% (1667/1667), done.
Writing objects: 100% (1691/1691), 66.38 MiB | 2.30 MiB/s, done.
Total 1691 (delta 274), reused 0 (delta 0), pack-reused 0
remote: Resolving deltas: 100% (274/274), done.
remote: warning: File .angular/cache/15.0.2/angular-webpack/54656bafcc60881502aad32eb4a45285fa9bc9e6/1.pack is 98.46 MB; this is larger than GitHub's recommended maximum file size of 50.00 MB
remote: error: Trace: 2fb04feb3b57a0caa4fd663ff04799796e001b6a7a7b055a5f6ed0120d4bbf0f
remote: error: See http://git.io/iEPt8g for more information.
remote: error: File .angular/cache/15.0.2/angular-webpack/e3ac25d47496cbc2f9e3adbe205cac2ccb01848d/0.pack is 285.25 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: File .angular/cache/15.0.2/angular-webpack/54656bafcc60881502aad32eb4a45285fa9bc9e6/0.pack is 112.29 MB; this exceeds GitHub's file size limit of 100.00 MB
remote: error: GH001: Large files detected. You may want to try Git Large File Storage - https://git-lfs.github.com.
To https://github.com/Bluemax86/paradolia-admin.git
 ! [remote rejected] main -> main (pre-receive hook declined)
error: failed to push some refs to 'https://github.com/Bluemax86/paradolia-admin.git'

Is there a path specified somewhere that tells git which .angular folder to look at?

Any help would be appreciated.


问:
When closing the Electron App the window closes but the background process remains idle
In the menu I've put

```<code>{
    label: '&Window',
    role: 'window',
    submenu: [
      {
        role: 'minimize'
      },

      {
        role: 'close'
        click () {
          window.api.electronIpcSend("mainWindow-close","close")
        }
      }

    ]
  }
</code>```

And in main :

```<code> ipcMain.on("mainWindow-close", (event, args) => {
  if (args === "close") {
    mainWindow.close()
    app.quit()
    //app.exit(0)
  }
}
</code>```

and

```<code> app.on('window-all-closed', () => {
   if (process.platform !== 'darwin') {
     app.quit();
   }
 });
</code>```

When I click the close button in the menu the window closes but the entire app remains "open" as you can see from this screenshot with the cursor in idle state:

Other Info:

```<code>Electron: 19
O.S. : Ubuntu 22.04
</code>```

How to close the entire Electron App?

Body:
In the menu I've put

{
    label: '&Window',
    role: 'window',
    submenu: [
      {
        role: 'minimize'
      },

      {
        role: 'close'
        click () {
          window.api.electronIpcSend("mainWindow-close","close")
        }
      }

    ]
  }

And in main :

 ipcMain.on("mainWindow-close", (event, args) => {
  if (args === "close") {
    mainWindow.close()
    app.quit()
    //app.exit(0)
  }
}

and

 app.on('window-all-closed', () => {
   if (process.platform !== 'darwin') {
     app.quit();
   }
 });

When I click the close button in the menu the window closes but the entire app remains "open" as you can see from this screenshot with the cursor in idle state:

Other Info:

Electron: 19
O.S. : Ubuntu 22.04

How to close the entire Electron App?


问:
Display a video from my external mysql database on a webpage with php
I want to display an mp4 file I have on an external mysql database(freesqldatabase.com) to my local website(localhost).

```<code>$host2="----.freesqldatabase.com";
$user2="-----";
$password2="-----";
$dbname2="-----";

//create connection
$con2 = mysqli_connect($host2, $user2, $password2, $dbname2);

//check connection
if (!$con2){
    die("connection failed: " .mysqli_connect_error());
}
</code>```
```<code><?php
    include("config.php");

?>
<!doctype html>
<html>
    <head>
        <style>
            video{
                float: left;
            }
        </style>
    </head>
    <body>
        <div>
        <?php
        $fetchVideos = mysqli_query($con2, "SELECT * FROM videos ORDER BY id DESC");
        while($row = mysqli_fetch_assoc($fetchVideos)){
            $location = $row['location'];
            echo "<div >";
            echo "<video src='' controls width='320px' height='200px' >";
            echo "</div>";
            print_r($row);
        }

        ?>
        </div>
    </body>
</html>

</code>```

Normally you'd put a path to the video file in src=' ', but it's stored in an external database so I don't know what to put there.
I think you have to use a mysql connection url somewhere but I don't know how to do that exactly and couldn't find any tutorials about it.

Body:
I want to display an mp4 file I have on an external mysql database(freesqldatabase.com) to my local website(localhost).

$host2="----.freesqldatabase.com";
$user2="-----";
$password2="-----";
$dbname2="-----";

//create connection
$con2 = mysqli_connect($host2, $user2, $password2, $dbname2);

//check connection
if (!$con2){
    die("connection failed: " .mysqli_connect_error());
}

<?php
    include("config.php");

?>
<!doctype html>

        <?php
        $fetchVideos = mysqli_query($con2, "SELECT * FROM videos ORDER BY id DESC");
        while($row = mysqli_fetch_assoc($fetchVideos)){
            $location = $row['location'];
            echo "
";
            echo "<video src='' controls width='320px' height='200px' >";
            echo "
";
            print_r($row);
        }

        ?>

Normally you'd put a path to the video file in src=' ', but it's stored in an external database so I don't know what to put there.
I think you have to use a mysql connection url somewhere but I don't know how to do that exactly and couldn't find any tutorials about it.


问:
UrlHighlight not working online server but working localhost
I want to use the https://github.com/vstelmakh/url-highlight plugin on Github. I'm doing everything right, I created the files on localhost. But while the same codes work correctly on localhost, it gives the following error on the online server.

PHP Fatal error:  Uncaught Error: Class
'VStelmakh\UrlHighlight\UrlHighlight' not found in
/home1/****/public_html/includes/connect.php:4

```<code><?php
require __DIR__ . '/vendor/autoload.php';

use VStelmakh\UrlHighlight\UrlHighlight;

$urlHighlight = new UrlHighlight();
echo $urlHighlight->highlightUrls('Hello, http://example.com.');
</code>```

The same codes work fine on localhost. But if it does not work on the online server, what could be the reason for this.

Body:
I want to use the https://github.com/vstelmakh/url-highlight plugin on Github. I'm doing everything right, I created the files on localhost. But while the same codes work correctly on localhost, it gives the following error on the online server.

PHP Fatal error:  Uncaught Error: Class
'VStelmakh\UrlHighlight\UrlHighlight' not found in
/home1/****/public_html/includes/connect.php:4

<?php
require __DIR__ . '/vendor/autoload.php';

use VStelmakh\UrlHighlight\UrlHighlight;

$urlHighlight = new UrlHighlight();
echo $urlHighlight->highlightUrls('Hello, http://example.com.');

The same codes work fine on localhost. But if it does not work on the online server, what could be the reason for this.


问:
store objectId from different collections in the same field
I have a database table called "userRoleAssign" and it has a field called "user" which can store ObjectIDs from two different database tables. The "user" field can contain an ID from the "user" table or from the "dashboardUser" table.

I am experiencing an issue where when I send a request to populate the "user" field, I get a "null" value returned for the "dashboardUser" entries (because the ID cannot be found in the table).

userRoleAssignSchema

```<code>export class UserRoleAssign {

  @Prop({
    type: MongooseSchema.Types.ObjectId, // Types.mixed ...
    ref: 'User',
  })
  user: User | DashboardUser;

 // ...
}
</code>```

I have tried a little bit around with the schema definition from mongoose but unfortunately, I received the same result.
For example, I tried to define the type as mixed.

Is there a solution or an alternative way to solve this situation?

Body:
I have a database table called "userRoleAssign" and it has a field called "user" which can store ObjectIDs from two different database tables. The "user" field can contain an ID from the "user" table or from the "dashboardUser" table.

I am experiencing an issue where when I send a request to populate the "user" field, I get a "null" value returned for the "dashboardUser" entries (because the ID cannot be found in the table).

userRoleAssignSchema

export class UserRoleAssign {

  @Prop({
    type: MongooseSchema.Types.ObjectId, // Types.mixed ...
    ref: 'User',
  })
  user: User | DashboardUser;

 // ...
}

I have tried a little bit around with the schema definition from mongoose but unfortunately, I received the same result.
For example, I tried to define the type as mixed.

Is there a solution or an alternative way to solve this situation?


问:
How to send and receive push notifications in android app?
I m making a carpool app and I want to send notification to rider that I am leaving and I am coming to pick you so how can I do it ?

I tried doing it but it was happening manually and It want to fetch data from the google firebase database.


问:
<security-constraint> programmatically Tomcat
I ask help for a question similar to "UPDATE" section in this question How to programmatically setup a <security-constraint> in Servlets 3.x? ...

I want to set programmatically, in a java class, some web.xml tags. In particular i have to define this snippt in a separate java class:

```<code>    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Application detail</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>*</role-name>
        </auth-constraint>
    </security-constraint>
    <security-role>
        <role-name>*</role-name>
    </security-role>
    <login-config>
        <auth-method>OIDC</auth-method>
    </login-config>
</code>```

Thank you!

Body:
I ask help for a question similar to "UPDATE" section in this question How to programmatically setup a <security-constraint> in Servlets 3.x? ...

I want to set programmatically, in a java class, some web.xml tags. In particular i have to define this snippt in a separate java class:

    <security-constraint>
        <web-resource-collection>
            <web-resource-name>Application detail</web-resource-name>
            <url-pattern>/*</url-pattern>
        </web-resource-collection>
        <auth-constraint>
            <role-name>*</role-name>
        </auth-constraint>
    </security-constraint>
    <security-role>
        <role-name>*</role-name>
    </security-role>
    <login-config>
        <auth-method>OIDC</auth-method>
    </login-config>

Thank you!


问:
Is there a way using html, css, vanilla js to change the background color of mobile navigation bar background color?

Hi, i need some help. as you can see a green circle mark on the picture, that was a bottom navigation bar on android device.. am trying to change that background color. Is there any way only using html, css and vanilla js? im using chrome.