问:
How can I return in a ObsevableCollection<T> using C# Linq, all items if no one is selected or just selected items if at least one is selected?
I'm trying to get items in C# in an ObservableCollection<MyClassSelectable> using Linq and Lambda in the following cases :

Returns All items if no one is selected

Or

Returns just selected items if at least one is selected.

MyClassSelectable has a property named Selected of bool type.

Is it possible to do it, in only one Linq query line ?

Thank you.

答:
You can also achieve the same behavoir without using GroupBy().</p>

```<code>class MainClass {
  public static void Main (string[] args) {
    var myCollection = new ObservableCollection<MyClassSelectable>();

    // Add some items of tyoe MyClassSelectable to myCollection here
    myCollection.Add(new MyClassSelectable() { Selected = true });
    myCollection.Add(new MyClassSelectable() { Selected = false });
    myCollection.Add(new MyClassSelectable() { Selected = true });
    myCollection.Add(new MyClassSelectable() { Selected = true });

    // Now get selected or all items
    var selected = GetSelectedItems(myCollection);

    Console.WriteLine($"Items selected: {selected.Count()}");
  }

  private static IEnumerable<MyClassSelectable> GetSelectedItems(ObservableCollection<MyClassSelectable> coll) {
    var selected = coll.Where(c => c.Selected);
    if (selected.Count() > 0) {
      return selected;
    }
    else {
      return coll;
    }
  }
}
</code>```

Body:
You can also achieve the same behavoir without using GroupBy().

class MainClass {
  public static void Main (string[] args) {
    var myCollection = new ObservableCollection<MyClassSelectable>();

    // Add some items of tyoe MyClassSelectable to myCollection here
    myCollection.Add(new MyClassSelectable() { Selected = true });
    myCollection.Add(new MyClassSelectable() { Selected = false });
    myCollection.Add(new MyClassSelectable() { Selected = true });
    myCollection.Add(new MyClassSelectable() { Selected = true });

    // Now get selected or all items
    var selected = GetSelectedItems(myCollection);

    Console.WriteLine($"Items selected: {selected.Count()}");
  }

  private static IEnumerable<MyClassSelectable> GetSelectedItems(ObservableCollection<MyClassSelectable> coll) {
    var selected = coll.Where(c => c.Selected);
    if (selected.Count() > 0) {
      return selected;
    }
    else {
      return coll;
    }
  }
}


来源: stackexchange

问:
Troupbles with creating apk with React Native
I'm new too React Native and just created an app with this command
    react-native init rnapp
It's ouputed many warnings:

```<code>npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","a
rch":"x64"})
npm WARN react-native@0.61.5 requires a peer of react@16.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: abbrev@1.1.1 (node_modules\fsevents\node_modules\abbrev):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\abbrev' -> 'D:\rn
app\node_modules\fsevents\node_modules\.abbrev.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ansi-regex@2.1.1 (node_modules\fsevents\node_modules\ansi-regex):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\ansi-regex' -> 'D
:\rnapp\node_modules\fsevents\node_modules\.ansi-regex.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: aproba@1.2.0 (node_modules\fsevents\node_modules\aproba):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\aproba' -> 'D:\rn
app\node_modules\fsevents\node_modules\.aproba.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: balanced-match@1.0.0 (node_modules\fsevents\node_modules\balanced-match):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\balanced-match' -
> 'D:\rnapp\node_modules\fsevents\node_modules\.balanced-match.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: chownr@1.1.3 (node_modules\fsevents\node_modules\chownr):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\chownr' -> 'D:\rn
app\node_modules\fsevents\node_modules\.chownr.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: code-point-at@1.1.0 (node_modules\fsevents\node_modules\code-point-at):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\code-point-at' ->
 'D:\rnapp\node_modules\fsevents\node_modules\.code-point-at.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: concat-map@0.0.1 (node_modules\fsevents\node_modules\concat-map):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\concat-map' -> 'D
:\rnapp\node_modules\fsevents\node_modules\.concat-map.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: console-control-strings@1.1.0 (node_modules\fsevents\node_modules\console-control-strings):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\console-control-s
trings' -> 'D:\rnapp\node_modules\fsevents\node_modules\.console-control-strings.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: core-util-is@1.0.2 (node_modules\fsevents\node_modules\core-util-is):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\core-util-is' ->
'D:\rnapp\node_modules\fsevents\node_modules\.core-util-is.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: deep-extend@0.6.0 (node_modules\fsevents\node_modules\deep-extend):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\deep-extend' -> '
D:\rnapp\node_modules\fsevents\node_modules\.deep-extend.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: delegates@1.0.0 (node_modules\fsevents\node_modules\delegates):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\delegates' -> 'D:
\rnapp\node_modules\fsevents\node_modules\.delegates.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: detect-libc@1.0.3 (node_modules\fsevents\node_modules\detect-libc):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\detect-libc' -> '
D:\rnapp\node_modules\fsevents\node_modules\.detect-libc.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs.realpath@1.0.0 (node_modules\fsevents\node_modules\fs.realpath):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\fs.realpath' -> '
D:\rnapp\node_modules\fsevents\node_modules\.fs.realpath.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: has-unicode@2.0.1 (node_modules\fsevents\node_modules\has-unicode):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\has-unicode' -> '
D:\rnapp\node_modules\fsevents\node_modules\.has-unicode.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: inherits@2.0.4 (node_modules\fsevents\node_modules\inherits):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\inherits' -> 'D:\
rnapp\node_modules\fsevents\node_modules\.inherits.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ini@1.3.5 (node_modules\fsevents\node_modules\ini):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\ini' -> 'D:\rnapp
\node_modules\fsevents\node_modules\.ini.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: isarray@1.0.0 (node_modules\fsevents\node_modules\isarray):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\isarray' -> 'D:\r
napp\node_modules\fsevents\node_modules\.isarray.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist@0.0.8 (node_modules\fsevents\node_modules\minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\minimist' -> 'D:\
rnapp\node_modules\fsevents\node_modules\.minimist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ms@2.1.2 (node_modules\fsevents\node_modules\ms):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\ms' -> 'D:\rnapp\
node_modules\fsevents\node_modules\.ms.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: npm-normalize-package-bin@1.0.1 (node_modules\fsevents\node_modules\npm-normalize-package-bin):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\npm-normalize-pac
kage-bin' -> 'D:\rnapp\node_modules\fsevents\node_modules\.npm-normalize-package-bin.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: number-is-nan@1.0.1 (node_modules\fsevents\node_modules\number-is-nan):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\number-is-nan' ->
 'D:\rnapp\node_modules\fsevents\node_modules\.number-is-nan.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: object-assign@4.1.1 (node_modules\fsevents\node_modules\object-assign):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\object-assign' ->
 'D:\rnapp\node_modules\fsevents\node_modules\.object-assign.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-homedir@1.0.2 (node_modules\fsevents\node_modules\os-homedir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\os-homedir' -> 'D
:\rnapp\node_modules\fsevents\node_modules\.os-homedir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-tmpdir@1.0.2 (node_modules\fsevents\node_modules\os-tmpdir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\os-tmpdir' -> 'D:
\rnapp\node_modules\fsevents\node_modules\.os-tmpdir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: path-is-absolute@1.0.1 (node_modules\fsevents\node_modules\path-is-absolute):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\path-is-absolute'
 -> 'D:\rnapp\node_modules\fsevents\node_modules\.path-is-absolute.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: process-nextick-args@2.0.1 (node_modules\fsevents\node_modules\process-nextick-args):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\process-nextick-a
rgs' -> 'D:\rnapp\node_modules\fsevents\node_modules\.process-nextick-args.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist@1.2.0 (node_modules\fsevents\node_modules\rc\node_modules\minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\rc\node_modules\m
inimist' -> 'D:\rnapp\node_modules\fsevents\node_modules\rc\node_modules\.minimist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safe-buffer@5.1.2 (node_modules\fsevents\node_modules\safe-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\safe-buffer' -> '
D:\rnapp\node_modules\fsevents\node_modules\.safe-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safer-buffer@2.1.2 (node_modules\fsevents\node_modules\safer-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\safer-buffer' ->
'D:\rnapp\node_modules\fsevents\node_modules\.safer-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sax@1.2.4 (node_modules\fsevents\node_modules\sax):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\sax' -> 'D:\rnapp
\node_modules\fsevents\node_modules\.sax.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: semver@5.7.1 (node_modules\fsevents\node_modules\semver):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\semver' -> 'D:\rn
app\node_modules\fsevents\node_modules\.semver.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: set-blocking@2.0.0 (node_modules\fsevents\node_modules\set-blocking):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\set-blocking' ->
'D:\rnapp\node_modules\fsevents\node_modules\.set-blocking.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: signal-exit@3.0.2 (node_modules\fsevents\node_modules\signal-exit):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\signal-exit' -> '
D:\rnapp\node_modules\fsevents\node_modules\.signal-exit.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: strip-json-comments@2.0.1 (node_modules\fsevents\node_modules\strip-json-comments):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\strip-json-commen
ts' -> 'D:\rnapp\node_modules\fsevents\node_modules\.strip-json-comments.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: util-deprecate@1.0.2 (node_modules\fsevents\node_modules\util-deprecate):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\util-deprecate' -
> 'D:\rnapp\node_modules\fsevents\node_modules\.util-deprecate.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: wrappy@1.0.2 (node_modules\fsevents\node_modules\wrappy):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\wrappy' -> 'D:\rn
app\node_modules\fsevents\node_modules\.wrappy.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: yallist@3.1.1 (node_modules\fsevents\node_modules\yallist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\yallist' -> 'D:\r
napp\node_modules\fsevents\node_modules\.yallist.DELETE'
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN eslint-plugin-react-native@3.6.0 requires a peer of eslint@^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies your
self.
npm WARN eslint-plugin-react@7.12.4 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies you
rself.
npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.
6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","a
rch":"x64"})
</code>```

Then I went to android folder and ran this command:

```<code>gradlew assemblerelease
</code>```

But then I get this:

*> Task :app:bundleReleaseJsAndAssets warning: the transform cache was reset. Loading dependency graph, done. info Writing bundle output to:,
  D:\rnapp\android\app\build\generated\assets\react\release\index.android.bundle
  info Writing sourcemap output to:,
  D:\rnapp\android\app\build\generated\sourcemaps\react\release\index.android.bundle.map
  info Done writing sourcemap output info Done writing bundle output
  info Copying 2 asset files info Done copying assets
  Task :app:mergeReleaseResources FAILED
  FAILURE: Build failed with an exception.
  * What went wrong:
  Execution failed for task ':app:mergeReleaseResources'.
  8 exceptions were raised by workers:
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #0: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #1: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #2: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #3: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #4: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #5: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #6: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #7: Daemon startup failed*

Anyone knows how to fix that and build apk file for Android on that empty application?

答:
Here's a link to the official react-native website where it shows how to build signed android apk.

https://facebook.github.io/react-native/docs/signed-apk-android#__docusaurus

First, you need to create a keystore, here's how to create a keystore (https://stackoverflow.com/a/30254012/4829343) and then follow the instructions on the react-native website.

ContentLicense: CC BY-SA 4.0

Body:
I'm new too React Native and just created an app with this command
    react-native init rnapp
It's ouputed many warnings:

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","a
rch":"x64"})
npm WARN react-native@0.61.5 requires a peer of react@16.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: abbrev@1.1.1 (node_modules\fsevents\node_modules\abbrev):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\abbrev' -> 'D:\rn
app\node_modules\fsevents\node_modules\.abbrev.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ansi-regex@2.1.1 (node_modules\fsevents\node_modules\ansi-regex):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\ansi-regex' -> 'D
:\rnapp\node_modules\fsevents\node_modules\.ansi-regex.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: aproba@1.2.0 (node_modules\fsevents\node_modules\aproba):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\aproba' -> 'D:\rn
app\node_modules\fsevents\node_modules\.aproba.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: balanced-match@1.0.0 (node_modules\fsevents\node_modules\balanced-match):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\balanced-match' -
> 'D:\rnapp\node_modules\fsevents\node_modules\.balanced-match.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: chownr@1.1.3 (node_modules\fsevents\node_modules\chownr):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\chownr' -> 'D:\rn
app\node_modules\fsevents\node_modules\.chownr.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: code-point-at@1.1.0 (node_modules\fsevents\node_modules\code-point-at):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\code-point-at' ->
 'D:\rnapp\node_modules\fsevents\node_modules\.code-point-at.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: concat-map@0.0.1 (node_modules\fsevents\node_modules\concat-map):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\concat-map' -> 'D
:\rnapp\node_modules\fsevents\node_modules\.concat-map.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: console-control-strings@1.1.0 (node_modules\fsevents\node_modules\console-control-strings):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\console-control-s
trings' -> 'D:\rnapp\node_modules\fsevents\node_modules\.console-control-strings.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: core-util-is@1.0.2 (node_modules\fsevents\node_modules\core-util-is):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\core-util-is' ->
'D:\rnapp\node_modules\fsevents\node_modules\.core-util-is.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: deep-extend@0.6.0 (node_modules\fsevents\node_modules\deep-extend):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\deep-extend' -> '
D:\rnapp\node_modules\fsevents\node_modules\.deep-extend.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: delegates@1.0.0 (node_modules\fsevents\node_modules\delegates):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\delegates' -> 'D:
\rnapp\node_modules\fsevents\node_modules\.delegates.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: detect-libc@1.0.3 (node_modules\fsevents\node_modules\detect-libc):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\detect-libc' -> '
D:\rnapp\node_modules\fsevents\node_modules\.detect-libc.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fs.realpath@1.0.0 (node_modules\fsevents\node_modules\fs.realpath):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\fs.realpath' -> '
D:\rnapp\node_modules\fsevents\node_modules\.fs.realpath.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: has-unicode@2.0.1 (node_modules\fsevents\node_modules\has-unicode):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\has-unicode' -> '
D:\rnapp\node_modules\fsevents\node_modules\.has-unicode.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: inherits@2.0.4 (node_modules\fsevents\node_modules\inherits):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\inherits' -> 'D:\
rnapp\node_modules\fsevents\node_modules\.inherits.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ini@1.3.5 (node_modules\fsevents\node_modules\ini):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\ini' -> 'D:\rnapp
\node_modules\fsevents\node_modules\.ini.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: isarray@1.0.0 (node_modules\fsevents\node_modules\isarray):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\isarray' -> 'D:\r
napp\node_modules\fsevents\node_modules\.isarray.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist@0.0.8 (node_modules\fsevents\node_modules\minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\minimist' -> 'D:\
rnapp\node_modules\fsevents\node_modules\.minimist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ms@2.1.2 (node_modules\fsevents\node_modules\ms):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\ms' -> 'D:\rnapp\
node_modules\fsevents\node_modules\.ms.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: npm-normalize-package-bin@1.0.1 (node_modules\fsevents\node_modules\npm-normalize-package-bin):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\npm-normalize-pac
kage-bin' -> 'D:\rnapp\node_modules\fsevents\node_modules\.npm-normalize-package-bin.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: number-is-nan@1.0.1 (node_modules\fsevents\node_modules\number-is-nan):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\number-is-nan' ->
 'D:\rnapp\node_modules\fsevents\node_modules\.number-is-nan.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: object-assign@4.1.1 (node_modules\fsevents\node_modules\object-assign):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\object-assign' ->
 'D:\rnapp\node_modules\fsevents\node_modules\.object-assign.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-homedir@1.0.2 (node_modules\fsevents\node_modules\os-homedir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\os-homedir' -> 'D
:\rnapp\node_modules\fsevents\node_modules\.os-homedir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: os-tmpdir@1.0.2 (node_modules\fsevents\node_modules\os-tmpdir):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\os-tmpdir' -> 'D:
\rnapp\node_modules\fsevents\node_modules\.os-tmpdir.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: path-is-absolute@1.0.1 (node_modules\fsevents\node_modules\path-is-absolute):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\path-is-absolute'
 -> 'D:\rnapp\node_modules\fsevents\node_modules\.path-is-absolute.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: process-nextick-args@2.0.1 (node_modules\fsevents\node_modules\process-nextick-args):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\process-nextick-a
rgs' -> 'D:\rnapp\node_modules\fsevents\node_modules\.process-nextick-args.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist@1.2.0 (node_modules\fsevents\node_modules\rc\node_modules\minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\rc\node_modules\m
inimist' -> 'D:\rnapp\node_modules\fsevents\node_modules\rc\node_modules\.minimist.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safe-buffer@5.1.2 (node_modules\fsevents\node_modules\safe-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\safe-buffer' -> '
D:\rnapp\node_modules\fsevents\node_modules\.safe-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: safer-buffer@2.1.2 (node_modules\fsevents\node_modules\safer-buffer):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\safer-buffer' ->
'D:\rnapp\node_modules\fsevents\node_modules\.safer-buffer.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: sax@1.2.4 (node_modules\fsevents\node_modules\sax):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\sax' -> 'D:\rnapp
\node_modules\fsevents\node_modules\.sax.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: semver@5.7.1 (node_modules\fsevents\node_modules\semver):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\semver' -> 'D:\rn
app\node_modules\fsevents\node_modules\.semver.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: set-blocking@2.0.0 (node_modules\fsevents\node_modules\set-blocking):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\set-blocking' ->
'D:\rnapp\node_modules\fsevents\node_modules\.set-blocking.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: signal-exit@3.0.2 (node_modules\fsevents\node_modules\signal-exit):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\signal-exit' -> '
D:\rnapp\node_modules\fsevents\node_modules\.signal-exit.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: strip-json-comments@2.0.1 (node_modules\fsevents\node_modules\strip-json-comments):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\strip-json-commen
ts' -> 'D:\rnapp\node_modules\fsevents\node_modules\.strip-json-comments.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: util-deprecate@1.0.2 (node_modules\fsevents\node_modules\util-deprecate):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\util-deprecate' -
> 'D:\rnapp\node_modules\fsevents\node_modules\.util-deprecate.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: wrappy@1.0.2 (node_modules\fsevents\node_modules\wrappy):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\wrappy' -> 'D:\rn
app\node_modules\fsevents\node_modules\.wrappy.DELETE'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: yallist@3.1.1 (node_modules\fsevents\node_modules\yallist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'D:\rnapp\node_modules\fsevents\node_modules\yallist' -> 'D:\r
napp\node_modules\fsevents\node_modules\.yallist.DELETE'
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN eslint-plugin-react-native@3.6.0 requires a peer of eslint@^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies your
self.
npm WARN eslint-plugin-react@7.12.4 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 but none is installed. You must install peer dependencies you
rself.
npm WARN @typescript-eslint/eslint-plugin@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @typescript-eslint/parser@1.13.0 requires a peer of eslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.
6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","a
rch":"x64"})

Then I went to android folder and ran this command:

gradlew assemblerelease

But then I get this:

*> Task :app:bundleReleaseJsAndAssets warning: the transform cache was reset. Loading dependency graph, done. info Writing bundle output to:,
  D:\rnapp\android\app\build\generated\assets\react\release\index.android.bundle
  info Writing sourcemap output to:,
  D:\rnapp\android\app\build\generated\sourcemaps\react\release\index.android.bundle.map
  info Done writing sourcemap output info Done writing bundle output
  info Copying 2 asset files info Done copying assets
  Task :app:mergeReleaseResources FAILED
  FAILURE: Build failed with an exception.
  * What went wrong:
  Execution failed for task ':app:mergeReleaseResources'.
  8 exceptions were raised by workers:
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #0: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #1: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #2: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #3: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #4: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #5: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #6: Daemon startup failed
    This should not happen under normal circumstances, please file an issue if it does.
    com.android.builder.internal.aapt.v2.Aapt2InternalException: AAPT2 aapt2-3.4.2-5326820-windows Daemon #7: Daemon startup failed*

Anyone knows how to fix that and build apk file for Android on that empty application?


问:
C#: asp.net CORE empty Migration
I am trying to add a migration from DatabaseContext
but when I add an migration i generates it empty like this. I had been following this tutorial

```<code>namespace MovieExampleAppDotNetCore.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class ModelMigration : DbMigration
    {
        public override void Up()
        {
        }

        public override void Down()
        {
        }
    }
}
</code>```

these are the models,Migration Configuration, Startup and DatabaseContext

Movie.cs

```<code>using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace MovieExampleAppDotNetCore.Models
{
    public class Movie
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int MovieId { get; set; }
        public String Name { get; set; }

        [Column(TypeName = "datetime2")]
        public DateTime? DateCreated { get; set; }
    }
}

</code>```

Customer.cs

```<code>using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace MovieExampleAppDotNetCore.Models
{
    public class Customer
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int CustomerId { get; set; }
        public string Name { get; set; }
        public string LastName { get; set; }
        public bool IsCreated { get; set; }
        public int MaxMovies { get; set; }

        [Column(TypeName = "datetime2")]
        public DateTime Created { get; set; }

        [Column(TypeName = "datetime2")]
        public DateTime? LastEdited { get; set; }

    }
}

</code>```

Configuration.cs

```<code>namespace MovieExampleAppDotNetCore.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<MovieExampleApp.Persistention.DatabaseContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
        }

        protected override void Seed(MovieExampleApp.Persistention.DatabaseContext context)
        {

        //  This method will be called after migrating to the latest version.

        //  You can use the DbSet<T>.AddOrUpdate() helper extension method
        //  to avoid creating duplicate seed data.
    }
}

}
</code>```

DatabaseContext.cs

```<code>using Microsoft.EntityFrameworkCore;
using MovieExampleAppDotNetCore.Models;
using System.Data.Entity;

namespace MovieExampleApp.Persistention
{
    public class DatabaseContext : System.Data.Entity.DbContext
    {
        public DatabaseContext() : base("main")
        {
            //Database.Initialize(true);
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }

        public Microsoft.EntityFrameworkCore.DbSet<Movie> Movies { get; set; }
        public Microsoft.EntityFrameworkCore.DbSet<Customer> Customers { get; set; }
    }
}
</code>```

Startup.cs

```<code>using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using MovieExampleApp.Persistention;
using System.Linq;

namespace MovieExampleAppDotNetCore
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {

            services.AddDbContext<DatabaseContext>(
                        options => options.UseSqlServer(Configuration.GetConnectionString("DatabaseContext")));

            services.AddControllersWithViews().AddNewtonsoftJson();

            services.AddControllersWithViews(options =>
            {
                options.InputFormatters.Insert(0, GetJsonPatchInputFormatter());
            });

        }

        private static NewtonsoftJsonPatchInputFormatter GetJsonPatchInputFormatter()
        {
            var builder = new ServiceCollection()
                .AddLogging()
                .AddMvc()
                .AddNewtonsoftJson()
                .Services.BuildServiceProvider();

            return builder
                .GetRequiredService<IOptions<MvcOptions>>()
                .Value
                .InputFormatters
                .OfType<NewtonsoftJsonPatchInputFormatter>()
                .First();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
    }
}
</code>```

I hope someone can tell what im doing wrong.

答:
use this; add-migration migration1
before you call update-database</p>

Title: C#: asp.net CORE empty Migration

Body:
I am trying to add a migration from DatabaseContext
but when I add an migration i generates it empty like this. I had been following this tutorial

namespace MovieExampleAppDotNetCore.Migrations
{
    using System;
    using System.Data.Entity.Migrations;

    public partial class ModelMigration : DbMigration
    {
        public override void Up()
        {
        }

        public override void Down()
        {
        }
    }
}

these are the models,Migration Configuration, Startup and DatabaseContext

Movie.cs

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace MovieExampleAppDotNetCore.Models
{
    public class Movie
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int MovieId { get; set; }
        public String Name { get; set; }

        [Column(TypeName = "datetime2")]
        public DateTime? DateCreated { get; set; }
    }
}

Customer.cs

using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using System.Threading.Tasks;

namespace MovieExampleAppDotNetCore.Models
{
    public class Customer
    {
        [Key]
        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int CustomerId { get; set; }
        public string Name { get; set; }
        public string LastName { get; set; }
        public bool IsCreated { get; set; }
        public int MaxMovies { get; set; }

        [Column(TypeName = "datetime2")]
        public DateTime Created { get; set; }

        [Column(TypeName = "datetime2")]
        public DateTime? LastEdited { get; set; }

    }
}

Configuration.cs

namespace MovieExampleAppDotNetCore.Migrations
{
    using System;
    using System.Data.Entity;
    using System.Data.Entity.Migrations;
    using System.Linq;

    internal sealed class Configuration : DbMigrationsConfiguration<MovieExampleApp.Persistention.DatabaseContext>
    {
        public Configuration()
        {
            AutomaticMigrationsEnabled = true;
        }

        protected override void Seed(MovieExampleApp.Persistention.DatabaseContext context)
        {

        //  This method will be called after migrating to the latest version.

        //  You can use the DbSet<T>.AddOrUpdate() helper extension method
        //  to avoid creating duplicate seed data.
    }
}

}

DatabaseContext.cs

using Microsoft.EntityFrameworkCore;
using MovieExampleAppDotNetCore.Models;
using System.Data.Entity;

namespace MovieExampleApp.Persistention
{
    public class DatabaseContext : System.Data.Entity.DbContext
    {
        public DatabaseContext() : base("main")
        {
            //Database.Initialize(true);
        }

        protected override void OnModelCreating(DbModelBuilder modelBuilder)
        {
            base.OnModelCreating(modelBuilder);
        }

        public Microsoft.EntityFrameworkCore.DbSet<Movie> Movies { get; set; }
        public Microsoft.EntityFrameworkCore.DbSet<Customer> Customers { get; set; }
    }
}

Startup.cs

using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Formatters;
using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Microsoft.Extensions.Options;
using MovieExampleApp.Persistention;
using System.Linq;

namespace MovieExampleAppDotNetCore
{
    public class Startup
    {
        public Startup(IConfiguration configuration)
        {
            Configuration = configuration;
        }

        public IConfiguration Configuration { get; }

        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {

            services.AddDbContext<DatabaseContext>(
                        options => options.UseSqlServer(Configuration.GetConnectionString("DatabaseContext")));

            services.AddControllersWithViews().AddNewtonsoftJson();

            services.AddControllersWithViews(options =>
            {
                options.InputFormatters.Insert(0, GetJsonPatchInputFormatter());
            });

        }

        private static NewtonsoftJsonPatchInputFormatter GetJsonPatchInputFormatter()
        {
            var builder = new ServiceCollection()
                .AddLogging()
                .AddMvc()
                .AddNewtonsoftJson()
                .Services.BuildServiceProvider();

            return builder
                .GetRequiredService<IOptions<MvcOptions>>()
                .Value
                .InputFormatters
                .OfType<NewtonsoftJsonPatchInputFormatter>()
                .First();
        }

        // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.
        public void Configure(IApplicationBuilder app, IWebHostEnvironment env)
        {
            if (env.IsDevelopment())
            {
                app.UseDeveloperExceptionPage();
            }
            else
            {
                app.UseExceptionHandler("/Home/Error");
                // The default HSTS value is 30 days. You may want to change this for production scenarios, see https://aka.ms/aspnetcore-hsts.
                app.UseHsts();
            }
            app.UseHttpsRedirection();
            app.UseStaticFiles();

            app.UseRouting();

            app.UseAuthorization();

            app.UseEndpoints(endpoints =>
            {
                endpoints.MapControllerRoute(
                    name: "default",
                    pattern: "{controller=Home}/{action=Index}/{id?}");
            });
        }
    }
}

I hope someone can tell what im doing wrong.


答:
you are decreasing the list size while iterating, so you are getting this issue. Try the below code and check!</p>

```<code>def zero_clear(tablica):
   count = 0
   while count < len(tablica):
      if tablica[count][1] == 0:
         del tablica[count]
      else:
         count += 1
   return tablica

for item in tablica:
   zero_clear(item)
print(tablica)
</code>```

Title: Delete list from the list matrix - Python

Body:
I created sorted matrix with ID/ Odometers/ Date. I really need to delete all list where 0 value is on the second position.
I prepared a function and loop but unfortunately I have still below error. I doubt that del [] method is used correctly ?

in zero_clear, if tablica[i][1] == 0: ****

tablica = [
            [
            [21091705,  0,'30.06.2019'],
            [21091705,  0,'29.06.2019'],
            [21091705,  653842,'29.06.2019'],
            [21091705,  641701,'28.06.2019'],
            [21091705,  642000,'27.06.2019'],
            [21091705,  0,'25.06.2019'],
            [21091705,  642030,'25.06.2019'],
            [21091705,  642030,'25.06.2019'],
            [21091705,  637030,'25.06.2019'],
            [21091705,  0,'25.06.2019'],
            [21091705,  0,'17.05.2019'],
            [21091705,  641256,'25.06.2019']
            ],
            [
            [21091703,  487000,'30.06.2019'],
            [21091703,  461524,'29.06.2019'],
            [21091703,  0,'29.06.2019'],
            [21091703,  0,'28.06.2019'],
            [21091703,  427701,'28.06.2019'],
            [21091703,  429000,'27.06.2019']
            ],
            [
            [21091701,  421077,'30.06.2019'],
            [21091701,  453777,'29.06.2019'],
            [21091701,  0,'29.06.2019'],
            [21091701,  427701,'28.06.2019'],
            [21091701,  433123,'27.06.2019']
            ],
            [
            [21091704,  491000,'30.06.2019'],
            [21091704,  0,'29.06.2019'],
            [21091704,  474542,'29.06.2019'],
            [21091704,  427701,'28.06.2019'],
            [21091704,  427701,'28.06.2019'],
            [21091704,  0,'27.06.2019']
            ]
            ]

def zero_clear(tablica):

    for i in range(len(tablica)):

        if tablica[i][1] == 0:
            del tablica[i]

    return tablica

for item in tablica:
    zero_clear(item)

Body:
you are decreasing the list size while iterating, so you are getting this issue. Try the below code and check!

def zero_clear(tablica):
   count = 0
   while count < len(tablica):
      if tablica[count][1] == 0:
         del tablica[count]
      else:
         count += 1
   return tablica

for item in tablica:
   zero_clear(item)
print(tablica)


问:
Inset data in firebase realtime database with react-native
I am using Firebase Realtime Database in my react-native project. I want to save the data in below formate

```<code>Images
Category 1
Image:
"/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgA...",
"/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgA..."
Category 2
Image:
"/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgA..."
</code>```

I want to store data depend upon categories. if I select category 1 the data is overwriting the old once, but I want to add without overwriting the previous data.
Is it possible to do so?

sample code

```<code>firebase.database().ref('Images/'+this.state.selectedValue).set({
    Image: this.state.imageSource,
  }).then(() =>{
    alert('saved')
  }).catch((error) =>{
  alert(JSON.stringify(error))
})
</code>```

答:
You are adding the new data to the old key so it is replacing it. You need to add a new key for every object like given below.

```<code>Images:{

Category 1:[{image1: "/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAA..."},image2:{"jmehyrjwrjewrghwe"} ],
Category 2:[ "/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgA..." ],image2:{"jmehyrjwrjewrghwe"} }
</code>```

Then it will work

Body:
I am using Firebase Realtime Database in my react-native project. I want to save the data in below formate

Images
Category 1
Image:
"/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgA...",
"/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgA..."
Category 2
Image:
"/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgA..."

I want to store data depend upon categories. if I select category 1 the data is overwriting the old once, but I want to add without overwriting the previous data.
Is it possible to do so?

sample code

firebase.database().ref('Images/'+this.state.selectedValue).set({
    Image: this.state.imageSource,
  }).then(() =>{
    alert('saved')
  }).catch((error) =>{
  alert(JSON.stringify(error))
})

Body:
You are adding the new data to the old key so it is replacing it. You need to add a new key for every object like given below.

Images:{

Category 1:[{image1: "/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAA..."},image2:{"jmehyrjwrjewrghwe"} ],
Category 2:[ "/9j/4AAQSkZJRgABAQAASABIAAD/4QBYRXhpZgAATU0AKgA..." ],image2:{"jmehyrjwrjewrghwe"} }

Then it will work


问:
Your query does not include the specified expression 'regNo' as part of an aggregate function
I am trying to find the car within a database that has spent the most days in the garage, but I keep getting this error. Any ideas?

```<code>SELECT MAX((dateOut - dateIn)) AS [Number of Days], job.regNo, Garage.garageName
FROM Job, Garage
WHERE garage.garageID = job.garageID;
</code>```

When running, I get the error "Your query does not include the specified expression 'regNo' as part of an aggregate function."

答:
First, if you want a list of all the jobs and how many days they took, you can do something like this:

```<code>select
    j.regNo,
    g.garageName,
    datediff(day,j.dateOut,j.dateIn) as [Number of Days]
from Job j
join Garage g on j.garageID = g.garageID
</code>```

You do not specify your RDBMS, so I've assumed SQL Server above and used datediff to get the number of days between two dates. If you are using a different RDBMS, you may need to use a different function to achieve this, but I'm not aware of being able to directly subtract one datetime from another without some conversion or a function to do so.

I also replaced your multi-table from clause with a join and included aliases for the tables, as this is usually the preferred approach to querying multiple tables.

To answer you original question, you can use the query above with an order by and top 1 to get what you're looking for:

```<code>select top 1
    j.regNo,
    g.garageName,
    datediff(day,j.dateOut,j.dateIn) as [Number of Days]
from Job j
join Garage g on j.garageID = g.garageID
order by datediff(day,j.dateOut,j.dateIn) desc
</code>```

Body:
I am trying to find the car within a database that has spent the most days in the garage, but I keep getting this error. Any ideas?

SELECT MAX((dateOut - dateIn)) AS [Number of Days], job.regNo, Garage.garageName
FROM Job, Garage
WHERE garage.garageID = job.garageID;

When running, I get the error "Your query does not include the specified expression 'regNo' as part of an aggregate function."

Body:
First, if you want a list of all the jobs and how many days they took, you can do something like this:

select
    j.regNo,
    g.garageName,
    datediff(day,j.dateOut,j.dateIn) as [Number of Days]
from Job j
join Garage g on j.garageID = g.garageID

You do not specify your RDBMS, so I've assumed SQL Server above and used datediff to get the number of days between two dates. If you are using a different RDBMS, you may need to use a different function to achieve this, but I'm not aware of being able to directly subtract one datetime from another without some conversion or a function to do so.

I also replaced your multi-table from clause with a join and included aliases for the tables, as this is usually the preferred approach to querying multiple tables.

To answer you original question, you can use the query above with an order by and top 1 to get what you're looking for:

select top 1
    j.regNo,
    g.garageName,
    datediff(day,j.dateOut,j.dateIn) as [Number of Days]
from Job j
join Garage g on j.garageID = g.garageID
order by datediff(day,j.dateOut,j.dateIn) desc


问:
Git Bash - string parameter with '/' at start is being expanded to a file path. How to stop this?
Earlier today, I was trying to generate a certificate with a DNSName entry in the SubjectAltName extension:

```<code>$ openssl req -new -subj "/C=GB/CN=foo" -addext "subjectAltName = DNS:foo.co.uk" \
-addext "certificatePolicies = 1.2.3.4" -key ./private-key.pem -out ~/req.pem
</code>```

This command led to the following error message:

name is expected to be in the format /type0=value0/type1=value1/type2=... where characters may be escaped by . This name is not in that format: 'C:/Program Files/Git/C=GB/CN=foo'
problems making Certificate Request

How can I stop Git Bash from treating this string parameter as a filepath, or at least stop it from making this alteration?

答:
Using MSYS_NO_PATHCONV=1 can be problematic if your script accesses files.

Prefixing with a double forward slash doesn't work for the specific case of OpenSSL, as it causes the first DN segment key to be read as "/C" instead of "C", so OpenSSL drops it, outputting:

```<code>req: Skipping unknown attribute "/C"
</code>```

Instead, I used a function that detects if running on bash for Windows, and prefixes with a "dummy" segment if so:

# If running on bash for Windows, any argument starting with a forward slash is automatically
# interpreted as a drive path. To stop that, you can prefix with 2 forward slashes instead
# of 1 - but in the specific case of openssl, that causes the first CN segment key to be read as
# "/O" instead of "O", and is skipped. We work around that by prefixing with a spurious segment,
# which will be skipped by openssl
function fixup_cn_subject() {
    local result="${1}"
    case $OSTYPE in
        msys|win32) result="//XX=x${result}"
    esac
    echo "$result"
}

# Usage example
MY_SUBJECT=$(fixup_cn_subject "/C=GB/CN=foo")
```

Body:
Earlier today, I was trying to generate a certificate with a DNSName entry in the SubjectAltName extension:

$ openssl req -new -subj "/C=GB/CN=foo" -addext "subjectAltName = DNS:foo.co.uk" \
-addext "certificatePolicies = 1.2.3.4" -key ./private-key.pem -out ~/req.pem

This command led to the following error message:

name is expected to be in the format /type0=value0/type1=value1/type2=... where characters may be escaped by . This name is not in that format: 'C:/Program Files/Git/C=GB/CN=foo'
problems making Certificate Request

How can I stop Git Bash from treating this string parameter as a filepath, or at least stop it from making this alteration?

Body:
Using MSYS_NO_PATHCONV=1 can be problematic if your script accesses files.

Prefixing with a double forward slash doesn't work for the specific case of OpenSSL, as it causes the first DN segment key to be read as "/C" instead of "C", so OpenSSL drops it, outputting:

req: Skipping unknown attribute "/C"

Instead, I used a function that detects if running on bash for Windows, and prefixes with a "dummy" segment if so:

# If running on bash for Windows, any argument starting with a forward slash is automatically
# interpreted as a drive path. To stop that, you can prefix with 2 forward slashes instead
# of 1 - but in the specific case of openssl, that causes the first CN segment key to be read as
# "/O" instead of "O", and is skipped. We work around that by prefixing with a spurious segment,
# which will be skipped by openssl
function fixup_cn_subject() {
    local result="${1}"
    case $OSTYPE in
        msys|win32) result="//XX=x${result}"
    esac
    echo "$result"
}

# Usage example
MY_SUBJECT=$(fixup_cn_subject "/C=GB/CN=foo")


问:
Get list of application packages available for a batch account of Azure Batch
I'm making a python app that launches a batch.
I want, via user inputs, to create a pool.
For simplicity, I'll just add all the applications present in the batch account to the pool.
I'm not able to get the list of available application packages.
This is the portion of code:

```<code>import azure.batch.batch_service_client as batch
from azure.common.credentials import ServicePrincipalCredentials

credentials = ServicePrincipalCredentials(
    client_id='xxxxx',
    secret='xxxxx',
    tenant='xxxx',
    resource="https://batch.core.windows.net/"
)
batch_client = batch.BatchServiceClient(
    credentials,
    base_url=self.AppData['CloudSettings'][0]['BatchAccountURL'])
# Get list of applications
batchApps = batch_client.application.list()
</code>```

I can create a pool, so credentials are good and there are applications but the returned list is empty.
Can anybody help me with this?

Thank you,
Guido

Update:

I tried:

```<code>import azure.batch.batch_service_client as batch

batchApps = batch.ApplicationOperations.list(batch_client)
</code>```

and

```<code>import azure.batch.operations as batch_operations

batchApps = batch_operations.ApplicationOperations.list(batch_client)
</code>```

but they don't seem to work. batchApps is always empty.
I don't think it's an authentication issue since I'd get an error otherwise.
At this point I wonder if it just a bug in the python SDK?

The SDK version I'm using is:

azure.batch: 4.1.3

azure: 4.0.0

This is a screenshot of the empty batchApps var:

答:
I haven't tried lately using the Azure Python SDK but the way I solved this was to use the Azure REST API:
https://learn.microsoft.com/en-us/rest/api/batchservice/application/list

For the authorization, I had to create an application and give it access to the Batch services and the I programmatically generated the token with the following request:

```<code>data = {'grant_type': 'client_credentials',
    'client_id': clientId,
    'client_secret': clientSecret,
    'resource': 'https://batch.core.windows.net/'}

postReply = requests.post('https://login.microsoftonline.com/' + tenantId + '/oauth2/token', data)
</code>```

Body:
I'm making a python app that launches a batch.
I want, via user inputs, to create a pool.
For simplicity, I'll just add all the applications present in the batch account to the pool.
I'm not able to get the list of available application packages.
This is the portion of code:

import azure.batch.batch_service_client as batch
from azure.common.credentials import ServicePrincipalCredentials

credentials = ServicePrincipalCredentials(
    client_id='xxxxx',
    secret='xxxxx',
    tenant='xxxx',
    resource="https://batch.core.windows.net/"
)
batch_client = batch.BatchServiceClient(
    credentials,
    base_url=self.AppData['CloudSettings'][0]['BatchAccountURL'])
# Get list of applications
batchApps = batch_client.application.list()

I can create a pool, so credentials are good and there are applications but the returned list is empty.
Can anybody help me with this?

Thank you,
Guido

Update:

I tried:

import azure.batch.batch_service_client as batch

batchApps = batch.ApplicationOperations.list(batch_client)

and

import azure.batch.operations as batch_operations

batchApps = batch_operations.ApplicationOperations.list(batch_client)

but they don't seem to work. batchApps is always empty.
I don't think it's an authentication issue since I'd get an error otherwise.
At this point I wonder if it just a bug in the python SDK?

The SDK version I'm using is:

azure.batch: 4.1.3

azure: 4.0.0

This is a screenshot of the empty batchApps var:

Body:
I haven't tried lately using the Azure Python SDK but the way I solved this was to use the Azure REST API:
https://learn.microsoft.com/en-us/rest/api/batchservice/application/list

For the authorization, I had to create an application and give it access to the Batch services and the I programmatically generated the token with the following request:

data = {'grant_type': 'client_credentials',
    'client_id': clientId,
    'client_secret': clientSecret,
    'resource': 'https://batch.core.windows.net/'}

postReply = requests.post('https://login.microsoftonline.com/' + tenantId + '/oauth2/token', data)


问:
Got "Fatal error: Index out of range" : show index in list item for swiftui
Updated: error: Type '_' has no member '1', if put a if closure(if !self.showMarkedOnly || name.marked {}) inside list-foreach, why?

Code version 4:

```<code>struct Name: Identifiable, Hashable {
    var id: String = UUID().uuidString
    var name: String
    var marked: Bool
    init(_ name: String, marked: Bool = false) { self.name = name; self.marked = marked }
}

struct TestView: View {
    @State private var list: [Name] = [Name("test1"), Name("test2"), Name("test3", marked: true), Name("test4"), Name("test5", marked: true), Name("test6"), Name("test7"), Name("test8")]
    @State private var showMarkedOnly = false

    var body: some View {
        VStack{
            Toggle(isOn: $showMarkedOnly) { Text("show marked only") }
            List {
                ForEach(Array(zip(0..., list)), id: \.1.id) { index, name in
//                    if !self.showMarkedOnly || name.marked {
                        HStack {
                            Text("\(index)").foregroundColor(name.marked ? .red : .gray)
                            Spacer()
                            Text("\(name.name)")
                        }
                        .background(Color.gray.opacity(0.001))
                        .onTapGesture {
                            self.list.remove(at: index)
                        }
//                    }
                }
            }
        }
    }
}
</code>```

=========

Updated: I found the issue of Code version 2, I must provide a id for ForEach. And Code version 2 updated.

I found a graceful way to show index, It avoids self.list[index]. But I found an error "Type '_' has no member '1'" occurred in some complex code.

Code version 3:

```<code>var body: some View {
        List {
            ForEach(Array(zip(0..., list)), id: \.1.id) { index, name in // a error occurs in some complex code: "Type '_' has no member '1'"
                HStack {
                    Text("\(index)")
                    Spacer()
                    Text("\(name.name)")
                }
                .background(Color.gray.opacity(0.001))
                .onTapGesture {
                    self.list.remove(at: index)
                }
            }
        }
    }
</code>```

I show a list, and remove the item I tapped. It's Code version 1, it works fine.
When I add index into the list item using indices(Code veriosn 2), got "Fatal error: Index out of range" after tapping.

Code version 1:

```<code>struct Name: Identifiable, Hashable {
    var id: String = UUID().uuidString
    var name: String
    init(_ name: String) { self.name = name }
}

struct TestView: View {
    @State private var list: [Name] = [Name("test1"), Name("test2"), Name("test3"), Name("test4"), Name("test5"), Name("test6"), Name("test7"), Name("test8")]

    var body: some View {
        List {
            ForEach(list) { name in
                HStack {
                    Text("\(0)")
                    Spacer()
                    Text("\(name.name)")
                }
                .background(Color.gray.opacity(0.001))
                .onTapGesture {
                    self.list = self.list.filter { $0 != name }
                }
            }
        }
    }
}
</code>```

Code version 2:

```<code>struct TestView: View {
    @State private var list: [Name] = [Name("test1"), Name("test2"), Name("test3"), Name("test4"), Name("test5"), Name("test6"), Name("test7"), Name("test8")]

    var body: some View {
        List {
            //ForEach(list.indices) { index in
            ForEach(list.indices, id: \.self) { index in
                HStack {
                    Text("\(index)")
                    Spacer()
                    Text("\(self.list[index].name)")
                }
                .background(Color.gray.opacity(0.001))
                .onTapGesture {
                    self.list.remove(at: index)
                }
            }
        }
    }
}
</code>```

答:
It's because indices is not your state, the array is. So you update the array but @State isn't actually smart enough to update computed or downstream properties of the value it wraps. If you want the index, make that the source of identifiers in your ForEach:

ForEach(0..<list.count, id: \.self) {
    // the rest should be ok here
}
```

Body:
Updated: error: Type '_' has no member '1', if put a if closure(if !self.showMarkedOnly || name.marked {}) inside list-foreach, why?

Code version 4:

struct Name: Identifiable, Hashable {
    var id: String = UUID().uuidString
    var name: String
    var marked: Bool
    init(_ name: String, marked: Bool = false) { self.name = name; self.marked = marked }
}

struct TestView: View {
    @State private var list: [Name] = [Name("test1"), Name("test2"), Name("test3", marked: true), Name("test4"), Name("test5", marked: true), Name("test6"), Name("test7"), Name("test8")]
    @State private var showMarkedOnly = false

    var body: some View {
        VStack{
            Toggle(isOn: $showMarkedOnly) { Text("show marked only") }
            List {
                ForEach(Array(zip(0..., list)), id: \.1.id) { index, name in
//                    if !self.showMarkedOnly || name.marked {
                        HStack {
                            Text("\(index)").foregroundColor(name.marked ? .red : .gray)
                            Spacer()
                            Text("\(name.name)")
                        }
                        .background(Color.gray.opacity(0.001))
                        .onTapGesture {
                            self.list.remove(at: index)
                        }
//                    }
                }
            }
        }
    }
}

=========

Updated: I found the issue of Code version 2, I must provide a id for ForEach. And Code version 2 updated.

I found a graceful way to show index, It avoids self.list[index]. But I found an error "Type '_' has no member '1'" occurred in some complex code.

Code version 3:

var body: some View {
        List {
            ForEach(Array(zip(0..., list)), id: \.1.id) { index, name in // a error occurs in some complex code: "Type '_' has no member '1'"
                HStack {
                    Text("\(index)")
                    Spacer()
                    Text("\(name.name)")
                }
                .background(Color.gray.opacity(0.001))
                .onTapGesture {
                    self.list.remove(at: index)
                }
            }
        }
    }

I show a list, and remove the item I tapped. It's Code version 1, it works fine.
When I add index into the list item using indices(Code veriosn 2), got "Fatal error: Index out of range" after tapping.

Code version 1:

struct Name: Identifiable, Hashable {
    var id: String = UUID().uuidString
    var name: String
    init(_ name: String) { self.name = name }
}

struct TestView: View {
    @State private var list: [Name] = [Name("test1"), Name("test2"), Name("test3"), Name("test4"), Name("test5"), Name("test6"), Name("test7"), Name("test8")]

    var body: some View {
        List {
            ForEach(list) { name in
                HStack {
                    Text("\(0)")
                    Spacer()
                    Text("\(name.name)")
                }
                .background(Color.gray.opacity(0.001))
                .onTapGesture {
                    self.list = self.list.filter { $0 != name }
                }
            }
        }
    }
}

Code version 2:

struct TestView: View {
    @State private var list: [Name] = [Name("test1"), Name("test2"), Name("test3"), Name("test4"), Name("test5"), Name("test6"), Name("test7"), Name("test8")]

    var body: some View {
        List {
            //ForEach(list.indices) { index in
            ForEach(list.indices, id: \.self) { index in
                HStack {
                    Text("\(index)")
                    Spacer()
                    Text("\(self.list[index].name)")
                }
                .background(Color.gray.opacity(0.001))
                .onTapGesture {
                    self.list.remove(at: index)
                }
            }
        }
    }
}


问:
Unable to open site url in browser
I have created simple basic automation script in Python using Selenium..
Getting unwanted exception.

File:-

```<code>import pandas as pd
from pandas import ExcelWriter
from selenium import webdriver

import selenium as sel

# Data = pd.read_excel(r"C:\Users\Admin\PycharmProjects\Web_Automation_Form_Filling\challenge.xlsx",sheet_name="Sheet1")

# browser = webdriver.Chrome(executable_path=r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe')
browser = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe");
browser.sleep(1000);
browser.get("http://www.python.org")
</code>```

Error log:-

```<code>C:\Users\Admin\PycharmProjects\Web_Automation_Form_Filling\venv\Scripts\python.exe C:/Users/Admin/PycharmProjects/Web_Automation_Form_Filling/venv/Web_Auto_Filling.py
Traceback (most recent call last):
  File "C:/Users/Admin/PycharmProjects/Web_Automation_Form_Filling/venv/Web_Auto_Filling.py", line 10, in <module>
    browser = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe");
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 98, in start
    self.assert_process_still_running()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 109, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0

Process finished with exit code 1
</code>```

Any suggestion will be appreciated..
Thanks...

答:
instead of chrome application try providing the chrome driver instead
more information on the site : https://sites.google.com/a/chromium.org/chromedriver/getting-started

Sample code :

```<code>import time
from selenium import webdriver

driver = webdriver.Chrome('/path/to/chromedriver')  # Optional argument, if not specified will search path.
driver.get('http://www.google.com/');
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5) # Let the user actually see something!
driver.quit()
</code>```

Download the ChromeDriver binary for your platform under the downloads section of this site
reference link to download : chrome driver

Title: Unable to open site url in browser

Body:
I have created simple basic automation script in Python using Selenium..
Getting unwanted exception.

File:-

import pandas as pd
from pandas import ExcelWriter
from selenium import webdriver

import selenium as sel

# Data = pd.read_excel(r"C:\Users\Admin\PycharmProjects\Web_Automation_Form_Filling\challenge.xlsx",sheet_name="Sheet1")

# browser = webdriver.Chrome(executable_path=r'C:\Program Files (x86)\Google\Chrome\Application\chrome.exe')
browser = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe");
browser.sleep(1000);
browser.get("http://www.python.org")

Error log:-

C:\Users\Admin\PycharmProjects\Web_Automation_Form_Filling\venv\Scripts\python.exe C:/Users/Admin/PycharmProjects/Web_Automation_Form_Filling/venv/Web_Auto_Filling.py
Traceback (most recent call last):
  File "C:/Users/Admin/PycharmProjects/Web_Automation_Form_Filling/venv/Web_Auto_Filling.py", line 10, in <module>
    browser = webdriver.Chrome("C:\Program Files (x86)\Google\Chrome\Application\chrome.exe");
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 73, in __init__
    self.service.start()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 98, in start
    self.assert_process_still_running()
  File "C:\Users\Admin\AppData\Local\Programs\Python\Python38-32\lib\site-packages\selenium\webdriver\common\service.py", line 109, in assert_process_still_running
    raise WebDriverException(
selenium.common.exceptions.WebDriverException: Message: Service C:\Program Files (x86)\Google\Chrome\Application\chrome.exe unexpectedly exited. Status code was: 0

Process finished with exit code 1

Any suggestion will be appreciated..
Thanks...

Body:
instead of chrome application try providing the chrome driver instead
more information on the site : https://sites.google.com/a/chromium.org/chromedriver/getting-started

Sample code :

import time
from selenium import webdriver

driver = webdriver.Chrome('/path/to/chromedriver')  # Optional argument, if not specified will search path.
driver.get('http://www.google.com/');
time.sleep(5) # Let the user actually see something!
search_box = driver.find_element_by_name('q')
search_box.send_keys('ChromeDriver')
search_box.submit()
time.sleep(5) # Let the user actually see something!
driver.quit()

Download the ChromeDriver binary for your platform under the downloads section of this site
reference link to download : chrome driver


问:
Typescript Pick Array not working as expected
I'm not sure why there is a problem if i use this line as array and how to fix it:

```<code>Pick<Author, PickedAuthorFields>[]
</code>```

Sandbox.

If i use never instead of conditional type, than i have another problem with required author field.

Sanbox 2

Sandbox 3 with optional ? author had another problems...

Sanbox 3

This ApiResBook generic type is needed for many pages that will make requests to api with different expected output fields based on request.

Maybe there is alternative approach, i can change shape of object if needed.

```<code>// Main types as in database - should't be changed
type Book = {
  id: string
  title: string
  visible: boolean
  author: string
}

type Author = {
  id: string
  name: string
}

// Inhereted from types from main
type BookFields = keyof Book
type AuthorFields = keyof Author

// type for generating expected fetch response from API
type ApiResBook<
  PickedBookFields extends BookFields,
  PickedAuthorFields extends AuthorFields | undefined = undefined,
> = {
  book: Pick<Book, PickedBookFields> & {
    author: PickedAuthorFields extends AuthorFields ? Pick<Author, PickedAuthorFields>[] : undefined
  }
}

// tests
type BookWithAuthor = ApiResBook<'id', 'name' | 'id'>

// should be ok
const bookWithAuthor1: BookWithAuthor = { book: { id: '1', author: [{ id: '1' }] } }
const bookWithAuthor2: BookWithAuthor = { book: { id: '1', author: [{ name: 'Max' }] } }
const bookWithAuthor3: BookWithAuthor = { book: { id: '1', author: [{ name: 'Max', id: '1' }] } } // why error?
</code>```

答:
It was a while to figurate out but I think this is the solution:

```<code>type Book = {
  id: string
  title: string
  visible: boolean
  author: string
}

type Author = {
  id: string
  name: string
}

// Inhereted from types from main
type BookFields = keyof Book
type AuthorFields = keyof Author

// type for generating expected fetch response from API
type ApiResBook<
  PickedBookFields extends BookFields,
  PickedAuthorFields extends AuthorFields | null = null,
  AuthorObj = {author: Pick<Author, Exclude<PickedAuthorFields, null>>[]}
> = {
    book: Pick<Book, PickedBookFields> & (PickedAuthorFields extends null ? {} : AuthorObj)
}

// tests
type BookWithAuthor = ApiResBook<'id', 'name' | 'id'>
type BookWithoutAuthor = ApiResBook<'id'>

// should be ok
const bookWithAuthor0: BookWithoutAuthor = { book: { id: '1' } }
const bookWithAuthor3: BookWithAuthor = { book: { id: '1', author: [{ id: '1', name: 'Max' }] } }
</code>```

PS. null can be replaced by undefined or any other unit type

Body:
I'm not sure why there is a problem if i use this line as array and how to fix it:

Pick<Author, PickedAuthorFields>[]

<a href="https://www.typescriptlang.org/play/?ssl=1&ssc=1&pln=36&pc=1#code/PTAEFkEMEsDtQC4E8AOBTAzqSW6gCaQKQBGOaoAtKBgBYD2ArgDb4DkCoJFAxrZLADmafAFgAUMnSgAQvXoBrUAF5QAbwmhQ0fAC4aCAE5xBmxNATM0%20jEZNmAbtAzQSV-SXlWBZyIwQMhjZ2QhIAvhISUhQAgv6BKupmOsHGoeJasJAAttYGaabiEeISIKAAkrC0aIZoCCKgAGaG9NmIqJhNLW3ZMLBRHbLyCgBi0GisWKoKaEj0jUOKA9JxAfSGYxP4U6AzcwurgZHiZdFN66DCsDVEJqBoAB7oPPX4TXV8oLUYKPSwGBRmq1QDEAArlZaxFDQABKmDkigAPGZQdAeDN8AjRuNJvcHvVYNtFtithgADQotEYw7rTa4x4Eok0jY4okAH1AjEJaEacAaqi5%20B5fPwFPEAD5EhoMlxhvpUejEViyaAFRisXTtpKAGRJGVaPxrIKqqkiZmarAMtCErDm1lYAD8JsVzJVarN8Vp9vFAG0ALqgfSC4XXMQy4rFY6nTAIDCQ4kAdQstGZiRi0LhGCxiLYOjYKrYWVybFAHNz7HFUbAdCYrC4FCW4h4f1sssUSYCzIAjPosR2U57DFK2wp9GptHpQGwu-nsIP9D7xykpzPQGEA2E1xJm-9OJ528nmQAmXvDfup1Tj-ej9QT-TT2eGwIL8dFvJsKAPEvrtdbpstvcz0PQcAGZTwPTtB2Ha8xzvFdH3nUBF1AN970-WdlwfNcN1-MoAHdaCQe5DBaQwHQkIA" rel="nofollow noreferrer">Sandbox.

If i use never instead of conditional type, than i have another problem with required author field.

<a href="https://www.typescriptlang.org/play/?ssl=36&ssc=89&pln=34&pc=65#code/PTAEFkEMEsDtQC4E8AOBTAzqSW6gCaQKQBGOaoAtKBgBYD2ArgDb4DkCoJFAxrZLADmafAFgAUMnSgAQvXoBrUAF5QAbwmhQ0fAC4aCAE5xBmxNATM0%20jEZNmAbtAzQSV-SXlWBZyIwQMhjZ2QhIAvhISUhQAgv6BKupmOsHGoeJasJAAttYGaabiEeISIKAAkrC0aIZoCCKgAGaG9NmIqJhNLW3ZMLBRHbLyCgBi0GisWKoKaEj0jUOKA9JxAfSGYxP4U6AzcwurgZHiZdFN66DCsDVEJqBoAB7oPPX4TXV8oLUYKPSwGBRmq1QDEAArlZaxFDQABKmDkigAPGZQdAeDN8AjRuNJvcHvVYNtFtithgADQotEYw7rTa4x4Eok0jY4omqa4OGoU8QAPkSGgyXGG%20lR6MRWLJoFFGKxdO2fIAZElBVo-GsglKqYjmZLpSJmXKMDyANoAXTMxWKx1OmAQGEhxIA6hZaMzEjFoXCMFjEWwdGxJWwsrk2KAAD6gP3sHkOrHOtb%20N2qD2w%20HDX3%20mMlE5gOhMVhcChLcQ8P62IWKeOu%20LrAAM%20jjLqYCCT6grCn0am0ekjAEZQ2FQMVS-9OJ5Ky7mQBmBvDKutrvjjttlJ9gPYGsa41d4N5NhQB7r1dsftD01Di9lADutCQ90MLUMAH4JEA" rel="nofollow noreferrer">Sanbox 2

Sandbox 3 with optional ? author had another problems...

<a href="https://www.typescriptlang.org/play/?ssl=39&ssc=24&pln=39&pc=41#code/PTAEFkEMEsDtQC4E8AOBTAzqSW6gCaQKQBGOaoAtKBgBYD2ArgDb4DkCoJFAxrZLADmafAFgAUMnSgAQvXoBrUAF5QAbwmhQ0fAC4aCAE5xBmxNATM0%20jEZNmAbtAzQSV-SXlWBZyIwQMhjZ2QhIAvhISUhQAgv6BKupmOsHGoeJasJAAttYGaabiEeISIKAAkrC0aIZoCCKgAGaG9NmIqJhNLW3ZMLBRHbLyCgBi0GisWKoKaEj0jUOKA9JxAfSGYxP4U6AzcwurgZHiZdFN66DCsDVEJqBoAB7oPPX4TXV8oLUYKPSwGBRmq1QDEAArlZaxFDQABKmDkigAPGZQdAeDN8AjRuNJvcHvVYNtFtithgADQotEYw7rTa4x4Eok0jY4omqa4OGoU8QAPkSGgyXGG%20lR6MRWLJoFFGKxdO2fIAZElBVo-GtDAB%20EVUxHMyXSkTMuUYHkAbQAumZisVjqdMAgMJDiQB1Cy0ZmJGLQuEYLGItg6NiSthZXJsUAAH1AAfYPKdWNda38HtUXth8OG-sDcZKJzAdCYrC4FCW4h4f1sQsUifd8XWAAZ9Am3UwECn1FWFPo1No9NGAIzhsKgYrl-6cTzVt3MgDMTeGNfbPcnXY7KQHQewdaCoFNPdDeTYUAem-XbEHI-NI%20vZQA7rQkPdDC1Nbb8wwWG9uE%20XxIx5WV0XbcABZ5ynJM223flO27Xt9HPTc1UCfQ91AA94OPU8%20wQy9r2HP8KwnBdp23ABWMCFCA9VoJXWCzwvYdiiAA" rel="nofollow noreferrer">Sanbox 3

This ApiResBook generic type is needed for many pages that will make requests to api with different expected output fields based on request.

Maybe there is alternative approach, i can change shape of object if needed.

// Main types as in database - should't be changed
type Book = {
  id: string
  title: string
  visible: boolean
  author: string
}

type Author = {
  id: string
  name: string
}

// Inhereted from types from main
type BookFields = keyof Book
type AuthorFields = keyof Author

// type for generating expected fetch response from API
type ApiResBook<
  PickedBookFields extends BookFields,
  PickedAuthorFields extends AuthorFields | undefined = undefined,
> = {
  book: Pick<Book, PickedBookFields> & {
    author: PickedAuthorFields extends AuthorFields ? Pick<Author, PickedAuthorFields>[] : undefined
  }
}

// tests
type BookWithAuthor = ApiResBook<'id', 'name' | 'id'>

// should be ok
const bookWithAuthor1: BookWithAuthor = { book: { id: '1', author: [{ id: '1' }] } }
const bookWithAuthor2: BookWithAuthor = { book: { id: '1', author: [{ name: 'Max' }] } }
const bookWithAuthor3: BookWithAuthor = { book: { id: '1', author: [{ name: 'Max', id: '1' }] } } // why error?

Body:
It was a while to figurate out but I think this is the solution:

type Book = {
  id: string
  title: string
  visible: boolean
  author: string
}

type Author = {
  id: string
  name: string
}

// Inhereted from types from main
type BookFields = keyof Book
type AuthorFields = keyof Author

// type for generating expected fetch response from API
type ApiResBook<
  PickedBookFields extends BookFields,
  PickedAuthorFields extends AuthorFields | null = null,
  AuthorObj = {author: Pick<Author, Exclude<PickedAuthorFields, null>>[]}
> = {
    book: Pick<Book, PickedBookFields> & (PickedAuthorFields extends null ? {} : AuthorObj)
}

// tests
type BookWithAuthor = ApiResBook<'id', 'name' | 'id'>
type BookWithoutAuthor = ApiResBook<'id'>

// should be ok
const bookWithAuthor0: BookWithoutAuthor = { book: { id: '1' } }
const bookWithAuthor3: BookWithAuthor = { book: { id: '1', author: [{ id: '1', name: 'Max' }] } }

PS. null can be replaced by undefined or any other unit type


问:
react function component inside class component, is a valid component ? What is the difference?
I'm trying to return a function component after the condition is checked within a class component. Here is my code:

```<code> class Page extends React.Component {
  constructor(props) {
    super(props);
    this.state = props.warn;
  }

   function WarningBanner() {
    if (this.state == false) {
      return null;
    }

    return (
      <div className="warning">
        Warning!
      </div>
    );
  }
  render() {
    return (
      <div>
        <WarningBanner />
      </div>
    );
  }
}

ReactDOM.render(
  <Page warn={true}/>,
  document.getElementById('root')
);
</code>```

Is a function component inside a class component considered a valid component ? Or is there a another way to define a function component inside a class component?

What is the difference between a function component inside class component or a function component outside a class component ?

I have also tried doing this:

```<code><WarningBanner warn = {this.state}/>
</code>```

And

```<code>function WarningBanner(warning) {
    if (warning.warn == false) {
      return null;
    }
    return (<div className="warning">Warning!</div>);
  }
</code>```

答:
I don't think nesting the definition of components like that is idiomatic.

Data can be shared between components using properties.

You can show or hide the banner using a conditional (here, I use the && operator) in your Page component like so:

function WarningBanner({message}) {
    return (
Warning!
)
}

class Page extends React.Component {
  render() {
    return (

        { this.props.showWarning && <WarningBanner /> }

    )
  }
}

ReactDOM.render(
    <Page showWarning={true} />,
    document.getElementById('root')
)```
<pre class="snippet-code-css lang-css prettyprint-override"><code>* {
  font-family: sans-serif;
  margin: 0;
}
button {
  height: 40px;
  width: 200px;
}
.warning {
  background-color: red;
  text-align: center;
  width: 100%;
  padding: 10px;

  font-size: 14pt;
  color: white;
}</code>```

```

Body:
I'm trying to return a function component after the condition is checked within a class component. Here is my code:

 class Page extends React.Component {
  constructor(props) {
    super(props);
    this.state = props.warn;
  }

   function WarningBanner() {
    if (this.state == false) {
      return null;
    }

    return (

        Warning!

    );
  }
  render() {
    return (

        <WarningBanner />

    );
  }
}

ReactDOM.render(
  <Page warn={true}/>,
  document.getElementById('root')
);

Is a function component inside a class component considered a valid component ? Or is there a another way to define a function component inside a class component?

What is the difference between a function component inside class component or a function component outside a class component ?

I have also tried doing this:

<WarningBanner warn = {this.state}/>

And

function WarningBanner(warning) {
    if (warning.warn == false) {
      return null;
    }
    return (
Warning!
);
  }

Body:
I don't think nesting the definition of components like that is idiomatic.

Data can be shared between components using properties.

You can show or hide the banner using a conditional (here, I use the && operator) in your Page component like so:

function WarningBanner({message}) {
    return (<div className="warning">Warning!</div>)
}

class Page extends React.Component {
  render() {
    return (
      <div>
        { this.props.showWarning && <WarningBanner /> }
      </div>
    )
  }
}

ReactDOM.render(
    <Page showWarning={true} />,
    document.getElementById('root')
)

* {
  font-family: sans-serif;
  margin: 0;
}
button {
  height: 40px;
  width: 200px;
}
.warning {
  background-color: red;
  text-align: center;
  width: 100%;
  padding: 10px;

  font-size: 14pt;
  color: white;
}

<script src="https://cdnjs.cloudflare.com/ajax/libs/react/16.6.3/umd/react.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.6.3/umd/react-dom.production.min.js"></script>

<div id="root"></div>


问:
Order of cancellation of effects (useEffect) in React
when a component is unmounted, for some reason, the effect is canceled first for the parent component, and then for the child components... (we are talking about useEffect hooks)

It doesn't make sense...

What could be the problem?

The problem is that I have map routes in my child components.. And when routes are unmounted, they try to delete themselves in the map... and the map has already been removed, because the cancellation of the effect for the parent component is called earlier than for the child components (the child components learn about the parent through the context)

https://codesandbox.io/s/ocherednost-otmeny-effektov-g0z0r

See the browser console

I expect:
Child cancel useEffect
Parent cancel useEffect

答:
https://github.com/facebook/react/issues/16728

We guarantee that parent effects are destroyed before the child ones. The reason for this is that parents often tend to depend on some resource created by the child. Such as removing a listener from a DOM node managed imperatively by a child. If the child disposes its resources first, the parent might not be able to properly clean itself up. This is not specific to Hooks — it’s how componentWillUnmount works as well.

We do not make guarantees about sibling order, whether within a component or between siblings. This is because strong guarantees there hinder refactoring. Within a component, you should be able to re-order Hooks—especially, custom ones. Between siblings, it is expected that you can re-order them safely too. It is also common that only one sibling updates or unmounts, so dependencies between siblings cannot be reliable anyway.


问:
Load CSS Module Wise in Angular
Here is the scenario -

I have multiple modules in my angular application. Ex -

```<code>app.module.ts
    student.module.ts
        component A
        component B
        component C
    admin.module.ts
        component A
        component B
        component C
    .
    .
    .
</code>```

As per the above hierarchy , I have two  new modules(student & admin) and each module has separate components.

Now I want to load CSS file module wise so that it can be apply on all components of that module , not outside that module.

If I call CSS file in style.css then it will be apply globally which I don't want.

So is there any way to do this because I don't want to write CSS in each component's css file because it is common for specific module's components.

答:
I don't now if it work but you try this:

Put this in your component:

```<code> import 'path/folder/module.css';
</code>```

Put the .css path in this import

Title: Load CSS Module Wise in Angular

Body:
Here is the scenario -

I have multiple modules in my angular application. Ex -

app.module.ts
    student.module.ts
        component A
        component B
        component C
    admin.module.ts
        component A
        component B
        component C
    .
    .
    .

As per the above hierarchy , I have two  new modules(student & admin) and each module has separate components.

Now I want to load CSS file module wise so that it can be apply on all components of that module , not outside that module.

If I call CSS file in style.css then it will be apply globally which I don't want.

So is there any way to do this because I don't want to write CSS in each component's css file because it is common for specific module's components.

Body:
I don't now if it work but you try this:

Put this in your component:

 import 'path/folder/module.css';

Put the .css path in this import