问:
Dragging window by title bar overrides ComponentListener setLocation()
I am trying to get the window of my program to resize and reposition when it is dragged to a different monitor. The current code I have achieves this but doesn't work 100% as intended. When the window is dragged to another screen the JFrame is resized but it only gets set to the new location if the user releases the mouse immediately after entering the new window. Is there a way to execute this so the users mouse drag doesn't override the setLocation()?

Example:

```<code>import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class FrameTest extends JFrame
{
   JPanel pnl;
   JLabel lbl;
   GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
   GraphicsDevice[] gs = ge.getScreenDevices();
   GraphicsConfiguration gsx = FrameTest.this.getGraphicsConfiguration();

   String OriginScreen = String.valueOf(gsx);
   String CurrentScreen = String.valueOf(gsx);

   public FrameTest()
   {
      setSize(1100,800);
      setLocationRelativeTo(null);
      setTitle("Frame Test");
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      pnl = new JPanel();
      lbl = new JLabel("This is my Frame");

      add(pnl);
      pnl.add(lbl);

      setVisible(true);
      FrameTest.this.addComponentListener(new CL());

   }

   public class CL implements ComponentListener
   {

    @Override
    public void componentShown(ComponentEvent evt)
    {
    }

    @Override
    public void componentResized(ComponentEvent e)
    {
    }

    @Override
    public void componentMoved(ComponentEvent e)
    {
         gsx = FrameTest.this.getGraphicsConfiguration();
         CurrentScreen = String.valueOf(gsx);
         System.out.println("Origin Screen: " + OriginScreen);
         System.out.println("Current Screen: " + CurrentScreen);
         if(!OriginScreen.equals(CurrentScreen))
         {
            int X = (int)Math.round(FrameTest.this.getGraphicsConfiguration().getBounds().getX());
            FrameTest.this.setLocation(X,0);
            OriginScreen = String.valueOf(gsx);
            System.out.println("Screen Switch Detected");
            int iW = (int)Math.round(FrameTest.this.getGraphicsConfiguration().getBounds().getWidth());
            int iH = (int)Math.round(FrameTest.this.getGraphicsConfiguration().getBounds().getHeight());
            iW = iW - 10;
            iH = iH - 10;
            FrameTest.this.setSize(iW,iH);

         }
         System.out.println("Frame Moved");
    }

    @Override
    public void componentHidden(ComponentEvent e)
    {
    }
   }
   public static void main( String[] args )
   {
      new FrameTest();
   }
}
</code>```

Body:
I am trying to get the window of my program to resize and reposition when it is dragged to a different monitor. The current code I have achieves this but doesn't work 100% as intended. When the window is dragged to another screen the JFrame is resized but it only gets set to the new location if the user releases the mouse immediately after entering the new window. Is there a way to execute this so the users mouse drag doesn't override the setLocation()?

Example:

import javax.swing.*;
import java.awt.event.*;
import java.awt.*;

public class FrameTest extends JFrame
{
   JPanel pnl;
   JLabel lbl;
   GraphicsEnvironment ge = GraphicsEnvironment.getLocalGraphicsEnvironment();
   GraphicsDevice[] gs = ge.getScreenDevices();
   GraphicsConfiguration gsx = FrameTest.this.getGraphicsConfiguration();

   String OriginScreen = String.valueOf(gsx);
   String CurrentScreen = String.valueOf(gsx);

   public FrameTest()
   {
      setSize(1100,800);
      setLocationRelativeTo(null);
      setTitle("Frame Test");
      setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

      pnl = new JPanel();
      lbl = new JLabel("This is my Frame");

      add(pnl);
      pnl.add(lbl);

      setVisible(true);
      FrameTest.this.addComponentListener(new CL());

   }

   public class CL implements ComponentListener
   {

    @Override
    public void componentShown(ComponentEvent evt)
    {
    }

    @Override
    public void componentResized(ComponentEvent e)
    {
    }

    @Override
    public void componentMoved(ComponentEvent e)
    {
         gsx = FrameTest.this.getGraphicsConfiguration();
         CurrentScreen = String.valueOf(gsx);
         System.out.println("Origin Screen: " + OriginScreen);
         System.out.println("Current Screen: " + CurrentScreen);
         if(!OriginScreen.equals(CurrentScreen))
         {
            int X = (int)Math.round(FrameTest.this.getGraphicsConfiguration().getBounds().getX());
            FrameTest.this.setLocation(X,0);
            OriginScreen = String.valueOf(gsx);
            System.out.println("Screen Switch Detected");
            int iW = (int)Math.round(FrameTest.this.getGraphicsConfiguration().getBounds().getWidth());
            int iH = (int)Math.round(FrameTest.this.getGraphicsConfiguration().getBounds().getHeight());
            iW = iW - 10;
            iH = iH - 10;
            FrameTest.this.setSize(iW,iH);

         }
         System.out.println("Frame Moved");
    }

    @Override
    public void componentHidden(ComponentEvent e)
    {
    }
   }
   public static void main( String[] args )
   {
      new FrameTest();
   }
}


来源: stackexchange

问:
Use the result of multiple select dropdown in case statement
I have a vue multi-select component and I need when the user selects an item to get the data from SQL. The user can select up to 4 items. I am struggling to figure out how to do it.

I tried this code in sql and it works if I select two apps but I need to do a condition when I select more or less and I am stuck

```<code>Declare @item  nvarchar(max)='App1,App2';
SET @sqlApp = Replace(@item  , ',', '.');
------------------- select using parse function------------
select
user,
count(case when app = PARSENAME(@item  ,1) then 1 end) as app1,
count(case when app  = PARSENAME(@item  ,2) then 1 end) as app2
from AppTable
group by user
order by count(*) desc
</code>```

ContentLicense: CC BY-SA 4.0

Body:
I have a vue multi-select component and I need when the user selects an item to get the data from SQL. The user can select up to 4 items. I am struggling to figure out how to do it.

I tried this code in sql and it works if I select two apps but I need to do a condition when I select more or less and I am stuck

Declare @item  nvarchar(max)='App1,App2';
SET @sqlApp = Replace(@item  , ',', '.');
------------------- select using parse function------------
select
user,
count(case when app = PARSENAME(@item  ,1) then 1 end) as app1,
count(case when app  = PARSENAME(@item  ,2) then 1 end) as app2
from AppTable
group by user
order by count(*) desc


问:
Create one Topic per user - know anti pattern or design-pattern?
Before I asked, I'm read these links:

https://github.com/apache/pulsar/issues/3302

Is creating a lot of topics with pulsar is a good scenario?

But I'm not sure about the responses.
My use case: We use SSE technology (Server Sent Event) protocol to send event from backend to client browser side to have a reactive behaviour. If the client lost the connection due to network failure, I want the browser code can get all events published since the last message id when the connection is restored.
The idea: have one topic by user, and when the browser call the get method, I use the Reader API to browse all msg since this message id.
My problem is the scalability of the solution: what happend if I reach 10.000 users, 100.000 ...
connected to the website ?

Regards


问:
How to fix/process a bad XML file
My application needs to parse XML files provided by the user, so I don't have control over its quality.

I have an XML which is incorrect, snippet I have shared below. Notice the missing prefix, xmlns:=

```<code><?xml version="1.0" encoding="utf-8" ?>
<ncx version="2005-1" xml:lang="por" xmlns:="http://www.daisy.org/z3986/2005/ncx/">
</ncx>
</code>```

When I try to use XDocument.Load() in C#, it throws this exception and rightly so -

```<code>System.Xml.XmlException: 'Name cannot begin with the '=' character, hexadecimal value 0x3D. Line 2, position 44.'
</code>```

Is there a way I can correct such minor errors in the XML? I tried looking for it but didn't find any good solution. And I want to avoid string search/replace to fix such errors.

Title: How to fix/process a bad XML file

Body:
My application needs to parse XML files provided by the user, so I don't have control over its quality.

I have an XML which is incorrect, snippet I have shared below. Notice the missing prefix, xmlns:=

<?xml version="1.0" encoding="utf-8" ?>
<ncx version="2005-1" xml:lang="por" xmlns:="http://www.daisy.org/z3986/2005/ncx/">
</ncx>

When I try to use XDocument.Load() in C#, it throws this exception and rightly so -

System.Xml.XmlException: 'Name cannot begin with the '=' character, hexadecimal value 0x3D. Line 2, position 44.'

Is there a way I can correct such minor errors in the XML? I tried looking for it but didn't find any good solution. And I want to avoid string search/replace to fix such errors.


问:
how to make the same design work on all screens?
I made a draggable FAB. Can only be dragged horizontally. But it's not working correctly on other screens. Let me show with SS.

İt's from emulator:

İt's from real device:

And there is my FAB Controller class

```<code>class FabController extends GetxController {
  double width = 0.0;
  double height = 0.0;
  var offset = FABButonDefaultKonum.obs;

  moveFab(Offset newOffset) {
    offset.value = newOffset;

    update();
  }

  @override
  void dispose() {

    super.dispose();
  }
}
</code>```

There is my constants class:

```<code>double newHeight = Get.size.height - padding.top - padding.bottom;
double newWidth = Get.size.width - padding.right - padding.left;
Offset FABButonDefaultKonum = Offset(newWidth * 0.8, newHeight * 0.85);
</code>```

And last one is Fab button:

```<code>Obx(
                    () {

                      return Positioned(
                        left: fabController.offset.value.dx,
                        top: fabController.offset.value.dy ,
                        child: Draggable(
                          axis: Axis.horizontal,
                          feedback: Container(
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(25),
                              color: Color(0xff3498DB),
                            ),
                            child: FloatingActionButton(
                                key: fabKey,
                                backgroundColor: Color(0xff3498DB),
                                child: const Icon(Icons.shopping_cart),
                                onPressed: () {
                                  print(fabController.offset);
                                }),
                          ),
                          child: Obx(
                            () {

                              return Badge();
                            },
                          ),
                          childWhenDragging: Container(),
                          onDragEnd: (details) {
                            Offset newOffset = details.offset;

                            if (details.offset.dx <= newWidth / 2) {
                              newOffset =
                                  Offset(newWidth * 0.05, newHeight * 0.90);
                            } else {
                              newOffset =
                                  Offset(newWidth * 0.8, newHeight * 0.90);
                            }

                            if (!_isLeave) fabController.moveFab(newOffset);

                            print(fabController.offset.value.toString() +
                                " ***");
                          },
                          onDragStarted: () {
                            _isLeave = false;
                          },
                        ),
                      );
                    },
                  ),
</code>```

Please help me. How can I make a responsive design?

I tried Get.height and Get.width. But didn't work.

Body:
I made a draggable FAB. Can only be dragged horizontally. But it's not working correctly on other screens. Let me show with SS.

İt's from emulator:

İt's from real device:

And there is my FAB Controller class

class FabController extends GetxController {
  double width = 0.0;
  double height = 0.0;
  var offset = FABButonDefaultKonum.obs;

  moveFab(Offset newOffset) {
    offset.value = newOffset;

    update();
  }

  @override
  void dispose() {

    super.dispose();
  }
}

There is my constants class:

double newHeight = Get.size.height - padding.top - padding.bottom;
double newWidth = Get.size.width - padding.right - padding.left;
Offset FABButonDefaultKonum = Offset(newWidth * 0.8, newHeight * 0.85);

And last one is Fab button:

Obx(
                    () {

                      return Positioned(
                        left: fabController.offset.value.dx,
                        top: fabController.offset.value.dy ,
                        child: Draggable(
                          axis: Axis.horizontal,
                          feedback: Container(
                            decoration: BoxDecoration(
                              borderRadius: BorderRadius.circular(25),
                              color: Color(0xff3498DB),
                            ),
                            child: FloatingActionButton(
                                key: fabKey,
                                backgroundColor: Color(0xff3498DB),
                                child: const Icon(Icons.shopping_cart),
                                onPressed: () {
                                  print(fabController.offset);
                                }),
                          ),
                          child: Obx(
                            () {

                              return Badge();
                            },
                          ),
                          childWhenDragging: Container(),
                          onDragEnd: (details) {
                            Offset newOffset = details.offset;

                            if (details.offset.dx <= newWidth / 2) {
                              newOffset =
                                  Offset(newWidth * 0.05, newHeight * 0.90);
                            } else {
                              newOffset =
                                  Offset(newWidth * 0.8, newHeight * 0.90);
                            }

                            if (!_isLeave) fabController.moveFab(newOffset);

                            print(fabController.offset.value.toString() +
                                " ***");
                          },
                          onDragStarted: () {
                            _isLeave = false;
                          },
                        ),
                      );
                    },
                  ),

Please help me. How can I make a responsive design?

I tried Get.height and Get.width. But didn't work.


问:
Change Report creation directory (Extent Report)
I am using the extent-report-adapter for cucumber7 in my project. Everything is fine, the reports are generated correctly. The problem is that they are generated in my root directory and I need them to be generated in a folder called target that is already created in my root directory, this would help me not to accumulate the reports in my directory and not have to delete them by hand, honestly I have looked everywhere and tried several things but I can not find the solution.

I leave here the configuration files that I am using.

extent.properties

```<code>extent.reporter.spark.start=true
extent.reporter.spark.out=report/automation-testing-report.html
extent.reporter.spark.config=src/test/resources/spark-config.xml

#test,exception,category,device,author,log,dashboard - default order
extent.reporter.spark.vieworder=dashboard,test,exception,category,device,author

#Status filter
#extent.reporter.statusfilter=Fail

#embed image as base64 string src. Default is false
#extent.reporter.spark.base64imagesrc=true

#enable device & author. Default is false
extent.reporter.spark.enable.device=true
extent.reporter.spark.enable.author=true

#prefix for device & author. Default is '@dev_' and '@aut_', case ignored
#only considered if 'enabledevice' & 'enableauthor' are set to true
#extent.reporter.spark.prefix.device=@device_
#extent.reporter.spark.prefix.author=@author_

screenshot.dir=test-output/screenshots/
screenshot.rel.path=../screenshots/

#time format 29-Feb-20 14-14-14'
basefolder.dir=target
basefolder.name=reports
basefolder.datetimepattern=d-MMM-YY HH-mm-ss

</code>```

spark-config.xml

```<code><?xml version="1.0" encoding="UTF-8"?>
<extentreports>
    <configuration>

        <!-- report theme -->
        <!-- STANDARD, DARK -->
        <theme>STANDARD</theme>

        <!-- document encoding -->
        <!-- defaults to UTF-8 -->
        <encoding>UTF-8</encoding>

        <!-- protocol for script and stylesheets -->
        <!-- defaults to https -->
        <!-- HTTP, HTTPS -->
        <protocol>HTTPS</protocol>

        <!-- offline report -->
        <timelineEnabled>true</timelineEnabled>

        <!-- offline report -->
        <enableOfflineMode>false</enableOfflineMode>

        <!-- use thumbnails for base64 images -->
        <!-- this may slowdown viewing tests -->
        <thumbnailForBase64>false</thumbnailForBase64>

        <!-- title of the document -->
        <documentTitle>Omnex4 Automation Reports</documentTitle>

        <!-- report name - displayed at top-nav -->
        <reportName>Regression suite result</reportName>

        <!-- timestamp format -->
        <timeStampFormat>MMM dd, yyyy HH:mm:ss</timeStampFormat>

        <output-directory>target</output-directory>

        <!-- custom javascript -->
        <scripts>
            <![CDATA[
        $(document).ready(function() {

        });
      ]]>
        </scripts>

        <!-- custom styles -->
        <styles>
            <![CDATA[

      ]]>
        </styles>

    </configuration>
</extentreports>
</code>```

I have tried to change the path in my extent.properties but I only manage to add an extra folder to the reports that are generated in the root.

Body:
I am using the extent-report-adapter for cucumber7 in my project. Everything is fine, the reports are generated correctly. The problem is that they are generated in my root directory and I need them to be generated in a folder called target that is already created in my root directory, this would help me not to accumulate the reports in my directory and not have to delete them by hand, honestly I have looked everywhere and tried several things but I can not find the solution.

I leave here the configuration files that I am using.

extent.properties

extent.reporter.spark.start=true
extent.reporter.spark.out=report/automation-testing-report.html
extent.reporter.spark.config=src/test/resources/spark-config.xml

#test,exception,category,device,author,log,dashboard - default order
extent.reporter.spark.vieworder=dashboard,test,exception,category,device,author

#Status filter
#extent.reporter.statusfilter=Fail

#embed image as base64 string src. Default is false
#extent.reporter.spark.base64imagesrc=true

#enable device & author. Default is false
extent.reporter.spark.enable.device=true
extent.reporter.spark.enable.author=true

#prefix for device & author. Default is '@dev_' and '@aut_', case ignored
#only considered if 'enabledevice' & 'enableauthor' are set to true
#extent.reporter.spark.prefix.device=@device_
#extent.reporter.spark.prefix.author=@author_

screenshot.dir=test-output/screenshots/
screenshot.rel.path=../screenshots/

#time format 29-Feb-20 14-14-14'
basefolder.dir=target
basefolder.name=reports
basefolder.datetimepattern=d-MMM-YY HH-mm-ss

spark-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<extentreports>
    <configuration>

        <theme>STANDARD</theme>

        <encoding>UTF-8</encoding>

        <protocol>HTTPS</protocol>

        <timelineEnabled>true</timelineEnabled>

        <enableOfflineMode>false</enableOfflineMode>

        <thumbnailForBase64>false</thumbnailForBase64>

        <documentTitle>Omnex4 Automation Reports</documentTitle>

        <reportName>Regression suite result</reportName>

        <timeStampFormat>MMM dd, yyyy HH:mm:ss</timeStampFormat>

        <output-directory>target</output-directory>

    </configuration>
</extentreports>

I have tried to change the path in my extent.properties but I only manage to add an extra folder to the reports that are generated in the root.


问:
writing http response in case of CTRL-C interrupt
I have a go application which process http requests. At some point, I might have many requests being processed, and I press ctrl-c ( maybe because database server is down ).

I want to give "internal error" response to all requests which have not been processed yet.

It's unclear to me how to access http.ResponseWriter of unprocessed requests after capturing ctrl-c signal.


问:
Tableau: Getting the Latitude/Longitude for the Current location
I am using Tableau on iPad, where I have the possibility to click on the icon of Locate me and Tableau zooms on to it. Just see the attached .GIF file, to see this small animation.

I wish to fetch the Latitude/Longitude of this current location.

Documentation says:

Note: Finding your current location is not supported on Tableau Desktop.

But, then it adds, "Note: When you click the locate me button, you might be prompted by your web browser to allow Tableau access to find your current location. If you block access, Tableau will be unable to zoom to your current location".

In nutshell, Tableau uses browser to fetch the Current location and then zooms on to it. I am precisely looking for Latitude/Longitude of this location, which it must be storing somewhere in the process. Does anyone know how to do fetch them?


问:
How to set id in Jetpack Compose for Appium and UIAutomator (Xpath issue)
I am using Jetpack Compose and Appium with UIAutomator. I would like to set a unique id for the Composables instead of showing the Xpath because of:
Using XPath locators is not recommended and can lead to fragile tests. Ask your development team to provide unique accessibility locators instead.

Inside Android Studio under my Composable I have added:

```<code>Row(
  modifier = Modifier.semantics { testTagsAsResourceId = true }
    ...
    ) {
       Text(
         modifier = Modifier.semantics { testTag = "testTag" },
</code>```

Now in Appium I can see that the resource-id = testTag, but the id is still showing the Xpath.

According to this article I should be able to set the id to the same as resource-id by using @AndroidFindBy and some class UiSelector  but I do not understand how - should I add this annotation inside my Composable?

I read about a solution here but Espresso is not an option for me, unfortunately.

I also tried using:

```<code>modifier = Modifier.semantics { this.contentDescription = "testTag" },
</code>```

And this actually changed the Xpath, but still it showed the warning above.

This is how I would like to have it (where id and resource-id has the same value): image from article

Body:
I am using Jetpack Compose and Appium with UIAutomator. I would like to set a unique id for the Composables instead of showing the Xpath because of:
Using XPath locators is not recommended and can lead to fragile tests. Ask your development team to provide unique accessibility locators instead.

Inside Android Studio under my Composable I have added:

Row(
  modifier = Modifier.semantics { testTagsAsResourceId = true }
    ...
    ) {
       Text(
         modifier = Modifier.semantics { testTag = "testTag" },

Now in Appium I can see that the resource-id = testTag, but the id is still showing the Xpath.

According to this article I should be able to set the id to the same as resource-id by using @AndroidFindBy and some class UiSelector  but I do not understand how - should I add this annotation inside my Composable?

I read about a solution here but Espresso is not an option for me, unfortunately.

I also tried using:

modifier = Modifier.semantics { this.contentDescription = "testTag" },

And this actually changed the Xpath, but still it showed the warning above.

This is how I would like to have it (where id and resource-id has the same value): image from article


问:
Azure Function with docker compose unreachable via container port
Container-to-container calls to an Azure Function App don't work but calls to a Web API from a Function App work (after removing UseHttpsRedirection).

I've created a simple solution with ASP.NET Core Web API (.NET 6.0) and an Azure Function App (.NET 6.0) with a HTTP trigger. I've added container orchestration support using Visual Studio 2022.  I want them to be able to call each other using service names such as http://functionapp.

✅ Using a REST client, I can call both the Web API and the Function App.

✅ The Function App can call the Web API using http://multicontainerapiandfunction/WeatherForecast as the URL.

❌ The Web API can't call the Function App using http://functionapp2/api/Function2 as the URL. Error: System.Net.Http.HttpRequestException: Connection refused (functionapp2:80).

✅ The Web API can call the Function App using http://functionapp2:31744/api/Function2 as the URL.

The launchSettings.json of the Function App contain this:

"Docker": {
      "commandName": "Docker",
      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
      "httpPort": 31744,
      "useSSL": false
    }
```
<p>The docker-compose and docker-compose.override files have been generated by VS.</p>
<p>The docker-compose.yml is simply:</p>
<pre class="lang-yaml prettyprint-override"><code>version: '3.4'

services:
  multicontainerapiandfunction:
    image: ${DOCKER_REGISTRY-}multicontainerapiandfunction
    build:
      context: .
      dockerfile: MultiContainerApiAndFunction/Dockerfile

  functionapp2:
    image: ${DOCKER_REGISTRY-}functionapp2
    build:
      context: .
      dockerfile: FunctionApp2/Dockerfile
</code>```

And docker-compose.override.yml is

version: '3.4'

services:
  multicontainerapiandfunction:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+:80
    ports:
      - "80"
      - "443"
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro

  functionapp2:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development

```
<p>This results in VS showing the Function App's ports like this:
<img src="https://i.stack.imgur.com/vYI4E.png" alt="Container view in VS" /></p>
<p>I tried changing the <code>ports</code> section in docker-compose.override.yml in these two ways:</p>
<pre class="lang-yaml prettyprint-override"><code>    ports:
      - "31744:80"
</code>```

That results in error during build: "port is already allocated".

    ports:
      - "31745:80"
```

That results in the ports being like this:

✅ Port 31744 can be called via a REST client.

❌ Port 31745 can't be called via a REST client.

❌ Web API can't call the Function App with http://functionapp2/api/Function2 as the URL.

✅ Web API can call with http://functionapp2:31744/api/Function2.

❌ Web API can't call with http://functionapp2:31745/api/Function2

I tried removing the "httpPort" from launchSettings.json and then setting port sections as above to 31744:

❌ Port 31744 can't be called via a REST client anymore. Error: Server returned nothing (no headers, no data)

❌ Web API can't call the Function App with http://functionapp2/api/Function2 as the URL. System.Net.Http.HttpRequestException: Connection refused (functionapp2:80)

❌ Web API can't call with http://functionapp2:31744/api/Function2. System.Net.Http.HttpRequestException: Connection refused (functionapp2:31744)

I expected that setting the ports to "31744:80" would mean that I can call it with a REST client using port 31744 and the Web API could call it with port 80. However, it seems that it doesn't do anything even though it correctly shows up in VS.
I expected that setting httpPorts to 31744 in launchSettings.json just means that I can call 31744 and it's mapped to container port 80. However, it seems that it instead exposes host port 31744 which maps to a container port 31744.

To summarize: Setting the ports section doesn't seem to anything. Setting the httpPorts works.

Body:
Container-to-container calls to an Azure Function App don't work but calls to a Web API from a Function App work (after removing UseHttpsRedirection).

I've created a simple solution with ASP.NET Core Web API (.NET 6.0) and an Azure Function App (.NET 6.0) with a HTTP trigger. I've added container orchestration support using Visual Studio 2022.  I want them to be able to call each other using service names such as http://functionapp.

✅ Using a REST client, I can call both the Web API and the Function App.

✅ The Function App can call the Web API using http://multicontainerapiandfunction/WeatherForecast as the URL.

❌ The Web API can't call the Function App using http://functionapp2/api/Function2 as the URL. Error: System.Net.Http.HttpRequestException: Connection refused (functionapp2:80).

✅ The Web API can call the Function App using http://functionapp2:31744/api/Function2 as the URL.

The launchSettings.json of the Function App contain this:

"Docker": {
      "commandName": "Docker",
      "launchUrl": "{Scheme}://{ServiceHost}:{ServicePort}",
      "httpPort": 31744,
      "useSSL": false
    }

The docker-compose and docker-compose.override files have been generated by VS.

The docker-compose.yml is simply:

version: '3.4'

services:
  multicontainerapiandfunction:
    image: ${DOCKER_REGISTRY-}multicontainerapiandfunction
    build:
      context: .
      dockerfile: MultiContainerApiAndFunction/Dockerfile

  functionapp2:
    image: ${DOCKER_REGISTRY-}functionapp2
    build:
      context: .
      dockerfile: FunctionApp2/Dockerfile

And docker-compose.override.yml is

version: '3.4'

services:
  multicontainerapiandfunction:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development
      - ASPNETCORE_URLS=https://+:443;http://+:80
    ports:
      - "80"
      - "443"
    volumes:
      - ${APPDATA}/Microsoft/UserSecrets:/root/.microsoft/usersecrets:ro
      - ${APPDATA}/ASP.NET/Https:/root/.aspnet/https:ro

  functionapp2:
    environment:
      - ASPNETCORE_ENVIRONMENT=Development

This results in VS showing the Function App's ports like this:

I tried changing the ports section in docker-compose.override.yml in these two ways:

    ports:
      - "31744:80"

That results in error during build: "port is already allocated".

    ports:
      - "31745:80"

That results in the ports being like this:

✅ Port 31744 can be called via a REST client.

❌ Port 31745 can't be called via a REST client.

❌ Web API can't call the Function App with http://functionapp2/api/Function2 as the URL.

✅ Web API can call with http://functionapp2:31744/api/Function2.

❌ Web API can't call with http://functionapp2:31745/api/Function2

I tried removing the "httpPort" from launchSettings.json and then setting port sections as above to 31744:

❌ Port 31744 can't be called via a REST client anymore. Error: Server returned nothing (no headers, no data)

❌ Web API can't call the Function App with http://functionapp2/api/Function2 as the URL. System.Net.Http.HttpRequestException: Connection refused (functionapp2:80)

❌ Web API can't call with http://functionapp2:31744/api/Function2. System.Net.Http.HttpRequestException: Connection refused (functionapp2:31744)

I expected that setting the ports to "31744:80" would mean that I can call it with a REST client using port 31744 and the Web API could call it with port 80. However, it seems that it doesn't do anything even though it correctly shows up in VS.
I expected that setting httpPorts to 31744 in launchSettings.json just means that I can call 31744 and it's mapped to container port 80. However, it seems that it instead exposes host port 31744 which maps to a container port 31744.

To summarize: Setting the ports section doesn't seem to anything. Setting the httpPorts works.


问:
CSS grid layout breaks in angular
I'm using Angular 14 and trying to design a page using CSS grid.

What I had before grid:

I want my layout to look like:

Where the colors are component type and the letter marks different props. The surrounding black square marks the parent component wanted size.

What I actually get with grid is:

My code is:

```<code><section id="dashboard">
    <div id="dashboard-title"></div>
    <app-status-top-frame></app-status-top-frame>
    <div class="dashboard-grid-parent">
        <div class="dashboard-grid">
            <app-card
                [title]="'Alerts'"
                [iconPath]="dashboardIconsPaths['alerts']"
                [titleClass]="'alert-title'"
            ></app-card>
            <app-card
                [title]="'Apps Changes'"
                [iconPath]="dashboardIconsPaths['appChanges']"
                [titleClass]="'app-title'"
            ></app-card>
            <app-card
                [title]="'Not Secured'"
                [iconPath]="dashboardIconsPaths['notSecured']"
                [titleClass]="'secure-title'"
            ></app-card>
            <app-card
                [title]="'Optimize'"
                [iconPath]="dashboardIconsPaths['optimize']"
                [titleClass]="'optimize-title'"
            ></app-card>
            <app-card-large [view]="'map'" [title]="'Maps'"></app-card-large>
            <app-card-large [view]="'network'" [title]="'Network'"></app-card-large>
        </div>
    </div>
</section>

// CSS with things I've tried:
.dashboard-grid {
    max-width: 100%;
    max-height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
    grid-column-gap: 24px;
    grid-row-gap: 24px;
    /* grid-template-areas:
        "card1 card2 card3 card4"
        "card-large-1 card-large-1 card-large-2 card-large-2"
        "card-large-1 card-large-1 card-large-2 card-large-2"; */
}

/* app-card[title="Alerts"] {
    grid-area: card1;
}
app-card[title="Apps Changes"] {
    grid-area: card2;
}
app-card[title="Not Secured"] {
    grid-area: card3;
}
app-card[title="Optimize"] {
    grid-area: card4;
}
app-card-large[title="Maps"] {
    grid-area: card4;
}
app-card-large[title="Network"] {
    grid-area: card4;
} */

/* .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr 2fr;
    grid-column-gap: 24px;
    grid-row-gap: 24px;
    }
    */
    app-card[title="Alerts"] { grid-area: 1 / 1 / 2 / 2; }
    app-card[title="Apps Changes"] { grid-area: 1 / 2 / 2 / 3; }
    app-card[title="Not Secured"] { grid-area: 1 / 3 / 2 / 4; }
    app-card[title="Optimize"] { grid-area: 1 / 4 / 2 / 5; }
    app-card-large[title="Maps"] { grid-area: 2 / 1 / 4 / 3; }
    app-card-large[title="Network"] { grid-area: 2 / 3 / 4 / 5; }
</code>```

Why doesn't it works?

** The purpose of the grid is to make elements margins more dynamic for different screen sizes, so I'll be happy to know about better ways to achieve that.

Thanks.

Title: CSS grid layout breaks in angular

Body:
I'm using Angular 14 and trying to design a page using CSS grid.

What I had before grid:

I want my layout to look like:

Where the colors are component type and the letter marks different props. The surrounding black square marks the parent component wanted size.

What I actually get with grid is:

My code is:

    <app-status-top-frame></app-status-top-frame>

            <app-card
                [title]="'Alerts'"
                [iconPath]="dashboardIconsPaths['alerts']"
                [titleClass]="'alert-title'"
            ></app-card>
            <app-card
                [title]="'Apps Changes'"
                [iconPath]="dashboardIconsPaths['appChanges']"
                [titleClass]="'app-title'"
            ></app-card>
            <app-card
                [title]="'Not Secured'"
                [iconPath]="dashboardIconsPaths['notSecured']"
                [titleClass]="'secure-title'"
            ></app-card>
            <app-card
                [title]="'Optimize'"
                [iconPath]="dashboardIconsPaths['optimize']"
                [titleClass]="'optimize-title'"
            ></app-card>
            <app-card-large [view]="'map'" [title]="'Maps'"></app-card-large>
            <app-card-large [view]="'network'" [title]="'Network'"></app-card-large>

// CSS with things I've tried:
.dashboard-grid {
    max-width: 100%;
    max-height: 100%;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: auto;
    grid-column-gap: 24px;
    grid-row-gap: 24px;
    /* grid-template-areas:
        "card1 card2 card3 card4"
        "card-large-1 card-large-1 card-large-2 card-large-2"
        "card-large-1 card-large-1 card-large-2 card-large-2"; */
}

/* app-card[title="Alerts"] {
    grid-area: card1;
}
app-card[title="Apps Changes"] {
    grid-area: card2;
}
app-card[title="Not Secured"] {
    grid-area: card3;
}
app-card[title="Optimize"] {
    grid-area: card4;
}
app-card-large[title="Maps"] {
    grid-area: card4;
}
app-card-large[title="Network"] {
    grid-area: card4;
} */

/* .dashboard-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-template-rows: 1fr 2fr;
    grid-column-gap: 24px;
    grid-row-gap: 24px;
    }
    */
    app-card[title="Alerts"] { grid-area: 1 / 1 / 2 / 2; }
    app-card[title="Apps Changes"] { grid-area: 1 / 2 / 2 / 3; }
    app-card[title="Not Secured"] { grid-area: 1 / 3 / 2 / 4; }
    app-card[title="Optimize"] { grid-area: 1 / 4 / 2 / 5; }
    app-card-large[title="Maps"] { grid-area: 2 / 1 / 4 / 3; }
    app-card-large[title="Network"] { grid-area: 2 / 3 / 4 / 5; }

Why doesn't it works?

** The purpose of the grid is to make elements margins more dynamic for different screen sizes, so I'll be happy to know about better ways to achieve that.

Thanks.


问:
Prometheus http_client_requests_second in Apache Camel Springboot Application
I have a Camel Springboot application that makes rest request with a Camel route like this:

```<code>from("direct:rest-request")
    .routeId("rest-get-route")
    .log("calling the rest service")
    .to("rest:post:localhost:8081")
</code>```

In the pom.xml there are all the dependencies:

```<code><dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-http-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-servlet-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-rest-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-metrics-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-micrometer-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
</code>```

and in the application.yml there are these properties:

```<code>camel:
  component:
    metrics:
      enabled: true
      metric-registry: prometheusMeterRegistry

management:
  endpoint:
    health:
      show-details: ALWAYS
  endpoints:
    web:
      exposure:
        include: 'health,prometheus'
  metrics:
    web:
      client:
        request:
          autotime:
            enabled: true
</code>```

Do somebody know why I can't see the metrics http_client_requests_second with a get request to http://localhost:8080/actuator/prometheus but i get only the http_server_requests_second?

Body:
I have a Camel Springboot application that makes rest request with a Camel route like this:

from("direct:rest-request")
    .routeId("rest-get-route")
    .log("calling the rest service")
    .to("rest:post:localhost:8081")

In the pom.xml there are all the dependencies:

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-core</artifactId>
</dependency>
<dependency>
    <groupId>io.micrometer</groupId>
    <artifactId>micrometer-registry-prometheus</artifactId>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-http-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-servlet-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-rest-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-metrics-starter</artifactId>
    <version>${camel.version}</version>
</dependency>
<dependency>
    <groupId>org.apache.camel.springboot</groupId>
    <artifactId>camel-micrometer-starter</artifactId>
    <version>${camel.version}</version>
</dependency>

and in the application.yml there are these properties:

camel:
  component:
    metrics:
      enabled: true
      metric-registry: prometheusMeterRegistry

management:
  endpoint:
    health:
      show-details: ALWAYS
  endpoints:
    web:
      exposure:
        include: 'health,prometheus'
  metrics:
    web:
      client:
        request:
          autotime:
            enabled: true

Do somebody know why I can't see the metrics http_client_requests_second with a get request to http://localhost:8080/actuator/prometheus but i get only the http_server_requests_second?


问:
SQLSTATE[08006] [7] could not connect to server postgresql
i'm working on a project where i have to put a website on a server and i'm encountering this error :

SQLSTATE[08006] [7] could not connect to server: Connection refused Is the server running on host "localhost" (::1) and accepting TCP/IP connections on port 5432?

So i already checked online, i did :
ufw allow 5432/tcp
(to allow port 5432 to be listen)

In the postgresql.conf, i changed listen_adresses='localhost' to listen_addresses='*'
In the pg_hba.conf, i put host    all             all             0.0.0.0                 md5

And i still got the error, if anyone can help me it would be great !

If it helps, the error appeared after i updated my postgres, and after i uncommented pdo_pgsql. I then restarted my database, then the error occured.


问:
Using tinysort to sort elements by tag matching
I am using the Tinysort.js plugin to sort my blog articles on my homepage blog that I'm building with 11ty.js.

I want it to function like a computer (MacOs at least) folder you can sort by date, title and tags. So far I managed dates and titles without any issues but I have a hard time with the tags.

What I want: if you click on tag, you can select 1 of the tags and all the articles with that tag specific tag will come up at the top of the list.

I made that tag "slider" but I cannot figure out how to make it match with the tag elements

If you select 'F' tag then the ARTICLE ABC should be on top since it has the tag F and not the others.

Can someone help me? I think i need to tweak the 'selector: '.tag' , attr:' but none of what i tried worked so far.

      var listElements = document.querySelectorAll('#index-list li');
      var filters = document.getElementsByClassName('filter');
      var alltags = document.getElementsByClassName('s-tag');
      var filler = document.getElementById ('filler-tag');
      var count = 0
      for (var i = 0; i < filters.length; i++) {
        filters[i].addEventListener('click', sort, false);
      }
      function sort() {
        for (var j = 0; j < filters.length; j++) {
          filters[j].classList.remove('active');
          //console.log(j);
        }

        for (var k = 0; k < alltags.length; k++) {
         alltags[k].classList.add('hidden');
        }

        this.classList.add('active');
          this.classList.toggle('asc');
        this.classList.toggle('desc');

        var type = (this).id;
        switch (type) {
          case "title":
            tinysort(listElements, {
              selector: '.p-title',
              order: (this.isAsc =! this.isAsc)
                ? 'asc'
                : 'desc'
            });
            break;
          case "date":
            tinysort(listElements, {
              selector: 'time',
              attr: 'datetime',
              order: (this.isAsc =! this.isAsc)
                ? 'asc'
                : 'desc'
            });
            break;
          case "tag":
            count++;
            if(count>=alltags.length){
            count=0;
            };
           alltags[count].classList.remove('hidden');

            tinysort(listElements, {
              selector: '.tag',
                attr: 'alltags[count]',
              order:'asc'

            });
            break;
        }
      }```
<pre class="snippet-code-css lang-css prettyprint-override"><code>.ftag.active>#filler-tag {
        display: none;
    }

    .s-tag.hidden {
        display: none;
    }</code>```

       tag
          <

                    B

                    A

                    F

                    C

                    Select tag
          >

                ARTICLE XYZ

                    February to October
                  2022

                    B,

                    C,

                  Last updated
                    <time datetime="2018-09-09">09 Sep 2018</time>

                  | "size" KB

                ARTICLE DEF

                    February to October
                  2021

                    B,

                  Last updated
                    <time datetime="2017-08-08">08 Aug 2017</time>

                  | "size" KB

                ARTICLE ABC

                    February to October
                  2021

                    A,

                    F,

                  Last updated
                    <time datetime="2016-08-08">08 Aug 2016</time>

                  | "size" KB

```

Body:
I am using the Tinysort.js plugin to sort my blog articles on my homepage blog that I'm building with 11ty.js.

I want it to function like a computer (MacOs at least) folder you can sort by date, title and tags. So far I managed dates and titles without any issues but I have a hard time with the tags.

What I want: if you click on tag, you can select 1 of the tags and all the articles with that tag specific tag will come up at the top of the list.

I made that tag "slider" but I cannot figure out how to make it match with the tag elements

If you select 'F' tag then the ARTICLE ABC should be on top since it has the tag F and not the others.

Can someone help me? I think i need to tweak the 'selector: '.tag' , attr:' but none of what i tried worked so far.

      var listElements = document.querySelectorAll('#index-list li');
      var filters = document.getElementsByClassName('filter');
      var alltags = document.getElementsByClassName('s-tag');
      var filler = document.getElementById ('filler-tag');
      var count = 0
      for (var i = 0; i < filters.length; i++) {
        filters[i].addEventListener('click', sort, false);
      }
      function sort() {
        for (var j = 0; j < filters.length; j++) {
          filters[j].classList.remove('active');
          //console.log(j);
        }

        for (var k = 0; k < alltags.length; k++) {
         alltags[k].classList.add('hidden');
        }

        this.classList.add('active');
          this.classList.toggle('asc');
        this.classList.toggle('desc');

        var type = (this).id;
        switch (type) {
          case "title":
            tinysort(listElements, {
              selector: '.p-title',
              order: (this.isAsc =! this.isAsc)
                ? 'asc'
                : 'desc'
            });
            break;
          case "date":
            tinysort(listElements, {
              selector: 'time',
              attr: 'datetime',
              order: (this.isAsc =! this.isAsc)
                ? 'asc'
                : 'desc'
            });
            break;
          case "tag":
            count++;
            if(count>=alltags.length){
            count=0;
            };
           alltags[count].classList.remove('hidden');

            tinysort(listElements, {
              selector: '.tag',
                attr: 'alltags[count]',
              order:'asc'

            });
            break;
        }
      }

.ftag.active>#filler-tag {
        display: none;
    }

    .s-tag.hidden {
        display: none;
    }

       tag
          <

                    B

                    A

                    F

                    C

                    Select tag
          >

                ARTICLE XYZ

                    February to October
                  2022

                    B,

                    C,

                  Last updated
                    <time datetime="2018-09-09">09 Sep 2018</time>

                  | "size" KB

                ARTICLE DEF

                    February to October
                  2021

                    B,

                  Last updated
                    <time datetime="2017-08-08">08 Aug 2017</time>

                  | "size" KB

                ARTICLE ABC

                    February to October
                  2021

                    A,

                    F,

                  Last updated
                    <time datetime="2016-08-08">08 Aug 2016</time>

                  | "size" KB


问:
How to make it so that the user can drag the layout by the edges to change its size in android studio?
I have a problem that I described above: I need to make it so that the user can directly (with his fingers) resize layout. (In my case, I put an EditText with android:inputType="textMultiLine" in a CardView). I searched for similar questions, and came across only creating Widgets with android:resizeMode. But I understand that they cannot be placed simply in your application. An example of what the target is:
target
That is, initially there is some default size, and the user, moving the edges, changes the size of this layout. How can this be implemented? Thank you.

I searched for similar questions on the Internet, but did not find a solution.


问:
'doc is missing path' when trying to patch with Kustomize
I'm trying to replace RAILS_ENVenv variable defined in this Deployment file.

deploy.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myservice-web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myservice-web
  template:
    metadata:
      labels:
        app: myservice-web
    spec:
      serviceAccountName: myservice-web-sa
      nodeSelector:
        iam.gke.io/gke-metadata-server-enabled: "true"
      containers:
        - name: myservice-web
          image: us-central1-docker.pkg.dev/path/to/myimage
          args:
            - bundle
            - exec
            - bin/rails
            - server
            - -p
            - "3000"
            - -b
            - "0.0.0.0"
          ports:
            - containerPort: 3000
          imagePullPolicy: Always
          resources:
            requests:
              memory: "2Gi"
              cpu: 1
            limits:
              memory: "2Gi"
              cpu: 1
          env:
            - name: RAILS_ENV
              value: "production"
            - name: RACK_ENV
              value: "production"
            - name: NODE_ENV
              value: "production"
            - name: SECRETS_PATH
              value: "/var/myservice-secrets"
            - name: SECRETS_FILE
              value: ".secrets"
          volumeMounts:
            - mountPath: "/var/myservice-secrets"
              name: gcp-myservice-secrets
      initContainers:
        - name: migrations
          image: us-central1-docker.pkg.dev/path/to/myservice:develop
          command:
          - bundle
          - exec
          - bin/rails
          - db:migrate
          env:
          - name: RAILS_ENV
            value: "production"
          - name: RACK_ENV
            value: "production"
          - name: NODE_ENV
            value: "production"
          - name: SECRETS_PATH
            value: "/var/myservice-secrets"
          - name: SECRETS_FILE
            value: ".secrets"
          volumeMounts:
          ...
      imagePullSecrets:
      ...
      volumes:
      ...
---
apiVersion: v1
kind: Service
metadata:
  name: myservice-web
spec:
  ports:
    - port: 3000
      targetPort: 3000
      protocol: TCP
  selector:
    app: myservice-web

```
<p>This is the kustomization file:</p>
<pre class="lang-yaml prettyprint-override"><code>apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: default

bases:
  - ../../base

images:
  - name: us-central1-docker.pkg.dev/path/to/myimage
    newTag: develop

resources:
  - sa.yaml
  - ing.yaml
  - ing-jukeboxhealth.yaml
  - cert.yaml
  - cert-jukeboxhealth.yaml

patches:
- patch: |-
    - op: replace
      path: /spec/template/spec/containers/0/env[name="RAILS_ENV"]/value
      value: "staging"
  target:
    kind: Deployment
    name: myservice-web
</code>```

I get this error:

```<code>error: replace operation does not apply: doc is missing path: /spec/template/spec/containers/0/env[name="RAILS_ENV"]/value: missing value
</code>```

I've tried defining the path by position instead of name and it works. But I'd like to do it by targeting the name. What is wrong with the path?

Body:
I'm trying to replace RAILS_ENVenv variable defined in this Deployment file.

deploy.yaml:

apiVersion: apps/v1
kind: Deployment
metadata:
  name: myservice-web
spec:
  replicas: 3
  selector:
    matchLabels:
      app: myservice-web
  template:
    metadata:
      labels:
        app: myservice-web
    spec:
      serviceAccountName: myservice-web-sa
      nodeSelector:
        iam.gke.io/gke-metadata-server-enabled: "true"
      containers:
        - name: myservice-web
          image: us-central1-docker.pkg.dev/path/to/myimage
          args:
            - bundle
            - exec
            - bin/rails
            - server
            - -p
            - "3000"
            - -b
            - "0.0.0.0"
          ports:
            - containerPort: 3000
          imagePullPolicy: Always
          resources:
            requests:
              memory: "2Gi"
              cpu: 1
            limits:
              memory: "2Gi"
              cpu: 1
          env:
            - name: RAILS_ENV
              value: "production"
            - name: RACK_ENV
              value: "production"
            - name: NODE_ENV
              value: "production"
            - name: SECRETS_PATH
              value: "/var/myservice-secrets"
            - name: SECRETS_FILE
              value: ".secrets"
          volumeMounts:
            - mountPath: "/var/myservice-secrets"
              name: gcp-myservice-secrets
      initContainers:
        - name: migrations
          image: us-central1-docker.pkg.dev/path/to/myservice:develop
          command:
          - bundle
          - exec
          - bin/rails
          - db:migrate
          env:
          - name: RAILS_ENV
            value: "production"
          - name: RACK_ENV
            value: "production"
          - name: NODE_ENV
            value: "production"
          - name: SECRETS_PATH
            value: "/var/myservice-secrets"
          - name: SECRETS_FILE
            value: ".secrets"
          volumeMounts:
          ...
      imagePullSecrets:
      ...
      volumes:
      ...
---
apiVersion: v1
kind: Service
metadata:
  name: myservice-web
spec:
  ports:
    - port: 3000
      targetPort: 3000
      protocol: TCP
  selector:
    app: myservice-web

This is the kustomization file:

apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

namespace: default

bases:
  - ../../base

images:
  - name: us-central1-docker.pkg.dev/path/to/myimage
    newTag: develop

resources:
  - sa.yaml
  - ing.yaml
  - ing-jukeboxhealth.yaml
  - cert.yaml
  - cert-jukeboxhealth.yaml

patches:
- patch: |-
    - op: replace
      path: /spec/template/spec/containers/0/env[name="RAILS_ENV"]/value
      value: "staging"
  target:
    kind: Deployment
    name: myservice-web

I get this error:

error: replace operation does not apply: doc is missing path: /spec/template/spec/containers/0/env[name="RAILS_ENV"]/value: missing value

I've tried defining the path by position instead of name and it works. But I'd like to do it by targeting the name. What is wrong with the path?


问:
If my ManageMonster Class have bloated parser / input checker should I move it to a new class MngMonsterParser? (OOP design question)
Say for example I have a microservice where I need a class where I can manage a monster from another service, like level it up, update its status (sick, hungry and etc) and take a picture with it(save picture somewhere local) through a terminal. The parsing part is located on the same class but I feel like I should have ManagerParser or ManageMonsterParser class...

```<code>class ManageMonster

  attr_accessor :monster_id, :status, :game_server...

  def initialize(cmd_args)
    #some intense parsing
    parse_args(cmd_args)
  end

  def update_status(monster_id, status)
    #call api to update status of monster
  end

  def level_up(monster_id)
    #level up the monster by 1
  end

  def take_picture(monster_id)
    #get monster coordinate, appearance
    #generate a picture with the data
  end

  def parse_args(cmd_args)
    #very long parsing code...
  end
end
</code>```

I tried creating ManageMonsterParser class and pass the cmd_args there and just pass
its instance to the ManageMonster class. I am expecting a more cleaner more SRP code... I felt like parsing logic is not ManageMonster's responsibility.

Body:
Say for example I have a microservice where I need a class where I can manage a monster from another service, like level it up, update its status (sick, hungry and etc) and take a picture with it(save picture somewhere local) through a terminal. The parsing part is located on the same class but I feel like I should have ManagerParser or ManageMonsterParser class...

class ManageMonster

  attr_accessor :monster_id, :status, :game_server...

  def initialize(cmd_args)
    #some intense parsing
    parse_args(cmd_args)
  end

  def update_status(monster_id, status)
    #call api to update status of monster
  end

  def level_up(monster_id)
    #level up the monster by 1
  end

  def take_picture(monster_id)
    #get monster coordinate, appearance
    #generate a picture with the data
  end

  def parse_args(cmd_args)
    #very long parsing code...
  end
end

I tried creating ManageMonsterParser class and pass the cmd_args there and just pass
its instance to the ManageMonster class. I am expecting a more cleaner more SRP code... I felt like parsing logic is not ManageMonster's responsibility.


问:
(Error) django.db.utils.IntegrityError: The row in table "" with primary key "' has an invalid foreign key
I am trying to get the primary key of my User model (which is not the default pk) by using a ForeignKey and then, with a property, get the "usertag" of the User model, but when I try migrating my changes I get the following error:

django.db.utils.IntegrityError: The row in table 'user_friend' with primary key 'LOL' has an invalid foreign key: user_friend.fk_id contains a value 'fk_id' that does not have a corresponding value in user_user.id.

My models.py:

```<code>from django.db import models

class User(models.Model):
    f_name = models.CharField(max_length=15)
    l_name = models.CharField(max_length=15)
    usertag = models.CharField(max_length=7, default="aabb11")
    level = models.IntegerField(default=1)
    profile_pic = models.URLField(max_length=10000)
    email = models.EmailField(max_length=100)
    password = models.CharField(max_length=25)

class invites(models.Model):
    invite_id = models.CharField(max_length=8, primary_key=True)
    choices = [("P", "PENDING"), ("A", "ACCEPTED"), ("D", "DECLINED")]
    sent_to = models.CharField(max_length=7)
    from_user = models.CharField(max_length=7)
    invite_status = models.CharField(choices=choices, default=choices[0], max_length=9)

# USE Foreign KEYS
class friend(models.Model):
    fk = models.ForeignKey(User, on_delete=models.CASCADE, db_constraint=False)
    friend_tag = models.CharField(max_length=7, primary_key=True)

    @property
    def my_tag(self):
        return self.fk.usertag

</code>```

Body:
I am trying to get the primary key of my User model (which is not the default pk) by using a ForeignKey and then, with a property, get the "usertag" of the User model, but when I try migrating my changes I get the following error:

django.db.utils.IntegrityError: The row in table 'user_friend' with primary key 'LOL' has an invalid foreign key: user_friend.fk_id contains a value 'fk_id' that does not have a corresponding value in user_user.id.

My models.py:

from django.db import models

class User(models.Model):
    f_name = models.CharField(max_length=15)
    l_name = models.CharField(max_length=15)
    usertag = models.CharField(max_length=7, default="aabb11")
    level = models.IntegerField(default=1)
    profile_pic = models.URLField(max_length=10000)
    email = models.EmailField(max_length=100)
    password = models.CharField(max_length=25)

class invites(models.Model):
    invite_id = models.CharField(max_length=8, primary_key=True)
    choices = [("P", "PENDING"), ("A", "ACCEPTED"), ("D", "DECLINED")]
    sent_to = models.CharField(max_length=7)
    from_user = models.CharField(max_length=7)
    invite_status = models.CharField(choices=choices, default=choices[0], max_length=9)

# USE Foreign KEYS
class friend(models.Model):
    fk = models.ForeignKey(User, on_delete=models.CASCADE, db_constraint=False)
    friend_tag = models.CharField(max_length=7, primary_key=True)

    @property
    def my_tag(self):
        return self.fk.usertag


问:
date and week name and month in datepicker
how to get this type of result using bootstrap datepicker

image

start with the current date, week name, and month name in each div. I will use this as a slider


问:
How to load trials results for hyperparameter_search
I run 100 trials for hyperparameters tuning of a transformers as following:

```<code>trainer = Trainer(...)

best_trial = trainer.hyperparameter_search(direction="maximize",
                                                backend='ray',
                                                hp_space=ray_hp_space,
                                                search_alg=hyperopt_search,
                                                n_trials=100,
                                                resources_per_trial={"cpu":4, "gpu":1},
                                                checkpoint_score_attr="training_iteration",
                                                progress_reporter=reporter,
                                                local_dir=training_args.output_dir + "/hyper_results"
                                              )
</code>```

I did not print "best_trial".
I am wondering if possible to load the trials results and anlyze them to get the best result ?

Body:
I run 100 trials for hyperparameters tuning of a transformers as following:

trainer = Trainer(...)

best_trial = trainer.hyperparameter_search(direction="maximize",
                                                backend='ray',
                                                hp_space=ray_hp_space,
                                                search_alg=hyperopt_search,
                                                n_trials=100,
                                                resources_per_trial={"cpu":4, "gpu":1},
                                                checkpoint_score_attr="training_iteration",
                                                progress_reporter=reporter,
                                                local_dir=training_args.output_dir + "/hyper_results"
                                              )

I did not print "best_trial".
I am wondering if possible to load the trials results and anlyze them to get the best result ?


问:
Feathersjs GeneralError: The "config.server" property is required and must be of type string
I created a new feathersjs app with npm create feathers@pre vdb-b.

```<code>  "feathers": {
    "language": "ts",
    "packager": "npm",
    "database": "mssql",
    "framework": "koa",
    "transports": [
      "rest"
    ],
    "schema": "typebox"
  },
</code>```

After successful running the migration task, which created the users table in my MSSQL database, I received the following error message while trying to create a first user via CURL:

```<code>error: GeneralError: The "config.server" property is required and must be of type string.
    at errorHandler (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@feathersjs\knex\src\error-handler.ts:91:21)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async UserService._create (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@feathersjs\knex\src\adapter.ts:232:23)
    at async UserService.logError (C:\Users\xyz\Workspaces\node\vdb\vdb-b\src\hooks\log-error.ts:7:5)
    at async C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@feathersjs\koa\src\rest.ts:36:21
    at async bodyParser (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\koa-bodyparser\index.js:95:5)
    at async C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@feathersjs\koa\src\handlers.ts:6:5
    at async serve (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\koa-static\index.js:53:9)
    at async cors (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@koa\cors\index.js:108:16)
</code>```

I tried to removed authentication for the users service, which gave a correct Not Authorized on GET /users before, but that resulted in receiving the above message for all service methods.

I searched in all generated files, but failed to identify, where config.server could be maintained directly or indirectly.

Body:
I created a new feathersjs app with npm create feathers@pre vdb-b.

  "feathers": {
    "language": "ts",
    "packager": "npm",
    "database": "mssql",
    "framework": "koa",
    "transports": [
      "rest"
    ],
    "schema": "typebox"
  },

After successful running the migration task, which created the users table in my MSSQL database, I received the following error message while trying to create a first user via CURL:

error: GeneralError: The "config.server" property is required and must be of type string.
    at errorHandler (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@feathersjs\knex\src\error-handler.ts:91:21)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async UserService._create (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@feathersjs\knex\src\adapter.ts:232:23)
    at async UserService.logError (C:\Users\xyz\Workspaces\node\vdb\vdb-b\src\hooks\log-error.ts:7:5)
    at async C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@feathersjs\koa\src\rest.ts:36:21
    at async bodyParser (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\koa-bodyparser\index.js:95:5)
    at async C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@feathersjs\koa\src\handlers.ts:6:5
    at async serve (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\koa-static\index.js:53:9)
    at async cors (C:\Users\xyz\Workspaces\node\vdb\vdb-b\node_modules\@koa\cors\index.js:108:16)

I tried to removed authentication for the users service, which gave a correct Not Authorized on GET /users before, but that resulted in receiving the above message for all service methods.

I searched in all generated files, but failed to identify, where config.server could be maintained directly or indirectly.


问:
how maven-assembly-plugin resolves it's dependencies? how the plugin chooses the repository?
I run the maven command:

mvn clean install -e -U -X

The following was the partial log:

```<code>[DEBUG] Skipped remote request for com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml, already updated during this session
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://maven.java.net/content/repositories/snapshots
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://maven.aliyun.com/repository/public
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repository.apache.org/snapshots
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://oss.sonatype.org/content/repositories/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repository.apache.org/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://maven.aliyun.com/repository/public
Downloading from apache.snapshots: https://repository.apache.org/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://maven.java.net/content/repositories/snapshots
Downloading from aliyun: https://maven.aliyun.com/repository/public/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://oss.sonatype.org/content/repositories/snapshots
Downloading from jvnet-nexus-snapshots: https://maven.java.net/content/repositories/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
Downloading from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repo.spring.io/snapshot
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.spring.io/snapshot
Downloading from spring-snapshots: https://repo.spring.io/snapshot/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://oss.jfrog.org/oss-snapshot-local
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://oss.jfrog.org/oss-snapshot-local
Downloading from rsocket-snapshots: https://oss.jfrog.org/oss-snapshot-local/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://oss.sonatype.org/content/repositories/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://oss.sonatype.org/content/repositories/snapshots
Downloading from sonatype-oss-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://oss.sonatype.org/content/repositories/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://oss.sonatype.org/content/repositories/snapshots
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in jvnet-nexus-snapshots (https://maven.java.net/content/repositories/snapshots)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in apache.snapshots (https://repository.apache.org/snapshots)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in aliyun (https://maven.aliyun.com/repository/public)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in spring-snapshots (https://repo.spring.io/snapshot)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in rsocket-snapshots (https://oss.jfrog.org/oss-snapshot-local)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in sonatype-oss-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in snapshots-repo (https://oss.sonatype.org/content/repositories/snapshots)
[DEBUG] Extension realms for project com.thikitech.one:one-test-pom:pom:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecycle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Adding file: D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\one-test-pom-0.0.1-SNAPSHOT.pom to archive location: risk-control-settings-provider/lib/one-test-pom-0.0.1-SNAPSHOT.pom
</code>```

I had specified a private nexus repository in my settings.xml, but not taken effect for this dependency.

Why is maven-assemble-plugin looking also in those public repositories? How can I force it look in my nexus repository?

Thank you.

Body:
I run the maven command:

mvn clean install -e -U -X

The following was the partial log:

[DEBUG] Skipped remote request for com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml, already updated during this session
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://maven.java.net/content/repositories/snapshots
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://maven.aliyun.com/repository/public
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repository.apache.org/snapshots
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://oss.sonatype.org/content/repositories/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repository.apache.org/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://maven.aliyun.com/repository/public
Downloading from apache.snapshots: https://repository.apache.org/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://maven.java.net/content/repositories/snapshots
Downloading from aliyun: https://maven.aliyun.com/repository/public/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://oss.sonatype.org/content/repositories/snapshots
Downloading from jvnet-nexus-snapshots: https://maven.java.net/content/repositories/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
Downloading from sonatype-nexus-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://repo.spring.io/snapshot
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://repo.spring.io/snapshot
Downloading from spring-snapshots: https://repo.spring.io/snapshot/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://oss.jfrog.org/oss-snapshot-local
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://oss.jfrog.org/oss-snapshot-local
Downloading from rsocket-snapshots: https://oss.jfrog.org/oss-snapshot-local/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://oss.sonatype.org/content/repositories/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://oss.sonatype.org/content/repositories/snapshots
Downloading from sonatype-oss-snapshots: https://oss.sonatype.org/content/repositories/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Using transporter WagonTransporter with priority -1.0 for https://oss.sonatype.org/content/repositories/snapshots
[DEBUG] Using connector BasicRepositoryConnector with priority 0.0 for https://oss.sonatype.org/content/repositories/snapshots
Downloading from snapshots-repo: https://oss.sonatype.org/content/repositories/snapshots/com/thikitech/one/one-test-pom/0.0.1-SNAPSHOT/maven-metadata.xml
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Writing tracking file D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\resolver-status.properties
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in jvnet-nexus-snapshots (https://maven.java.net/content/repositories/snapshots)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in apache.snapshots (https://repository.apache.org/snapshots)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in aliyun (https://maven.aliyun.com/repository/public)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in spring-snapshots (https://repo.spring.io/snapshot)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in rsocket-snapshots (https://oss.jfrog.org/oss-snapshot-local)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in sonatype-oss-snapshots (https://oss.sonatype.org/content/repositories/snapshots)
[DEBUG] Could not find metadata com.thikitech.one:one-test-pom:0.0.1-SNAPSHOT/maven-metadata.xml in snapshots-repo (https://oss.sonatype.org/content/repositories/snapshots)
[DEBUG] Extension realms for project com.thikitech.one:one-test-pom:pom:0.0.1-SNAPSHOT: (none)
[DEBUG] Looking up lifecycle mappings for packaging pom from ClassRealm[plexus.core, parent: null]
[DEBUG] Adding file: D:\home\.m2\repository\com\thikitech\one\one-test-pom\0.0.1-SNAPSHOT\one-test-pom-0.0.1-SNAPSHOT.pom to archive location: risk-control-settings-provider/lib/one-test-pom-0.0.1-SNAPSHOT.pom

I had specified a private nexus repository in my settings.xml, but not taken effect for this dependency.

Why is maven-assemble-plugin looking also in those public repositories? How can I force it look in my nexus repository?

Thank you.


问:
Is there a way to share QR codes created in Flutterflow?
I've been recently developing low code apps with flutterflow, and I've noticed the recent inclusion of a widget that allows you to create QR codes, however, couldn't help but to think, is there a way to share these QR codes as an image/pdf via instant messaging apps????

I have tried to use two pub.dev flutter widgets in my app, however those are not free, so I wanted to know if there's an open source solution (pub.dev widget)


问:
SPy error: "Axes don't match array" when calling .open_memmap()
I have some .bsq files with corresponding header files (.hdr). I want to open and edit them in Python, using the spectral (SPy) module.

Since I need to edit the files from within a Python Toolbox in ArcMap (that is, a single Python script which uses the Python installation that comes with ArcMap), I decided to copy the GitHub repository of the SPy module and import it as

```<code>import sys
sys.path.append("/path/to/module")
import spatial as spy
</code>```

in order to be able to run the toolbox on any computer without having to install pip or other software. (I intend to just copy the Toolbox and the module folder, or, in a later step, create a single Python script comprising the Toolbox as well as the SPy-module code.)

I opened some .bsq-file and tried to subsequently edit it as memmap, following this example.

First, I opened the image as spectral.io.bsqfile.BsqFile:

```<code>path = "/path/to/image_header.hdr"
img = spy.open_image(path)
</code>```

I am able to apply various methods to img (such as: view metadata, read bands as array, etc), hence, I assume there were no issues with the path or the image file. I can also read single bands with memmap = True:

```<code>mem_band = img.read_band(0, use_memmap = True)
</code>```

Reading a single band results in an array of shape (lines, samples) with dtype: float64 and where lines and sample correspond to the respective values in the .hdr file.

However, trying to apply the .open_memmap() method to the BsqFile instance as follows:

```<code>mem = img.open_memmap(writable = True)
</code>```

results in the following error:

```<code>Runtime error
Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File
"/path/to/module/spectral/io/spyfile.py", line 809, in open_memmap dst_inter))
 File "/path/to/lib/site-packages/numpy/core/fromnumeric.py", line 536, in transpose
    return _wrapit(a, 'transpose', axes)
 File "/path/to/lib/site-packages/numpy/core/fromnumeric.py", line 45, in _wrapit
    result = getattr(asattr(obj), method)(*args, **kwds)
ValueError: axes don't match array
</code>```

Is this due to some incompatibilities between the numpy version that comes with the ArcMap-Python-Installation which I am required to use (numpy version 1.9.2)? Or are there other issues with the code or set-up?

Python version: 2.7.10

numpy version: 1.9.2

spectral version: 0.23.1

Edit

With the given Python version, spectral.envi.create_image() cannot create images of the given size due to an OverflowError. Potentially, this older Python version does not handle large numbers "correctly"?

Using another Python installation, the .open_memmap() method worked without issues.

Body:
I have some .bsq files with corresponding header files (.hdr). I want to open and edit them in Python, using the spectral (SPy) module.

Since I need to edit the files from within a Python Toolbox in ArcMap (that is, a single Python script which uses the Python installation that comes with ArcMap), I decided to copy the GitHub repository of the SPy module and import it as

import sys
sys.path.append("/path/to/module")
import spatial as spy

in order to be able to run the toolbox on any computer without having to install pip or other software. (I intend to just copy the Toolbox and the module folder, or, in a later step, create a single Python script comprising the Toolbox as well as the SPy-module code.)

I opened some .bsq-file and tried to subsequently edit it as memmap, following this example.

First, I opened the image as spectral.io.bsqfile.BsqFile:

path = "/path/to/image_header.hdr"
img = spy.open_image(path)

I am able to apply various methods to img (such as: view metadata, read bands as array, etc), hence, I assume there were no issues with the path or the image file. I can also read single bands with memmap = True:

mem_band = img.read_band(0, use_memmap = True)

Reading a single band results in an array of shape (lines, samples) with dtype: float64 and where lines and sample correspond to the respective values in the .hdr file.

However, trying to apply the .open_memmap() method to the BsqFile instance as follows:

mem = img.open_memmap(writable = True)

results in the following error:

Runtime error
Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File
"/path/to/module/spectral/io/spyfile.py", line 809, in open_memmap dst_inter))
 File "/path/to/lib/site-packages/numpy/core/fromnumeric.py", line 536, in transpose
    return _wrapit(a, 'transpose', axes)
 File "/path/to/lib/site-packages/numpy/core/fromnumeric.py", line 45, in _wrapit
    result = getattr(asattr(obj), method)(*args, **kwds)
ValueError: axes don't match array

Is this due to some incompatibilities between the numpy version that comes with the ArcMap-Python-Installation which I am required to use (numpy version 1.9.2)? Or are there other issues with the code or set-up?

Python version: 2.7.10

numpy version: 1.9.2

spectral version: 0.23.1

Edit

With the given Python version, spectral.envi.create_image() cannot create images of the given size due to an OverflowError. Potentially, this older Python version does not handle large numbers "correctly"?

Using another Python installation, the .open_memmap() method worked without issues.


问:
Prisma orderBy nested optional relationships
I am trying to write a Prisma Query (PostgreSQL) which selects users ordered by their name. However, other users can be dependent on "unregistered" users => meaning: A user's name can either be saved in the table "PreRegistrationDetails" (for unregistered users) or "UserDetails" once they are registered.

Now I would like to select all users and order by name. No matter if the name is "PreRegistrationDetails"."name" or "UserDetails"."name".

So far I have:

```<code>prismaClient.users.findAll({
  select: {
    id: true,
    certificate: true
  }
  orderBy: {
    preRegistrationDetails: {
      name: 'asc',
    },
    userDetails: {
      name: 'asc',
    }
  },
})
</code>```

However this does not work, since it just orders by "PreRegistrationDetails" first and by "UserDetails" afterward. I'd like to do that all in the Prisma query since I only need them ordered by name but don't need the name itself (This is a very specific edge case in the application).

Is there any way doing this using a Prisma query or will I have to select all information and then do it manually afterwards?

Body:
I am trying to write a Prisma Query (PostgreSQL) which selects users ordered by their name. However, other users can be dependent on "unregistered" users => meaning: A user's name can either be saved in the table "PreRegistrationDetails" (for unregistered users) or "UserDetails" once they are registered.

Now I would like to select all users and order by name. No matter if the name is "PreRegistrationDetails"."name" or "UserDetails"."name".

So far I have:

prismaClient.users.findAll({
  select: {
    id: true,
    certificate: true
  }
  orderBy: {
    preRegistrationDetails: {
      name: 'asc',
    },
    userDetails: {
      name: 'asc',
    }
  },
})

However this does not work, since it just orders by "PreRegistrationDetails" first and by "UserDetails" afterward. I'd like to do that all in the Prisma query since I only need them ordered by name but don't need the name itself (This is a very specific edge case in the application).

Is there any way doing this using a Prisma query or will I have to select all information and then do it manually afterwards?


问:
Download is disallowed
I would like to save the html to a file by creating a blob and then downloading/saving it.

In particular I would like to do this on the following website: https://news.yahoo.com/explainer-house-representatives-elects-speaker-135629660.html

When I run the following code (in the chrome console of the dev tools):

```<code>let iframes = document.querySelectorAll('iframe');
for (let i = 0; i < iframes.length; i++) {
    iframes[i].parentNode.removeChild(iframes[i]);
}
let blob = new Blob([new XMLSerializer().serializeToString(document)], {type: "html/text"});
let file_name = "yahoo-dwnld.html";

let saver = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
let blobURL = saver.href = URL.createObjectURL(blob), body = document.body;
saver.download = file_name;

body.appendChild(saver);
saver.dispatchEvent(new MouseEvent("click"));
body.removeChild(saver);
URL.revokeObjectURL(blobURL);
</code>```

I get the following error message:

Download is disallowed. The frame initiating or instantiating the
download is sandboxed, but the flag ‘allow-downloads’ is not set. See
https://www.chromestatus.com/feature/5706745674465280 for more
details.

First googling this error message let me to some solutions that said this is a problem with the iframes.

It also puzzles me that this error message is still referring to a frame that is sandboxed. However, I cannot locate this frame inside my html (I already removed all iframes) or better said: I do not know which element of the DOM I should modify by setting this sandbox attribute allow-downloads.

But since I removed them I do not understand why this still is a problem in my case.

Title: Download is disallowed

Body:
I would like to save the html to a file by creating a blob and then downloading/saving it.

In particular I would like to do this on the following website: https://news.yahoo.com/explainer-house-representatives-elects-speaker-135629660.html

When I run the following code (in the chrome console of the dev tools):

let iframes = document.querySelectorAll('iframe');
for (let i = 0; i < iframes.length; i++) {
    iframes[i].parentNode.removeChild(iframes[i]);
}
let blob = new Blob([new XMLSerializer().serializeToString(document)], {type: "html/text"});
let file_name = "yahoo-dwnld.html";

let saver = document.createElementNS("http://www.w3.org/1999/xhtml", "a");
let blobURL = saver.href = URL.createObjectURL(blob), body = document.body;
saver.download = file_name;

body.appendChild(saver);
saver.dispatchEvent(new MouseEvent("click"));
body.removeChild(saver);
URL.revokeObjectURL(blobURL);

I get the following error message:

Download is disallowed. The frame initiating or instantiating the
download is sandboxed, but the flag ‘allow-downloads’ is not set. See
https://www.chromestatus.com/feature/5706745674465280 for more
details.

First googling this error message let me to some solutions that said this is a problem with the iframes.

It also puzzles me that this error message is still referring to a frame that is sandboxed. However, I cannot locate this frame inside my html (I already removed all iframes) or better said: I do not know which element of the DOM I should modify by setting this sandbox attribute allow-downloads.

But since I removed them I do not understand why this still is a problem in my case.


问:
Is there a way to disable <Navigate> when I refresh the page?
Every time I refresh the page when I am using a component within the Private Route below, I navigate to the /login. Is there a way to prevent that from happening? I only want to navigate to login if there is no currentUser.</p>
```<code>const PrivateRoute = ({ children }) => {
  const { currentUser } = useContext(AuthContext);
  return currentUser ? children : <Navigate to="/login" />;
};

</code>```

Body:
Every time I refresh the page when I am using a component within the Private Route below, I navigate to the /login. Is there a way to prevent that from happening? I only want to navigate to login if there is no currentUser.

const PrivateRoute = ({ children }) => {
  const { currentUser } = useContext(AuthContext);
  return currentUser ? children : <Navigate to="/login" />;
};


问:
Restricting leaflet drawing lattitude
I am drawing a lat and lon using leaflet.  I've figured out how to restrict users from drawing outside of a longitude.  But can't figure out how to prevent them from drawing outside of a longitude.
Here is the Fiddle if you draw from canada to top of the map, it does prevent you from going past 85 however the bounding box twists.  If try to draw past 180, -180 on map you get stopped and the box does not do the twist.</p>
```<code>var vertexMarkerClass = L.Editable.VertexMarker.extend({
onDrag: function(e) {
e.vertex = this;
var iconPos = L.DomUtil.getPosition(this._icon),
  latlng = this._map.layerPointToLatLng(iconPos);

if (latlng.lng < -180) {
  e.latlng.lng = latlng.lng = -179;
  this.setLatLng(latlng);
}
if (latlng.lng > 180) {
  e.latlng.lng = latlng.lng = 179;
  this.setLatLng(latlng);
}

if(latlng.lat>85)
{
    e.latlng.lng = latlng.lat = 84;
  this.setLatLng(latlng);
}

this.editor.onVertexMarkerDrag(e);

this.latlng.update(latlng);
this._latlng = this.latlng;
this.editor.refresh();
if (this.middleMarker) this.middleMarker.updateLatLng();
var next = this.getNext();
if (next && next.middleMarker) next.middleMarker.updateLatLng();
}
});
map.editTools.options.vertexMarkerClass = vertexMarkerClass;
</code>```

Title: Restricting leaflet drawing lattitude

Body:
I am drawing a lat and lon using leaflet.  I've figured out how to restrict users from drawing outside of a longitude.  But can't figure out how to prevent them from drawing outside of a longitude.
Here is the Fiddle if you draw from canada to top of the map, it does prevent you from going past 85 however the bounding box twists.  If try to draw past 180, -180 on map you get stopped and the box does not do the twist.

var vertexMarkerClass = L.Editable.VertexMarker.extend({
onDrag: function(e) {
e.vertex = this;
var iconPos = L.DomUtil.getPosition(this._icon),
  latlng = this._map.layerPointToLatLng(iconPos);

if (latlng.lng < -180) {
  e.latlng.lng = latlng.lng = -179;
  this.setLatLng(latlng);
}
if (latlng.lng > 180) {
  e.latlng.lng = latlng.lng = 179;
  this.setLatLng(latlng);
}

if(latlng.lat>85)
{
    e.latlng.lng = latlng.lat = 84;
  this.setLatLng(latlng);
}

this.editor.onVertexMarkerDrag(e);

this.latlng.update(latlng);
this._latlng = this.latlng;
this.editor.refresh();
if (this.middleMarker) this.middleMarker.updateLatLng();
var next = this.getNext();
if (next && next.middleMarker) next.middleMarker.updateLatLng();
}
});
map.editTools.options.vertexMarkerClass = vertexMarkerClass;