问:
AWS App Runner Deploy fails due to failing health checks of my nodejs app image
I would like to start off by saying I am pretty new to containerization, and the Amazon services that use them. I am implementing whatever I am learning from educational videos.

I have a NodeJs App [essentially a set of APIs] that I want to deploy. To make the code portable I have dockerized my nodejs image, and also published it to ECR.

However, when I am trying to deploy it using the App runner - the deployment failed, saying the health check failed.

I have looked up similar issues here on SO, and their response was deleting the current app running service and creating a new one, which doesn't work for me.

I figured the culprit might be:

using the App Runner GUI, the health check configuration is preset to TCP protocol, when my app uses http.

to be able to custom configure my health check object, I used the AWS CLI, but I am still facing the same issue.

Additionally, I also added a health check endpoint to my app at / path that returns 200 status and an ok flag.

The error says:
health check failed on port 8080. make sure you have configured the port number correctly

Now, my port is configured at 8080 only.

Steps that weere succesful:

building the docker image

pushing the docker image to ECR

Additionally, I am pasting my appRunner.json configuration file for more clarity and I will also post my docker file:

appRunner config json file:

{
    "ServiceName": "micro_server",
    "SourceConfiguration": {
        "AuthenticationConfiguration": {
         "AccessRoleArn": "<my ARN_ I didnt post the actula string here>"
      },
        "AutoDeploymentsEnabled": true,
        "ImageRepository": {
            "ImageIdentifier": "397552631910.dkr.ecr.us-east-1.amazonaws.com/mico_server:latest",
            "ImageRepositoryType": "ECR"
        }
    },
    "HealthCheckConfiguration": {
        "HealthyThreshold": 5,
        "Interval": 10,
        "Path": "/",
        "Protocol": "HTTP",
        "UnhealthyThreshold": 5
    },
    "InstanceConfiguration": {
        "Cpu": "1 vCPU",
        "Memory": "3 GB"
    }
}
```
<ul>
<li>dockerfile</li>
</ul>
<pre class="lang-docker prettyprint-override"><code>FROM node:gallium-alpine3.14
WORKDIR /
ENV NODE_ENV=dev

COPY / .
RUN npm install

CMD npm run serve
EXPOSE 8080
</code>```

this is how my index.js looks like

const express = require('express');
const cors = require('cors');
var bodyParser = require('body-parser')
const fs = require('fs')

const swaggerUi = require('swagger-ui-express');
const swaggerSpec = require('./swaggerConfig');
const connectToDatabase = require('./db');

require('dotenv').config()

const app = express();
// url encoded
app.use(bodyParser.urlencoded({ extended: false }))

// parse application/json
app.use(bodyParser.json())

const port = process.env.PORT || 8080;

app.use(cors());
app.use(express.json());

app.use(express.static('public'));
app.use('/images', express.static(__dirname + '/Images'))

app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));

// health check EP for http protocol
app.get('/', (req, res) => {
  res.status(200).json({ok:true})
})

fs.readdirSync('./routes').map(route => {
  app.use(`/api/${route.split('.')[0]}`, require('./routes/' + route))
})

// BASE_URL/API
app.listen(port, () => {
  console.log(`Listening on port ${port}`);
  // console.log(process.env)

});
```

Dealing w Docker
I am on a linux machine - garuda.

to run my docker image, I use the --network='host' flag to run my app and also be able to connect to it at localhost:PORT

If I run it without the --network='host' flag, the app still runs on 8080, but I can't access it on localhost:8080.

Body:
I would like to start off by saying I am pretty new to containerization, and the Amazon services that use them. I am implementing whatever I am learning from educational videos.

I have a NodeJs App [essentially a set of APIs] that I want to deploy. To make the code portable I have dockerized my nodejs image, and also published it to ECR.

However, when I am trying to deploy it using the App runner - the deployment failed, saying the health check failed.

I have looked up similar issues here on SO, and their response was deleting the current app running service and creating a new one, which doesn't work for me.

I figured the culprit might be:

using the App Runner GUI, the health check configuration is preset to TCP protocol, when my app uses http.

to be able to custom configure my health check object, I used the AWS CLI, but I am still facing the same issue.

Additionally, I also added a health check endpoint to my app at / path that returns 200 status and an ok flag.

The error says:
health check failed on port 8080. make sure you have configured the port number correctly

Now, my port is configured at 8080 only.

Steps that weere succesful:

building the docker image

pushing the docker image to ECR

Additionally, I am pasting my appRunner.json configuration file for more clarity and I will also post my docker file:

appRunner config json file:

{
    "ServiceName": "micro_server",
    "SourceConfiguration": {
        "AuthenticationConfiguration": {
         "AccessRoleArn": "<my ARN_ I didnt post the actula string here>"
      },
        "AutoDeploymentsEnabled": true,
        "ImageRepository": {
            "ImageIdentifier": "397552631910.dkr.ecr.us-east-1.amazonaws.com/mico_server:latest",
            "ImageRepositoryType": "ECR"
        }
    },
    "HealthCheckConfiguration": {
        "HealthyThreshold": 5,
        "Interval": 10,
        "Path": "/",
        "Protocol": "HTTP",
        "UnhealthyThreshold": 5
    },
    "InstanceConfiguration": {
        "Cpu": "1 vCPU",
        "Memory": "3 GB"
    }
}

dockerfile

FROM node:gallium-alpine3.14
WORKDIR /
ENV NODE_ENV=dev

COPY / .
RUN npm install

CMD npm run serve
EXPOSE 8080

this is how my index.js looks like

const express = require('express');
const cors = require('cors');
var bodyParser = require('body-parser')
const fs = require('fs')

const swaggerUi = require('swagger-ui-express');
const swaggerSpec = require('./swaggerConfig');
const connectToDatabase = require('./db');

require('dotenv').config()

const app = express();
// url encoded
app.use(bodyParser.urlencoded({ extended: false }))

// parse application/json
app.use(bodyParser.json())

const port = process.env.PORT || 8080;

app.use(cors());
app.use(express.json());

app.use(express.static('public'));
app.use('/images', express.static(__dirname + '/Images'))

app.use('/docs', swaggerUi.serve, swaggerUi.setup(swaggerSpec));

// health check EP for http protocol
app.get('/', (req, res) => {
  res.status(200).json({ok:true})
})

fs.readdirSync('./routes').map(route => {
  app.use(`/api/${route.split('.')[0]}`, require('./routes/' + route))
})

// BASE_URL/API
app.listen(port, () => {
  console.log(`Listening on port ${port}`);
  // console.log(process.env)

});

Dealing w Docker
I am on a linux machine - garuda.

to run my docker image, I use the --network='host' flag to run my app and also be able to connect to it at localhost:PORT

If I run it without the --network='host' flag, the app still runs on 8080, but I can't access it on localhost:8080.


来源: stackexchange

问:
Object Reference not set to an instance of an object
I'm building an API application and when I call this service method the way it's below, it just works fine:

```<code>public IEnumerable<Produtos> GetAll(string term, int page, int pageSize)
        {
            var products = _repository.GetAllProducts().Skip((page - 1) * pageSize).Take(pageSize).ToList();

            return products;

        }
</code>```

It returns a List of objects. Fair enough.

But then, when I implement this logic, it fails to retrieve me any data:

```<code>public IEnumerable<Produtos> GetAll(string term, int page, int pageSize)
        {
            var products = _repository.GetAllProducts().Skip((page - 1) * pageSize).Take(pageSize).ToList();

            List<Produtos> produtos = new List<Produtos>();

            products.ForEach(produto =>
                {
                    Console.WriteLine(produto);
                    if (produto.Nome.Contains(term))
                    {
                        Console.WriteLine("if statement");
                        produtos.Add(produto);
                    }
                }
            );

            if (!(produtos.Count > 0))
            {
                throw new Exception();
            }

            return produtos;

        }
</code>```

Also, the IDE tells me that there is not an instantiated object:

Strangely, when I debug it, it stops looping over the list when it reaches product.name == "kn"

Here's my db with random values I did insert into.

ContentLicense: CC BY-SA 4.0

Body:
I'm building an API application and when I call this service method the way it's below, it just works fine:

public IEnumerable<Produtos> GetAll(string term, int page, int pageSize)
        {
            var products = _repository.GetAllProducts().Skip((page - 1) * pageSize).Take(pageSize).ToList();

            return products;

        }

It returns a List of objects. Fair enough.

But then, when I implement this logic, it fails to retrieve me any data:

public IEnumerable<Produtos> GetAll(string term, int page, int pageSize)
        {
            var products = _repository.GetAllProducts().Skip((page - 1) * pageSize).Take(pageSize).ToList();

            List<Produtos> produtos = new List<Produtos>();

            products.ForEach(produto =>
                {
                    Console.WriteLine(produto);
                    if (produto.Nome.Contains(term))
                    {
                        Console.WriteLine("if statement");
                        produtos.Add(produto);
                    }
                }
            );

            if (!(produtos.Count > 0))
            {
                throw new Exception();
            }

            return produtos;

        }

Also, the IDE tells me that there is not an instantiated object:

Strangely, when I debug it, it stops looping over the list when it reaches product.name == "kn"

Here's my db with random values I did insert into.


问:
Webpack CSS Bundle with Duplicate Bootstrap Libraries
My web application is generating a bundle.css file and it is duplicating the bootstrap css library multiple times. The css filesize is 2.4mb causing performance issues during load (before cache).

I have no idea who setup the webpack configuration, or if this is an issue with one of my npm packages.

Here is a snippet of my css preloader config.

```<code>{
          test: /\.(scss|css)$/,
          use: [
            {
              loader: MiniCssExtractPlugin.loader,
            },
            {
              loader: 'css-loader',
              options: {
                importLoaders: 1,
                minimize: mode != "production" ? true : false,
              }
            },
            // {
            //   loader: 'external-downloader'
            // },
            {
              loader: 'postcss-loader',
              options: {
                ident: 'postcss',
                plugins: [
                  autoprefixer({

                    browsers: ['Android >= 7', 'iOS >=9']
                  }),
                  cssnano({})
                ],
              }
            },
            {
              loader: 'sass-loader',
              options: {
                sourceMap: mode != "production" ? true : false
              }
            },
</code>```

Thanks in advance.

I need a clean CSS file, without duplicates.

Body:
My web application is generating a bundle.css file and it is duplicating the bootstrap css library multiple times. The css filesize is 2.4mb causing performance issues during load (before cache).

I have no idea who setup the webpack configuration, or if this is an issue with one of my npm packages.

Here is a snippet of my css preloader config.

{
          test: /\.(scss|css)$/,
          use: [
            {
              loader: MiniCssExtractPlugin.loader,
            },
            {
              loader: 'css-loader',
              options: {
                importLoaders: 1,
                minimize: mode != "production" ? true : false,
              }
            },
            // {
            //   loader: 'external-downloader'
            // },
            {
              loader: 'postcss-loader',
              options: {
                ident: 'postcss',
                plugins: [
                  autoprefixer({

                    browsers: ['Android >= 7', 'iOS >=9']
                  }),
                  cssnano({})
                ],
              }
            },
            {
              loader: 'sass-loader',
              options: {
                sourceMap: mode != "production" ? true : false
              }
            },

Thanks in advance.

I need a clean CSS file, without duplicates.


问:
Create multi-channels in Pusher Laravel with different events
I have a multi-vendor E-commerce with users making orders, and drivers making offers on these orders,
I made a pusher channel so that when a user makes an order it shows on the drivers home realtime.

```<code>class NewOrderEvent implements ShouldBroadcastNow
{
    use Dispatchable, InteractsWithSockets, SerializesModels;
    public $afterCommit = true;

    public function __construct(
        public Order $order,

    ) {
    }

    public function broadcastOn()
    {
        return new PrivateChannel('order');
    }
    public function broadcastAs()
    {
        return 'new-order';
    }
    public function broadcastWith()
    {

        return [
            'order' => OrderResource::make($this->order),
        ];
    }
}

</code>```

I made another pusher channel so the user can see the offers on his order, 'order-'$orderId

```<code>class NewOfferEvent implements ShouldBroadcastNow
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public Order $order;
    public OrderOffer $offer;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct(Order $order , OrderOffer $offer)
    {
        $this->order = $order;
        $this->offer = $offer;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return ['offer-'. $this->order->id];
    }

    public function broadcastAs()
    {
        return 'new-offer';
    }

    public function broadcastWith()
    {

        return [
            'offer' => $this->offer,
        ];
    }
}

</code>```

and in the .env I have the credentials of the first channel

```<code>BROADCAST_DRIVER=pusher
PUSHER_APP_ID=*******
PUSHER_APP_KEY=******
PUSHER_APP_SECRET=****
PUSHER_APP_CLUSTER=**

</code>```

How to make the other channel work?
My problem is that the new-offer event isn't sent in pusher because the credentials of its channel in pusher is different from the credentials I have in the .env(which are the credentials of the 'order' channel)

I tried adding another driver in the broadcasting.php like this:

```<code> 'connections' => [

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com'),
                'port' => env('PUSHER_PORT', 443),
                'scheme' => env('PUSHER_SCHEME', 'https'),
                'encrypted' => true,
                'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
       ],

 'pusher1' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY1'),
            'secret' => env('PUSHER_APP_SECRET1'),
            'app_id' => env('PUSHER_APP_ID1'),
            'options' => [
                'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER1', 'mt1').'.pusher.com'),
                'port' => env('PUSHER_PORT', 443),
                'scheme' => env('PUSHER_SCHEME', 'https'),
                'encrypted' => true,
                'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
        ],

    ],

</code>```

But it did not work, what should I do?

Body:
I have a multi-vendor E-commerce with users making orders, and drivers making offers on these orders,
I made a pusher channel so that when a user makes an order it shows on the drivers home realtime.

class NewOrderEvent implements ShouldBroadcastNow
{
    use Dispatchable, InteractsWithSockets, SerializesModels;
    public $afterCommit = true;

    public function __construct(
        public Order $order,

    ) {
    }

    public function broadcastOn()
    {
        return new PrivateChannel('order');
    }
    public function broadcastAs()
    {
        return 'new-order';
    }
    public function broadcastWith()
    {

        return [
            'order' => OrderResource::make($this->order),
        ];
    }
}

I made another pusher channel so the user can see the offers on his order, 'order-'$orderId

class NewOfferEvent implements ShouldBroadcastNow
{
    use Dispatchable, InteractsWithSockets, SerializesModels;

    public Order $order;
    public OrderOffer $offer;

    /**
     * Create a new event instance.
     *
     * @return void
     */
    public function __construct(Order $order , OrderOffer $offer)
    {
        $this->order = $order;
        $this->offer = $offer;
    }

    /**
     * Get the channels the event should broadcast on.
     *
     * @return \Illuminate\Broadcasting\Channel|array
     */
    public function broadcastOn()
    {
        return ['offer-'. $this->order->id];
    }

    public function broadcastAs()
    {
        return 'new-offer';
    }

    public function broadcastWith()
    {

        return [
            'offer' => $this->offer,
        ];
    }
}

and in the .env I have the credentials of the first channel

BROADCAST_DRIVER=pusher
PUSHER_APP_ID=*******
PUSHER_APP_KEY=******
PUSHER_APP_SECRET=****
PUSHER_APP_CLUSTER=**

How to make the other channel work?
My problem is that the new-offer event isn't sent in pusher because the credentials of its channel in pusher is different from the credentials I have in the .env(which are the credentials of the 'order' channel)

I tried adding another driver in the broadcasting.php like this:

 'connections' => [

        'pusher' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY'),
            'secret' => env('PUSHER_APP_SECRET'),
            'app_id' => env('PUSHER_APP_ID'),
            'options' => [
                'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com'),
                'port' => env('PUSHER_PORT', 443),
                'scheme' => env('PUSHER_SCHEME', 'https'),
                'encrypted' => true,
                'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
       ],

 'pusher1' => [
            'driver' => 'pusher',
            'key' => env('PUSHER_APP_KEY1'),
            'secret' => env('PUSHER_APP_SECRET1'),
            'app_id' => env('PUSHER_APP_ID1'),
            'options' => [
                'host' => env('PUSHER_HOST', 'api-'.env('PUSHER_APP_CLUSTER1', 'mt1').'.pusher.com'),
                'port' => env('PUSHER_PORT', 443),
                'scheme' => env('PUSHER_SCHEME', 'https'),
                'encrypted' => true,
                'useTLS' => env('PUSHER_SCHEME', 'https') === 'https',
            ],
            'client_options' => [
                // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html
            ],
        ],

    ],

But it did not work, what should I do?


问:
MagicOnion on Unity3D, .dll file ChannelBase is missing shutdownasync functions
I've been trying to correct an error in the script GrpcChannelx, when it references as override the methods in ChannelBase ShutdownAsync and ShutdownAsyncCore the script can't find them, when I go to ChannelBase both methods aren't there and I can't seem to add them, not even with updates and grpc packages.

I need to find a way to make ChannelBase have those methods, is there a way I can modify this? how should I go on about this?

What I did:
I added the packages as I did in the example expecting to have the functions on ChannelBase.I followed the steps in this link.

https://9to5tutorial.com/unity-net-core-magiconion-v3-environment-building-hands-on

What I got:
They aren't there and I can't seem to find a way to add them.


问:
useExternalScript hook will only work once with NextJS Link
I've a simpel project with two pages in NextJS & Typescript and I want to load an external script on the second page only. Normally I would use the Script tag from NextJS, but the navigation is build with the Link tag from NextJS. So somehow the Script tag will not work with the Link tag, without a full reload. See GitHub issue.

So I built a custom hook for that, useExternalScript:

```<code>import { useEffect, useState } from 'react';

export const useExternalScript = (url: string) => {
  const [isLoaded, setIsLoaded] = useState(false);
  const [error, setError] = useState(false);

  useEffect(() => {
    const script = document.createElement('script');
    script.src = url;
    script.async = true;
    document.body.appendChild(script);

    script.onerror = () => setError(true);
    script.onload = () => setIsLoaded(true);

    return () => {
      document.body.removeChild(script);
    };
  }, [url]);

  return {
    isLoaded,
    error
  };
};
</code>```

And I call the custom hook on my page, like:

```<code> const { error, isLoaded: scriptIsLoaded } = useExternalScript('https://platform.twitter.com/widgets.js');

return (
<div>
 {scriptIsLoaded && <TwitterComments />}
</div>
)
</code>```

Weird enough it will work the first time, but as soon as you go back and do it again, it doesn't work anymore. At least the onLoad is triggered and true, so <TwitterComments /> does load. But not correctly, because it looks like the script itself isn't loaded.

As soon as I remove the conditional render, and only return TwitterComments, like:

```<code><div>
 <TwitterComments />
</div>
</code>```

There is no problem at all. So I've no idea why it only works once when it's in a conditional render?

Body:
I've a simpel project with two pages in NextJS & Typescript and I want to load an external script on the second page only. Normally I would use the Script tag from NextJS, but the navigation is build with the Link tag from NextJS. So somehow the Script tag will not work with the Link tag, without a full reload. See GitHub issue.

So I built a custom hook for that, useExternalScript:

import { useEffect, useState } from 'react';

export const useExternalScript = (url: string) => {
  const [isLoaded, setIsLoaded] = useState(false);
  const [error, setError] = useState(false);

  useEffect(() => {
    const script = document.createElement('script');
    script.src = url;
    script.async = true;
    document.body.appendChild(script);

    script.onerror = () => setError(true);
    script.onload = () => setIsLoaded(true);

    return () => {
      document.body.removeChild(script);
    };
  }, [url]);

  return {
    isLoaded,
    error
  };
};

And I call the custom hook on my page, like:

 const { error, isLoaded: scriptIsLoaded } = useExternalScript('https://platform.twitter.com/widgets.js');

return (

 {scriptIsLoaded && <TwitterComments />}

)

Weird enough it will work the first time, but as soon as you go back and do it again, it doesn't work anymore. At least the onLoad is triggered and true, so <TwitterComments /> does load. But not correctly, because it looks like the script itself isn't loaded.

As soon as I remove the conditional render, and only return TwitterComments, like:

 <TwitterComments />

There is no problem at all. So I've no idea why it only works once when it's in a conditional render?


问:
Apex Trigger that emails user once user is assigned a case
I have a trigger that does a round robin assignment to queue that assigns cases. How would be able to send a custom email to the user once the case is assigned to them via apex? How can I query which user was assigned the last case in the queue? My code is listed below. Thank you.</p>
```<code>trigger ConsultationCaseAssignment on Case(before insert, before update) {
  if (Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)) {
    // Get the queue user details
    List<Group> queues = [
      SELECT Id, (SELECT Id, UserOrGroupId FROM GroupMembers ORDER BY ID ASC)
      FROM Group
      WHERE Type = 'Queue' AND DeveloperName = 'Consultation_Requests'
    ];

    // Get the index of the last case assigned user in the queue
    Case_Round_Robin_Assignment__c lrr = Case_Round_Robin_Assignment__c.getOrgDefaults();
    Integer userIndex = (lrr.get('User_Index__c') == null ||
      Integer.valueOf(lrr.get('User_Index__c')) < -1)
      ? -1
      : Integer.valueOf(lrr.get('User_Index__c'));

    if (queues.size() > 0 && queues.get(0).GroupMembers.size() > 0) {
      Id queueId = queues.get(0).Id;
      Integer groupMemberSize = queues.get(0).GroupMembers.size();
      for (Case c : Trigger.new) {
        if (c.OwnerId != queueId) {
          Integer caseUserIndex = (userIndex + 1) >= groupMemberSize
            ? 0
            : userIndex + 1;
          c.OwnerId = queues.get(0)
            .GroupMembers.get(caseUserIndex)
            .UserOrGroupId;
          System.Debug(c.OwnerId);
          c.RecordTypeId = '0128Z000000JUwLQAW';
          userIndex = caseUserIndex;
        }
      }

      // Update the custom settings user index with the last lead assigned user
      lrr.User_Index__c = userIndex;
      update lrr;
    }
  }
}

</code>```
```<code></code>```

Body:
I have a trigger that does a round robin assignment to queue that assigns cases. How would be able to send a custom email to the user once the case is assigned to them via apex? How can I query which user was assigned the last case in the queue? My code is listed below. Thank you.

trigger ConsultationCaseAssignment on Case(before insert, before update) {
  if (Trigger.isBefore && (Trigger.isInsert || Trigger.isUpdate)) {
    // Get the queue user details
    List<Group> queues = [
      SELECT Id, (SELECT Id, UserOrGroupId FROM GroupMembers ORDER BY ID ASC)
      FROM Group
      WHERE Type = 'Queue' AND DeveloperName = 'Consultation_Requests'
    ];

    // Get the index of the last case assigned user in the queue
    Case_Round_Robin_Assignment__c lrr = Case_Round_Robin_Assignment__c.getOrgDefaults();
    Integer userIndex = (lrr.get('User_Index__c') == null ||
      Integer.valueOf(lrr.get('User_Index__c')) < -1)
      ? -1
      : Integer.valueOf(lrr.get('User_Index__c'));

    if (queues.size() > 0 && queues.get(0).GroupMembers.size() > 0) {
      Id queueId = queues.get(0).Id;
      Integer groupMemberSize = queues.get(0).GroupMembers.size();
      for (Case c : Trigger.new) {
        if (c.OwnerId != queueId) {
          Integer caseUserIndex = (userIndex + 1) >= groupMemberSize
            ? 0
            : userIndex + 1;
          c.OwnerId = queues.get(0)
            .GroupMembers.get(caseUserIndex)
            .UserOrGroupId;
          System.Debug(c.OwnerId);
          c.RecordTypeId = '0128Z000000JUwLQAW';
          userIndex = caseUserIndex;
        }
      }

      // Update the custom settings user index with the last lead assigned user
      lrr.User_Index__c = userIndex;
      update lrr;
    }
  }
}


问:
Behavior of implicit declaration declared after usage
Scala 2.13.10. Consider the following code:

```<code>object Hello extends App {
  def foo(implicit i: Int) = println(i)
  foo
  implicit val i: Int = 42
  foo
}
</code>```

It compiles with the warning

```<code> Reference to uninitialized value i
[warn]   foo
</code>```

and prints

```<code>0
42
</code>```

The expected behavior is that it compiles with an error of implicit not found.

Why does it behave the way it is?

Body:
Scala 2.13.10. Consider the following code:

object Hello extends App {
  def foo(implicit i: Int) = println(i)
  foo
  implicit val i: Int = 42
  foo
}

It compiles with the warning

 Reference to uninitialized value i
[warn]   foo

and prints

0
42

The expected behavior is that it compiles with an error of implicit not found.

Why does it behave the way it is?


问:
bigdecimal gem 1.4.1 fails to build
Trying to get bigdecimal 1.4.1. or 1.3.5 to compile in a rails project. I get:

```<code>bobwalsh@iMac2021 webservices % gem install bigdecimal -v '1.3.5'
Building native extensions. This could take a while...
ERROR:  Error installing bigdecimal:
    ERROR: Failed to build gem native extension.

    current directory: /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bigdecimal-1.3.5/ext/bigdecimal
/Users/bobwalsh/.rbenv/versions/3.1.2/bin/ruby -I /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0 extconf.rb
checking for labs() in stdlib.h... yes
checking for llabs() in stdlib.h... yes
checking for finite() in math.h... yes
checking for isfinite() in math.h... no
checking for struct RRational in ruby.h... no
checking for rb_rational_num() in ruby.h... yes
checking for rb_rational_den() in ruby.h... yes
checking for rb_array_const_ptr() in ruby.h... yes
checking for rb_sym2str() in ruby.h... yes
creating Makefile

current directory: /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bigdecimal-1.3.5/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20221229-75388-86psx7 sitelibdir\=./.gem.20221229-75388-86psx7 clean

current directory: /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bigdecimal-1.3.5/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20221229-75388-86psx7 sitelibdir\=./.gem.20221229-75388-86psx7
compiling bigdecimal.c
bigdecimal.c:366:28: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                       INT2NUM(p->MaxPrec*VpBaseFig()));
                       ~~~~~~~ ~~~~~~~~~~^~~~~~~~~~~~
bigdecimal.c:365:39: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
    obj = rb_assoc_new(INT2NUM(p->Prec*VpBaseFig()),
                       ~~~~~~~ ~~~~~~~^~~~~~~~~~~~
bigdecimal.c:439:5: error: implicit declaration of function 'rb_check_safe_obj' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    rb_check_safe_obj(str);
    ^
bigdecimal.c:439:5: note: did you mean 'rb_check_safe_str'?
/Users/bobwalsh/.rbenv/versions/3.1.2/include/ruby-3.1.0/ruby/internal/core/rstring.h:383:6: note: 'rb_check_safe_str' declared here
void rb_check_safe_str(VALUE);
     ^
bigdecimal.c:2047:6: error: implicit declaration of function 'rb_check_safe_obj' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            rb_check_safe_obj(f);
            ^
bigdecimal.c:2152:30: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    rb_ary_push(obj, INT2NUM(e));
                     ~~~~~~~ ^
bigdecimal.c:2165:20: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    return INT2NUM(e);
           ~~~~~~~ ^
bigdecimal.c:2737:27: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
    VALUE  nCur = INT2NUM(VpGetPrecLimit());
                  ~~~~~~~ ^~~~~~~~~~~~~~~~
5 warnings and 2 errors generated.
make: *** [bigdecimal.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bigdecimal-1.3.5 for inspection.
Results logged to /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/extensions/x86_64-darwin-21/3.1.0/bigdecimal-1.3.5/gem_make.out
</code>```

What do I do to get this working?

Title: bigdecimal gem 1.4.1 fails to build

Body:
Trying to get bigdecimal 1.4.1. or 1.3.5 to compile in a rails project. I get:

bobwalsh@iMac2021 webservices % gem install bigdecimal -v '1.3.5'
Building native extensions. This could take a while...
ERROR:  Error installing bigdecimal:
    ERROR: Failed to build gem native extension.

    current directory: /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bigdecimal-1.3.5/ext/bigdecimal
/Users/bobwalsh/.rbenv/versions/3.1.2/bin/ruby -I /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/site_ruby/3.1.0 extconf.rb
checking for labs() in stdlib.h... yes
checking for llabs() in stdlib.h... yes
checking for finite() in math.h... yes
checking for isfinite() in math.h... no
checking for struct RRational in ruby.h... no
checking for rb_rational_num() in ruby.h... yes
checking for rb_rational_den() in ruby.h... yes
checking for rb_array_const_ptr() in ruby.h... yes
checking for rb_sym2str() in ruby.h... yes
creating Makefile

current directory: /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bigdecimal-1.3.5/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20221229-75388-86psx7 sitelibdir\=./.gem.20221229-75388-86psx7 clean

current directory: /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bigdecimal-1.3.5/ext/bigdecimal
make DESTDIR\= sitearchdir\=./.gem.20221229-75388-86psx7 sitelibdir\=./.gem.20221229-75388-86psx7
compiling bigdecimal.c
bigdecimal.c:366:28: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
                       INT2NUM(p->MaxPrec*VpBaseFig()));
                       ~~~~~~~ ~~~~~~~~~~^~~~~~~~~~~~
bigdecimal.c:365:39: warning: implicit conversion loses integer precision: 'unsigned long' to 'int' [-Wshorten-64-to-32]
    obj = rb_assoc_new(INT2NUM(p->Prec*VpBaseFig()),
                       ~~~~~~~ ~~~~~~~^~~~~~~~~~~~
bigdecimal.c:439:5: error: implicit declaration of function 'rb_check_safe_obj' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
    rb_check_safe_obj(str);
    ^
bigdecimal.c:439:5: note: did you mean 'rb_check_safe_str'?
/Users/bobwalsh/.rbenv/versions/3.1.2/include/ruby-3.1.0/ruby/internal/core/rstring.h:383:6: note: 'rb_check_safe_str' declared here
void rb_check_safe_str(VALUE);
     ^
bigdecimal.c:2047:6: error: implicit declaration of function 'rb_check_safe_obj' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
            rb_check_safe_obj(f);
            ^
bigdecimal.c:2152:30: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    rb_ary_push(obj, INT2NUM(e));
                     ~~~~~~~ ^
bigdecimal.c:2165:20: warning: implicit conversion loses integer precision: 'ssize_t' (aka 'long') to 'int' [-Wshorten-64-to-32]
    return INT2NUM(e);
           ~~~~~~~ ^
bigdecimal.c:2737:27: warning: implicit conversion loses integer precision: 'size_t' (aka 'unsigned long') to 'int' [-Wshorten-64-to-32]
    VALUE  nCur = INT2NUM(VpGetPrecLimit());
                  ~~~~~~~ ^~~~~~~~~~~~~~~~
5 warnings and 2 errors generated.
make: *** [bigdecimal.o] Error 1

make failed, exit code 2

Gem files will remain installed in /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/gems/bigdecimal-1.3.5 for inspection.
Results logged to /Users/bobwalsh/.rbenv/versions/3.1.2/lib/ruby/gems/3.1.0/extensions/x86_64-darwin-21/3.1.0/bigdecimal-1.3.5/gem_make.out

What do I do to get this working?


问:
How do I get useful data from a UDP socket using GNAT.Sockets in Ada?

Summary:

I am writing a server in Ada that should listen and reply to messages received over UDP. I am using the GNAT.Sockets library and have created a socket and bound it to a port. However, I am not sure how to listen for and receive messages on the socket. The Listen_Socket function is for TCP sockets and it seems that using Stream with UDP sockets is not recommended. I have seen the receive_socket and receive_vector procedures as alternatives, but I am not sure how to use them or how to convert the output to a usable format.

More details:

I am writing a server that should reply to messages that it gets over UDP. A minimal example of what I have so far would look like this:

```<code>with GNAT.Sockets;use GNAT.Sockets;

procedure udp is
    sock: Socket_Type;
    family: Family_Type:=Family_Inet;
    port: Port_Type:=12345;
    addr: Sock_Addr_Type(family);
begin
    Create_Socket(sock,family,Socket_Datagram);
    addr.Addr:=Any_Inet_Addr;
    addr.Port:=port;
    Bind_Socket(sock,addr);
    -- Listen_Socket(sock); -- A TCP thing, not for UDP.
    -- now what?
end UDP;
</code>```

For a TCP socket, I can listen, accept, then use the Stream function to get a nice way to read the data (as in 'Read and 'Input). While the Stream function still exists, I have found an archive of a ten year old comp.lang.ada thread in which multiple people say not to use streams with UDP.

Looking in g-socket.ads, I do see alternatives: the receive_socket and receive_vector procedures. However, the output of the former is a Stream_Element_Array (with an offset indicating the length), and the latter has something similar, just with some kind of length associated with each Stream_Element.

According to https://stackoverflow.com/a/40045312/7105391, the way to change these types into a stream, is to not get them in the first place, and instead get a stream, which is not particularly helpful here.

Over at this github gist I found , Unchecked_Conversion is being used to turn the arrays into strings and vice versa, but given that the reference manual (13.13.1) says that type Stream_Element is mod <implementation-defined>;, I'm not entirely comfortable using that approach.

All in all, I'm pretty confused about how I'm supposed to do this. I'm even more confused about the lack of examples online, as this should be a pretty basic thing to do.

Body:
Summary:

I am writing a server in Ada that should listen and reply to messages received over UDP. I am using the GNAT.Sockets library and have created a socket and bound it to a port. However, I am not sure how to listen for and receive messages on the socket. The Listen_Socket function is for TCP sockets and it seems that using Stream with UDP sockets is not recommended. I have seen the receive_socket and receive_vector procedures as alternatives, but I am not sure how to use them or how to convert the output to a usable format.

More details:

I am writing a server that should reply to messages that it gets over UDP. A minimal example of what I have so far would look like this:

with GNAT.Sockets;use GNAT.Sockets;

procedure udp is
    sock: Socket_Type;
    family: Family_Type:=Family_Inet;
    port: Port_Type:=12345;
    addr: Sock_Addr_Type(family);
begin
    Create_Socket(sock,family,Socket_Datagram);
    addr.Addr:=Any_Inet_Addr;
    addr.Port:=port;
    Bind_Socket(sock,addr);
    -- Listen_Socket(sock); -- A TCP thing, not for UDP.
    -- now what?
end UDP;

For a TCP socket, I can listen, accept, then use the Stream function to get a nice way to read the data (as in 'Read and 'Input). While the Stream function still exists, I have found an archive of a ten year old comp.lang.ada thread in which multiple people say not to use streams with UDP.

Looking in g-socket.ads, I do see alternatives: the receive_socket and receive_vector procedures. However, the output of the former is a Stream_Element_Array (with an offset indicating the length), and the latter has something similar, just with some kind of length associated with each Stream_Element.

According to https://stackoverflow.com/a/40045312/7105391, the way to change these types into a stream, is to not get them in the first place, and instead get a stream, which is not particularly helpful here.

Over at this github gist I found , Unchecked_Conversion is being used to turn the arrays into strings and vice versa, but given that the reference manual (13.13.1) says that type Stream_Element is mod <implementation-defined>;, I'm not entirely comfortable using that approach.

All in all, I'm pretty confused about how I'm supposed to do this. I'm even more confused about the lack of examples online, as this should be a pretty basic thing to do.


问:
Using JavaScript in Flutter
I Am creating a bot that can access websites and I am creating a GUI for it using flutter. I want to write the code for the bot accessing the website in javascript but I am struggling to find anything that can allow me to execute a script on the click of a button. I have attempted to use flutter_js but when I press the button to call the script, I get this error:

```<code>SyntaxError: expecting '('
    at <eval>:1

JSError (SyntaxError: expecting '('
    at <eval>:1
)
</code>```

The code for the flutter to Js is:

```<code>import 'package:flutter/services.dart';
import 'package:flutter_js/flutter_js.dart';
import 'package:flutter_js/quickjs/qjs_typedefs.dart';

void addFromJs(JavascriptRuntime _javascriptRuntime)
  async{
    String test_code = await rootBundle.loadString("assets/bot_code/testcode.js");
    final eval = _javascriptRuntime.evaluate(test_code+ """openTrapstar()""");
    final res = eval.stringResult;
  }

</code>```

And the code for the js script is:

```<code>import * as puppeteer from 'puppeteer';

function openTrapstar(){

    (async () => {
        const browser = await puppeteer.launch({headless: false});
        const page = await browser.newPage();
        await page.goto('https://uk.trapstarlondon.com/');
        console.log("HERE");
        await browser.close();
    })();

};
 openTrapstar();
</code>```

addFromJs is then called in an OnPressed function where the button is.

From this post I want to know what I am doing wrong in flutter_js or if it's even possible to run a script like this in flutter_js.

If not how can I go about achieving this goal.

Title: Using JavaScript in Flutter

Body:
I Am creating a bot that can access websites and I am creating a GUI for it using flutter. I want to write the code for the bot accessing the website in javascript but I am struggling to find anything that can allow me to execute a script on the click of a button. I have attempted to use flutter_js but when I press the button to call the script, I get this error:

SyntaxError: expecting '('
    at <eval>:1

JSError (SyntaxError: expecting '('
    at <eval>:1
)

The code for the flutter to Js is:

import 'package:flutter/services.dart';
import 'package:flutter_js/flutter_js.dart';
import 'package:flutter_js/quickjs/qjs_typedefs.dart';

void addFromJs(JavascriptRuntime _javascriptRuntime)
  async{
    String test_code = await rootBundle.loadString("assets/bot_code/testcode.js");
    final eval = _javascriptRuntime.evaluate(test_code+ """openTrapstar()""");
    final res = eval.stringResult;
  }

And the code for the js script is:

import * as puppeteer from 'puppeteer';

function openTrapstar(){

    (async () => {
        const browser = await puppeteer.launch({headless: false});
        const page = await browser.newPage();
        await page.goto('https://uk.trapstarlondon.com/');
        console.log("HERE");
        await browser.close();
    })();

};
 openTrapstar();

addFromJs is then called in an OnPressed function where the button is.

From this post I want to know what I am doing wrong in flutter_js or if it's even possible to run a script like this in flutter_js.

If not how can I go about achieving this goal.


问:
Dataclasses for arguments of methods in dependency injection principle
I have the following project structure:

```<code>|__workspaces
|  |__db
|  |  |__create.py
|  |__graphql
|  |  |__mutations.py
|  |  |__interfaces.py
</code>```

In graphql.mutations I have create mutation which create multiple workspaces:

```<code>class MutationWorkspacesCreate:
    def __init__(self, workspaces_creator: WorkspacesCreatorI):
        self._workspaces_creator = workspaces_creator

    def __call__(self, ...) -> list[UUID]
        ...
        await self._workspaces_creator.create(...)
</code>```

This mutation depends on the class that implements the WorkspacesCreatorI interface:

```<code>class WorkspaceCreatorI(abc.ABC):
    @abc.abstractmethod
    async def create(self, schemas: WorkspaceCreateSchemaSet) -> list[UUID]
        raise NotImplementedError
</code>```

In db.create I have class which implements this interface:

```<code>class DbWorkspacesCreator(WorkspacesCreatorI):
    async def create(self, schemas: WorkspaceCreateSchemaSet) -> list[UUID]
        ...
</code>```

But since I need to create several workspaces, I need to have some two dataclasses:

```<code>class WorkspaceCreateSchema(pydantic.BaseModel):
   ...

class WorkspaceCreateSchemaSet(pydantic.BaseModel):
    items: list[WorkspaceCreateSchema]
</code>```

If I put these dataclasses in the interfaces.py file, it looks kind of weird, because they are not abstract classes, but fully implemented, plus they can be used in a module in the database from some other modules, so rather they belong to the database. But on the other hand, if I put them in the database, then it turns out strange that the graphql package depends on the database, and the database on the graphql.

Please advise where to put these dataclasses and why

Body:
I have the following project structure:

|__workspaces
|  |__db
|  |  |__create.py
|  |__graphql
|  |  |__mutations.py
|  |  |__interfaces.py

In graphql.mutations I have create mutation which create multiple workspaces:

class MutationWorkspacesCreate:
    def __init__(self, workspaces_creator: WorkspacesCreatorI):
        self._workspaces_creator = workspaces_creator

    def __call__(self, ...) -> list[UUID]
        ...
        await self._workspaces_creator.create(...)

This mutation depends on the class that implements the WorkspacesCreatorI interface:

class WorkspaceCreatorI(abc.ABC):
    @abc.abstractmethod
    async def create(self, schemas: WorkspaceCreateSchemaSet) -> list[UUID]
        raise NotImplementedError

In db.create I have class which implements this interface:

class DbWorkspacesCreator(WorkspacesCreatorI):
    async def create(self, schemas: WorkspaceCreateSchemaSet) -> list[UUID]
        ...

But since I need to create several workspaces, I need to have some two dataclasses:

class WorkspaceCreateSchema(pydantic.BaseModel):
   ...

class WorkspaceCreateSchemaSet(pydantic.BaseModel):
    items: list[WorkspaceCreateSchema]

If I put these dataclasses in the interfaces.py file, it looks kind of weird, because they are not abstract classes, but fully implemented, plus they can be used in a module in the database from some other modules, so rather they belong to the database. But on the other hand, if I put them in the database, then it turns out strange that the graphql package depends on the database, and the database on the graphql.

Please advise where to put these dataclasses and why


问:
Unable to draw polyline on google map from one destination to another destination
I am trying to draw a polyline between the origin and a destination in a separate Activity. But when I was going on that Activity it only shows me the map, not the polyline which I want to draw.

Here's my code for that Activity where I want to draw the polyline.
`

```<code>package com.example.ridesharing_rider

import android.Manifest
import android.animation.ValueAnimator
import android.content.pm.PackageManager
import android.content.res.Resources
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.animation.LinearInterpolator
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import com.example.ridesharing_rider.Model.EventBus.SelectedPlaceEvent
import com.example.ridesharing_rider.Remote.IGoogleAPI
import com.example.ridesharing_rider.Remote.RetrofitClient
import com.example.ridesharing_rider.databinding.ActivityRequestDriverBinding
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.OnMapReadyCallback
import com.google.android.gms.maps.SupportMapFragment
import com.google.android.gms.maps.model.*
import com.google.android.material.snackbar.Snackbar
import com.google.maps.android.ui.IconGenerator
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_request_driver.*
import kotlinx.android.synthetic.main.layout_confirm_pickup.*
import kotlinx.android.synthetic.main.layout_confirm_uber.*
import kotlinx.android.synthetic.main.origin_info_windows.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.json.JSONObject

class RequestDriverActivity : AppCompatActivity(), OnMapReadyCallback {

  private lateinit var mMap: GoogleMap
  private lateinit var txt_origin:TextView

  private var selectedPlaceEvent: SelectedPlaceEvent? = null

  private lateinit var mapFragment: SupportMapFragment

  // Routes
  private val compositeDisposable = CompositeDisposable()
  private lateinit var iGoogleAPI: IGoogleAPI
  private var blackPolyline: Polyline? = null
  private var greyPolyline: Polyline? = null
  private var polylineOptions: PolylineOptions? = null
  private var blackPolylineOptions: PolylineOptions? = null
  private var polylineList: ArrayList<LatLng>? = null
  private var originMarker: Marker? = null
  private var destinationMarker: Marker? = null

  override fun onStart() {
    if (!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().register(this)
    super.onStart()
  }

  override fun onStop() {
    compositeDisposable.clear()
    if (EventBus.getDefault().hasSubscriberForEvent(SelectedPlaceEvent::class.java))
        EventBus.getDefault().removeStickyEvent(SelectedPlaceEvent::class.java)
    EventBus.getDefault().unregister(this)
    super.onStop()
  }

  @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
  fun onSelectPlaceEvent(event: SelectedPlaceEvent) {
    selectedPlaceEvent = event
  }

  private lateinit var binding: ActivityRequestDriverBinding

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    binding = ActivityRequestDriverBinding.inflate(layoutInflater)
    setContentView(binding.root)

    init()

    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    mapFragment = supportFragmentManager.findFragmentById(R.id.map) as SupportMapFragment
    mapFragment.getMapAsync(this)
  }

  private fun init() {

    iGoogleAPI = RetrofitClient.instance!!.create(IGoogleAPI::class.java)

    //event
    btn_confirm_uber.setOnClickListener {
      confirm_pickup_layout.visibility = View.VISIBLE
      confirm_uber_layout.visibility = View.GONE

      setDataPickup()
    }
  }

  private fun setDataPickup() {

   txt_address_pickup.text = if (txt_origin != null) txt_origin.text else "None"
    mMap.clear()
    addPickupMarker()
  }

  private fun addPickupMarker() {
    val view = layoutInflater.inflate(R.layout.pickup_info_windows,null)

    val generator = IconGenerator(this)
    generator.setContentView(view)
    generator.setBackground(ColorDrawable(Color.TRANSPARENT))
    val icon = generator.makeIcon()

    originMarker = mMap.addMarker(MarkerOptions()
      .icon(BitmapDescriptorFactory.fromBitmap(icon))
      .position(selectedPlaceEvent!!.origin))
  }
  override fun onMapReady(googleMap: GoogleMap) {
    mMap = googleMap

    drawPath(selectedPlaceEvent)

    try {
      val success =
          googleMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(this, R.raw.uber_maps_style))
      if (!success)
        Log.e("Shown_Error", "style parsing error")
        Snackbar.make(
                mapFragment.requireView(),
                "Load map style failed : Req Driver Activity",
                Snackbar.LENGTH_SHORT)
            .show()

    } catch (e: Resources.NotFoundException) {
      Snackbar.make(mapFragment.requireView(), e.message!!, Snackbar.LENGTH_SHORT).show()
    }
  }

  private fun drawPath(selectedPlaceEvent: SelectedPlaceEvent?) {

    // Request API
    compositeDisposable.add(
        iGoogleAPI!!
            .getDirections(
                "driving",
                "less_driving",
                selectedPlaceEvent?.originString,
                selectedPlaceEvent?.destinationString,
                getString(R.string.google_api_key))!!
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe() {
              Log.d("API_RETURN", it)
              try {
                val jsonObject = JSONObject(it)
                val jsonArray = jsonObject.getJSONArray("routes")
                for (i in 0 until jsonArray.length()) {
                  val route = jsonArray.getJSONObject(i)
                  val poly = route.getJSONObject("overview_polyline")
                  val polyline = poly.getString("points")
                  polylineList = Common.decodePoly(polyline)
                }

                polylineOptions = PolylineOptions()
                polylineOptions!!.color(Color.GRAY)
                polylineOptions!!.width(12f)
                polylineOptions!!.startCap(SquareCap())
                polylineOptions!!.jointType(JointType.ROUND)
                polylineOptions!!.addAll(polylineList!!)
                greyPolyline = mMap.addPolyline(polylineOptions!!)

                blackPolylineOptions = PolylineOptions()
                blackPolylineOptions!!.color(Color.BLACK)
                blackPolylineOptions!!.width(5f)
                blackPolylineOptions!!.startCap(SquareCap())
                blackPolylineOptions!!.jointType(JointType.ROUND)
                blackPolylineOptions!!.addAll(polylineList!!)
                blackPolyline = mMap.addPolyline(blackPolylineOptions!!)

                // Animator

                val valueAnimator = ValueAnimator.ofInt(0, 100)
                valueAnimator.duration = 1100
                valueAnimator.repeatCount = ValueAnimator.INFINITE
                valueAnimator.interpolator = LinearInterpolator()
                valueAnimator.addUpdateListener {
                  val points = greyPolyline!!.points
                  val percentValue = it.animatedValue.toString().toInt()
                  val size = points.size
                  val newpoints = (size * (percentValue / 100.0f)).toInt()
                  val p = points.subList(0, newpoints)
                  blackPolyline!!.points = p
                }
                valueAnimator.start()

                val latlngBound =
                    LatLngBounds.builder()
                        .include(selectedPlaceEvent!!.origin)
                        .include(selectedPlaceEvent!!.destination)
                        .build()

                // add car icon for origin
                val objects = jsonArray.getJSONObject(0)
                val legs = objects.getJSONArray("legs")
                val legsObject = legs.getJSONObject(0)

                val time = legsObject.getJSONObject("duration")
                val duration = time.getString("text")

                val start_address = legsObject.getString("start_address")
                val end_address = legsObject.getString("end_address")

                addOriginMarker(duration, start_address)

                addDestinationMarker(end_address)

                mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(latlngBound, 160))
                mMap.moveCamera(CameraUpdateFactory.zoomTo(mMap.cameraPosition.zoom - 1))
              } catch (e: java.lang.Exception) {

                //                    Toast.makeText(this,e.message!!,Toast.LENGTH_SHORT).show()
              }
            })
  }

  private fun addDestinationMarker(endAddress: String) {

    val view = layoutInflater.inflate(R.layout.destination_info_window, null)

    val txt_destination = view.findViewById<View>(R.id.txt_destination) as TextView
    txt_destination.text = Common.formatAddress(endAddress)

    val generator = IconGenerator(this)
    generator.setContentView(view)
    generator.setBackground(ColorDrawable(Color.TRANSPARENT))
    val icon = generator.makeIcon()

    destinationMarker =
        mMap.addMarker(
            MarkerOptions()
                .icon(BitmapDescriptorFactory.fromBitmap(icon))
                .position(selectedPlaceEvent!!.destination))
  }

  private fun addOriginMarker(duration: String, startAddress: String) {

    val view = layoutInflater.inflate(R.layout.origin_info_windows, null)

    val txt_time = view.findViewById<View>(R.id.txt_time) as TextView
     txt_origin = view.findViewById<View>(R.id.txt_origin) as TextView

    txt_time.text = Common.formatDuration(duration)
    txt_origin.text = Common.formatAddress(startAddress)

    val generator = IconGenerator(this)
    generator.setContentView(view)
    generator.setBackground(ColorDrawable(Color.TRANSPARENT))
    val icon = generator.makeIcon()

    originMarker =
        mMap.addMarker(
            MarkerOptions()
                .icon(BitmapDescriptorFactory.fromBitmap(icon))
                .position(selectedPlaceEvent!!.origin))
  }
}
`
</code>```

interface IGoogleAPI {

```<code>@GET("maps/api/directions/json")
fun getDirections(
    @Query("mode") mode:String?,
    @Query("transit_routing_preference") transit_routing:String?,
    @Query("origin") from:String?,
    @Query("destination") to:String?,
    @Query("key") key:String?
): Observable<String>}
</code>```
```<code>object RetrofitClient {

    val instance: Retrofit? = null
    get() = if (field == null)Retrofit.Builder()
        .baseUrl("https://maps.googleapis.com/")
        .addConverterFactory(ScalarsConverterFactory.create())
        .addCallAdapterFactory(RxJava3CallAdapterFactory.create())
        .build() else field
}
</code>```

Below code is from another Fragment.This below Fragment code redirects me to the RequestDriverActivity

```<code>mFusedLocationClient!!
    .lastLocation.addOnSuccessListener {
        val origin = LatLng(it.latitude,it.longitude)
        val destination = LatLng(p0.latLng!!.latitude,p0.latLng!!.longitude)

        startActivity(Intent(requireContext(),RequestDriverActivity::class.java))
        EventBus.getDefault().postSticky(SelectedPlaceEvent(origin,destination))
    }

</code>```

Below I have uploaded 2 screenshots. The 1st picture shows what I get and the 2nd picture shows what I want to get.

This is the screenshot of my emulator

This is the functionality which I want to achieve

Body:
I am trying to draw a polyline between the origin and a destination in a separate Activity. But when I was going on that Activity it only shows me the map, not the polyline which I want to draw.

Here's my code for that Activity where I want to draw the polyline.
`

package com.example.ridesharing_rider

import android.Manifest
import android.animation.ValueAnimator
import android.content.pm.PackageManager
import android.content.res.Resources
import android.graphics.Color
import android.graphics.drawable.ColorDrawable
import android.os.Bundle
import android.util.Log
import android.view.View
import android.view.animation.LinearInterpolator
import android.widget.RelativeLayout
import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity
import androidx.core.app.ActivityCompat
import com.example.ridesharing_rider.Model.EventBus.SelectedPlaceEvent
import com.example.ridesharing_rider.Remote.IGoogleAPI
import com.example.ridesharing_rider.Remote.RetrofitClient
import com.example.ridesharing_rider.databinding.ActivityRequestDriverBinding
import com.google.android.gms.maps.CameraUpdateFactory
import com.google.android.gms.maps.GoogleMap
import com.google.android.gms.maps.OnMapReadyCallback
import com.google.android.gms.maps.SupportMapFragment
import com.google.android.gms.maps.model.*
import com.google.android.material.snackbar.Snackbar
import com.google.maps.android.ui.IconGenerator
import io.reactivex.rxjava3.android.schedulers.AndroidSchedulers
import io.reactivex.rxjava3.disposables.CompositeDisposable
import io.reactivex.rxjava3.schedulers.Schedulers
import kotlinx.android.synthetic.main.activity_request_driver.*
import kotlinx.android.synthetic.main.layout_confirm_pickup.*
import kotlinx.android.synthetic.main.layout_confirm_uber.*
import kotlinx.android.synthetic.main.origin_info_windows.*
import org.greenrobot.eventbus.EventBus
import org.greenrobot.eventbus.Subscribe
import org.greenrobot.eventbus.ThreadMode
import org.json.JSONObject

class RequestDriverActivity : AppCompatActivity(), OnMapReadyCallback {

  private lateinit var mMap: GoogleMap
  private lateinit var txt_origin:TextView

  private var selectedPlaceEvent: SelectedPlaceEvent? = null

  private lateinit var mapFragment: SupportMapFragment

  // Routes
  private val compositeDisposable = CompositeDisposable()
  private lateinit var iGoogleAPI: IGoogleAPI
  private var blackPolyline: Polyline? = null
  private var greyPolyline: Polyline? = null
  private var polylineOptions: PolylineOptions? = null
  private var blackPolylineOptions: PolylineOptions? = null
  private var polylineList: ArrayList<LatLng>? = null
  private var originMarker: Marker? = null
  private var destinationMarker: Marker? = null

  override fun onStart() {
    if (!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().register(this)
    super.onStart()
  }

  override fun onStop() {
    compositeDisposable.clear()
    if (EventBus.getDefault().hasSubscriberForEvent(SelectedPlaceEvent::class.java))
        EventBus.getDefault().removeStickyEvent(SelectedPlaceEvent::class.java)
    EventBus.getDefault().unregister(this)
    super.onStop()
  }

  @Subscribe(sticky = true, threadMode = ThreadMode.MAIN)
  fun onSelectPlaceEvent(event: SelectedPlaceEvent) {
    selectedPlaceEvent = event
  }

  private lateinit var binding: ActivityRequestDriverBinding

  override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    binding = ActivityRequestDriverBinding.inflate(layoutInflater)
    setContentView(binding.root)

    init()

    // Obtain the SupportMapFragment and get notified when the map is ready to be used.
    mapFragment = supportFragmentManager.findFragmentById(R.id.map) as SupportMapFragment
    mapFragment.getMapAsync(this)
  }

  private fun init() {

    iGoogleAPI = RetrofitClient.instance!!.create(IGoogleAPI::class.java)

    //event
    btn_confirm_uber.setOnClickListener {
      confirm_pickup_layout.visibility = View.VISIBLE
      confirm_uber_layout.visibility = View.GONE

      setDataPickup()
    }
  }

  private fun setDataPickup() {

   txt_address_pickup.text = if (txt_origin != null) txt_origin.text else "None"
    mMap.clear()
    addPickupMarker()
  }

  private fun addPickupMarker() {
    val view = layoutInflater.inflate(R.layout.pickup_info_windows,null)

    val generator = IconGenerator(this)
    generator.setContentView(view)
    generator.setBackground(ColorDrawable(Color.TRANSPARENT))
    val icon = generator.makeIcon()

    originMarker = mMap.addMarker(MarkerOptions()
      .icon(BitmapDescriptorFactory.fromBitmap(icon))
      .position(selectedPlaceEvent!!.origin))
  }
  override fun onMapReady(googleMap: GoogleMap) {
    mMap = googleMap

    drawPath(selectedPlaceEvent)

    try {
      val success =
          googleMap.setMapStyle(MapStyleOptions.loadRawResourceStyle(this, R.raw.uber_maps_style))
      if (!success)
        Log.e("Shown_Error", "style parsing error")
        Snackbar.make(
                mapFragment.requireView(),
                "Load map style failed : Req Driver Activity",
                Snackbar.LENGTH_SHORT)
            .show()

    } catch (e: Resources.NotFoundException) {
      Snackbar.make(mapFragment.requireView(), e.message!!, Snackbar.LENGTH_SHORT).show()
    }
  }

  private fun drawPath(selectedPlaceEvent: SelectedPlaceEvent?) {

    // Request API
    compositeDisposable.add(
        iGoogleAPI!!
            .getDirections(
                "driving",
                "less_driving",
                selectedPlaceEvent?.originString,
                selectedPlaceEvent?.destinationString,
                getString(R.string.google_api_key))!!
            .subscribeOn(Schedulers.io())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe() {
              Log.d("API_RETURN", it)
              try {
                val jsonObject = JSONObject(it)
                val jsonArray = jsonObject.getJSONArray("routes")
                for (i in 0 until jsonArray.length()) {
                  val route = jsonArray.getJSONObject(i)
                  val poly = route.getJSONObject("overview_polyline")
                  val polyline = poly.getString("points")
                  polylineList = Common.decodePoly(polyline)
                }

                polylineOptions = PolylineOptions()
                polylineOptions!!.color(Color.GRAY)
                polylineOptions!!.width(12f)
                polylineOptions!!.startCap(SquareCap())
                polylineOptions!!.jointType(JointType.ROUND)
                polylineOptions!!.addAll(polylineList!!)
                greyPolyline = mMap.addPolyline(polylineOptions!!)

                blackPolylineOptions = PolylineOptions()
                blackPolylineOptions!!.color(Color.BLACK)
                blackPolylineOptions!!.width(5f)
                blackPolylineOptions!!.startCap(SquareCap())
                blackPolylineOptions!!.jointType(JointType.ROUND)
                blackPolylineOptions!!.addAll(polylineList!!)
                blackPolyline = mMap.addPolyline(blackPolylineOptions!!)

                // Animator

                val valueAnimator = ValueAnimator.ofInt(0, 100)
                valueAnimator.duration = 1100
                valueAnimator.repeatCount = ValueAnimator.INFINITE
                valueAnimator.interpolator = LinearInterpolator()
                valueAnimator.addUpdateListener {
                  val points = greyPolyline!!.points
                  val percentValue = it.animatedValue.toString().toInt()
                  val size = points.size
                  val newpoints = (size * (percentValue / 100.0f)).toInt()
                  val p = points.subList(0, newpoints)
                  blackPolyline!!.points = p
                }
                valueAnimator.start()

                val latlngBound =
                    LatLngBounds.builder()
                        .include(selectedPlaceEvent!!.origin)
                        .include(selectedPlaceEvent!!.destination)
                        .build()

                // add car icon for origin
                val objects = jsonArray.getJSONObject(0)
                val legs = objects.getJSONArray("legs")
                val legsObject = legs.getJSONObject(0)

                val time = legsObject.getJSONObject("duration")
                val duration = time.getString("text")

                val start_address = legsObject.getString("start_address")
                val end_address = legsObject.getString("end_address")

                addOriginMarker(duration, start_address)

                addDestinationMarker(end_address)

                mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(latlngBound, 160))
                mMap.moveCamera(CameraUpdateFactory.zoomTo(mMap.cameraPosition.zoom - 1))
              } catch (e: java.lang.Exception) {

                //                    Toast.makeText(this,e.message!!,Toast.LENGTH_SHORT).show()
              }
            })
  }

  private fun addDestinationMarker(endAddress: String) {

    val view = layoutInflater.inflate(R.layout.destination_info_window, null)

    val txt_destination = view.findViewById<View>(R.id.txt_destination) as TextView
    txt_destination.text = Common.formatAddress(endAddress)

    val generator = IconGenerator(this)
    generator.setContentView(view)
    generator.setBackground(ColorDrawable(Color.TRANSPARENT))
    val icon = generator.makeIcon()

    destinationMarker =
        mMap.addMarker(
            MarkerOptions()
                .icon(BitmapDescriptorFactory.fromBitmap(icon))
                .position(selectedPlaceEvent!!.destination))
  }

  private fun addOriginMarker(duration: String, startAddress: String) {

    val view = layoutInflater.inflate(R.layout.origin_info_windows, null)

    val txt_time = view.findViewById<View>(R.id.txt_time) as TextView
     txt_origin = view.findViewById<View>(R.id.txt_origin) as TextView

    txt_time.text = Common.formatDuration(duration)
    txt_origin.text = Common.formatAddress(startAddress)

    val generator = IconGenerator(this)
    generator.setContentView(view)
    generator.setBackground(ColorDrawable(Color.TRANSPARENT))
    val icon = generator.makeIcon()

    originMarker =
        mMap.addMarker(
            MarkerOptions()
                .icon(BitmapDescriptorFactory.fromBitmap(icon))
                .position(selectedPlaceEvent!!.origin))
  }
}
`

interface IGoogleAPI {

@GET("maps/api/directions/json")
fun getDirections(
    @Query("mode") mode:String?,
    @Query("transit_routing_preference") transit_routing:String?,
    @Query("origin") from:String?,
    @Query("destination") to:String?,
    @Query("key") key:String?
): Observable<String>}

object RetrofitClient {

    val instance: Retrofit? = null
    get() = if (field == null)Retrofit.Builder()
        .baseUrl("https://maps.googleapis.com/")
        .addConverterFactory(ScalarsConverterFactory.create())
        .addCallAdapterFactory(RxJava3CallAdapterFactory.create())
        .build() else field
}

Below code is from another Fragment.This below Fragment code redirects me to the RequestDriverActivity

mFusedLocationClient!!
    .lastLocation.addOnSuccessListener {
        val origin = LatLng(it.latitude,it.longitude)
        val destination = LatLng(p0.latLng!!.latitude,p0.latLng!!.longitude)

        startActivity(Intent(requireContext(),RequestDriverActivity::class.java))
        EventBus.getDefault().postSticky(SelectedPlaceEvent(origin,destination))
    }

Below I have uploaded 2 screenshots. The 1st picture shows what I get and the 2nd picture shows what I want to get.

This is the screenshot of my emulator

This is the functionality which I want to achieve


问:
Problem with keyboard library, exactly with stopping .record() in function
```<code>import keyboard
import time
import pyautogui
import mouse
def call_record():
    event = keyboard.record(until='shift')
    print("ended record")
def call_playrecord():
    print('playing...')
    keyboard.play(event)
keyboard.add_hotkey('l', call_record)
keyboard.add_hotkey('n+m', call_playrecord)
keyboard.wait('esc')
</code>```

This is a code and a problem about that, is that record wont stop when i press 'shift'
(nevermind that i dont have global set on event i will make this later)

I tried to make a record and play system with hotkeys but i cant stop the record

Body:
import keyboard
import time
import pyautogui
import mouse
def call_record():
    event = keyboard.record(until='shift')
    print("ended record")
def call_playrecord():
    print('playing...')
    keyboard.play(event)
keyboard.add_hotkey('l', call_record)
keyboard.add_hotkey('n+m', call_playrecord)
keyboard.wait('esc')

This is a code and a problem about that, is that record wont stop when i press 'shift'
(nevermind that i dont have global set on event i will make this later)

I tried to make a record and play system with hotkeys but i cant stop the record


问:
adding custom fonts to storybook
i'm making a component library that i use through my applications, it work fine but when i added my custom fonts used by my icons, my storybook couldn't start anymore (the lib and the Icon component is still working).

this is how I imported my files

in my .storybook/main.js

const postcss = require("postcss");

module.exports = {
  stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    "@storybook/preset-scss",
    {
       name: "@storybook/addon-postcss",
       options: {
         cssLoaderOptions: {,
           importLoaders: 1,
         },
         postcssLoaderOptions: {
           implementation: postcss,
         },
       },
     },
  ],
  framework: "@storybook/react",
  core: {
    builder: "@storybook/builder-webpack5",
  },
};

```
<p>in my src/styles/index.scss</p>
<pre class="lang-scss prettyprint-override"><code>@import "fonts";
@import "colors";
@import "sizes";
@import "icons/icons";

*,
*::before,
*::after {
  box-sizing: border-box;
}

// etc

</code>```

in stc/styles/icons/icons.scss

@import "my-icons-variables";
$icomoon-font-family: "my-icons" !default;
$icomoon-font-path: "./fonts" !default;

@font-face {
  font-family: '#{$icomoon-font-family}';
  src: url('#{$icomoon-font-path}/#{$icomoon-font-family}.woff2') format('woff2'),
  url('#{$icomoon-font-path}/#{$icomoon-font-family}.ttf') format('truetype'),
  url('#{$icomoon-font-path}/#{$icomoon-font-family}.woff') format('woff'),
  url('#{$icomoon-font-path}/#{$icomoon-font-family}.svg##{$icomoon-font-family}') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

// etc
```
<p>and all my icon font files are located in src/styles/icons/fonts/*</p>
<p>when i try to run my storybook i got this kind of errors</p>
```ModuleNotFoundError: Module not found: Error: Can't resolve './fonts/my-icons.woff2' in '/home/victor/dev/design-components/src/components/layout/section'
    at /home/victor/dev/design-components/node_modules/webpack/lib/Compilation.js:2016:28
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/home/victor/dev/design-components/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/home/victor/dev/design-components/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:975:5
    at /home/victor/dev/design-components/node_modules/neo-async/async.js:6883:13
    at Array.<anonymous> (/home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:950:14)
    at arrayEachFunc (/home/victor/dev/design-components/node_modules/neo-async/async.js:2517:19)
    at Object.parallel (/home/victor/dev/design-components/node_modules/neo-async/async.js:6858:9)
    at NormalModuleFactory._resolveResourceErrorHints (/home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:873:12)
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:834:18
    at finishWithoutResolve (/home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:386:15
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/forEachBail.js:16:12
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/AliasPlugin.js:125:14
    at next (/home/victor/dev/design-components/node_modules/enhanced-resolve/lib/forEachBail.js:14:3)
    at forEachBail (/home/victor/dev/design-components/node_modules/enhanced-resolve/lib/forEachBail.js:24:9)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/AliasPlugin.js:51:5
    at _next0 (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:30:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/RootsPlugin.js:37:38
    at _next2 (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/ConditionalPlugin.js:40:47
    at _next1 (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:46:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/ConditionalPlugin.js:40:47
    at _next0 (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:38:1)
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:60:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
resolve './fonts/my-icons.woff2' in '/home/victor/dev/design-components/src/components/layout/section'
  using description file: /home/victor/dev/design-components/package.json (relative path: ./src/components/layout/section)
    using description file: /home/victor/dev/design-components/package.json (relative path: ./src/components/layout/section/fonts/my-icons.woff2)
      no extension
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2 doesn't exist
      .mjs
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.mjs doesn't exist
      .js
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.js doesn't exist
      .jsx
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.jsx doesn't exist
      .ts
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.ts doesn't exist
      .tsx
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.tsx doesn't exist
      .json
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.json doesn't exist
      .cjs
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.cjs doesn't exist
      as directory
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2 doesn't exist
```

(this for each of my components)

Am I missing something maybe with a webpack conf ? or maybe I should not import the icons fonts this way ?

Title: adding custom fonts to storybook

Body:
i'm making a component library that i use through my applications, it work fine but when i added my custom fonts used by my icons, my storybook couldn't start anymore (the lib and the Icon component is still working).

this is how I imported my files

in my .storybook/main.js

const postcss = require("postcss");

module.exports = {
  stories: ["../src/**/*.stories.mdx", "../src/**/*.stories.@(js|jsx|ts|tsx)"],
  addons: [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    "@storybook/preset-scss",
    {
       name: "@storybook/addon-postcss",
       options: {
         cssLoaderOptions: {,
           importLoaders: 1,
         },
         postcssLoaderOptions: {
           implementation: postcss,
         },
       },
     },
  ],
  framework: "@storybook/react",
  core: {
    builder: "@storybook/builder-webpack5",
  },
};

in my src/styles/index.scss

@import "fonts";
@import "colors";
@import "sizes";
@import "icons/icons";

*,
*::before,
*::after {
  box-sizing: border-box;
}

// etc

in stc/styles/icons/icons.scss

@import "my-icons-variables";
$icomoon-font-family: "my-icons" !default;
$icomoon-font-path: "./fonts" !default;

@font-face {
  font-family: '#{$icomoon-font-family}';
  src: url('#{$icomoon-font-path}/#{$icomoon-font-family}.woff2') format('woff2'),
  url('#{$icomoon-font-path}/#{$icomoon-font-family}.ttf') format('truetype'),
  url('#{$icomoon-font-path}/#{$icomoon-font-family}.woff') format('woff'),
  url('#{$icomoon-font-path}/#{$icomoon-font-family}.svg##{$icomoon-font-family}') format('svg');
  font-weight: normal;
  font-style: normal;
  font-display: block;
}

// etc

and all my icon font files are located in src/styles/icons/fonts/*

when i try to run my storybook i got this kind of errors

ModuleNotFoundError: Module not found: Error: Can't resolve './fonts/my-icons.woff2' in '/home/victor/dev/design-components/src/components/layout/section'
    at /home/victor/dev/design-components/node_modules/webpack/lib/Compilation.js:2016:28
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:798:13
    at eval (eval at create (/home/victor/dev/design-components/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:10:1)
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:270:22
    at eval (eval at create (/home/victor/dev/design-components/node_modules/webpack/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:9:1)
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:434:22
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:116:11
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:670:25
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:855:8
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:975:5
    at /home/victor/dev/design-components/node_modules/neo-async/async.js:6883:13
    at Array.<anonymous> (/home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:950:14)
    at arrayEachFunc (/home/victor/dev/design-components/node_modules/neo-async/async.js:2517:19)
    at Object.parallel (/home/victor/dev/design-components/node_modules/neo-async/async.js:6858:9)
    at NormalModuleFactory._resolveResourceErrorHints (/home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:873:12)
    at /home/victor/dev/design-components/node_modules/webpack/lib/NormalModuleFactory.js:834:18
    at finishWithoutResolve (/home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:312:11)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:386:15
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/forEachBail.js:16:12
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/AliasPlugin.js:125:14
    at next (/home/victor/dev/design-components/node_modules/enhanced-resolve/lib/forEachBail.js:14:3)
    at forEachBail (/home/victor/dev/design-components/node_modules/enhanced-resolve/lib/forEachBail.js:24:9)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/AliasPlugin.js:51:5
    at _next0 (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:30:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/RootsPlugin.js:37:38
    at _next2 (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:8:1)
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:31:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/ConditionalPlugin.js:40:47
    at _next1 (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:23:1)
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:46:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/ConditionalPlugin.js:40:47
    at _next0 (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:38:1)
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:60:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:27:1)
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/DescriptionFilePlugin.js:87:43
    at /home/victor/dev/design-components/node_modules/enhanced-resolve/lib/Resolver.js:435:5
    at eval (eval at create (/home/victor/dev/design-components/node_modules/enhanced-resolve/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:16:1)
resolve './fonts/my-icons.woff2' in '/home/victor/dev/design-components/src/components/layout/section'
  using description file: /home/victor/dev/design-components/package.json (relative path: ./src/components/layout/section)
    using description file: /home/victor/dev/design-components/package.json (relative path: ./src/components/layout/section/fonts/my-icons.woff2)
      no extension
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2 doesn't exist
      .mjs
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.mjs doesn't exist
      .js
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.js doesn't exist
      .jsx
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.jsx doesn't exist
      .ts
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.ts doesn't exist
      .tsx
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.tsx doesn't exist
      .json
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.json doesn't exist
      .cjs
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2.cjs doesn't exist
      as directory
        /home/victor/dev/design-components/src/components/layout/section/fonts/my-icons.woff2 doesn't exist

(this for each of my components)

Am I missing something maybe with a webpack conf ? or maybe I should not import the icons fonts this way ?


问:
What means Schemifier.schemify method in liftweb?
I am updating a liftweb project and in Boot.scala, I have this line:

```<code>Schemifier.schemify(true, Log.infoF _, HistoricIndicator)
</code>```

If I try to compile, this line has an error, because a field not found in postgresql
If I delete this line, compile ok and all seems to work fine.

my BD is in  "public" schema...

What means this line? Can i delete this and all will works fine?

thanks

Body:
I am updating a liftweb project and in Boot.scala, I have this line:

Schemifier.schemify(true, Log.infoF _, HistoricIndicator)

If I try to compile, this line has an error, because a field not found in postgresql
If I delete this line, compile ok and all seems to work fine.

my BD is in  "public" schema...

What means this line? Can i delete this and all will works fine?

thanks


问:
R conditional loop, multiple lists
I need help stepping through a second loop in R when a test fails in my first loop. Here's the logic:

to start use config_list[1] from list

then download file path_list[1] from list

check if file passes test,

if so, download path_list[1 + 1] file from list and go back to step 3

if not, change config to next in list and go back to step 2 for failed file

Here's how far I've gotten:

```<code>path_list <- list("path1", "path2", "path3")
config_list <- list("a", "b", "c")

for (con in config_list) {
  con[1] # set initial config
  for (val in path_list) {
    print(paste(val, "downloaded")) # download file
    if (val == "path2"){ # check if file passes some test
      con[1 + 1] # if above test fails change to con[1 + 1]
      print(paste(val, "downloaded")) # download file again with new config ???
    }
    print(val)
  }
}
</code>```

Title: R conditional loop, multiple lists

Body:
I need help stepping through a second loop in R when a test fails in my first loop. Here's the logic:

to start use config_list[1] from list

then download file path_list[1] from list

check if file passes test,

if so, download path_list[1 + 1] file from list and go back to step 3

if not, change config to next in list and go back to step 2 for failed file

Here's how far I've gotten:

path_list <- list("path1", "path2", "path3")
config_list <- list("a", "b", "c")

for (con in config_list) {
  con[1] # set initial config
  for (val in path_list) {
    print(paste(val, "downloaded")) # download file
    if (val == "path2"){ # check if file passes some test
      con[1 + 1] # if above test fails change to con[1 + 1]
      print(paste(val, "downloaded")) # download file again with new config ???
    }
    print(val)
  }
}


问:
Authentication in Single page application and Statically generated website
Single page applications built using Angular/React/Vue/Svelte and statically generated sites get served same way when hosted on github pages or firebase hosting.

If Single page applications can have authentication then why can not statically generated sites have authentication for hosting on github pages? After all both are getting served same way.