问:
While creating new project java project with play using 'sbt new playframework/play-java-seed.g8' not working getting error
I've just started to play with framework tutorials. Installed SBT in my windows machine when am trying to create new java project with sbt new playframework/play-java-seed.g8 command getting below error. Please help me to understand and fix this issue. Please how to get started with the new project using java and play.

```<code>"C:\Users\praveena\.sbt\preloaded\org.scala-sbt\sbt\"1.0.0"\jars\sbt.jar"
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\praveena\project
[info] Set current project to praveena (in build file:/C:/Users/praveena/)
13:05:47.274 [main] ERROR org.eclipse.jgit.util.FS - Caught exception in FS.readPipe()
java.io.IOException: Cannot run program "bash" (in directory "C:\Users\praveena"): CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[?:1.8.0_121]
        at java.lang.Runtime.exec(Runtime.java:620) ~[?:1.8.0_121]
        at org.eclipse.jgit.util.FS.readPipe(FS.java:431) ~[?:?]
        at org.eclipse.jgit.util.FS_Win32.discoverGitPrefix(FS_Win32.java:113) ~[?:?]
        at org.eclipse.jgit.util.FS.gitPrefix(FS.java:517) ~[?:?]
        at org.eclipse.jgit.util.SystemReader$Default.openSystemConfig(SystemReader.java:92) ~[?:?]
        at org.eclipse.jgit.internal.storage.file.FileRepository.<init>(FileRepository.java:171) ~[?:?]
        at org.eclipse.jgit.lib.BaseRepositoryBuilder.build(BaseRepositoryBuilder.java:577) ~[?:?]
        at org.eclipse.jgit.api.InitCommand.call(InitCommand.java:113) ~[?:?]
        at org.eclipse.jgit.api.CloneCommand.init(CloneCommand.java:161) ~[?:?]
        at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:132) ~[?:?]
        at giter8.JgitHelper$.clone(JgitHelper.scala:116) ~[?:?]
        at giter8.JgitHelper$.run(JgitHelper.scala:67) ~[?:?]
        at giter8.JgitHelper$.run(JgitHelper.scala:80) ~[?:?]
        at giter8.Giter8.$anonfun$run$2(giter8.scala:34) ~[?:?]
        at scala.Option.map(Option.scala:146) ~[scala-library.jar:1.0.0]
        at giter8.Giter8.run(giter8.scala:33) ~[?:?]
        at sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
        at sbt.TemplateCommandUtil$.call(TemplateCommand.scala:93) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:71) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:51) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:47) ~[main_2.12-1.0.0.jar:1.0.0]
        at scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111) ~[scala-library.jar:1.0.0]
        at scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108) ~[scala-library.jar:1.0.0]
        at scala.collection.immutable.List.find(List.scala:86) ~[scala-library.jar:1.0.0]
        at sbt.TemplateCommandUtil$.run(TemplateCommand.scala:47) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:34) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:17) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.Command$.$anonfun$applyEffect$4(Command.scala:125) ~[command_2.12-1.0.0.jar:1.0.0]
        at sbt.Command$.$anonfun$applyEffect$2(Command.scala:121) ~[command_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.processCommand(MainLoop.scala:121) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:105) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.State$$anon$1.runCmd$1(State.scala:228) ~[command_2.12-1.0.0.jar:1.0.0]
        at sbt.State$$anon$1.process(State.scala:234) ~[command_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:105) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:17) ~[util-control_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.next(MainLoop.scala:105) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.run(MainLoop.scala:98) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:76) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.io.Using.apply(Using.scala:23) ~[io_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.runWithNewLog(MainLoop.scala:70) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.runAndClearLast(MainLoop.scala:52) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:37) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.runLogged(MainLoop.scala:29) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.StandardMain$.runManaged(Main.scala:104) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.xMain.run(Main.scala:71) ~[main_2.12-1.0.0.jar:1.0.0]
        at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109) ~[?:?]
        at xsbt.boot.Launch$.withContextLoader(Launch.scala:128) ~[?:?]
        at xsbt.boot.Launch$.run(Launch.scala:109) ~[?:?]
        at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35) ~[?:?]
        at xsbt.boot.Launch$.launch(Launch.scala:117) ~[?:?]
        at xsbt.boot.Launch$.apply(Launch.scala:18) ~[?:?]
        at xsbt.boot.Boot$.runImpl(Boot.scala:41) ~[?:?]
        at xsbt.boot.Boot$.main(Boot.scala:17) ~[?:?]
        at xsbt.boot.Boot.main(Boot.scala) ~[?:?]
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method) ~[?:1.8.0_121]
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386) ~[?:1.8.0_121]
        at java.lang.ProcessImpl.start(ProcessImpl.java:137) ~[?:1.8.0_121]
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ~[?:1.8.0_121]
        ... 58 more
[error] org.eclipse.jgit.api.errors.TransportException: git@github.com:playframework/play-java-seed.g8.git: Connection timed out: connect
[error]         at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
[error]         at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:193)
[error]         at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:133)
[error]         at giter8.JgitHelper$.clone(JgitHelper.scala:116)
[error]         at giter8.JgitHelper$.run(JgitHelper.scala:67)
[error]         at giter8.Giter8.$anonfun$run$2(giter8.scala:34)
[error]         at scala.Option.map(Option.scala:146)
[error]         at giter8.Giter8.run(giter8.scala:33)
[error]         at sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]         at java.lang.reflect.Method.invoke(Method.java:498)
[error]         at sbt.TemplateCommandUtil$.call(TemplateCommand.scala:93)
[error]         at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:71)
[error]         at sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:51)
[error]         at sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:47)
[error]         at scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111)
[error]         at scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108)
[error]         at scala.collection.immutable.List.find(List.scala:86)
[error]         at sbt.TemplateCommandUtil$.run(TemplateCommand.scala:47)
[error]         at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:34)
[error]         at sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:17)
[error]         at sbt.Command$.$anonfun$applyEffect$4(Command.scala:125)
[error]         at sbt.Command$.$anonfun$applyEffect$2(Command.scala:121)
[error]         at sbt.MainLoop$.processCommand(MainLoop.scala:121)
[error]         at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:105)
[error]         at sbt.State$$anon$1.runCmd$1(State.scala:228)
[error]         at sbt.State$$anon$1.process(State.scala:234)
[error]         at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:105)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
[error]         at sbt.MainLoop$.next(MainLoop.scala:105)
[error]         at sbt.MainLoop$.run(MainLoop.scala:98)
[error]         at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:76)
[error]         at sbt.io.Using.apply(Using.scala:23)
[error]         at sbt.MainLoop$.runWithNewLog(MainLoop.scala:70)
[error]         at sbt.MainLoop$.runAndClearLast(MainLoop.scala:52)
[error]         at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:37)
[error]         at sbt.MainLoop$.runLogged(MainLoop.scala:29)
[error]         at sbt.StandardMain$.runManaged(Main.scala:104)
[error]         at sbt.xMain.run(Main.scala:71)
[error]         at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error]         at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error]         at xsbt.boot.Launch$.run(Launch.scala:109)
[error]         at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error]         at xsbt.boot.Launch$.launch(Launch.scala:117)
[error]         at xsbt.boot.Launch$.apply(Launch.scala:18)
[error]         at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error]         at xsbt.boot.Boot$.main(Boot.scala:17)
[error]         at xsbt.boot.Boot.main(Boot.scala)
[error] Caused by: org.eclipse.jgit.errors.TransportException: git@github.com:playframework/play-java-seed.g8.git: Connection timed out: connect
[error]         at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:158)
[error]         at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:136)
[error]         at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262)
[error]         at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161)
[error]         at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
[error]         at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
[error]         at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
[error]         at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
[error]         at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:193)
[error]         at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:133)
[error]         at giter8.JgitHelper$.clone(JgitHelper.scala:116)
[error]         at giter8.JgitHelper$.run(JgitHelper.scala:67)
[error]         at giter8.Giter8.$anonfun$run$2(giter8.scala:34)
[error]         at scala.Option.map(Option.scala:146)
[error]         at giter8.Giter8.run(giter8.scala:33)
[error]         at sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]         at java.lang.reflect.Method.invoke(Method.java:498)
[error]         at sbt.TemplateCommandUtil$.call(TemplateCommand.scala:93)
[error]         at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:71)
[error]         at sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:51)
[error]         at sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:47)
[error]         at scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111)
[error]         at scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108)
[error]         at scala.collection.immutable.List.find(List.scala:86)
[error]         at sbt.TemplateCommandUtil$.run(TemplateCommand.scala:47)
[error]         at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:34)
[error]         at sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:17)
[error]         at sbt.Command$.$anonfun$applyEffect$4(Command.scala:125)
[error]         at sbt.Command$.$anonfun$applyEffect$2(Command.scala:121)
[error]         at sbt.MainLoop$.processCommand(MainLoop.scala:121)
[error]         at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:105)
[error]         at sbt.State$$anon$1.runCmd$1(State.scala:228)
[error]         at sbt.State$$anon$1.process(State.scala:234)
[error]         at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:105)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
[error]         at sbt.MainLoop$.next(MainLoop.scala:105)
[error]         at sbt.MainLoop$.run(MainLoop.scala:98)
[error]         at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:76)
[error]         at sbt.io.Using.apply(Using.scala:23)
[error]         at sbt.MainLoop$.runWithNewLog(MainLoop.scala:70)
[error]         at sbt.MainLoop$.runAndClearLast(MainLoop.scala:52)
[error]         at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:37)
[error]         at sbt.MainLoop$.runLogged(MainLoop.scala:29)
[error]         at sbt.StandardMain$.runManaged(Main.scala:104)
[error]         at sbt.xMain.run(Main.scala:71)
[error]         at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error]         at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error]         at xsbt.boot.Launch$.run(Launch.scala:109)
[error]         at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error]         at xsbt.boot.Launch$.launch(Launch.scala:117)
[error]         at xsbt.boot.Launch$.apply(Launch.scala:18)
[error]         at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error]         at xsbt.boot.Boot$.main(Boot.scala:17)
[error]         at xsbt.boot.Boot.main(Boot.scala)
[error] org.eclipse.jgit.api.errors.TransportException: git@github.com:playframework/play-java-seed.g8.git: Connection timed out: connect
[error] Use 'last' for the full log.
</code>```

答: Looks like you don't have git bash installed in your system. Try to install git(https://git-scm.com/downloads) and try to run the same command again. It worked out for me.</p>

Body:
I've just started to play with framework tutorials. Installed SBT in my windows machine when am trying to create new java project with sbt new playframework/play-java-seed.g8 command getting below error. Please help me to understand and fix this issue. Please how to get started with the new project using java and play.

"C:\Users\praveena\.sbt\preloaded\org.scala-sbt\sbt\"1.0.0"\jars\sbt.jar"
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256m; support was removed in 8.0
[info] Loading project definition from C:\Users\praveena\project
[info] Set current project to praveena (in build file:/C:/Users/praveena/)
13:05:47.274 [main] ERROR org.eclipse.jgit.util.FS - Caught exception in FS.readPipe()
java.io.IOException: Cannot run program "bash" (in directory "C:\Users\praveena"): CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048) ~[?:1.8.0_121]
        at java.lang.Runtime.exec(Runtime.java:620) ~[?:1.8.0_121]
        at org.eclipse.jgit.util.FS.readPipe(FS.java:431) ~[?:?]
        at org.eclipse.jgit.util.FS_Win32.discoverGitPrefix(FS_Win32.java:113) ~[?:?]
        at org.eclipse.jgit.util.FS.gitPrefix(FS.java:517) ~[?:?]
        at org.eclipse.jgit.util.SystemReader$Default.openSystemConfig(SystemReader.java:92) ~[?:?]
        at org.eclipse.jgit.internal.storage.file.FileRepository.<init>(FileRepository.java:171) ~[?:?]
        at org.eclipse.jgit.lib.BaseRepositoryBuilder.build(BaseRepositoryBuilder.java:577) ~[?:?]
        at org.eclipse.jgit.api.InitCommand.call(InitCommand.java:113) ~[?:?]
        at org.eclipse.jgit.api.CloneCommand.init(CloneCommand.java:161) ~[?:?]
        at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:132) ~[?:?]
        at giter8.JgitHelper$.clone(JgitHelper.scala:116) ~[?:?]
        at giter8.JgitHelper$.run(JgitHelper.scala:67) ~[?:?]
        at giter8.JgitHelper$.run(JgitHelper.scala:80) ~[?:?]
        at giter8.Giter8.$anonfun$run$2(giter8.scala:34) ~[?:?]
        at scala.Option.map(Option.scala:146) ~[scala-library.jar:1.0.0]
        at giter8.Giter8.run(giter8.scala:33) ~[?:?]
        at sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31) ~[?:?]
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_121]
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_121]
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_121]
        at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_121]
        at sbt.TemplateCommandUtil$.call(TemplateCommand.scala:93) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:71) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:51) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:47) ~[main_2.12-1.0.0.jar:1.0.0]
        at scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111) ~[scala-library.jar:1.0.0]
        at scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108) ~[scala-library.jar:1.0.0]
        at scala.collection.immutable.List.find(List.scala:86) ~[scala-library.jar:1.0.0]
        at sbt.TemplateCommandUtil$.run(TemplateCommand.scala:47) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:34) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:17) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.Command$.$anonfun$applyEffect$4(Command.scala:125) ~[command_2.12-1.0.0.jar:1.0.0]
        at sbt.Command$.$anonfun$applyEffect$2(Command.scala:121) ~[command_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.processCommand(MainLoop.scala:121) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:105) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.State$$anon$1.runCmd$1(State.scala:228) ~[command_2.12-1.0.0.jar:1.0.0]
        at sbt.State$$anon$1.process(State.scala:234) ~[command_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:105) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:17) ~[util-control_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.next(MainLoop.scala:105) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.run(MainLoop.scala:98) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:76) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.io.Using.apply(Using.scala:23) ~[io_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.runWithNewLog(MainLoop.scala:70) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.runAndClearLast(MainLoop.scala:52) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:37) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.MainLoop$.runLogged(MainLoop.scala:29) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.StandardMain$.runManaged(Main.scala:104) ~[main_2.12-1.0.0.jar:1.0.0]
        at sbt.xMain.run(Main.scala:71) ~[main_2.12-1.0.0.jar:1.0.0]
        at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109) ~[?:?]
        at xsbt.boot.Launch$.withContextLoader(Launch.scala:128) ~[?:?]
        at xsbt.boot.Launch$.run(Launch.scala:109) ~[?:?]
        at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35) ~[?:?]
        at xsbt.boot.Launch$.launch(Launch.scala:117) ~[?:?]
        at xsbt.boot.Launch$.apply(Launch.scala:18) ~[?:?]
        at xsbt.boot.Boot$.runImpl(Boot.scala:41) ~[?:?]
        at xsbt.boot.Boot$.main(Boot.scala:17) ~[?:?]
        at xsbt.boot.Boot.main(Boot.scala) ~[?:?]
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method) ~[?:1.8.0_121]
        at java.lang.ProcessImpl.<init>(ProcessImpl.java:386) ~[?:1.8.0_121]
        at java.lang.ProcessImpl.start(ProcessImpl.java:137) ~[?:1.8.0_121]
        at java.lang.ProcessBuilder.start(ProcessBuilder.java:1029) ~[?:1.8.0_121]
        ... 58 more
[error] org.eclipse.jgit.api.errors.TransportException: git@github.com:playframework/play-java-seed.g8.git: Connection timed out: connect
[error]         at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:139)
[error]         at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:193)
[error]         at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:133)
[error]         at giter8.JgitHelper$.clone(JgitHelper.scala:116)
[error]         at giter8.JgitHelper$.run(JgitHelper.scala:67)
[error]         at giter8.Giter8.$anonfun$run$2(giter8.scala:34)
[error]         at scala.Option.map(Option.scala:146)
[error]         at giter8.Giter8.run(giter8.scala:33)
[error]         at sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]         at java.lang.reflect.Method.invoke(Method.java:498)
[error]         at sbt.TemplateCommandUtil$.call(TemplateCommand.scala:93)
[error]         at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:71)
[error]         at sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:51)
[error]         at sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:47)
[error]         at scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111)
[error]         at scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108)
[error]         at scala.collection.immutable.List.find(List.scala:86)
[error]         at sbt.TemplateCommandUtil$.run(TemplateCommand.scala:47)
[error]         at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:34)
[error]         at sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:17)
[error]         at sbt.Command$.$anonfun$applyEffect$4(Command.scala:125)
[error]         at sbt.Command$.$anonfun$applyEffect$2(Command.scala:121)
[error]         at sbt.MainLoop$.processCommand(MainLoop.scala:121)
[error]         at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:105)
[error]         at sbt.State$$anon$1.runCmd$1(State.scala:228)
[error]         at sbt.State$$anon$1.process(State.scala:234)
[error]         at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:105)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
[error]         at sbt.MainLoop$.next(MainLoop.scala:105)
[error]         at sbt.MainLoop$.run(MainLoop.scala:98)
[error]         at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:76)
[error]         at sbt.io.Using.apply(Using.scala:23)
[error]         at sbt.MainLoop$.runWithNewLog(MainLoop.scala:70)
[error]         at sbt.MainLoop$.runAndClearLast(MainLoop.scala:52)
[error]         at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:37)
[error]         at sbt.MainLoop$.runLogged(MainLoop.scala:29)
[error]         at sbt.StandardMain$.runManaged(Main.scala:104)
[error]         at sbt.xMain.run(Main.scala:71)
[error]         at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error]         at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error]         at xsbt.boot.Launch$.run(Launch.scala:109)
[error]         at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error]         at xsbt.boot.Launch$.launch(Launch.scala:117)
[error]         at xsbt.boot.Launch$.apply(Launch.scala:18)
[error]         at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error]         at xsbt.boot.Boot$.main(Boot.scala:17)
[error]         at xsbt.boot.Boot.main(Boot.scala)
[error] Caused by: org.eclipse.jgit.errors.TransportException: git@github.com:playframework/play-java-seed.g8.git: Connection timed out: connect
[error]         at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:158)
[error]         at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:136)
[error]         at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:262)
[error]         at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:161)
[error]         at org.eclipse.jgit.transport.FetchProcess.executeImp(FetchProcess.java:136)
[error]         at org.eclipse.jgit.transport.FetchProcess.execute(FetchProcess.java:122)
[error]         at org.eclipse.jgit.transport.Transport.fetch(Transport.java:1138)
[error]         at org.eclipse.jgit.api.FetchCommand.call(FetchCommand.java:130)
[error]         at org.eclipse.jgit.api.CloneCommand.fetch(CloneCommand.java:193)
[error]         at org.eclipse.jgit.api.CloneCommand.call(CloneCommand.java:133)
[error]         at giter8.JgitHelper$.clone(JgitHelper.scala:116)
[error]         at giter8.JgitHelper$.run(JgitHelper.scala:67)
[error]         at giter8.Giter8.$anonfun$run$2(giter8.scala:34)
[error]         at scala.Option.map(Option.scala:146)
[error]         at giter8.Giter8.run(giter8.scala:33)
[error]         at sbtgiter8resolver.Giter8TemplateResolver.run(Giter8TemplateResolver.scala:31)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[error]         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[error]         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[error]         at java.lang.reflect.Method.invoke(Method.java:498)
[error]         at sbt.TemplateCommandUtil$.call(TemplateCommand.scala:93)
[error]         at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:71)
[error]         at sbt.TemplateCommandUtil$.$anonfun$run$1(TemplateCommand.scala:51)
[error]         at sbt.TemplateCommandUtil$.$anonfun$run$1$adapted(TemplateCommand.scala:47)
[error]         at scala.collection.LinearSeqOptimized.find(LinearSeqOptimized.scala:111)
[error]         at scala.collection.LinearSeqOptimized.find$(LinearSeqOptimized.scala:108)
[error]         at scala.collection.immutable.List.find(List.scala:86)
[error]         at sbt.TemplateCommandUtil$.run(TemplateCommand.scala:47)
[error]         at sbt.TemplateCommandUtil$.runTemplate(TemplateCommand.scala:34)
[error]         at sbt.TemplateCommandUtil$.$anonfun$templateCommand$2(TemplateCommand.scala:17)
[error]         at sbt.Command$.$anonfun$applyEffect$4(Command.scala:125)
[error]         at sbt.Command$.$anonfun$applyEffect$2(Command.scala:121)
[error]         at sbt.MainLoop$.processCommand(MainLoop.scala:121)
[error]         at sbt.MainLoop$.$anonfun$next$2(MainLoop.scala:105)
[error]         at sbt.State$$anon$1.runCmd$1(State.scala:228)
[error]         at sbt.State$$anon$1.process(State.scala:234)
[error]         at sbt.MainLoop$.$anonfun$next$1(MainLoop.scala:105)
[error]         at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
[error]         at sbt.MainLoop$.next(MainLoop.scala:105)
[error]         at sbt.MainLoop$.run(MainLoop.scala:98)
[error]         at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:76)
[error]         at sbt.io.Using.apply(Using.scala:23)
[error]         at sbt.MainLoop$.runWithNewLog(MainLoop.scala:70)
[error]         at sbt.MainLoop$.runAndClearLast(MainLoop.scala:52)
[error]         at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:37)
[error]         at sbt.MainLoop$.runLogged(MainLoop.scala:29)
[error]         at sbt.StandardMain$.runManaged(Main.scala:104)
[error]         at sbt.xMain.run(Main.scala:71)
[error]         at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
[error]         at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
[error]         at xsbt.boot.Launch$.run(Launch.scala:109)
[error]         at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
[error]         at xsbt.boot.Launch$.launch(Launch.scala:117)
[error]         at xsbt.boot.Launch$.apply(Launch.scala:18)
[error]         at xsbt.boot.Boot$.runImpl(Boot.scala:41)
[error]         at xsbt.boot.Boot$.main(Boot.scala:17)
[error]         at xsbt.boot.Boot.main(Boot.scala)
[error] org.eclipse.jgit.api.errors.TransportException: git@github.com:playframework/play-java-seed.g8.git: Connection timed out: connect
[error] Use 'last' for the full log.


来源: stackexchange

问:
SQL Server Express across network
Can SQL Server Express be accessed from another computer running SQL Server Management Studio across the network? Assuming there are no network firewalls etc.</p>

答: Yes, you can. But remember that you must accept open to remote or tcp/ip connections</p>

ContentLicense: CC BY-SA 3.0

Title: SQL Server Express across network


问:
Python 3.6.2 not running loops over a single value
In my code I have implemented a loop where the lower and upper bounds are variable, and it can happen that lower and upper bound are the same. In this case, Python skips the loop.

```<code>for i in range(low_, high_):
    print(i)
</code>```

Is there a way to fix this in the definition of the loop?

答:
Try running:

```<code>for i in range(low_, high_ + 1):
    print(i)
</code>```

It sounds like you want your loop to start at low_ and get to high_, even if they're the same. So adding the extra '+ 1' should get you what you want.

In general a loop only gets to one less than the second value.  If you want to hit that value, adding the extra one should do the trick.

Body:
In my code I have implemented a loop where the lower and upper bounds are variable, and it can happen that lower and upper bound are the same. In this case, Python skips the loop.

for i in range(low_, high_):
    print(i)

Is there a way to fix this in the definition of the loop?

Body:
Try running:

for i in range(low_, high_ + 1):
    print(i)

It sounds like you want your loop to start at low_ and get to high_, even if they're the same. So adding the extra '+ 1' should get you what you want.

In general a loop only gets to one less than the second value.  If you want to hit that value, adding the extra one should do the trick.


问:
Not able to set Interactive Push Notifications on iOS8
I was already able to set Interactive LOCAL notifications, but the Remote notifications aren't working. I'm using Parse.com to send the JSON

My AppDelegate.Swift looks like this:

```<code>//
//  AppDelegate.swift
//  SwifferApp
//
//  Created by Training on 29/06/14.
//  Copyright (c) 2014 Training. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
        UINavigationBar.appearance().barTintColor = UIColor.orangeColor()
        UINavigationBar.appearance().tintColor = UIColor.whiteColor()

        Parse.setApplicationId("eUEC7O4Jad0Kt3orqRouU0OJhkGuE20n4uSfrLYE", clientKey: "WypmaQ8XyqH26AeWIANttqwUjRJR4CIM55ioXvez")

        let notificationTypes:UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
        let notificationSettings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)

        UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)

        return true
    }

    func application(application: UIApplication!, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings!) {
        UIApplication.sharedApplication().registerForRemoteNotifications()
    }

    func application(application: UIApplication!, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData!) {
        let currentInstallation:PFInstallation = PFInstallation.currentInstallation()
        currentInstallation.setDeviceTokenFromData(deviceToken)
        currentInstallation.saveInBackground()
    }

    func application(application: UIApplication!, didFailToRegisterForRemoteNotificationsWithError error: NSError!) {
        println(error.localizedDescription)
    }

    func application(application: UIApplication!, didReceiveRemoteNotification userInfo:NSDictionary!) {

        var notification:NSDictionary = userInfo.objectForKey("aps") as NSDictionary

        if notification.objectForKey("content-available"){
            if notification.objectForKey("content-available").isEqualToNumber(1){
                NSNotificationCenter.defaultCenter().postNotificationName("reloadTimeline", object: nil)
            }
        }else{
            PFPush.handlePush(userInfo)
        }
    }

    func applicationWillResignActive(application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }
}
</code>```

on Parse, I'm setting the Push payload like this:

```<code>{
"alert": "Tune in for the World Series, tonight at 8pm EDT",
"badge": "Increment",
"sound": "chime",
"category": "FIRST_CATEGORY"
}
</code>```

and I receive the push, but not with the custom buttons I've set.

答:
This is in case if anyone comes across this problem while using Firebase Remote Notifications.

Just ask the backend developer to send:

```<code>"notification" : {
  "title" : YOUR_TITLE,
  "body" : YOUR_BODY,
  "click_action" : YOUR_CATEGORY_NAME
}
</code>```

Body:
I was already able to set Interactive LOCAL notifications, but the Remote notifications aren't working. I'm using Parse.com to send the JSON

My AppDelegate.Swift looks like this:

//
//  AppDelegate.swift
//  SwifferApp
//
//  Created by Training on 29/06/14.
//  Copyright (c) 2014 Training. All rights reserved.
//

import UIKit

@UIApplicationMain
class AppDelegate: UIResponder, UIApplicationDelegate {

    var window: UIWindow?

    func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {
        UINavigationBar.appearance().barTintColor = UIColor.orangeColor()
        UINavigationBar.appearance().tintColor = UIColor.whiteColor()

        Parse.setApplicationId("eUEC7O4Jad0Kt3orqRouU0OJhkGuE20n4uSfrLYE", clientKey: "WypmaQ8XyqH26AeWIANttqwUjRJR4CIM55ioXvez")

        let notificationTypes:UIUserNotificationType = UIUserNotificationType.Alert | UIUserNotificationType.Badge | UIUserNotificationType.Sound
        let notificationSettings:UIUserNotificationSettings = UIUserNotificationSettings(forTypes: notificationTypes, categories: nil)

        UIApplication.sharedApplication().registerUserNotificationSettings(notificationSettings)

        return true
    }

    func application(application: UIApplication!, didRegisterUserNotificationSettings notificationSettings: UIUserNotificationSettings!) {
        UIApplication.sharedApplication().registerForRemoteNotifications()
    }

    func application(application: UIApplication!, didRegisterForRemoteNotificationsWithDeviceToken deviceToken: NSData!) {
        let currentInstallation:PFInstallation = PFInstallation.currentInstallation()
        currentInstallation.setDeviceTokenFromData(deviceToken)
        currentInstallation.saveInBackground()
    }

    func application(application: UIApplication!, didFailToRegisterForRemoteNotificationsWithError error: NSError!) {
        println(error.localizedDescription)
    }

    func application(application: UIApplication!, didReceiveRemoteNotification userInfo:NSDictionary!) {

        var notification:NSDictionary = userInfo.objectForKey("aps") as NSDictionary

        if notification.objectForKey("content-available"){
            if notification.objectForKey("content-available").isEqualToNumber(1){
                NSNotificationCenter.defaultCenter().postNotificationName("reloadTimeline", object: nil)
            }
        }else{
            PFPush.handlePush(userInfo)
        }
    }

    func applicationWillResignActive(application: UIApplication) {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }

    func applicationDidEnterBackground(application: UIApplication) {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later.
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }

    func applicationWillEnterForeground(application: UIApplication) {
        // Called as part of the transition from the background to the active state; here you can undo many of the changes made on entering the background.
    }

    func applicationDidBecomeActive(application: UIApplication) {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }

    func applicationWillTerminate(application: UIApplication) {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }
}

on Parse, I'm setting the Push payload like this:

{
"alert": "Tune in for the World Series, tonight at 8pm EDT",
"badge": "Increment",
"sound": "chime",
"category": "FIRST_CATEGORY"
}

and I receive the push, but not with the custom buttons I've set.

Body:
This is in case if anyone comes across this problem while using Firebase Remote Notifications.

Just ask the backend developer to send:

"notification" : {
  "title" : YOUR_TITLE,
  "body" : YOUR_BODY,
  "click_action" : YOUR_CATEGORY_NAME
}


问:
How can I take the datas of a growing list in python3
There is my list :

```<code>fieldNames = ["Your Firstname","Year of birth", "Month of birth", "Day of   Birth"]
birthValues = []
birthValues = multenterbox(msg, title, fieldNames)
yourName = birthValues[0]
yearBirth = birthValues[1]
 monthBirth = birthValues[2]
dayBirth = birthValues[3]
</code>```

I can find the lenght of the list with :
  len(fieldNames)

My problem is that I keep add values in the list.  So I need something that can take the next values automatcly [4] [5] [6] etc...

答:
You mean you wan a loop, like this ?

```<code>fieldNames = ["Your Firstname","Year of birth", "Month of birth", "Day of   Birth"]
birthValues = multenterbox(msg, title, fieldNames)
mapping = dict()
for i in range(len(fieldNames)):
    mapping[fieldNames[i]] = birthValues[i]
</code>```

And you can access birthname with mapping["Your Firstname"].

Body:
There is my list :

fieldNames = ["Your Firstname","Year of birth", "Month of birth", "Day of   Birth"]
birthValues = []
birthValues = multenterbox(msg, title, fieldNames)
yourName = birthValues[0]
yearBirth = birthValues[1]
 monthBirth = birthValues[2]
dayBirth = birthValues[3]

I can find the lenght of the list with :
  len(fieldNames)

My problem is that I keep add values in the list.  So I need something that can take the next values automatcly [4] [5] [6] etc...

Body:
You mean you wan a loop, like this ?

fieldNames = ["Your Firstname","Year of birth", "Month of birth", "Day of   Birth"]
birthValues = multenterbox(msg, title, fieldNames)
mapping = dict()
for i in range(len(fieldNames)):
    mapping[fieldNames[i]] = birthValues[i]

And you can access birthname with mapping["Your Firstname"].


问:
Switch statement doesn't work with some variables
I want to make the Angular2 Pipe which returns different values according to passed variable. The variable device.display can be of different type (object or string) and takes only two values null and "dataTime".

Component part:

```<code><div class="col col-2">{{values[variable.id] | display: device.display}}</div>
</code>```

Pipe:

```<code>Pipe
import { Pipe } from '@angular/core';
@Pipe({
    name: 'display'
})
export class DisplayPipe {
    transform(value: any, display: string): string {
        display = String(display);
        switch (display) {
            case 'dateTime': {
                value = value * 60;
            }
            case 'null': {
                value = value;
           }
        default: value = 'abc';
        }
    return value;
    }
}
</code>```

I'm sure that after parsing variable to String it is equal to "null" or "dateTime". I checked it with console.log.

The problem is the switch statement always returns default value:"abc".

答:
Wrong Syntax. You don't need brackets in each case, and you forgot the break; statement.

Heres an example, on how you build switch case:

```<code>switch (new Date().getDay()) {
    case 0:
        day = "Sunday";
        break;
    case 1:
        day = "Monday";
        break;
    case 2:
        day = "Tuesday";
        break;
    case 3:
        day = "Wednesday";
        break;
    case 4:
        day = "Thursday";
        break;
    case 5:
        day = "Friday";
        break;
    case 6:
        day = "Saturday";
}
</code>```

Body:
I want to make the Angular2 Pipe which returns different values according to passed variable. The variable device.display can be of different type (object or string) and takes only two values null and "dataTime".

Component part:

{{values[variable.id] | display: device.display}}

Pipe:

Pipe
import { Pipe } from '@angular/core';
@Pipe({
    name: 'display'
})
export class DisplayPipe {
    transform(value: any, display: string): string {
        display = String(display);
        switch (display) {
            case 'dateTime': {
                value = value * 60;
            }
            case 'null': {
                value = value;
           }
        default: value = 'abc';
        }
    return value;
    }
}

I'm sure that after parsing variable to String it is equal to "null" or "dateTime". I checked it with console.log.

The problem is the switch statement always returns default value:"abc".

Body:
Wrong Syntax. You don't need brackets in each case, and you forgot the break; statement.

Heres an example, on how you build switch case:

switch (new Date().getDay()) {
    case 0:
        day = "Sunday";
        break;
    case 1:
        day = "Monday";
        break;
    case 2:
        day = "Tuesday";
        break;
    case 3:
        day = "Wednesday";
        break;
    case 4:
        day = "Thursday";
        break;
    case 5:
        day = "Friday";
        break;
    case 6:
        day = "Saturday";
}


问:
Menu Bar not Maximized When Main Window Maximized
In Qt 5.5.1 (Linux), I am showing main window in maximized state as:

```<code>QApplication a(argc, argv);
MainWindow w;
w.setWindowState(Qt::WindowMaximized);
w.show();
return a.exec();
</code>```

In the main window constructor, I call CreateMenuBar which simply creates some menu:

```<code>fileMenu = menuBar()->addMenu(tr("&File"));
projectMenu = menuBar()->addMenu(tr("&Project"));
...
</code>```

When run, Main Window is shown at maximized state correctly but menu bar shortened as:

One strange behaviour is that if I normalized the window with clicking normalize button in window top then maximizing again does stretch the menu bar as it should be.

What am I missing?

答:
You can try to call QMainWindow::show() function before setting its state, i.e.:

```<code>[..]
w.show();
w.setWindowState(Qt::WindowMaximized);
</code>```

I am not sure I know the exact reason of such behavior, but I guess that Qt performs incorrect layouting if you try to change its geometry without showing it. It may also depend on window manager you use.

Body:
In Qt 5.5.1 (Linux), I am showing main window in maximized state as:

QApplication a(argc, argv);
MainWindow w;
w.setWindowState(Qt::WindowMaximized);
w.show();
return a.exec();

In the main window constructor, I call CreateMenuBar which simply creates some menu:

fileMenu = menuBar()->addMenu(tr("&File"));
projectMenu = menuBar()->addMenu(tr("&Project"));
...

When run, Main Window is shown at maximized state correctly but menu bar shortened as:

One strange behaviour is that if I normalized the window with clicking normalize button in window top then maximizing again does stretch the menu bar as it should be.

What am I missing?

Body:
You can try to call QMainWindow::show() function before setting its state, i.e.:

[..]
w.show();
w.setWindowState(Qt::WindowMaximized);

I am not sure I know the exact reason of such behavior, but I guess that Qt performs incorrect layouting if you try to change its geometry without showing it. It may also depend on window manager you use.


问:
Tracing Variables in AS3 is not working
```<code>var a:Number;
var b:Number;

a + b = 17;

trace ("A: "a"       B: "b);
</code>```

Why does this not work? Is there somthing about tracing multiple pieces of information in  the same trace statement in AS3?

答:
You have to use the plus (+) symbol to concatenate strings together.</p>

```<code>trace ("A: " + a + "B: " + b);
</code>```

ContentLicense: CC BY-SA 2.5

Title: Tracing Variables in AS3 is not working

Body:
var a:Number;
var b:Number;

a + b = 17;

trace ("A: "a"       B: "b);

Why does this not work? Is there somthing about tracing multiple pieces of information in  the same trace statement in AS3?

Body:
You have to use the plus (+) symbol to concatenate strings together.

trace ("A: " + a + "B: " + b);


问:
AngularJS - Better filtering of collection in collection with lodash
I have a key value filter.

```<code>$scope.filter.subjects = [
  { Key: 27, Value: "Txt" }
  { Key: 19, Value: "Txt" }
  { Key: 7, Value: "Txt" }
  { Key: 5, Value: "Txt" }
]
</code>```

And a result collection where I want to filter against another key value collection.

```<code>result = [{
  Prop1: "txt",
  Prop2: "txt",
  ...
  Subjects: [{
    { Key: 7, Value: "Txt" }
    { Key: 5, Value: "Txt" }
  ],
  ...
}]
</code>```

This lodash filtering is currently working but it looks very inefficient and clunky. I can change the filter and result model on the backend to instead of a collection of key and value I can return an object with the values mapped like this:

```<code>...
Subjects: {
  7: "Txt",
  5: "txt"
}
...
</code>```

and change the filter to:

```<code>$scope.filter.subjects = {
  27: "Txt",
  19: "Txt",
  7: "Txt",
  5: "Txt"
}
</code>```

If this can make it more efficient

Here is the current filter:

```<code>...
var filteredList = angular.copy($scope.data);
...
if ($scope.filter.Subject.length > 0) {
    filteredList = _.filter(filteredList, function (o) {
        return _.find(o.Subjects, function (y) {
            return _.find($scope.filter.Subject, ["Key", y.Key]);
        });
    });
}
...
$scope.result = filteredList;
</code>```

答:
Though not sure what you are exactly trying. If your $scope.filter.Subject is just an map object like {27: 'Txt', 12: '...'} instead of a [{key: '', value: ''}, {<key,value>}, ...}] then you can easily skip the inner most iteration for find in the context of exactly what you are trying in the given example, and can change the code to:

```<code>filteredList = _.filter(filteredList, function (o) {
    return _.find(o.Subjects, function (y) {
        return $scope.filter.subjects[y.Key];
    });
});
</code>```

Body:
I have a key value filter.

$scope.filter.subjects = [
  { Key: 27, Value: "Txt" }
  { Key: 19, Value: "Txt" }
  { Key: 7, Value: "Txt" }
  { Key: 5, Value: "Txt" }
]

And a result collection where I want to filter against another key value collection.

result = [{
  Prop1: "txt",
  Prop2: "txt",
  ...
  Subjects: [{
    { Key: 7, Value: "Txt" }
    { Key: 5, Value: "Txt" }
  ],
  ...
}]

This lodash filtering is currently working but it looks very inefficient and clunky. I can change the filter and result model on the backend to instead of a collection of key and value I can return an object with the values mapped like this:

...
Subjects: {
  7: "Txt",
  5: "txt"
}
...

and change the filter to:

$scope.filter.subjects = {
  27: "Txt",
  19: "Txt",
  7: "Txt",
  5: "Txt"
}

If this can make it more efficient

Here is the current filter:

...
var filteredList = angular.copy($scope.data);
...
if ($scope.filter.Subject.length > 0) {
    filteredList = _.filter(filteredList, function (o) {
        return _.find(o.Subjects, function (y) {
            return _.find($scope.filter.Subject, ["Key", y.Key]);
        });
    });
}
...
$scope.result = filteredList;

Body:
Though not sure what you are exactly trying. If your $scope.filter.Subject is just an map object like {27: 'Txt', 12: '...'} instead of a [{key: '', value: ''}, {<key,value>}, ...}] then you can easily skip the inner most iteration for find in the context of exactly what you are trying in the given example, and can change the code to:

filteredList = _.filter(filteredList, function (o) {
    return _.find(o.Subjects, function (y) {
        return $scope.filter.subjects[y.Key];
    });
});


问:
Download a file to a path when running headless mode in Chrome
I'm using the following versions:

Ruby 2.4.1

chromedriver 2.33

selenium-webdriver 3.7.0

watir 6.7.3

page-object 2.2.2

Chrome browser 62.0.32

The env.rb file contains the path for the download directory.
When running the test NOT in headless mode the file downloads perfectly, but when I am running it headless nothing happens and the file does not download.
I was using chromderiver 2.27 and Chrome Browser 58.* and it worked in both modes, does anybody know how can I overcome that?

答:
So here's what I found and it definitely worked!

in the env.rb file when I configure the parameters for the headless mode, I defined it as such:

```<code>options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-gpu')
options.add_argument('--disable-popup-blocking')
options.add_argument('--window-size=1366,768')
options.add_preference(:download, directory_upgrade: true,
                                prompt_for_download: false,
                                default_directory: DOWNLOAD_DIR)

options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })

$browser = Selenium::WebDriver.for :chrome, options: options

bridge = $browser.send(:bridge)
path = '/session/:session_id/chromium/send_command'
path[':session_id'] = bridge.session_id
bridge.http.call(:post, path, cmd: 'Page.setDownloadBehavior',
                            params: {
                              behavior: 'allow',
                              downloadPath: DOWNLOAD_DIR
                            })
</code>```

Thank you comment 89 in the Chromium's bugs webpage:
https://bugs.chromium.org/p/chromium/issues/detail?id=696481

Body:
So here's what I found and it definitely worked!

in the env.rb file when I configure the parameters for the headless mode, I defined it as such:

options = Selenium::WebDriver::Chrome::Options.new
options.add_argument('--headless')
options.add_argument('--no-sandbox')
options.add_argument('--disable-gpu')
options.add_argument('--disable-popup-blocking')
options.add_argument('--window-size=1366,768')
options.add_preference(:download, directory_upgrade: true,
                                prompt_for_download: false,
                                default_directory: DOWNLOAD_DIR)

options.add_preference(:browser, set_download_behavior: { behavior: 'allow' })

$browser = Selenium::WebDriver.for :chrome, options: options

bridge = $browser.send(:bridge)
path = '/session/:session_id/chromium/send_command'
path[':session_id'] = bridge.session_id
bridge.http.call(:post, path, cmd: 'Page.setDownloadBehavior',
                            params: {
                              behavior: 'allow',
                              downloadPath: DOWNLOAD_DIR
                            })

Thank you comment 89 in the Chromium's bugs webpage:
https://bugs.chromium.org/p/chromium/issues/detail?id=696481


问:
Can't display data from the ViewBag
I have a table in my database and I want to get the name field without repetition.
But I get this error:

'string' does not contain definition for 'ID'.
When I debug my code, I find the variables full with data, until the foreach the error shows up.

In my controller:

```<code>public ActionResult Create()
{
            HREntities db = new HREntities();
            var areas = db.Area.Select(area => area.Area + area.ID).Distinct().ToList();
            if(areas != null)
                ViewBag.areas = areas;

            return View();
}
</code>```

The view's code:

```<code> @foreach (var area in ViewBag.areas)
{
    <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
        <input name="group4" type="radio" id="@area.ID" class="radio-col-blue-grey" />
        <label for="@area.ID">@area.Area</label>
    </div>
}
</code>```

答:
In your Create method in the controller, you are creating a List<string>on following line:

```<code>var areas = db.Area.Select(area => area.Area + area.ID).Distinct().ToList();
</code>```

You then pass this list to the ViewBag, but as it is now a list of strings and not a List<Area>, it won't have an ID property there.

While debugging, check the type of the variable areas, you'll see. Your markup code in the foreach loop should look like this:

```<code><input name="group4" type="radio" id="@area" class="radio-col-blue-grey" />
<label for="@area">@area</label>
</code>```

Title: Can't display data from the ViewBag

Body:
I have a table in my database and I want to get the name field without repetition.
But I get this error:

'string' does not contain definition for 'ID'.
When I debug my code, I find the variables full with data, until the foreach the error shows up.

In my controller:

public ActionResult Create()
{
            HREntities db = new HREntities();
            var areas = db.Area.Select(area => area.Area + area.ID).Distinct().ToList();
            if(areas != null)
                ViewBag.areas = areas;

            return View();
}

The view's code:

 @foreach (var area in ViewBag.areas)
{

        <input name="group4" type="radio" id="@area.ID" class="radio-col-blue-grey" />
        @area.Area

}

Body:
In your Create method in the controller, you are creating a List<string>on following line:

var areas = db.Area.Select(area => area.Area + area.ID).Distinct().ToList();

You then pass this list to the ViewBag, but as it is now a list of strings and not a List<Area>, it won't have an ID property there.

While debugging, check the type of the variable areas, you'll see. Your markup code in the foreach loop should look like this:

<input name="group4" type="radio" id="@area" class="radio-col-blue-grey" />
<label for="@area">@area</label>


问:
Get all links for my laravel website for sitemap
I generate sitemap but im getting error when im run composer update in my server.
this package cause an error https://github.com/spatie/laravel-sitemap

because the php version of the server is 7.0 but the requirements for package is 7.1.

their have any alternative solution for this, without updating php version?
or their have a way short way to get all the links of my website? thanks in advance :)

答:
you can use this package instead:

https://github.com/Laravelium/laravel-sitemap

here one sample for big sitemap:

```<code>/** @var Sitemap $sitemap */
        $sitemap = \App::make("sitemap");

        // add item to the sitemap (url, date, priority, freq)
        $sitemap->add(route('home'), new Carbon(), '1.0', 'hourly');

        $sitemapNumber = 1;
        /** @var Application $application */
        Application::with('applicationImages')->chunk(200, function ($applications) use ($sitemap, &$sitemapNumber) {
            foreach ($applications as $application) {

                $images = [];
                $images[] = ['url' => url($application->icon->url()), 'title' => $application->name];
                if (!empty($application->applicationImages))
                    foreach ($application->applicationImages as $applicationImage) {
                        $images[] = ['url' => url($applicationImage->image->url()), 'title' => $application->name];
                    }

                $sitemap->add(route('application.show', $application->routeArray()), $application->updated_at->format('c'), '0.5', 'daily', $images);

            }
            // generate new sitemap file
            $sitemap->store('xml', 'sitemap-' . $sitemapNumber);
            // add the file to the sitemaps array
            $sitemap->addSitemap(secure_url('sitemap-' . $sitemapNumber . '.xml'));
            // reset items array (clear memory)
            $sitemap->model->resetItems();
            // count generated sitemap
            $sitemapNumber++;
        });

        $sitemap->store('sitemapindex', 'sitemap', public_path());
        return true;
</code>```

Body:
you can use this package instead:

https://github.com/Laravelium/laravel-sitemap

here one sample for big sitemap:

/** @var Sitemap $sitemap */
        $sitemap = \App::make("sitemap");

        // add item to the sitemap (url, date, priority, freq)
        $sitemap->add(route('home'), new Carbon(), '1.0', 'hourly');

        $sitemapNumber = 1;
        /** @var Application $application */
        Application::with('applicationImages')->chunk(200, function ($applications) use ($sitemap, &$sitemapNumber) {
            foreach ($applications as $application) {

                $images = [];
                $images[] = ['url' => url($application->icon->url()), 'title' => $application->name];
                if (!empty($application->applicationImages))
                    foreach ($application->applicationImages as $applicationImage) {
                        $images[] = ['url' => url($applicationImage->image->url()), 'title' => $application->name];
                    }

                $sitemap->add(route('application.show', $application->routeArray()), $application->updated_at->format('c'), '0.5', 'daily', $images);

            }
            // generate new sitemap file
            $sitemap->store('xml', 'sitemap-' . $sitemapNumber);
            // add the file to the sitemaps array
            $sitemap->addSitemap(secure_url('sitemap-' . $sitemapNumber . '.xml'));
            // reset items array (clear memory)
            $sitemap->model->resetItems();
            // count generated sitemap
            $sitemapNumber++;
        });

        $sitemap->store('sitemapindex', 'sitemap', public_path());
        return true;


问:
Angular 2 routing with custom base href cant find route
When I manually try to open certain page (by typing url in browser) seems like my app can't find what route to use. Page is loading but router-outlet is empty. Also I receive "EmptyError: no elements in sequence". Found that this is some troubles with canActivate method, tried to change Observables to Promise as it says here EmptyError: no elements in sequence but still get error.

My app also have custom base href, defined in index.html

app.routing.ts

```<code>const appRoutes: Routes = [
    {
        path: 'project',
        canActivate: [AuthGuard],
        canActivateChild: [AuthGuard],
        children: [
            {
                path: 'home',
                component: HomeComponent
            },
            {
                path: 'events',
                loadChildren: 'app/feature/events/events.module#EventsModule'
            },
        ],
    }
];
</code>```

So when I try to go "localhost/some/base/href/project/home" I get empty page, only app's main menu visible. Also, url became "localhost/some/base/href" Then I can navigate my app by clicking buttons on app's main menu (theirs hyperlinks are 'localhost/some/base/href/project/events/list' for example). This work perfect, routes founded.

Tried to change path in appRoutes to 'some/base/href/project' and now when I go to "localhost/some/base/href/project/home" HomeCompoment is loaded but url became "localhost/some/base/href/some/base/href/project/home" and also buttons on app's main menu stop working.

Of course, I can make redirect

```<code>path: '**',
redirectTo: '/project/home',
pathMatch: 'full'
</code>```

But this will get me only homepage, I want to manually navigate to other components in app.

UPDATE:
My authGuard, also tried return Observable and Promise but no effect. isAuthorized() always return true now.

```<code>canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
        let result: boolean = this.authService.isAuthorized();

        if (result) {
            return true;
        }

        this.authService.setRedirectUrl(state.url);

        return false;
    }
</code>```

答:
Make your routes this way:

Here we have main branches - Login and Root with empty key - path:
''

And child branches, these path contains children pages - alerts, dashboards and so on.

You able to build path as deep as you need recursively, using children field.

If you want to manually navigate to routes you need to define all paths in you appRoutes array, in the offered style.

```<code>const appRoutes: Routes = [
  {path: 'login', component: LoginComponent},
  {path: '', component: MainComponent, redirectTo: '/dashboard', pathMatch: 'full'
    children: [
      { path: 'alert/:id', component: AlertDetailComponent },
      { path: 'alerts', component: AlertsComponent },
      { path: 'dashboard', component: EriskDashboardComponent }
  ]}];
</code>```

And you able to make some default route to login / 404 page

```<code>path: '**',
redirectTo: '/login',
pathMatch: 'full'
</code>```

Additionally, need to mention, that angular router
uses hash symbol by default in router - #;

So to navigate to login you need to build path like this:

```<code>#/login
#/dashboard
</code>```

http://localhost:4200/#/login

Setting to use hash can be found in app.module.ts, when we importing router module:

```<code>imports:[
    RouterModule.forRoot(routes, { useHash: true }),
]
</code>```

Body:
When I manually try to open certain page (by typing url in browser) seems like my app can't find what route to use. Page is loading but router-outlet is empty. Also I receive "EmptyError: no elements in sequence". Found that this is some troubles with canActivate method, tried to change Observables to Promise as it says here EmptyError: no elements in sequence but still get error.

My app also have custom base href, defined in index.html

app.routing.ts

const appRoutes: Routes = [
    {
        path: 'project',
        canActivate: [AuthGuard],
        canActivateChild: [AuthGuard],
        children: [
            {
                path: 'home',
                component: HomeComponent
            },
            {
                path: 'events',
                loadChildren: 'app/feature/events/events.module#EventsModule'
            },
        ],
    }
];

So when I try to go "localhost/some/base/href/project/home" I get empty page, only app's main menu visible. Also, url became "localhost/some/base/href" Then I can navigate my app by clicking buttons on app's main menu (theirs hyperlinks are 'localhost/some/base/href/project/events/list' for example). This work perfect, routes founded.

Tried to change path in appRoutes to 'some/base/href/project' and now when I go to "localhost/some/base/href/project/home" HomeCompoment is loaded but url became "localhost/some/base/href/some/base/href/project/home" and also buttons on app's main menu stop working.

Of course, I can make redirect

path: '**',
redirectTo: '/project/home',
pathMatch: 'full'

But this will get me only homepage, I want to manually navigate to other components in app.

UPDATE:
My authGuard, also tried return Observable and Promise but no effect. isAuthorized() always return true now.

canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): boolean {
        let result: boolean = this.authService.isAuthorized();

        if (result) {
            return true;
        }

        this.authService.setRedirectUrl(state.url);

        return false;
    }

Body:
Make your routes this way:

Here we have main branches - Login and Root with empty key - path:
''

And child branches, these path contains children pages - alerts, dashboards and so on.

You able to build path as deep as you need recursively, using children field.

If you want to manually navigate to routes you need to define all paths in you appRoutes array, in the offered style.

const appRoutes: Routes = [
  {path: 'login', component: LoginComponent},
  {path: '', component: MainComponent, redirectTo: '/dashboard', pathMatch: 'full'
    children: [
      { path: 'alert/:id', component: AlertDetailComponent },
      { path: 'alerts', component: AlertsComponent },
      { path: 'dashboard', component: EriskDashboardComponent }
  ]}];

And you able to make some default route to login / 404 page

path: '**',
redirectTo: '/login',
pathMatch: 'full'

Additionally, need to mention, that angular router
uses hash symbol by default in router - #;

So to navigate to login you need to build path like this:

#/login
#/dashboard

http://localhost:4200/#/login

Setting to use hash can be found in app.module.ts, when we importing router module:

imports:[
    RouterModule.forRoot(routes, { useHash: true }),
]


答:
That's not correct sintaxis for switch:

```<code>switch (display) {
            case 'dateTime':
                value = value * 60;
                break;
            case 'null':
                value = value;
                break;
            default:
               value = 'abc';
        }
</code>```

if you dont break on every case, switch will execute all cases, then how you are setting same variable on all cases, the value is the last case default: abc.

Title: Switch statement doesn't work with some variables

Body:
That's not correct sintaxis for switch:

switch (display) {
            case 'dateTime':
                value = value * 60;
                break;
            case 'null':
                value = value;
                break;
            default:
               value = 'abc';
        }

if you dont break on every case, switch will execute all cases, then how you are setting same variable on all cases, the value is the last case default: abc.


问:
Possible to set BroadcastReceiver priority programmatically?
Is it possible to set the priority attribute of a BroadcastReceiver programmatically or can it only be done in XML?
Relevant documents include:

http://developer.android.com/reference/android/content/BroadcastReceiver.html

http://developer.android.com/reference/android/R.styleable.html

It doesn't seem so, but I don't fully understand the relationship of android.R.styleable to a given application and its activities...

答:
You don't set priority on BroadcastReceiver (or Activity) objects, but instead on the IntentFilter object(s) that cause these items to be started.

With that in mind, IntentFilter.setPriority() is what you want to use.


答:
Your .Select() query is returning IEnumerable<string>, not a collection of Area objects (and a string does not have a property named Id)

Based on your query your view code should be just

```<code>@foreach (var area in ViewBag.areas)
{
    <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
        <input name="group4" type="radio" id="@area" class="radio-col-blue-grey" />
        <label for="@area">@area</label>
    </div>
}
</code>```

Alternativey you need to return  a collection of your model

Title: Can't display data from the ViewBag

Body:
Your .Select() query is returning IEnumerable<string>, not a collection of Area objects (and a string does not have a property named Id)

Based on your query your view code should be just

@foreach (var area in ViewBag.areas)
{
    <div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
        <input name="group4" type="radio" id="@area" class="radio-col-blue-grey" />
        <label for="@area">@area</label>
    </div>
}

Alternativey you need to return  a collection of your model


问:
Dotnet CLI build and test – just run the tests
```<code>**\*test*.dll
</code>```

I want use this schema on dotnet cli but I can't found dotnet test documentation nothing.my project file structure is this way this.

At the moment tests It looking at all the .dll files under the .sln file. but I want just looking tests.dll files

```<code>dotnet test --no-build "**\*test*.dll" //?? All files in my project
</code>```

答:
There isn't such a pattern to filter that for dotnet test, we can only filter tests by DisplayName or FullyQualifiedName for xUnit, refer to this link for dertails : https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md

But it can only filter the tests, it cannot exclude other non-test project .dlls.

e.g.

```<code>dotnet test --filter "FullyQualifiedName=YourNamespace.TestClass1.Test1"
</code>```

Howerever you can try writing PowerShell script to filter the test projects and run the command in the loop. Reference: Dotnet CLI – running tests from multiple assemblies

e.g.

```<code>Get-ChildItem | ? { $_.Name.Contains("Test") } | ForEach-Object { Push-Location; Set-Location $_.Name; dotnet test --no-build; Pop-Location}
</code>```

Also this thread for your reference : https://github.com/Microsoft/vstest/issues/705

Another workaround is writing a cmd/bat script to run the test projects only:

e.g.

```<code>cd C:\TestProjectPath\A.Tests

dotnet test --no-build

cd C:\TestProjectPath\B.Tests

dotnet test --no-build

cd C:\TestProjectPath\C.Tests

dotnet test --no-build
</code>```

Body:
**\*test*.dll

I want use this schema on dotnet cli but I can't found dotnet test documentation nothing.my project file structure is this way this.

At the moment tests It looking at all the .dll files under the .sln file. but I want just looking tests.dll files

dotnet test --no-build "**\*test*.dll" //?? All files in my project

Body:
There isn't such a pattern to filter that for dotnet test, we can only filter tests by DisplayName or FullyQualifiedName for xUnit, refer to this link for dertails : https://github.com/Microsoft/vstest-docs/blob/master/docs/filter.md

But it can only filter the tests, it cannot exclude other non-test project .dlls.

e.g.

dotnet test --filter "FullyQualifiedName=YourNamespace.TestClass1.Test1"

Howerever you can try writing PowerShell script to filter the test projects and run the command in the loop. Reference: Dotnet CLI – running tests from multiple assemblies

e.g.

Get-ChildItem | ? { $_.Name.Contains("Test") } | ForEach-Object { Push-Location; Set-Location $_.Name; dotnet test --no-build; Pop-Location}

Also this thread for your reference : https://github.com/Microsoft/vstest/issues/705

Another workaround is writing a cmd/bat script to run the test projects only:

e.g.

cd C:\TestProjectPath\A.Tests

dotnet test --no-build

cd C:\TestProjectPath\B.Tests

dotnet test --no-build

cd C:\TestProjectPath\C.Tests

dotnet test --no-build


问:
Can I define a variable globally then assign it locally and again use it another local method?
Can I define a variable globally then assign it locally and again use it as another local method in Java? I tried to fetch data from FireBase database locally. Using it I want to perform some task in another local method but the problem is I could not manage to get the data to another method. Is there any way to do it?</p>

```<code>double slatitude,slongitude,currbal;
        DatabaseReference mDatabase= FirebaseDatabase.getInstance().getReference();
        DatabaseReference mref,mlat,mlong,mstatus;
    protected void onCreate(@Nullable Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.travel);
            // Get the Intent that started this activity and extract the string
            Intent intent = getIntent();
            String id = intent.getStringExtra(rfidreader.EXTRA_MESSAGE);
            // Capture the layout's TextView and set the string as its text
            textView = (TextView) findViewById(R.id.message);
            //textView.setText(id+" "+"signed in successfully");
            mref=mDatabase.child(id).child("Balance");
            mlat=mDatabase.child(id).child("Start").child("Lat");
            mlong=mDatabase.child(id).child("Start").child("Long");
            mstatus=mDatabase.child(id).child("Status");
            getData(id);

        }
     public void getData(String input)
        {
            pssngrid = input;
            mDatabase.addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot)
                {
                    currbal = dataSnapshot.child(pssngrid).child("Balance").getValue(Double.class);
                    status = dataSnapshot.child(pssngrid).child("Status").getValue(Integer.class);
                    mlatiude = dataSnapshot.child(pssngrid).child("Start").child("Lat").getValue(Double.class);
                    mlongittude = dataSnapshot.child(pssngrid).child("Start").child("Long").getValue(Double.class);
                }
                @Override
                public void onCancelled(DatabaseError databaseError) {

                }
            });
        }
@Override
    protected void onStart() {
        super.onStart();
        if(currbal>=10)
        {
            gps = new GPSTracker(onTravel.this);
            double slatitude = gps.getLatitude();
            double slongitude = gps.getLongitude();
            if(status==0)
            {
                mlat.setValue(slatitude);
                mlong.setValue(slongitude);
                mstatus.setValue(1);
                textView.setText("Thank you,you are eligible for travelling....");

            }
            else if(status==1)
            {
                dis=HaverSineDistance(mlatitude,mlongitude,slatitude,slongitude);
                fare=dis*5;
                newbal=currbal-fare;
                mref.setValue(newbal);
                mstatus.setValue(0);
                textView.setText("Distance Traveled:"+dis+"\n"+"Current Balance:"+currbal+"\n"+"Fare:"+fare+"\n"+"Net Balance:"+newbal);

            }
        }
        else
        {
            textView.setText("Sorry,you are not eligible for travelling this time.Please recharge your card..");

        }
</code>```

答:
There's a difference between what you're doing, and actually making things truly "global" variables.

Private instance variables are how you share variables across methods, however you might be misunderstanding the Activity lifecycle and that Firebase does not  present data to your app in any guaranteed way according to it.

In other words, onStart will likely run first. Then onCreate and getData, and only after that, does the onDataChange event occur

Now you see the issue that currbal and status are  never assigned until much later that you've given.

The correct way to get data to update like this is to make the UI updates from the Firebase callback. And you don't need the fields if you pass through your needed values as parameters

```<code>@Override
protected void onStart() {
    super.onStart();
}

// separate this
private updateUI(String  pssngrid, DataSnapshot dataSnapshot)
    double currbal = dataSnapshot.child(pssngrid).child("Balance").getValue(Double.class);
    int status = dataSnapshot.child(pssngrid).child("Status").getValue(Integer.class);
    double mlatiude = dataSnapshot.child(pssngrid).child("Start").child("Lat").getValue(Double.class);
     double mlongittude = dataSnapshot.child(pssngrid).child("Start").child("Long").getValue(Double.class);

    if(currbal>=10) {
      ...
</code>```

And

```<code>public void getData(final String input) {
        mDatabase.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot)
            {
                updateUI(input, dataSnapshot);
            }
            @Override
            public void onCancelled(DatabaseError databaseError) {

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

Also, remove all unnecessary DatabaseReference variables. You only need the one you're querying

You may want to additionally retrieve your Firebase data as a single Java object, rather than individually extracting the fields

Body:
Can I define a variable globally then assign it locally and again use it as another local method in Java? I tried to fetch data from FireBase database locally. Using it I want to perform some task in another local method but the problem is I could not manage to get the data to another method. Is there any way to do it?

double slatitude,slongitude,currbal;
        DatabaseReference mDatabase= FirebaseDatabase.getInstance().getReference();
        DatabaseReference mref,mlat,mlong,mstatus;
    protected void onCreate(@Nullable Bundle savedInstanceState)
        {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.travel);
            // Get the Intent that started this activity and extract the string
            Intent intent = getIntent();
            String id = intent.getStringExtra(rfidreader.EXTRA_MESSAGE);
            // Capture the layout's TextView and set the string as its text
            textView = (TextView) findViewById(R.id.message);
            //textView.setText(id+" "+"signed in successfully");
            mref=mDatabase.child(id).child("Balance");
            mlat=mDatabase.child(id).child("Start").child("Lat");
            mlong=mDatabase.child(id).child("Start").child("Long");
            mstatus=mDatabase.child(id).child("Status");
            getData(id);

        }
     public void getData(String input)
        {
            pssngrid = input;
            mDatabase.addValueEventListener(new ValueEventListener() {
                @Override
                public void onDataChange(DataSnapshot dataSnapshot)
                {
                    currbal = dataSnapshot.child(pssngrid).child("Balance").getValue(Double.class);
                    status = dataSnapshot.child(pssngrid).child("Status").getValue(Integer.class);
                    mlatiude = dataSnapshot.child(pssngrid).child("Start").child("Lat").getValue(Double.class);
                    mlongittude = dataSnapshot.child(pssngrid).child("Start").child("Long").getValue(Double.class);
                }
                @Override
                public void onCancelled(DatabaseError databaseError) {

                }
            });
        }
@Override
    protected void onStart() {
        super.onStart();
        if(currbal>=10)
        {
            gps = new GPSTracker(onTravel.this);
            double slatitude = gps.getLatitude();
            double slongitude = gps.getLongitude();
            if(status==0)
            {
                mlat.setValue(slatitude);
                mlong.setValue(slongitude);
                mstatus.setValue(1);
                textView.setText("Thank you,you are eligible for travelling....");

            }
            else if(status==1)
            {
                dis=HaverSineDistance(mlatitude,mlongitude,slatitude,slongitude);
                fare=dis*5;
                newbal=currbal-fare;
                mref.setValue(newbal);
                mstatus.setValue(0);
                textView.setText("Distance Traveled:"+dis+"\n"+"Current Balance:"+currbal+"\n"+"Fare:"+fare+"\n"+"Net Balance:"+newbal);

            }
        }
        else
        {
            textView.setText("Sorry,you are not eligible for travelling this time.Please recharge your card..");

        }

Body:
There's a difference between what you're doing, and actually making things truly "global" variables.

Private instance variables are how you share variables across methods, however you might be misunderstanding the Activity lifecycle and that Firebase does not  present data to your app in any guaranteed way according to it.

In other words, onStart will likely run first. Then onCreate and getData, and only after that, does the onDataChange event occur

Now you see the issue that currbal and status are  never assigned until much later that you've given.

The correct way to get data to update like this is to make the UI updates from the Firebase callback. And you don't need the fields if you pass through your needed values as parameters

@Override
protected void onStart() {
    super.onStart();
}

// separate this
private updateUI(String  pssngrid, DataSnapshot dataSnapshot)
    double currbal = dataSnapshot.child(pssngrid).child("Balance").getValue(Double.class);
    int status = dataSnapshot.child(pssngrid).child("Status").getValue(Integer.class);
    double mlatiude = dataSnapshot.child(pssngrid).child("Start").child("Lat").getValue(Double.class);
     double mlongittude = dataSnapshot.child(pssngrid).child("Start").child("Long").getValue(Double.class);

    if(currbal>=10) {
      ...

And

public void getData(final String input) {
        mDatabase.addValueEventListener(new ValueEventListener() {
            @Override
            public void onDataChange(DataSnapshot dataSnapshot)
            {
                updateUI(input, dataSnapshot);
            }
            @Override
            public void onCancelled(DatabaseError databaseError) {

            }
        });
    }

Also, remove all unnecessary DatabaseReference variables. You only need the one you're querying

You may want to additionally retrieve your Firebase data as a single Java object, rather than individually extracting the fields


问:
How to replace an entire table with pictures?
This is my table, of course with some text in it, and I want on a button click to hide it, and show some images. I also want to reverse the action on the same button click. How can I do that?

```

答:
you can start with jQuery .toggle() method

```<code>$("button").click(function(){
    $("img").toggle();
});
</code>```

this will work as you need

Have a look here: http://api.jquery.com/toggle/

Body:
you can start with jQuery .toggle() method

$("button").click(function(){
    $("img").toggle();
});

this will work as you need

Have a look here: http://api.jquery.com/toggle/


问:
How to use DevExpress Logify with Postsharp 5.0 Logging along with Serilog
DevExpress Logify supports SeriLog and logs all fatal erros to its server. According to their document when ever serilog logs an error it will automatically trigger Logify as follows

```<code> Log.Logger = new LoggerConfiguration()
            .WriteTo.Seq("http://localhost:5341").MinimumLevel.Error()
            .WriteTo.Console(LogEventLevel.Error)
            .WriteTo.LogifyAlert()
            .ReadFrom.AppSettings()
            .CreateLogger();
</code>```

its working fine when using Serilog but the moment I use postsharp the event is not logged.

```<code>  LoggingServices.DefaultBackend = new SerilogLoggingBackend();
</code>```

How can I solve this?

答:
According to the aforementioned link, currently, it is necessary to access the LogifyAlert.Instance property before creating LoggerConfiguration to initialize a Logify engine inside a plugin.

```<code>LogifyAlert client = LogifyAlert.Instance;
...
Log.Logger = new LoggerConfiguration();
</code>```

Body:
DevExpress Logify supports SeriLog and logs all fatal erros to its server. According to their document when ever serilog logs an error it will automatically trigger Logify as follows

 Log.Logger = new LoggerConfiguration()
            .WriteTo.Seq("http://localhost:5341").MinimumLevel.Error()
            .WriteTo.Console(LogEventLevel.Error)
            .WriteTo.LogifyAlert()
            .ReadFrom.AppSettings()
            .CreateLogger();

its working fine when using Serilog but the moment I use postsharp the event is not logged.

  LoggingServices.DefaultBackend = new SerilogLoggingBackend();

How can I solve this?

Body:
According to the aforementioned link, currently, it is necessary to access the LogifyAlert.Instance property before creating LoggerConfiguration to initialize a Logify engine inside a plugin.

LogifyAlert client = LogifyAlert.Instance;
...
Log.Logger = new LoggerConfiguration();


问:
How can stop a mule project in Mule standalone(server)?
I am a beginner in Mule
How can stop a Mule project in Mule standalone(server)?</p>

答:
Please do either of the following:
delete anchor.txt file or
undeploy the appliction or
kill the process in task mamnager</p>