问:
AndroidStudio build with Dagger2: java.lang.IllegalArgumentException: ... cannot be represented as a Class<?>
When I try to build my project I get this error (Gradle ran with --stacktrace command line option):

```<code>    * Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJavaWithJavac'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Error:java.lang.RuntimeException: java.lang.IllegalArgumentException: ProductManager cannot be represented as a Class<?>.
    at com.sun.tools.javac.main.Main.compile(Main.java:469)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:45)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:101)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:50)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:36)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:34)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
    at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:157)
    at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:139)
    at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:93)
    at com.android.build.gradle.tasks.factory.AndroidJavaCompile.compile(AndroidJavaCompile.java:49)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 70 more
Error:java.lang.IllegalArgumentException: ProductManager cannot be represented as a Class<?>.
    at dagger.shaded.auto.common.MoreTypes$16.defaultAction(MoreTypes.java:658)
    at dagger.shaded.auto.common.MoreTypes$16.defaultAction(MoreTypes.java:656)
    at com.sun.tools.javac.code.Type$ErrorType.accept(Type.java:1349)
    at dagger.shaded.auto.common.MoreTypes.isTypeOf(MoreTypes.java:656)
    at dagger.internal.codegen.DependencyRequest$Factory.extractKindAndType(DependencyRequest.java:271)
    at dagger.internal.codegen.DependencyRequest$Factory.newDependencyRequest(DependencyRequest.java:239)
    at dagger.internal.codegen.DependencyRequest$Factory.forRequiredResolvedVariable(DependencyRequest.java:165)
    at dagger.internal.codegen.MembersInjectionBinding$Factory.injectionSiteForInjectField(MembersInjectionBinding.java:161)
    at dagger.internal.codegen.MembersInjectionBinding$Factory.access$200(MembersInjectionBinding.java:126)
    at dagger.internal.codegen.MembersInjectionBinding$Factory$1.visitVariableAsField(MembersInjectionBinding.java:208)
    at dagger.internal.codegen.MembersInjectionBinding$Factory$1.visitVariableAsField(MembersInjectionBinding.java:197)
    at com.sun.tools.javac.code.Symbol$VarSymbol.accept(Symbol.java:964)
    at dagger.internal.codegen.MembersInjectionBinding$Factory.forInjectedType(MembersInjectionBinding.java:195)
    at dagger.internal.codegen.InjectBindingRegistry.getOrFindMembersInjectionBinding(InjectBindingRegistry.java:261)
    at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.rollUpMembersInjectionBindings(BindingGraph.java:374)
    at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.lookUpBindings(BindingGraph.java:366)
    at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.resolve(BindingGraph.java:461)
    at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:228)
    at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:236)
    at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:151)
    at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:76)
    at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:228)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
    at com.sun.tools.javac.main.Main.compile(Main.java:439)
    ... 89 more
Information:BUILD FAILED
</code>```

I double checked all my Components and Modules - everything looks fine. AndroidStudio does not show any additional errors. How to resolve this issue?

答:
Doubtful this will help anyone, but I will add my answer anyway:

I had a that accepted a RetrofitService but I forget to do an @Provides annotation for that particular service.

I did have to do some hunting though. If you run into this issue, try and see if you can start with injecting some of your larger dependencies and see when that fails. Hopefully, the error reporting will improve over time.

Body:
When I try to build my project I get this error (Gradle ran with --stacktrace command line option):

    * Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':app:compileDebugJavaWithJavac'.
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
    at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
    at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
    at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
    at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
    at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
    at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:203)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:185)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:66)
    at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:50)
    at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor.process(DefaultTaskPlanExecutor.java:25)
    at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter.execute(DefaultTaskGraphExecuter.java:110)
    at org.gradle.execution.SelectedTaskExecutionAction.execute(SelectedTaskExecutionAction.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.access$000(DefaultBuildExecuter.java:23)
    at org.gradle.execution.DefaultBuildExecuter$1.proceed(DefaultBuildExecuter.java:43)
    at org.gradle.execution.DryRunBuildExecutionAction.execute(DryRunBuildExecutionAction.java:32)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:37)
    at org.gradle.execution.DefaultBuildExecuter.execute(DefaultBuildExecuter.java:30)
    at org.gradle.initialization.DefaultGradleLauncher$4.run(DefaultGradleLauncher.java:154)
    at org.gradle.internal.Factories$1.create(Factories.java:22)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:52)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
    at org.gradle.initialization.DefaultGradleLauncher.access$200(DefaultGradleLauncher.java:32)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:99)
    at org.gradle.initialization.DefaultGradleLauncher$1.create(DefaultGradleLauncher.java:93)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:90)
    at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:62)
    at org.gradle.initialization.DefaultGradleLauncher.doBuild(DefaultGradleLauncher.java:93)
    at org.gradle.initialization.DefaultGradleLauncher.run(DefaultGradleLauncher.java:82)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$DefaultBuildController.run(InProcessBuildActionExecuter.java:94)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:46)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.tooling.internal.provider.runner.SubscribableBuildActionRunner.run(SubscribableBuildActionRunner.java:58)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:43)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:28)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.launcher.exec.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:48)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:52)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:74)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput$2.call(ForwardClientInput.java:72)
    at org.gradle.util.Swapper.swap(Swapper.java:38)
    at org.gradle.launcher.daemon.server.exec.ForwardClientInput.execute(ForwardClientInput.java:72)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.DaemonHealthTracker.execute(DaemonHealthTracker.java:47)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:66)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:72)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.health.HintGCAfterBuild.execute(HintGCAfterBuild.java:41)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:120)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:246)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
    at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Error:java.lang.RuntimeException: java.lang.IllegalArgumentException: ProductManager cannot be represented as a Class<?>.
    at com.sun.tools.javac.main.Main.compile(Main.java:469)
    at com.sun.tools.javac.api.JavacTaskImpl.call(JavacTaskImpl.java:132)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:45)
    at org.gradle.api.internal.tasks.compile.JdkJavaCompiler.execute(JdkJavaCompiler.java:33)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.delegateAndHandleErrors(NormalizingJavaCompiler.java:101)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:50)
    at org.gradle.api.internal.tasks.compile.NormalizingJavaCompiler.execute(NormalizingJavaCompiler.java:36)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:34)
    at org.gradle.api.internal.tasks.compile.CleaningJavaCompilerSupport.execute(CleaningJavaCompilerSupport.java:25)
    at org.gradle.api.tasks.compile.JavaCompile.performCompilation(JavaCompile.java:157)
    at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:139)
    at org.gradle.api.tasks.compile.JavaCompile.compile(JavaCompile.java:93)
    at com.android.build.gradle.tasks.factory.AndroidJavaCompile.compile(AndroidJavaCompile.java:49)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.doExecute(AnnotationProcessingTaskFactory.java:244)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$IncrementalTaskAction.execute(AnnotationProcessingTaskFactory.java:231)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 70 more
Error:java.lang.IllegalArgumentException: ProductManager cannot be represented as a Class<?>.
    at dagger.shaded.auto.common.MoreTypes$16.defaultAction(MoreTypes.java:658)
    at dagger.shaded.auto.common.MoreTypes$16.defaultAction(MoreTypes.java:656)
    at com.sun.tools.javac.code.Type$ErrorType.accept(Type.java:1349)
    at dagger.shaded.auto.common.MoreTypes.isTypeOf(MoreTypes.java:656)
    at dagger.internal.codegen.DependencyRequest$Factory.extractKindAndType(DependencyRequest.java:271)
    at dagger.internal.codegen.DependencyRequest$Factory.newDependencyRequest(DependencyRequest.java:239)
    at dagger.internal.codegen.DependencyRequest$Factory.forRequiredResolvedVariable(DependencyRequest.java:165)
    at dagger.internal.codegen.MembersInjectionBinding$Factory.injectionSiteForInjectField(MembersInjectionBinding.java:161)
    at dagger.internal.codegen.MembersInjectionBinding$Factory.access$200(MembersInjectionBinding.java:126)
    at dagger.internal.codegen.MembersInjectionBinding$Factory$1.visitVariableAsField(MembersInjectionBinding.java:208)
    at dagger.internal.codegen.MembersInjectionBinding$Factory$1.visitVariableAsField(MembersInjectionBinding.java:197)
    at com.sun.tools.javac.code.Symbol$VarSymbol.accept(Symbol.java:964)
    at dagger.internal.codegen.MembersInjectionBinding$Factory.forInjectedType(MembersInjectionBinding.java:195)
    at dagger.internal.codegen.InjectBindingRegistry.getOrFindMembersInjectionBinding(InjectBindingRegistry.java:261)
    at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.rollUpMembersInjectionBindings(BindingGraph.java:374)
    at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.lookUpBindings(BindingGraph.java:366)
    at dagger.internal.codegen.BindingGraph$Factory$RequestResolver.resolve(BindingGraph.java:461)
    at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:228)
    at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:236)
    at dagger.internal.codegen.BindingGraph$Factory.create(BindingGraph.java:151)
    at dagger.internal.codegen.ComponentProcessingStep.process(ComponentProcessingStep.java:76)
    at dagger.shaded.auto.common.BasicAnnotationProcessor.process(BasicAnnotationProcessor.java:228)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:793)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:722)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.access$1700(JavacProcessingEnvironment.java:97)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1029)
    at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1163)
    at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:1108)
    at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:824)
    at com.sun.tools.javac.main.Main.compile(Main.java:439)
    ... 89 more
Information:BUILD FAILED

I double checked all my Components and Modules - everything looks fine. AndroidStudio does not show any additional errors. How to resolve this issue?


来源: stackexchange

问:
What is the best way to pass the **sensitive data** from one action method controller to another controller action method controller
Here am using TempData["Amount"] to pass the total cart amount from one controller action to another action method. so I had a doubt its good practice to use TempData["Amount"] pass sensitive information from one action method to another action method . what's the life time of time data (like sessions 20 mins) and how handle the exception of TempData["Amount"].

```<code>if (adoptionDetails != null)
      {
        foreach (var m in adoptionDetails.animalAdaptionDetails.ToList())
          {
            amount += Convert.ToInt32(m.amount);
            animalNames += m.name;
             animalNames += ",";
           }
        ViewBag.Amount = amount;
        ViewBag.animalsName = animalNames;
        TempData["Amount"] = amount;
        return View(adoptionDetails);
       }
else
     {
        return View("~/Views/Users/Errorpage.cshtml");
      }
</code>```

答:
You can start thinking about it in a different way.

You have some user data, whatever it is, which you need to make available to your application in multiple places. One option is the session, it is user bound, it is short lived and works well provided you don't store too much in it.

Once you have the data in one place, you no longer have to think about passing it between controllers, instead you start to pull it, wherever you need it. You could start building some services which you can use to work with your storage. I said session, but you can just as easily use something else, like an actual database, which for things like shopping carts is not a bad idea.

The idea here is to stop thinking from the point of view of MVC and start to think at application level.

ContentLicense: CC BY-SA 4.0

Body:
Here am using TempData["Amount"] to pass the total cart amount from one controller action to another action method. so I had a doubt its good practice to use TempData["Amount"] pass sensitive information from one action method to another action method . what's the life time of time data (like sessions 20 mins) and how handle the exception of TempData["Amount"].

if (adoptionDetails != null)
      {
        foreach (var m in adoptionDetails.animalAdaptionDetails.ToList())
          {
            amount += Convert.ToInt32(m.amount);
            animalNames += m.name;
             animalNames += ",";
           }
        ViewBag.Amount = amount;
        ViewBag.animalsName = animalNames;
        TempData["Amount"] = amount;
        return View(adoptionDetails);
       }
else
     {
        return View("~/Views/Users/Errorpage.cshtml");
      }


问:
Error response from daemon: network myapp not found
I am trying to create a container in a multihost network but while creating I am getting this error:

```<code>Error response from daemon: network myapp not found
</code>```

Here myapp is the name of overlay network which i have created. The command I am using is:

```<code>sudo docker run --rm -it --name=test_cont --net=myapp ubuntu bash
</code>```

答:
I started getting this error after doing a docker system prune.

docker network ls showed my network:

```<code>NETWORK ID          NAME                DRIVER              SCOPE
pgl0gb0mbwql        myapp               overlay             swarm
</code>```

But deploying the stack would give error like:

```<code>failed to create service myapp_database: Error response from daemon: network myapp not found
</code>```

Then I asked myself the most important debugging question there is: Have you tried turning it off and on again?

I restarted my docker daemon and the network was deleted for real. I was then able to re-create it and everything started working again.

ContentLicense: CC BY-SA 3.0

Body:
I am trying to create a container in a multihost network but while creating I am getting this error:

Error response from daemon: network myapp not found

Here myapp is the name of overlay network which i have created. The command I am using is:

sudo docker run --rm -it --name=test_cont --net=myapp ubuntu bash

Body:
I started getting this error after doing a docker system prune.

docker network ls showed my network:

NETWORK ID          NAME                DRIVER              SCOPE
pgl0gb0mbwql        myapp               overlay             swarm

But deploying the stack would give error like:

failed to create service myapp_database: Error response from daemon: network myapp not found

Then I asked myself the most important debugging question there is: Have you tried turning it off and on again?

I restarted my docker daemon and the network was deleted for real. I was then able to re-create it and everything started working again.


问:
Passing a variable to frame
I am creating a password manager software. The passwords are stored in different categories. When I click on the category it should open a ViewPasswordsInsideCategory page.
I am unable to pass the category name to the ViewPasswordsInsideCategory page.
Please help! I am new to Python and cant solve this issue.

I tried to pass an argument when I can showframe function but I couldn't achieve the goal.

class PasswordPage(Page):
    def __init__(self, *args, **kwargs):
        Page.__init__(self, *args, **kwargs)

        self.shared_data = {
            "category": tk.StringVar(),
            "password": tk.StringVar()}

        self.passwordScreen = Frame(self)
        self.passwordScreen.pack(fill="both", expand=True)
        self.passwordScreen.columnconfigure(0, weight=1)
        self.passwordScreen.rowconfigure(0, weight=1)

        self.frames = {}

        for F in (PasswordCategoryPage,ViewPasswords_InCategory,CreateNewPassword,ViewPassword,ModifyPassword):
            page_name = F.__name__
            frame = F(parent=self.passwordScreen, controller=self)
            self.frames[page_name] = frame

            frame.grid(row=0, column=0, sticky="nsew")

        self.show_frame("PasswordCategoryPage")

    def show_frame(self, page_name, arg=None):
        '''Show a frame for the given page name'''
        frame = self.frames[page_name]
        frame.tkraise()
class PasswordCategoryPage(tk.Frame):

    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller

        # passwords categories content

        self.labels = []

        self.dict = {'Home': 'Blue', 'Work': 'Red', 'School': 'Yellow', "Technical": 'Pink', "Office": 'Orange'}
        self.button = []

        j = 0
        for key, value in self.dict.items():
            self.name = key
            self.key = Label(self.pass_page_container,text=self.name,bg=value)

            # Add the Label to the list
            self.labels.append(key)

            self.key.grid(row=j, column=0, sticky=(N, S, E, W))
            self.key.bind("<Double-Button-1>", self.showPasswordPage)
            j = j + 1

    def showPasswordPage(self,event):
        #here need to pass the label that was clicked to the ViewPasswords_InCategory page
        self.controller.show_frame("ViewPasswords_InCategory")

class ViewPasswords_InCategory(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
 #here need the name of the category selected to extract data from database

        # home banner
        home_label = Label(self, text=here need the name of the category, bg="blue", width=200, height=3, fg='white')
        home_label.pack(side=TOP, expand=False)

```

答:
The simply way is to add a new function in class ViewPasswords_InCategory to update the banner.  Then whenever you switch to the page, call the new function.  My proposed changes are:

1) return the frame that is raised in function PasswordPage.show_frame(...):

```<code>class PasswordPage(Page):
    ...
    def show_frame(self, page_name, arg=None):
        '''Show a frame for the given page name'''
        frame = self.frames[page_name]
        frame.tkraise()
        return frame  # return the raised frame
</code>```

2) add new function, for example set_category(...) inside class ViewPasswords_InCategory to update its banner:

```<code>class ViewPasswords_InCategory(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        # home banner
        self.home_label = Label(self, text='', bg="blue", width=200, height=3, fg='white') # changed to instance variable
        self.home_label.pack(side=TOP, expand=False)

    # new function to update banner
    def set_category(self, category):
        self.home_label['text'] = category
</code>```

3) update PasswordCategoryPage.showPasswordPage(...) to call the new fucntion:

```<code>class PasswordCategoryPage(tk.Frame):
    ...
    def showPasswordPage(self,event):
        #here need to pass the label that was clicked to the ViewPasswords_InCategory page
        self.controller.show_frame("ViewPasswords_InCategory").set_category(event.widget['text'])
</code>```

Title: Passing a variable to frame

Body:
The simply way is to add a new function in class ViewPasswords_InCategory to update the banner.  Then whenever you switch to the page, call the new function.  My proposed changes are:

1) return the frame that is raised in function PasswordPage.show_frame(...):

class PasswordPage(Page):
    ...
    def show_frame(self, page_name, arg=None):
        '''Show a frame for the given page name'''
        frame = self.frames[page_name]
        frame.tkraise()
        return frame  # return the raised frame

2) add new function, for example set_category(...) inside class ViewPasswords_InCategory to update its banner:

class ViewPasswords_InCategory(tk.Frame):
    def __init__(self, parent, controller):
        tk.Frame.__init__(self, parent)
        self.controller = controller
        # home banner
        self.home_label = Label(self, text='', bg="blue", width=200, height=3, fg='white') # changed to instance variable
        self.home_label.pack(side=TOP, expand=False)

    # new function to update banner
    def set_category(self, category):
        self.home_label['text'] = category

3) update PasswordCategoryPage.showPasswordPage(...) to call the new fucntion:

class PasswordCategoryPage(tk.Frame):
    ...
    def showPasswordPage(self,event):
        #here need to pass the label that was clicked to the ViewPasswords_InCategory page
        self.controller.show_frame("ViewPasswords_InCategory").set_category(event.widget['text'])


问:
how to determine maximum route cost in a n high numeric pyramid
I've got a numeric pyramid like this

```<code>       7
      4 8
     1 8 9
    2 4 6 7
   4 6 7 4 9
  4 9 7 3 8 8

routes: 32
</code>```

every number indexed by how powerful in its line.

```<code> 0 ( 9 => 1 ) 1 ( 8 => 5 ) 2 ( 8 => 4 ) 3 ( 7 => 2 ) 4 ( 4 => 0 ) 5 ( 3 => 3 )
 0 ( 9 => 4 ) 1 ( 7 => 2 ) 2 ( 6 => 1 ) 3 ( 4 => 3 ) 4 ( 4 => 0 )
 0 ( 7 => 3 ) 1 ( 6 => 2 ) 2 ( 4 => 1 ) 3 ( 2 => 0 )
 0 ( 9 => 2 ) 1 ( 8 => 1 ) 2 ( 1 => 0 )
 0 ( 8 => 1 ) 1 ( 4 => 0 )
 0 ( 7 => 0 )
</code>```

in this pyramid there are 2^(n-1) routes (you can go 2 way form each number)
If the pyramid high this low, it's easy you can calculate all the routes, and compare to eachother. But if you have an 50 high pyramid with 562949953421312 routes, the problem little bit more difficult.

I thoght I start from the bottom beginning from the most powerful numbers, but soon i realized, the max route cost ain't necesserly start or end up in big numbers.

Then I thought maybe secoundary indexes (where can you go futher from a number) will help, but I didin't even implement that becouse I assumed its still uses much resources and not optimal.

And now i'm confused how to restart thinking about this problem... any advice appreciated

答:
Think of your pyramid as a tree with the root at the top of the pyramid: I think you want the route with the maximum cost from the root to any of the leaf nodes (bottom of the pyramid). OK, it's not actually a tree, because a node may have two parents, in fact you can get to a node at level i from at most two nodes at level i-1.

Anyway, I think you can compute the route with the maximum cost by using dynamic programming. Let me rewrite your data in a matrix like way:

```<code>7
4 8
1 8 9
2 4 6 7
4 6 7 4 9
4 9 7 3 8 8
</code>```

and let the missing elements of the matrix be 0. Let's call this matrix v (for values). Now you can build a matrix c (for costs) where c(i,j) is the maximum cost for reaching the tree node at position (i,j). You can compute it with this recurrence:

c(i,j) = v(i,j) + max{ c(i-1,j-1), c(i-1,j) }

where c(h,k) is 0 when you get to a position out of the matrix. Essentially we say that the maximum cost for getting to node at position (i,j) is the cost of the node itself plus the maximum between the costs of getting to its two possible parents at level i-1.

Here is c for your example:

```<code>7
11 15
12 23 24
14 27 30 31
18 33 37 35 40
22 42 44 40 48 48
</code>```

For instance, let's take i=3, j=2:

```<code>c(3,2) = v(3,2) + max{ c(2,1), c(2,2) }
       = 6      + max{ 23    , 24     }
       = 30
</code>```

From c you see that the most expensive rout costs 48 (and you have two of them).

Body:
I've got a numeric pyramid like this

       7
      4 8
     1 8 9
    2 4 6 7
   4 6 7 4 9
  4 9 7 3 8 8

routes: 32

every number indexed by how powerful in its line.

 0 ( 9 => 1 ) 1 ( 8 => 5 ) 2 ( 8 => 4 ) 3 ( 7 => 2 ) 4 ( 4 => 0 ) 5 ( 3 => 3 )
 0 ( 9 => 4 ) 1 ( 7 => 2 ) 2 ( 6 => 1 ) 3 ( 4 => 3 ) 4 ( 4 => 0 )
 0 ( 7 => 3 ) 1 ( 6 => 2 ) 2 ( 4 => 1 ) 3 ( 2 => 0 )
 0 ( 9 => 2 ) 1 ( 8 => 1 ) 2 ( 1 => 0 )
 0 ( 8 => 1 ) 1 ( 4 => 0 )
 0 ( 7 => 0 )

in this pyramid there are 2^(n-1) routes (you can go 2 way form each number)
If the pyramid high this low, it's easy you can calculate all the routes, and compare to eachother. But if you have an 50 high pyramid with 562949953421312 routes, the problem little bit more difficult.

I thoght I start from the bottom beginning from the most powerful numbers, but soon i realized, the max route cost ain't necesserly start or end up in big numbers.

Then I thought maybe secoundary indexes (where can you go futher from a number) will help, but I didin't even implement that becouse I assumed its still uses much resources and not optimal.

And now i'm confused how to restart thinking about this problem... any advice appreciated

Body:
Think of your pyramid as a tree with the root at the top of the pyramid: I think you want the route with the maximum cost from the root to any of the leaf nodes (bottom of the pyramid). OK, it's not actually a tree, because a node may have two parents, in fact you can get to a node at level i from at most two nodes at level i-1.

Anyway, I think you can compute the route with the maximum cost by using dynamic programming. Let me rewrite your data in a matrix like way:

7
4 8
1 8 9
2 4 6 7
4 6 7 4 9
4 9 7 3 8 8

and let the missing elements of the matrix be 0. Let's call this matrix v (for values). Now you can build a matrix c (for costs) where c(i,j) is the maximum cost for reaching the tree node at position (i,j). You can compute it with this recurrence:

c(i,j) = v(i,j) + max{ c(i-1,j-1), c(i-1,j) }

where c(h,k) is 0 when you get to a position out of the matrix. Essentially we say that the maximum cost for getting to node at position (i,j) is the cost of the node itself plus the maximum between the costs of getting to its two possible parents at level i-1.

Here is c for your example:

7
11 15
12 23 24
14 27 30 31
18 33 37 35 40
22 42 44 40 48 48

For instance, let's take i=3, j=2:

c(3,2) = v(3,2) + max{ c(2,1), c(2,2) }
       = 6      + max{ 23    , 24     }
       = 30

From c you see that the most expensive rout costs 48 (and you have two of them).


问:
How to generate 5 percent unique numbers between 1 and 10 Million in oracle table?
I have a task to generate unique numbers(in terms of percentage) in a given range. For example: I need to generate 10 million random numbers in an oracle table out of which 5% values are unique.</p>

答:
Here is my design:

5% from 10 million is half a million. so you can reserve the range of 1-500,000 for unique numbers.

when you generate the sequence of random numbers, you generate random number in the range 500,001 - 10,000,000 and every 20th call, take the next number from the reserved pool


问:
React - dynamic input fields based on count
I want create the textfields based on the count entered by the user. I have gone through many related questions, I cannot find the result as I want.

For Example: If the user enter 5 as input.. I want to create 5 text boxes for entering 5 people Name and Mobile.

How can I achieve this?

TextField to get count

```<code>  <GridItem xs={12} sm={12} md={12}>
                      <TextField
                        id="sp_Inhouse"
                        label="Number of Pilots Available "
                        type="number"
                        fullWidth
                        className={classes.textField}
                        value={this.state.sp_Inhousecount}
                        error={!!this.state.sp_InhouseError}
                        helperText={this.state.sp_InhouseError}
                        onChange={this.handleChangeInhouse}
                        margin="normal"
                        required
                      />
                    </GridItem>
</code>```

Tried adding the textboxes based on button click. It works fine. but I want the result as explained.

```<code>                    <GridItem xs={12} sm={12} md={12}>
                       <Button color="primary" onClick={this.handleCreatePilots}>
                      <AddIcon />  Add Pilots
                      </Button>
                      {this.state.inhouse.map((index) => {
                        return (
                          <div key={index}>
                          <TextField
                            id="sp_Name"

                            label="Name "
                            type="number"
                            fullWidth
                          />
 <TextField
                            id="sp_Mobile"

                            label="Name "
                            type="number"
                            fullWidth
                          />
                          </div>
                        )
                      })
                      }
                    </GridItem>
</code>```

```<code> handleCreatePilots=()=>{
    this.setState({
      inhouse:[...this.state.inhouse,'']
    })
  }
</code>```

答:
Here is the solution. Other refactor may be required.

Working link
https://jsfiddle.net/ogmv3wpu/1/

class Hello extends React.Component {
 constructor() {
  super();
  this.state= {
   inputSize: 0
  }
 }

 handleOnChange(value){
 this.setState({
 inputSize: value.target.value
 });
 }

 renderInputs(value){
  const inputs=[];
  for(let i=0; i<value; i++){
    inputs.push(
<input  value={Name}}type="text" name="quantity"/>
)
  }
  return inputs;
 }

  render() {
  console.log(this.state.inputSize);
    return (

    <input type="number" name="quantity" min="0" max="99999" onChange={(value)=>this.handleOnChange(value)}/>

    {this.renderInputs(this.state.inputSize)}

    )
  }
}

ReactDOM.render(
  <Hello name="World" />,
  document.getElementById('container')
);```
<pre class="snippet-code-html lang-html prettyprint-override"><code><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="container">
    <!-- This element's contents will be replaced with your component. -->
</div></code>```

Body:
I want create the textfields based on the count entered by the user. I have gone through many related questions, I cannot find the result as I want.

For Example: If the user enter 5 as input.. I want to create 5 text boxes for entering 5 people Name and Mobile.

How can I achieve this?

TextField to get count

  <GridItem xs={12} sm={12} md={12}>
                      <TextField
                        id="sp_Inhouse"
                        label="Number of Pilots Available "
                        type="number"
                        fullWidth
                        className={classes.textField}
                        value={this.state.sp_Inhousecount}
                        error={!!this.state.sp_InhouseError}
                        helperText={this.state.sp_InhouseError}
                        onChange={this.handleChangeInhouse}
                        margin="normal"
                        required
                      />
                    </GridItem>

Tried adding the textboxes based on button click. It works fine. but I want the result as explained.

                    <GridItem xs={12} sm={12} md={12}>
                       <Button color="primary" onClick={this.handleCreatePilots}>
                      <AddIcon />  Add Pilots
                      </Button>
                      {this.state.inhouse.map((index) => {
                        return (

                          <TextField
                            id="sp_Name"

                            label="Name "
                            type="number"
                            fullWidth
                          />
 <TextField
                            id="sp_Mobile"

                            label="Name "
                            type="number"
                            fullWidth
                          />

                        )
                      })
                      }
                    </GridItem>

 handleCreatePilots=()=>{
    this.setState({
      inhouse:[...this.state.inhouse,'']
    })
  }

Body:
Here is the solution. Other refactor may be required.

Working link
https://jsfiddle.net/ogmv3wpu/1/

class Hello extends React.Component {
 constructor() {
  super();
  this.state= {
   inputSize: 0
  }
 }

 handleOnChange(value){
 this.setState({
 inputSize: value.target.value
 });
 }

 renderInputs(value){
  const inputs=[];
  for(let i=0; i<value; i++){
    inputs.push(<div key={i}><input  value={Name}}type="text" name="quantity"/></div>)
  }
  return inputs;
 }

  render() {
  console.log(this.state.inputSize);
    return (<div>
    <input type="number" name="quantity" min="0" max="99999" onChange={(value)=>this.handleOnChange(value)}/>
    <div>
    {this.renderInputs(this.state.inputSize)}
    </div>
    </div>
    )
  }
}

ReactDOM.render(
  <Hello name="World" />,
  document.getElementById('container')
);

<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="container">
    <!-- This element's contents will be replaced with your component. -->
</div>


问:
PHP PDO with Oracle, call stored procedure when output parameter is a cursor
i'm trying to use php with pdo. Is there any examples how to call oracle's stored procedure when the output parameter is a cursor?

I was able to do it using php with adodb and also oci8 extension

This is my stored procedure in Oracle

```<code>create or replace procedure   Search_Personal_Data
(   p_tipo_doc in Persona.TIPO_DOC%type,
    p_nro_doc in  Persona.NRO_DOC%type,
    prc out sys_refcursor
)
AS
begin
   //some code
end;
</code>```

答:
PDO_OCI doesn't support REF CURSORS bind variables.

PDO is an abstraction layer so it doesn't have all the bells and whistles that native drivers like OCI8 have (although there has been some creep since the original PDO implementation).

You could convert the REF CURSOR to a PIPE, see https://blogs.oracle.com/opal/converting-ref-cursor-to-pipe-for-performance-in-php-oci8-and-pdooci

Body:
i'm trying to use php with pdo. Is there any examples how to call oracle's stored procedure when the output parameter is a cursor?

I was able to do it using php with adodb and also oci8 extension

This is my stored procedure in Oracle

create or replace procedure   Search_Personal_Data
(   p_tipo_doc in Persona.TIPO_DOC%type,
    p_nro_doc in  Persona.NRO_DOC%type,
    prc out sys_refcursor
)
AS
begin
   //some code
end;


问:
Laravel/Mysql - Manipulate large data
Dears,

Actually, I would like to know the best solution to manipulate BIG DATA in LARAVEL/MYSQL.

In my system, am uploading daily excel file (5K rows) into my DB, in case I find the same row in my table so I don't insert it, and if I find the same row, I changed the uploaded date in my DB.

Every time I upload the excel, am checking each row if exist in my table (table contain > 50K) with a normal array like the below

           $res = policies::where('phone', '=', $row['phone'])
                      ->where('draft_no', '=', $row['draftno'])
                      ->where('due_date', '=', $duedate)
                      ->where('status', '=', $stat)
                      ->where('bord_date', '=', $borddate)
                      ->where('amount', '=', $row['amnt'])
                      ->where('remarks', '=', $row['remarks'])
                      ->exists();

                    if(!$res) {
                   // insert row ($table->save())
                    }
                    else {
                      //update uploaded date to this row.
                    }

```

this process takes lots of time bcz each time is checking the table.  I tried to use array_chunk in order to insert, but still, the load is big (15 min to 20 min) to finish

Your advice are highly appreciated.

Thanks

答:
Why don't use laravel default eloquent method updateOrCreate.
Hope you already read about it if you don't you can read it from documentation other-creation-methods.

Let me explain what actually it does.

It Accepts an array of values and checks value is already in the database if it's already in the database it will update these values and also update column updated_at or if it's not already in the database, it will create a new entry in the table.

See eg below :-

```<code>policies::updateOrCreate(['value'=>1,'value'=>2,'so on...']);
</code>```

and dont forget to add protected $fillable = [your column] , Because it's use $fillable for this.

Title: Laravel/Mysql - Manipulate large data

Body:
Dears,

Actually, I would like to know the best solution to manipulate BIG DATA in LARAVEL/MYSQL.

In my system, am uploading daily excel file (5K rows) into my DB, in case I find the same row in my table so I don't insert it, and if I find the same row, I changed the uploaded date in my DB.

Every time I upload the excel, am checking each row if exist in my table (table contain > 50K) with a normal array like the below

           $res = policies::where('phone', '=', $row['phone'])
                      ->where('draft_no', '=', $row['draftno'])
                      ->where('due_date', '=', $duedate)
                      ->where('status', '=', $stat)
                      ->where('bord_date', '=', $borddate)
                      ->where('amount', '=', $row['amnt'])
                      ->where('remarks', '=', $row['remarks'])
                      ->exists();

                    if(!$res) {
                   // insert row ($table->save())
                    }
                    else {
                      //update uploaded date to this row.
                    }

this process takes lots of time bcz each time is checking the table.  I tried to use array_chunk in order to insert, but still, the load is big (15 min to 20 min) to finish

Your advice are highly appreciated.

Thanks

Body:
Why don't use laravel default eloquent method updateOrCreate.
Hope you already read about it if you don't you can read it from documentation other-creation-methods.

Let me explain what actually it does.

It Accepts an array of values and checks value is already in the database if it's already in the database it will update these values and also update column updated_at or if it's not already in the database, it will create a new entry in the table.

See eg below :-

policies::updateOrCreate(['value'=>1,'value'=>2,'so on...']);

and dont forget to add protected $fillable = [your column] , Because it's use $fillable for this.


问:
Navigation Architecture Component - DestinationFragmentArgs is not generated
I have this in app gradle:

```<code>apply plugin: 'androidx.navigation.safeargs'

implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0'
</code>```

and this in the project gradle:

```<code>classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0'
</code>```

the navigation graph:

```<code><navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/navigation_graph"
    app:startDestination="@id/loginPhoneNumberFragment">

    <fragment
        android:id="@+id/loginPhoneNumberFragment"
        android:name="...fragments.LoginPhoneNumberFragment"
        android:label="@string/login_activity_title"
        tools:layout="@layout/fragment_login_phone_number">
        <action
            android:id="@+id/action_loginPhoneNumberFragment_to_loginCodeFragment"
            app:destination="@id/loginCodeFragment">
            <argument
                android:name="prefix"
                app:argType="string" />
            <argument
                android:name="phone_number"
                app:argType="string" />
        </action>
    </fragment>

    <fragment
        android:id="@+id/loginCodeFragment"
        android:name="...LoginCodeFragment"
        android:label="@string/login_activity_title"
        tools:layout="@layout/fragment_login_code" />

</navigation>
</code>```

LoginPhoneNumberFragment:

```<code>val action = LoginPhoneNumberFragmentDirections.actionLoginPhoneNumberFragmentToLoginCodeFragment(prefix, phoneNumber)
view?.findNavController()?.navigate(action)
</code>```

LoginCodeFragment:

```<code>override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val prefix = LoginCodeFragmentArgs.fromBundle(arguments).prefix //LoginCodeFragmentArgs is not recognized

    }
</code>```

In the LoginPhoneNumberFragment it creates the "LoginPhoneNumberFragmentDirections" class, but on the destination class, LoginCodeFragment, it doesn't recognize "LoginCodeFragmentArgs".

Can someone please tell me what am I missing?
(I cleaned and rebuilded, and tried Invalidate caches...)

答:
Ok, so after a lot of searching I found out my mistake -
the arguments should be on the Destination fragment, and not on the starting one:

```<code><navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/navigation_graph"
    app:startDestination="@id/loginPhoneNumberFragment">

    <fragment
        android:id="@+id/loginPhoneNumberFragment"
        android:name="...fragments.LoginPhoneNumberFragment"
        android:label="@string/login_activity_title"
        tools:layout="@layout/fragment_login_phone_number">
        <action
            android:id="@+id/action_loginPhoneNumberFragment_to_loginCodeFragment"
            app:destination="@id/loginCodeFragment">
        </action>
    </fragment>

    <fragment
        android:id="@+id/loginCodeFragment"
        android:name="...fragments.LoginCodeFragment"
        android:label="@string/login_activity_title"
        tools:layout="@layout/fragment_login_code" >
        <argument
            android:name="prefix"
            app:argType="string"
            android:defaultValue="888" />
        <argument
            android:name="phone_number"
            app:argType="string"
            android:defaultValue="88888888"/>
    </fragment>

</navigation>
</code>```

You can also add it manually via the navigation graph design - press on the destination fragment and press "+" on the arguments section, it will add it to the text file.

Body:
I have this in app gradle:

apply plugin: 'androidx.navigation.safeargs'

implementation 'android.arch.navigation:navigation-fragment-ktx:1.0.0'
implementation 'android.arch.navigation:navigation-ui-ktx:1.0.0'

and this in the project gradle:

classpath 'android.arch.navigation:navigation-safe-args-gradle-plugin:1.0.0'

the navigation graph:

<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/navigation_graph"
    app:startDestination="@id/loginPhoneNumberFragment">

    <fragment
        android:id="@+id/loginPhoneNumberFragment"
        android:name="...fragments.LoginPhoneNumberFragment"
        android:label="@string/login_activity_title"
        tools:layout="@layout/fragment_login_phone_number">
        <action
            android:id="@+id/action_loginPhoneNumberFragment_to_loginCodeFragment"
            app:destination="@id/loginCodeFragment">
            <argument
                android:name="prefix"
                app:argType="string" />
            <argument
                android:name="phone_number"
                app:argType="string" />
        </action>
    </fragment>

    <fragment
        android:id="@+id/loginCodeFragment"
        android:name="...LoginCodeFragment"
        android:label="@string/login_activity_title"
        tools:layout="@layout/fragment_login_code" />

</navigation>

LoginPhoneNumberFragment:

val action = LoginPhoneNumberFragmentDirections.actionLoginPhoneNumberFragmentToLoginCodeFragment(prefix, phoneNumber)
view?.findNavController()?.navigate(action)

LoginCodeFragment:

override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
        super.onViewCreated(view, savedInstanceState)

        val prefix = LoginCodeFragmentArgs.fromBundle(arguments).prefix //LoginCodeFragmentArgs is not recognized

    }

In the LoginPhoneNumberFragment it creates the "LoginPhoneNumberFragmentDirections" class, but on the destination class, LoginCodeFragment, it doesn't recognize "LoginCodeFragmentArgs".

Can someone please tell me what am I missing?
(I cleaned and rebuilded, and tried Invalidate caches...)

Body:
Ok, so after a lot of searching I found out my mistake -
the arguments should be on the Destination fragment, and not on the starting one:

<navigation xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:id="@+id/navigation_graph"
    app:startDestination="@id/loginPhoneNumberFragment">

    <fragment
        android:id="@+id/loginPhoneNumberFragment"
        android:name="...fragments.LoginPhoneNumberFragment"
        android:label="@string/login_activity_title"
        tools:layout="@layout/fragment_login_phone_number">
        <action
            android:id="@+id/action_loginPhoneNumberFragment_to_loginCodeFragment"
            app:destination="@id/loginCodeFragment">
        </action>
    </fragment>

    <fragment
        android:id="@+id/loginCodeFragment"
        android:name="...fragments.LoginCodeFragment"
        android:label="@string/login_activity_title"
        tools:layout="@layout/fragment_login_code" >
        <argument
            android:name="prefix"
            app:argType="string"
            android:defaultValue="888" />
        <argument
            android:name="phone_number"
            app:argType="string"
            android:defaultValue="88888888"/>
    </fragment>

</navigation>

You can also add it manually via the navigation graph design - press on the destination fragment and press "+" on the arguments section, it will add it to the text file.


问:
Failed to run maven javafx application and some error in pom file
I am trying to run a JavaFX application under Maven. When I run the program it shows some error.

Error: Failed to execute goal
  org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on
  project Calculator: The parameters 'mainClass' for goal
  org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid
  -> [Help 1]

At which part i should make the change in my pom.xml file.

```<code>Using netbeans 11.0
JDK 12
</code>```

I tried to see some available solutions on stackoverflow itself.

This is my Pom.xml file

```<code><project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>gproject</groupId>
    <artifactId>Calculator</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Calculator</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mainClass>gproject.calculator.MainApp</mainClass>
        <maven.compiler.source>12</maven.compiler.source>
        <maven.compiler.target>12</maven.compiler.target>
    </properties>

    <organization>
        <!-- Used as the 'Vendor' for JNLP generation -->
        <name>Your Organisation</name>
    </organization>
    <dependencies>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>12.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-fxml</artifactId>
      <version>12.0.1</version>
    </dependency>
  </dependencies>

  <
build>

    <plugins>
      <plugin>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>0.0.2</version>
        <configuration>
          <mainClass>gproject.calculator.MainApp</mainClass>
        </configuration>
      </plugin>
    </plugins>

<
/build>

<
/project>
</code>```

------------------------------------------------------------------------ BUILD FAILURE
  ------------------------------------------------------------------------ Total time: 4.614 s Finished at: 2019-05-27T00:49:24+05:30 Final
  Memory: 14M/40M

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java
  (default-cli) on project Calculator: The parameters 'mainClass' for
  goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or
  invalid -> [Help 1]
  ----------------------------------------------------------------------------- To see the full stack trace of the errors, re-run Maven with the -e
  switch. Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please
  read the following articles: [Help 1]
  http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException**

答:
I added some line of code under tag Plugins in my pom.xml file.
Also, I referred to a youtube video.

Link: https://www.youtube.com/watch?v=RCdBmPfzeyM
Make sure to watch the full video.

```<code>  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
            <release>11</release>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
            <execution>
                <goals>
                    <goal>java</goal>
                </goals>
            </execution>

        </executions>
        <configuration>
          <mainClass>gproject.calculator.MainApp</mainClass>

        </configuration>
      </plugin>
    </plugins>
</build>
</code>```

Body:
I am trying to run a JavaFX application under Maven. When I run the program it shows some error.

Error: Failed to execute goal
  org.codehaus.mojo:exec-maven-plugin:1.2.1:java (default-cli) on
  project Calculator: The parameters 'mainClass' for goal
  org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or invalid
  -> [Help 1]

At which part i should make the change in my pom.xml file.

Using netbeans 11.0
JDK 12

I tried to see some available solutions on stackoverflow itself.

This is my Pom.xml file

<project xmlns="http://maven.apache.org/POM/4.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>gproject</groupId>
    <artifactId>Calculator</artifactId>
    <version>1.0-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>Calculator</name>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <mainClass>gproject.calculator.MainApp</mainClass>
        <maven.compiler.source>12</maven.compiler.source>
        <maven.compiler.target>12</maven.compiler.target>
    </properties>

    <organization>

        <name>Your Organisation</name>
    </organization>
    <dependencies>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-controls</artifactId>
      <version>12.0.1</version>
    </dependency>
    <dependency>
      <groupId>org.openjfx</groupId>
      <artifactId>javafx-fxml</artifactId>
      <version>12.0.1</version>
    </dependency>
  </dependencies>

  <
build>

    <plugins>
      <plugin>
        <groupId>org.openjfx</groupId>
        <artifactId>javafx-maven-plugin</artifactId>
        <version>0.0.2</version>
        <configuration>
          <mainClass>gproject.calculator.MainApp</mainClass>
        </configuration>
      </plugin>
    </plugins>

<
/build>

<
/project>

------------------------------------------------------------------------ BUILD FAILURE
  ------------------------------------------------------------------------ Total time: 4.614 s Finished at: 2019-05-27T00:49:24+05:30 Final
  Memory: 14M/40M

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java
  (default-cli) on project Calculator: The parameters 'mainClass' for
  goal org.codehaus.mojo:exec-maven-plugin:1.2.1:java are missing or
  invalid -> [Help 1]
  ----------------------------------------------------------------------------- To see the full stack trace of the errors, re-run Maven with the -e
  switch. Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please
  read the following articles: [Help 1]
  http://cwiki.apache.org/confluence/display/MAVEN/PluginParameterException**

Body:
I added some line of code under tag Plugins in my pom.xml file.
Also, I referred to a youtube video.

Link: https://www.youtube.com/watch?v=RCdBmPfzeyM
Make sure to watch the full video.

  <build>
    <plugins>
      <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.8.0</version>
        <configuration>
            <release>11</release>
        </configuration>
      </plugin>

      <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>exec-maven-plugin</artifactId>
        <version>1.6.0</version>
        <executions>
            <execution>
                <goals>
                    <goal>java</goal>
                </goals>
            </execution>

        </executions>
        <configuration>
          <mainClass>gproject.calculator.MainApp</mainClass>

        </configuration>
      </plugin>
    </plugins>
</build>


问:
Upgrade angular CLI to 8
I have encountered the following errors when updating the version of Angular Cli to 8.

```<code>Could not find module "@angular-devkit/build-angular" from "C:\\Users\\AGT\\Desktop\\central8\\client".
Error: Could not find module "@angular-devkit/build-angular" from "C:\\Users\\AGT\\Desktop\\central8\\client".
    at Object.resolve (C:\Users\AGT\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\core\node\resolve.js:151:11)
    at WorkspaceNodeModulesArchitectHost.resolveBuilder (C:\Users\AGT\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:31:40)
    at ServeCommand.initialize (C:\Users\AGT\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:135:55)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
</code>```

答:
If you are upgrading to Angular 8, you should ensure your Angular packages are safely updated to the current stable version by running the following command

```<code>ng update
</code>```

Otherwise, you can try to manually update the @angular/cli and core framework package manually.

```<code>ng update @angular/cli @angular/core
</code>```

Alternatively, you can directly use npm to install/update it.

```<code>npm install --save-dev @angular-devkit/build-angular
</code>```

The step-by-step Angular upgrade guide can be found here.

Title: Upgrade angular CLI to 8

Body:
I have encountered the following errors when updating the version of Angular Cli to 8.

Could not find module "@angular-devkit/build-angular" from "C:\\Users\\AGT\\Desktop\\central8\\client".
Error: Could not find module "@angular-devkit/build-angular" from "C:\\Users\\AGT\\Desktop\\central8\\client".
    at Object.resolve (C:\Users\AGT\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\core\node\resolve.js:151:11)
    at WorkspaceNodeModulesArchitectHost.resolveBuilder (C:\Users\AGT\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js:31:40)
    at ServeCommand.initialize (C:\Users\AGT\AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js:135:55)
    at process._tickCallback (internal/process/next_tick.js:68:7)
    at Function.Module.runMain (internal/modules/cjs/loader.js:757:11)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Body:
If you are upgrading to Angular 8, you should ensure your Angular packages are safely updated to the current stable version by running the following command

ng update

Otherwise, you can try to manually update the @angular/cli and core framework package manually.

ng update @angular/cli @angular/core

Alternatively, you can directly use npm to install/update it.

npm install --save-dev @angular-devkit/build-angular

The step-by-step Angular upgrade guide can be found here.


问:
how to download video from my app to photos by react native on IOS
I created function to download video from url to local storage by rn-fetch-blob library, it's working on android fine, but not working on ios
i added persmission by xcode but when i open photos or camera roll i can't find video

```<code> async download() {
        this.setState({btnDownloadLoading: true});

        const {video} = this.state;
        let hasPermission = await this.requestStoragePermission();

        console.log('hasPermission : ', hasPermission);
        if (!hasPermission) {
            this.requestStoragePermission();
            this.setState({btnDownloadLoading: false});
            return false;
        }

        var date = new Date();
        var url = video.video_url;
        var ext = this.extention(url);
        ext = "." + ext[0];
        const {config, fs} = RNFetchBlob
        let MovieDir = fs.dirs.DownloadDir
        let options = {
            fileCache: true,
            addAndroidDownloads: {
                useDownloadManager: true,
                notification: true,
                path: MovieDir + "/video_" + Math.floor(date.getTime() + date.getSeconds() / 2) + ext,
                description: 'Video'
            }
        }
        config(options).fetch('GET', url).then((res) => {
            this.setState({btnDownloadLoading: false});
            Alert.alert("تم تحميل الفيديو بنجاح.");
        });
    }
</code>```

i need code that will work on ios and android to download video from url to my phone

答:
You can use cameraRoll for saving images .

```<code> CameraRoll.saveToCameraRoll(filePath, 'photo')
                .then(Alert.alert('Success', ' added to camera roll!'))
</code>```

It works for me.

Body:
I created function to download video from url to local storage by rn-fetch-blob library, it's working on android fine, but not working on ios
i added persmission by xcode but when i open photos or camera roll i can't find video

 async download() {
        this.setState({btnDownloadLoading: true});

        const {video} = this.state;
        let hasPermission = await this.requestStoragePermission();

        console.log('hasPermission : ', hasPermission);
        if (!hasPermission) {
            this.requestStoragePermission();
            this.setState({btnDownloadLoading: false});
            return false;
        }

        var date = new Date();
        var url = video.video_url;
        var ext = this.extention(url);
        ext = "." + ext[0];
        const {config, fs} = RNFetchBlob
        let MovieDir = fs.dirs.DownloadDir
        let options = {
            fileCache: true,
            addAndroidDownloads: {
                useDownloadManager: true,
                notification: true,
                path: MovieDir + "/video_" + Math.floor(date.getTime() + date.getSeconds() / 2) + ext,
                description: 'Video'
            }
        }
        config(options).fetch('GET', url).then((res) => {
            this.setState({btnDownloadLoading: false});
            Alert.alert("تم تحميل الفيديو بنجاح.");
        });
    }

i need code that will work on ios and android to download video from url to my phone

Body:
You can use cameraRoll for saving images .

 CameraRoll.saveToCameraRoll(filePath, 'photo')
                .then(Alert.alert('Success', ' added to camera roll!'))

It works for me.


问:
Return multiple elements using Lodash _.get?
I have this JavaScript object:

const object = {
  categories: [
    {
      title: 'Category 1',
      items: [
        { title: 'Item 1', image: 'path/to/file-1.png' },
        { title: 'Item 2', image: 'path/to/file-2.png' },
        { title: 'Item 3', image: 'path/to/file-3.png' }
      ]
    },
    {
      title: 'Category 2',
      items: [
        { title: 'Item 4', image: 'path/to/file-4.png' },
        { title: 'Item 5', image: 'path/to/file-5.png' },
        { title: 'Item 6', image: 'path/to/file-6.png' }
      ]
    }
  ]
}
```

<p>I was able to select only one item using Lodash's <code>_.get</code> method.</p>

<pre class="lang-js prettyprint-override"><code>_.get(object, 'categories[0].items[0].image')
// => "path/to/file-1.png"
</code>```

But I need an array with all occurrences, not just from position 0. Something like this:

_.get(object, 'categories[].items[].image')
// => ["path/to/file-1.png", "path/to/file-2.png", "path/to/file-3.png", "path/to/file-4.png", "path/to/file-5.png", "path/to/file-6.png"]
```

Is it possible to do it using Lodash?

If it's not possible, do you have any idea how to implement it?

EDIT: I'm looking for something like _.get from Lodash, where I can supply the "search schema" (path) as string. Obviously I know how to solve this with map, reduce, etc.

答:
This is my implementation of a flatGet function that can handle arrays:

const flatGet = (object, path) => {
  const p = path.match(/[^.\[\]]+/g)

  const getItem = (item, [current, ...path]) => {
    if(current === undefined) return item

    if(typeof item !== 'object') return undefined

    if(Array.isArray(item)) return item.flatMap(o => getItem(o[current], path))

    return getItem(item[current], path)
  }

  return getItem(object, p)
}

const object = {"categories":[{"title":"Category 1","items":[{"title":"Item 1","image":"path/to/file-1.png"},{"title":"Item 2","image":"path/to/file-2.png"},{"title":"Item 3","image":"path/to/file-3.png"}]},{"title":"Category 2","items":[{"title":"Item 4","image":"path/to/file-4.png"},{"title":"Item 5","image":"path/to/file-5.png"},{"title":"Item 6","image":"path/to/file-6.png"}]}]}

var result = flatGet(object, 'categories.items.image')

console.log(result)```

Body:
I have this JavaScript object:

const object = {
  categories: [
    {
      title: 'Category 1',
      items: [
        { title: 'Item 1', image: 'path/to/file-1.png' },
        { title: 'Item 2', image: 'path/to/file-2.png' },
        { title: 'Item 3', image: 'path/to/file-3.png' }
      ]
    },
    {
      title: 'Category 2',
      items: [
        { title: 'Item 4', image: 'path/to/file-4.png' },
        { title: 'Item 5', image: 'path/to/file-5.png' },
        { title: 'Item 6', image: 'path/to/file-6.png' }
      ]
    }
  ]
}

I was able to select only one item using Lodash's _.get method.

_.get(object, 'categories[0].items[0].image')
// => "path/to/file-1.png"

But I need an array with all occurrences, not just from position 0. Something like this:

_.get(object, 'categories[].items[].image')
// => ["path/to/file-1.png", "path/to/file-2.png", "path/to/file-3.png", "path/to/file-4.png", "path/to/file-5.png", "path/to/file-6.png"]

Is it possible to do it using Lodash?

If it's not possible, do you have any idea how to implement it?

EDIT: I'm looking for something like _.get from Lodash, where I can supply the "search schema" (path) as string. Obviously I know how to solve this with map, reduce, etc.


问:
How do i get a function to repeat its self without generating an exit code 0?
I made a simple dice roller  with a for-in loop that takes 2 pieces of input, the number of dice and the number of sides of the dice.  When the roll is made the results are printed to the screen.

After the initial roll is made I'd like to have the code begin again, with new inputs, with out generating an exit code 0.

##Original design obviously does not loop
from random import randint
import time
dice = int(input("\nHow many dice?\n   "))
sides = int(input("How many sides?\n   "))

def roll():
    for quantity in range(dice):
        time.sleep(.5)
        print(randint(1, sides))

roll()
```

<p>I moved the <code>input</code> variables from a <code>global scope</code> to a <code>local scope</code> so they can be updated with each repetition.  When ending the <code>function</code> by calling the <code>function</code>, I achieve some success.  I am able to <code>loop</code> the process endlessly without generating an <code>exit code 0</code> but any number of dice beyond <code>1</code> does not seem to register.  I can only roll one dice at a time this way.</p>

<pre class="lang-py prettyprint-override"><code>##Design 2 does not generate any exit codes and continues to loop
##endlessly but will not register more than 1 dice
from random import randint
import time

def roll():
    dice = int(input("\nHow many dice?\n   "))
    sides = int(input("How many sides?\n   "))
    for quantity in range(dice):
        time.sleep(.5)
        print(randint(1, sides))
        roll()

roll()
</code>```

I've changed the function so that it does not end by calling itself.  Instead I created a new function that does nothing but call the first.  I've placed the redundant function after the first and have been able to successfully achieve my goal of rolling any number of sided dice as I please... twice.  After two iterations/cycles this generates an exit code 0

##Current design will register all input data correctly
##but only loops 2 times before generating an `exit code 0`
from random import randint
import time

def roll():
    dice = int(input("\nHow many dice?\n   "))
    sides = int(input("How many sides?\n   "))
    for quantity in range(dice):
        time.sleep(.5)
        print(randint(1, sides))

def roll_again():
    roll()

roll()
roll_again()
```

Anyone know what I'm doing wrong?

答:
You could use a while loop

```<code>from random import randint
import time

def roll():
    dice = int(input("\nHow many dice?\n   "))
    sides = int(input("How many sides?\n   "))
    for quantity in range(dice):
        time.sleep(.5)
        print(randint(1, sides))

while True:
    roll()
</code>```

This will run the script forever, a new input after all rolls.

To exit press Ctrl+C

Background: a while loop will check condition at the beginning and run if it is met (True). In this case the condition is always set to True, so it is forever met ;-)

Body:
I made a simple dice roller  with a for-in loop that takes 2 pieces of input, the number of dice and the number of sides of the dice.  When the roll is made the results are printed to the screen.

After the initial roll is made I'd like to have the code begin again, with new inputs, with out generating an exit code 0.

##Original design obviously does not loop
from random import randint
import time
dice = int(input("\nHow many dice?\n   "))
sides = int(input("How many sides?\n   "))

def roll():
    for quantity in range(dice):
        time.sleep(.5)
        print(randint(1, sides))

roll()

I moved the input variables from a global scope to a local scope so they can be updated with each repetition.  When ending the function by calling the function, I achieve some success.  I am able to loop the process endlessly without generating an exit code 0 but any number of dice beyond 1 does not seem to register.  I can only roll one dice at a time this way.

##Design 2 does not generate any exit codes and continues to loop
##endlessly but will not register more than 1 dice
from random import randint
import time

def roll():
    dice = int(input("\nHow many dice?\n   "))
    sides = int(input("How many sides?\n   "))
    for quantity in range(dice):
        time.sleep(.5)
        print(randint(1, sides))
        roll()

roll()

I've changed the function so that it does not end by calling itself.  Instead I created a new function that does nothing but call the first.  I've placed the redundant function after the first and have been able to successfully achieve my goal of rolling any number of sided dice as I please... twice.  After two iterations/cycles this generates an exit code 0

##Current design will register all input data correctly
##but only loops 2 times before generating an `exit code 0`
from random import randint
import time

def roll():
    dice = int(input("\nHow many dice?\n   "))
    sides = int(input("How many sides?\n   "))
    for quantity in range(dice):
        time.sleep(.5)
        print(randint(1, sides))

def roll_again():
    roll()

roll()
roll_again()

Anyone know what I'm doing wrong?

Body:
You could use a while loop

from random import randint
import time

def roll():
    dice = int(input("\nHow many dice?\n   "))
    sides = int(input("How many sides?\n   "))
    for quantity in range(dice):
        time.sleep(.5)
        print(randint(1, sides))

while True:
    roll()

This will run the script forever, a new input after all rolls.

To exit press Ctrl+C

Background: a while loop will check condition at the beginning and run if it is met (True). In this case the condition is always set to True, so it is forever met ;-)


问:
Managing an objects Constructors across multiple software versions
I'm designing a library where I am debating if I should use a constructor to initialize objects in the api's model.  My considerations are:

By using a constructor I can enforce what data is required to have a valid object according to the model.

However, by using a constructor I am curious as to how to maintain the code as it is modified in order to maintain this requirement without breaking existing code across the code base.

I could avoid using constructors in the object design, but I need the library to communicate to the developer using it which fields are required in order for the object to satisfy its model.

How can I create an object model that expresses the requirement of particular properties being initialized as well as provide scalability as it relates to code maintenance?

```<code>dim objV1 as new ObjectOfSomeType(Param1, Param2, Param3)
</code>```

VS

```<code>dim objV1 as new ObjectOfSomeType()

objV1.Property1 = Param1
objV1.Property2 = Param2
objV1.Property3 = Param3
</code>```

答:
If initialization of some properties are required for the validity of the state of the object, then such properties must be initialized by the constructor and made read-only.

This will impose a requirement on the part of the class and its users which will make changes more difficult but you cannot have the cake and eat it.

One possible compromise is to design an abstract base class with protected constructors while other implementations can derive from and define other constructors and change the behaviour.

Body:
I'm designing a library where I am debating if I should use a constructor to initialize objects in the api's model.  My considerations are:

By using a constructor I can enforce what data is required to have a valid object according to the model.

However, by using a constructor I am curious as to how to maintain the code as it is modified in order to maintain this requirement without breaking existing code across the code base.

I could avoid using constructors in the object design, but I need the library to communicate to the developer using it which fields are required in order for the object to satisfy its model.

How can I create an object model that expresses the requirement of particular properties being initialized as well as provide scalability as it relates to code maintenance?

dim objV1 as new ObjectOfSomeType(Param1, Param2, Param3)

VS

dim objV1 as new ObjectOfSomeType()

objV1.Property1 = Param1
objV1.Property2 = Param2
objV1.Property3 = Param3


问:
java.io.FileNotFoundException: null\gallery2.jpg (The system cannot find the path specified)

java.io.IOException: An exception occurred processing JSP page
  /upimg.jsp at line 43

```<code>String s23=f1.getString();

 String fpath=request.getRealPath("files")+"\\"+filename;
 43:               f1.write(new File(fpath));
</code>```

答: You have encountered a FileNotFoundException, which means the file you search doesn't exist in the path you have declared. Check whether you have given the correct path. And if you are sure about the path, then make sure the file you search is available in that path.

Body:
java.io.IOException: An exception occurred processing JSP page
  /upimg.jsp at line 43

String s23=f1.getString();

 String fpath=request.getRealPath("files")+"\\"+filename;
 43:               f1.write(new File(fpath));


问:
VBA code for giving slides a constant name
I am trying to reduce the effort needed to keep a certain slide (lets call it SlideXYZ) up to date. SlideXYZ is an important content slide that can be found in multiple slide decks. I initially created slide objects that updated automatically when a change was made in the "source slide". However, slide objects unfortunately don't contain animations (they are simply a snapshot of the actual slide). I am now trying to write a VBA script that will search and replace SlideXYZ in each deck with a newer version of SlideXYZ. However, the slide number is dynamic (it changes when a new slide is added above). I need a static, constant reference to SlideXYZ.

I thought of copying SlideXYZ into all presentations once and then using the Slide.Name property to find all instances of it once an update is needed.

However, it appears that the Slide.Name is reassigned by powerpoint each time the slide is pasted into a new presentation. I need a reference that will not change so that I can find and replace SlideXYZ.

答:
As you already found out: Neither SlideIndex, SlideNumber, SlideID nor Name can be used to identify a copied slide.

You may work with the "alternative text" of a characteristic shape to identify a slide:

Just do a right mouseclick on the shape and edit its alternative text.

Also slide notes may help to identify a slide.

Following prints some slide information to your debug window:

```<code>Private Sub IdentifyMySlide()
    Dim myslide As PowerPoint.Slide
    For Each myslide In ActivePresentation.Slides
        Debug.Print "Index: " & myslide.SlideIndex,
        Debug.Print "Number: " & myslide.SlideNumber,
        Debug.Print "ID: " & myslide.SlideID,
        Debug.Print "Name: " & myslide.Name,

        If myslide.Shapes.Count > 0 Then
            Debug.Print "Alternative ShapeText: " & myslide.Shapes(1).AlternativeText,
        End If

        If myslide.HasNotesPage Then
            If myslide.NotesPage(1).Shapes.Count > 0 Then
                If myslide.NotesPage(1).Shapes(1).HasTextFrame Then
                    Debug.Print "Notes: " & Left(myslide.NotesPage(1).Shapes(1).TextFrame.TextRange.Text, 10)
                Else
                    Debug.Print
                End If
            Else
                Debug.Print
            End If
        Else
            Debug.Print
        End If

    Next myslide
End Sub
</code>```

Body:
As you already found out: Neither SlideIndex, SlideNumber, SlideID nor Name can be used to identify a copied slide.

You may work with the "alternative text" of a characteristic shape to identify a slide:

Just do a right mouseclick on the shape and edit its alternative text.

Also slide notes may help to identify a slide.

Following prints some slide information to your debug window:

Private Sub IdentifyMySlide()
    Dim myslide As PowerPoint.Slide
    For Each myslide In ActivePresentation.Slides
        Debug.Print "Index: " & myslide.SlideIndex,
        Debug.Print "Number: " & myslide.SlideNumber,
        Debug.Print "ID: " & myslide.SlideID,
        Debug.Print "Name: " & myslide.Name,

        If myslide.Shapes.Count > 0 Then
            Debug.Print "Alternative ShapeText: " & myslide.Shapes(1).AlternativeText,
        End If

        If myslide.HasNotesPage Then
            If myslide.NotesPage(1).Shapes.Count > 0 Then
                If myslide.NotesPage(1).Shapes(1).HasTextFrame Then
                    Debug.Print "Notes: " & Left(myslide.NotesPage(1).Shapes(1).TextFrame.TextRange.Text, 10)
                Else
                    Debug.Print
                End If
            Else
                Debug.Print
            End If
        Else
            Debug.Print
        End If

    Next myslide
End Sub


问:
How to expire a particular row when a date is reached?
I have a table for students, where each student has to get an ID card and this ID card is valid for one year

I want the student record to be expired when it reaches to the expiration date and the expiration date also needs to be updated

For example, if the expiration date is 01/01/2020 it should be turned to 01/01/2021.

答:
You will probably require a cron job that runs every day which will check the date and if date is today's date, it will update it.

Second possibility is Event scheduler in MySql. For more details on Event Scheduler please refer

https://dev.mysql.com/doc/refman/5.7/en/event-scheduler.html


问:
How can i clone from git app without occurred no error
I want to clone this app from git

https://github.com/mdy0501/Airbnb

But there is a problem when I clone it from git

When I clone its layout show 'Unresolved class'

!-- This is one of layout that shows error --

```<code><?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/DeepGreen"
    tools:context="com.android.airbnb.WelcomeActivity">
</code>```

Under this code shows red

```<code>@color/DeepGreen
.airbnb.WelcomeActivity
</code>```

Even though that .xml and class file has existed
That showing error (i attach photo also)
enter image description here

I want to know how I can fix that
when I clone from git that
I would be very thankful if I see that activity from my android studio

答: All those red lines came from android studio not being able to find them. Make sure they are all available and the path is as expected like the WelcomeActivity. Make sure the package name is as expected and the build.gradle has the constraint layout dependency. If you have done those, all you do is sync, clean and rebuild your app. All the errors will go away. </p>

Body:
I want to clone this app from git

https://github.com/mdy0501/Airbnb

But there is a problem when I clone it from git

When I clone its layout show 'Unresolved class'

!-- This is one of layout that shows error --

<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/DeepGreen"
    tools:context="com.android.airbnb.WelcomeActivity">

Under this code shows red

@color/DeepGreen
.airbnb.WelcomeActivity

Even though that .xml and class file has existed
That showing error (i attach photo also)
enter image description here

I want to know how I can fix that
when I clone from git that
I would be very thankful if I see that activity from my android studio


问:
jboss war deploy : Access to DialectResolutionInfo cannot be null when 'hibernate.dialect
I try to deploy a war but I get this Exception :

Caused by: org.hibernate.HibernateException: Access to
  DialectResolutionInfo cannot be null when 'hibernate.dialect' not
  set","jboss.persistenceunit ...
  => "org.hibernate.service.spi.ServiceException: Unable to create requested service [org.hibernate.engine.jdbc.env.spi.JdbcEnvironment]

答:
Add following property in your hibernate config xml file</p>

```<code>  <property name = "hibernate.dialect">
     org.hibernate.dialect.<DB_DRIVER>
  </property>
</code>```

Body:
Add following property in your hibernate config xml file

  <property name = "hibernate.dialect">
     org.hibernate.dialect.<DB_DRIVER>
  </property>


问:
How to return total number of records with TOP * select
I have over 300 000 rows, I would like to return total number of the records even if I pick only 20/50/100 records using TOP * statement.

Is it possible to filter select like

select top 50 * from table where rule1=rule1 and rule=rule2

Let's say that total number of records if database is 300 000 and select above would return 4 000 records. But physically it will return only 50 records, I need to know how manu is there in database using this where statement (it would return 4000).

Thanks

答:
```<code>SELECT TOP 50
  *
FROM TableName t1
INNER JOIN (SELECT
              COUNT(*) AS CountOfRecords
            FROM TableName) t2 on 1=1
</code>```