问:
Migrate terraform to terragrunt for high number of modules
I have microservice non-prod env. where each team has its own env. which means a lot of envs, in terms of terrafrom right now I have two github repos:

The first one has root tf modules.

The Second one has reusable tf modules.

The first one contains 10 root modules each one of them calls just a single module that resides in the second repo, this module in the second repo calls 13 modules, so one of the modules in the second repo represents a proxy repo.

to recap, the first repo structure:

tf-env1.tf

tf-env2.tf

tf-env3.tf

....

tf-env10.tf

The second one has a structure:

api-gateway.tf

vpc.tf

rds.tf

ec2.tf

s3.tf

lambda.tf

lb.tf

SPECIAL_Module.tf

the call chain goes as:

```<code>in repo1 : tf-envX.tf
|
in repo2 : SPECIAL_Module.tf
|
in repo2 : api-gateway.tf,vpc.tf,rds.tf,s3.tf .... etc
</code>```

As part of migrating to terragrunt in order to give the developers an ability to control their env. via managing their env. variables and free up the SRE team to just writing new terraform modules.

I'm thinking of getting rid of SPECIAL_Module.tf, since it has a lot of local controls on how terraform works, but the issue is if I remove SPECIAL_Module.tf terragrunt doesn't support more than one source on each hcl file.

Another option is to create an hcl for each module from the second repo, but this means I would manage  # of modules * # of envs files., so it came to my mind to group the modules in the second repo into 3 or 4 groups.

One solution I thought about is to move SPECIAL_Module.tf to the first module and include it in each env., but this means a huge single terraform file would reside inside terragrunt repo. which I'm not sure if it's an abuse for terragrunt.

So is there a way to migrate from terraform to terragrunt with a high # of modules and a high # of envs?

Body:
I have microservice non-prod env. where each team has its own env. which means a lot of envs, in terms of terrafrom right now I have two github repos:

The first one has root tf modules.

The Second one has reusable tf modules.

The first one contains 10 root modules each one of them calls just a single module that resides in the second repo, this module in the second repo calls 13 modules, so one of the modules in the second repo represents a proxy repo.

to recap, the first repo structure:

tf-env1.tf

tf-env2.tf

tf-env3.tf

....

tf-env10.tf

The second one has a structure:

api-gateway.tf

vpc.tf

rds.tf

ec2.tf

s3.tf

lambda.tf

lb.tf

SPECIAL_Module.tf

the call chain goes as:

in repo1 : tf-envX.tf
|
in repo2 : SPECIAL_Module.tf
|
in repo2 : api-gateway.tf,vpc.tf,rds.tf,s3.tf .... etc

As part of migrating to terragrunt in order to give the developers an ability to control their env. via managing their env. variables and free up the SRE team to just writing new terraform modules.

I'm thinking of getting rid of SPECIAL_Module.tf, since it has a lot of local controls on how terraform works, but the issue is if I remove SPECIAL_Module.tf terragrunt doesn't support more than one source on each hcl file.

Another option is to create an hcl for each module from the second repo, but this means I would manage  # of modules * # of envs files., so it came to my mind to group the modules in the second repo into 3 or 4 groups.

One solution I thought about is to move SPECIAL_Module.tf to the first module and include it in each env., but this means a huge single terraform file would reside inside terragrunt repo. which I'm not sure if it's an abuse for terragrunt.

So is there a way to migrate from terraform to terragrunt with a high # of modules and a high # of envs?


来源: stackexchange

问:
swipeable recyclerview
enter image description here

i want to obtain this design and want to set vector asset in middle of swipeable button and curve for border of that buttons anyone help me out for this

ContentLicense: CC BY-SA 4.0

Title: swipeable recyclerview


问:
pump mode with Red Hat Developer Toolset
I have a very big project, I managed to use distcc with the non-pump method.
I use red hat servers but I have to use
source scl_source enable devtoolset-7
In order to use a more recent version of g++ and build the project.
Is there any specific configuration that could be done so pump mode works?
Currently if I try and use pump mode I can see it's using the wrong version of g++ because I get the following message:
cc: error: unrecognized command line option '-std=c++17'

I expected the pump mode to have this issue, since non-pump mode method works just fine. :)


问:
Custom Exception Handler at Controller Level For Request Body
I am trying to create a custom Exception handler which will be the first thing to run when a request is made for different endpoints using the same request body object.

Depending on the endpoint, It should check the request body object's fields and throw a different error message for the same field.

I could not figure out to specify the endpoint for @Valid and thought an Exception Handler would be a better solution for this issue.

My problem is on the Controller side. I could not figure out how to call the custom exception check when a request is made. Any help would be great.

```<code>public class RequestData {
  private String type;
  private int distance;
  //getters, setters etc.
}
</code>```

Controller:

```<code>    @RestController
    public class TestController {

        @PostMapping("/getSomething")
        @ExceptionHandler({CustomIllegalArgumentException.class})
        public ResponseEntity getSomething(@RequestBody RequestData requestData) {
              String endPoint = "getSomething";
            try {
                //first check requestData, if no exception is thrown then proceed.
                return new ResponseEntity<>("response", HttpStatus.OK);
            } catch (CustomIllegalArgumentException e) {
                return new RestExceptionHandler().handleIllegalRequestBodyException(requestData, e, endPoint);
            }
        }

        @PostMapping("/doSomething")
        @ExceptionHandler({CustomIllegalArgumentException.class})
        public ResponseEntity doSomething(@RequestBody RequestData requestData) {
            String endPoint = "doSomething";
            try {
                //first check requestData, if no exception is thrown then proceed.
                return new ResponseEntity<>("response", HttpStatus.OK);
            } catch (CustomIllegalArgumentException e) {
                return new RestExceptionHandler().handleIllegalRequestBodyException(requestData, e, endpoint);
            }
        }
    }
</code>```

Custom Exception:

```<code>public class CustomIllegalArgumentException extends Exception {
}
</code>```

Error Response Class:

```<code>@Getter
@Setter
public class ErrorResponse {

    private HttpStatus status;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd hh:mm:ss")
    private LocalDateTime timeStamp;
    private String message;

    public ErrorResponse(HttpStatus status) {
        this();
        this.status = status;
    }

    public ErrorResponse(HttpStatus status, String message) {
        this();
        this.status = status;
        this.message = message;
    }

    public ErrorResponse(){
        timeStamp = LocalDateTime.now();
    }
    public ErrorResponse(HttpStatus status, LocalDateTime timeStamp, String message) {
        this();
        this.status = status;
        this.timeStamp = timeStamp;
        this.message = message;
    }
}
</code>```

Exception Handler For Custom Exception:

```<code>@ControllerAdvice
public class RestExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(value = CustomIllegalArgumentException.class)
public ResponseEntity handleIllegalRequestBodyException(RequestData requestData, CustomIllegalArgumentException exp, String endPoint) {
    ErrorResponse response = new ErrorResponse(HttpStatus.BAD_REQUEST);
    if(**endPoint.equals("doSomething")** && requestDdata.getDistance() > 2) {
        response.setMessage("a message for this endpoint");
    }
    if(**endPoint.equals("getSomething")** && requestDdata.getDistance() > 2) {
        response.setMessage("some other message for this endpoint");
    }

    return buildResponseEntity(response);
}

private ResponseEntity buildResponseEntity(ErrorResponse errorResponse) {
    return new ResponseEntity<>(errorResponse, errorResponse.getStatus());
}
</code>```

}

Body:
I am trying to create a custom Exception handler which will be the first thing to run when a request is made for different endpoints using the same request body object.

Depending on the endpoint, It should check the request body object's fields and throw a different error message for the same field.

I could not figure out to specify the endpoint for @Valid and thought an Exception Handler would be a better solution for this issue.

My problem is on the Controller side. I could not figure out how to call the custom exception check when a request is made. Any help would be great.

public class RequestData {
  private String type;
  private int distance;
  //getters, setters etc.
}

Controller:

    @RestController
    public class TestController {

        @PostMapping("/getSomething")
        @ExceptionHandler({CustomIllegalArgumentException.class})
        public ResponseEntity getSomething(@RequestBody RequestData requestData) {
              String endPoint = "getSomething";
            try {
                //first check requestData, if no exception is thrown then proceed.
                return new ResponseEntity<>("response", HttpStatus.OK);
            } catch (CustomIllegalArgumentException e) {
                return new RestExceptionHandler().handleIllegalRequestBodyException(requestData, e, endPoint);
            }
        }

        @PostMapping("/doSomething")
        @ExceptionHandler({CustomIllegalArgumentException.class})
        public ResponseEntity doSomething(@RequestBody RequestData requestData) {
            String endPoint = "doSomething";
            try {
                //first check requestData, if no exception is thrown then proceed.
                return new ResponseEntity<>("response", HttpStatus.OK);
            } catch (CustomIllegalArgumentException e) {
                return new RestExceptionHandler().handleIllegalRequestBodyException(requestData, e, endpoint);
            }
        }
    }

Custom Exception:

public class CustomIllegalArgumentException extends Exception {
}

Error Response Class:

@Getter
@Setter
public class ErrorResponse {

    private HttpStatus status;
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyyMMdd hh:mm:ss")
    private LocalDateTime timeStamp;
    private String message;

    public ErrorResponse(HttpStatus status) {
        this();
        this.status = status;
    }

    public ErrorResponse(HttpStatus status, String message) {
        this();
        this.status = status;
        this.message = message;
    }

    public ErrorResponse(){
        timeStamp = LocalDateTime.now();
    }
    public ErrorResponse(HttpStatus status, LocalDateTime timeStamp, String message) {
        this();
        this.status = status;
        this.timeStamp = timeStamp;
        this.message = message;
    }
}

Exception Handler For Custom Exception:

@ControllerAdvice
public class RestExceptionHandler extends ResponseEntityExceptionHandler {
@ExceptionHandler(value = CustomIllegalArgumentException.class)
public ResponseEntity handleIllegalRequestBodyException(RequestData requestData, CustomIllegalArgumentException exp, String endPoint) {
    ErrorResponse response = new ErrorResponse(HttpStatus.BAD_REQUEST);
    if(**endPoint.equals("doSomething")** && requestDdata.getDistance() > 2) {
        response.setMessage("a message for this endpoint");
    }
    if(**endPoint.equals("getSomething")** && requestDdata.getDistance() > 2) {
        response.setMessage("some other message for this endpoint");
    }

    return buildResponseEntity(response);
}

private ResponseEntity buildResponseEntity(ErrorResponse errorResponse) {
    return new ResponseEntity<>(errorResponse, errorResponse.getStatus());
}

}


问:
Is there any way to fix "Both left and right aliases encountered in JOIN 'max_date'" without using a WHERE clause?
I'm getting this error when I try do do a simple join in Hive .

```<code>SELECT *
FROM table_1 a
INNER JOIN table_2 b
ON a.sales_amount between b.min_sales_amount and b.max_sales_amount
</code>```

Both left and right aliases encountered in JOIN 'max_date

I know you can use a WHERE clause but is there other way to get this working? I have a large script, and I don't want to have to change every join.

It's pretty absurd that it doesn't allow you to do this type of join.

Body:
I'm getting this error when I try do do a simple join in Hive .

SELECT *
FROM table_1 a
INNER JOIN table_2 b
ON a.sales_amount between b.min_sales_amount and b.max_sales_amount

Both left and right aliases encountered in JOIN 'max_date

I know you can use a WHERE clause but is there other way to get this working? I have a large script, and I don't want to have to change every join.

It's pretty absurd that it doesn't allow you to do this type of join.


问:
Resolving express res.end() error "Type 'void' is not assignable to type 'Response<any, Record<string, any>>'"
I want to create own logging function by extending express.js res.end() method:

```<code>export async function inOutLogger(req: express.Request, res: express.Response, next: express.NextFunction): Promise<any> {

...
  res.end = (...restArgs) => {
    if (restArgs[0]) {
      chunks.push(Buffer.from(restArgs[0]));
    }

    oldEnd.apply(res, restArgs);
    logFn();
  };
...

export default logger;
</code>```

At this particular end() method I get the following TS error

```<code>Type '(...restArgs: any[]) => void' is not assignable to type '{ (cb?: () => void): Response<any, Record<string, any>>; (chunk: any, cb?: () => void): Response<any, Record<string, any>>; (chunk: any, encoding: string, cb?: () => void): Response<...>; }'.ts(2322)
Type '(...restArgs: any[]) => void' is not assignable to type '{ (cb?: () => void): Response<any, Record<string, any>>; (chunk: any, cb?: () => void): Response<any, Record<string, any>>; (chunk: any, encoding: string, cb?: () => void): Response<...>; }'.
  Type 'void' is not assignable to type 'Response<any, Record<string, any>>'.ts(2322)
</code>```

Now I know I need to return something but I just can't seem to figure out the correct type of return.

How do I resolve the error?
Thanks.

Body:
I want to create own logging function by extending express.js res.end() method:

export async function inOutLogger(req: express.Request, res: express.Response, next: express.NextFunction): Promise<any> {

...
  res.end = (...restArgs) => {
    if (restArgs[0]) {
      chunks.push(Buffer.from(restArgs[0]));
    }

    oldEnd.apply(res, restArgs);
    logFn();
  };
...

export default logger;

At this particular end() method I get the following TS error

Type '(...restArgs: any[]) => void' is not assignable to type '{ (cb?: () => void): Response<any, Record<string, any>>; (chunk: any, cb?: () => void): Response<any, Record<string, any>>; (chunk: any, encoding: string, cb?: () => void): Response<...>; }'.ts(2322)
Type '(...restArgs: any[]) => void' is not assignable to type '{ (cb?: () => void): Response<any, Record<string, any>>; (chunk: any, cb?: () => void): Response<any, Record<string, any>>; (chunk: any, encoding: string, cb?: () => void): Response<...>; }'.
  Type 'void' is not assignable to type 'Response<any, Record<string, any>>'.ts(2322)

Now I know I need to return something but I just can't seem to figure out the correct type of return.

How do I resolve the error?
Thanks.


问:
How to disable Scroll Effect in WebViewX Flutter
I want to disable WebViewX Scroll Effect. Unable to scroll when the cursor is on Webview Area. I want the whole page to scroll on the web. Any other package which can disable the scroll effect is also appreciated. Wanted this HTML in Android, iOS, and WEB

Check Video

Build Method

```<code>Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            const SizedBox(height: 50),
            _buildWebView(),
            const SizedBox(
              height: 500,
            )
          ],
        ),
      ),
    );
  }
</code>```

WebView Used

```<code>return WebViewX(
          initialContent: html,
          initialSourceType: SourceType.html,
          height: 500,
          width: MediaQuery.of(context).size.width,
        );
      },
</code>```

Body:
I want to disable WebViewX Scroll Effect. Unable to scroll when the cursor is on Webview Area. I want the whole page to scroll on the web. Any other package which can disable the scroll effect is also appreciated. Wanted this HTML in Android, iOS, and WEB

Check Video

Build Method

Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: SingleChildScrollView(
        child: Column(
          children: [
            const SizedBox(height: 50),
            _buildWebView(),
            const SizedBox(
              height: 500,
            )
          ],
        ),
      ),
    );
  }

WebView Used

return WebViewX(
          initialContent: html,
          initialSourceType: SourceType.html,
          height: 500,
          width: MediaQuery.of(context).size.width,
        );
      },


问:
Is it possible to use SOS with a .NET7 AOT application?
When building a .NET Core AOT application the necessary CLR functionality is, if I understand it correctly, statically linked into the executable. That means that at run time, coreclr.dll is not present as a module and consequently SOS complains that it cannot find a suitable runtime module.

I've tried specifying the extension and CLR path. I can load SOS that way, but so far I haven't been able to run any of the SOS extension commands against an AOT application.

My assumption is that the application still uses the same internal structures such as the managed heap, so I am wondering how these can be debugged in a managed context using SOS (or something similar).


问:
How to run selenium in Docker with Flask?
My goal is to run Selenium with Flask. The problem is that it throws an error.

```<code>[2022-12-16 11:30:05 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2022-12-16 11:30:05 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2022-12-16 11:30:05 +0000] [1] [INFO] Using worker: sync
[2022-12-16 11:30:05 +0000] [6] [INFO] Booting worker with pid: 6
[WDM] - Downloading: 100%|██████████| 6.96M/6.96M [00:00<00:00, 12.6MB/s]
[2022-12-16 11:30:07 +0000] [6] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.10/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/app.py", line 2, in <module>
    from scrapeutil import get_db
  File "/scrapeutil.py", line 14, in <module>
    driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=chrome_options)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in __init__
    self.service.start()
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 110, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service /root/.wdm/drivers/chromedriver/linux64/108.0.5359/chromedriver unexpectedly exited. Status code was: 255
</code>```

What I've did:

Cross checkk if gunicorn is the culprit. I make a simple Dockerfile with only gunicorn and a flask endpoint that return "Hello World". It works as expected. Therefore, I assume that webdriver is the culprit.

The code that trigger the error

```<code>chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=chrome_options)
</code>```

The Dockerfile

```<code># Do not use Alpine Linux if you use pandas
# FROM python:3.10-alpine3.16
# bullseye https://wiki.debian.org/DebianReleases
FROM python:3.10-bullseye
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . /
# {module_import}:{app_variable}
# equivalent to 'from app import app'
CMD ["gunicorn", "-b", ":8080", "app:app"]
</code>```

The requirements.txt

```<code>flask==2.2.*
pandas==1.5.*
selenium==4.5.*
webdriver-manager==3.8.*
gunicorn==20.1.*
</code>```

This code, in my Mac Mini M1 works. But when I tried to run the Docker Image, it throws the error.

Body:
My goal is to run Selenium with Flask. The problem is that it throws an error.

[2022-12-16 11:30:05 +0000] [1] [INFO] Starting gunicorn 20.1.0
[2022-12-16 11:30:05 +0000] [1] [INFO] Listening at: http://0.0.0.0:8080 (1)
[2022-12-16 11:30:05 +0000] [1] [INFO] Using worker: sync
[2022-12-16 11:30:05 +0000] [6] [INFO] Booting worker with pid: 6
[WDM] - Downloading: 100%|██████████| 6.96M/6.96M [00:00<00:00, 12.6MB/s]
[2022-12-16 11:30:07 +0000] [6] [ERROR] Exception in worker process
Traceback (most recent call last):
  File "/usr/local/lib/python3.10/site-packages/gunicorn/arbiter.py", line 589, in spawn_worker
    worker.init_process()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", line 134, in init_process
    self.load_wsgi()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/workers/base.py", line 146, in load_wsgi
    self.wsgi = self.app.wsgi()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/app/base.py", line 67, in wsgi
    self.callable = self.load()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 58, in load
    return self.load_wsgiapp()
  File "/usr/local/lib/python3.10/site-packages/gunicorn/app/wsgiapp.py", line 48, in load_wsgiapp
    return util.import_app(self.app_uri)
  File "/usr/local/lib/python3.10/site-packages/gunicorn/util.py", line 359, in import_app
    mod = importlib.import_module(module)
  File "/usr/local/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/app.py", line 2, in <module>
    from scrapeutil import get_db
  File "/scrapeutil.py", line 14, in <module>
    driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=chrome_options)
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chrome/webdriver.py", line 69, in __init__
    super().__init__(DesiredCapabilities.CHROME['browserName'], "goog",
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/chromium/webdriver.py", line 89, in __init__
    self.service.start()
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 98, in start
    self.assert_process_still_running()
  File "/usr/local/lib/python3.10/site-packages/selenium/webdriver/common/service.py", line 110, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service /root/.wdm/drivers/chromedriver/linux64/108.0.5359/chromedriver unexpectedly exited. Status code was: 255

What I've did:

Cross checkk if gunicorn is the culprit. I make a simple Dockerfile with only gunicorn and a flask endpoint that return "Hello World". It works as expected. Therefore, I assume that webdriver is the culprit.

The code that trigger the error

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=chrome_options)

The Dockerfile

# Do not use Alpine Linux if you use pandas
# FROM python:3.10-alpine3.16
# bullseye https://wiki.debian.org/DebianReleases
FROM python:3.10-bullseye
COPY requirements.txt requirements.txt
RUN pip install -r requirements.txt
COPY . /
# {module_import}:{app_variable}
# equivalent to 'from app import app'
CMD ["gunicorn", "-b", ":8080", "app:app"]

The requirements.txt

flask==2.2.*
pandas==1.5.*
selenium==4.5.*
webdriver-manager==3.8.*
gunicorn==20.1.*

This code, in my Mac Mini M1 works. But when I tried to run the Docker Image, it throws the error.


问:
Parse Unix timestamp with offset in php example timestamp 1671847200000-0600
I am trying to parse the Unix timestamp in Laravel

```<code>/Date(1671847200000-0600)/
</code>```

where 1671847200000 is the timestamp and this is -0600 offset (-06:00 i.e. -HH::mm)

expected output be like
2022-12-23 18:00:00

Body:
I am trying to parse the Unix timestamp in Laravel

/Date(1671847200000-0600)/

where 1671847200000 is the timestamp and this is -0600 offset (-06:00 i.e. -HH::mm)

expected output be like
2022-12-23 18:00:00


问:
update xml value with new value in python
I am trying to post xml request with new updated value from existing xml.
my default payload is: https://pastebin.com/rDjb0HSH

headers = { 'Content-Type': 'application/xml' } response = requests.request("POST", url, headers=headers, data=payload, verify=False) print(response.text)

Actually I want to post with new AcctId and 2022-12-13T16:21:10.813 with current datetime.

I tried with above code and return success result but when I modify xml value of 0015151641988001 with new acctid using string concatenate it returned error.


问:
SignalR - OnDisconnectedAsync not called when client disconnects abruptly
I have a SignalR hub with an override for OnDisconnectedAsync. I have found that gracefully closing the connection on the client side - like calling close() - will trigger OnDisconnectedAsync. However, the disconnect doesn't seem to trigger when disconnecting "disgracefully".

For example; When I open the client in a tab, click onto a couple of other open tabs, then close the client tab while having another tab in focus. This does not trigger a disconnect.

This also seems to happen when disconnecting from my work's network through a VPN connection. Basically, any condition that falls outwith the normal conditions for a disconnect. It's like the server still thinks the connection is open.

I have tried to reduce the KeepAliveInterval and ClientTimeoutInterval to see if I was just being impatient, but after waiting 5 minutes after disconnecting, I'm convinced it's not firing properly.

Am I doing something wrong in my hub?

```<code>services.AddSignalR(opts => {
    opts.MaximumParallelInvocationsPerClient = 10;
    opts.KeepAliveInterval = TimeSpan.FromSeconds(5);
    opts.ClientTimeoutInterval = TimeSpan.FromSeconds(5);
});
</code>```
```<code>public override async Task OnDisconnectedAsync(Exception? exception)
{
    if (exception != null)
    {
        Log.Error(exception.Message);
    }

     Log.Information("${Context.UserIdentifier} Disconnected");

     ...bunch of additional logic

     await base.OnDisconnectedAsync(exception);
}
</code>```

Body:
I have a SignalR hub with an override for OnDisconnectedAsync. I have found that gracefully closing the connection on the client side - like calling close() - will trigger OnDisconnectedAsync. However, the disconnect doesn't seem to trigger when disconnecting "disgracefully".

For example; When I open the client in a tab, click onto a couple of other open tabs, then close the client tab while having another tab in focus. This does not trigger a disconnect.

This also seems to happen when disconnecting from my work's network through a VPN connection. Basically, any condition that falls outwith the normal conditions for a disconnect. It's like the server still thinks the connection is open.

I have tried to reduce the KeepAliveInterval and ClientTimeoutInterval to see if I was just being impatient, but after waiting 5 minutes after disconnecting, I'm convinced it's not firing properly.

Am I doing something wrong in my hub?

services.AddSignalR(opts => {
    opts.MaximumParallelInvocationsPerClient = 10;
    opts.KeepAliveInterval = TimeSpan.FromSeconds(5);
    opts.ClientTimeoutInterval = TimeSpan.FromSeconds(5);
});

public override async Task OnDisconnectedAsync(Exception? exception)
{
    if (exception != null)
    {
        Log.Error(exception.Message);
    }

     Log.Information("${Context.UserIdentifier} Disconnected");

     ...bunch of additional logic

     await base.OnDisconnectedAsync(exception);
}


问:
Replicating `export -f` using shells other than bash

Background

I have a line in a shell script (my_functions.sh) that exports a function for use elsewhere:

#!bin/bash

my_function() {
    echo 'whatever'
}

export -f my_function
```
<p>This file is sourced by another script.</p>
```. ./my_functions.sh
```
<p>I need to make <code>my_functions.sh</code> usable by <code>sh</code> rather than <code>bash</code>. At the moment <code>sh</code> does not like the <code>-f</code> flag of the <code>export</code> call:</p>
```export: Illegal option -f
```

Question:

What is a sh compatible way of accomplishing behaviour like export -f?

Body:
Background

I have a line in a shell script (my_functions.sh) that exports a function for use elsewhere:

#!bin/bash

my_function() {
    echo 'whatever'
}

export -f my_function

This file is sourced by another script.

. ./my_functions.sh

I need to make my_functions.sh usable by sh rather than bash. At the moment sh does not like the -f flag of the export call:

export: Illegal option -f

Question:

What is a sh compatible way of accomplishing behaviour like export -f?


问:
Windows deletes file(php) after running it in terminal
After running function(php/mysql) in terminal(in vs code) windows deletes file, var_dump() returns what it's supposed to return but file gets deleted, but vs code gives a message (Failed to save 'index.php': Insufficient permissions. Select 'Retry as Admin' to retry as administrator.)

if I press retry as administrator:

(Failed to save 'index.php': Command failed: "C:\Users\PC\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd" --file-write "c:\Users\PC\AppData\Roaming\Code\code-elevated-gMjoiuCl" "c:\CODEACADEMY\temp hold\index.php"
Using --file-write with invalid arguments.)

the user is administrator there are no other users,

making a new file gives :

(Unable to write file 'c:\Users\PC\Documents\PRGMR\MYSQL\03mysql\index.php' (NoPermissions (FileSystemError): Error: EPERM: operation not permitted, open 'c:\Users\PC\Documents\PRGMR\MYSQL\03mysql\index.php')

its the same in atom or running file trough terminal without code editor

when running file in browser trough localhost I get a blank page, no results (works in terminal once before getting deleted on autosave).


问:
Chrome issues in docker while streaming it with TurboVnc
I'm trying to stream docker to my browser (I followed this article). Inside docker I run the chrome browser which is streamed to my Mac browser. The setup using docker is easy, just build the image and run it.

Although the chrome browser is running fine, I can't really visit any pages. As soon as it tries to load a website it displays the following:

(If I visit google.com all works fine btw)

If you would like to reproduce, you can read the article or use this docker image.
Unfortunate, this image does not include chrome, so you have to install it yourself:

```<code>$> https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$> apt-get install -y ./google-chrome-stable_current_amd64.deb
$> google-chrome --no-sandbox
</code>```

When I replace chrome with Firefox, everything works fine.

Anyway, I hope someone knows how to fix this chrome issue or any suggestion what might be going wrong here would really help!

Body:
I'm trying to stream docker to my browser (I followed this article). Inside docker I run the chrome browser which is streamed to my Mac browser. The setup using docker is easy, just build the image and run it.

Although the chrome browser is running fine, I can't really visit any pages. As soon as it tries to load a website it displays the following:

(If I visit google.com all works fine btw)

If you would like to reproduce, you can read the article or use this docker image.
Unfortunate, this image does not include chrome, so you have to install it yourself:

$> https://dl.google.com/linux/direct/google-chrome-stable_current_amd64.deb
$> apt-get install -y ./google-chrome-stable_current_amd64.deb
$> google-chrome --no-sandbox

When I replace chrome with Firefox, everything works fine.

Anyway, I hope someone knows how to fix this chrome issue or any suggestion what might be going wrong here would really help!


问:
Formik and Yup updating mysql form data
Working on editing data using Formik and Yup validation, when the form loads with the user information on the respective fields the yup validation is still seeing it as empty when the data loaded on the fields is already there. I have used enableReinitialize on Formik but that does not seem to work. This is the Edit Ballot Form code below, any assistance will be greatly appreciated.</p>
```<code>  import React, { useState } from 'react'
  import { useLocation } from 'react-router-dom'
  import axios from 'axios'
  import { Card, Modal, Button, Col, Form, Row } from 'react-bootstrap'
  import { CancelOutlined, CheckCircleOutline } from '@mui/icons-material'
  import * as Yup from 'yup'
  import 'bootstrap/scss/bootstrap.scss'
  import { Formik, useFormik } from 'formik'
  import Header from '../components/include/Header'

export default function Edit() {

const location = useLocation()

// localhost:port# [0]/admin[1]/edit[2]/ballotID[3]
const ballotID = location.pathname.split('/')[3]

const state = useLocation().state
const [id, setID ] = useState(state?.id || null)
const [name, setName] = useState(state?.name || null)
const [surname, setSurname] = useState(state?.surname || null)
const [title, setTitle] = useState(state?.title || null)
const [dept, setDept] = useState(state?.dept || null)
const [unit, setUnit] = useState(state?.unit || null)
const [district, setDistrict] = useState(state?.district || null)
const [level, setLevel] = useState(state?.level || null)
const [email, setEmail] = useState(state?.email || null)
const [ballot, setBallot] = useState(state?.ballot || null)

const [ error, setError]  = useState(null)

const [ show, setShow ] = useState(null)
const handleClose = function () {
    setShow(false)
}

const [info, setInfo ] = useState(null)
const handleSubmit = function () {
   setInfo(false)
}

 const dataSet = useFormik({
   initialValues: {
      name: name,
      surname: surname,
      title: title,
      dept: dept,
      unit: unit,
      district: district,
      level: level,
      email: email,
      ballot: ballot
   },
})

const validate = Yup.object().shape({
    name: Yup.string().required('Name is required'),
    surname: Yup.string().required('Surname is required'),
    title: Yup.string().required('Job Title is required'),
    dept: Yup.string().required('Teaching Department is required'),
    unit: Yup.string().required('Please select Service Type'),
    district: Yup.string().required('District is required'),
    level: Yup.string().required('Teaching level is required'),
    email: Yup.string().required('email is required').email('Email is Invalid')
})

return (
  <>
    <div className='content'>
     <Header />
        <h1>Edit Ballot Information</h1>

        <Formik
          enableReinitialize = {true}
          initialValues={{dataSet}}
          validationSchema={validate}
          validateOnChange={true}
          onSubmit={ async (values, actions) => {
              try {
                await axios.put(`/user/${ballotID}`, {
                      name: name,
                      surname: surname,
                      title: title,
                      dept: dept,
                      unit: unit,
                      district: district,
                      level: level,
                      email: email,
                      ballot: ballot
                })
                setInfo(true)
                actions.setSubmitting(false)
                actions.resetForm({
                  values: {
                      id: '',
                      name: '',
                      surname: '',
                      title:'',
                      dept: '',
                      unit: '',
                      district: '',
                      level: '',
                      email: '',
                      ballot:''
                  }
              })

              } catch (error) {
                  setError(error.response.data)
                  setShow(true)
              }
      }}>
      {({handleSubmit, touched, errors }) => (
        <Form noValidate onSubmit={handleSubmit}>
          <Row className='mb-3'>

          <Form.Group as={Col} md='2'  controlId='formGridName' className='position-relative'>
                <Form.Label>ID</Form.Label>
                <Form.Control type={'number'}
                  name={'id'}
                  placeholder={'Enter User ID'}
                  value={id}
                  onChange={(event) => setID(event.target.value)}
                  readOnly />
              </Form.Group>

              <Form.Group as={Col} md='4'  controlId='formGridName' className='position-relative'>
                <Form.Label>Name</Form.Label>
                <Form.Control type={'text'}
                  name={'name'}
                  placeholder={'Enter Name'}
                  value={name}
                  onChange={(event) => setName(event.target.value)}
                  isValid={touched.name}
                  isInvalid={!!errors.name} />
                  <Form.Control.Feedback type='invalid' tooltip>{errors.name}</Form.Control.Feedback>
              </Form.Group>

              <Form.Group as={Col} md='4' controlId='formGridSurname' className='position-relative'>
                <Form.Label>Surname</Form.Label>
                <Form.Control type={'text'}
                  name={'surname'}
                  placeholder={'Enter Surname'}
                  value={surname}
                  onChange={(event) => setSurname(event.target.value)}
                  isValid={touched.surname}
                  isInvalid={!!errors.surname} />
                <Form.Control.Feedback type='invalid' tooltip>{errors.surname}</Form.Control.Feedback>
              </Form.Group>
          </Row>

          <Row className='mb-3'>
            <Form.Group as={Col} md='4' controlId='formGridEmail' className='position-relative'>
              <Form.Label>Email</Form.Label>
                <Form.Control type={'email'}
                  name={'email'}
                  placeholder={'Enter Email'}
                  value={email}
                  onChange={(event) => setEmail(event.target.value)}
                  isInvalid={!!errors.email}/>
                <Form.Control.Feedback type='invalid' tooltip>{errors.email}</Form.Control.Feedback>
              </Form.Group>

             <Form.Group as={Col} md='4' controlId='formGridTitle' className='position-relative'>
              <Form.Label>Job Title</Form.Label>
              <Form.Control type={'text'}
                  name={'title'}
                  placeholder={'Enter Job Title'}
                  value={title}
                  onChange={(event) => setTitle(event.target.value)}
                  isValid={touched.title}
                  isInvalid={!!errors.title} />
                <Form.Control.Feedback type='invalid' tooltip>{errors.title}</Form.Control.Feedback>
            </Form.Group>

            <Form.Group as={Col} md='2'  controlId='formGridUnit' className='position-relative'>
                <Form.Label>School Level</Form.Label>
                <Form.Select aria-label='select status' name={'status'}
                    value={level} onChange={(event) => setLevel(event.target.value)}
                    isValid={touched.level} isInvalid={!!errors.level}>
                    <option>Select Status</option>
                    <option value={'Primary'}>Primary</option>
                    <option value={'Secondary'}>Secondary</option>
                    <option value={'Not Applicable'}>Not Applicable</option>
                </Form.Select>
                <Form.Control.Feedback type='invalid' tooltip>{errors.level}</Form.Control.Feedback>
             </Form.Group>

          </Row>

          <Row className='mb-3'>
             <Form.Group as={Col} md='6' controlId='formGridDept' className='position-relative'>
                <Form.Label>School</Form.Label>
                <Form.Select aria-label='select dept' name={'dept'} value={dept}
                    onChange={(event) => setDept(event.target.value)} isValid={touched.dept} isInvalid={!!errors.dept}>
                    <option>Select School</option>
                    <option value={'Agostini Settlement KPA'}>Agostini Settlement KPA</option>
                    <option value={'Anstey Memorial Girls Anglican'}>Anstey Memorial Girls Anglican</option>
                    <option value={'Aranguez Government'}>Aranguez Government</option>
                    <option value={'Aranguez North Secondary'}>Aranguez North Secondary</option>
                    <option value={'Aranguez SDMS'}>Aranguez SDMS</option>
                </Form.Select>
                <Form.Control.Feedback type='invalid' tooltip>{errors.dept}</Form.Control.Feedback>
             </Form.Group>

             <Form.Group as={Col} md='3'  controlId='formGridUnit' className='position-relative'>
                <Form.Label>Type of Service</Form.Label>
                <Form.Select aria-label='select unit' name={'unit'}
                    value={unit} onChange={(event) => setUnit(event.target.value)}
                    isValid={touched.unit} isInvalid={!!errors.unit}>
                    <option>Service Type</option>
                    <option value={'TEACH'}>TEACH</option>
                    <option value={'CIVIL'}>CIVIL</option>
                </Form.Select>
                <Form.Control.Feedback type='invalid' tooltip>{errors.unit}</Form.Control.Feedback>
             </Form.Group>

             <Form.Group as={Col} md='3'  controlId='formGridUnit' className='position-relative'>
                <Form.Label>Teaching District</Form.Label>
                <Form.Select aria-label='select district' name={'district'}
                    value={district} onChange={(event) => setDistrict(event.target.value)}
                    isValid={touched.district} isInvalid={!!errors.district}>
                    <option>Select District</option>
                    <option value={'CARONI'}>CARONI</option>
                    <option value={'NARIVA/MAYARO'}>NARIVA/MAYARO</option>
                    <option value={'ST ANDREW/ST DAVID'}>ST ANDREW/ST DAVID</option>
                    <option value={'ST GEORGE EAST'}>ST GEORGE EAST</option>
                    <option value={'ST GEORGE WEST'}>ST GEORGE WEST</option>
                    <option value={'ST PATRICK'}>ST PATRICK</option>
                    <option value={'TOBAGO'}>TOBAGO</option>
                    <option value={'VICTORIA'}>VICTORIA</option>
                </Form.Select>
                <Form.Control.Feedback type='invalid' tooltip>{errors.district}</Form.Control.Feedback>
             </Form.Group>
            </Row>

            <Row className='mb-3'>
            <Card style={{width:'12rem', position:'relative'}}>
              <Card.Header style={{'backgroundColor':'#ffff'}}>Ballot</Card.Header>
                  <Card.Body>
                    {[`radio`].map((type) => (
                        <div key={type} className='mb-3'>
                          <Form.Check label={'On'} value={'On'} type={type} name={'ballot'} onChange={(event) => setBallot(event.target.value)} isValid />
                          <Form.Check label={'Off'} value={'Off'} type={type} name={'ballot'} onChange={(event) => setBallot(event.target.value)} isInvalid />
                          <Form.Control.Feedback type='invalid'>{errors.ballot}</Form.Control.Feedback>
                        </div>
                    ))}
                  </Card.Body>
                </Card>
              </Row>

          <Form.Group as={Col} controlId='formGridSubmit'>
            <Button variant={'primary'} type={'submit'} >Update</Button>
          </Form.Group>
        </Form>
      )}
    </Formik>
  </div>

  { show ? (<Modal show={show} onHide={handleClose}>
                        <Modal.Header closeButton>
                            <Modal.Title><CancelOutlined />{" "}Error</Modal.Title>
                        </Modal.Header>
                        <Modal.Body>{error && <p>{error}</p>}</Modal.Body>
                        <Modal.Footer></Modal.Footer>
                    </Modal>):

           (<Modal show={info} onHide={handleSubmit}>
                <Modal.Header closeButton>
                    <Modal.Title><CheckCircleOutline />{"  "}Success</Modal.Title>
                </Modal.Header>
                <Modal.Body>Ballot Updated!!</Modal.Body>
                <Modal.Footer></Modal.Footer>
            </Modal>)}

        </>

        )

  }
</code>```

Title: Formik and Yup updating mysql form data

Body:
Working on editing data using Formik and Yup validation, when the form loads with the user information on the respective fields the yup validation is still seeing it as empty when the data loaded on the fields is already there. I have used enableReinitialize on Formik but that does not seem to work. This is the Edit Ballot Form code below, any assistance will be greatly appreciated.

  import React, { useState } from 'react'
  import { useLocation } from 'react-router-dom'
  import axios from 'axios'
  import { Card, Modal, Button, Col, Form, Row } from 'react-bootstrap'
  import { CancelOutlined, CheckCircleOutline } from '@mui/icons-material'
  import * as Yup from 'yup'
  import 'bootstrap/scss/bootstrap.scss'
  import { Formik, useFormik } from 'formik'
  import Header from '../components/include/Header'

export default function Edit() {

const location = useLocation()

// localhost:port# [0]/admin[1]/edit[2]/ballotID[3]
const ballotID = location.pathname.split('/')[3]

const state = useLocation().state
const [id, setID ] = useState(state?.id || null)
const [name, setName] = useState(state?.name || null)
const [surname, setSurname] = useState(state?.surname || null)
const [title, setTitle] = useState(state?.title || null)
const [dept, setDept] = useState(state?.dept || null)
const [unit, setUnit] = useState(state?.unit || null)
const [district, setDistrict] = useState(state?.district || null)
const [level, setLevel] = useState(state?.level || null)
const [email, setEmail] = useState(state?.email || null)
const [ballot, setBallot] = useState(state?.ballot || null)

const [ error, setError]  = useState(null)

const [ show, setShow ] = useState(null)
const handleClose = function () {
    setShow(false)
}

const [info, setInfo ] = useState(null)
const handleSubmit = function () {
   setInfo(false)
}

 const dataSet = useFormik({
   initialValues: {
      name: name,
      surname: surname,
      title: title,
      dept: dept,
      unit: unit,
      district: district,
      level: level,
      email: email,
      ballot: ballot
   },
})

const validate = Yup.object().shape({
    name: Yup.string().required('Name is required'),
    surname: Yup.string().required('Surname is required'),
    title: Yup.string().required('Job Title is required'),
    dept: Yup.string().required('Teaching Department is required'),
    unit: Yup.string().required('Please select Service Type'),
    district: Yup.string().required('District is required'),
    level: Yup.string().required('Teaching level is required'),
    email: Yup.string().required('email is required').email('Email is Invalid')
})

return (
  <>

Edit Ballot Information

        <Formik
          enableReinitialize = {true}
          initialValues={{dataSet}}
          validationSchema={validate}
          validateOnChange={true}
          onSubmit={ async (values, actions) => {
              try {
                await axios.put(`/user/${ballotID}`, {
                      name: name,
                      surname: surname,
                      title: title,
                      dept: dept,
                      unit: unit,
                      district: district,
                      level: level,
                      email: email,
                      ballot: ballot
                })
                setInfo(true)
                actions.setSubmitting(false)
                actions.resetForm({
                  values: {
                      id: '',
                      name: '',
                      surname: '',
                      title:'',
                      dept: '',
                      unit: '',
                      district: '',
                      level: '',
                      email: '',
                      ballot:''
                  }
              })

              } catch (error) {
                  setError(error.response.data)
                  setShow(true)
              }
      }}>
      {({handleSubmit, touched, errors }) => (
        <Form noValidate onSubmit={handleSubmit}>
          <Row className='mb-3'>

          <Form.Group as={Col} md='2'  controlId='formGridName' className='position-relative'>
                <Form.Label>ID</Form.Label>
                <Form.Control type={'number'}
                  name={'id'}
                  placeholder={'Enter User ID'}
                  value={id}
                  onChange={(event) => setID(event.target.value)}
                  readOnly />
              </Form.Group>

              <Form.Group as={Col} md='4'  controlId='formGridName' className='position-relative'>
                <Form.Label>Name</Form.Label>
                <Form.Control type={'text'}
                  name={'name'}
                  placeholder={'Enter Name'}
                  value={name}
                  onChange={(event) => setName(event.target.value)}
                  isValid={touched.name}
                  isInvalid={!!errors.name} />
                  <Form.Control.Feedback type='invalid' tooltip>{errors.name}</Form.Control.Feedback>
              </Form.Group>

              <Form.Group as={Col} md='4' controlId='formGridSurname' className='position-relative'>
                <Form.Label>Surname</Form.Label>
                <Form.Control type={'text'}
                  name={'surname'}
                  placeholder={'Enter Surname'}
                  value={surname}
                  onChange={(event) => setSurname(event.target.value)}
                  isValid={touched.surname}
                  isInvalid={!!errors.surname} />
                <Form.Control.Feedback type='invalid' tooltip>{errors.surname}</Form.Control.Feedback>
              </Form.Group>
          </Row>

          <Row className='mb-3'>
            <Form.Group as={Col} md='4' controlId='formGridEmail' className='position-relative'>
              <Form.Label>Email</Form.Label>
                <Form.Control type={'email'}
                  name={'email'}
                  placeholder={'Enter Email'}
                  value={email}
                  onChange={(event) => setEmail(event.target.value)}
                  isInvalid={!!errors.email}/>
                <Form.Control.Feedback type='invalid' tooltip>{errors.email}</Form.Control.Feedback>
              </Form.Group>

             <Form.Group as={Col} md='4' controlId='formGridTitle' className='position-relative'>
              <Form.Label>Job Title</Form.Label>
              <Form.Control type={'text'}
                  name={'title'}
                  placeholder={'Enter Job Title'}
                  value={title}
                  onChange={(event) => setTitle(event.target.value)}
                  isValid={touched.title}
                  isInvalid={!!errors.title} />
                <Form.Control.Feedback type='invalid' tooltip>{errors.title}</Form.Control.Feedback>
            </Form.Group>

            <Form.Group as={Col} md='2'  controlId='formGridUnit' className='position-relative'>
                <Form.Label>School Level</Form.Label>
                <Form.Select aria-label='select status' name={'status'}
                    value={level} onChange={(event) => setLevel(event.target.value)}
                    isValid={touched.level} isInvalid={!!errors.level}>
                    <option>Select Status</option>
                    <option value={'Primary'}>Primary</option>
                    <option value={'Secondary'}>Secondary</option>
                    <option value={'Not Applicable'}>Not Applicable</option>
                </Form.Select>
                <Form.Control.Feedback type='invalid' tooltip>{errors.level}</Form.Control.Feedback>
             </Form.Group>

          </Row>

          <Row className='mb-3'>
             <Form.Group as={Col} md='6' controlId='formGridDept' className='position-relative'>
                <Form.Label>School</Form.Label>
                <Form.Select aria-label='select dept' name={'dept'} value={dept}
                    onChange={(event) => setDept(event.target.value)} isValid={touched.dept} isInvalid={!!errors.dept}>
                    <option>Select School</option>
                    <option value={'Agostini Settlement KPA'}>Agostini Settlement KPA</option>
                    <option value={'Anstey Memorial Girls Anglican'}>Anstey Memorial Girls Anglican</option>
                    <option value={'Aranguez Government'}>Aranguez Government</option>
                    <option value={'Aranguez North Secondary'}>Aranguez North Secondary</option>
                    <option value={'Aranguez SDMS'}>Aranguez SDMS</option>
                </Form.Select>
                <Form.Control.Feedback type='invalid' tooltip>{errors.dept}</Form.Control.Feedback>
             </Form.Group>

             <Form.Group as={Col} md='3'  controlId='formGridUnit' className='position-relative'>
                <Form.Label>Type of Service</Form.Label>
                <Form.Select aria-label='select unit' name={'unit'}
                    value={unit} onChange={(event) => setUnit(event.target.value)}
                    isValid={touched.unit} isInvalid={!!errors.unit}>
                    <option>Service Type</option>
                    <option value={'TEACH'}>TEACH</option>
                    <option value={'CIVIL'}>CIVIL</option>
                </Form.Select>
                <Form.Control.Feedback type='invalid' tooltip>{errors.unit}</Form.Control.Feedback>
             </Form.Group>

             <Form.Group as={Col} md='3'  controlId='formGridUnit' className='position-relative'>
                <Form.Label>Teaching District</Form.Label>
                <Form.Select aria-label='select district' name={'district'}
                    value={district} onChange={(event) => setDistrict(event.target.value)}
                    isValid={touched.district} isInvalid={!!errors.district}>
                    <option>Select District</option>
                    <option value={'CARONI'}>CARONI</option>
                    <option value={'NARIVA/MAYARO'}>NARIVA/MAYARO</option>
                    <option value={'ST ANDREW/ST DAVID'}>ST ANDREW/ST DAVID</option>
                    <option value={'ST GEORGE EAST'}>ST GEORGE EAST</option>
                    <option value={'ST GEORGE WEST'}>ST GEORGE WEST</option>
                    <option value={'ST PATRICK'}>ST PATRICK</option>
                    <option value={'TOBAGO'}>TOBAGO</option>
                    <option value={'VICTORIA'}>VICTORIA</option>
                </Form.Select>
                <Form.Control.Feedback type='invalid' tooltip>{errors.district}</Form.Control.Feedback>
             </Form.Group>
            </Row>

            <Row className='mb-3'>
            <Card style={{width:'12rem', position:'relative'}}>
              <Card.Header style={{'backgroundColor':'#ffff'}}>Ballot</Card.Header>
                  <Card.Body>
                    {[`radio`].map((type) => (

                          <Form.Check label={'On'} value={'On'} type={type} name={'ballot'} onChange={(event) => setBallot(event.target.value)} isValid />
                          <Form.Check label={'Off'} value={'Off'} type={type} name={'ballot'} onChange={(event) => setBallot(event.target.value)} isInvalid />
                          <Form.Control.Feedback type='invalid'>{errors.ballot}</Form.Control.Feedback>

                    ))}
                  </Card.Body>
                </Card>
              </Row>

          <Form.Group as={Col} controlId='formGridSubmit'>
            <Button variant={'primary'} type={'submit'} >Update</Button>
          </Form.Group>
        </Form>
      )}
    </Formik>

  { show ? (<Modal show={show} onHide={handleClose}>
                        <Modal.Header closeButton>
                            <Modal.Title><CancelOutlined />{" "}Error</Modal.Title>
                        </Modal.Header>
                        <Modal.Body>{error &&
{error}
}</Modal.Body>
                        <Modal.Footer></Modal.Footer>
                    </Modal>):

           (<Modal show={info} onHide={handleSubmit}>
                <Modal.Header closeButton>
                    <Modal.Title><CheckCircleOutline />{"  "}Success</Modal.Title>
                </Modal.Header>
                <Modal.Body>Ballot Updated!!</Modal.Body>
                <Modal.Footer></Modal.Footer>
            </Modal>)}

        </>

        )

  }


问:
setting up network in hyperledger fabric with dynamically adding orgs by admin
While apporaching to make a new network in Hyperledger fabric with user input of how many organization he wants in an network. how can i do this and what should be my approach to do this.

My, solution to this problem is to modify "config_tx.yaml" and adding as many organization object to it using yq and jq parsers but this seems impossible to achieve as command getting to much complex. any other solution to this please help.


问:
cmake Installing many libraries so that find_package can access them
I've got a source tree with many src directories (lots of use of add_subdirectory), and
I would like to install all of them and be able to use find_package to include them into another project.
After getting mightly confused with install(EXPORT.... , .cmake and config.cmake files,
please could someone tell me the right way of approaching this.

Thanks


问:
Stop flex-wrap from spreading flex-items apart
When the website is at a phone screen, the flex-items spread apart the whole height of the screen even when align-items: center. I want the flex items to be anchored in the center and not move when height is changed.

I tried to set gap: 0 but there was still a gap in between.

body,html{
    height: 100vh;
    padding: 0
}
#div1{
    width: 200px;
    height: 200px;
    background-color: tomato;
}
#div2{
    width: 200px;
    height: 200px;
    background-color: aqua
}
#wrapper{
    display: flex;
    gap: 20px;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    height: 100%
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>
</head>
<body>
    <div id="wrapper">
        <div id="div1"></div>
        <div id="div2"></div>
    </div>
    <script src="script.js"></script>
</body>
</html></code>```

Body:
When the website is at a phone screen, the flex-items spread apart the whole height of the screen even when align-items: center. I want the flex items to be anchored in the center and not move when height is changed.

I tried to set gap: 0 but there was still a gap in between.

body,html{
    height: 100vh;
    padding: 0
}
#div1{
    width: 200px;
    height: 200px;
    background-color: tomato;
}
#div2{
    width: 200px;
    height: 200px;
    background-color: aqua
}
#wrapper{
    display: flex;
    gap: 20px;
    flex-direction: row;
    justify-content: center;
    align-items: center;
    flex-wrap: wrap;
    height: 100%
}

<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="style.css">
    <title>Document</title>


问:
custom node of @ant-design/flowchart
```<code>import { Flowchart } from '@ant-design/flowchart';
import "@ant-design/flowchart/dist/index.css";

const IndicatorNode = (props:any) => {
  const { size = { width: 120, height: 50 }, data } = props;
  const { width, height } = size;
  const { label = 'john', stroke = '#ccc', fill = '#fff', fontFill, fontSize } = data;

  return (
    <div
      className="indicator-container"
      style={{
        position: 'relative',
        display: 'block',
        background: '#fff',
        border: '1px solid #84b2e8',
        borderRadius: '2px',
        padding: '10px 12px',
        overflow: 'hidden',
        boxShadow: '0 1px 4px 0 rgba(0,0,0,0.20)',
        width,
        height,
        borderColor: stroke,
        backgroundColor: fill,
        color: fontFill,
        fontSize,
      }}
    >
      <div style={{ color: fontFill }}>{label}</div>
    </div>
  );
};

export designer = () => {
  return (
    <div style={{ height: 600 }}>
      <Flowchart
        onSave={(d) => {
          console.log(d);
        }}
        toolbarPanelProps={{
          position: {
            top: 0,
            left: 0,
            right: 0,
          },
        }}
        scaleToolbarPanelProps={{
          layout: 'horizontal',
          position: {
            right: 0,
            top: -40,
          },
          style: {
            width: 150,
            height: 39,
            left: 'auto',
            background: 'transparent',
          },
        }}
        canvasProps={{
          position: {
            top: 40,
            left: 0,
            right: 0,
            bottom: 0,
          },
        }}
        nodePanelProps={{
          position: { width: 160, top: 40, bottom: 0, left: 0 },
          defaultActiveKey: ['custom'], // ['custom', 'official']
          registerNode: {
            title: 'abc',
            key:"abc",
            nodes: [
              {
                component: IndicatorNode,
                popover: () => <div>abcs</div>,
                name: 'custom-node-indicator',
                width: 120,
                height: 50,
                label: 'abc',

              },
            ],
          },
        }}
        detailPanelProps={{
          position: { width: 200, top: 40, bottom: 0, right: 0 },
        }}
      />
    </div>
  );
}
</code>```

I want to create new custom code with api configurations and once I click on that node it shows the editable custom properties on right panel.
in custom node of @ant-design/flowchart can I add my custom editable properties? that are showing on right panel once I clink on node.. Can someone provide me any reference for that?

Title: custom node of @ant-design/flowchart

Body:
import { Flowchart } from '@ant-design/flowchart';
import "@ant-design/flowchart/dist/index.css";

const IndicatorNode = (props:any) => {
  const { size = { width: 120, height: 50 }, data } = props;
  const { width, height } = size;
  const { label = 'john', stroke = '#ccc', fill = '#fff', fontFill, fontSize } = data;

  return (

{label}

  );
};

export designer = () => {
  return (

      <Flowchart
        onSave={(d) => {
          console.log(d);
        }}
        toolbarPanelProps={{
          position: {
            top: 0,
            left: 0,
            right: 0,
          },
        }}
        scaleToolbarPanelProps={{
          layout: 'horizontal',
          position: {
            right: 0,
            top: -40,
          },
          style: {
            width: 150,
            height: 39,
            left: 'auto',
            background: 'transparent',
          },
        }}
        canvasProps={{
          position: {
            top: 40,
            left: 0,
            right: 0,
            bottom: 0,
          },
        }}
        nodePanelProps={{
          position: { width: 160, top: 40, bottom: 0, left: 0 },
          defaultActiveKey: ['custom'], // ['custom', 'official']
          registerNode: {
            title: 'abc',
            key:"abc",
            nodes: [
              {
                component: IndicatorNode,
                popover: () =>
abcs
,
                name: 'custom-node-indicator',
                width: 120,
                height: 50,
                label: 'abc',

              },
            ],
          },
        }}
        detailPanelProps={{
          position: { width: 200, top: 40, bottom: 0, right: 0 },
        }}
      />

  );
}

I want to create new custom code with api configurations and once I click on that node it shows the editable custom properties on right panel.
in custom node of @ant-design/flowchart can I add my custom editable properties? that are showing on right panel once I clink on node.. Can someone provide me any reference for that?


问:
Cannot use global variables in exported functions. Function:
im new to pine script, sorry even to coding
i got this error in lib while exporting
any help much appriciated

```<code>ERROR is: Cannot use global variables in exported functions. Function: Colcupc

fun is this
export Colcupc() =>
    array.get(bull, math.round(cndlu_css() * 97))

</code>```

any help of coding error

Body:
im new to pine script, sorry even to coding
i got this error in lib while exporting
any help much appriciated

ERROR is: Cannot use global variables in exported functions. Function: Colcupc

fun is this
export Colcupc() =>
    array.get(bull, math.round(cndlu_css() * 97))

any help of coding error


问:
How to open a pdf with node and extract a table
I feel a bit foolish to ask this but I have been stuck for a while now researching different npm packages and none of them seemingly does what I need.

I would like to open a pdf in node, parse it, and retrieve the data in a meaningful way.
I have tried pdf-parse pdf2json pdf-lib and pdf-js. None of them seems to be able to recognise text reliably (by which I mean, some lines seem to be read out multiple times even I read the file synchronously) Ideally this package or code would be able to read out a table inside a pdf.

Is there anything like that out there? All the packages seem to only concentrate on creating pdfs - which I don't care about.


问:
React Native 0.66.5 - Need android.permission.BLUETOOTH_SCAN permission for AttributionSource (Android 12)
Our app is trying to support Android 12 and 13, however, starting the app causes a crash showed in the picture below:

The app crash message

The Android manifest includes the bluetooth_scan as shown below:

Android manifest

Asking the user for permission is shown below:

Implementing the permission in the app

The react-native version is 0.66.5, and therefore should support the BLUETOOTH_SCAN. The same asking for permission implementation is used for the previous Android versions asking for "ACCESS_FINE_LOCATION", "WRITE_EXTERNAL_STORAGE" and so on.

Hope someone can help solve this problem.

Solution

I found that the app's class controlling the Bluetooth connection/scan already started before asking for the permissions. Permission was not yet granted to use Bluetooth therefore the App crashed.

For people with the same problems. Check if your Bluetooth is turned on before asking for the permissions.

Hope this helps :)


问:
PVlib: modelchain.run_model_from_poa() not found after installation?
I am trying to model an Agri-PV system (90° tilt and 90/270° azimuth with bifacial panels) and running into the following problem: I don't seem to have the .run_model_from_poa() function, perhaps the installation was incomplete. This is on a company laptop, deinstalling and reinstalling would require IT support, unfortunately. On my private machine, regular installation ("conda install -c pvlib pvlib") also does not leave me with the desired poa function.

How do I get the .run_model_from_poa() function?

Any help is appreciated!

Kind regards,
Gregor

Installation on company and private machine using the anaconda prompt command "conda install -c pvlib pvlib". In both cases I only have the .run_model() function, but not .run_model_from_poa()


问:
Python proxy with authentification (request,pytrends...)
Hello I was previously using older packages and in our corporate I was able to reach outside with proxy with Python in a way:

username = "Platform\\PersonalID"

proxies = {
           "http" : "http://username:password@adress:port",
           "https" : "http://username:password@adress:port",
          }
```
<p>with for example:</p>
<pre class="lang-py prettyprint-override"><code>requests.get(url, proxies=proxies)
</code>```

However, when I try this on new packages I get a problem with the connection to the proxy and get a timeout error from the urllib3:

"Connection to Platform timed out"

I was able to track it to some changes in urllib3 when I was comparing the old and new packages, but can't figure out how to feed the proxy settings to the requests, pytrends and other packeges (in fact to the new urllib3 which the requests and other libraries are build on)

I have tried to search throught web was looking for several ways how to get the proxy working but failed in one way or another.

for example

If I use the proxies without the password and try to pass the password as an auth=("username","password") then I get error 407 authentication required. Even though the password and ID is correct.

Example:

import requests

proxies = {"http":"http://Platform\\userID:password@adress:port",
           "https": "http://Platform\\userID:password@adress:port"
           }

url="https://www.google.com/"
requests.get(url, proxies=proxies).content

```

works with:
urllib3 up to 1.24

doesnt work with:

urllib3 1.25 (Unable to parse the proxyAdress)

urllib3 1.26.13 (TimeoutError, trying to connect to badly parsed proxyAdress is my tip?)

Body:
Hello I was previously using older packages and in our corporate I was able to reach outside with proxy with Python in a way:

username = "Platform\\PersonalID"

proxies = {
           "http" : "http://username:password@adress:port",
           "https" : "http://username:password@adress:port",
          }

with for example:

requests.get(url, proxies=proxies)

However, when I try this on new packages I get a problem with the connection to the proxy and get a timeout error from the urllib3:

"Connection to Platform timed out"

I was able to track it to some changes in urllib3 when I was comparing the old and new packages, but can't figure out how to feed the proxy settings to the requests, pytrends and other packeges (in fact to the new urllib3 which the requests and other libraries are build on)

I have tried to search throught web was looking for several ways how to get the proxy working but failed in one way or another.

for example

If I use the proxies without the password and try to pass the password as an auth=("username","password") then I get error 407 authentication required. Even though the password and ID is correct.

Example:

import requests

proxies = {"http":"http://Platform\\userID:password@adress:port",
           "https": "http://Platform\\userID:password@adress:port"
           }

url="https://www.google.com/"
requests.get(url, proxies=proxies).content

works with:
urllib3 up to 1.24

doesnt work with:

urllib3 1.25 (Unable to parse the proxyAdress)

urllib3 1.26.13 (TimeoutError, trying to connect to badly parsed proxyAdress is my tip?)


问:
WEBPACK with React router gives 404 while serving the build
Recently i am learning webpack with react and i build a app that  runs wells in Dev enviroment but when i build the app and tries to change the route it throws 404 error.

Here are my webpack Config.
webpack.common.js

```<code>const path = require("path");
const HTMLWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = {
  entry: path.resolve(__dirname, "..", "./src/index.tsx"),
  resolve: {
    extensions: [".tsx", ".ts", ".jsx", ".js"],
  },
  module: {
    rules: [
      {
        test: /\.(ts|js)x?$/,
        exclude: /node_modules/,
        use: [
          {
            loader: "babel-loader",
          },
        ],
      },
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"],
      },
      {
        test:/\.(?:ico|gif|png|jpg|jpeg)$/i,
        type:'asset/resource'
      },
      {
         test:/\.(woff(2)?|eot|ttf|otf|svg)$/i,
         type:'asset/inline'
      }
    ],
  },
  output: {
    path: path.resolve(__dirname, "..", "./build"),
    filename: "bundle.js",
  },
  plugins: [
    new HTMLWebpackPlugin({
      template: path.resolve(__dirname, "..", "./public/index.html"),
      filename:'index.html'
    }),
    // new CopyWebpackPlugin({
    //   patterns:[{from:"src",to:'dest'}]
    // })
  ],
};

</code>```

webpack.dev.js

```<code>const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const path=require('path')
module.exports={
    mode:"development",
    devServer:{
        hot:true,
        open:true,
        historyApiFallback: { index: "/", disableDotRule: true },
        port:3001
    },
    devtool:'cheap-module-source-map',
    plugins:[
        new ReactRefreshWebpackPlugin()
    ]
}
</code>```

webpack.prod.js

```<code>module.exports={
    mode:"production"  ,

}
</code>```

i changed lots of configuration like public path and other, but it didn't help.

Body:
Recently i am learning webpack with react and i build a app that  runs wells in Dev enviroment but when i build the app and tries to change the route it throws 404 error.

Here are my webpack Config.
webpack.common.js

const path = require("path");
const HTMLWebpackPlugin = require("html-webpack-plugin");
const CopyWebpackPlugin = require("copy-webpack-plugin");
module.exports = {
  entry: path.resolve(__dirname, "..", "./src/index.tsx"),
  resolve: {
    extensions: [".tsx", ".ts", ".jsx", ".js"],
  },
  module: {
    rules: [
      {
        test: /\.(ts|js)x?$/,
        exclude: /node_modules/,
        use: [
          {
            loader: "babel-loader",
          },
        ],
      },
      {
        test: /\.css$/,
        use: ["style-loader", "css-loader"],
      },
      {
        test:/\.(?:ico|gif|png|jpg|jpeg)$/i,
        type:'asset/resource'
      },
      {
         test:/\.(woff(2)?|eot|ttf|otf|svg)$/i,
         type:'asset/inline'
      }
    ],
  },
  output: {
    path: path.resolve(__dirname, "..", "./build"),
    filename: "bundle.js",
  },
  plugins: [
    new HTMLWebpackPlugin({
      template: path.resolve(__dirname, "..", "./public/index.html"),
      filename:'index.html'
    }),
    // new CopyWebpackPlugin({
    //   patterns:[{from:"src",to:'dest'}]
    // })
  ],
};

webpack.dev.js

const ReactRefreshWebpackPlugin = require('@pmmmwh/react-refresh-webpack-plugin');
const path=require('path')
module.exports={
    mode:"development",
    devServer:{
        hot:true,
        open:true,
        historyApiFallback: { index: "/", disableDotRule: true },
        port:3001
    },
    devtool:'cheap-module-source-map',
    plugins:[
        new ReactRefreshWebpackPlugin()
    ]
}

webpack.prod.js

module.exports={
    mode:"production"  ,

}

i changed lots of configuration like public path and other, but it didn't help.


问:
Flow of execution is not going as expected
I ran into a weired problem. My program is not executing as per the expectations.

public void sendPasswordResetCode(String email, Long code){
    log.info("inside");
    JavaMailSenderImpl javaMailSender = configureMailProps();
    log.info("mail props {}",javaMailSender.toString());
    SimpleMailMessage msg = new SimpleMailMessage();
    msg.setTo(email);
    msg.setSubject("Password reset code.");
    msg.setText("use this code to reset your password "+code);
    javaMailSender.send(msg);
}
```
<p>the next methods:</p>
<pre class="lang-java prettyprint-override"><code>private JavaMailSenderImpl configureMailProps() {
    log.info("inside config");
    JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
    GmailConfigurations config = new GmailConfigurations();
    GmailSettings gmail = config.getGmailSettings();
    log.info(gmail.toString());
    try {
        mailSender.setHost(gmail.getHost());
        mailSender.setPort(gmail.getPort());

        mailSender.setUsername(gmail.getGmail());

        mailSender.setPassword(gmail.getAppPassword());
    }
    catch(RuntimeException ex) {
        log.info("exce here");
        ex.printStackTrace();
    }
    log.info("Before seing props");
    Properties props = mailSender.getJavaMailProperties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.debug", "true");
    log.info("Mail {}",mailSender.toString());
    return mailSender;
}

@Slf4j
@Component
public class GmailConfigurations {

    @Autowired
    private EmailCredService emailCred;

    public GmailSettings getGmailSettings() {
        log.info("inside gmail seings");
        GmailSettings gmail = new GmailSettings();
        EmailCredSetting cred = emailCred.getEmailCred();
        if(cred != null) {
            gmail.setAppPassword(cred.getPassword());
            gmail.setGmail(cred.getEmail());
        }
        gmail.setPort(587);
        gmail.setHost("smtp.gmail.com");
        log.info("Inside gmail seings 2{}", gmail.toString());
        return gmail;
    }
}
</code>```

The output is:

inside

inside config

inside gmail seings

After that nothing is getting printed and email is not send. nothing is happening.

Please help me.

Body:
I ran into a weired problem. My program is not executing as per the expectations.

public void sendPasswordResetCode(String email, Long code){
    log.info("inside");
    JavaMailSenderImpl javaMailSender = configureMailProps();
    log.info("mail props {}",javaMailSender.toString());
    SimpleMailMessage msg = new SimpleMailMessage();
    msg.setTo(email);
    msg.setSubject("Password reset code.");
    msg.setText("use this code to reset your password "+code);
    javaMailSender.send(msg);
}

the next methods:

private JavaMailSenderImpl configureMailProps() {
    log.info("inside config");
    JavaMailSenderImpl mailSender = new JavaMailSenderImpl();
    GmailConfigurations config = new GmailConfigurations();
    GmailSettings gmail = config.getGmailSettings();
    log.info(gmail.toString());
    try {
        mailSender.setHost(gmail.getHost());
        mailSender.setPort(gmail.getPort());

        mailSender.setUsername(gmail.getGmail());

        mailSender.setPassword(gmail.getAppPassword());
    }
    catch(RuntimeException ex) {
        log.info("exce here");
        ex.printStackTrace();
    }
    log.info("Before seing props");
    Properties props = mailSender.getJavaMailProperties();
    props.put("mail.transport.protocol", "smtp");
    props.put("mail.smtp.auth", "true");
    props.put("mail.smtp.starttls.enable", "true");
    props.put("mail.debug", "true");
    log.info("Mail {}",mailSender.toString());
    return mailSender;
}

@Slf4j
@Component
public class GmailConfigurations {

    @Autowired
    private EmailCredService emailCred;

    public GmailSettings getGmailSettings() {
        log.info("inside gmail seings");
        GmailSettings gmail = new GmailSettings();
        EmailCredSetting cred = emailCred.getEmailCred();
        if(cred != null) {
            gmail.setAppPassword(cred.getPassword());
            gmail.setGmail(cred.getEmail());
        }
        gmail.setPort(587);
        gmail.setHost("smtp.gmail.com");
        log.info("Inside gmail seings 2{}", gmail.toString());
        return gmail;
    }
}

The output is:

inside

inside config

inside gmail seings

After that nothing is getting printed and email is not send. nothing is happening.

Please help me.


问:
Dynamic column names in field parameter
I've the following pbix file https://1drv.ms/u/s!Amd7BXzYs7AVk3D5iDMIrhfnpQNW?e=lHWRuH

The data model is simple

one fact related to date table and field parameter table

I  need to create a dynamic column names, concatenate the month periode selected by the field parameter

I do it manually, I duplicate the same script for months june and march and I should do the same for all months

```<code>Parameter = {
    ("Month Name June-2022", NAMEOF('DimDate'[Month Name]), 0,"June-2022","Month Name"),
    ("sales.Reason June-2022", NAMEOF('FactSales'[sales.Reason]), 1,"June-2022","sales.Reason"),
    ("Customer.Email March-2022", NAMEOF('FactSales'[Customer.Email]), 2,"June-2022","Customer.Email"), ("Month Name May-2022", NAMEOF('DimDate'[Month Name]), 0,"March-2022","Month Name"),
    ("sales.Reason March-2022", NAMEOF('FactSales'[sales.Reason]), 1,"March-2022","sales.Reason"),
    ("Customer.Email March-2022", NAMEOF('FactSales'[Customer.Email]), 2,"March-2022","Customer.Email")
}
</code>```

Is there a way to do it dynamically please?

Title: Dynamic column names in field parameter

Body:
I've the following pbix file https://1drv.ms/u/s!Amd7BXzYs7AVk3D5iDMIrhfnpQNW?e=lHWRuH

The data model is simple

one fact related to date table and field parameter table

I  need to create a dynamic column names, concatenate the month periode selected by the field parameter

I do it manually, I duplicate the same script for months june and march and I should do the same for all months

Parameter = {
    ("Month Name June-2022", NAMEOF('DimDate'[Month Name]), 0,"June-2022","Month Name"),
    ("sales.Reason June-2022", NAMEOF('FactSales'[sales.Reason]), 1,"June-2022","sales.Reason"),
    ("Customer.Email March-2022", NAMEOF('FactSales'[Customer.Email]), 2,"June-2022","Customer.Email"), ("Month Name May-2022", NAMEOF('DimDate'[Month Name]), 0,"March-2022","Month Name"),
    ("sales.Reason March-2022", NAMEOF('FactSales'[sales.Reason]), 1,"March-2022","sales.Reason"),
    ("Customer.Email March-2022", NAMEOF('FactSales'[Customer.Email]), 2,"March-2022","Customer.Email")
}

Is there a way to do it dynamically please?


问:
autofac AutoActivate instance how to control order?
```<code>public class TestOrderIndex1
{
    public TestOrderIndex1()
    {
         Console.WriteLine("TestOrderIndex1");
    }
}

public class TestOrderIndex2
{
    public TestOrderIndex2()
    {
         Console.WriteLine("TestOrderIndex2");
    }
}

public class TestOrderIndex3
{
    public TestOrderIndex3()
    {
        Console.WriteLine("TestOrderIndex3");
    }
}

</code>```
```<code>    var builder = new ContainerBuilder();
    builder.RegisterType<TestOrderIndex1>().SingleInstance().AutoActivate();
    builder.RegisterType<TestOrderIndex2>().SingleInstance().AutoActivate();
    builder.RegisterType<TestOrderIndex3>().SingleInstance().AutoActivate();
    var container = builder.Build();
</code>```

// the order of instance autoactivate
// It looks like it is registered first and instantiated last
TestOrderIndex3
TestOrderIndex2
TestOrderIndex1

how to change the order to registered first and instantiated first ?

Body:
public class TestOrderIndex1
{
    public TestOrderIndex1()
    {
         Console.WriteLine("TestOrderIndex1");
    }
}

public class TestOrderIndex2
{
    public TestOrderIndex2()
    {
         Console.WriteLine("TestOrderIndex2");
    }
}

public class TestOrderIndex3
{
    public TestOrderIndex3()
    {
        Console.WriteLine("TestOrderIndex3");
    }
}

    var builder = new ContainerBuilder();
    builder.RegisterType<TestOrderIndex1>().SingleInstance().AutoActivate();
    builder.RegisterType<TestOrderIndex2>().SingleInstance().AutoActivate();
    builder.RegisterType<TestOrderIndex3>().SingleInstance().AutoActivate();
    var container = builder.Build();

// the order of instance autoactivate
// It looks like it is registered first and instantiated last
TestOrderIndex3
TestOrderIndex2
TestOrderIndex1

how to change the order to registered first and instantiated first ?


问:
create a new Calendar in user main account with expo
I want to create a new Calendar under the user main account using expo-calendar (if possible)

I'm able to retrieve currently existing calendars including a "custom" one (for instance I have a "Family" calendar in my account:

which I am able to get information about with expo-calendar:

{
    "calendars": [
        {
            "allowsModifications": true,
            "title": "Famille",
            "name": "Famille",
            "isVisible": true,
            "ownerAccount": "ACCOUNT_ID@group.calendar.google.com",
            "color": "#7BD148",
            "source": {
                "isLocalAccount": false,
                "type": "com.google",
                "name": "EMAIL@gmail.com"
            },
            "isPrimary": false,
            "id": "1",
            "accessLevel": "editor",
            "timeZone": "UTC",
            "allowedAttendeeTypes": [
                "none",
                "required",
                "optional"
            ],
            "isSynced": true,
            "allowedAvailabilities": [
                "busy",
                "free"
            ],
            "allowedReminders": [
                "default",
                "alert",
                "email"
            ]
        },
    ...

```

I'm also able to create events in my main account (which are correctly created and synced) by retrieving my main account CalendarId and adding events in it.
Also, by simply following the example, I can create a local calendar and add events in it. but it stays local, not synced with my other devices

Now what I want to do is creating a new "calendar" (like the Family one) under my main user account using expo-calendar.

I know I can create a calendar via the web interface of google calendar and probably use it then, but is it possible to create it with expo-calendar?

I have tried a few things:

Creating a calendar with the same source as my main calendar, and the same ownerAccount. It creates the calendar, but I can neither see it in google agenda nor events created in it, and then it is removed by OS within a minute most of the time anyway.

creating a calendar with a new source (but copy pasted from the one on my main account)

setting the "isSynced" to true and to false
using a "owner" access level

none of it is working

So my questions are:

Is it only possible to create a new Calendar and sync it with a google account from expo-calendar?

If it is... how can I do it?

By the way, I see the "Family" Calendar in the list of calendars, but not the "Reminders", or "Events" one. I guess they are some specials, protected calendars?

Body:
I want to create a new Calendar under the user main account using expo-calendar (if possible)

I'm able to retrieve currently existing calendars including a "custom" one (for instance I have a "Family" calendar in my account:

which I am able to get information about with expo-calendar:

{
    "calendars": [
        {
            "allowsModifications": true,
            "title": "Famille",
            "name": "Famille",
            "isVisible": true,
            "ownerAccount": "ACCOUNT_ID@group.calendar.google.com",
            "color": "#7BD148",
            "source": {
                "isLocalAccount": false,
                "type": "com.google",
                "name": "EMAIL@gmail.com"
            },
            "isPrimary": false,
            "id": "1",
            "accessLevel": "editor",
            "timeZone": "UTC",
            "allowedAttendeeTypes": [
                "none",
                "required",
                "optional"
            ],
            "isSynced": true,
            "allowedAvailabilities": [
                "busy",
                "free"
            ],
            "allowedReminders": [
                "default",
                "alert",
                "email"
            ]
        },
    ...

I'm also able to create events in my main account (which are correctly created and synced) by retrieving my main account CalendarId and adding events in it.
Also, by simply following the example, I can create a local calendar and add events in it. but it stays local, not synced with my other devices

Now what I want to do is creating a new "calendar" (like the Family one) under my main user account using expo-calendar.

I know I can create a calendar via the web interface of google calendar and probably use it then, but is it possible to create it with expo-calendar?

I have tried a few things:

Creating a calendar with the same source as my main calendar, and the same ownerAccount. It creates the calendar, but I can neither see it in google agenda nor events created in it, and then it is removed by OS within a minute most of the time anyway.

creating a calendar with a new source (but copy pasted from the one on my main account)

setting the "isSynced" to true and to false
using a "owner" access level

none of it is working

So my questions are:

Is it only possible to create a new Calendar and sync it with a google account from expo-calendar?

If it is... how can I do it?

By the way, I see the "Family" Calendar in the list of calendars, but not the "Reminders", or "Events" one. I guess they are some specials, protected calendars?


问:
Why doesn't "overflow:hidden" work on siblings with position properties?
I made several tests with the property overflow:hidden.

I wonder why it doesn't work if I apply it to .child1
If I apply to #parent it only works on #section2, but child2 remains covered

I wonder which are the causes of this behaviour and what to do in order to fix it.

I found out that the overflow:hidden works on sibligns (if I apply the property to #parent, its sibling(#section2) gets uncovered.

However it does not work on siblings (child1) and (child2). If I apply the property either to child1 or #parent, child2 remains covered by child1.

#parent {
  position: relative;
  background-color: grey;
  width: 600px;
  height: 600px;
}

.child1 {
  position: absolute;
  background-color: orange;
  width: 400px;
  height: 800px;
  overflow: hidden;
}

.child2 {
  background-color: green;
  width: 300px;
  height: 300px;
}

#section2 {
  background-color: purple;
}```
<pre class="snippet-code-html lang-html prettyprint-override"><code><main>
  <section id="parent">
    <div class="child1"> <strong>child1</strong></div>
    <div class="child2"><strong>child2</strong></div>
  </section>
  <section id="section2">
    <p> I am section2</p>
  </section>
</main></code>```

Body:
I made several tests with the property overflow:hidden.

I wonder why it doesn't work if I apply it to .child1
If I apply to #parent it only works on #section2, but child2 remains covered

I wonder which are the causes of this behaviour and what to do in order to fix it.

I found out that the overflow:hidden works on sibligns (if I apply the property to #parent, its sibling(#section2) gets uncovered.

However it does not work on siblings (child1) and (child2). If I apply the property either to child1 or #parent, child2 remains covered by child1.

#parent {
  position: relative;
  background-color: grey;
  width: 600px;
  height: 600px;
}

.child1 {
  position: absolute;
  background-color: orange;
  width: 400px;
  height: 800px;
  overflow: hidden;
}

.child2 {
  background-color: green;
  width: 300px;
  height: 300px;
}

#section2 {
  background-color: purple;
}

 child1

child2

 I am section2


问:
Item content not center aligns in Grid and irregular height Material UI
I am trying to use MUI Card in Grid layout

```<code>      <Grid container spacing={5} alignContent="center" alignItems="center" justifyContent="center" columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
        <Grid item xs={4} md={6} alignItems="center">
            <Card />
        </Grid>
        <Grid item xs={4} md={6}>
            <Card />
        </Grid>
        <Grid item xs={4} md={6}>
            <Card />
        </Grid>
        <Grid item xs={4} md={6}>
            <Card />
        </Grid>
      </Grid>
</code>```

But the problem is its not center aligns with in each grid item. I have added border for each item

What I did wrong?
Also as you can see the grid overlap on the title above

Body:
I am trying to use MUI Card in Grid layout

      <Grid container spacing={5} alignContent="center" alignItems="center" justifyContent="center" columnSpacing={{ xs: 1, sm: 2, md: 3 }}>
        <Grid item xs={4} md={6} alignItems="center">
            <Card />
        </Grid>
        <Grid item xs={4} md={6}>
            <Card />
        </Grid>
        <Grid item xs={4} md={6}>
            <Card />
        </Grid>
        <Grid item xs={4} md={6}>
            <Card />
        </Grid>
      </Grid>

But the problem is its not center aligns with in each grid item. I have added border for each item

What I did wrong?
Also as you can see the grid overlap on the title above


问:
Extracting data from the chemical_kinetics data.dataset
I recreated the "simple example" from the documentation of the chemical_kinetics module used to load, plot and fit chemical kinetics data. I used the module to fit some of my own data succesfully but now I also want to get numerical values from the data.dataset created. The DataFrame contains all the input data but also the parameters and the output data used to plot the fitted line.

The following code is used to import data

```<code>ds = data.Dataset(
    files_c = ["data/concentrations vs time.csv"],
    t_label = "Time [a.u.]",
    c_label = "Concentration [a.u.]"
)
</code>```

And the following adds the fitting data

```<code>from chemical_kinetics import fit

fit.fit_dataset(
    dataset = ds,
    derivatives = derivatives,
    parameters = parameters,
    c0 = c0
)
</code>```

The function

```<code>fit.print_result(ds)
</code>```

only reports the values for each parameter and

```<code>plot.plot_c(ds)
</code>```

plots all the data I want to extract. I want to numerically extract the very data that is plotted.

I tried using some methods to get data from pandas Dataframe as the documentation says that the data.dataset created pandas.Dataframes but it never works.

The entire example is listed on the following link:
https://chemical-kinetics.readthedocs.io/en/latest/simple_example.html

Body:
I recreated the "simple example" from the documentation of the chemical_kinetics module used to load, plot and fit chemical kinetics data. I used the module to fit some of my own data succesfully but now I also want to get numerical values from the data.dataset created. The DataFrame contains all the input data but also the parameters and the output data used to plot the fitted line.

The following code is used to import data

ds = data.Dataset(
    files_c = ["data/concentrations vs time.csv"],
    t_label = "Time [a.u.]",
    c_label = "Concentration [a.u.]"
)

And the following adds the fitting data

from chemical_kinetics import fit

fit.fit_dataset(
    dataset = ds,
    derivatives = derivatives,
    parameters = parameters,
    c0 = c0
)

The function

fit.print_result(ds)

only reports the values for each parameter and

plot.plot_c(ds)

plots all the data I want to extract. I want to numerically extract the very data that is plotted.

I tried using some methods to get data from pandas Dataframe as the documentation says that the data.dataset created pandas.Dataframes but it never works.

The entire example is listed on the following link:
https://chemical-kinetics.readthedocs.io/en/latest/simple_example.html