问:
Applying Lombok plugin to Gradle causes "Could not find any public constructor" error
I'm trying to apply the Lombok Gradle plugin to my project:

```<code>plugins {
    id 'java'
    id 'application'
    id "io.freefair.lombok" version "3.6.4"
}
</code>```

However I get this error when running the build:

```<code>* Exception is:
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'io.freefair.lombok', version: '3.6.4']
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.exceptionOccurred(DefaultPluginRequestApplicator.java:247)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:229)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:148)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:186)
    at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:66)
    at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:63)
    at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
    at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:63)
    at org.gradle.configuration.project.BuildScriptProcessor$1.run(BuildScriptProcessor.java:44)
    at org.gradle.internal.Factories$1.create(Factories.java:25)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:200)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:41)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
    at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
    at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject$1.run(LifecycleProjectEvaluator.java:106)
    at org.gradle.internal.Factories$1.create(Factories.java:25)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withProjectLock(DefaultProjectStateRegistry.java:226)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:220)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186)
    at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:95)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:67)
    at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:693)
    at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:141)
    at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:60)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:41)
    at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:302)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:210)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
    at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134)
    at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:58)
    at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:55)
    at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:82)
    at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:75)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75)
    at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:49)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:44)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:49)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46)
    at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    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:104)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [class 'io.freefair.gradle.plugins.lombok.LombokBasePlugin']
    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:163)
    at org.gradle.api.internal.plugins.DefaultPluginManager.addImperativePlugin(DefaultPluginManager.java:88)
    at org.gradle.api.internal.plugins.DefaultPluginManager.addImperativePlugin(DefaultPluginManager.java:94)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:92)
    at io.freefair.gradle.plugins.lombok.LombokPlugin.apply(LombokPlugin.java:34)
    at io.freefair.gradle.plugins.lombok.LombokPlugin.apply(LombokPlugin.java:23)
    at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42)
    at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:50)
    at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:177)
    at org.gradle.api.internal.plugins.DefaultPluginManager.access$300(DefaultPluginManager.java:51)
    at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:267)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:155)
    at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:152)
    at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:152)
    at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:133)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator$3.run(DefaultPluginRequestApplicator.java:151)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:225)
    ... 119 more
Caused by: org.gradle.api.reflect.ObjectInstantiationException: Could not create an instance of type io.freefair.gradle.plugins.lombok.LombokExtension_Decorated.
    at org.gradle.internal.reflect.DirectInstantiator.newInstance(DirectInstantiator.java:55)
    at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
    at org.gradle.api.internal.plugins.DefaultConvention.instantiate(DefaultConvention.java:242)
    at org.gradle.api.internal.plugins.DefaultConvention.create(DefaultConvention.java:142)
    at io.freefair.gradle.plugins.lombok.LombokBasePlugin.apply(LombokBasePlugin.java:19)
    at io.freefair.gradle.plugins.lombok.LombokBasePlugin.apply(LombokBasePlugin.java:10)
    at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42)
    at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:50)
    at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:177)
    at org.gradle.api.internal.plugins.DefaultPluginManager.access$300(DefaultPluginManager.java:51)
    at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:267)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:155)
    at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:152)
    at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:152)
    ... 141 more
Caused by: java.lang.IllegalArgumentException: Could not find any public constructor for class io.freefair.gradle.plugins.lombok.LombokExtension_Decorated which accepts parameters [].
    at org.gradle.internal.reflect.DirectInstantiator$ConstructorCache.create(DirectInstantiator.java:94)
    at org.gradle.internal.reflect.DirectInstantiator$ConstructorCache.create(DirectInstantiator.java:75)
    at org.gradle.internal.reflect.ReflectionCache$WeaklyClassReferencingCache.get(ReflectionCache.java:56)
    at org.gradle.internal.reflect.ReflectionCache.get(ReflectionCache.java:36)
    at org.gradle.internal.reflect.DirectInstantiator.newInstance(DirectInstantiator.java:49)
    ... 160 more
</code>```

Do you know what could be the problem here?

答:
Try to use the latest version of lombok to work properly. I provide below brief code snippet about the usage of lombok with gradle.

```<code>buildscript {
    repositories {
        mavenCentral()
    }
    ext {
        lombokVersion = '1.18.4'
    }
    .... Other dependencies
}

apply plugin: 'java'
apply plugin: 'eclipse'
//Other plugins

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    // Other dependencies
    annotationProcessor("org.projectlombok:lombok:${lombokVersion}")
    testAnnotationProcessor("org.projectlombok:lombok:${lombokVersion}")
}
</code>```

Modify you code accordingly.

Body:
I'm trying to apply the Lombok Gradle plugin to my project:

plugins {
    id 'java'
    id 'application'
    id "io.freefair.lombok" version "3.6.4"
}

However I get this error when running the build:

* Exception is:
org.gradle.api.plugins.InvalidPluginException: An exception occurred applying plugin request [id: 'io.freefair.lombok', version: '3.6.4']
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.exceptionOccurred(DefaultPluginRequestApplicator.java:247)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:229)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugins(DefaultPluginRequestApplicator.java:148)
    at org.gradle.configuration.DefaultScriptPluginFactory$ScriptPluginImpl.apply(DefaultScriptPluginFactory.java:186)
    at org.gradle.configuration.BuildOperationScriptPlugin$1$1.run(BuildOperationScriptPlugin.java:69)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:66)
    at org.gradle.configuration.BuildOperationScriptPlugin$1.execute(BuildOperationScriptPlugin.java:63)
    at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
    at org.gradle.configuration.BuildOperationScriptPlugin.apply(BuildOperationScriptPlugin.java:63)
    at org.gradle.configuration.project.BuildScriptProcessor$1.run(BuildScriptProcessor.java:44)
    at org.gradle.internal.Factories$1.create(Factories.java:25)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:200)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:41)
    at org.gradle.configuration.project.BuildScriptProcessor.execute(BuildScriptProcessor.java:26)
    at org.gradle.configuration.project.ConfigureActionsProjectEvaluator.evaluate(ConfigureActionsProjectEvaluator.java:34)
    at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject$1.run(LifecycleProjectEvaluator.java:106)
    at org.gradle.internal.Factories$1.create(Factories.java:25)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withProjectLock(DefaultProjectStateRegistry.java:226)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:220)
    at org.gradle.api.internal.project.DefaultProjectStateRegistry$ProjectStateImpl.withMutableState(DefaultProjectStateRegistry.java:186)
    at org.gradle.configuration.project.LifecycleProjectEvaluator$EvaluateProject.run(LifecycleProjectEvaluator.java:95)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.configuration.project.LifecycleProjectEvaluator.evaluate(LifecycleProjectEvaluator.java:67)
    at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:693)
    at org.gradle.api.internal.project.DefaultProject.evaluate(DefaultProject.java:141)
    at org.gradle.execution.TaskPathProjectEvaluator.configure(TaskPathProjectEvaluator.java:35)
    at org.gradle.execution.TaskPathProjectEvaluator.configureHierarchy(TaskPathProjectEvaluator.java:60)
    at org.gradle.configuration.DefaultBuildConfigurer.configure(DefaultBuildConfigurer.java:41)
    at org.gradle.initialization.DefaultGradleLauncher$ConfigureBuild.run(DefaultGradleLauncher.java:302)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.initialization.DefaultGradleLauncher.configureBuild(DefaultGradleLauncher.java:210)
    at org.gradle.initialization.DefaultGradleLauncher.doBuildStages(DefaultGradleLauncher.java:151)
    at org.gradle.initialization.DefaultGradleLauncher.executeTasks(DefaultGradleLauncher.java:134)
    at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:58)
    at org.gradle.internal.invocation.GradleBuildController$1.execute(GradleBuildController.java:55)
    at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:82)
    at org.gradle.internal.invocation.GradleBuildController$3.create(GradleBuildController.java:75)
    at org.gradle.internal.work.DefaultWorkerLeaseService.withLocks(DefaultWorkerLeaseService.java:183)
    at org.gradle.internal.work.StopShieldingWorkerLeaseService.withLocks(StopShieldingWorkerLeaseService.java:40)
    at org.gradle.internal.invocation.GradleBuildController.doBuild(GradleBuildController.java:75)
    at org.gradle.internal.invocation.GradleBuildController.run(GradleBuildController.java:55)
    at org.gradle.tooling.internal.provider.runner.BuildModelActionRunner.run(BuildModelActionRunner.java:54)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.ChainingBuildActionRunner.run(ChainingBuildActionRunner.java:35)
    at org.gradle.launcher.exec.BuildOutcomeReportingBuildActionRunner.run(BuildOutcomeReportingBuildActionRunner.java:58)
    at org.gradle.tooling.internal.provider.ValidatingBuildActionRunner.run(ValidatingBuildActionRunner.java:32)
    at org.gradle.launcher.exec.BuildCompletionNotifyingBuildActionRunner.run(BuildCompletionNotifyingBuildActionRunner.java:39)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:49)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner$3.call(RunAsBuildOperationBuildActionRunner.java:44)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:315)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$CallableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:305)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.call(DefaultBuildOperationExecutor.java:101)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.call(DelegatingBuildOperationExecutor.java:36)
    at org.gradle.launcher.exec.RunAsBuildOperationBuildActionRunner.run(RunAsBuildOperationBuildActionRunner.java:44)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:49)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter$1.transform(InProcessBuildActionExecuter.java:46)
    at org.gradle.composite.internal.DefaultRootBuildState.run(DefaultRootBuildState.java:78)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:46)
    at org.gradle.launcher.exec.InProcessBuildActionExecuter.execute(InProcessBuildActionExecuter.java:31)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:42)
    at org.gradle.launcher.exec.BuildTreeScopeBuildActionExecuter.execute(BuildTreeScopeBuildActionExecuter.java:28)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:78)
    at org.gradle.tooling.internal.provider.ContinuousBuildActionExecuter.execute(ContinuousBuildActionExecuter.java:52)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:59)
    at org.gradle.tooling.internal.provider.SubscribableBuildActionExecuter.execute(SubscribableBuildActionExecuter.java:36)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:68)
    at org.gradle.tooling.internal.provider.SessionScopeBuildActionExecuter.execute(SessionScopeBuildActionExecuter.java:38)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:37)
    at org.gradle.tooling.internal.provider.GradleThreadBuildActionExecuter.execute(GradleThreadBuildActionExecuter.java:26)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:43)
    at org.gradle.tooling.internal.provider.ParallelismConfigurationBuildActionExecuter.execute(ParallelismConfigurationBuildActionExecuter.java:29)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:60)
    at org.gradle.tooling.internal.provider.StartParamsValidatingActionExecuter.execute(StartParamsValidatingActionExecuter.java:32)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:55)
    at org.gradle.tooling.internal.provider.SessionFailureReportingActionExecuter.execute(SessionFailureReportingActionExecuter.java:41)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:48)
    at org.gradle.tooling.internal.provider.SetupLoggingActionExecuter.execute(SetupLoggingActionExecuter.java:32)
    at org.gradle.launcher.daemon.server.exec.ExecuteBuild.doBuild(ExecuteBuild.java:67)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.WatchForDisconnection.execute(WatchForDisconnection.java:37)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.ResetDeprecationLogger.execute(ResetDeprecationLogger.java:26)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.RequestStopIfSingleUsedDaemon.execute(RequestStopIfSingleUsedDaemon.java:34)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    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:104)
    at org.gradle.launcher.daemon.server.exec.LogAndCheckHealth.execute(LogAndCheckHealth.java:55)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.LogToClient.doBuild(LogToClient.java:62)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.EstablishBuildEnvironment.doBuild(EstablishBuildEnvironment.java:81)
    at org.gradle.launcher.daemon.server.exec.BuildCommandOnly.execute(BuildCommandOnly.java:36)
    at org.gradle.launcher.daemon.server.api.DaemonCommandExecution.proceed(DaemonCommandExecution.java:104)
    at org.gradle.launcher.daemon.server.exec.StartBuildOrRespondWithBusy$1.run(StartBuildOrRespondWithBusy.java:50)
    at org.gradle.launcher.daemon.server.DaemonStateCoordinator$1.run(DaemonStateCoordinator.java:295)
    at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
    at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
    at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
Caused by: org.gradle.api.internal.plugins.PluginApplicationException: Failed to apply plugin [class 'io.freefair.gradle.plugins.lombok.LombokBasePlugin']
    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:163)
    at org.gradle.api.internal.plugins.DefaultPluginManager.addImperativePlugin(DefaultPluginManager.java:88)
    at org.gradle.api.internal.plugins.DefaultPluginManager.addImperativePlugin(DefaultPluginManager.java:94)
    at org.gradle.api.internal.plugins.DefaultPluginContainer.apply(DefaultPluginContainer.java:92)
    at io.freefair.gradle.plugins.lombok.LombokPlugin.apply(LombokPlugin.java:34)
    at io.freefair.gradle.plugins.lombok.LombokPlugin.apply(LombokPlugin.java:23)
    at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42)
    at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:50)
    at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:177)
    at org.gradle.api.internal.plugins.DefaultPluginManager.access$300(DefaultPluginManager.java:51)
    at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:267)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:155)
    at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:152)
    at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:152)
    at org.gradle.api.internal.plugins.DefaultPluginManager.apply(DefaultPluginManager.java:133)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator$3.run(DefaultPluginRequestApplicator.java:151)
    at org.gradle.plugin.use.internal.DefaultPluginRequestApplicator.applyPlugin(DefaultPluginRequestApplicator.java:225)
    ... 119 more
Caused by: org.gradle.api.reflect.ObjectInstantiationException: Could not create an instance of type io.freefair.gradle.plugins.lombok.LombokExtension_Decorated.
    at org.gradle.internal.reflect.DirectInstantiator.newInstance(DirectInstantiator.java:55)
    at org.gradle.api.internal.ClassGeneratorBackedInstantiator.newInstance(ClassGeneratorBackedInstantiator.java:36)
    at org.gradle.api.internal.plugins.DefaultConvention.instantiate(DefaultConvention.java:242)
    at org.gradle.api.internal.plugins.DefaultConvention.create(DefaultConvention.java:142)
    at io.freefair.gradle.plugins.lombok.LombokBasePlugin.apply(LombokBasePlugin.java:19)
    at io.freefair.gradle.plugins.lombok.LombokBasePlugin.apply(LombokBasePlugin.java:10)
    at org.gradle.api.internal.plugins.ImperativeOnlyPluginTarget.applyImperative(ImperativeOnlyPluginTarget.java:42)
    at org.gradle.api.internal.plugins.RuleBasedPluginTarget.applyImperative(RuleBasedPluginTarget.java:50)
    at org.gradle.api.internal.plugins.DefaultPluginManager.addPlugin(DefaultPluginManager.java:177)
    at org.gradle.api.internal.plugins.DefaultPluginManager.access$300(DefaultPluginManager.java:51)
    at org.gradle.api.internal.plugins.DefaultPluginManager$AddPluginBuildOperation.run(DefaultPluginManager.java:267)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:301)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:293)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:175)
    at org.gradle.internal.operations.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:91)
    at org.gradle.internal.operations.DelegatingBuildOperationExecutor.run(DelegatingBuildOperationExecutor.java:31)
    at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:155)
    at org.gradle.api.internal.plugins.DefaultPluginManager$2.execute(DefaultPluginManager.java:152)
    at org.gradle.configuration.internal.DefaultUserCodeApplicationContext.apply(DefaultUserCodeApplicationContext.java:48)
    at org.gradle.api.internal.plugins.DefaultPluginManager.doApply(DefaultPluginManager.java:152)
    ... 141 more
Caused by: java.lang.IllegalArgumentException: Could not find any public constructor for class io.freefair.gradle.plugins.lombok.LombokExtension_Decorated which accepts parameters [].
    at org.gradle.internal.reflect.DirectInstantiator$ConstructorCache.create(DirectInstantiator.java:94)
    at org.gradle.internal.reflect.DirectInstantiator$ConstructorCache.create(DirectInstantiator.java:75)
    at org.gradle.internal.reflect.ReflectionCache$WeaklyClassReferencingCache.get(ReflectionCache.java:56)
    at org.gradle.internal.reflect.ReflectionCache.get(ReflectionCache.java:36)
    at org.gradle.internal.reflect.DirectInstantiator.newInstance(DirectInstantiator.java:49)
    ... 160 more

Do you know what could be the problem here?

Body:
Try to use the latest version of lombok to work properly. I provide below brief code snippet about the usage of lombok with gradle.

buildscript {
    repositories {
        mavenCentral()
    }
    ext {
        lombokVersion = '1.18.4'
    }
    .... Other dependencies
}

apply plugin: 'java'
apply plugin: 'eclipse'
//Other plugins

repositories {
    mavenCentral()
}

sourceCompatibility = 1.8
targetCompatibility = 1.8

dependencies {
    // Other dependencies
    annotationProcessor("org.projectlombok:lombok:${lombokVersion}")
    testAnnotationProcessor("org.projectlombok:lombok:${lombokVersion}")
}

Modify you code accordingly.


来源: stackexchange

问:
QLabel, removing border and background
I have several instances of QLabel and I want these rendered without border or background colour. I tried the following:

```<code>plbl = new QLabel();
plbl->setGeometry(210, 0, 26, 16);
plbl->setAlignment(Qt::AlignRight);
plbl->setAlignment(Qt::AlignVCenter);
plbl->setStyleSheet("border: 0px; background-color:rgba(0,0,0,0%);");
plbl->show();
</code>```

I also tried changing the style sheet parameter to:

```<code>plbl->setStyleSheet("QLabel {border: 0px; background-color:rgba(0,0,0,0%);}");
</code>```

and:

```<code>plbl->setFrameStyle(QFrame::NoFrame);
</code>```

None of these work.  I am using Qt Creator 3.5.1, Based on Qt 5.5.1 (GCC 5.2.1 20151129, 32 bit)

I have no choice on the Qt version its part of an SDK for an ACR890 handset.

[Edit]  To fix the alignment, use the Qt specific CSS assignment:

```<code>     qproperty-alignment: 'AlignVCenter | AlignCenter';
</code>```

The quotes and more importantly the pipe are important.

Removing the borders was solved by giving the QLabel constructor a parent, it wasn't a CSS border that was visible, each label was being rendered as a window without a parent.

答:
If you want your QLabel to be a window itself, you need to remove the window frame and sets the right attributes to avoid the window manager to paint the background.

For example:

```<code>    QLabel* plbl = new QLabel("foobar");
    plbl->setGeometry(210, 0, 26, 16);
    plbl->setAlignment(Qt::AlignRight);
    plbl->setAlignment(Qt::AlignVCenter);
    plbl->setWindowFlag(Qt::FramelessWindowHint); // No frame
    plbl->setAttribute(Qt::WA_NoSystemBackground); // No background
    plbl->setAttribute(Qt::WA_TranslucentBackground);
    plbl->show();
</code>```

The label will appear as just a text on the screen.

If you want to insert your label in another widget, you have to set its parent:

```<code>QLabel* plbl = new QLabel("foobar", parent);
// plbl->show(); // Useless. Done by the parent
</code>```

The label will be displayed in parent without background or frame (by default).

ContentLicense: CC BY-SA 4.0

Title: QLabel, removing border and background

Body:
I have several instances of QLabel and I want these rendered without border or background colour. I tried the following:

plbl = new QLabel();
plbl->setGeometry(210, 0, 26, 16);
plbl->setAlignment(Qt::AlignRight);
plbl->setAlignment(Qt::AlignVCenter);
plbl->setStyleSheet("border: 0px; background-color:rgba(0,0,0,0%);");
plbl->show();

I also tried changing the style sheet parameter to:

plbl->setStyleSheet("QLabel {border: 0px; background-color:rgba(0,0,0,0%);}");

and:

plbl->setFrameStyle(QFrame::NoFrame);

None of these work.  I am using Qt Creator 3.5.1, Based on Qt 5.5.1 (GCC 5.2.1 20151129, 32 bit)

I have no choice on the Qt version its part of an SDK for an ACR890 handset.

[Edit]  To fix the alignment, use the Qt specific CSS assignment:

     qproperty-alignment: 'AlignVCenter | AlignCenter';

The quotes and more importantly the pipe are important.

Removing the borders was solved by giving the QLabel constructor a parent, it wasn't a CSS border that was visible, each label was being rendered as a window without a parent.

Body:
If you want your QLabel to be a window itself, you need to remove the window frame and sets the right attributes to avoid the window manager to paint the background.

For example:

    QLabel* plbl = new QLabel("foobar");
    plbl->setGeometry(210, 0, 26, 16);
    plbl->setAlignment(Qt::AlignRight);
    plbl->setAlignment(Qt::AlignVCenter);
    plbl->setWindowFlag(Qt::FramelessWindowHint); // No frame
    plbl->setAttribute(Qt::WA_NoSystemBackground); // No background
    plbl->setAttribute(Qt::WA_TranslucentBackground);
    plbl->show();

The label will appear as just a text on the screen.

If you want to insert your label in another widget, you have to set its parent:

QLabel* plbl = new QLabel("foobar", parent);
// plbl->show(); // Useless. Done by the parent

The label will be displayed in parent without background or frame (by default).


问:
Saving timestamp in mysql table using php
I have a field in a MySQL table which has a timestamp data type. I am saving data into that table. But when I pass the timestamp (1299762201428) to the record, it automatically saves the value 0000-00-00 00:00:00 into that table.

How can I store the timestamp in a MySQL table?

Here is my INSERT statement:

```<code>INSERT INTO table_name (id,d_id,l_id,connection,s_time,upload_items_count,download_items_count,t_time,status)
VALUES (1,5,9,'2',1299762201428,5,10,20,'1'),
       (2,5,9,'2',1299762201428,5,10,20,'1')
</code>```

答:
I'm guessing that the field you are trying to save the value in is a datetime field it's not but the same seems to be true for timestamps. If so mysql expects the format to be Year-month-day Hour:minute:second. In order to save the timestamp you will have to convert the field to numeric using a query like

```<code>alter table <table_name> change <field> <field> bigint unsigned
</code>```

If you are using the current time you can use now() or current_timestamp.

ContentLicense: CC BY-SA 3.0

Body:
I have a field in a MySQL table which has a timestamp data type. I am saving data into that table. But when I pass the timestamp (1299762201428) to the record, it automatically saves the value 0000-00-00 00:00:00 into that table.

How can I store the timestamp in a MySQL table?

Here is my INSERT statement:

INSERT INTO table_name (id,d_id,l_id,connection,s_time,upload_items_count,download_items_count,t_time,status)
VALUES (1,5,9,'2',1299762201428,5,10,20,'1'),
       (2,5,9,'2',1299762201428,5,10,20,'1')

Body:
I'm guessing that the field you are trying to save the value in is a datetime field it's not but the same seems to be true for timestamps. If so mysql expects the format to be Year-month-day Hour:minute:second. In order to save the timestamp you will have to convert the field to numeric using a query like

alter table <table_name> change <field> <field> bigint unsigned

If you are using the current time you can use now() or current_timestamp.


问:
Calculating helping columns on R script on azure machine learning, so they could be later added to tabular model
So I am creating flow for imorting data, so some aggragate columns could be uploaded to Azure Sql database and later on tabular model. Now I would to describe the flow, so someone could tell about it, pros and cons.

At this stage of development the flow is:

1.

User imports CSV file to my web service  (in ASP.NET CORE 2.1) to Azure Sql database, for importing I am using Sql Bulk Library in .NET Core.
The webservice and database will be located on the server in azure.
Some of the data importstakes about 20minutes.

2.

When the data import is finished, I am calling Azure Machine Learning Web service, who will calculate helping columns so later on with MDX queries I could retrieve data from tabular model more easily and more efficiently. These helping columns will tell if users were active previous month or not for example.

3.

When R script finishes calculation it updates Azure Sql Database table with new column(s).

4.

When columns are updated in a database, I am telling Azure Analysis Service to refresh database(not in .net core version because it doesn't support ADOM.NET) So I am created another web service (.NET 4.7) so I could from web service automatically refresh it.

5.

So finally the new data appears on a tabular model so I can get information of data using MDX queries with ADOM.NET library.

Please tell me if there is a better solution for this flow.

答:
Azure SQL Database supports in memory R execution for feature engineering, training models and inference.  It is currently in preview, but will GA soon: https://learn.microsoft.com/en-us/azure/sql-database/sql-database-machine-learning-services-overview

Also at //BUILD, Microsoft announced a serverless performance profile for Azure SQL DB which is perfect for low frequency jobs like this.

This hopefully can simplify your workflow dramatically.


问:
How to save the result of classifier textblob NaiveBayesClassifier?
I am using TextBlob's NaiveBayesclassifier for text analysis according to the given themes that I have chosen.

The data is huge(about 3000 entries).

Though I was able to get a result, I'm not able to save it for future use without calling that function again and waiting hours till the processing gets complete.

I tried pickling by the following method

```<code>ab = NaiveBayesClassifier(data)

import pickle

object = ab
file = open('f.obj','w') #tried to use 'a' in place of 'w' ie. append
pickle.dump(object,file)
</code>```

and I got an error, which is as follows:

```<code>Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\pickle.py", line 1370, in dump
    Pickler(file, protocol).dump(obj)
  File "C:\Python27\lib\pickle.py", line 224, in dump
    self.save(obj)
  File "C:\Python27\lib\pickle.py", line 331, in save
    self.save_reduce(obj=obj, *rv)
  File "C:\Python27\lib\pickle.py", line 419, in save_reduce
    save(state)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 649, in save_dict
    self._batch_setitems(obj.iteritems())
  File "C:\Python27\lib\pickle.py", line 663, in _batch_setitems
    save(v)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 600, in save_list
    self._batch_appends(iter(obj))
  File "C:\Python27\lib\pickle.py", line 615, in _batch_appends
    save(x)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 562, in save_tuple
    save(element)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 649, in save_dict
    self._batch_setitems(obj.iteritems())
  File "C:\Python27\lib\pickle.py", line 662, in _batch_setitems
    save(k)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 501, in save_unicode
    self.memoize(obj)
  File "C:\Python27\lib\pickle.py", line 247, in memoize
    self.memo[id(obj)] = memo_len, obj
MemoryError
</code>```

I also tried with sPickle but it also resulted in errors such as:

```<code>#saving object with function sPickle.s_dump
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\sPickle.py", line 22, in s_dump
    for elt in iterable_to_pickle:
TypeError: 'NaiveBayesClassifier' object is not iterable

#saving object with function sPickle.s_dump_elt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\sPickle.py", line 28, in s_dump_elt
    pickled_elt_str = dumps(elt_to_pickle)
MemoryError: out of memory
</code>```

Can anyone tell me what I have to do to save the object?

Or is there anyway by which is save the results of the classifier for future use?

答:
For Python > 3.0 it appears cPickle is not there any more, but the default pickle does the job, just make sure to use the protocol that fits with your python installation. For python > 3.4 use this:</p>

```<code>import pickle
with open(r"blobClassifier.pickle",'wb') as file:
    pickle.dump(cl_Title, file, protocol=pickle.HIGHEST_PROTOCOL,fix_imports=False)
</code>```

Body:
I am using TextBlob's NaiveBayesclassifier for text analysis according to the given themes that I have chosen.

The data is huge(about 3000 entries).

Though I was able to get a result, I'm not able to save it for future use without calling that function again and waiting hours till the processing gets complete.

I tried pickling by the following method

ab = NaiveBayesClassifier(data)

import pickle

object = ab
file = open('f.obj','w') #tried to use 'a' in place of 'w' ie. append
pickle.dump(object,file)

and I got an error, which is as follows:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\pickle.py", line 1370, in dump
    Pickler(file, protocol).dump(obj)
  File "C:\Python27\lib\pickle.py", line 224, in dump
    self.save(obj)
  File "C:\Python27\lib\pickle.py", line 331, in save
    self.save_reduce(obj=obj, *rv)
  File "C:\Python27\lib\pickle.py", line 419, in save_reduce
    save(state)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 649, in save_dict
    self._batch_setitems(obj.iteritems())
  File "C:\Python27\lib\pickle.py", line 663, in _batch_setitems
    save(v)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 600, in save_list
    self._batch_appends(iter(obj))
  File "C:\Python27\lib\pickle.py", line 615, in _batch_appends
    save(x)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 562, in save_tuple
    save(element)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 649, in save_dict
    self._batch_setitems(obj.iteritems())
  File "C:\Python27\lib\pickle.py", line 662, in _batch_setitems
    save(k)
  File "C:\Python27\lib\pickle.py", line 286, in save
    f(self, obj) # Call unbound method with explicit self
  File "C:\Python27\lib\pickle.py", line 501, in save_unicode
    self.memoize(obj)
  File "C:\Python27\lib\pickle.py", line 247, in memoize
    self.memo[id(obj)] = memo_len, obj
MemoryError

I also tried with sPickle but it also resulted in errors such as:

#saving object with function sPickle.s_dump
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\sPickle.py", line 22, in s_dump
    for elt in iterable_to_pickle:
TypeError: 'NaiveBayesClassifier' object is not iterable

#saving object with function sPickle.s_dump_elt
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\site-packages\sPickle.py", line 28, in s_dump_elt
    pickled_elt_str = dumps(elt_to_pickle)
MemoryError: out of memory

Can anyone tell me what I have to do to save the object?

Or is there anyway by which is save the results of the classifier for future use?

Body:
For Python > 3.0 it appears cPickle is not there any more, but the default pickle does the job, just make sure to use the protocol that fits with your python installation. For python > 3.4 use this:

import pickle
with open(r"blobClassifier.pickle",'wb') as file:
    pickle.dump(cl_Title, file, protocol=pickle.HIGHEST_PROTOCOL,fix_imports=False)


问:
Automate process for downloading cumulative update
I want to automate process of downloading newest CU for NAV and BC.I wrote powershell script, but still need part how to donwload zip file from this page (https://www.microsoft.com/en-us/download/details.aspx?id=58275)

This is the code that I wrote so far:

```<code>$FeedUrl = "https://support.microsoft.com/app/content/api/content/feeds/sap/en-gb/dea12e4a-4dd3-35e1-2577-45df252a2b9c/atom"
$FeedFilePath = "C:\Test\Feed.xml"
$ArticlePath = "C:\Test\Article.html"
$DownloadPagePath = "C:\Test\Download.html"

Download_File -Url $FeedUrl -FileName $FeedFilePath

[xml]$Content = Get-Content $FeedFilePath
$Feed = $Content.feed
$SearchString = "Cumulative Update * for Microsoft Dynamics NAV 2018 *"

foreach($item in $Feed.entry){
    if($item.title -like $SearchString){
        Download_File -Url $item.link.href -FileName $ArticlePath
        $Article = Get-Content $ArticlePath | Out-String
        $endPos = 1
        $startPos = $Article.IndexOf('http://www.microsoft.com/downloads/details.aspx?familyid=', $endPos)
        $endPos = $Article.IndexOf('\"', $startPos)
        $DownloadUrl = $Article.Substring($startPos, $endPos - $startPos)
        break
    }
}
Download_File -Url $DownloadUrl -FileName $DownloadPagePath
</code>```

答:
Have you seen this?

http://www.waldo.be/2016/12/09/automate-downloads-of-cumulative-updates/

I also wonder why you need this?
I think it's easier to pull docker images. Just if you do not need the installation media.

Body:
I want to automate process of downloading newest CU for NAV and BC.I wrote powershell script, but still need part how to donwload zip file from this page (https://www.microsoft.com/en-us/download/details.aspx?id=58275)

This is the code that I wrote so far:

$FeedUrl = "https://support.microsoft.com/app/content/api/content/feeds/sap/en-gb/dea12e4a-4dd3-35e1-2577-45df252a2b9c/atom"
$FeedFilePath = "C:\Test\Feed.xml"
$ArticlePath = "C:\Test\Article.html"
$DownloadPagePath = "C:\Test\Download.html"

Download_File -Url $FeedUrl -FileName $FeedFilePath

[xml]$Content = Get-Content $FeedFilePath
$Feed = $Content.feed
$SearchString = "Cumulative Update * for Microsoft Dynamics NAV 2018 *"

foreach($item in $Feed.entry){
    if($item.title -like $SearchString){
        Download_File -Url $item.link.href -FileName $ArticlePath
        $Article = Get-Content $ArticlePath | Out-String
        $endPos = 1
        $startPos = $Article.IndexOf('http://www.microsoft.com/downloads/details.aspx?familyid=', $endPos)
        $endPos = $Article.IndexOf('\"', $startPos)
        $DownloadUrl = $Article.Substring($startPos, $endPos - $startPos)
        break
    }
}
Download_File -Url $DownloadUrl -FileName $DownloadPagePath


问:
Excel macros - Too many line continuations
I have a "large" SQL query (like 200 lines)...

```<code>dim query as string
query = "..................................." & _
        "..................................." & _
           .... Like a lot lines later...
        "..................................."

function query,"sheet 1"
</code>```

When I do this, Excel says "Too many line continuations."

What is the best way to avoid this?

答:
why not use VBA to help with the VBA concatenation?

Check this code of mine (it is very primitive and feel free to adjust it), it basically takes whatever data you have on worksheet called "Fast_string" in columns "A:E" and in column F it prepares you the code for the concatenation using preliminary variable "prelim_string". You just use this and then copy-paste the solution from column F into your code... you're welcome ;)

```<code>Sub FAST_STRING()
Dim cel As Range, lastcel As Range, prel_r As String, i As Integer, cr As Integer
With ThisWorkbook.Worksheets("Fast_string")
Set lastcel = .Cells(10000, 1).End(xlUp)
For Each cel In .Range(.Cells(1, 1), lastcel)
    cr = cel.row
    prel_r = ""

    For i = 1 To 5
     If .Cells(cr, i) = "" Then
        prel_r = prel_r & "     "
     Else
        prel_r = prel_r & " " & Replace(.Cells(cr, i).Value, """", """""")
     End If
    Next i

    If cr = 1 Then
         prel_r = "Prelim_string =" & """" & prel_r & """" & " & chr(10) & _"
    ElseIf cr / 20 = Round(cr / 20) Then
         prel_r = "Prelim_string = Prelim_string & " & """" & prel_r & """" & " & chr(10) & _"
    Else
         prel_r = """" & prel_r & """" & " & chr(10) & _"
    End If
    If cr = lastcel.row Or (cr + 1) / 20 = Round((cr + 1) / 20) Then prel_r = Left(prel_r, Len(prel_r) - 14)
    cel(1, 6) = prel_r
Next cel
End With
End Sub
</code>```

Body:
I have a "large" SQL query (like 200 lines)...

dim query as string
query = "..................................." & _
        "..................................." & _
           .... Like a lot lines later...
        "..................................."

function query,"sheet 1"

When I do this, Excel says "Too many line continuations."

What is the best way to avoid this?

Body:
why not use VBA to help with the VBA concatenation?

Check this code of mine (it is very primitive and feel free to adjust it), it basically takes whatever data you have on worksheet called "Fast_string" in columns "A:E" and in column F it prepares you the code for the concatenation using preliminary variable "prelim_string". You just use this and then copy-paste the solution from column F into your code... you're welcome ;)

Sub FAST_STRING()
Dim cel As Range, lastcel As Range, prel_r As String, i As Integer, cr As Integer
With ThisWorkbook.Worksheets("Fast_string")
Set lastcel = .Cells(10000, 1).End(xlUp)
For Each cel In .Range(.Cells(1, 1), lastcel)
    cr = cel.row
    prel_r = ""

    For i = 1 To 5
     If .Cells(cr, i) = "" Then
        prel_r = prel_r & "     "
     Else
        prel_r = prel_r & " " & Replace(.Cells(cr, i).Value, """", """""")
     End If
    Next i

    If cr = 1 Then
         prel_r = "Prelim_string =" & """" & prel_r & """" & " & chr(10) & _"
    ElseIf cr / 20 = Round(cr / 20) Then
         prel_r = "Prelim_string = Prelim_string & " & """" & prel_r & """" & " & chr(10) & _"
    Else
         prel_r = """" & prel_r & """" & " & chr(10) & _"
    End If
    If cr = lastcel.row Or (cr + 1) / 20 = Round((cr + 1) / 20) Then prel_r = Left(prel_r, Len(prel_r) - 14)
    cel(1, 6) = prel_r
Next cel
End With
End Sub


问:
Unobtrusive, realtime notifications of new RSS entries
First, why I ask:  Now that reputation points on StackOverflow have real value (you can spend them on damn good answers by offering bounties) I'd like to monitor questions I might be able to answer and pounce on them!  (Also the fact that others answer my questions in real time makes StackOverflow amazingly handy, so it would be nice to reciprocate.)

To ask this as a more general question, not specific to StackOverflow:

What kind of delay will there typically be in an RSS feed vs polling and scraping?

What's a good way to display the notifications in a not-too-distracting way, such as Growl on Mac?  (It should also be easy to turn on and off, if it does get too distracting.)

(Or, for StackOverflow addicts, what's your setup for pouncing on new questions and can you generalize it for monitoring other web content in real time?)

答: VibeFire is a decent solution for this.  It'll read RSS feeds and pop up notifications (that will automatically go away if you don't read them) for you.  http://vibefire.com if you're interested.  Its a bundled installer though, but it won't install anything you don't accept.</p>

OwnerDisplayName: dreeves

ContentLicense: CC BY-SA 2.5

OwnerDisplayName: Jordan Cox


问:
How to deal with async function in react?
I have a body object with different types of elements: (strings, number, objects...).

I need to show the body in a table.

In order to do it, I need to print in one table the elements that aren't objects, and in another table the elements that are objects.

So I am calling the function to create an array with object elements (arrObj) and another array with the non object elements (arrSimple).

The problem is that when I go through the arrSimple array to print the elements in a table, this array is empty.

Could anyone guide me on how can I resolve this async problem?

```<code>const DetailResult = props => {

    ...
    const arrSimple = []
    const arrObj = []

    function organizeArray() {
        for (const prop in body) {
            if (typeof (body[prop]) != 'object') {
                arrSimple[prop] = (body[prop])
            } else if (typeof (body[prop]) == 'object') {
                arrObj[prop] = (body[prop])
            }
        }
    }

    function renderGeneralData() {
        organizeArray()

        arrSimple.map((key, i) => {
            <tr key={i}>
                <td width="25%">{key}</td>
                <td>{(arrSimple[key])}</td>
            </tr>
        })

    }

    return (

        <div>
            <table className='table table-striped'>
                <tbody>
                    <tr>
                        <th>General Data</th>
                    </tr>
                    <tr>
                        {renderGeneralData()}
                    </tr>
                </tbody>
            </table>
        </div>
    )
}

export default DetailResult;
</code>```

The body object comes from the app component.

```<code>class App extends Component {

    constructor() {
        super()
        this.state = {
            dataTable: {
                transactionID: '',
                maxRows: 10,
                currentPage: 0,
                list: {
                    headerList: [],
                    body: []
                }
            }
        }
        this.search = this.search.bind(this)
     }

      search() {
        axios.get(URL)
            .then(resp => this.setState({
                dataTable: Object.assign(this.state.dataTable, {
                    list: [
                        {headerList: ['App name', 'Date', 'Bio data', 'Is verified', 'Actions']},
                        {body: resp.data},
                    ],
                }),

            }))
            .catch(function (error) {
                console.log(error);
            })
    }
</code>```

I have a component that contains a search field to make a request

```<code> const SearchComponent = props => {

        const renderDetailResult =
            <DetailResult list={props.dtObject.list}
                search={props.search}
            />

         return (
            <div role='form' className='searchID'>
                <ContentHeader title={props.componentHeaderTitle} />
                <Grid cols='12 9 10'>
                    <input id="cpf" className='w-25 form-control'
                        placeholder='Type the ID'
                    />
                </Grid>
                <Grid cols='12 3 2'>
                    <IconButton style='primary' icon='search'
                        onClick={props.search}>
                    </IconButton>
                </Grid>
                <Grid cols='12'>
                    {renderDetailResult}
                </Grid>

            </div>
        )
    }

    export default SearchComponent
</code>```

答:
The reason why nothing appears is that you are calling a function that returns nothing, so there isn't anything to render.

You need to return the .map and return the elements you want.

```<code>function renderGeneralData() {
    organizeArray()

    // added return
    return arrSimple.map((key, i) => (
        <tr key={i}>
            <td width="25%">{key}</td>
            <td>{(arrSimple[key])}</td>
        </tr>
    ))

}
</code>```

Observation

You are rendering
 inside
. I recommend removing the

```<code>return arrSimple.map((key, i) => (
    //returning tr
    <tr key={i}>
        <td width="25%">{key}</td>
        <td>{(arrSimple[key])}</td>
    </tr>
))

<tr>
    // returned tr inside another tr
    {renderGeneralData()}
</tr>
</code>```

I'm not sure how you want to display your data, but I recommend removing one of the tr tag.

Quick tip

If you want to  remove the tr that is inside .map you should use React.Fragment

```<code>return arrSimple.map((key, i) => (
    <React.Fragment key={i}>
        <td width="25%">{key}</td>
        <td>{(arrSimple[key])}</td>
    </React.Fragment>
))
</code>```

Edit:

I also noticed something weird in your code in this part

```<code>arrSimple.map((key, i) => (
    <tr key={i}>
        <td width="25%">{key}</td>
        <td>{(arrSimple[key])}</td>
    </tr>
))
</code>```

In this part of the code, key will be an element of arrSimple. If you do arrSimple[key] it will probably return undefined. Here is an example

arr = ['hey', 'this', 'is', 'bad', '!']
console.log(arr.map((key, i) => arr[key]))```

Body:
I have a body object with different types of elements: (strings, number, objects...).

I need to show the body in a table.

In order to do it, I need to print in one table the elements that aren't objects, and in another table the elements that are objects.

So I am calling the function to create an array with object elements (arrObj) and another array with the non object elements (arrSimple).

The problem is that when I go through the arrSimple array to print the elements in a table, this array is empty.

Could anyone guide me on how can I resolve this async problem?

const DetailResult = props => {

    ...
    const arrSimple = []
    const arrObj = []

    function organizeArray() {
        for (const prop in body) {
            if (typeof (body[prop]) != 'object') {
                arrSimple[prop] = (body[prop])
            } else if (typeof (body[prop]) == 'object') {
                arrObj[prop] = (body[prop])
            }
        }
    }

    function renderGeneralData() {
        organizeArray()

        arrSimple.map((key, i) => {

                {key}
                {(arrSimple[key])}

        })

    }

    return (

                        General Data

                        {renderGeneralData()}

    )
}

export default DetailResult;

The body object comes from the app component.

class App extends Component {

    constructor() {
        super()
        this.state = {
            dataTable: {
                transactionID: '',
                maxRows: 10,
                currentPage: 0,
                list: {
                    headerList: [],
                    body: []
                }
            }
        }
        this.search = this.search.bind(this)
     }

      search() {
        axios.get(URL)
            .then(resp => this.setState({
                dataTable: Object.assign(this.state.dataTable, {
                    list: [
                        {headerList: ['App name', 'Date', 'Bio data', 'Is verified', 'Actions']},
                        {body: resp.data},
                    ],
                }),

            }))
            .catch(function (error) {
                console.log(error);
            })
    }

I have a component that contains a search field to make a request

 const SearchComponent = props => {

        const renderDetailResult =
            <DetailResult list={props.dtObject.list}
                search={props.search}
            />

         return (

                <ContentHeader title={props.componentHeaderTitle} />
                <Grid cols='12 9 10'>
                    <input id="cpf" className='w-25 form-control'
                        placeholder='Type the ID'
                    />
                </Grid>
                <Grid cols='12 3 2'>
                    <IconButton style='primary' icon='search'
                        onClick={props.search}>
                    </IconButton>
                </Grid>
                <Grid cols='12'>
                    {renderDetailResult}
                </Grid>

        )
    }

    export default SearchComponent

Body:
The reason why nothing appears is that you are calling a function that returns nothing, so there isn't anything to render.

You need to return the .map and return the elements you want.

function renderGeneralData() {
    organizeArray()

    // added return
    return arrSimple.map((key, i) => (
        <tr key={i}>
            <td width="25%">{key}</td>
            <td>{(arrSimple[key])}</td>
        </tr>
    ))

}

Observation

You are rendering <tr> inside <tr>. I recommend removing the

return arrSimple.map((key, i) => (
    //returning tr
    <tr key={i}>
        <td width="25%">{key}</td>
        <td>{(arrSimple[key])}</td>
    </tr>
))

<tr>
    // returned tr inside another tr
    {renderGeneralData()}
</tr>

I'm not sure how you want to display your data, but I recommend removing one of the tr tag.

Quick tip

If you want to  remove the tr that is inside .map you should use React.Fragment

return arrSimple.map((key, i) => (
    <React.Fragment key={i}>
        <td width="25%">{key}</td>
        <td>{(arrSimple[key])}</td>
    </React.Fragment>
))

Edit:

I also noticed something weird in your code in this part

arrSimple.map((key, i) => (
    <tr key={i}>
        <td width="25%">{key}</td>
        <td>{(arrSimple[key])}</td>
    </tr>
))

In this part of the code, key will be an element of arrSimple. If you do arrSimple[key] it will probably return undefined. Here is an example

arr = ['hey', 'this', 'is', 'bad', '!']
console.log(arr.map((key, i) => arr[key]))


问:
multi-dimensional array hierarchy from key name
I like to know how can I get the hierarchy by the identifier Key NAME, just the values with PHP. I already had try some implode functions but without success. I appreciated any help. Thanks

This is an example :

```<code>$treeArray = (Array
(
    [0] => Array
        (
            [name] => S-ATLANTICO-1
            [id] => 1HIk_jh2GHo2VnBbUI8c3P9cADY4NnKQ5
            [parents] =>
            [children] => Array
                (
                    [0] => Array
                        (
                            [name] => TESTE
                            [id] => 1EYi_CF7gjANq_MPnUOkquJI609Jkhzf0
                            [parents] => 1HIk_jh2GHo2VnBbUI8c3P9cADY4NnKQ5
                        )

                    [1] => Array
                        (
                            [name] => SAPO
                            [id] => 1I8QxJiMa11U2s4ncPxyqfdCPk_6dQ9Tl
                            [parents] => 1HIk_jh2GHo2VnBbUI8c3P9cADY4NnKQ5
                            [children] => Array
                                (
                                    [0] => Array
                                        (
                                            [name] => SAPO-1
                                            [id] => 1KGzjcy79TCKp-c6T1Xxm5WqswXhqFlb7
                                            [parents] => 1I8QxJiMa11U2s4ncPxyqfdCPk_6dQ9Tl
                                        )

                                    [1] => Array
                                        (
                                            [name] => carlos.csv
                                            [id] => 1eHU_r5GJCXualVQMhurd6FwOoD_h3hHG
                                            [parents] => 1I8QxJiMa11U2s4ncPxyqfdCPk_6dQ9Tl
                                        )

                                    [2] => Array
                                        (
                                            [name] => logo-news_sa.png
                                            [id] => 16HnsOxzDEow710jNfda7Mtt-8qsLwSeG
                                            [parents] => 1I8QxJiMa11U2s4ncPxyqfdCPk_6dQ9Tl
                                        )

                                )

                        )

                    [2] => Array
                        (
                            [name] => DOCUMENTOS
                            [id] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                            [parents] => 1HIk_jh2GHo2VnBbUI8c3P9cADY4NnKQ5
                            [children] => Array
                                (
                                    [0] => Array
                                        (
                                            [name] => carlos-excel
                                            [id] => 16YyMy3F9QMzRT5XtCMVJygKDEVVSRpAVmAjh0XU3luY
                                            [parents] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                                        )

                                    [1] => Array
                                        (
                                            [name] => carlos-excel.xlsx
                                            [id] => 1GbJ9YmwuRiUmnT8jRJ9pLZI7acqO4eu-
                                            [parents] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                                        )

                                    [2] => Array
                                        (
                                            [name] => SAPO
                                            [id] => 1DRBPJHPxRSeaa7zC8yF-UgGbo9tpwOsOxAusfEuGtsY
                                            [parents] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                                        )

                                    [3] => Array
                                        (
                                            [name] => PRECIOS
                                            [id] => 1S0lNS7bKOK6wBxhCZcB7uaNBXA1GMqlxwtTdSBc4f9U
                                            [parents] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                                        )

                                )

                        )

                )

        )

)
);
</code>```

This result would be ok: in array or print in screen line by line.

```
S-ATLANTICO-1/
S-ATLANTICO-1/TESTE
S-ATLANTICO-1/SAPO
S-ATLANTICO-1/SAPO/SAPO-1
S-ATLANTICO-1/SAPO/carlos.csv
S-ATLANTICO-1/SAPO/logo-news_sa.png
S-ATLANTICO-1/DOCUMENTOS
S-ATLANTICO-1/DOCUMENTOS/carlos-excel
S-ATLANTICO-1/DOCUMENTOS/carlos-excel.xlsx
S-ATLANTICO-1/DOCUMENTOS/SAPO
S-ATLANTICO-1/DOCUMENTOS/PRECIOS
```

答:
```<code>$array = [
    ['App', 'Classes', 'Auth'],
    ['App', 'Classes', 'Auth'],
    ['App', 'Classes', 'Middleware'],
    ['App', 'Classes', 'Phone'],
    ['App', 'Classes', 'Auth'],
    ['App', 'Mail'],
    ['App', 'Mail', 'Sender'],
    ['App', 'Box'],
    ['Bla', 'bli'],
];

var_dump(arrayToNamespace($array));

function arrayToNamespace($array) {
    $newArr = array();

    foreach ($array as $nsArr) {
        $wns = &$newArr;
        foreach ($nsArr as $ns) {
            if (!isset($wns[$ns])) {
                $wns[$ns] = array();
            }
            $wns = &$wns[$ns];
        }
    }
    return $newArr;
}
</code>```

Body:
I like to know how can I get the hierarchy by the identifier Key NAME, just the values with PHP. I already had try some implode functions but without success. I appreciated any help. Thanks

This is an example :

$treeArray = (Array
(
    [0] => Array
        (
            [name] => S-ATLANTICO-1
            [id] => 1HIk_jh2GHo2VnBbUI8c3P9cADY4NnKQ5
            [parents] =>
            [children] => Array
                (
                    [0] => Array
                        (
                            [name] => TESTE
                            [id] => 1EYi_CF7gjANq_MPnUOkquJI609Jkhzf0
                            [parents] => 1HIk_jh2GHo2VnBbUI8c3P9cADY4NnKQ5
                        )

                    [1] => Array
                        (
                            [name] => SAPO
                            [id] => 1I8QxJiMa11U2s4ncPxyqfdCPk_6dQ9Tl
                            [parents] => 1HIk_jh2GHo2VnBbUI8c3P9cADY4NnKQ5
                            [children] => Array
                                (
                                    [0] => Array
                                        (
                                            [name] => SAPO-1
                                            [id] => 1KGzjcy79TCKp-c6T1Xxm5WqswXhqFlb7
                                            [parents] => 1I8QxJiMa11U2s4ncPxyqfdCPk_6dQ9Tl
                                        )

                                    [1] => Array
                                        (
                                            [name] => carlos.csv
                                            [id] => 1eHU_r5GJCXualVQMhurd6FwOoD_h3hHG
                                            [parents] => 1I8QxJiMa11U2s4ncPxyqfdCPk_6dQ9Tl
                                        )

                                    [2] => Array
                                        (
                                            [name] => logo-news_sa.png
                                            [id] => 16HnsOxzDEow710jNfda7Mtt-8qsLwSeG
                                            [parents] => 1I8QxJiMa11U2s4ncPxyqfdCPk_6dQ9Tl
                                        )

                                )

                        )

                    [2] => Array
                        (
                            [name] => DOCUMENTOS
                            [id] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                            [parents] => 1HIk_jh2GHo2VnBbUI8c3P9cADY4NnKQ5
                            [children] => Array
                                (
                                    [0] => Array
                                        (
                                            [name] => carlos-excel
                                            [id] => 16YyMy3F9QMzRT5XtCMVJygKDEVVSRpAVmAjh0XU3luY
                                            [parents] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                                        )

                                    [1] => Array
                                        (
                                            [name] => carlos-excel.xlsx
                                            [id] => 1GbJ9YmwuRiUmnT8jRJ9pLZI7acqO4eu-
                                            [parents] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                                        )

                                    [2] => Array
                                        (
                                            [name] => SAPO
                                            [id] => 1DRBPJHPxRSeaa7zC8yF-UgGbo9tpwOsOxAusfEuGtsY
                                            [parents] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                                        )

                                    [3] => Array
                                        (
                                            [name] => PRECIOS
                                            [id] => 1S0lNS7bKOK6wBxhCZcB7uaNBXA1GMqlxwtTdSBc4f9U
                                            [parents] => 1viFriBa2GaSxiLG8nDYIDd-sFl545T31
                                        )

                                )

                        )

                )

        )

)
);

This result would be ok: in array or print in screen line by line.

S-ATLANTICO-1/
S-ATLANTICO-1/TESTE
S-ATLANTICO-1/SAPO
S-ATLANTICO-1/SAPO/SAPO-1
S-ATLANTICO-1/SAPO/carlos.csv
S-ATLANTICO-1/SAPO/logo-news_sa.png
S-ATLANTICO-1/DOCUMENTOS
S-ATLANTICO-1/DOCUMENTOS/carlos-excel
S-ATLANTICO-1/DOCUMENTOS/carlos-excel.xlsx
S-ATLANTICO-1/DOCUMENTOS/SAPO
S-ATLANTICO-1/DOCUMENTOS/PRECIOS


问:
How can i apply Unit Testing on my simple algorithm?
I have a maven project that draws Christmas tree. I need to implement Unit tests on it but i have no idea how to do it :/  </p>

<p>I already set up , JUnit on my Maven project </p>

```<code>for (int i = 0; i < 4; i++) {
   for (int j = 0; j < 10 - i; j++)
    System.out.print(" ");
   for (int k = 0; k < (2 * i + 1); k++)
    System.out.print("*");
   System.out.println();
  }
</code>```

答:
Assuming your class that draws Christmas tree looks more or less like that:

```<code>class ChristmasTreeDrafter {

    void draw() {
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 10 - i; j++)
                System.out.print(" ");
            for (int k = 0; k < (2 * i + 1); k++)
                System.out.print("*");
            System.out.println();
        }
    }
}
</code>```

You can test it in that way:

```<code>public class ChristmasTreeDrafterTest {

    private final ByteArrayOutputStream out = new ByteArrayOutputStream();

    @Before
    public void setup() {
        System.setOut(new PrintStream(out));
    }

    @Test
    public void shouldDrawChristmasTree() {
        // given
        ChristmasTreeDrafter christmasTreeDrafter = new ChristmasTreeDrafter();

        // when
        christmasTreeDrafter.draw();

        // then
        Assert.assertEquals("          *\r\n" +
                "         ***\r\n" +
                "        *****\r\n" +
                "       *******\r\n", out.toString());
    }
}
</code>```

In the setup method standard output stream is redirected to the out object and thanks to this you can verify its content in then block. Unfortunately Java has no multiline strings, so this code looks ugly. In order to improve readability you can extract this content to the file under test/resources (assuming default maven project structure).

Body:
I have a maven project that draws Christmas tree. I need to implement Unit tests on it but i have no idea how to do it :/

I already set up , JUnit on my Maven project

for (int i = 0; i < 4; i++) {
   for (int j = 0; j < 10 - i; j++)
    System.out.print(" ");
   for (int k = 0; k < (2 * i + 1); k++)
    System.out.print("*");
   System.out.println();
  }

Body:
Assuming your class that draws Christmas tree looks more or less like that:

class ChristmasTreeDrafter {

    void draw() {
        for (int i = 0; i < 4; i++) {
            for (int j = 0; j < 10 - i; j++)
                System.out.print(" ");
            for (int k = 0; k < (2 * i + 1); k++)
                System.out.print("*");
            System.out.println();
        }
    }
}

You can test it in that way:

public class ChristmasTreeDrafterTest {

    private final ByteArrayOutputStream out = new ByteArrayOutputStream();

    @Before
    public void setup() {
        System.setOut(new PrintStream(out));
    }

    @Test
    public void shouldDrawChristmasTree() {
        // given
        ChristmasTreeDrafter christmasTreeDrafter = new ChristmasTreeDrafter();

        // when
        christmasTreeDrafter.draw();

        // then
        Assert.assertEquals("          *\r\n" +
                "         ***\r\n" +
                "        *****\r\n" +
                "       *******\r\n", out.toString());
    }
}

In the setup method standard output stream is redirected to the out object and thanks to this you can verify its content in then block. Unfortunately Java has no multiline strings, so this code looks ugly. In order to improve readability you can extract this content to the file under test/resources (assuming default maven project structure).


问:
VBA resize table to fit to page's width
I want to resize a table to fit to the pages width via VBA code.

I have tried it with the following code:

```<code> mytable.PreferredWidthType = wdPreferredWidthPercent
 mytable.PreferredWidth = 100
</code>```

Can anyone tell me how I can resize the table to the page size? My first page has an edge of 2 centimeters and because of this the table jumps to page 2.

Thanks in advance!

答:
You could try the AutoFitBehavior property of the table.

mytable.AutoFitBehavior = wdAutoFitWindow

AutoFitBehavior

Title: VBA resize table to fit to page's width

Body:
I want to resize a table to fit to the pages width via VBA code.

I have tried it with the following code:

 mytable.PreferredWidthType = wdPreferredWidthPercent
 mytable.PreferredWidth = 100

Can anyone tell me how I can resize the table to the page size? My first page has an edge of 2 centimeters and because of this the table jumps to page 2.

Thanks in advance!


问:
Array Manipulation : HackerRank Questions : JAVA
I am doing this Array Manipulation problem from hackerrank and it tells me compile error is Terminated due to timeout.

For small arrays my method work perfectly. This error only happens for bigger array values.

Here is the question link. Question Here

Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each of the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in your array.

For example, the length of your array of zeros . Your list of queries is as follows:

```<code>a b k
1 5 3
4 8 7
6 9 1
</code>```

Add the values of  between the indices  and  inclusive:

```<code>index -> 1 2 3  4  5 6 7 8 9 10
        [0,0,0, 0, 0,0,0,0,0, 0]
        [3,3,3, 3, 3,0,0,0,0, 0]
        [3,3,3,10,10,7,7,7,0, 0]
        [3,3,3,10,10,8,8,8,1, 0]
</code>```

The largest value is  after all operations are performed.

Given below is my method.

```<code> static long arrayManipulation(int n, int[][] queries) {
    long max = 0L;
    long[] arr = new long[n];
    for (int i = 0; i < n; i++) {
        arr[i] = 0L;
    }
    for (int i = 0; i < queries.length; i++) {
        int[] q = queries[i];
        int start = q[0] - 1;
        int end = q[1] - 1;
        int val = q[2];
        long tempMax = updateVal(start, end, val, arr);
        if (tempMax > max) {
           max = tempMax;
        }
    }
    return max;
 }

static long updateVal(int start, int end, int val, long[] arr) {
   long max = 0L;
   for (int i = start; i <= end; i++) {
       arr[i] = arr[i] + val;
       if (arr[i] > max) {
           max = arr[i];
       }
   }
   return max;
}
</code>```

Given below are few test classes that doesn't work with my code.

Test1 Test2 Test3

Please help me to figure this out. I searched for lots of answers based on java.

But I couldn't understand them.

This is my last resort. Please help.

Updated after Kanahaiya's answer

```<code>    static long arrayManipulation(int n, int[][] queries) {
        long max = 0L;
        int a, b, k;
        int[] arr = new int[n + 2];
        for (int i = 0; i < queries.length; i++) {
            a = queries[i][0];
            b = queries[i][1];
            k = queries[i][2];

            for (int j = 0; j < arr.length; j++) {
                if (j >= a) {
                    arr[j] = arr[j] + k;
                }
                if (j > b) {
                    arr[j] = arr[j] - k;
                }
            }
        }
        Arrays.sort(arr);
        max = arr[arr.length - 1];
        return max;
    }
</code>```

答:
Brute-force solution is not going to work here due to the given time constraint.
That is the reason you will get the time out error.

So you need to optimize your code which can be done with the help of prefix sum array.

instead of adding k to all the elements within a range from a to b in an array, accumulate the difference array

Whenever we add anything at any index into an array and apply prefix sum algorithm the same element will be added to every element till the end of the array.

ex- n=5, m=1, a=2 b=5 k=5

```<code>    i     0.....1.....2.....3.....4.....5.....6   //take array of size N+2 to avoid index out of bound
  A[i]    0     0     0     0     0     0     0
</code>```

Add k=5 to at a=2

A[a]=A[a]+k  // start index from where k element should be added

```<code>     i    0.....1.....2.....3.....4.....5.....6
   A[i]   0     0     5     0     0     0     0
</code>```

now apply prefix sum algorithm

```<code>     i    0.....1.....2.....3.....4.....5.....6
  A[i]    0     0     5     5     5     5     5
</code>```

so you can see K=5 add to all the element till the end after applying prefix sum but we don't have to add k till the end. so to negate this effect we have to add -K also after b+1 index so that only from [a,b] range only will have K element addition effect.

A[b+1]=A[b]-k  // to remove the effect of previously added k element after bth index.
that's why adding -k in the initial array along with +k.

```<code>    i    0.....1.....2.....3.....4.....5.....6
  A[i]   0     0     5     0     0     0    -5
</code>```

Now apply prefix sum Array

```<code>    i    0.....1.....2.....3.....4.....5.....6
  A[i]   0     0     5     5     5     5     0
</code>```

You can see now K=5 got added from a=2 to b=5 which was expected.
Here we are only updating two indices for every query so complexity will be O(1).

Now apply the same algorithm in the input

```<code>         # 0.....1.....2.....3.....4.....5.....6    //taken array of size N+2 to avoid index out of bound
5 3      # 0     0     0     0     0     0     0
1 2 100  # 0    100    0   -100    0     0     0
2 5 100  # 0    100   100  -100    0     0   -100
3 4 100  # 0    100   100    0     0  -100   -100
</code>```

To calculate the max prefix sum, accumulate the difference array to  while taking the maximum accumulated prefix.

After performing all the operation now apply prefix sum Array

```<code>    i      0.....1.....2.....3.....4.....5.....6
  A[i]     0     100   200  200   200   100    0
</code>```

Now you can traverse this array to find max which is 200.
traversing the array will take O(N) time and updating the two indices for each query will take O(1)* number of queries(m)

overall complexity=O(N)+O(M)
                  = O(N+M)

it means = (10^7+10^5) which is less than 10^8 (per second)

Note: If searching for video tutorial , you must check it out here for detailed explanation.

Body:
I am doing this Array Manipulation problem from hackerrank and it tells me compile error is Terminated due to timeout.

For small arrays my method work perfectly. This error only happens for bigger array values.

Here is the question link. Question Here

Starting with a 1-indexed array of zeros and a list of operations, for each operation add a value to each of the array element between two given indices, inclusive. Once all operations have been performed, return the maximum value in your array.

For example, the length of your array of zeros . Your list of queries is as follows:

a b k
1 5 3
4 8 7
6 9 1

Add the values of  between the indices  and  inclusive:

index -> 1 2 3  4  5 6 7 8 9 10
        [0,0,0, 0, 0,0,0,0,0, 0]
        [3,3,3, 3, 3,0,0,0,0, 0]
        [3,3,3,10,10,7,7,7,0, 0]
        [3,3,3,10,10,8,8,8,1, 0]

The largest value is  after all operations are performed.

Given below is my method.

 static long arrayManipulation(int n, int[][] queries) {
    long max = 0L;
    long[] arr = new long[n];
    for (int i = 0; i < n; i++) {
        arr[i] = 0L;
    }
    for (int i = 0; i < queries.length; i++) {
        int[] q = queries[i];
        int start = q[0] - 1;
        int end = q[1] - 1;
        int val = q[2];
        long tempMax = updateVal(start, end, val, arr);
        if (tempMax > max) {
           max = tempMax;
        }
    }
    return max;
 }

static long updateVal(int start, int end, int val, long[] arr) {
   long max = 0L;
   for (int i = start; i <= end; i++) {
       arr[i] = arr[i] + val;
       if (arr[i] > max) {
           max = arr[i];
       }
   }
   return max;
}

Given below are few test classes that doesn't work with my code.

Test1 Test2 Test3

Please help me to figure this out. I searched for lots of answers based on java.

But I couldn't understand them.

This is my last resort. Please help.

Updated after Kanahaiya's answer

    static long arrayManipulation(int n, int[][] queries) {
        long max = 0L;
        int a, b, k;
        int[] arr = new int[n + 2];
        for (int i = 0; i < queries.length; i++) {
            a = queries[i][0];
            b = queries[i][1];
            k = queries[i][2];

            for (int j = 0; j < arr.length; j++) {
                if (j >= a) {
                    arr[j] = arr[j] + k;
                }
                if (j > b) {
                    arr[j] = arr[j] - k;
                }
            }
        }
        Arrays.sort(arr);
        max = arr[arr.length - 1];
        return max;
    }

Body:
Brute-force solution is not going to work here due to the given time constraint.
That is the reason you will get the time out error.

So you need to optimize your code which can be done with the help of prefix sum array.

instead of adding k to all the elements within a range from a to b in an array, accumulate the difference array

Whenever we add anything at any index into an array and apply prefix sum algorithm the same element will be added to every element till the end of the array.

ex- n=5, m=1, a=2 b=5 k=5

    i     0.....1.....2.....3.....4.....5.....6   //take array of size N+2 to avoid index out of bound
  A[i]    0     0     0     0     0     0     0

Add k=5 to at a=2

A[a]=A[a]+k  // start index from where k element should be added

     i    0.....1.....2.....3.....4.....5.....6
   A[i]   0     0     5     0     0     0     0

now apply prefix sum algorithm

     i    0.....1.....2.....3.....4.....5.....6
  A[i]    0     0     5     5     5     5     5

so you can see K=5 add to all the element till the end after applying prefix sum but we don't have to add k till the end. so to negate this effect we have to add -K also after b+1 index so that only from [a,b] range only will have K element addition effect.

A[b+1]=A[b]-k  // to remove the effect of previously added k element after bth index.
that's why adding -k in the initial array along with +k.

    i    0.....1.....2.....3.....4.....5.....6
  A[i]   0     0     5     0     0     0    -5

Now apply prefix sum Array

    i    0.....1.....2.....3.....4.....5.....6
  A[i]   0     0     5     5     5     5     0

You can see now K=5 got added from a=2 to b=5 which was expected.
Here we are only updating two indices for every query so complexity will be O(1).

Now apply the same algorithm in the input

         # 0.....1.....2.....3.....4.....5.....6    //taken array of size N+2 to avoid index out of bound
5 3      # 0     0     0     0     0     0     0
1 2 100  # 0    100    0   -100    0     0     0
2 5 100  # 0    100   100  -100    0     0   -100
3 4 100  # 0    100   100    0     0  -100   -100

To calculate the max prefix sum, accumulate the difference array to  while taking the maximum accumulated prefix.

After performing all the operation now apply prefix sum Array

    i      0.....1.....2.....3.....4.....5.....6
  A[i]     0     100   200  200   200   100    0

Now you can traverse this array to find max which is 200.
traversing the array will take O(N) time and updating the two indices for each query will take O(1)* number of queries(m)

overall complexity=O(N)+O(M)
                  = O(N+M)

it means = (10^7+10^5) which is less than 10^8 (per second)

Note: If searching for video tutorial , you must check it out here for detailed explanation.