问:
It create file in local dir, if i open local dir file, it will open normally, but when i put to download by base64 code it turn corrupted
Well, my code is from my API in python. Initialy i try to do by base64 code, passing the base64 string and creating the file to download at php. It dowload the file, same size as original, but when i try to open the pdf/xlsx file, it shows msg that is corrupted.

The base64 code API:

```<code>@goals.route('/getPdfB64',methods=['GET'])
def getPdfB64():
    c = canvas.Canvas("C:/Report.pdf", pagesize=landscape(A4))
    c.drawString(300, 300, f'TEST')

    pdf = c.getpdfdata()
    pdf_b64 = base64.b64encode(pdf).decode('utf-8')

    data = {
        "code" : 200,
        "value" : {
            "base64" : pdf_b64
        }
    }
    return jsonify(data)
</code>```

The PHP that receives the file:

```<code><?php
$file = json_decode(sendAPIRequest("GET", "localhost:5000/getPdfB64",[]));
$file = base64_decode($file->value->base64);
header('Content-Description: File Transfer');
header("Content-Type: application/pdf") ;
header("Content-Disposition: attachment; filename=Report.pdf");
header("Content-Length: ".strlen($file));

echo $file;

exit;
</code>```

It do the download, but always corrupt. Well, to know if my original file is corrupted, i make a line to save the file at local dir and then, pass file dir by API to download at PHP and it works for pdf.

API:

```<code>@goals.route('/getPdfB64',methods=['GET'])
def getPdfB64():
    fileDir = "C:/Report.pdf"
    c = canvas.Canvas(fileDir, pagesize=landscape(A4))
    c.drawString(300, 300, f'TEST')
    c.save()

    pdf = c.getpdfdata()
    pdf_b64 = base64.b64encode(pdf).decode('utf-8')

    data = {
        "code" : 200,
        "value" : {
            "base64" : pdf_b64,
            "dir" : fileDir
        }
    }
    return jsonify(data)
</code>```

PHP:

```<code>$file = json_decode(sendAPIRequest("GET", "localhost:5000/getPdfB64",[]));
$file = $file->value->dir;

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="'.basename($file).'"');
    header('Content-Length: ' . filesize($file));
    readfile($file);
    exit;
}
</code>```

The problem at this point is: it works for pdf, but i want it by base64 string, because i don't want to save local files... then i try to get base64 of saved file and try to pass it by API to discover if this way base64 code will go.

API:

```<code>@goals.route('/getPdfB64',methods=['GET'])
def getPdfB64():
    fileDir = "C:/Report.pdf"
    c = canvas.Canvas(fileDir, pagesize=landscape(A4))
    c.drawString(300, 300, f'TEST')
    c.save()

    with open(fileDir, "rb") as file:
        pdf = file.read()

    pdf_b64 = base64.b64encode(pdf).decode('utf-8')

    data = {
        "code" : 200,
        "value" : {
            "base64" : pdf_b64,
            "dir" : fileDir
        }
    }
    return jsonify(data)
</code>```

PHP:

```<code>
<?php
$file = json_decode(sendAPIRequest("GET", "localhost:5000/getPdfB64",[]));
$file = base64_decode($file->value->base64);
header('Content-Description: File Transfer');
header("Content-Type: application/pdf") ;
header("Content-Disposition: attachment; filename=Report.pdf");
header("Content-Length: ".strlen($file));

echo $file;

exit;
</code>```

And it continue corrupted. But i open the local file manualy it opens normal.

Body:
Well, my code is from my API in python. Initialy i try to do by base64 code, passing the base64 string and creating the file to download at php. It dowload the file, same size as original, but when i try to open the pdf/xlsx file, it shows msg that is corrupted.

The base64 code API:

@goals.route('/getPdfB64',methods=['GET'])
def getPdfB64():
    c = canvas.Canvas("C:/Report.pdf", pagesize=landscape(A4))
    c.drawString(300, 300, f'TEST')

    pdf = c.getpdfdata()
    pdf_b64 = base64.b64encode(pdf).decode('utf-8')

    data = {
        "code" : 200,
        "value" : {
            "base64" : pdf_b64
        }
    }
    return jsonify(data)

The PHP that receives the file:

<?php
$file = json_decode(sendAPIRequest("GET", "localhost:5000/getPdfB64",[]));
$file = base64_decode($file->value->base64);
header('Content-Description: File Transfer');
header("Content-Type: application/pdf") ;
header("Content-Disposition: attachment; filename=Report.pdf");
header("Content-Length: ".strlen($file));

echo $file;

exit;

It do the download, but always corrupt. Well, to know if my original file is corrupted, i make a line to save the file at local dir and then, pass file dir by API to download at PHP and it works for pdf.

API:

@goals.route('/getPdfB64',methods=['GET'])
def getPdfB64():
    fileDir = "C:/Report.pdf"
    c = canvas.Canvas(fileDir, pagesize=landscape(A4))
    c.drawString(300, 300, f'TEST')
    c.save()

    pdf = c.getpdfdata()
    pdf_b64 = base64.b64encode(pdf).decode('utf-8')

    data = {
        "code" : 200,
        "value" : {
            "base64" : pdf_b64,
            "dir" : fileDir
        }
    }
    return jsonify(data)

PHP:

$file = json_decode(sendAPIRequest("GET", "localhost:5000/getPdfB64",[]));
$file = $file->value->dir;

if (file_exists($file)) {
    header('Content-Description: File Transfer');
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename="'.basename($file).'"');
    header('Content-Length: ' . filesize($file));
    readfile($file);
    exit;
}

The problem at this point is: it works for pdf, but i want it by base64 string, because i don't want to save local files... then i try to get base64 of saved file and try to pass it by API to discover if this way base64 code will go.

API:

@goals.route('/getPdfB64',methods=['GET'])
def getPdfB64():
    fileDir = "C:/Report.pdf"
    c = canvas.Canvas(fileDir, pagesize=landscape(A4))
    c.drawString(300, 300, f'TEST')
    c.save()

    with open(fileDir, "rb") as file:
        pdf = file.read()

    pdf_b64 = base64.b64encode(pdf).decode('utf-8')

    data = {
        "code" : 200,
        "value" : {
            "base64" : pdf_b64,
            "dir" : fileDir
        }
    }
    return jsonify(data)

PHP:

<?php
$file = json_decode(sendAPIRequest("GET", "localhost:5000/getPdfB64",[]));
$file = base64_decode($file->value->base64);
header('Content-Description: File Transfer');
header("Content-Type: application/pdf") ;
header("Content-Disposition: attachment; filename=Report.pdf");
header("Content-Length: ".strlen($file));

echo $file;

exit;

And it continue corrupted. But i open the local file manualy it opens normal.


来源: stackexchange

问:
Angular Material input border is not working properly in case of error in IOS devices
In IOS mobile devices Angular material input border color is not working properly, in case of error the border color is splitting.
Example Screenshot

Tried to overwrite border color using the material components with the class
.mat-form-filed-outline

ContentLicense: CC BY-SA 4.0


问:
adb: failed to install google.apk: Failure [INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.google.android
i cant insatll main google app(package: com.google.android.googlequicksearchbox) from play store on my android vivo y15s android 12.
on android the error was something about package name conflicting.

then i tried to install the apk file from CMD of google of version 13.48.11.26.arm64 then it showed the error...
adb: failed to install google.apk: Failure [INSTALL_FAILED_DUPLICATE_PERMISSION: Package com.google.android.googlequicksearchbox attempting to redeclare permiss ion com.google.android.apps.now.OPT_IN_WIZARD already owned by com.google.androi d.apps.searchlite]

then i uninstalled the com.google.android.apps.searchlite] but nothing changed...same error
then i tried to uninstall com.google.android.apps.now.OPT_IN_WIZARD then error occured
Failure [DELETE_FAILED_INTERNAL_ERROR]


问:
Unable to configure proxy for ASP.NET application to be viewed on Apache website
I am doing a project where a running ASP.NET application (ran by dotnet core) is to be portrayed on a website via apache. I am having trouble with the proxy and get some interesting log errors I can't understand.

```<code>[Fri Jan 06 10:54:01.049808 2023] [proxy_http:error] [pid 17756:tid 3045061632] (20014)Internal error (specific information not available): [client 5.150.205.190:61781] AH01102: error reading status line from remote server localhost:7199, referer: http://www.website.me/
[Fri Jan 06 10:54:01.050039 2023] [proxy:error] [pid 17756:tid 3045061632] [client 5.150.205.190:61781] AH00898: Error reading from remote server returned by /favicon.ico, referer: http://www.website.me/
</code>```

The VirtualHost is kept simple

```<code><VirtualHost *:80>
    ServerName www.website.me
    ServerAlias www.website.me
    ProxyPreserveHost On
    ProxyRequests On
    ProxyPass "/" "http://localhost:7199/"
    ProxyPassReverse "/" "http://localhost:7199/"
</VirtualHost>
</code>```

I've consulted with ChatGPT, referring me vaguely to possible network issues between the application and apache. But since both are running I don't see the issue with simply pointing to the localhost view. I can view it locally in browser. Why can't I point to it?

Body:
I am doing a project where a running ASP.NET application (ran by dotnet core) is to be portrayed on a website via apache. I am having trouble with the proxy and get some interesting log errors I can't understand.

[Fri Jan 06 10:54:01.049808 2023] [proxy_http:error] [pid 17756:tid 3045061632] (20014)Internal error (specific information not available): [client 5.150.205.190:61781] AH01102: error reading status line from remote server localhost:7199, referer: http://www.website.me/
[Fri Jan 06 10:54:01.050039 2023] [proxy:error] [pid 17756:tid 3045061632] [client 5.150.205.190:61781] AH00898: Error reading from remote server returned by /favicon.ico, referer: http://www.website.me/

The VirtualHost is kept simple

<VirtualHost *:80>
    ServerName www.website.me
    ServerAlias www.website.me
    ProxyPreserveHost On
    ProxyRequests On
    ProxyPass "/" "http://localhost:7199/"
    ProxyPassReverse "/" "http://localhost:7199/"
</VirtualHost>

I've consulted with ChatGPT, referring me vaguely to possible network issues between the application and apache. But since both are running I don't see the issue with simply pointing to the localhost view. I can view it locally in browser. Why can't I point to it?


问:
Qt C++ / objective-C application, lock iPad screen orientation programmatically
I have a Qt / QML application on iOS. It is coded in C++ but I can include objective-c code in it.
I can change programmatically the orientation of the screen, which changes the orientation of the application, without changing the orienation of the iPad, and the user has to turn it when he notices the change of orientation of the screen.

I do that as I need to force the orientation depending on what I display on the application.

What I need to do now is to lock the automatic change of orientation (due to physical change) as I need it to be landscape sometimes and portrait other times.

To change the orientation programmatically, I found the above solution which works:

in my plist file, orientations must be allowed:

```<code><key>UISupportedInterfaceOrientations</key>
<array>
  <string>UIInterfaceOrientationPortrait</string>
  <string>UIInterfaceOrientationLandscapeRight</string>
</array>
</code>```

in my C++ code where I can insert objective-c:

```<code>void setScreenOrientation(bool inIsPortrait)
{
  if(@available(iOS 16, *))
  {
    NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
    UIWindowScene *scene = (UIWindowScene *)array[0];

    UIInterfaceOrientationMask newOrientation;

    if(inIsPortrait)
      newOrientation = UIInterfaceOrientationMaskPortrait;
    else
      newOrientation = UIInterfaceOrientationMaskLandscapeRight;

    UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] initWithInterfaceOrientations:newOrientation];

   [scene requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) { }];
  }
  else
  {
    //does not work on iOS 16, outputs following error:
    //[Orientation] BUG IN CLIENT OF UIKIT: Setting UIDevice.orientation is not supported. Please use UIWindowScene.requestGeometryUpdate(_:)

    NSNumber *newOrientation;
    if(inIsPortrait)
      newOrientation = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
    else
      newOrientation = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];

    [[UIDevice currentDevice] setValue:newOrientation forKey:@"orientation"];
  }
}
</code>```

}

So with that, when I want to change the orientation from portrait to landscape or vice versa, I just call the function with the correct parameter.

The problem is that when I physically turn the iPad, the screen automatically changes its orientation due to the plist file. So when I force to landscape, the user sees the change so turns its iPad, but if he turns back to portrait, the automatic change will put back the screen to portrait, without calling my function of course.

I can't remove the orientations from the plist file as they are required if I want to change it programmatically.

But I would like to lock the screen in the selected orientation at the end of the function, and of course, unlock it at the beginning, so that physically turn the iPad won't change the screen orientation.

I found solutions with the function "shouldAutorotate" but it has to be overwritten and called in viewDidLoad or supportedInterfaceOrientationsForWindow which are specific to an objective-c implementation and architecture.

I found : Lock orientation with native Objective-C code from Qt

but I can't do that in my code as I don't have any ViewController, ... it's a Qt / QML application.

I would like to have something that I can call in my function, something to change the supported orientations, so modify "supportedInterfaceOrientationsForWindow" by calling it directly in a function. Something like:

```<code>[[UIApplication ???] supportedInterfaceOrientationsForWindow] = UIInterfaceOrientationMaskPortrait; //or UIInterfaceOrientationMaskLandscapeRight depending on what I need
</code>```

or any other instructions but without having to override supportedInterfaceOrientationsForWindow.

Thanks

Body:
I have a Qt / QML application on iOS. It is coded in C++ but I can include objective-c code in it.
I can change programmatically the orientation of the screen, which changes the orientation of the application, without changing the orienation of the iPad, and the user has to turn it when he notices the change of orientation of the screen.

I do that as I need to force the orientation depending on what I display on the application.

What I need to do now is to lock the automatic change of orientation (due to physical change) as I need it to be landscape sometimes and portrait other times.

To change the orientation programmatically, I found the above solution which works:

in my plist file, orientations must be allowed:

<key>UISupportedInterfaceOrientations</key>
<array>
  <string>UIInterfaceOrientationPortrait</string>
  <string>UIInterfaceOrientationLandscapeRight</string>
</array>

in my C++ code where I can insert objective-c:

void setScreenOrientation(bool inIsPortrait)
{
  if(@available(iOS 16, *))
  {
    NSArray *array = [[[UIApplication sharedApplication] connectedScenes] allObjects];
    UIWindowScene *scene = (UIWindowScene *)array[0];

    UIInterfaceOrientationMask newOrientation;

    if(inIsPortrait)
      newOrientation = UIInterfaceOrientationMaskPortrait;
    else
      newOrientation = UIInterfaceOrientationMaskLandscapeRight;

    UIWindowSceneGeometryPreferencesIOS *geometryPreferences = [[UIWindowSceneGeometryPreferencesIOS alloc] initWithInterfaceOrientations:newOrientation];

   [scene requestGeometryUpdateWithPreferences:geometryPreferences errorHandler:^(NSError * _Nonnull error) { }];
  }
  else
  {
    //does not work on iOS 16, outputs following error:
    //[Orientation] BUG IN CLIENT OF UIKIT: Setting UIDevice.orientation is not supported. Please use UIWindowScene.requestGeometryUpdate(_:)

    NSNumber *newOrientation;
    if(inIsPortrait)
      newOrientation = [NSNumber numberWithInt:UIInterfaceOrientationPortrait];
    else
      newOrientation = [NSNumber numberWithInt:UIInterfaceOrientationLandscapeRight];

    [[UIDevice currentDevice] setValue:newOrientation forKey:@"orientation"];
  }
}

}

So with that, when I want to change the orientation from portrait to landscape or vice versa, I just call the function with the correct parameter.

The problem is that when I physically turn the iPad, the screen automatically changes its orientation due to the plist file. So when I force to landscape, the user sees the change so turns its iPad, but if he turns back to portrait, the automatic change will put back the screen to portrait, without calling my function of course.

I can't remove the orientations from the plist file as they are required if I want to change it programmatically.

But I would like to lock the screen in the selected orientation at the end of the function, and of course, unlock it at the beginning, so that physically turn the iPad won't change the screen orientation.

I found solutions with the function "shouldAutorotate" but it has to be overwritten and called in viewDidLoad or supportedInterfaceOrientationsForWindow which are specific to an objective-c implementation and architecture.

I found : Lock orientation with native Objective-C code from Qt

but I can't do that in my code as I don't have any ViewController, ... it's a Qt / QML application.

I would like to have something that I can call in my function, something to change the supported orientations, so modify "supportedInterfaceOrientationsForWindow" by calling it directly in a function. Something like:

[[UIApplication ???] supportedInterfaceOrientationsForWindow] = UIInterfaceOrientationMaskPortrait; //or UIInterfaceOrientationMaskLandscapeRight depending on what I need

or any other instructions but without having to override supportedInterfaceOrientationsForWindow.

Thanks


问:
delegating constructors are permitted only in C++11
enter image description here

How do I declare a delegate constructor?

Please tell me how to declare a delegation constructor in a version other than C++11.


问:
React native app with firestore-emulator. Queries getting firestore-production data mixed with firestore-emulator data?
Sample Code of assigning emulator ports

authstore.js

import firebase from "@react-native-firebase/app";
import "@react-native-firebase/auth";
import "@react-native-firebase/firestore";
import { FirebaseAuthTypes } from "@react-native-firebase/auth";
import { createSlice, createAsyncThunk, PayloadAction } from "@reduxjs/toolkit";
if (__DEV__) {
    firebase.firestore().useEmulator('localhost', 8080);
    firebase.auth().useEmulator('http://127.0.0.1:9099');
}
```
<p>Now when I query my business data</p>
<pre class="lang-js prettyprint-override"><code>const data = await firebase.firestore()
                .collection('business')
                .where('clients', 'array-contains', 'client1')
                .get();
</code>```

I am getting two documents say ABC and XYZ. But I have only one document in firestore emulator database ie. ABC. I have one document in firestore production database XYZ. Why I am getting both?

Body:
Sample Code of assigning emulator ports

authstore.js

import firebase from "@react-native-firebase/app";
import "@react-native-firebase/auth";
import "@react-native-firebase/firestore";
import { FirebaseAuthTypes } from "@react-native-firebase/auth";
import { createSlice, createAsyncThunk, PayloadAction } from "@reduxjs/toolkit";
if (__DEV__) {
    firebase.firestore().useEmulator('localhost', 8080);
    firebase.auth().useEmulator('http://127.0.0.1:9099');
}

Now when I query my business data

const data = await firebase.firestore()
                .collection('business')
                .where('clients', 'array-contains', 'client1')
                .get();

I am getting two documents say ABC and XYZ. But I have only one document in firestore emulator database ie. ABC. I have one document in firestore production database XYZ. Why I am getting both?


问:
Use ViewBinding in sealed class
I have a simple android app, which is changing text and color of TextView depends on how much passengers i added. I want to create a sealed class for each state.

Here is the code of the current app:

```<code>class MainActivity : AppCompatActivity() {
    private var counter = 0
    private val maxPassengers = 50
    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        binding = ActivityMainBinding.inflate(layoutInflater)
        super.onCreate(savedInstanceState)
        setContentView(binding.root)
        binding.seats.text = counter.toString()

        binding.minusButton.setOnClickListener {
            counter -= 1
            checkAndSwitchState(counter)
        }

        binding.plusButton.setOnClickListener {
            counter += 1
            checkAndSwitchState(counter)
        }

        binding.resetButton.setOnClickListener {
            counter = 0
            it.visibility = View.GONE
            checkAndSwitchState(counter)
        }
    }

    private fun checkAndSwitchState(counter: Int) {
        if (counter == 0) {
            binding.minusButton.isEnabled = false
            binding.textView.text = binding.textView.context.getText(R.string.green_text)
            binding.textView.setTextColor(Color.parseColor("#00FF00"))
            binding.seats.text = counter.toString()
        }

        if (counter in 1 until maxPassengers) {
            binding.minusButton.isEnabled = true
            binding.textView.text = "Осталось мест: " + "${maxPassengers - counter}"
            binding.textView.setTextColor(Color.parseColor("#0000FF"))
            binding.seats.text = counter.toString()
        }

        if (counter >= maxPassengers) {
            binding.resetButton.visibility = View.VISIBLE
            binding.textView.text = binding.textView.context.getText(R.string.red_text)
            binding.textView.setTextColor(Color.parseColor("#FF0000"))
            binding.seats.text = counter.toString()
        }
    }
}
</code>```

So the question is how can i use binding outside MainActivity in sealed class

Title: Use ViewBinding in sealed class

Body:
I have a simple android app, which is changing text and color of TextView depends on how much passengers i added. I want to create a sealed class for each state.

Here is the code of the current app:

class MainActivity : AppCompatActivity() {
    private var counter = 0
    private val maxPassengers = 50
    private lateinit var binding: ActivityMainBinding

    override fun onCreate(savedInstanceState: Bundle?) {
        binding = ActivityMainBinding.inflate(layoutInflater)
        super.onCreate(savedInstanceState)
        setContentView(binding.root)
        binding.seats.text = counter.toString()

        binding.minusButton.setOnClickListener {
            counter -= 1
            checkAndSwitchState(counter)
        }

        binding.plusButton.setOnClickListener {
            counter += 1
            checkAndSwitchState(counter)
        }

        binding.resetButton.setOnClickListener {
            counter = 0
            it.visibility = View.GONE
            checkAndSwitchState(counter)
        }
    }

    private fun checkAndSwitchState(counter: Int) {
        if (counter == 0) {
            binding.minusButton.isEnabled = false
            binding.textView.text = binding.textView.context.getText(R.string.green_text)
            binding.textView.setTextColor(Color.parseColor("#00FF00"))
            binding.seats.text = counter.toString()
        }

        if (counter in 1 until maxPassengers) {
            binding.minusButton.isEnabled = true
            binding.textView.text = "Осталось мест: " + "${maxPassengers - counter}"
            binding.textView.setTextColor(Color.parseColor("#0000FF"))
            binding.seats.text = counter.toString()
        }

        if (counter >= maxPassengers) {
            binding.resetButton.visibility = View.VISIBLE
            binding.textView.text = binding.textView.context.getText(R.string.red_text)
            binding.textView.setTextColor(Color.parseColor("#FF0000"))
            binding.seats.text = counter.toString()
        }
    }
}

So the question is how can i use binding outside MainActivity in sealed class


问:
Return date after each month cut off date in Presto SQL
I have encountered this situation where I need to return a specific date for each cut off automatically. The cut off will be 5 days before each month.

Desire output :

Start from Jan 1, the calculation of transaction will be between 2023-01-01 and 2023-01-26
eg. from this period there are 100 transactions from 10 users.

Then the date will automatically start again between 2023-01-27 and 2023-02-23
eg. from this period there are 200 transactions from 20 users.
and so on..

So, basically the data will returns on each cut off

Any help would be appreciated!


问:
Angular Routing Problem with Fuse admin and user
I have problem with navigating route for admin and user only ( have limitation than admin )

const routes: Route[] = [
    {path: '', pathMatch : 'full', redirectTo: 'home'},

    {path: 'signed-in-redirect', pathMatch: 'full', redirectTo: 'admin/dashboard'},
    {path: 'admin-signed-in-redirect', pathMatch: 'full', redirectTo: 'admin/dashboard'},
    {path: 'user-signed-in-redirect', pathMatch: 'full', redirectTo: 'user/dashboard'},
    {
        path: '',
        component  : LayoutComponent,
        data: {
            layout: 'empty'
        },
        children   : [
            {path: '', loadChildren: () => import('app/modules/landing/home/home.module').then(m => m.LandingHomeModule)},
        ]
    },

];

if (environment.allowSignUp) {
    routes.push(
        {
            path: '',
            canActivate: [NoAuthGuard],
            canActivateChild: [NoAuthGuard],
            component: LayoutComponent,
            data: {
                layout: 'empty'
            },
            children: [
                {path: 'confirmation-required', loadChildren: () => import('app/modules/auth/confirmation-required/confirmation-required.module').then(m => m.AuthConfirmationRequiredModule)},
                {path: 'forgot-password', loadChildren: () => import('app/modules/auth/forgot-password/forgot-password.module').then(m => m.AuthForgotPasswordModule)},
                {path: 'reset-password', loadChildren: () => import('app/modules/auth/reset-password/reset-password.module').then(m => m.AuthResetPasswordModule)},
                {path: 'sign-in', loadChildren: () => import('app/modules/auth/sign-in/sign-in.module').then(m => m.AuthSignInModule)},
                {path: 'sign-in-transition', loadChildren: () => import('app/modules/auth/sign-in-transition/sign-in-transition.module').then(m => m.AuthSignInTransitionModule)},
                {path: 'sign-up', loadChildren: () => import('app/modules/auth/sign-up/sign-up.module').then(m => m.AuthSignUpModule)},
                {path: 'sign-up-confirmation', loadChildren: () => import('app/modules/auth/sign-up-confirmation/sign-up-confirmation.module').then(m => m.AuthSignUpConfirmationModule)},
            ]
        }
    );
}
else {
    routes.push(
        {
            path: '',
            canActivate: [NoAuthGuard],
            canActivateChild: [NoAuthGuard],
            component: LayoutComponent,
            data: {
                layout: 'empty'
            },
            children: [
                {path: 'confirmation-required', loadChildren: () => import('app/modules/auth/confirmation-required/confirmation-required.module').then(m => m.AuthConfirmationRequiredModule)},
                {path: 'forgot-password', loadChildren: () => import('app/modules/auth/forgot-password/forgot-password.module').then(m => m.AuthForgotPasswordModule)},
                {path: 'reset-password', loadChildren: () => import('app/modules/auth/reset-password/reset-password.module').then(m => m.AuthResetPasswordModule)},
                {path: 'sign-in', loadChildren: () => import('app/modules/auth/sign-in/sign-in.module').then(m => m.AuthSignInModule)},
                {path: 'sign-in-transition', loadChildren: () => import('app/modules/auth/sign-in-transition/sign-in-transition.module').then(m => m.AuthSignInTransitionModule)},
            ]
        }
    );
}

routes.push(
    {
        path: 'admin',
        canActivate: [AuthGuard],
        canActivateChild: [AuthGuard],
        component: LayoutComponent,
        data: {
            layout: 'empty'
        },
        children: [
            {path: 'admin/dashboard', loadChildren: () => import('app/modules/admin/dashboards/analytics/analytics.module').then(m => m.AnalyticsModule)},
            {path: 'user/dashboard', loadChildren: () => import('app/modules/user/dashboard/user-analytics.module').then(m => m.UserAnalyticsModule)},
            {path: 'solarmanagement/:id', loadChildren: () => import('app/modules/admin/pages/userassigned/userassigned.module').then(m => m.UserassignedModule)},
            {path: 'settings', loadChildren: () => import('app/modules/admin/pages/settings/settings.module').then(m => m.SettingsModule)},
            {path: 'user/settings', loadChildren: () => import('app/modules/dashboards/pages/settings/settingsuser.module').then(m => m.SettingsUserModule)},
            {path: 'usergroup', loadChildren: () => import('app/modules/admin/pages/usergroup/usergroup.module').then(m => m.UsergroupModule)},
            {path: 'solarmanagement', loadChildren: () => import('app/modules/admin/pages/solarmanagement/solarmanagement.module').then(m => m.SolarmanagementModule)},
            {path: '404-not-found', pathMatch: 'full', loadChildren: () => import('app/modules/admin/pages/error/error-404/error-404.module').then(m => m.Error404Module)},
            {path: '**', redirectTo: '404-not-found'},
            {path: 'sign-out', loadChildren: () => import('app/modules/auth/sign-out/sign-out.module').then(m => m.AuthSignOutModule)},
            {path: 'unlock-session', loadChildren: () => import('app/modules/auth/unlock-session/unlock-session.module').then(m => m.AuthUnlockSessionModule)}
        ]
    },
    {
        path: '',
        component  : LayoutComponent,
        data: {
            layout: 'empty'
        },
        children   : [
            {path: 'home', loadChildren: () => import('app/modules/landing/home/home.module').then(m => m.LandingHomeModule)},
            {path: 'sign-out', loadChildren: () => import('app/modules/auth/sign-out/sign-out.module').then(m => m.AuthSignOutModule)},
            {path: 'unlock-session', loadChildren: () => import('app/modules/auth/unlock-session/unlock-session.module').then(m => m.AuthUnlockSessionModule)},
            {path: 'confirmation-required', loadChildren: () => import('app/modules/auth/confirmation-required/confirmation-required.module').then(m => m.AuthConfirmationRequiredModule)},
                {path: 'forgot-password', loadChildren: () => import('app/modules/auth/forgot-password/forgot-password.module').then(m => m.AuthForgotPasswordModule)},
                {path: 'reset-password', loadChildren: () => import('app/modules/auth/reset-password/reset-password.module').then(m => m.AuthResetPasswordModule)},
                {path: 'sign-in', loadChildren: () => import('app/modules/auth/sign-in/sign-in.module').then(m => m.AuthSignInModule)},
                {path: 'sign-in-transition', loadChildren: () => import('app/modules/auth/sign-in-transition/sign-in-transition.module').then(m => m.AuthSignInTransitionModule)},
        ]
    },

    {
        path       : 'user',
        canActivate: [AuthGuard],
        canActivateChild: [AuthGuard],
        component  : LayoutComponent,
        resolve    : {
            initialData: InitialDataResolver,
        },
        children   : [

            {path: 'user/dashboard', loadChildren: () => import('app/modules/user/dashboard/user-analytics.module').then(m => m.UserAnalyticsModule)},
            {path: 'solarmanagement/:id', loadChildren: () => import('app/modules/admin/pages/userassigned/userassigned.module').then(m => m.UserassignedModule)},
            {path: 'settings', loadChildren: () => import('app/modules/admin/pages/settings/settings.module').then(m => m.SettingsModule)},
            {path: 'user/settings', loadChildren: () => import('app/modules/dashboards/pages/settings/settingsuser.module').then(m => m.SettingsUserModule)},
            {path: 'usergroup', loadChildren: () => import('app/modules/admin/pages/usergroup/usergroup.module').then(m => m.UsergroupModule)},
            {path: 'solarmanagement', loadChildren: () => import('app/modules/admin/pages/solarmanagement/solarmanagement.module').then(m => m.SolarmanagementModule)},
            {path: '404-not-found', pathMatch: 'full', loadChildren: () => import('app/modules/admin/pages/error/error-404/error-404.module').then(m => m.Error404Module)},
            {path: '**', redirectTo: '404-not-found'},

        ]
    }
)```

how to routing the right way to put admin only placement and user only placement. All I do when login is going to user and not even admin got the placement. When login admin must be admin routing and if user login must be user routing only.

Body:
I have problem with navigating route for admin and user only ( have limitation than admin )

const routes: Route[] = [
    {path: '', pathMatch : 'full', redirectTo: 'home'},

    {path: 'signed-in-redirect', pathMatch: 'full', redirectTo: 'admin/dashboard'},
    {path: 'admin-signed-in-redirect', pathMatch: 'full', redirectTo: 'admin/dashboard'},
    {path: 'user-signed-in-redirect', pathMatch: 'full', redirectTo: 'user/dashboard'},
    {
        path: '',
        component  : LayoutComponent,
        data: {
            layout: 'empty'
        },
        children   : [
            {path: '', loadChildren: () => import('app/modules/landing/home/home.module').then(m => m.LandingHomeModule)},
        ]
    },

];

if (environment.allowSignUp) {
    routes.push(
        {
            path: '',
            canActivate: [NoAuthGuard],
            canActivateChild: [NoAuthGuard],
            component: LayoutComponent,
            data: {
                layout: 'empty'
            },
            children: [
                {path: 'confirmation-required', loadChildren: () => import('app/modules/auth/confirmation-required/confirmation-required.module').then(m => m.AuthConfirmationRequiredModule)},
                {path: 'forgot-password', loadChildren: () => import('app/modules/auth/forgot-password/forgot-password.module').then(m => m.AuthForgotPasswordModule)},
                {path: 'reset-password', loadChildren: () => import('app/modules/auth/reset-password/reset-password.module').then(m => m.AuthResetPasswordModule)},
                {path: 'sign-in', loadChildren: () => import('app/modules/auth/sign-in/sign-in.module').then(m => m.AuthSignInModule)},
                {path: 'sign-in-transition', loadChildren: () => import('app/modules/auth/sign-in-transition/sign-in-transition.module').then(m => m.AuthSignInTransitionModule)},
                {path: 'sign-up', loadChildren: () => import('app/modules/auth/sign-up/sign-up.module').then(m => m.AuthSignUpModule)},
                {path: 'sign-up-confirmation', loadChildren: () => import('app/modules/auth/sign-up-confirmation/sign-up-confirmation.module').then(m => m.AuthSignUpConfirmationModule)},
            ]
        }
    );
}
else {
    routes.push(
        {
            path: '',
            canActivate: [NoAuthGuard],
            canActivateChild: [NoAuthGuard],
            component: LayoutComponent,
            data: {
                layout: 'empty'
            },
            children: [
                {path: 'confirmation-required', loadChildren: () => import('app/modules/auth/confirmation-required/confirmation-required.module').then(m => m.AuthConfirmationRequiredModule)},
                {path: 'forgot-password', loadChildren: () => import('app/modules/auth/forgot-password/forgot-password.module').then(m => m.AuthForgotPasswordModule)},
                {path: 'reset-password', loadChildren: () => import('app/modules/auth/reset-password/reset-password.module').then(m => m.AuthResetPasswordModule)},
                {path: 'sign-in', loadChildren: () => import('app/modules/auth/sign-in/sign-in.module').then(m => m.AuthSignInModule)},
                {path: 'sign-in-transition', loadChildren: () => import('app/modules/auth/sign-in-transition/sign-in-transition.module').then(m => m.AuthSignInTransitionModule)},
            ]
        }
    );
}

routes.push(
    {
        path: 'admin',
        canActivate: [AuthGuard],
        canActivateChild: [AuthGuard],
        component: LayoutComponent,
        data: {
            layout: 'empty'
        },
        children: [
            {path: 'admin/dashboard', loadChildren: () => import('app/modules/admin/dashboards/analytics/analytics.module').then(m => m.AnalyticsModule)},
            {path: 'user/dashboard', loadChildren: () => import('app/modules/user/dashboard/user-analytics.module').then(m => m.UserAnalyticsModule)},
            {path: 'solarmanagement/:id', loadChildren: () => import('app/modules/admin/pages/userassigned/userassigned.module').then(m => m.UserassignedModule)},
            {path: 'settings', loadChildren: () => import('app/modules/admin/pages/settings/settings.module').then(m => m.SettingsModule)},
            {path: 'user/settings', loadChildren: () => import('app/modules/dashboards/pages/settings/settingsuser.module').then(m => m.SettingsUserModule)},
            {path: 'usergroup', loadChildren: () => import('app/modules/admin/pages/usergroup/usergroup.module').then(m => m.UsergroupModule)},
            {path: 'solarmanagement', loadChildren: () => import('app/modules/admin/pages/solarmanagement/solarmanagement.module').then(m => m.SolarmanagementModule)},
            {path: '404-not-found', pathMatch: 'full', loadChildren: () => import('app/modules/admin/pages/error/error-404/error-404.module').then(m => m.Error404Module)},
            {path: '**', redirectTo: '404-not-found'},
            {path: 'sign-out', loadChildren: () => import('app/modules/auth/sign-out/sign-out.module').then(m => m.AuthSignOutModule)},
            {path: 'unlock-session', loadChildren: () => import('app/modules/auth/unlock-session/unlock-session.module').then(m => m.AuthUnlockSessionModule)}
        ]
    },
    {
        path: '',
        component  : LayoutComponent,
        data: {
            layout: 'empty'
        },
        children   : [
            {path: 'home', loadChildren: () => import('app/modules/landing/home/home.module').then(m => m.LandingHomeModule)},
            {path: 'sign-out', loadChildren: () => import('app/modules/auth/sign-out/sign-out.module').then(m => m.AuthSignOutModule)},
            {path: 'unlock-session', loadChildren: () => import('app/modules/auth/unlock-session/unlock-session.module').then(m => m.AuthUnlockSessionModule)},
            {path: 'confirmation-required', loadChildren: () => import('app/modules/auth/confirmation-required/confirmation-required.module').then(m => m.AuthConfirmationRequiredModule)},
                {path: 'forgot-password', loadChildren: () => import('app/modules/auth/forgot-password/forgot-password.module').then(m => m.AuthForgotPasswordModule)},
                {path: 'reset-password', loadChildren: () => import('app/modules/auth/reset-password/reset-password.module').then(m => m.AuthResetPasswordModule)},
                {path: 'sign-in', loadChildren: () => import('app/modules/auth/sign-in/sign-in.module').then(m => m.AuthSignInModule)},
                {path: 'sign-in-transition', loadChildren: () => import('app/modules/auth/sign-in-transition/sign-in-transition.module').then(m => m.AuthSignInTransitionModule)},
        ]
    },

    {
        path       : 'user',
        canActivate: [AuthGuard],
        canActivateChild: [AuthGuard],
        component  : LayoutComponent,
        resolve    : {
            initialData: InitialDataResolver,
        },
        children   : [

            {path: 'user/dashboard', loadChildren: () => import('app/modules/user/dashboard/user-analytics.module').then(m => m.UserAnalyticsModule)},
            {path: 'solarmanagement/:id', loadChildren: () => import('app/modules/admin/pages/userassigned/userassigned.module').then(m => m.UserassignedModule)},
            {path: 'settings', loadChildren: () => import('app/modules/admin/pages/settings/settings.module').then(m => m.SettingsModule)},
            {path: 'user/settings', loadChildren: () => import('app/modules/dashboards/pages/settings/settingsuser.module').then(m => m.SettingsUserModule)},
            {path: 'usergroup', loadChildren: () => import('app/modules/admin/pages/usergroup/usergroup.module').then(m => m.UsergroupModule)},
            {path: 'solarmanagement', loadChildren: () => import('app/modules/admin/pages/solarmanagement/solarmanagement.module').then(m => m.SolarmanagementModule)},
            {path: '404-not-found', pathMatch: 'full', loadChildren: () => import('app/modules/admin/pages/error/error-404/error-404.module').then(m => m.Error404Module)},
            {path: '**', redirectTo: '404-not-found'},

        ]
    }
)

how to routing the right way to put admin only placement and user only placement. All I do when login is going to user and not even admin got the placement. When login admin must be admin routing and if user login must be user routing only.


问:
Puppet facter - How to fix Error: Could not retrieve fact='os', resolution='<anonymous>'
On my windows server machine, just facter command gives the following error-

```<code>[stdout][0;36mDebug: Loading facts from C:/ProgramData/.../facter/windows_version.rb[0m
[stderr]Could not retrieve fact='os', resolution='<anonymous>': failed to parse display name of moniker `winmgmts:{impersonationLevel=impersonate}!//./root/cimv2'
[stderr] HRESULT error code:0x80010114
[stderr] The requested object does not exist.
[stderr]Could not retrieve fact='os', resolution='<anonymous>': failed to parse display name of moniker `winmgmts:{impersonationLevel=impersonate}!//./root/cimv2'
[stderr] HRESULT error code:0x80010114
[stderr] The requested object does not exist.
[stderr]Could not retrieve fact='os', resolution='<anonymous>': failed to parse display name of moniker `winmgmts:{impersonationLevel=impersonate}!//./root/cimv2'
[stderr] HRESULT error code:0x80010114
[stderr] The requested object does not exist.
[stderr]Could not retrieve fact='virtual', resolution='<anonymous>': failed to parse display name of moniker `winmgmts:{impersonationLevel=impersonate}!//./root/cimv2'
[stderr] HRESULT error code:0x80010108
</code>```

This is happening suddenly, 2 weeks ago it was working fine.

Any idea how to fix this and what is causing these errors? Due to this, some Ruby scripts are failing.

Body:
On my windows server machine, just facter command gives the following error-

[stdout][0;36mDebug: Loading facts from C:/ProgramData/.../facter/windows_version.rb[0m
[stderr]Could not retrieve fact='os', resolution='<anonymous>': failed to parse display name of moniker `winmgmts:{impersonationLevel=impersonate}!//./root/cimv2'
[stderr] HRESULT error code:0x80010114
[stderr] The requested object does not exist.
[stderr]Could not retrieve fact='os', resolution='<anonymous>': failed to parse display name of moniker `winmgmts:{impersonationLevel=impersonate}!//./root/cimv2'
[stderr] HRESULT error code:0x80010114
[stderr] The requested object does not exist.
[stderr]Could not retrieve fact='os', resolution='<anonymous>': failed to parse display name of moniker `winmgmts:{impersonationLevel=impersonate}!//./root/cimv2'
[stderr] HRESULT error code:0x80010114
[stderr] The requested object does not exist.
[stderr]Could not retrieve fact='virtual', resolution='<anonymous>': failed to parse display name of moniker `winmgmts:{impersonationLevel=impersonate}!//./root/cimv2'
[stderr] HRESULT error code:0x80010108

This is happening suddenly, 2 weeks ago it was working fine.

Any idea how to fix this and what is causing these errors? Due to this, some Ruby scripts are failing.


问:
Early stopping in XGBoost classification and RandomizedSearchCV
When I try to combine RandomSearch with the early stopping method to reduce the overfitting, I get this error:

py:372: FitFailedWarning:
300 fits failed out of a total of 300.
The score on these train-test partitions for these parameters will be set to nan.
If these failures are not expected, you can try to debug them by setting error_score='raise'.

The code I am trying is like this:

```<code>params_dist = {'min_child_weight': [0.1, 1, 5, 10, 50],
              'colsample_bytree': np.arange(0.5, 1.0, 0.1),
              'gamma': [0.5, 1, 1.5, 2, 5],
              'subsample': np.arange(0.5, 1.0, 0.1),
              'max_depth': range(3, 21, 3),
              'learning_rate': [0.0001,0.001, 0.01, 0.1, 0.2, 0.3, 0.4, 0.5, 1],
              'n_estimators': [50, 100, 250, 500, 750, 1000],
              'reg_alpha': [0.0001, 0.001, 0.1, 1],
              'reg_lambda': [0.0001, 0.001, 0.1, 1]}
 model_with_earlyStopping = xgb.XGBClassifier(objective='binary:logistic',
                                              eval_metric="error",
                                               early_stopping_rounds=13,
                                                seed=42)
random_search = model_selection.RandomizedSearchCV(model_with_earlyStopping,
                                                       param_distributions=params_dist,
                                                       scoring='roc_auc',
                                                       n_jobs=-1,
                                                       verbose=0,
                                                       cv=3,
                                                       random_state=1001,
                                                       n_iter=100)
</code>```

The code worked fine without using early stopping. However, I am looking for a way to combine these 2 methods together.

Can anyone help me fix it?

Body:
When I try to combine RandomSearch with the early stopping method to reduce the overfitting, I get this error:

py:372: FitFailedWarning:
300 fits failed out of a total of 300.
The score on these train-test partitions for these parameters will be set to nan.
If these failures are not expected, you can try to debug them by setting error_score='raise'.

The code I am trying is like this:

params_dist = {'min_child_weight': [0.1, 1, 5, 10, 50],
              'colsample_bytree': np.arange(0.5, 1.0, 0.1),
              'gamma': [0.5, 1, 1.5, 2, 5],
              'subsample': np.arange(0.5, 1.0, 0.1),
              'max_depth': range(3, 21, 3),
              'learning_rate': [0.0001,0.001, 0.01, 0.1, 0.2, 0.3, 0.4, 0.5, 1],
              'n_estimators': [50, 100, 250, 500, 750, 1000],
              'reg_alpha': [0.0001, 0.001, 0.1, 1],
              'reg_lambda': [0.0001, 0.001, 0.1, 1]}
 model_with_earlyStopping = xgb.XGBClassifier(objective='binary:logistic',
                                              eval_metric="error",
                                               early_stopping_rounds=13,
                                                seed=42)
random_search = model_selection.RandomizedSearchCV(model_with_earlyStopping,
                                                       param_distributions=params_dist,
                                                       scoring='roc_auc',
                                                       n_jobs=-1,
                                                       verbose=0,
                                                       cv=3,
                                                       random_state=1001,
                                                       n_iter=100)

The code worked fine without using early stopping. However, I am looking for a way to combine these 2 methods together.

Can anyone help me fix it?


问:
Typescript and Firebase error with type { id: string}[]
I have problem with trying to get a document based on document field value. So I have created a function that takes one argument that should be the same as field value, and based on that argument I'm trying to map through docs and find desired doc. And that all works as it is, but problem is that Typescript is screaming at me

Property 'wordText' does not exist on type '{ id: string; }'

Here is my code

```<code>const findDoc = async (wordName: string) => {
  const data = await getDocs(wordsCollectionRef);
  return data.docs.map(doc => ({...doc.data(), id: doc.id})).find(word => word.wordText === wordName)
}
</code>```

I have no idea how to fix this, if you have any ideas please share it with me.

Body:
I have problem with trying to get a document based on document field value. So I have created a function that takes one argument that should be the same as field value, and based on that argument I'm trying to map through docs and find desired doc. And that all works as it is, but problem is that Typescript is screaming at me

Property 'wordText' does not exist on type '{ id: string; }'

Here is my code

const findDoc = async (wordName: string) => {
  const data = await getDocs(wordsCollectionRef);
  return data.docs.map(doc => ({...doc.data(), id: doc.id})).find(word => word.wordText === wordName)
}

I have no idea how to fix this, if you have any ideas please share it with me.


问:
NGRX Unit Test 'overrideSelector' Not Working

Help Determining Why the overrideSelector() Method isn't Happening in Time

Ok, it appears like a timing issue, but I can't understand why this is happening.

I have an Effect that relies on a variable populated by a selector from my store. Here's my constructor for my Effects class:

constructor(
    private actions$: Actions,
    private nifiService: NifiService,
    private store: Store<NiFiState>
  ) {
    this.store.pipe(select(selectProcessingGroupTransformProcessor))
    .subscribe((p) => {this.transformProcessor = <GenericProcessor>p});
  }
```
<p>The Selector looks like this:</p>
<h4>Selector</h4>
```export const selectProcessingGroupTransformProcessor = createSelector(
  nifiState,
  (state: NiFiState) => state.processing.processors?.filter(p => p.component.type === environment.COT_TRANSFORM_PROCESSOR_TYPE)[0]
)
```
<h4>Effect</h4>
<pre class="lang-js prettyprint-override"><code>startTransformProcessor$ = createEffect(() =>
    this.actions$.pipe(
      ofType(
        ProcessingTransformActions.handleProcessingUpdateTransformSuccess
      ),
      mergeMap((action) =>{
        console.log('TRANSFORM PROC', this.transformProcessor)
        return this.nifiService
          .setProcessorState(this.transformProcessor.id, 'RUNNING')
          .pipe(
            map((resp) =>
              ProcessingTransformActions.handleStartTransformProcessorSuccess({
                processor: resp,
                gType: 'processing',
              })
            ),
            catchError((error) =>
              of(
                ProcessingTransformActions.handleStartTransformProcessorFailure(
                  { error }
                )
              )
            )
          )}
      )
    )
  );
</code>```

Test that's failing:

Test

it('[startTransformProcessor$] - handleProcessingUpdateTransformSuccess', () => {
        const action = handleProcessingUpdateTransformSuccess({ processor });
        const outcome = handleStartTransformProcessorSuccess({
          processor,
          gType: 'processing',
        });

        store.overrideSelector(
          selectProcessingGroupTransformProcessor,
          processor
        );
        store.refreshState();

        testScheduler.run(({ hot, cold, expectObservable }) => {
          actions$ = hot('-a', { a: action });
          const response = cold('-b|', { b: processor });
          spyObj = jest
            .spyOn(service, 'setProcessorState')
            .mockReturnValue(response);

          expectObservable(effects.startTransformProcessor$).toBe('--b', {
            b: outcome,
          });
        });
      });
```
<p>I have another test evaluates the 'fail' condition as well immediately after the one above. Here's what I'm seeing:</p>
<p>When the first test runs, the <code>console.log()</code> in the Effect statement outputs <code>undefined</code>. After that, the test evaluating the 'fail/catchError' condition runs and the logging statement outputs the mocked selector. Additonally, I did have a <code>console.log()</code> statement inside the</p>
<pre class="lang-js prettyprint-override"><code>this.store.pipe(select(selectProcessingGroupTransformProcessor))
.subscribe((p) => {this.transformProcessor = <GenericProcessor>p});
</code>```

where the variable is actually set and noticed that the logging line from the Effect being tested was output before the one in the store selector inside the class constructor.

Console Logging Output Order

```<code>console.log
    TRANSFORM PROC undefined

  console.log
    p {
      id: 'proc1',
      component: {
        id: 'proc1',
        config: { properties: [Object] },
        type: 'CoTtoNFFIProcessor'
      }
    }

  console.log
    p {
      id: 'proc1',
      component: {
        id: 'proc1',
        config: { properties: [Object] },
        type: 'CoTtoNFFIProcessor'
      }
    }

  console.log
    TRANSFORM PROC {
      id: 'proc1',
      component: {
        id: 'proc1',
        config: { properties: [Object] },
        type: 'CoTtoNFFIProcessor'
      }
    }
</code>```

I have tried moving the overrideSelector() statement into a beforeEach(), but I get the same result. I'm using this same sort of functionality in another test suite without issue.

Any thoughts?

Body:
Help Determining Why the overrideSelector() Method isn't Happening in Time

Ok, it appears like a timing issue, but I can't understand why this is happening.

I have an Effect that relies on a variable populated by a selector from my store. Here's my constructor for my Effects class:

constructor(
    private actions$: Actions,
    private nifiService: NifiService,
    private store: Store<NiFiState>
  ) {
    this.store.pipe(select(selectProcessingGroupTransformProcessor))
    .subscribe((p) => {this.transformProcessor = <GenericProcessor>p});
  }

The Selector looks like this:

Selector

export const selectProcessingGroupTransformProcessor = createSelector(
  nifiState,
  (state: NiFiState) => state.processing.processors?.filter(p => p.component.type === environment.COT_TRANSFORM_PROCESSOR_TYPE)[0]
)

Effect

startTransformProcessor$ = createEffect(() =>
    this.actions$.pipe(
      ofType(
        ProcessingTransformActions.handleProcessingUpdateTransformSuccess
      ),
      mergeMap((action) =>{
        console.log('TRANSFORM PROC', this.transformProcessor)
        return this.nifiService
          .setProcessorState(this.transformProcessor.id, 'RUNNING')
          .pipe(
            map((resp) =>
              ProcessingTransformActions.handleStartTransformProcessorSuccess({
                processor: resp,
                gType: 'processing',
              })
            ),
            catchError((error) =>
              of(
                ProcessingTransformActions.handleStartTransformProcessorFailure(
                  { error }
                )
              )
            )
          )}
      )
    )
  );

Test that's failing:

Test

it('[startTransformProcessor$] - handleProcessingUpdateTransformSuccess', () => {
        const action = handleProcessingUpdateTransformSuccess({ processor });
        const outcome = handleStartTransformProcessorSuccess({
          processor,
          gType: 'processing',
        });

        store.overrideSelector(
          selectProcessingGroupTransformProcessor,
          processor
        );
        store.refreshState();

        testScheduler.run(({ hot, cold, expectObservable }) => {
          actions$ = hot('-a', { a: action });
          const response = cold('-b|', { b: processor });
          spyObj = jest
            .spyOn(service, 'setProcessorState')
            .mockReturnValue(response);

          expectObservable(effects.startTransformProcessor$).toBe('--b', {
            b: outcome,
          });
        });
      });

I have another test evaluates the 'fail' condition as well immediately after the one above. Here's what I'm seeing:

When the first test runs, the console.log() in the Effect statement outputs undefined. After that, the test evaluating the 'fail/catchError' condition runs and the logging statement outputs the mocked selector. Additonally, I did have a console.log() statement inside the

this.store.pipe(select(selectProcessingGroupTransformProcessor))
.subscribe((p) => {this.transformProcessor = <GenericProcessor>p});

where the variable is actually set and noticed that the logging line from the Effect being tested was output before the one in the store selector inside the class constructor.

Console Logging Output Order

console.log
    TRANSFORM PROC undefined

  console.log
    p {
      id: 'proc1',
      component: {
        id: 'proc1',
        config: { properties: [Object] },
        type: 'CoTtoNFFIProcessor'
      }
    }

  console.log
    p {
      id: 'proc1',
      component: {
        id: 'proc1',
        config: { properties: [Object] },
        type: 'CoTtoNFFIProcessor'
      }
    }

  console.log
    TRANSFORM PROC {
      id: 'proc1',
      component: {
        id: 'proc1',
        config: { properties: [Object] },
        type: 'CoTtoNFFIProcessor'
      }
    }

I have tried moving the overrideSelector() statement into a beforeEach(), but I get the same result. I'm using this same sort of functionality in another test suite without issue.

Any thoughts?


问:
How to authenticate Firestore in ReactJS app when unit testing?
So I'm using ReactJS to build an app with Firestore as its backend. I want to run some tests and the tests passed but some error was logged when running all tests.

The error:

```<code>Attempted to log "[FirebaseError: 7 PERMISSION_DENIED: Missing or insufficient permissions.] {
      code: 'permission-denied',
      customData: undefined,
      toString: [Function (anonymous)]
    }".
</code>```

My question is that, are we authenticated when we run the tests? If we are not, how can I authenticate so that it can reads from the database? Because in the database, I have set up Firestore rules where if authenticated, then allow read.

If you need more information, feel free to comment below, as I'm pretty confused on how to approach this issue.

Body:
So I'm using ReactJS to build an app with Firestore as its backend. I want to run some tests and the tests passed but some error was logged when running all tests.

The error:

Attempted to log "[FirebaseError: 7 PERMISSION_DENIED: Missing or insufficient permissions.] {
      code: 'permission-denied',
      customData: undefined,
      toString: [Function (anonymous)]
    }".

My question is that, are we authenticated when we run the tests? If we are not, how can I authenticate so that it can reads from the database? Because in the database, I have set up Firestore rules where if authenticated, then allow read.

If you need more information, feel free to comment below, as I'm pretty confused on how to approach this issue.


问:
How can I send Boolean fields via Django send_mail
I am fairly new to Python and Django, I am trying to use the build in send_mail and having a few issues with the boolean fields I want to be included in the email that is sent, I have had no issues with the form being printed to the terminal for testing but as soon as I added the other fields that are on the form(b oolean fields) I am getting the following error (TypeError: sequence item 4: expected str instance, bool found), probably an easy fix but I am struggling to find anything on the web that will help.

I am not fussed is the boolean fields that are False are excluded on the email as this is not relevant, any help would be much appreciated.

I have managed to get the email side working when it comes to Firstname, Lastname, Email, Phone, but when adding the boolean fields I am getting an error.

Views.py

```<code>from django.shortcuts import render, redirect
from django.http import JsonResponse
from main.models import WFHSHEET
from django.http import HttpResponse, response, HttpResponseRedirect
from .forms import WFHLIST, RETURNLIST
from django.core.mail import send_mail, BadHeaderError

def home(response):
    return render(response, 'home.html', {})

def wfhsheet(request):
    if request.method == 'POST':
        form = WFHLIST(request.POST)
        if form.is_valid():
            subject = "WFH-Form"
            body = {
            'firstname': form.cleaned_data['firstname'],
            'lastname': form.cleaned_data['lastname'],
            'email': form.cleaned_data['email'],
                'phone' : form.cleaned_data['phone'],
                'PC_tower' : form.cleaned_data['PC_tower'],
                'Monitor' : form.cleaned_data['Monitor'],
                'Keyboard' : form.cleaned_data['Keyboard'],
                'Mice' : form.cleaned_data['Mice'],
                'PowerLeads' : form.cleaned_data['PowerLeads'],
                'VGA' : form.cleaned_data['VGA'],
                'DVI' : form.cleaned_data['DVI'],
                'DisplayPort' : form.cleaned_data['DisplayPort'],
                'Ethernet' : form.cleaned_data['Ethernet'],
                'Headset' : form.cleaned_data['Headset'],
                'Comments' : form.cleaned_data['Comments']
                    }
            message = "\n".join(body.values())

            try:
                send_mail(subject, message, 'admin@example.com', ['admin@example.com'])
            except BadHeaderError:
                return HttpResponse('Invalid header found.')
            return redirect ("form.html")

    form = WFHLIST()
    return render(request, "home.html", {'form':form})

def returnsheet(response):
    if response.method == "POST":
        form = RETURNLIST(response.POST)

        if form.is_valid():
            print('the form was valid')
            send_mail(
                'WFH Form',
                '{forms.Form}',
                'from@example.com',
                ['My@email'],
                fail_silently=False,
                )
            form.save()

        else:
            form = RETURNLIST()
        return render(response, "returnform.html", {"form":form})

def usefullinks(response):
    return render(response, 'usefullinks.html', {})

def usefulinfo(response):
    return render(response, 'usefulinfo.html', {})

</code>```

Forms.py

```<code>from django import forms
from django.forms import ModelForm
from .models import WFHSHEET, RETURNSHEET

class WFHLIST(ModelForm):
    firstname = forms.CharField(max_length=100, required=True)
    lastname = forms.CharField(max_length=100, required=True)
    email = forms.EmailField(max_length=150, required=True)
    phone = forms.CharField(max_length=13, required=True)
    PC_tower = forms.BooleanField(required=False)
    Monitor = forms.BooleanField(required=False)
    Keyboard = forms.BooleanField(required=False)
    Mice = forms.BooleanField(required=False)
    PowerLeads = forms.BooleanField(required=False)
    VGA = forms.BooleanField(required=False)
    DVI =  forms.BooleanField(required=False)
    DisplayPort =  forms.BooleanField(required=False)
    Ethernet =  forms.BooleanField(required=False)
    Headset =  forms.BooleanField(required=False)
    Comments =  forms.CharField(max_length=300, required=False)
    Complete = forms.BooleanField(widget = forms.HiddenInput(), required = False)
    class Meta:
        model = WFHSHEET
        fields = ['firstname', 'lastname', 'email', 'phone',
        'PC_tower', 'Monitor', 'Keyboard', 'Mice', 'PowerLeads',
         'VGA', 'DVI', 'DisplayPort', 'Ethernet', 'Headset', 'Comments', 'Complete']

class RETURNLIST(ModelForm):
    firstname = forms.CharField(max_length=100, required=True)
    lastname = forms.CharField(max_length=100, required=True)
    email = forms.EmailField(max_length=150, required=True)
    phone = forms.CharField(max_length=13, required=True)
    PC_tower = forms.BooleanField(required=False)
    Monitor = forms.BooleanField(required=False)
    Keyboard = forms.BooleanField(required=False)
    Mice = forms.BooleanField(required=False)
    PowerLeads = forms.BooleanField(required=False)
    VGA = forms.BooleanField(required=False)
    DVI =  forms.BooleanField(required=False)
    DisplayPort =  forms.BooleanField(required=False)
    Ethernet =  forms.BooleanField(required=False)
    Headset =  forms.BooleanField(required=False)
    ReturnDate =  forms.DateField(required=True)
    Complete = forms.BooleanField(widget = forms.HiddenInput(), required = False)
    class Meta:
        model = RETURNSHEET
        fields = ['firstname', 'lastname', 'email', 'phone',
        'PC_tower', 'Monitor', 'Keyboard', 'Mice', 'PowerLeads',
         'VGA', 'DVI', 'DisplayPort', 'Ethernet', 'Headset', 'ReturnDate', 'Complete']

</code>```

Models.py

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

# Create your models here.

class WFHSHEET(models.Model):
    firstname = models.CharField(max_length=100)
    lastname = models.CharField(max_length=100)
    email = models.EmailField()
    phone = models.CharField(max_length=100)
    PC_tower = models.BooleanField()
    Monitor = models.BooleanField()
    Keyboard = models.BooleanField()
    Mice = models.BooleanField()
    PowerLeads = models.BooleanField()
    VGA = models.BooleanField()
    DVI =  models.BooleanField()
    DisplayPort =  models.BooleanField()
    Ethernet =  models.BooleanField()
    Headset =  models.BooleanField()
    Comments =  models.CharField(max_length=300)
    Complete = models.BooleanField()
    def __str__(self):
        return self.firstname

class RETURNSHEET(models.Model):
    firstname = models.CharField(max_length=100)
    lastname = models.CharField(max_length=100)
    email = models.EmailField()
    phone = models.CharField(max_length=100)
    PC_tower = models.BooleanField()
    Monitor = models.BooleanField()
    Keyboard = models.BooleanField()
    Mice = models.BooleanField()
    PowerLeads = models.BooleanField()
    VGA = models.BooleanField()
    DVI =  models.BooleanField()
    DisplayPort =  models.BooleanField()
    Ethernet =  models.BooleanField()
    Headset =  models.BooleanField()
    ReturnDate =  models.DateField()
    Complete = models.BooleanField()
    def __str__(self):
        return self.firstname

</code>```

Settings.py

```<code>EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'
</code>```

Body:
I am fairly new to Python and Django, I am trying to use the build in send_mail and having a few issues with the boolean fields I want to be included in the email that is sent, I have had no issues with the form being printed to the terminal for testing but as soon as I added the other fields that are on the form(b oolean fields) I am getting the following error (TypeError: sequence item 4: expected str instance, bool found), probably an easy fix but I am struggling to find anything on the web that will help.

I am not fussed is the boolean fields that are False are excluded on the email as this is not relevant, any help would be much appreciated.

I have managed to get the email side working when it comes to Firstname, Lastname, Email, Phone, but when adding the boolean fields I am getting an error.

Views.py

from django.shortcuts import render, redirect
from django.http import JsonResponse
from main.models import WFHSHEET
from django.http import HttpResponse, response, HttpResponseRedirect
from .forms import WFHLIST, RETURNLIST
from django.core.mail import send_mail, BadHeaderError

def home(response):
    return render(response, 'home.html', {})

def wfhsheet(request):
    if request.method == 'POST':
        form = WFHLIST(request.POST)
        if form.is_valid():
            subject = "WFH-Form"
            body = {
            'firstname': form.cleaned_data['firstname'],
            'lastname': form.cleaned_data['lastname'],
            'email': form.cleaned_data['email'],
                'phone' : form.cleaned_data['phone'],
                'PC_tower' : form.cleaned_data['PC_tower'],
                'Monitor' : form.cleaned_data['Monitor'],
                'Keyboard' : form.cleaned_data['Keyboard'],
                'Mice' : form.cleaned_data['Mice'],
                'PowerLeads' : form.cleaned_data['PowerLeads'],
                'VGA' : form.cleaned_data['VGA'],
                'DVI' : form.cleaned_data['DVI'],
                'DisplayPort' : form.cleaned_data['DisplayPort'],
                'Ethernet' : form.cleaned_data['Ethernet'],
                'Headset' : form.cleaned_data['Headset'],
                'Comments' : form.cleaned_data['Comments']
                    }
            message = "\n".join(body.values())

            try:
                send_mail(subject, message, 'admin@example.com', ['admin@example.com'])
            except BadHeaderError:
                return HttpResponse('Invalid header found.')
            return redirect ("form.html")

    form = WFHLIST()
    return render(request, "home.html", {'form':form})

def returnsheet(response):
    if response.method == "POST":
        form = RETURNLIST(response.POST)

        if form.is_valid():
            print('the form was valid')
            send_mail(
                'WFH Form',
                '{forms.Form}',
                'from@example.com',
                ['My@email'],
                fail_silently=False,
                )
            form.save()

        else:
            form = RETURNLIST()
        return render(response, "returnform.html", {"form":form})

def usefullinks(response):
    return render(response, 'usefullinks.html', {})

def usefulinfo(response):
    return render(response, 'usefulinfo.html', {})

Forms.py

from django import forms
from django.forms import ModelForm
from .models import WFHSHEET, RETURNSHEET

class WFHLIST(ModelForm):
    firstname = forms.CharField(max_length=100, required=True)
    lastname = forms.CharField(max_length=100, required=True)
    email = forms.EmailField(max_length=150, required=True)
    phone = forms.CharField(max_length=13, required=True)
    PC_tower = forms.BooleanField(required=False)
    Monitor = forms.BooleanField(required=False)
    Keyboard = forms.BooleanField(required=False)
    Mice = forms.BooleanField(required=False)
    PowerLeads = forms.BooleanField(required=False)
    VGA = forms.BooleanField(required=False)
    DVI =  forms.BooleanField(required=False)
    DisplayPort =  forms.BooleanField(required=False)
    Ethernet =  forms.BooleanField(required=False)
    Headset =  forms.BooleanField(required=False)
    Comments =  forms.CharField(max_length=300, required=False)
    Complete = forms.BooleanField(widget = forms.HiddenInput(), required = False)
    class Meta:
        model = WFHSHEET
        fields = ['firstname', 'lastname', 'email', 'phone',
        'PC_tower', 'Monitor', 'Keyboard', 'Mice', 'PowerLeads',
         'VGA', 'DVI', 'DisplayPort', 'Ethernet', 'Headset', 'Comments', 'Complete']

class RETURNLIST(ModelForm):
    firstname = forms.CharField(max_length=100, required=True)
    lastname = forms.CharField(max_length=100, required=True)
    email = forms.EmailField(max_length=150, required=True)
    phone = forms.CharField(max_length=13, required=True)
    PC_tower = forms.BooleanField(required=False)
    Monitor = forms.BooleanField(required=False)
    Keyboard = forms.BooleanField(required=False)
    Mice = forms.BooleanField(required=False)
    PowerLeads = forms.BooleanField(required=False)
    VGA = forms.BooleanField(required=False)
    DVI =  forms.BooleanField(required=False)
    DisplayPort =  forms.BooleanField(required=False)
    Ethernet =  forms.BooleanField(required=False)
    Headset =  forms.BooleanField(required=False)
    ReturnDate =  forms.DateField(required=True)
    Complete = forms.BooleanField(widget = forms.HiddenInput(), required = False)
    class Meta:
        model = RETURNSHEET
        fields = ['firstname', 'lastname', 'email', 'phone',
        'PC_tower', 'Monitor', 'Keyboard', 'Mice', 'PowerLeads',
         'VGA', 'DVI', 'DisplayPort', 'Ethernet', 'Headset', 'ReturnDate', 'Complete']

Models.py

from django.db import models
from django import forms

# Create your models here.

class WFHSHEET(models.Model):
    firstname = models.CharField(max_length=100)
    lastname = models.CharField(max_length=100)
    email = models.EmailField()
    phone = models.CharField(max_length=100)
    PC_tower = models.BooleanField()
    Monitor = models.BooleanField()
    Keyboard = models.BooleanField()
    Mice = models.BooleanField()
    PowerLeads = models.BooleanField()
    VGA = models.BooleanField()
    DVI =  models.BooleanField()
    DisplayPort =  models.BooleanField()
    Ethernet =  models.BooleanField()
    Headset =  models.BooleanField()
    Comments =  models.CharField(max_length=300)
    Complete = models.BooleanField()
    def __str__(self):
        return self.firstname

class RETURNSHEET(models.Model):
    firstname = models.CharField(max_length=100)
    lastname = models.CharField(max_length=100)
    email = models.EmailField()
    phone = models.CharField(max_length=100)
    PC_tower = models.BooleanField()
    Monitor = models.BooleanField()
    Keyboard = models.BooleanField()
    Mice = models.BooleanField()
    PowerLeads = models.BooleanField()
    VGA = models.BooleanField()
    DVI =  models.BooleanField()
    DisplayPort =  models.BooleanField()
    Ethernet =  models.BooleanField()
    Headset =  models.BooleanField()
    ReturnDate =  models.DateField()
    Complete = models.BooleanField()
    def __str__(self):
        return self.firstname

Settings.py

EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend'


问:
Invalid azure URL or Personal Access Token in SonarQube
enter image description hereI am using SonarQube 8.9 LTS community edition, while configuring the azure devops server withSonarQube it is throwing error as invalid azure URL or PAT, I had tried multiple PAT's with defferent pat permissions.
The

Invalid azure URL or Personal Access Token in SonarQube


问:
Disable Firefox's "Search for text when I start typing" option via CSS or JS
Firefox has a features which allows the user to search the page directly by just pressing a letter on the keyboard, without the need to press Ctrl + F beforehand, which is enabled by default. This does not happen if a text field or something similar is in focus.

I am currently working on a Worlde clone using Vue3. The game offers a virtual keyboard but also allows input via keys. The goal is to find 5 letter long word within 6 tries. To help the player it indicates containing letters (green if on the right position, yellow if not). When using the physical keyboard however, the above mentioned search field shows up. The official New York Times Wordle game also has this issue. Listening to key strokes happens via the keyup event:

```<code>window.addEventListener("keyup", (e) => {
e.preventDefault();
let key =
  e.keyCode == 13
    ? "{enter}"
    : e.keyCode == 8
    ? "{bksp}"
    : String.fromCharCode(e.keyCode).toLowerCase();
handleInput(key);
});
</code>```

Is there any way to disable the option via CSS or JS. Or set the focus to an invisible text field while still listening to the event but not triggering the search bar? (or any similar tricks)

Body:
Firefox has a features which allows the user to search the page directly by just pressing a letter on the keyboard, without the need to press Ctrl + F beforehand, which is enabled by default. This does not happen if a text field or something similar is in focus.

I am currently working on a Worlde clone using Vue3. The game offers a virtual keyboard but also allows input via keys. The goal is to find 5 letter long word within 6 tries. To help the player it indicates containing letters (green if on the right position, yellow if not). When using the physical keyboard however, the above mentioned search field shows up. The official New York Times Wordle game also has this issue. Listening to key strokes happens via the keyup event:

window.addEventListener("keyup", (e) => {
e.preventDefault();
let key =
  e.keyCode == 13
    ? "{enter}"
    : e.keyCode == 8
    ? "{bksp}"
    : String.fromCharCode(e.keyCode).toLowerCase();
handleInput(key);
});

Is there any way to disable the option via CSS or JS. Or set the focus to an invisible text field while still listening to the event but not triggering the search bar? (or any similar tricks)


问:
How to update dynamic form fields in Django
The users can dynamically add more fields and edit fields to the forms.
The problem is I don't know how exactly I should pass the dynamic multiple dynamic 'city' ids and edit-update them.

Models.py

```<code>class Cities(models.Model):
    cityname = models.CharField(max_length=5000, null = True, blank = True)
    owner = models.ForeignKey(User, null = True, on_delete=models.CASCADE)
    relcountry = models.ForeignKey(Country, null = True, on_delete=models.CASCADE)
</code>```

Index.html

```<code><form method = "post" action='cityupdate/{{city.id}}' enctype="multipart/form-data">
{% csrf_token %}

{% for city in cities %}
  <input type="text" name = "{{city.id}}" value= "{{city.name}}" </input>
{% endfor %}

<input type="submit" name = "cityupdate" value= "Update"  </input></a>
</form>
</code>```

Urls.py

```<code>path('cityupdate/<str:id>',views.cityupdate,name='pk')
</code>```

Views.py

```<code>def cityupdate(request,pk):
    if request.method == 'POST' and 'cityupdate' in request.POST:
         -----------------

</code>```

I need help to complete the views.py code

Body:
The users can dynamically add more fields and edit fields to the forms.
The problem is I don't know how exactly I should pass the dynamic multiple dynamic 'city' ids and edit-update them.

Models.py

class Cities(models.Model):
    cityname = models.CharField(max_length=5000, null = True, blank = True)
    owner = models.ForeignKey(User, null = True, on_delete=models.CASCADE)
    relcountry = models.ForeignKey(Country, null = True, on_delete=models.CASCADE)

Index.html

<form method = "post" action='cityupdate/{{city.id}}' enctype="multipart/form-data">
{% csrf_token %}

{% for city in cities %}
  <input type="text" name = "{{city.id}}" value= "{{city.name}}" </input>
{% endfor %}

<input type="submit" name = "cityupdate" value= "Update"  </input>
</form>

Urls.py

path('cityupdate/<str:id>',views.cityupdate,name='pk')

Views.py

def cityupdate(request,pk):
    if request.method == 'POST' and 'cityupdate' in request.POST:
         -----------------

I need help to complete the views.py code


问:
Angular 15 - Cannot read properties of null (reading 'bindingStartIndex') when adding a dependency in nested package.json
I have migrated my angular app from 14.0.2 -> 15.0.4.
And I have the following error in my browser :

I have found what is causing this error. It's when I add a dependency (thats relies on Angular) in wrapper1's package.json.

project structure

```<code> projects
   |
   |___ lib
   |     |
   |     |___ src
   |          package.json
   |
   |___ wrapper1
   |     |
   |     |___ src
   |          package.json
   |
   |
   |___ wrapper2
   |     |
   |     |___ src
   |          package.json
   |
 package.json

</code>```

angular.json

```<code>{
  "$schema": "node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "projects": {
    "wrapper1": {
      "projectType": "application",
      "root": "projects/wrapper1",
      "sourceRoot": "projects/wrapper1/src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/wrapper1",
            "index": "projects/wrapper1/src/index.html",
            "main": "projects/wrapper1/src/main.ts",
            "polyfills": [
              "zone.js"
            ],
            "tsConfig": "projects/wrapper1/tsconfig.app.json",
            "assets": [],
            "styles": ["projects/wrapper1/src/styles.scss"],
            "scripts": [],
            "preserveSymlinks": true
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "projects/wrapper1/src/environments/environment.ts",
                  "with": "projects/wrapper1/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "500kb",
                  "maximumError": "7mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "7kb",
                  "maximumError": "10kb"
                }
              ]
            },
            "local": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "wrapper1:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "wrapper1:build:production"
            },
            "local": {
              "browserTarget": "wrapper1:build:local"
            },
            "development": {
              "browserTarget": "wrapper1:build:development"
            }
          },
          "defaultConfiguration": "development"
        }
      }
    },
  }
}

</code>```

package.json

```<code>{
  "name": "test",
  "version": "1.0.0-SNAPSHOT",
  "scripts": {
    "ng": "ng",
    "start:wrapper1": "ng serve --port 3000 wrapper1 -o",
    "start:wrapper2": "ng serve --configuration development --port 3002 wrapper2",
    "build": "ng build",
    "build:wrapper1": "cd projects/wrapper1 && npm run build",
    "build:wrapper2": "cd projects/wrapper2 && npm run build",
    "test": "ng test --detect-open-handles --pass-with-no-tests",
    "test:ci": "ng test --ci --pass-with-no-tests --collect-coverage",
    "e2e": "ng e2e",
    "postinstall": "concurrently \"cd projects/lib && npm install\" \"cd projects/wrapper1 && npm install\" \"cd projects/wrapper2 && npm install\""
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^15.0.4",
    "@angular/common": "^15.0.4",
    "@angular/compiler": "^15.0.4",
    "@angular/core": "^15.0.4",
    "@angular/forms": "^15.0.4",
    "@angular/platform-browser": "^15.0.4",
    "@angular/platform-browser-dynamic": "^15.0.4",
    "@angular/router": "^15.0.4",
    "rxjs": "^6.6.7",
    "tslib": "^2.4.0",
    "zone.js": "^0.12.0"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "^15.0.0",
    "@angular-builders/jest": "^15.0.0",
    "@angular-devkit/build-angular": "^15.0.4",
    "@angular-eslint/builder": "15.1.0",
    "@angular-eslint/eslint-plugin": "15.1.0",
    "@angular-eslint/eslint-plugin-template": "15.1.0",
    "@angular-eslint/schematics": "15.1.0",
    "@angular-eslint/template-parser": "15.1.0",
    "@angular/cli": "^15.0.4",
    "@angular/compiler-cli": "^15.0.4",
    "@types/jest": "^29.2.4",
    "@typescript-eslint/eslint-plugin": "5.47.1",
    "@typescript-eslint/parser": "5.47.1",
    "autoprefixer": "^10.4.13",
    "concurrently": "^7.4.0",
    "eslint": "^8.30.0",
    "jest": "^28.1.3",
    "jest-environment-jsdom": "^28.1.3",
    "jest-preset-angular": "^12.2.3",
    "lint-staged": "^13.0.3",
    "ng-packagr": "^15.0.3",
    "stylelint": "^14.16.1",
    "stylelint-config-standard": "^29.0.0",
    "stylelint-config-standard-scss": "^6.1.0",
    "ts-node": "^10.9.1",
    "typescript": "^4.8.2"
  },
  "engines": {
    "node": ">= 16.16.0",
    "npm": ">= 8"
  },
  "jest": {
    "preset": "jest-preset-angular",
    "setupFilesAfterEnv": [
      "<rootDir>/setup-jest.ts"
    ],
    "globalSetup": "jest-preset-angular/global-setup",
    "snapshotResolver": "<rootDir>/config/jest/snapshotResolver.js",
    "transformIgnorePatterns": [
      "^.+\\.js$"
    ]
  }
}
</code>```

wrapper1/tsconfig.app.json

```<code>{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "paths": {
      "rxjs": ["node_modules/rxjs"],
      "rxjs/*": ["node_modules/rxjs/*"]
    }
  },
  "exclude": ["**/*.spec.ts", "**/*-mock*.ts", "**/*-local*.ts"]
}
</code>```

wrapper1/package.json

```<code>{
  "name": "wrapper1",
  "version": "1.0.0-SNAPSHOT",
  "scripts": {
   },
  "dependencies": {
    "angular-oauth2-oidc": "^15.0.0",
    "tslib": "^2.4.0"
  }
}
</code>```

adding "angular-oauth2-oidc": "^15.0.0", in this package.json is causing the error. Same if I add a custom component librairy (based on Angular).

I had already "preserveSymlinks": true in my angular.json but it's not enough anymore.
Do you have any idea why ?

Body:
I have migrated my angular app from 14.0.2 -> 15.0.4.
And I have the following error in my browser :

I have found what is causing this error. It's when I add a dependency (thats relies on Angular) in wrapper1's package.json.

project structure

 projects
   |
   |___ lib
   |     |
   |     |___ src
   |          package.json
   |
   |___ wrapper1
   |     |
   |     |___ src
   |          package.json
   |
   |
   |___ wrapper2
   |     |
   |     |___ src
   |          package.json
   |
 package.json

angular.json

{
  "$schema": "node_modules/@angular/cli/lib/config/schema.json",
  "version": 1,
  "projects": {
    "wrapper1": {
      "projectType": "application",
      "root": "projects/wrapper1",
      "sourceRoot": "projects/wrapper1/src",
      "prefix": "app",
      "architect": {
        "build": {
          "builder": "@angular-devkit/build-angular:browser",
          "options": {
            "outputPath": "dist/wrapper1",
            "index": "projects/wrapper1/src/index.html",
            "main": "projects/wrapper1/src/main.ts",
            "polyfills": [
              "zone.js"
            ],
            "tsConfig": "projects/wrapper1/tsconfig.app.json",
            "assets": [],
            "styles": ["projects/wrapper1/src/styles.scss"],
            "scripts": [],
            "preserveSymlinks": true
          },
          "configurations": {
            "production": {
              "fileReplacements": [
                {
                  "replace": "projects/wrapper1/src/environments/environment.ts",
                  "with": "projects/wrapper1/src/environments/environment.prod.ts"
                }
              ],
              "optimization": true,
              "outputHashing": "all",
              "sourceMap": false,
              "namedChunks": false,
              "extractLicenses": true,
              "vendorChunk": false,
              "buildOptimizer": true,
              "budgets": [
                {
                  "type": "initial",
                  "maximumWarning": "500kb",
                  "maximumError": "7mb"
                },
                {
                  "type": "anyComponentStyle",
                  "maximumWarning": "7kb",
                  "maximumError": "10kb"
                }
              ]
            },
            "local": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true
            },
            "development": {
              "buildOptimizer": false,
              "optimization": false,
              "vendorChunk": true,
              "extractLicenses": false,
              "sourceMap": true,
              "namedChunks": true
            }
          }
        },
        "serve": {
          "builder": "@angular-devkit/build-angular:dev-server",
          "options": {
            "browserTarget": "wrapper1:build"
          },
          "configurations": {
            "production": {
              "browserTarget": "wrapper1:build:production"
            },
            "local": {
              "browserTarget": "wrapper1:build:local"
            },
            "development": {
              "browserTarget": "wrapper1:build:development"
            }
          },
          "defaultConfiguration": "development"
        }
      }
    },
  }
}

package.json

{
  "name": "test",
  "version": "1.0.0-SNAPSHOT",
  "scripts": {
    "ng": "ng",
    "start:wrapper1": "ng serve --port 3000 wrapper1 -o",
    "start:wrapper2": "ng serve --configuration development --port 3002 wrapper2",
    "build": "ng build",
    "build:wrapper1": "cd projects/wrapper1 && npm run build",
    "build:wrapper2": "cd projects/wrapper2 && npm run build",
    "test": "ng test --detect-open-handles --pass-with-no-tests",
    "test:ci": "ng test --ci --pass-with-no-tests --collect-coverage",
    "e2e": "ng e2e",
    "postinstall": "concurrently \"cd projects/lib && npm install\" \"cd projects/wrapper1 && npm install\" \"cd projects/wrapper2 && npm install\""
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^15.0.4",
    "@angular/common": "^15.0.4",
    "@angular/compiler": "^15.0.4",
    "@angular/core": "^15.0.4",
    "@angular/forms": "^15.0.4",
    "@angular/platform-browser": "^15.0.4",
    "@angular/platform-browser-dynamic": "^15.0.4",
    "@angular/router": "^15.0.4",
    "rxjs": "^6.6.7",
    "tslib": "^2.4.0",
    "zone.js": "^0.12.0"
  },
  "devDependencies": {
    "@angular-builders/custom-webpack": "^15.0.0",
    "@angular-builders/jest": "^15.0.0",
    "@angular-devkit/build-angular": "^15.0.4",
    "@angular-eslint/builder": "15.1.0",
    "@angular-eslint/eslint-plugin": "15.1.0",
    "@angular-eslint/eslint-plugin-template": "15.1.0",
    "@angular-eslint/schematics": "15.1.0",
    "@angular-eslint/template-parser": "15.1.0",
    "@angular/cli": "^15.0.4",
    "@angular/compiler-cli": "^15.0.4",
    "@types/jest": "^29.2.4",
    "@typescript-eslint/eslint-plugin": "5.47.1",
    "@typescript-eslint/parser": "5.47.1",
    "autoprefixer": "^10.4.13",
    "concurrently": "^7.4.0",
    "eslint": "^8.30.0",
    "jest": "^28.1.3",
    "jest-environment-jsdom": "^28.1.3",
    "jest-preset-angular": "^12.2.3",
    "lint-staged": "^13.0.3",
    "ng-packagr": "^15.0.3",
    "stylelint": "^14.16.1",
    "stylelint-config-standard": "^29.0.0",
    "stylelint-config-standard-scss": "^6.1.0",
    "ts-node": "^10.9.1",
    "typescript": "^4.8.2"
  },
  "engines": {
    "node": ">= 16.16.0",
    "npm": ">= 8"
  },
  "jest": {
    "preset": "jest-preset-angular",
    "setupFilesAfterEnv": [
      "<rootDir>/setup-jest.ts"
    ],
    "globalSetup": "jest-preset-angular/global-setup",
    "snapshotResolver": "<rootDir>/config/jest/snapshotResolver.js",
    "transformIgnorePatterns": [
      "^.+\\.js$"
    ]
  }
}

wrapper1/tsconfig.app.json

{
  "extends": "../../tsconfig.json",
  "compilerOptions": {
    "paths": {
      "rxjs": ["node_modules/rxjs"],
      "rxjs/*": ["node_modules/rxjs/*"]
    }
  },
  "exclude": ["**/*.spec.ts", "**/*-mock*.ts", "**/*-local*.ts"]
}

wrapper1/package.json

{
  "name": "wrapper1",
  "version": "1.0.0-SNAPSHOT",
  "scripts": {
   },
  "dependencies": {
    "angular-oauth2-oidc": "^15.0.0",
    "tslib": "^2.4.0"
  }
}

adding "angular-oauth2-oidc": "^15.0.0", in this package.json is causing the error. Same if I add a custom component librairy (based on Angular).

I had already "preserveSymlinks": true in my angular.json but it's not enough anymore.
Do you have any idea why ?


问:
persistentStore(for:) always return nil
I'm following this solution to migrate the Core Data database to AppGroup and always "persistentStore(for: oldStoreURL)" returns "nil". The URL is correct and the file exist in the path. Any ideas?</p>
```<code>if let url = defaultURL, url.absoluteString != storeURL.absoluteString {
        let coordinator = container.persistentStoreCoordinator
        if let oldStore = coordinator.persistentStore(for: url) {   // oldStore returns nil
            do {
                try coordinator.migratePersistentStore(oldStore, to: storeURL, options: nil, withType: NSSQLiteStoreType)
            } catch {
                print(error.localizedDescription)
            }

            // delete old store
            let fileCoordinator = NSFileCoordinator(filePresenter: nil)
            fileCoordinator.coordinate(writingItemAt: url, options: .forDeleting, error: nil, byAccessor: { url in
                do {
                    try FileManager.default.removeItem(at: url)
                } catch {
                    print(error.localizedDescription)
                }
            })
        }
    }
</code>```

Title: persistentStore(for:) always return nil

Body:
I'm following this solution to migrate the Core Data database to AppGroup and always "persistentStore(for: oldStoreURL)" returns "nil". The URL is correct and the file exist in the path. Any ideas?

if let url = defaultURL, url.absoluteString != storeURL.absoluteString {
        let coordinator = container.persistentStoreCoordinator
        if let oldStore = coordinator.persistentStore(for: url) {   // oldStore returns nil
            do {
                try coordinator.migratePersistentStore(oldStore, to: storeURL, options: nil, withType: NSSQLiteStoreType)
            } catch {
                print(error.localizedDescription)
            }

            // delete old store
            let fileCoordinator = NSFileCoordinator(filePresenter: nil)
            fileCoordinator.coordinate(writingItemAt: url, options: .forDeleting, error: nil, byAccessor: { url in
                do {
                    try FileManager.default.removeItem(at: url)
                } catch {
                    print(error.localizedDescription)
                }
            })
        }
    }