问:
Plotting a bubble chart (circle packing) with d3.js using a .csv file updated every n-seconds
I am trying to plot a bubble chart in d3.js using a file that is updated every few seconds and I'm having trouble with a few parts of the code.

The whole data-to-visualization pipeline is described below:

Data is gathered, processed and saved using a dataproc cluster on GCP

Data is retrieved from GCP and saved to a local machine as a .csv file every 10 seconds

The .csv file is used to create a d3.js visualization - the visualization is updated using d3's setInterval().

A sample of the data is shown below:

Tag
Count
Date

0
python
1
12/06 18:15:40

1
pandas
1
12/06 18:15:40

2
java
1
12/06 18:15:40

3
html
1
12/06 18:15:40

4
c++
1
12/06 18:15:40

The issues I'm facing are numbered below:

Ideally, I would like to be able to get the data and store just that new data (i.e. overwrite the old file) when saving it on the GCP end. I'm not able to do that because for some reason it seems that something is causing the script to clear out variables in memory (potentially?). I say this because when I run the code below, the csv variable is reset each time. To remedy this, I'm appending all data gathered so that I have all the data.

Currently, it seems that every time that I run the update function, the circles are replotted (which is what is happening - I understand) but I would like to figure out how to get the circles that I already have and transition them so that they show their new values and only draw new circles for the new data. I'm unable to achieve that with my current code even though I've tried many different ways to transition the data.

I was expecting to be able to update the csv variable in memory so that I would not have to reprocess the data every time. I would also prefer not to append the file and pull the complete file each iteration. Furthermore, the every iteration the visuals are a complete wipe of the canvas and replotting rather than a smooth transition.

Here is my code and a couple of pictures of the visualization at different times. Any suggestion would be extremely helpful.

```<code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Real-Time Tags Analysis</title>
    <script src="https://d3js.org/d3.v4.js"></script>
    <script src="//d3js.org/d3-scale-chromatic.v0.3.min.js"></script>
</head>
<body>
    <h1>Real-Time Tags Analysis</h1>
    <div id="dataviz"></div>
    <script>

        //defining constant for the visualization
        const width = window.innerWidth, height = window.innerHeight, sizeDivisor = 0.1, nodePadding = 2.75, topTags = 12;

        //defining svg canvas
        let svg = d3.select("body")
            .append("svg")
            .attr("width", width)
            .attr("height", height);

        //color palette
        let color = d3.scaleSequential().domain([1,200]).interpolator(d3.interpolateViridis);

        //simulation instantiation
        let simulation = d3.forceSimulation()
            .force("forceX", d3.forceX().strength(.1).x(width * .5))
            .force("forceY", d3.forceY().strength(.1).y(height * .5))
            .force("center", d3.forceCenter().x(width * .5).y(height * .5))
            .force("charge", d3.forceManyBody().strength(-15));

        //global variables
        let csv = {}, tag, temp = {}, oldData;

        //initial bubble chart plotting
        d3.csv("bigquery_data.csv", function(error, data) {
        if (error) throw error;

        oldData = data;

        //adding new data from file to the csv variable
        data.forEach(function(d) {

            tag = d['tag'];

            if(csv[tag] == undefined) {
                    csv[tag] = +d['count']
                } else {
                    csv[tag]+= +d['count'];
            }
        });

        //converting the csv variable to d3 entries list for visualization and defining more values
        let csvlist = d3.entries(csv);

        csvlist.forEach(function(d) {
            d.value = +d.value;
            d.size = +d.value / sizeDivisor;
            d.size < 3 ? d.radius = 3 : d.radius = d.size;
            return d;
        });

        // sort the nodes so that the bigger ones are at the back
        csvlist = csvlist.sort(function(a,b) { return b.size - a.size; });

        //update the simulation based on the data
        simulation
            .nodes(csvlist)
            .force("collide", d3.forceCollide().strength(0.5).radius(function(d) { return d.radius + nodePadding; }).iterations(5))
            .on("tick", function(d){

                circle.attr("cx", function(d){ return d.x; })
                    .attr("cy", function(d){ return d.y; })

                text.attr("dx", function(d) { return d.x; })
                    .attr("dy", function(d) { return d.y; })

            });

        //setting up nodes
        let node = svg.selectAll("circle")
                    .data(csvlist)
                    .attr("class", "node")
                    .enter().append("g")
                    .call(d3.drag()
                            .on("start", dragstarted)
                            .on("drag", dragged)
                            .on("end", dragended));

        //appending circles to nodes
        let circle = node.append("circle")
                        .data(csvlist)
                        .attr("r", function(d) { return d.radius; })
                        .attr("fill", function(d) { return color(d.index); })
                        .attr("cx", function(d){ return d.x; })
                        .attr("cy", function(d){ return d.y; });

        //appending text to nodes
        let text = node.append("text")
                    .attr("class", "text")
                    .data(csvlist)
                    .attr("dx", function(d) { return d.x; })
                    .attr("dy", function(d) { return d.y + d.size/5; })
                    .text(function(d) { return d.key; })
                    .style("font-size", function(d) {return d.size/2 > 8 ? d.size/2 : 8; })
                    .style("font-family", "Helvetica")
                    .style("text-anchor", "middle");

        });

        //helper functions for simulation
        function dragstarted(d) {
            if (!d3.event.active) simulation.alphaTarget(.03).restart();
            d.fx = d.x;
            d.fy = d.y;
        }

        function dragged(d) {
            d.fx = d3.event.x;
            d.fy = d3.event.y;
        }

        function dragended(d) {
            if (!d3.event.active) simulation.alphaTarget(.03);
            d.fx = null;
            d.fy = null;
        }

        // update function which is similar to the original plot with conditional exit
        function update() {

            d3.csv("bigquery_data.csv", function(error, data) {
            if (error) throw error;

            // exit if no new data
            if (data[data.length - 1].date  == oldData[oldData.length - 1].date ) {
                return;
            }

            // update for next conditional exit
            oldData = data;

            // updating the csv variable
            data.forEach(function(d) {

                tag = d['tag'];

                if(csv[tag] == undefined) {
                        csv[tag] = +d['count'];
                    } else {
                        csv[tag] += +d['count'];
                }
            });

            // converting to d3 entries list and adding other required data for visualization
            let csvlist = d3.entries(csv);

            csvlist.forEach(function(d) {
                d.value = +d.value;
                d.size = +d.value / sizeDivisor;
                d.size < 3 ? d.radius = 3 : d.radius = d.size;
                return d;
            });

            // sort the nodes so that the bigger ones are at the back
            csvlist = csvlist.sort(function(a,b) { return b.size - a.size; });

            //update the simulation based on the data
            simulation
                .nodes(csvlist)
                .force("collide", d3.forceCollide().strength(0.5).radius(function(d) { return d.radius + nodePadding; }).iterations(1))
                .on("tick", function(d) {

                    circle.attr("cx", function(d){ return d.x; })
                          .attr("cy", function(d){ return d.y; })

                    text.attr("dx", function(d) { return d.x; })
                        .attr("dy", function(d) { return d.y; })

                });

            let node = svg.selectAll(".node")
                      .data(csvlist)
                      .transition()
                      .duration(100)
                      .ease(d3.easeLinear);

            node.enter().append("g")
                .attr("class", "node")
                .call(d3.drag()
                            .on("start", dragstarted)
                            .on("drag", dragged)
                            .on("end", dragended));

            let circle = node.append("circle")
                .data(csvlist)
                .attr("r", function(d) { return d.radius; })
                .attr("fill", function(d) { return color(d.index); })
                .attr("cx", function(d){ return d.x; })
                .attr("cy", function(d){ return d.y; });

            let text = node.append("text")
                .attr("class", "text")
                .data(csvlist)
                .attr("dx", function(d) { return d.x; })
                .attr("dy", function(d) { return d.y + d.size/5; })
                .text(function(d) { return d.key; })
                .style("font-size", function(d) {return d.size/2 > 8 ? d.size/2 : 8; })
                .style("font-family", "Helvetica")
                .style("text-anchor", "middle");

            });

            function dragstarted(d) {
            if (!d3.event.active) simulation.alphaTarget(.03).restart();
            d.fx = d.x;
            d.fy = d.y;
            }

            function dragged(d) {
            d.fx = d3.event.x;
            d.fy = d3.event.y;
            }

            function dragended(d) {
            if (!d3.event.active) simulation.alphaTarget(.03);
            d.fx = null;
            d.fy = null;
            }

            }

        // code to update the visualization every 10seconds
        let inter = setInterval(function() {update()}, 10000);

    </script>
</body>
</html>
</code>```

Bubble Chart at inception

Bubble Chart after ~10mins

Body:
I am trying to plot a bubble chart in d3.js using a file that is updated every few seconds and I'm having trouble with a few parts of the code.

The whole data-to-visualization pipeline is described below:

Data is gathered, processed and saved using a dataproc cluster on GCP

Data is retrieved from GCP and saved to a local machine as a .csv file every 10 seconds

The .csv file is used to create a d3.js visualization - the visualization is updated using d3's setInterval().

A sample of the data is shown below:

Tag
Count
Date

0
python
1
12/06 18:15:40

1
pandas
1
12/06 18:15:40

2
java
1
12/06 18:15:40

3
html
1
12/06 18:15:40

4
c++
1
12/06 18:15:40

The issues I'm facing are numbered below:

Ideally, I would like to be able to get the data and store just that new data (i.e. overwrite the old file) when saving it on the GCP end. I'm not able to do that because for some reason it seems that something is causing the script to clear out variables in memory (potentially?). I say this because when I run the code below, the csv variable is reset each time. To remedy this, I'm appending all data gathered so that I have all the data.

Currently, it seems that every time that I run the update function, the circles are replotted (which is what is happening - I understand) but I would like to figure out how to get the circles that I already have and transition them so that they show their new values and only draw new circles for the new data. I'm unable to achieve that with my current code even though I've tried many different ways to transition the data.

I was expecting to be able to update the csv variable in memory so that I would not have to reprocess the data every time. I would also prefer not to append the file and pull the complete file each iteration. Furthermore, the every iteration the visuals are a complete wipe of the canvas and replotting rather than a smooth transition.

Here is my code and a couple of pictures of the visualization at different times. Any suggestion would be extremely helpful.

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Real-Time Tags Analysis</title>

Real-Time Tags Analysis

Bubble Chart at inception

Bubble Chart after ~10mins


来源: stackexchange

问:
Seemingly random exceptions at fernet token from file
Please excuse my poor english and spaghetti code;

I really want to make a python script that encrypts and decrypts files, but every time i try to run it (in vs code), there is one or another problem with the token.

Here is the code:

```<code>import os
from cryptography.fernet import Fernet

defKey = 'wLQz9Enb5veyv_JhXKsYMWybwAhm-JA1ytdyh4tGRI0='

def dec():
    inpPass = input('Password:\n')
    passKey = inpPass + defKey[len(inpPass):]

    passToken = open('pass.txt', 'rb').read
    Fernet(passKey.encode('utf-8')).decrypt(passToken)
    print('no error wowie')

dec()
</code>```

The exception with this code here is TypeError: token must be bytes.

Quite detailed explanation:

The pass.txt file contains the word "check" encrypted with this key: amogusnb5veyv_JhXKsYMWybwAhm-JA1ytdyh4tGRI0=. The script is prompting the user to enter a password. The password gets converted to a fernet key by replacing the first letters of defKey. After that the program tries validating the key by decrypting the pass file.

I tried three notable things:

Making the pass.txt file plaintext in the script, and converting it to bytes. This worked, but i want the script to take in different passwords.

Converting the file to string, then to bytes.

```<code>Fernet(passKey.encode('utf-8')).decrypt(bytes(str(encPass), 'utf-8'))
</code>```

This gives this exception: InvalidToken: Incorrect padding.

Doing what i did previously, but adding an equals sign to the string. This gives InvalidToken: no description. I thought about adding this because is solved somebody's problem with decoding base64.

Please help! I am really stuck, and for no good reason.

ContentLicense: CC BY-SA 4.0

Body:
Please excuse my poor english and spaghetti code;

I really want to make a python script that encrypts and decrypts files, but every time i try to run it (in vs code), there is one or another problem with the token.

Here is the code:

import os
from cryptography.fernet import Fernet

defKey = 'wLQz9Enb5veyv_JhXKsYMWybwAhm-JA1ytdyh4tGRI0='

def dec():
    inpPass = input('Password:\n')
    passKey = inpPass + defKey[len(inpPass):]

    passToken = open('pass.txt', 'rb').read
    Fernet(passKey.encode('utf-8')).decrypt(passToken)
    print('no error wowie')

dec()

The exception with this code here is TypeError: token must be bytes.

Quite detailed explanation:

The pass.txt file contains the word "check" encrypted with this key: amogusnb5veyv_JhXKsYMWybwAhm-JA1ytdyh4tGRI0=. The script is prompting the user to enter a password. The password gets converted to a fernet key by replacing the first letters of defKey. After that the program tries validating the key by decrypting the pass file.

I tried three notable things:

Making the pass.txt file plaintext in the script, and converting it to bytes. This worked, but i want the script to take in different passwords.

Converting the file to string, then to bytes.

Fernet(passKey.encode('utf-8')).decrypt(bytes(str(encPass), 'utf-8'))

This gives this exception: InvalidToken: Incorrect padding.

Doing what i did previously, but adding an equals sign to the string. This gives InvalidToken: no description. I thought about adding this because is solved somebody's problem with decoding base64.

Please help! I am really stuck, and for no good reason.


问:
How to get Token by make Authentication with Email and Password in bitbucket
I am using API in bitbucket.org, before I can get data with APIs, I need to make Authentication by this API

To access any api endpoint you have to setup auth in your app and ask for email and password and then call the following api:

```<code>  https://smartmenu22.com/api/auth/login
</code>```

The API will return in a case of successfull login: a token that you have to save it. And then you can access any API endpoint using that token.

I try this code but it always say Email or Password is not valid

```<code>            var client = new RestClient("https://smartmenu22.com/api/auth/login");
            var request = new RestRequest(Method.POST);
            request.AddParameter("email", email);
            request.AddParameter("password", password);
            request.AddHeader("cache-control", "no-cache");
            request.AddHeader("content-type", "application/x-www-form-urlencoded");
            IRestResponse response = client.Execute(request);
            dynamic resp = JObject.Parse(response.Content);
            string token = resp.access_token;
</code>```

Body:
I am using API in bitbucket.org, before I can get data with APIs, I need to make Authentication by this API

To access any api endpoint you have to setup auth in your app and ask for email and password and then call the following api:

  https://smartmenu22.com/api/auth/login

The API will return in a case of successfull login: a token that you have to save it. And then you can access any API endpoint using that token.

I try this code but it always say Email or Password is not valid

            var client = new RestClient("https://smartmenu22.com/api/auth/login");
            var request = new RestRequest(Method.POST);
            request.AddParameter("email", email);
            request.AddParameter("password", password);
            request.AddHeader("cache-control", "no-cache");
            request.AddHeader("content-type", "application/x-www-form-urlencoded");
            IRestResponse response = client.Execute(request);
            dynamic resp = JObject.Parse(response.Content);
            string token = resp.access_token;


问:
Neo4j - Loop through relationships with conditions and variables in loop
How is it possible to loop through relationships in a specific order (e.g.: "created" property) and taking the single properties of the relationships into consideration.

I prepared one example:

Imagine we have 3 users (nodes) who each collect (relationship) 40kg Apples with a created-timestamp. On the other hand, we have a basket (node) with can take 100kg. How is it possible to loop through all 3 relationships and fill the basket with exactly 100kg? The goal would be to take the full 40kg of the two oldest-created-relationships and to take only 20kg from the youngest-relationship. This scenario needs to deal with the single relationships-properties within the loop.

The result could be that we change/add properties of the existing COLLECTS-relationship or add new relationships between the Basket and the User.

Thank you

The schema of the example looks like this:

In Neo4j the relationships/nodes could be created by this:

```<code>create
(_0:`Basket`  {`size`:100}),
(_1:`User`  {`name`:"Franc"}),
(_6:`User`  {`name`:"Peter"}),
(_34:`User`  {`name`:"Betty"}),
(_54:`Fruit` ),
(_1)-[:`COLLECTS` {`created`:"20221206212715",`kilos`:40,`type`:"Apples"}]->(_54),
(_6)-[:`COLLECTS` {`created`:"20221206212417",`kilos`:40,`type`:"Apples"}]->(_54),
(_34)-[:`COLLECTS` {`created`:"20221206212547",`kilos`:40,`type`:"Apples"}]->(_54)
</code>```

Body:
How is it possible to loop through relationships in a specific order (e.g.: "created" property) and taking the single properties of the relationships into consideration.

I prepared one example:

Imagine we have 3 users (nodes) who each collect (relationship) 40kg Apples with a created-timestamp. On the other hand, we have a basket (node) with can take 100kg. How is it possible to loop through all 3 relationships and fill the basket with exactly 100kg? The goal would be to take the full 40kg of the two oldest-created-relationships and to take only 20kg from the youngest-relationship. This scenario needs to deal with the single relationships-properties within the loop.

The result could be that we change/add properties of the existing COLLECTS-relationship or add new relationships between the Basket and the User.

Thank you

The schema of the example looks like this:

In Neo4j the relationships/nodes could be created by this:

create
(_0:`Basket`  {`size`:100}),
(_1:`User`  {`name`:"Franc"}),
(_6:`User`  {`name`:"Peter"}),
(_34:`User`  {`name`:"Betty"}),
(_54:`Fruit` ),
(_1)-[:`COLLECTS` {`created`:"20221206212715",`kilos`:40,`type`:"Apples"}]->(_54),
(_6)-[:`COLLECTS` {`created`:"20221206212417",`kilos`:40,`type`:"Apples"}]->(_54),
(_34)-[:`COLLECTS` {`created`:"20221206212547",`kilos`:40,`type`:"Apples"}]->(_54)


问:
I find a problem with removing elements from list in nested "for loop"
I have this problem to solve:
Your school wants to hold a competition with the largest number of teams, so that each team consists of two students, provided that the average marks of the team (the two students) are greater or equal to 87. Your task is to write a program that reads 10 different marks for ten students and forms the teams, and in case there is no average team  Above 87, the program prints No Team

What I'm trying to do is to check the average of the number with every other number in the list, and this I managed to do with the nested loop, but the problem is when I try to remove these items from the list, I know that my way of doing it is wrong but I don't understand why and I don't know how solve it

I'm trying to remove more than one item in a list, inside a nested for loop, but I don't understand why it's giving me an "IndexError"

```<code>x = []
for i in range(10):
    y = int(input("Enter your grade: "))
    x.append(y)

for n in range (len(x)):
    for index in range(len(x)):
        average = (x[n]+x[index])/2
        if n == index:
            continue
        if average >= 0:
            print(x[n] , x[index] , average)
            x.remove(x[n])
            x.remove(x[index])
</code>```
```<code>Traceback (most recent call last):
  File "c:\Users\IMOE001\Desktop\exam\Question2.py", line 11, in <module>
    average = (x[n]+x[index])/2
                    ~^^^^^^^
IndexError: list index out of range
</code>```

Body:
I have this problem to solve:
Your school wants to hold a competition with the largest number of teams, so that each team consists of two students, provided that the average marks of the team (the two students) are greater or equal to 87. Your task is to write a program that reads 10 different marks for ten students and forms the teams, and in case there is no average team  Above 87, the program prints No Team

What I'm trying to do is to check the average of the number with every other number in the list, and this I managed to do with the nested loop, but the problem is when I try to remove these items from the list, I know that my way of doing it is wrong but I don't understand why and I don't know how solve it

I'm trying to remove more than one item in a list, inside a nested for loop, but I don't understand why it's giving me an "IndexError"

x = []
for i in range(10):
    y = int(input("Enter your grade: "))
    x.append(y)

for n in range (len(x)):
    for index in range(len(x)):
        average = (x[n]+x[index])/2
        if n == index:
            continue
        if average >= 0:
            print(x[n] , x[index] , average)
            x.remove(x[n])
            x.remove(x[index])

Traceback (most recent call last):
  File "c:\Users\IMOE001\Desktop\exam\Question2.py", line 11, in <module>
    average = (x[n]+x[index])/2
                    ~^^^^^^^
IndexError: list index out of range


问:
How to define a range that includes both merged and non-merged cells?
Let's say I have cells A1 through E1. A1 and B1 are normal cells, while C1, D1, and E1 are all merged as one cell.

If I want to define a range as these three cells (meaning, from A1 through E1), this code isn't working for me:

```<code>Dim startRow, endRow, startColumn, endColumn As Long

startRow = 1
endRow = 1
startColumn = 1
endColumn = 3

Set rng = Range(Cells(startRow, startColumn), Cells(endRow, endColumn))
</code>```

I have run this with the variable endColumn set to both 3 and 5 (the first and last column used in the merged cell) and neither of them work. My code returns an error each time, and I can only assume it is due to the merged cell in this range definition.

It seems like there should be a simple solution to this, but google isn't returning anything too helpful.

Thanks in advance.

Body:
Let's say I have cells A1 through E1. A1 and B1 are normal cells, while C1, D1, and E1 are all merged as one cell.

If I want to define a range as these three cells (meaning, from A1 through E1), this code isn't working for me:

Dim startRow, endRow, startColumn, endColumn As Long

startRow = 1
endRow = 1
startColumn = 1
endColumn = 3

Set rng = Range(Cells(startRow, startColumn), Cells(endRow, endColumn))

I have run this with the variable endColumn set to both 3 and 5 (the first and last column used in the merged cell) and neither of them work. My code returns an error each time, and I can only assume it is due to the merged cell in this range definition.

It seems like there should be a simple solution to this, but google isn't returning anything too helpful.

Thanks in advance.


问:
Kotlin CameraX How to: Preview/Object Detection/Image Capture/Crop
I'm trying to set up a simple fragment that uses CameraX to provide a preview, does object detection on the live stream (for a simple rectangle - using no classification at the moment), and then once an object is detected for a number of consecutive frames (50), capture an image.  On image saved, I want to crop the captured image down to just the detected object.

I can make most of the parts of this work, but I am struggling to crop the saved image down to the proper part of the image that matches the detected object.
`

```<code>    fun runCamera() {
        cameraController = LifecycleCameraController(requireContext())
        cameraController!!.bindToLifecycle(this as LifecycleOwner)
        cameraController!!.isPinchToZoomEnabled = false
        binding.previewView.controller = cameraController
        cameraController!!.imageCaptureMode = ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY
        cameraController!!.setImageAnalysisAnalyzer(cameraExecutor, MyCameraAnalyzer())
    }
</code>```
```<code>inner class MyCameraAnalyzer : ImageAnalysis.Analyzer {

    // Live detection and tracking
    val options = ObjectDetectorOptions.Builder()
        .setDetectorMode(ObjectDetectorOptions.STREAM_MODE)
        .build()

    val objectDetector = ObjectDetection.getClient(options)

    override fun analyze(image: ImageProxy) {
        if (isShutdown) {
            image.close()
            return
        }
        val mediaImage = image.image
        if (mediaImage != null) {
            val inputImage = InputImage.fromMediaImage(mediaImage, image.imageInfo.rotationDegrees)

            lifecycleScope.launch {
                cameraController!!.cameraInfo
                val isImageFlipped = lensFacing == CameraSelector.LENS_FACING_FRONT
                val rotationDegrees = image.imageInfo.rotationDegrees
                if (rotationDegrees == 0 || rotationDegrees == 180) {
                    binding.overlayView.setImageSourceInfo(
                        image.width,
                        image.height,
                        isImageFlipped
                    )
                } else {
                    binding.overlayView.setImageSourceInfo(
                        image.height,
                        image.width,
                        isImageFlipped
                    )
                }
            }

            // Pass image to an ML Kit Vision API
            objectDetector.process(inputImage)
                .addOnSuccessListener { detectedObjects ->
                    if (detectedObjects.size == 1) {
                        lifecycleScope.launch {
                            isShutdown = true
                            currImageProxy = image

                            val detectedBox = RectF(detectedObjects[0].boundingBox)

                            // Scale the detection box for the graphic overlay
                            // This part works fine and the object is surrounded with an outline
                            //   as expected
                            val objBorder = CameraODBorder(binding.overlayView, detectedBox)
                            val detectedBoxScaled = objBorder.scaleRectF(detectedBox)
                            binding.overlayView.clear()
                            binding.overlayView.add(objBorder)

                            if (detectedBox.left < 0 || detectedBox.top < 0 ||
                                (detectedBox.left + detectedBox.width()) > image.width ||
                                (detectedBox.top + detectedBox.height()) > image.height
                            ) {
                                isShutdown = false
                                goodDetections = 0
                            } else {
                                if( goodDetections > 50 ) {
                                    goodDetections = 0
                                    takePicture(detectedBoxScaled, image.imageInfo.rotationDegrees)
                                }
                                else {
                                    isShutdown = false
                                    goodDetections++
                                }
                            }
                        }
                    } else {
                        binding.overlayView.clear()
                        goodDetections = 0
                    }
                    image.close()
                }
                .addOnFailureListener { e ->
                    image.close()
                    Log.e(TAG, "Failed object detection: $e")
                }
                .addOnCompleteListener {
                    image.close()
                }
                .addOnCanceledListener {
                    image.close()
                }
        } else {
            image.close()
        }
    }
}
</code>```
```<code>fun takePicture(cropTarget: RectF, inRotation: Int) {
    val file = File(requireContext().cacheDir, "cameraTmp.png")
    val outputOptions = ImageCapture.OutputFileOptions.Builder(file).build()
    cameraController?.takePicture(outputOptions, cameraExecutor,
        object : ImageCapture.OnImageSavedCallback {
            override fun onImageSaved(outputFileResults: ImageCapture.OutputFileResults) {
                val savedUri = outputFileResults.savedUri
                // Get image rotation
                val inputStream = myActivity.contentResolver.openInputStream(savedUri!!)
                val exif = Exif.createFromInputStream(inputStream!!)
                val rotation = exif.rotation
                lifecycleScope.launch {
                    setMode("photo")

                    val previewViewTransform = binding.previewView.outputTransform!!
                    val imageProxyTransform = ImageProxyTransformFactory().getOutputTransform(currImageProxy!!)
                    val fileTransform = FileTransformFactory().getOutputTransform(file)
                    val coordinateTransform = CoordinateTransform(imageProxyTransform!!, previewViewTransform)

                    coordinateTransform.mapRect(cropTarget)

                    val bitmap = savedUri?.getBitmap()

                    binding.pictureTaken.setImageBitmap(bitmap)

                    val cropWidth = cropTarget.width().toInt()
                    val cropHeight = cropTarget.height().toInt()
                    val cropLeft = cropTarget.left.toInt()
                    val cropTop = cropTarget.top.toInt()
                    Log.d("cropTarget", "bitmap w:${bitmap!!.width} h:${bitmap!!.height} CropTarget w:${cropWidth} h:${cropHeight} l:${cropLeft} t:${cropTop}")
                    croppedBitmap = Bitmap.createBitmap(
                        bitmap!!,
                        cropLeft,
                        cropTop,
                        cropWidth,
                        cropHeight
                    )
                    binding.pictureTaken.setImageBitmap(croppedBitmap)
                }
            }

            override fun onError(exception: ImageCaptureException) {
                Log.e(TAG, "exception:$exception")
            }
        })
}
</code>```

`

D/cropTarget: bitmap w:2184 h:4032 CropTarget w:933 h:1718 l:-1949 t:1002
(the actual detected object is centered in the screen and only about half to quarter the width/height of the preview view)

So it seems pretty clear the coordinate transform is rotating the original coordinate space (which is the detected image and is 640x480 from testing it)  But I'm not sure what to do with that.

I've tried transforming the coordinates myself.  I think the image being analyzed being wider, is being cropped compared to the preview/captured image.  But my translations seem to fail.

As far as I understand the whole cameraX infrastructure should be capable of doing this but I have to be missing something.

I tried to clean the code up and pare it down from all the things I've tried.

If anyone knows how to get the coordinate transform to work properly that would be great, but open to other ideas definitely.

There are other similar questions, but nobody has a solution for the full process.
This one seems close but untested code and the thing doesn't work for me so...
How to crop image captured by CameraX based on a rectangle on Preview display

Body:
I'm trying to set up a simple fragment that uses CameraX to provide a preview, does object detection on the live stream (for a simple rectangle - using no classification at the moment), and then once an object is detected for a number of consecutive frames (50), capture an image.  On image saved, I want to crop the captured image down to just the detected object.

I can make most of the parts of this work, but I am struggling to crop the saved image down to the proper part of the image that matches the detected object.
`

    fun runCamera() {
        cameraController = LifecycleCameraController(requireContext())
        cameraController!!.bindToLifecycle(this as LifecycleOwner)
        cameraController!!.isPinchToZoomEnabled = false
        binding.previewView.controller = cameraController
        cameraController!!.imageCaptureMode = ImageCapture.CAPTURE_MODE_MAXIMIZE_QUALITY
        cameraController!!.setImageAnalysisAnalyzer(cameraExecutor, MyCameraAnalyzer())
    }

inner class MyCameraAnalyzer : ImageAnalysis.Analyzer {

    // Live detection and tracking
    val options = ObjectDetectorOptions.Builder()
        .setDetectorMode(ObjectDetectorOptions.STREAM_MODE)
        .build()

    val objectDetector = ObjectDetection.getClient(options)

    override fun analyze(image: ImageProxy) {
        if (isShutdown) {
            image.close()
            return
        }
        val mediaImage = image.image
        if (mediaImage != null) {
            val inputImage = InputImage.fromMediaImage(mediaImage, image.imageInfo.rotationDegrees)

            lifecycleScope.launch {
                cameraController!!.cameraInfo
                val isImageFlipped = lensFacing == CameraSelector.LENS_FACING_FRONT
                val rotationDegrees = image.imageInfo.rotationDegrees
                if (rotationDegrees == 0 || rotationDegrees == 180) {
                    binding.overlayView.setImageSourceInfo(
                        image.width,
                        image.height,
                        isImageFlipped
                    )
                } else {
                    binding.overlayView.setImageSourceInfo(
                        image.height,
                        image.width,
                        isImageFlipped
                    )
                }
            }

            // Pass image to an ML Kit Vision API
            objectDetector.process(inputImage)
                .addOnSuccessListener { detectedObjects ->
                    if (detectedObjects.size == 1) {
                        lifecycleScope.launch {
                            isShutdown = true
                            currImageProxy = image

                            val detectedBox = RectF(detectedObjects[0].boundingBox)

                            // Scale the detection box for the graphic overlay
                            // This part works fine and the object is surrounded with an outline
                            //   as expected
                            val objBorder = CameraODBorder(binding.overlayView, detectedBox)
                            val detectedBoxScaled = objBorder.scaleRectF(detectedBox)
                            binding.overlayView.clear()
                            binding.overlayView.add(objBorder)

                            if (detectedBox.left < 0 || detectedBox.top < 0 ||
                                (detectedBox.left + detectedBox.width()) > image.width ||
                                (detectedBox.top + detectedBox.height()) > image.height
                            ) {
                                isShutdown = false
                                goodDetections = 0
                            } else {
                                if( goodDetections > 50 ) {
                                    goodDetections = 0
                                    takePicture(detectedBoxScaled, image.imageInfo.rotationDegrees)
                                }
                                else {
                                    isShutdown = false
                                    goodDetections++
                                }
                            }
                        }
                    } else {
                        binding.overlayView.clear()
                        goodDetections = 0
                    }
                    image.close()
                }
                .addOnFailureListener { e ->
                    image.close()
                    Log.e(TAG, "Failed object detection: $e")
                }
                .addOnCompleteListener {
                    image.close()
                }
                .addOnCanceledListener {
                    image.close()
                }
        } else {
            image.close()
        }
    }
}

fun takePicture(cropTarget: RectF, inRotation: Int) {
    val file = File(requireContext().cacheDir, "cameraTmp.png")
    val outputOptions = ImageCapture.OutputFileOptions.Builder(file).build()
    cameraController?.takePicture(outputOptions, cameraExecutor,
        object : ImageCapture.OnImageSavedCallback {
            override fun onImageSaved(outputFileResults: ImageCapture.OutputFileResults) {
                val savedUri = outputFileResults.savedUri
                // Get image rotation
                val inputStream = myActivity.contentResolver.openInputStream(savedUri!!)
                val exif = Exif.createFromInputStream(inputStream!!)
                val rotation = exif.rotation
                lifecycleScope.launch {
                    setMode("photo")

                    val previewViewTransform = binding.previewView.outputTransform!!
                    val imageProxyTransform = ImageProxyTransformFactory().getOutputTransform(currImageProxy!!)
                    val fileTransform = FileTransformFactory().getOutputTransform(file)
                    val coordinateTransform = CoordinateTransform(imageProxyTransform!!, previewViewTransform)

                    coordinateTransform.mapRect(cropTarget)

                    val bitmap = savedUri?.getBitmap()

                    binding.pictureTaken.setImageBitmap(bitmap)

                    val cropWidth = cropTarget.width().toInt()
                    val cropHeight = cropTarget.height().toInt()
                    val cropLeft = cropTarget.left.toInt()
                    val cropTop = cropTarget.top.toInt()
                    Log.d("cropTarget", "bitmap w:${bitmap!!.width} h:${bitmap!!.height} CropTarget w:${cropWidth} h:${cropHeight} l:${cropLeft} t:${cropTop}")
                    croppedBitmap = Bitmap.createBitmap(
                        bitmap!!,
                        cropLeft,
                        cropTop,
                        cropWidth,
                        cropHeight
                    )
                    binding.pictureTaken.setImageBitmap(croppedBitmap)
                }
            }

            override fun onError(exception: ImageCaptureException) {
                Log.e(TAG, "exception:$exception")
            }
        })
}

`

D/cropTarget: bitmap w:2184 h:4032 CropTarget w:933 h:1718 l:-1949 t:1002
(the actual detected object is centered in the screen and only about half to quarter the width/height of the preview view)

So it seems pretty clear the coordinate transform is rotating the original coordinate space (which is the detected image and is 640x480 from testing it)  But I'm not sure what to do with that.

I've tried transforming the coordinates myself.  I think the image being analyzed being wider, is being cropped compared to the preview/captured image.  But my translations seem to fail.

As far as I understand the whole cameraX infrastructure should be capable of doing this but I have to be missing something.

I tried to clean the code up and pare it down from all the things I've tried.

If anyone knows how to get the coordinate transform to work properly that would be great, but open to other ideas definitely.

There are other similar questions, but nobody has a solution for the full process.
This one seems close but untested code and the thing doesn't work for me so...
How to crop image captured by CameraX based on a rectangle on Preview display


问:
Nginx 400 Error - client sent plain HTTP request to HTTPS port while reading client request headers
I recently added a SSL certificate to my website using Let's Encrypt and have noticed that when I try to access my website using either HTTP or HTTPS, the site will load correctly most of the time, but sometimes it will return a 400: Bad Request error. Refreshing the page after that will usually return me to the working HTTPS site, but I am having trouble understanding why this error only occurs sometimes.

The current site is using Django, Gunicorn, Nginx, and AWS EC2 with a load balancer and the SSL certificate is for the EC2 instance, if this makes a difference.

nginx.conf

```<code>user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log info;

        ##
        # Gzip Settings
        ##

        gzip on;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}
</code>```

sites-enabled .conf file

```<code>server {

    listen 80;
    server_name = "";
    return 444;

}

server {

    listen 80;
    server_name sitename;
    return 301 https://$host$request_uri;

}
server {

    listen 443 default ssl;
    server_name sitename;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /opt/code/shop;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
    }

    ssl_certificate /etc/letsencrypt/live/sitename/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sitename/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}
</code>```

proxy_params

```<code>proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $server_name;
</code>```

Nginx error.log example output

```<code>2022/12/06 17:41:22 [info] 1996220#1996220: *1047 client sent plain HTTP request to HTTPS port while reading client request headers, client: ip, server: sitename, request: "GET / HTTP/1.1", host: "sitename"
2022/12/06 17:59:42 [info] 1996220#1996220: *1929 client sent invalid method while reading client request line, client: ip, server: sitename, request: "KtIX\YNY"
</code>```

Body:
I recently added a SSL certificate to my website using Let's Encrypt and have noticed that when I try to access my website using either HTTP or HTTPS, the site will load correctly most of the time, but sometimes it will return a 400: Bad Request error. Refreshing the page after that will usually return me to the working HTTPS site, but I am having trouble understanding why this error only occurs sometimes.

The current site is using Django, Gunicorn, Nginx, and AWS EC2 with a load balancer and the SSL certificate is for the EC2 instance, if this makes a difference.

nginx.conf

user www-data;
worker_processes auto;
pid /run/nginx.pid;
include /etc/nginx/modules-enabled/*.conf;

events {
        worker_connections 768;
        # multi_accept on;
}

http {

        ##
        # Basic Settings
        ##

        sendfile on;
        tcp_nopush on;
        tcp_nodelay on;
        keepalive_timeout 65;
        types_hash_max_size 2048;
        # server_tokens off;

        # server_names_hash_bucket_size 64;
        # server_name_in_redirect off;

        include /etc/nginx/mime.types;
        default_type application/octet-stream;

        ##
        # SSL Settings
        ##

        ssl_protocols TLSv1.2 TLSv1.3; # Dropping SSLv3, ref: POODLE
        ssl_prefer_server_ciphers on;

        ##
        # Logging Settings
        ##

        access_log /var/log/nginx/access.log;
        error_log /var/log/nginx/error.log info;

        ##
        # Gzip Settings
        ##

        gzip on;

        ##
        # Virtual Host Configs
        ##

        include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;
}

sites-enabled .conf file

server {

    listen 80;
    server_name = "";
    return 444;

}

server {

    listen 80;
    server_name sitename;
    return 301 https://$host$request_uri;

}
server {

    listen 443 default ssl;
    server_name sitename;

    location = /favicon.ico { access_log off; log_not_found off; }
    location /static/ {
        root /opt/code/shop;
    }

    location / {
        include proxy_params;
        proxy_pass http://unix:/run/gunicorn.sock;
    }

    ssl_certificate /etc/letsencrypt/live/sitename/fullchain.pem; # managed by Certbot
    ssl_certificate_key /etc/letsencrypt/live/sitename/privkey.pem; # managed by Certbot
    include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
    ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot

}

proxy_params

proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Forwarded-Host $server_name;

Nginx error.log example output

2022/12/06 17:41:22 [info] 1996220#1996220: *1047 client sent plain HTTP request to HTTPS port while reading client request headers, client: ip, server: sitename, request: "GET / HTTP/1.1", host: "sitename"
2022/12/06 17:59:42 [info] 1996220#1996220: *1929 client sent invalid method while reading client request line, client: ip, server: sitename, request: "KtIX\YNY"


问:
Extracting equation from a DNN in MATLAB?
I have built a deep neural network in MATLAB consist of two hidden layers (6 neurons in the first layer and 4 in the second layer), (11 inputs), and (1 output). Below is the code:

```<code>net=newff(Norm_inputs,Norm_Outputs,[6 4],{'tansig' 'tansig' 'tansig'}); %% Neural Network with 12 inputs and four Neurons in the Hidden layers
net.divideParam.trainRatio=80;     %% 70% of the data are used for training
net.divideParam.testRatio=20;      %% 15% of the data are used for testing
net.divideParam.valRatio=0;       %% 15% of the data are used for the validation
net.trainParam.lr=0.01;             %% Learning rate
net.trainParam.min_grad=1e-20;
net.trainParam.goal=1e-30;
net.trainParam.epochs=1000;
net = train(net,Norm_inputs,Norm_Outputs);
</code>```

where Norm_inputs are the normalized inputs and Norm_Outputs are the normalized outputs

To test the accuracy of network I am using the following:

```<code>A = net([0.613497 1 1 0.660657 0.675336 0.150442 0.343584 0.162069 0.655799 0.574284 9.83E-05 ]')
</code>```

I am comparing the output of A with my raw data to check the performance..

I am trting to extract the mathematical equation so I can avoid opening matlab everytime to see the results..

I did the following in the command window to exctract the weights and biases:

```<code>b1 = net.b{1}; % Bias between the input layer and the first hidden layer (6x1)
b2 = net.b{2}; % Bias between the first hidden layer and the second hidden layer (4x1)
b3 = net.b{3}; % Bias between the second hidden layer and the output layer (1x1)

W_ITH = net.IW{1,1} % weights between the input layer and the first hidden layer (6x11)
W_H1TH2 = net.LW{2,1} % weights between the first hidden layer and the second hidden layer (4x6)
W_H2TO = net.LW{3,2}; % weights between the second hidden layer and the output layer(1x4)
</code>```

I have used the following equation to return the output of the first part:

```<code>y1 = b2 + W_H1TH2 * tansig(b1+W_ITH*x) (4x1)
</code>```

My question is how can I pass the output of this hidden layer to the next hidden layer to obtain the output which is a scalar in my case?

The final target is to extract the mathmatical equation?

Body:
I have built a deep neural network in MATLAB consist of two hidden layers (6 neurons in the first layer and 4 in the second layer), (11 inputs), and (1 output). Below is the code:

net=newff(Norm_inputs,Norm_Outputs,[6 4],{'tansig' 'tansig' 'tansig'}); %% Neural Network with 12 inputs and four Neurons in the Hidden layers
net.divideParam.trainRatio=80;     %% 70% of the data are used for training
net.divideParam.testRatio=20;      %% 15% of the data are used for testing
net.divideParam.valRatio=0;       %% 15% of the data are used for the validation
net.trainParam.lr=0.01;             %% Learning rate
net.trainParam.min_grad=1e-20;
net.trainParam.goal=1e-30;
net.trainParam.epochs=1000;
net = train(net,Norm_inputs,Norm_Outputs);

where Norm_inputs are the normalized inputs and Norm_Outputs are the normalized outputs

To test the accuracy of network I am using the following:

A = net([0.613497 1 1 0.660657 0.675336 0.150442 0.343584 0.162069 0.655799 0.574284 9.83E-05 ]')

I am comparing the output of A with my raw data to check the performance..

I am trting to extract the mathematical equation so I can avoid opening matlab everytime to see the results..

I did the following in the command window to exctract the weights and biases:

b1 = net.b{1}; % Bias between the input layer and the first hidden layer (6x1)
b2 = net.b{2}; % Bias between the first hidden layer and the second hidden layer (4x1)
b3 = net.b{3}; % Bias between the second hidden layer and the output layer (1x1)

W_ITH = net.IW{1,1} % weights between the input layer and the first hidden layer (6x11)
W_H1TH2 = net.LW{2,1} % weights between the first hidden layer and the second hidden layer (4x6)
W_H2TO = net.LW{3,2}; % weights between the second hidden layer and the output layer(1x4)

I have used the following equation to return the output of the first part:

y1 = b2 + W_H1TH2 * tansig(b1+W_ITH*x) (4x1)

My question is how can I pass the output of this hidden layer to the next hidden layer to obtain the output which is a scalar in my case?

The final target is to extract the mathmatical equation?


问:
Use of ILogger in Acumatica Dependency Injection
In previous versions, I registered Serilog.ILogger in the container as follows:

```<code>        builder.Register(context => PXTrace.Logger).As<ILogger>();
</code>```

So that I could inject it into types registered in the container:

In 22R2 this seems to have stopped working, but there is no error. When I call _logger.Information("test"); or _logger.Error() nothing is written to the trace. I know one can use Microsofts ILogger interface to inject into a graph, but how does one inject a non generic ILogger interface into an object that is not necessarily tied to a graph?

Thanks

Body:
In previous versions, I registered Serilog.ILogger in the container as follows:

        builder.Register(context => PXTrace.Logger).As<ILogger>();

So that I could inject it into types registered in the container:

In 22R2 this seems to have stopped working, but there is no error. When I call _logger.Information("test"); or _logger.Error() nothing is written to the trace. I know one can use Microsofts ILogger interface to inject into a graph, but how does one inject a non generic ILogger interface into an object that is not necessarily tied to a graph?

Thanks


问:
Why I can't find a "smallest-height" attribute as the "smallest-width" attribute?
I have a ConstraintLayout and a TextView with layout_marginTop=@margin_dimen and layout_marginBottom=@margin_dimen attributes. As there are different screen sizes, the margin value should change according to the specific screen. I have thought of using something like "smallest-height" to have different margin_dimen values (different dimens.xml with different margin_dimen value according to the height of the device) as the margins I am using (marginTop and marginBottom) are dependent of the height of the device as if the device has a smallest height, the margin should be lower that the margin of a bigger device.

In short words, what I would like to have is something like this:

In dimens folder:

dimens.xml (sh300dp)

dimens.xml(sh400dp)

dimens.xml(sh600dp)

dimens.xml(sh700dp)

...

The problem is that I have only found an attribute for the width (smallest screen width) but not for the height. I would like to know how could I face this problem.


问:
How to extract sessions from bigquery
I am trying to extract sessions by day from two tables (using UNION ALL) and the total sessions is way overinflated.

```<code>SELECT
  date,
  channelGrouping,
  trafficSource.source,
  trafficSource.medium,
  trafficSource.campaign,
  trafficSource.adContent,
  geoNetwork.country,
  transaction.transactionId,
  appInfo.screenName,
  COUNT(DISTINCT CONCAT(fullvisitorId, CAST(visitId AS string), date)) AS sessions,
  SUM(totals.transactions) AS transactions,
  SUM(totals.transactionRevenue)/1000000 AS transactionRev,
FROM
  `source.table1.ga_sessions_*`,
  UNNEST(hits) AS hit
WHERE
  _table_suffix BETWEEN '20221101'
  AND '20221201'
  AND totals.visits = 1
GROUP BY
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9
UNION ALL
SELECT
  date,
  channelGrouping,
  trafficSource.source,
  trafficSource.medium,
  trafficSource.campaign,
  trafficSource.adContent,
  geoNetwork.country,
  transaction.transactionId,
  appInfo.screenName,
  COUNT(DISTINCT CONCAT(fullvisitorId, CAST(visitId AS string), date)) AS sessions,
  SUM(totals.transactions) AS transactions,
  SUM(totals.transactionRevenue)/1000000 AS transactionRev,
FROM
  `source.table2.ga_sessions_*`,
  UNNEST(hits) AS hit
WHERE
  _table_suffix BETWEEN '20221101'
  AND '20221201'
  AND totals.visits = 1
GROUP BY
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9
</code>```

I've used the query above and sessions (as well as revenue) is over inflated -- sometimes 3x for sessions and 70x for revenue... Am I aggregating the incorrect columns?

Title: How to extract sessions from bigquery

Body:
I am trying to extract sessions by day from two tables (using UNION ALL) and the total sessions is way overinflated.

SELECT
  date,
  channelGrouping,
  trafficSource.source,
  trafficSource.medium,
  trafficSource.campaign,
  trafficSource.adContent,
  geoNetwork.country,
  transaction.transactionId,
  appInfo.screenName,
  COUNT(DISTINCT CONCAT(fullvisitorId, CAST(visitId AS string), date)) AS sessions,
  SUM(totals.transactions) AS transactions,
  SUM(totals.transactionRevenue)/1000000 AS transactionRev,
FROM
  `source.table1.ga_sessions_*`,
  UNNEST(hits) AS hit
WHERE
  _table_suffix BETWEEN '20221101'
  AND '20221201'
  AND totals.visits = 1
GROUP BY
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9
UNION ALL
SELECT
  date,
  channelGrouping,
  trafficSource.source,
  trafficSource.medium,
  trafficSource.campaign,
  trafficSource.adContent,
  geoNetwork.country,
  transaction.transactionId,
  appInfo.screenName,
  COUNT(DISTINCT CONCAT(fullvisitorId, CAST(visitId AS string), date)) AS sessions,
  SUM(totals.transactions) AS transactions,
  SUM(totals.transactionRevenue)/1000000 AS transactionRev,
FROM
  `source.table2.ga_sessions_*`,
  UNNEST(hits) AS hit
WHERE
  _table_suffix BETWEEN '20221101'
  AND '20221201'
  AND totals.visits = 1
GROUP BY
  1,
  2,
  3,
  4,
  5,
  6,
  7,
  8,
  9

I've used the query above and sessions (as well as revenue) is over inflated -- sometimes 3x for sessions and 70x for revenue... Am I aggregating the incorrect columns?


问:
How do I automatically delete a line break (space) after my macro deletes a paragraph range in VBA?
So I currently have this code in a macro- which automatically searches for duplicate lines of text in a Word doc and deletes repeated lines. This code runs perfectly fine. However, when it deletes a line of text in my Word doc, there is an extra space between the line above and below the deleted paragraph range. I'm wondering how I can adapt this code in order to delete the extra space (line break) above the paragraph range. In some cases there is no extra space- so I would not want the code to delete the line above.

Code below:

```<code>DupCount = 0
' code below deletes the duplicate lines in the text- eliminate redundancies in cases where FY end and TTM are the same causing us to request the report twice
For Each p1 In WordApp.ActiveDocument.Paragraphs
  If p1.Range.Text <> vbCr Then 'Ignore blank paragraphs

    For Each p2 In WordApp.ActiveDocument.Paragraphs
      If p1.Range.Text = p2.Range.Text Then
        DupCount = DupCount + 1
        If p1.Range.Text = p2.Range.Text And DupCount > 1 Then p2.Range.Delete
      End If
    Next p2

  End If

  'Reset Duplicate Counter
    DupCount = 0

Next p1
</code>```

Body:
So I currently have this code in a macro- which automatically searches for duplicate lines of text in a Word doc and deletes repeated lines. This code runs perfectly fine. However, when it deletes a line of text in my Word doc, there is an extra space between the line above and below the deleted paragraph range. I'm wondering how I can adapt this code in order to delete the extra space (line break) above the paragraph range. In some cases there is no extra space- so I would not want the code to delete the line above.

Code below:

DupCount = 0
' code below deletes the duplicate lines in the text- eliminate redundancies in cases where FY end and TTM are the same causing us to request the report twice
For Each p1 In WordApp.ActiveDocument.Paragraphs
  If p1.Range.Text <> vbCr Then 'Ignore blank paragraphs

    For Each p2 In WordApp.ActiveDocument.Paragraphs
      If p1.Range.Text = p2.Range.Text Then
        DupCount = DupCount + 1
        If p1.Range.Text = p2.Range.Text And DupCount > 1 Then p2.Range.Delete
      End If
    Next p2

  End If

  'Reset Duplicate Counter
    DupCount = 0

Next p1


问:
Bootstrap - Navbar icon not showing up on mobile devices
I am trying to show a side navbar on mobile devices with Bootstrap but it does not show up on mobile devices. Not sure if I set something wrong - any tips how to narrow down the problem? I tried to set different style settings but couldnt figure out the root cause. Did I miss something especially in regards to expand the navbar?
html

```<code><!doctype html>
<html lang="en">
   <head>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
      <link rel="stylesheet" href="css/owl.carousel.min.css">
      <!-- Bootstrap CSS -->
      <link rel="stylesheet" href="css/bootstrap.min.css">
      <!-- Style -->
      <link rel="stylesheet" href="css/style.css">
   </head>
   <body>
      <div class="site-mobile-menu">
         <div class="site-mobile-menu-header">
            <div class="site-mobile-menu-close mt-3">
               <span class="icon-close2 js-menu-toggle"></span>
            </div>
         </div>
         <div class="site-mobile-menu-body">
         </div>
      </div>
      <header class="site-navbar" role="banner" style="background-color: white; opacity: 0.8;  border-bottom: 2px solid #6c7c98;" >
         <div class="container" >
            <div class="row align-items-center">
               <div class="col-11 col-xl-2">
                  <h1 class="mb-0 site-logo">
                  <a href="index.html" class="text-white mb-0">
                  <a href="#1">
                     <img style="height: 3; width: 12; border: 0; margin-bottom: 1vh" src="images/logo.png"; >
               </div>
               <div class="col-12 col-md-10 d-none d-xl-block">
               <nav class="site-navigation position-relative text-right" role="navigation">
               <ul class="site-menu js-clone-nav mr-auto d-none d-lg-block">
               <li><a href="#1"><span>1</span></a></li>
               <li><a href="#2"><span>2</span></a></li>
               <li class="has-children">
               <a href="#3"><span>3</span></a>
               <ul class="dropdown arrow-top">
               <li><a href="#4">4</a></li>
               <li><a href="#5>5</a></li>
               <li><a href="#6">6</a></li>
               </ul>
               </li>
               <li><a href="#7"><span>7</span></a></li>
               <li><a href="#8 "><span>8</span></a></li>
               </ul>
               </nav>
               </div>
               <div class="d-inline-block d-xl-none ml-md-0 mr-auto py-3" style="position: relative; top: 3px;"><a href="#" class="site-menu-toggle js-menu-toggle text-black"><span class="icon-menu h3"></span></a></div>
            </div>
         </div>
         </div>
         </div>
      </header>

</code>```

css

```<code>.site-mobile-menu {
  width: 300px;
  position: fixed;
  right: 0;
  z-index: 2000;
  padding-top: 20px;
  background: #fff;
  height: calc(100vh);
  -webkit-transform: translateX(110%);
  -ms-transform: translateX(110%);
  transform: translateX(110%);
  -webkit-box-shadow: -10px 0 20px -10px rgba(0, 0, 0, 0.1);
  box-shadow: -10px 0 20px -10px rgba(0, 0, 0, 0.1);
  -webkit-transition: .3s all ease-in-out;
  -o-transition: .3s all ease-in-out;
  transition: .3s all ease-in-out; }
  .offcanvas-menu .site-mobile-menu {
    -webkit-transform: translateX(0%);
    -ms-transform: translateX(0%);
    transform: translateX(0%); }
  .site-mobile-menu .site-mobile-menu-header {
    width: 100%;
    float: left;
    padding-left: 20px;
    padding-right: 20px; }
    .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-close {
      float: right;
      margin-top: 8px; }
      .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-close span {
        font-size: 30px;
        display: inline-block;
        padding-left: 10px;
        padding-right: 0px;
        line-height: 1;
        cursor: pointer;
        -webkit-transition: .3s all ease;
        -o-transition: .3s all ease;
        transition: .3s all ease; }
        .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-close span:hover {
          color: #f8f9fa; }
    .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-logo {
      float: left;
      margin-top: 10px;
      margin-left: 0px; }
      .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-logo a {
        display: inline-block;
        text-transform: uppercase; }
        .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-logo a img {
          max-width: 70px; }
        .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-logo a:hover {
          text-decoration: none; }
  .site-mobile-menu .site-mobile-menu-body {
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    position: relative;
    padding: 0 20px 20px 20px;
    height: calc(100vh - 52px);
    padding-bottom: 150px; }
  .site-mobile-menu .site-nav-wrap {
    padding: 0;
    margin: 0;
    list-style: none;
    position: relative; }
    .site-mobile-menu .site-nav-wrap a {
      padding: 10px 20px;
      display: block;
      position: relative;
      color: #212529; }
      .site-mobile-menu .site-nav-wrap a:hover {
        color: #005f6a; }
    .site-mobile-menu .site-nav-wrap li {
      position: relative;
      display: block; }
      .site-mobile-menu .site-nav-wrap li.active > a {
        color: #005f6a; }
    .site-mobile-menu .site-nav-wrap .arrow-collapse {
      position: absolute;
      right: 0px;
      top: 10px;
      z-index: 20;
      width: 36px;
      height: 36px;
      text-align: center;
      cursor: pointer;
      border-radius: 50%; }
      .site-mobile-menu .site-nav-wrap .arrow-collapse:hover {
        background: #f8f9fa; }
      .site-mobile-menu .site-nav-wrap .arrow-collapse:before {
        font-size: 12px;
        z-index: 20;
        font-family: "Alegreya Sans";
        content: "\f078";
        position: absolute;
        top: 50%;
        left: 50%;
        -webkit-transform: translate(-50%, -50%) rotate(-180deg);
        -ms-transform: translate(-50%, -50%) rotate(-180deg);
        transform: translate(-50%, -50%) rotate(-180deg);
        -webkit-transition: .3s all ease;
        -o-transition: .3s all ease;
        transition: .3s all ease; }
      .site-mobile-menu .site-nav-wrap .arrow-collapse.collapsed:before {
        -webkit-transform: translate(-50%, -50%);
        -ms-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%); }
    .site-mobile-menu .site-nav-wrap > li {
      display: block;
      position: relative;
      float: left;
      width: 100%; }
      .site-mobile-menu .site-nav-wrap > li > a {
        padding-left: 20px;
        font-size: 20px; }
      .site-mobile-menu .site-nav-wrap > li > ul {
        padding: 0;
        margin: 0;
        list-style: none; }
        .site-mobile-menu .site-nav-wrap > li > ul > li {
          display: block; }
          .site-mobile-menu .site-nav-wrap > li > ul > li > a {
            padding-left: 40px;
            font-size: 16px; }
          .site-mobile-menu .site-nav-wrap > li > ul > li > ul {
            padding: 0;
            margin: 0; }
            .site-mobile-menu .site-nav-wrap > li > ul > li > ul > li {
              display: block; }
              .site-mobile-menu .site-nav-wrap > li > ul > li > ul > li > a {
                font-size: 16px;
                padding-left: 60px; }
    .site-mobile-menu .site-nav-wrap[data-class="social"] {
      float: left;
      width: 100%;
      margin-top: 30px;
      padding-bottom: 5em; }
      .site-mobile-menu .site-nav-wrap[data-class="social"] > li {
        width: auto; }
        .site-mobile-menu .site-nav-wrap[data-class="social"] > li:first-child a {
          padding-left: 15px !important; }

</code>```

Body:
I am trying to show a side navbar on mobile devices with Bootstrap but it does not show up on mobile devices. Not sure if I set something wrong - any tips how to narrow down the problem? I tried to set different style settings but couldnt figure out the root cause. Did I miss something especially in regards to expand the navbar?
html

<!doctype html>

      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
      <link rel="stylesheet" href="css/owl.carousel.min.css">

      <link rel="stylesheet" href="css/bootstrap.min.css">

      <link rel="stylesheet" href="css/style.css">

1

2

               3

4

5

6

7

8

css

.site-mobile-menu {
  width: 300px;
  position: fixed;
  right: 0;
  z-index: 2000;
  padding-top: 20px;
  background: #fff;
  height: calc(100vh);
  -webkit-transform: translateX(110%);
  -ms-transform: translateX(110%);
  transform: translateX(110%);
  -webkit-box-shadow: -10px 0 20px -10px rgba(0, 0, 0, 0.1);
  box-shadow: -10px 0 20px -10px rgba(0, 0, 0, 0.1);
  -webkit-transition: .3s all ease-in-out;
  -o-transition: .3s all ease-in-out;
  transition: .3s all ease-in-out; }
  .offcanvas-menu .site-mobile-menu {
    -webkit-transform: translateX(0%);
    -ms-transform: translateX(0%);
    transform: translateX(0%); }
  .site-mobile-menu .site-mobile-menu-header {
    width: 100%;
    float: left;
    padding-left: 20px;
    padding-right: 20px; }
    .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-close {
      float: right;
      margin-top: 8px; }
      .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-close span {
        font-size: 30px;
        display: inline-block;
        padding-left: 10px;
        padding-right: 0px;
        line-height: 1;
        cursor: pointer;
        -webkit-transition: .3s all ease;
        -o-transition: .3s all ease;
        transition: .3s all ease; }
        .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-close span:hover {
          color: #f8f9fa; }
    .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-logo {
      float: left;
      margin-top: 10px;
      margin-left: 0px; }
      .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-logo a {
        display: inline-block;
        text-transform: uppercase; }
        .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-logo a img {
          max-width: 70px; }
        .site-mobile-menu .site-mobile-menu-header .site-mobile-menu-logo a:hover {
          text-decoration: none; }
  .site-mobile-menu .site-mobile-menu-body {
    overflow-y: scroll;
    -webkit-overflow-scrolling: touch;
    position: relative;
    padding: 0 20px 20px 20px;
    height: calc(100vh - 52px);
    padding-bottom: 150px; }
  .site-mobile-menu .site-nav-wrap {
    padding: 0;
    margin: 0;
    list-style: none;
    position: relative; }
    .site-mobile-menu .site-nav-wrap a {
      padding: 10px 20px;
      display: block;
      position: relative;
      color: #212529; }
      .site-mobile-menu .site-nav-wrap a:hover {
        color: #005f6a; }
    .site-mobile-menu .site-nav-wrap li {
      position: relative;
      display: block; }
      .site-mobile-menu .site-nav-wrap li.active > a {
        color: #005f6a; }
    .site-mobile-menu .site-nav-wrap .arrow-collapse {
      position: absolute;
      right: 0px;
      top: 10px;
      z-index: 20;
      width: 36px;
      height: 36px;
      text-align: center;
      cursor: pointer;
      border-radius: 50%; }
      .site-mobile-menu .site-nav-wrap .arrow-collapse:hover {
        background: #f8f9fa; }
      .site-mobile-menu .site-nav-wrap .arrow-collapse:before {
        font-size: 12px;
        z-index: 20;
        font-family: "Alegreya Sans";
        content: "\f078";
        position: absolute;
        top: 50%;
        left: 50%;
        -webkit-transform: translate(-50%, -50%) rotate(-180deg);
        -ms-transform: translate(-50%, -50%) rotate(-180deg);
        transform: translate(-50%, -50%) rotate(-180deg);
        -webkit-transition: .3s all ease;
        -o-transition: .3s all ease;
        transition: .3s all ease; }
      .site-mobile-menu .site-nav-wrap .arrow-collapse.collapsed:before {
        -webkit-transform: translate(-50%, -50%);
        -ms-transform: translate(-50%, -50%);
        transform: translate(-50%, -50%); }
    .site-mobile-menu .site-nav-wrap > li {
      display: block;
      position: relative;
      float: left;
      width: 100%; }
      .site-mobile-menu .site-nav-wrap > li > a {
        padding-left: 20px;
        font-size: 20px; }
      .site-mobile-menu .site-nav-wrap > li > ul {
        padding: 0;
        margin: 0;
        list-style: none; }
        .site-mobile-menu .site-nav-wrap > li > ul > li {
          display: block; }
          .site-mobile-menu .site-nav-wrap > li > ul > li > a {
            padding-left: 40px;
            font-size: 16px; }
          .site-mobile-menu .site-nav-wrap > li > ul > li > ul {
            padding: 0;
            margin: 0; }
            .site-mobile-menu .site-nav-wrap > li > ul > li > ul > li {
              display: block; }
              .site-mobile-menu .site-nav-wrap > li > ul > li > ul > li > a {
                font-size: 16px;
                padding-left: 60px; }
    .site-mobile-menu .site-nav-wrap[data-class="social"] {
      float: left;
      width: 100%;
      margin-top: 30px;
      padding-bottom: 5em; }
      .site-mobile-menu .site-nav-wrap[data-class="social"] > li {
        width: auto; }
        .site-mobile-menu .site-nav-wrap[data-class="social"] > li:first-child a {
          padding-left: 15px !important; }


问:
Multiple image arrays with prev and next buttons on one webpage javascript
I'm an absolute beginner with javascript and stuck on the last thing for the website I'm building. I have four image arrays on one webpage, all four have the same prev and next buttons. When I put the javascript files in the HTML of all the arrays this is what happens.

When you click on the prev and next buttons of arrays 1, 2, or 3, the images of array 4 are moving. If you use the prev or next button of array 4 nothing happens. How would it be working for each array? I hope to find a solution. You will help me a lot!

```<code><!--just the html of two arrays-->
<div><img src="images/boek_tantes01.jpg" class="detantesboek-images"></div>
    <div><button class="pijl-links" id="prev_01"><img src="images/pijl_links.svg"></button></div>
    <div><button class="pijl-rechts" id="next_01"><img src="images/pijl_rechts.svg"></button></div>
</div>
<div></div>

<div></div>
<div>
<div><img src="images/boek_se_1.jpg" class="detantesspec-images"></div>
    <div><button class="pijl-links" id="prev_02"><img src="images/pijl_links.svg"></button></div>
    <div><button class="pijl-rechts" id="next_02"><img src="images/pijl_rechts.svg"></button></div>
</code>```

The javascript of two arrays, the other two are the same only with different file names. I have tried different button names. I can solve it to make 4 separate pages but I don't prefer this.

```<code>var slider_img = document.querySelector('.detantesboek-images');
var images = ['boek_tantes01.jpg', 'boek_tantes02.jpg', 'boek_tantes03.jpg', 'boek_tantes04.jpg', 'boek_tantes05.jpg', 'boek_tantes06.jpg','boek_tantes07.jpg'];
var current_image = 0;

document.getElementById("prev_01").addEventListener("click", prev);
document.getElementById("next_01").addEventListener("click", next);

function prev(){
    if(current_image <= 0) current_image = images.length;
    current_image--;
    return setImg();
}

function next(){
    if(current_image >= images.length-1) current_image = -1;
    current_image++;
    return setImg();
}

function setImg(){
    return slider_img.setAttribute('src', "images/"+images[current_image]);

}

var slider_img = document.querySelector('.detantesspec-images');
var images = ['boek_se_1.jpg', 'boek_se_2.jpg', 'boek_se_3.jpg', 'boek_se_4.jpg', 'boek_se_5.jpg'];
var current_image = 0;

document.getElementById("prev_02").addEventListener("click", prev);
document.getElementById("next_02").addEventListener("click", next);

function prev(){
    if(current_image <= 0) current_image = images.length;
    current_image--;
    return setImg();
}

function next(){
    if(current_image >= images.length-1) current_image = -1;
    current_image++;
    return setImg();
}

function setImg(){
    return slider_img.setAttribute('src', "images/"+images[current_image]);

}
</code>```

Body:
I'm an absolute beginner with javascript and stuck on the last thing for the website I'm building. I have four image arrays on one webpage, all four have the same prev and next buttons. When I put the javascript files in the HTML of all the arrays this is what happens.

When you click on the prev and next buttons of arrays 1, 2, or 3, the images of array 4 are moving. If you use the prev or next button of array 4 nothing happens. How would it be working for each array? I hope to find a solution. You will help me a lot!

<button class="pijl-links" id="prev_01"></button>

<button class="pijl-rechts" id="next_01"></button>

<button class="pijl-links" id="prev_02"></button>

<button class="pijl-rechts" id="next_02"></button>

The javascript of two arrays, the other two are the same only with different file names. I have tried different button names. I can solve it to make 4 separate pages but I don't prefer this.

var slider_img = document.querySelector('.detantesboek-images');
var images = ['boek_tantes01.jpg', 'boek_tantes02.jpg', 'boek_tantes03.jpg', 'boek_tantes04.jpg', 'boek_tantes05.jpg', 'boek_tantes06.jpg','boek_tantes07.jpg'];
var current_image = 0;

document.getElementById("prev_01").addEventListener("click", prev);
document.getElementById("next_01").addEventListener("click", next);

function prev(){
    if(current_image <= 0) current_image = images.length;
    current_image--;
    return setImg();
}

function next(){
    if(current_image >= images.length-1) current_image = -1;
    current_image++;
    return setImg();
}

function setImg(){
    return slider_img.setAttribute('src', "images/"+images[current_image]);

}

var slider_img = document.querySelector('.detantesspec-images');
var images = ['boek_se_1.jpg', 'boek_se_2.jpg', 'boek_se_3.jpg', 'boek_se_4.jpg', 'boek_se_5.jpg'];
var current_image = 0;

document.getElementById("prev_02").addEventListener("click", prev);
document.getElementById("next_02").addEventListener("click", next);

function prev(){
    if(current_image <= 0) current_image = images.length;
    current_image--;
    return setImg();
}

function next(){
    if(current_image >= images.length-1) current_image = -1;
    current_image++;
    return setImg();
}

function setImg(){
    return slider_img.setAttribute('src', "images/"+images[current_image]);

}


问:
In PyTorch 1.11 why was `torch.backends.cuda.matmul.allow_tf32` flag disabled by default?
I was reading the documentation and came across this flag, which was turned off by default in PyTorch 1.11. My question is why did this occur/ if someone can point me to the change.</p>


问:
"You are not authorized to perform the requested action cf route sharing" while setup of route sharing
I'm trying to share a route between 2 spaces to avoid downtime while moving an app from a space (originspace) into another space (otherspace).
We're using SAP BTP Cloud Foundry runtime for the app

I found the process at
https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#share-route

cf target -o orgname-s originspace
cf8 enable-feature-flag route_sharing
cf8 share-route example.com --hostname exampleroutehost -s otherspace -o orgname
```
<p>But I get the following message</p>
<blockquote>
<p>Enabling feature flag route_sharing as myemail@example.com...</p>
<p>You are not authorized to perform the requested action</p>
<p>FAILED</p>
<p>Sharing route exampleroutehost .example.com to space otherspace as myemail@example.com</p>
<p>Feature Disabled: route_sharing</p>
<p>FAILED</p>
</blockquote>
<p>I already have the role <code>ORG_MANAGER</code> and <code>ORG_AUDITOR</code> for the organization and spaces.
I have also checked that Cloud Foundry only has some privileges for the admin user but it either doesn't exist for BTP or I don't have access to it.</p>
<p>I tried checking which feature flags I have enabled</p>
<pre class="lang-bash prettyprint-override"><code>$ cf8 feature-flags
Getting feature flags as myemail@example.com...

name                                          state
app_bits_upload                               enabled
app_scaling                                   enabled
diego_docker                                  enabled
env_var_visibility                            enabled
hide_marketplace_from_unauthenticated_users   disabled
private_domain_creation                       enabled
resource_matching                             enabled
route_creation                                enabled
route_sharing                                 disabled
service_instance_creation                     enabled
service_instance_sharing                      enabled
set_roles_by_username                         enabled
space_developer_env_var_visibility            enabled
space_scoped_private_broker_creation          enabled
task_creation                                 enabled
unset_roles_by_username                       enabled
user_org_creation                             disabled

</code>```

Please tell me how to access to the user admin or how to enable route sharing

Body:
I'm trying to share a route between 2 spaces to avoid downtime while moving an app from a space (originspace) into another space (otherspace).
We're using SAP BTP Cloud Foundry runtime for the app

I found the process at
https://docs.cloudfoundry.org/devguide/deploy-apps/routes-domains.html#share-route

cf target -o orgname-s originspace
cf8 enable-feature-flag route_sharing
cf8 share-route example.com --hostname exampleroutehost -s otherspace -o orgname

But I get the following message

Enabling feature flag route_sharing as myemail@example.com...

You are not authorized to perform the requested action

FAILED

Sharing route exampleroutehost .example.com to space otherspace as myemail@example.com

Feature Disabled: route_sharing

FAILED

I already have the role ORG_MANAGER and ORG_AUDITOR for the organization and spaces.
I have also checked that Cloud Foundry only has some privileges for the admin user but it either doesn't exist for BTP or I don't have access to it.

I tried checking which feature flags I have enabled

$ cf8 feature-flags
Getting feature flags as myemail@example.com...

name                                          state
app_bits_upload                               enabled
app_scaling                                   enabled
diego_docker                                  enabled
env_var_visibility                            enabled
hide_marketplace_from_unauthenticated_users   disabled
private_domain_creation                       enabled
resource_matching                             enabled
route_creation                                enabled
route_sharing                                 disabled
service_instance_creation                     enabled
service_instance_sharing                      enabled
set_roles_by_username                         enabled
space_developer_env_var_visibility            enabled
space_scoped_private_broker_creation          enabled
task_creation                                 enabled
unset_roles_by_username                       enabled
user_org_creation                             disabled

Please tell me how to access to the user admin or how to enable route sharing


问:
can i add shadow on a widget in PyQt5 using CSS?
i can add shadow on a widget in pyqt5 using setGraphicsEffect but i want to do it using css.

widget.setGraphicsEffect(QtWidgets.QGraphicsDropShadowEffect(blurRadius=20.0,xOffset=0.0,yOffset=0.0,color=QtGui.QColor(0,0,0,200)))
```

is there a way to do it by CSS ?

Body:
i can add shadow on a widget in pyqt5 using setGraphicsEffect but i want to do it using css.

widget.setGraphicsEffect(QtWidgets.QGraphicsDropShadowEffect(blurRadius=20.0,xOffset=0.0,yOffset=0.0,color=QtGui.QColor(0,0,0,200)))

is there a way to do it by CSS ?


问:
How can I access to a value in Excel using Pandas with subcolumns?
I am trying to read a value from a cell which is located in a subcolumn of a big column. I want to read it by using the string labels and not the integers.

How can I access the value '%' of Product1 in 'Step1' using df.loc?

I am trying

```<code>df.loc['Step1', 'Product1','%']
</code>```

but it doesnt function. Thank you for your help

Body:
I am trying to read a value from a cell which is located in a subcolumn of a big column. I want to read it by using the string labels and not the integers.

How can I access the value '%' of Product1 in 'Step1' using df.loc?

I am trying

df.loc['Step1', 'Product1','%']

but it doesnt function. Thank you for your help


问:
multiple services trying to connect to the same db container
I have this docker-compose file:

```<code>version: "3.9"

services:
  producer:
    build:
      context: ./producer
      dockerfile: Dockerfile.producer
      target: prod
    ports:
      - 8080:8080
    env_file:
      - ./producer/producer.env
    depends_on:
      - db
    networks:
      - network-db

  cleanup:
    build:
      context: ./cleanup
      dockerfile: Dockerfile.cleanup
      target: prod
    ports:
      - 4040:4040
    env_file:
      - ./cleanup/cleanup.env
    depends_on:
      - producer
    networks:
      - network-db

  db:
    image: postgres
    env_file:
      - .env
    volumes:
      - postgres-data:/var/lib/postgresql/data
    ports:
      - 5432:5432
    networks:
      - network-db
    restart: always

volumes:
  postgres-data:

networks:
  network-db:
    driver: bridge
</code>```

And in both of the producer and cleanup services' codebase, I try to connect to the same port, which is 5432, like so:

```<code>configData := fmt.Sprintf("postgres://%v:%v@%v:%v/%v?sslmode=disable",
    pgUser,
    pgPassword,
    pgHost,
    pgPort, // 5432
    pgName,
)

GDB, err = gorm.Open(postgres.Open(configData), &gorm.Config{})
</code>```

At the moment I get a connection refused error and I am assuming it is something to do with the port.
So my question is, can db image handle connections from multiple services on the same port (5432). If not, then what is the better way to solve the problem?

Btw, .env files should not be the source of the issue since they match.. (port=5432, host=db, etc.)

Body:
I have this docker-compose file:

version: "3.9"

services:
  producer:
    build:
      context: ./producer
      dockerfile: Dockerfile.producer
      target: prod
    ports:
      - 8080:8080
    env_file:
      - ./producer/producer.env
    depends_on:
      - db
    networks:
      - network-db

  cleanup:
    build:
      context: ./cleanup
      dockerfile: Dockerfile.cleanup
      target: prod
    ports:
      - 4040:4040
    env_file:
      - ./cleanup/cleanup.env
    depends_on:
      - producer
    networks:
      - network-db

  db:
    image: postgres
    env_file:
      - .env
    volumes:
      - postgres-data:/var/lib/postgresql/data
    ports:
      - 5432:5432
    networks:
      - network-db
    restart: always

volumes:
  postgres-data:

networks:
  network-db:
    driver: bridge

And in both of the producer and cleanup services' codebase, I try to connect to the same port, which is 5432, like so:

configData := fmt.Sprintf("postgres://%v:%v@%v:%v/%v?sslmode=disable",
    pgUser,
    pgPassword,
    pgHost,
    pgPort, // 5432
    pgName,
)

GDB, err = gorm.Open(postgres.Open(configData), &gorm.Config{})

At the moment I get a connection refused error and I am assuming it is something to do with the port.
So my question is, can db image handle connections from multiple services on the same port (5432). If not, then what is the better way to solve the problem?

Btw, .env files should not be the source of the issue since they match.. (port=5432, host=db, etc.)


问:
Recording a video with MediaStore.ACTION_VIDEO_CAPTURE fails on Android 13
When I'm trying to Record a video with MediaStore.ACTION_VIDEO_CAPTURE on Android 13, the app crashes.

```<code>java.lang.NullPointerException: Attempt to invoke virtual method 'void android.content.ContentValues.put(java.lang.String, java.lang.Long)' on a null object reference
    at com.android.camera.VideoModule.saveVideo(VideoModule.java:1263)
    at com.android.camera.VideoModule.stopVideoRecording(VideoModule.java:1513)
    at com.android.camera.VideoModule.onStopVideoRecording(VideoModule.java:656)
    at com.android.camera.VideoModule.onShutterButtonClick(VideoModule.java:697)
    at com.android.camera.ShutterButton.performClick(ShutterButton.java:190)
    at android.view.View.performClickInternal(View.java:7483)
    at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
    at android.view.View$PerformClick.run(View.java:29334)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7872)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
</code>```

My code:

```<code>    Intent(MediaStore.ACTION_VIDEO_CAPTURE).also { takePictureIntent ->
        // Ensure that there's a camera activity to handle the intent
        takePictureIntent.resolveActivity(packageManager)?.also {
            // Create the File where the photo should go
            val videoFile: File? = try {
                createVideoFile()
            } catch (ex: IOException) {
                // Error occurred while creating the File
                null
            }
            // Continue only if the File was successfully created
            videoFile?.also {
                val videoUri: Uri = FileProvider.getUriForFile(
                    this@MainActivity,
                    "com.cameralbum.fileprovider",
                    it
                )

                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri)
                startActivityForResult(takePictureIntent, REQUEST_TAKE_VIDEO)
            }
        }

    }
</code>```

This code works and records videos starting from Android 6 to Android 12 included.

Any help will be very appreciated.

Thanks

Body:
When I'm trying to Record a video with MediaStore.ACTION_VIDEO_CAPTURE on Android 13, the app crashes.

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.content.ContentValues.put(java.lang.String, java.lang.Long)' on a null object reference
    at com.android.camera.VideoModule.saveVideo(VideoModule.java:1263)
    at com.android.camera.VideoModule.stopVideoRecording(VideoModule.java:1513)
    at com.android.camera.VideoModule.onStopVideoRecording(VideoModule.java:656)
    at com.android.camera.VideoModule.onShutterButtonClick(VideoModule.java:697)
    at com.android.camera.ShutterButton.performClick(ShutterButton.java:190)
    at android.view.View.performClickInternal(View.java:7483)
    at android.view.View.-$$Nest$mperformClickInternal(Unknown Source:0)
    at android.view.View$PerformClick.run(View.java:29334)
    at android.os.Handler.handleCallback(Handler.java:942)
    at android.os.Handler.dispatchMessage(Handler.java:99)
    at android.os.Looper.loopOnce(Looper.java:201)
    at android.os.Looper.loop(Looper.java:288)
    at android.app.ActivityThread.main(ActivityThread.java:7872)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)

My code:

    Intent(MediaStore.ACTION_VIDEO_CAPTURE).also { takePictureIntent ->
        // Ensure that there's a camera activity to handle the intent
        takePictureIntent.resolveActivity(packageManager)?.also {
            // Create the File where the photo should go
            val videoFile: File? = try {
                createVideoFile()
            } catch (ex: IOException) {
                // Error occurred while creating the File
                null
            }
            // Continue only if the File was successfully created
            videoFile?.also {
                val videoUri: Uri = FileProvider.getUriForFile(
                    this@MainActivity,
                    "com.cameralbum.fileprovider",
                    it
                )

                takePictureIntent.putExtra(MediaStore.EXTRA_OUTPUT, videoUri)
                startActivityForResult(takePictureIntent, REQUEST_TAKE_VIDEO)
            }
        }

    }

This code works and records videos starting from Android 6 to Android 12 included.

Any help will be very appreciated.

Thanks


问:
Error while loading shared libraries: ?: cannot open shared object file
When I run my Makefile, it gives me the following error:

E:/Cygwin/lib/gcc/x86_64-pc-cygwin/11/cc1plus.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

It doesn't specify which library is missing?

This is my Makefile:

```<code>CC:= E:\Cygwin\bin\gcc.exe
CXX:= E:\Cygwin\bin\g++.exe
CFLAGS=-O3 -fopenmp -std=c99
CXXFLAGS=-O3 -fopenmp

all: daxpy

daxpy: daxpy.cpp
    $(CXX) $(CFLAGS) -o daxpy daxpy.cpp $(CXXFLAGS)

clean:
    rm -f $(EXECS) *.o
</code>```

I had to specify my compiler path, because otherwise it couldn't find it.

(It gave me the error make: g++: No such file or directory until I changed it this way)

Does anyone have any ideas? It seems to not be able to find certain things, because I also get an undefined reference to 'omp_get_wtime' error when I run my main function.

Body:
When I run my Makefile, it gives me the following error:

E:/Cygwin/lib/gcc/x86_64-pc-cygwin/11/cc1plus.exe: error while loading shared libraries: ?: cannot open shared object file: No such file or directory

It doesn't specify which library is missing?

This is my Makefile:

CC:= E:\Cygwin\bin\gcc.exe
CXX:= E:\Cygwin\bin\g++.exe
CFLAGS=-O3 -fopenmp -std=c99
CXXFLAGS=-O3 -fopenmp

all: daxpy

daxpy: daxpy.cpp
    $(CXX) $(CFLAGS) -o daxpy daxpy.cpp $(CXXFLAGS)

clean:
    rm -f $(EXECS) *.o

I had to specify my compiler path, because otherwise it couldn't find it.

(It gave me the error make: g++: No such file or directory until I changed it this way)

Does anyone have any ideas? It seems to not be able to find certain things, because I also get an undefined reference to 'omp_get_wtime' error when I run my main function.


问:
Dockerize hosted blazor wasm - Cannot find blazor.webassembly.js”
When I try to run my hosted Blazor app (with backend Api, .net core 6) as a Docker container, I get the error

Loading failed for the


问:
Datatable search by ID of username
Objective: row Data filter according to specific column data (username) values.

Action: searching data table. Search string: ID = username

I have following in code.gs.

```<code> function getData() {
  var ss = SpreadsheetApp.getActiveSpreadsheet()
 var sheet = ss.getSheets()[0]
 var range = sheet.getDataRange()
 var values = range.getDisplayValues()
 Logger.log(values)
 return values
}
</code>```

then I used following code in datatable.html

```<code>google.script.run.withSuccessHandler(createTable).getData();

function createTable(dataArray) {
 var username = document.getElementById("username").value;
    console.log(dataArray)
      $('#btn-close').click()
      $(document).ready(function(){
      $('#dataTable').DataTable({
        "oSearch": {"sSearch": username}, // data search according to username expected
      data: dataArray.slice(1),
     columns: [
      { title: "Number" }, //....more columns below.
</code>```

Observation: No filtering. All data in sheet is displaying in the table.

Check: I replaced  "oSearch": {"sSearch": username} to  "oSearch": {"sSearch": "user1"} //  user1 is one of username (data in the filtering column.)
Data filtering as I want. //trying to obtain same result using USERNAME search

Please help me to filter row data according to specific column data (username) values.

Title: Datatable search by ID of username

Body:
Objective: row Data filter according to specific column data (username) values.

Action: searching data table. Search string: ID = username

I have following in code.gs.

 function getData() {
  var ss = SpreadsheetApp.getActiveSpreadsheet()
 var sheet = ss.getSheets()[0]
 var range = sheet.getDataRange()
 var values = range.getDisplayValues()
 Logger.log(values)
 return values
}

then I used following code in datatable.html

google.script.run.withSuccessHandler(createTable).getData();

function createTable(dataArray) {
 var username = document.getElementById("username").value;
    console.log(dataArray)
      $('#btn-close').click()
      $(document).ready(function(){
      $('#dataTable').DataTable({
        "oSearch": {"sSearch": username}, // data search according to username expected
      data: dataArray.slice(1),
     columns: [
      { title: "Number" }, //....more columns below.

Observation: No filtering. All data in sheet is displaying in the table.

Check: I replaced  "oSearch": {"sSearch": username} to  "oSearch": {"sSearch": "user1"} //  user1 is one of username (data in the filtering column.)
Data filtering as I want. //trying to obtain same result using USERNAME search

Please help me to filter row data according to specific column data (username) values.