问:
Issue with Maven Central behind proxy in IntelliJ
IntelliJ has no problem to use Maven Central when VPN is off and "No proxy" is selected.

When connected with VPN and using the company's proxy, Maven Central Archtype list is empty even if proxy test was successful.

idea.log shows the following messages:

```<code>2022-12-19 15:17:44,788 [77795073]   WARN - #o.j.i.maven - Using extension org.jetbrains.idea.maven.maven3.Maven3Support@febaa86 to start MavenServer
2022-12-19 15:17:45,070 [77795355]   INFO - #o.j.i.maven - Sent token to maven server
</code>```

Anyone can help?

I even tried setting VM option in Build tool section (although I think it should be irrelavent) and it was to no avail.

Full log:

```<code>2022-12-20 08:54:25,159 [     19]   INFO - #c.i.i.AppStarter - ------------------------------------------------------ IDE STARTED ------------------------------------------------------
2022-12-20 08:54:25,389 [    249]   INFO - #c.i.i.p.PluginManager - Plugin PluginDescriptor(name=Groovy, id=org.intellij.groovy, descriptorPath=plugin.xml, path=~\Documents\plugins\Groovy, version=223.7571.182, package=org.jetbrains.plugins.groovy, isBundled=true) misses optional descriptor duplicates-groovy.xml
2022-12-20 08:54:25,389 [    249]   INFO - #c.i.i.p.PluginManager - Plugin PluginDescriptor(name=Groovy, id=org.intellij.groovy, descriptorPath=plugin.xml, path=~\Documents\plugins\Groovy, version=223.7571.182, package=org.jetbrains.plugins.groovy, isBundled=true) misses optional descriptor duplicates-detection-groovy.xml
2022-12-20 08:54:25,606 [    466]   INFO - #c.i.i.AppStarter - JNA library (64-bit) loaded in 380 ms
2022-12-20 08:54:25,619 [    479]   INFO - #c.i.i.AppStarter - IDE: IntelliJ IDEA (build #IC-223.7571.182, 29 Nov 2022 10:36)
2022-12-20 08:54:25,620 [    480]   INFO - #c.i.i.AppStarter - OS: Windows 10 (10.0, amd64)
2022-12-20 08:54:25,624 [    484]   INFO - #c.i.i.AppStarter - JRE: 17.0.5+1-b653.14 (JetBrains s.r.o.)
2022-12-20 08:54:25,624 [    484]   INFO - #c.i.i.AppStarter - JVM: 17.0.5+1-b653.14 (OpenJDK 64-Bit Server VM)
2022-12-20 08:54:25,634 [    494]   INFO - #c.i.i.AppStarter - PID: 14532
2022-12-20 08:54:25,734 [    594]   INFO - #c.i.i.p.PluginManager - Plugin PluginDescriptor(name=Kotlin, id=org.jetbrains.kotlin, descriptorPath=plugin.xml, path=~\Documents\plugins\Kotlin, version=223-1.7.20-release-201-IJ7571.182, package=org.jetbrains.kotlin, isBundled=true) misses optional descriptor performance-plugin.xml
2022-12-20 08:54:25,762 [    622]   INFO - #c.i.i.AppStarter - JVM options: [exit, -Xms128m, -Xmx750m, -XX:ReservedCodeCacheSize=512m, -XX:+UseG1GC, -XX:SoftRefLRUPolicyMSPerMB=50, -XX:CICompilerCount=2, -XX:+HeapDumpOnOutOfMemoryError, -XX:-OmitStackTraceInFastThrow, -XX:+IgnoreUnrecognizedVMOptions, -XX:CompileCommand=exclude,com/intellij/openapi/vfs/impl/FilePartNodeRoot,trieDescend, -ea, -Dsun.io.useCanonCaches=false, -Dsun.java2d.metal=true, -Djbr.catch.SIGABRT=true, -Djdk.http.auth.tunneling.disabledSchemes="", -Djdk.attach.allowAttachSelf=true, -Djdk.module.illegalAccess.silent=true, -Dkotlinx.coroutines.debug=off, -Xmx2048m, -Djb.vmOptionsFile=C:\Users\abc\AppData\Roaming\\JetBrains\\IdeaIC2022.3\idea64.exe.vmoptions, -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader, -Didea.vendor.name=JetBrains, -Didea.paths.selector=IdeaIC2022.3, -Djna.boot.library.path=C:\Users\abc\Documents/lib/jna/amd64, -Dpty4j.preferred.native.folder=C:\Users\abc\Documents/lib/pty4j, -Djna.nosys=true, -Djna.nounpack=true, -Didea.platform.prefix=Idea, -Dsplash=true, --add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.lang.ref=ALL-UNNAMED, --add-opens=java.base/java.lang.reflect=ALL-UNNAMED, --add-opens=java.base/java.net=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/java.nio.charset=ALL-UNNAMED, --add-opens=java.base/java.text=ALL-UNNAMED, --add-opens=java.base/java.time=ALL-UNNAMED, --add-opens=java.base/java.util=ALL-UNNAMED, --add-opens=java.base/java.util.concurrent=ALL-UNNAMED, --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED, --add-opens=java.base/jdk.internal.vm=ALL-UNNAMED, --add-opens=java.base/sun.nio.ch=ALL-UNNAMED, --add-opens=java.base/sun.nio.fs=ALL-UNNAMED, --add-opens=java.base/sun.security.ssl=ALL-UNNAMED, --add-opens=java.base/sun.security.util=ALL-UNNAMED, --add-opens=java.desktop/java.awt=ALL-UNNAMED, --add-opens=java.desktop/java.awt.dnd.peer=ALL-UNNAMED, --add-opens=java.desktop/java.awt.event=ALL-UNNAMED, --add-opens=java.desktop/java.awt.image=ALL-UNNAMED, --add-opens=java.desktop/java.awt.peer=ALL-UNNAMED, --add-opens=java.desktop/java.awt.font=ALL-UNNAMED, --add-opens=java.desktop/javax.swing=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.desktop/sun.awt.datatransfer=ALL-UNNAMED, --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED, --add-opens=java.desktop/sun.awt.windows=ALL-UNNAMED, --add-opens=java.desktop/sun.awt=ALL-UNNAMED, --add-opens=java.desktop/sun.font=ALL-UNNAMED, --add-opens=java.desktop/sun.java2d=ALL-UNNAMED, --add-opens=java.desktop/sun.swing=ALL-UNNAMED, --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED, --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED, --add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED, --add-opens=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED, -Dide.native.launcher=true, -XX:ErrorFile=C:\Users\abc\\java_error_in_idea64_%p.log, -XX:HeapDumpPath=C:\Users\abc\\java_error_in_idea64.hprof]
2022-12-20 08:54:25,763 [    623]   INFO - #c.i.i.AppStarter - args:
2022-12-20 08:54:25,764 [    624]   INFO - #c.i.i.AppStarter - library path: C:\Users\abc\Documents\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\windows\CCM\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Adaptiva\AdaptivaClient\bin\x32;C:\Program Files (x86)\Adaptiva\AdaptivaClient\bin\x64;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Git\cmd;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Fortify\Fortify_SCA_and_Apps_20.2.4\bin;C:\Users\abc\AppData\Local\Programs\Python\Launcher\;C:\Fortify\Fortify_SCA_and_Apps_20.2.2\bin;C:\Users\abc\AppData\Local\Microsoft\WindowsApps;C:\Program Files\JetBrains\PyCharm 2020.2.3\bin;;C:\Users\abc\AppData\Local\Programs\MiKTeX\miktex\bin\x64\;C:\Users\abc\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\abc\Documents\apache-maven-3.6.3\bin;C:\Program Files\Java\jdk1.8.0_201\jre\bin;;.
2022-12-20 08:54:25,765 [    625]   INFO - #c.i.i.AppStarter - boot library path: C:\Users\abc\Documents\jbr\bin
2022-12-20 08:54:25,824 [    684]   INFO - #c.i.i.AppStarter - locale=en_CA JNU=Cp1252 file.encoding=Cp1252
  idea.config.path=C:\Users\abc\AppData\Roaming\JetBrains\IdeaIC2022.3
  idea.system.path=C:\Users\abc\AppData\Local\JetBrains\IdeaIC2022.3
  idea.plugins.path=C:\Users\abc\AppData\Roaming\JetBrains\IdeaIC2022.3\plugins
  idea.log.path=C:\Users\abc\AppData\Local\JetBrains\IdeaIC2022.3\log
2022-12-20 08:54:25,834 [    694]   INFO - #c.i.i.AppStarter - CPU cores: 4; ForkJoinPool.commonPool: java.util.concurrent.ForkJoinPool@6da75138[Running, parallelism = 3, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]; factory: com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory@1260f2bf
2022-12-20 08:54:26,054 [    914]   INFO - #c.i.i.p.PluginManager - Module intellij.sh.python is not enabled because dependency com.intellij.modules.python is not available
Module intellij.space.gateway is not enabled because dependency com.jetbrains.gateway is not available
Module intellij.space.php is not enabled because dependency com.jetbrains.php is not available
Module intellij.space.index is not enabled because dependency intellij.indexing.shared is not available
2022-12-20 08:54:26,501 [   1361]   INFO - #c.i.i.p.PluginManager - Loaded bundled plugins: Eclipse Keymap (223.7571.182), NetBeans Keymap (223.7571.182), Shell Script (223.7571.182), Mercurial (223.7571.182), Copyright (223.7571.182), Smali Support (223.7571.182), IntelliLang (223.7571.182), Gradle (223.7571.182), Markdown (223.7571.182), com.intellij.dev (223.7571.182), XSLT Debugger (223.7571.182), XPathView + XSLT (223.7571.182), Subversion (223.7571.182), Gradle DSL API (223.7571.182), Android Design Tools (223.7571.182), Machine Learning in Search Everywhere (223.7571.182), YAML (223.7571.182), Package Search (223.7571.182), JetBrains Marketplace Licensing Support (223.7571.182), Code With Me (223.7571.182), JavaFX (223.7571.182), GitHub (223.7571.182), Bytecode Viewer (223.7571.182), JetBrains Repository Search (223.7571.182), Grazie (223.7571.182), Visual Studio Keymap (223.7571.182), Ant (223.7571.182), IDEA CORE (223.7571.182), Projector Libraries for Code With Me and Remote Development (223.7571.182), Gradle-Maven (223.7571.182), Plugin DevKit (223.7571.182), Java IDE Customization (223.7571.182), Configuration Script (223.7571.182), Toml (223.7571.182), Java Internationalization (223.7571.182), Machine Learning Code Completion (223.7571.182), Java Bytecode Decompiler (223.7571.182), Properties (223.7571.182), Git (223.7571.182), Kotlin (223-1.7.20-release-201-IJ7571.182), WebP Support (223.7571.182), Groovy (223.7571.182), Maven (223.7571.182), Eclipse Interoperability (223.7571.182), Task Management (223.7571.182), TextMate Bundles (223.7571.182), Android (2022.1.1 Beta 2.223.7571.182), Java (223.7571.182), Space (223.7571.182), Gradle-Java (223.7571.182), UI Designer (223.7571.182), Java Stream Debugger (223.7571.182), Lombok (223.7571.182), Maven server api classes (223.7571.182), Qodana (223.7571.182), Terminal (223.7571.182), Shared Indexes (223.7571.182), Settings Sync (223.7571.182), Code Coverage for Java (223.7571.182), JUnit (223.7571.182), JetBrains maven model api classes (223.7571.182), Gradle Dependency Updater Implementation (223.7571.182), EditorConfig (223.7571.182), IDE Features Trainer (223.7571.182), Perforce Helix Core (223.7571.182), Windows 10 Light Theme (223.7571.182), com.intellij.tracing.ide (223.7571.182), Images (223.7571.182), TestNG (223.7571.182)
2022-12-20 08:54:27,454 [   2314]   INFO - #c.i.a.o.PathMacrosImpl - Loaded path macros: {MAVEN_REPOSITORY=C:\Users\abc\.m2\repository}
2022-12-20 08:54:27,455 [   2315]   INFO - #c.i.o.v.n.p.PersistentFSConnector - VFS uses strict names enumerator
2022-12-20 08:54:27,776 [   2636]   INFO - #c.i.o.v.n.p.PersistentFSConnector - VFS uses regular attributes storage
2022-12-20 08:54:28,059 [   2919]   INFO - #c.i.o.v.n.p.FSRecords - using REGULAR storage for VFS records
2022-12-20 08:54:28,389 [   3249]   INFO - #c.i.o.v.n.p.PersistentFSConnector - 310 ms to load free records and inverted name index
2022-12-20 08:54:28,613 [   3473]   INFO - #com.android.tools.idea.serverflags.ServerFlagInitializer - Enabled server flags:
2022-12-20 08:54:28,637 [   3497]   INFO - #c.i.i.p.ExpiredPluginsState - Plugins to skip: []
2022-12-20 08:54:28,756 [   3616]   INFO - #c.i.u.n.s.CertificateManager - Default SSL context initialized
2022-12-20 08:54:29,023 [   3883]   INFO - #o.j.i.BuiltInServerManager - built-in server started, port 63342
2022-12-20 08:54:29,424 [   4284]   INFO - #c.i.o.v.i.l.NativeFileWatcherImpl - Starting file watcher: C:\Users\abc\Documents\bin\fsnotifier.exe
2022-12-20 08:54:29,713 [   4573]   WARN - #c.i.u.s.SvgCacheManager - Icon cache will be recreated or previous version of data reused, (db=C:\Users\abc\AppData\Local\JetBrains\IdeaIC2022.3\icons-v6.db)
2022-12-20 08:54:31,180 [   6040]   INFO - #c.i.i.s.p.i.SharedIndexMainZipStorage - Shared Indexes Storage is opened and empty
2022-12-20 08:54:31,216 [   6076]   INFO - #c.i.o.v.i.l.NativeFileWatcherImpl - Native file watcher is operational.
2022-12-20 08:54:31,467 [   6327]   INFO - #c.i.o.v.i.w.WslFileWatcher - WSL file watcher: C:\Users\abc\Documents\bin\fsnotifier-wsl
2022-12-20 08:54:33,902 [   8762]   INFO - #c.i.o.u.i.UpdateCheckerService - channel: release
2022-12-20 08:54:37,038 [  11898]   INFO - #c.i.u.i.FileBasedIndexImpl - Indices to be built:FilenameIndex(v = 258)
2022-12-20 08:54:37,067 [  11927]   INFO - c.i.u.i.FileBasedIndexDataInitialization - Index data initialization done: 7459 ms. Initialized indexes: [FilenameIndex, TodoIndex, FrameworkDetectionIndex, filetypes, IdIndex, Trigram.Index, fileIncludes, DomFileIndex, RelaxSymbolIndex, Stubs, XmlTagNames, XmlNamespaces, SchemaTypeInheritance, html5.custom.attributes.index, yaml.keys.name, json.file.root.values, editorconfig.index.name, xmlProperties, XsltSymbolIndex, java.auto.module.name, bytecodeAnalysis, java.source.module.name, java.null.method.argument, java.fun.expression, java.binary.plus.expression, IdeaPluginRegistrationIndex, PluginIdDependenciesIndex, PluginIdModuleIndex, devkit.ExtensionPointClassIndex, devkit.ExtensionPointIndex, LombokConfigIndex, JavaFxControllerClassIndex, ant-imports, javafx.id.name, javafx.custom.component, org.jetbrains.kotlin.idea.versions.KotlinJvmMetadataVersionIndex, org.jetbrains.kotlin.idea.versions.KotlinJsMetadataVersionIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinPartialPackageNamesIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinClassFileIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinJavaScriptMetaFileIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinMetadataFileIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinMetadataFilePackageIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinModuleMappingIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinJvmModuleAnnotationsIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinBuiltInsMetadataIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinPackageSourcesMemberNamesIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinStdlibIndex, com.intellij.uiDesigner.FormClassIndex, org.jetbrains.kotlin.idea.vfilefinder.KlibMetaFileIndex, BindingXmlIndex, com.android.tools.idea.model.AndroidManifestIndex$Companion$NAME$1.NAME, NavXmlIndex].
2022-12-20 08:54:39,305 [  14165]   INFO - c.i.p.s.StubIndexImpl$StubIndexInitialization - Index data initialization done: 2237 ms. Initialized stub indexes: {gr.annot.members, org.jetbrains.kotlin.idea.stubindex.KotlinProbablyContractedFunctionShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinSuperClassIndex, org.jetbrains.kotlin.idea.stubindex.KotlinFullClassNameIndex, dom.namespaceKey, org.jetbrains.kotlin.idea.stubindex.KotlinProbablyNothingPropertyShortNameIndex, markdown.header.anchor, org.jetbrains.kotlin.idea.stubindex.KotlinScriptFqnIndex, java.anonymous.baseref, org.jetbrains.kotlin.idea.stubindex.KotlinInnerTypeAliasClassIdIndex, org.jetbrains.kotlin.idea.stubindex.KotlinJvmNameAnnotationIndex, org.jetbrains.kotlin.idea.stubindex.KotlinOverridableInternalMembersShortNameIndex, java.class.extlist, gr.script.fqn, org.jetbrains.kotlin.idea.stubindex.KotlinFileFacadeFqNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionByPackageIndex, org.jetbrains.kotlin.idea.stubindex.KotlinClassShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinMultifileClassPartIndex, markdown.header, org.jetbrains.kotlin.idea.stubindex.KotlinTypeAliasByExpansionShortNameIndex, gr.class.super, java.field.name, java.class.fqn, jvm.static.member.name, org.jetbrains.kotlin.idea.stubindex.KotlinFileFacadeShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinFilePartClassIndex, java.module.name, gr.annot.method.name, org.jetbrains.kotlin.idea.stubindex.KotlinProbablyNothingFunctionShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinFileFacadeClassByPackageIndex, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelPropertyByPackageIndex, org.jetbrains.kotlin.idea.stubindex.KotlinAnnotationsIndex, gr.anonymous.class, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionFqnNameIndex, dom.elementClass, gr.class.fqn, org.jetbrains.kotlin.idea.stubindex.KotlinFunctionShortNameIndex, kotlin.primeIndexKey, org.jetbrains.kotlin.idea.stubindex.KotlinExactPackagesIndex, gr.script.class, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelExtensionsByReceiverTypeIndex, gr.field.name, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelPropertyFqnNameIndex, java.method.name, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelTypeAliasByPackageIndex, java.class.shortname, org.jetbrains.kotlin.idea.stubindex.KotlinTypeAliasShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinExtensionsInObjectsByReceiverTypeIndex, gr.method.name, org.jetbrains.kotlin.idea.stubindex.KotlinSubclassObjectNameIndex, properties.index, java.annotations, jvm.static.member.type, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelClassByPackageIndex, org.jetbrains.kotlin.idea.stubindex.KotlinPropertyShortNameIndex, java.method.parameter.types, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelTypeAliasFqNameIndex}.
2022-12-20 08:55:03,873 [  38733]   INFO - #c.j.r.f.FollowMeManager - Register new user 0:'abc' with ClientId=ClientId(value=Host)
2022-12-20 08:55:05,229 [  40089]   INFO - #c.i.o.a.Experiments - Experimental features enabled for user: wsl.p9.support, wsl.prefer.p9.support, wsl.p9.show.roots.in.file.chooser, wsl.execute.with.wsl.exe, linux.native.menu, recent.and.edited.files.together, show.create.new.element.in.popup, search.everywhere.mixed.results, new.project.wizard, editor.reader.mode, new.large.text.file.viewer, terminal.shell.command.handling
2022-12-20 08:55:13,036 [  47896]   WARN - #o.j.i.maven - Using extension org.jetbrains.idea.maven.maven3.Maven3Support@7f50729b to start MavenServer
2022-12-20 08:55:13,547 [  48407]   INFO - #o.j.i.maven - Sent token to maven server
</code>```

Body:
IntelliJ has no problem to use Maven Central when VPN is off and "No proxy" is selected.

When connected with VPN and using the company's proxy, Maven Central Archtype list is empty even if proxy test was successful.

idea.log shows the following messages:

2022-12-19 15:17:44,788 [77795073]   WARN - #o.j.i.maven - Using extension org.jetbrains.idea.maven.maven3.Maven3Support@febaa86 to start MavenServer
2022-12-19 15:17:45,070 [77795355]   INFO - #o.j.i.maven - Sent token to maven server

Anyone can help?

I even tried setting VM option in Build tool section (although I think it should be irrelavent) and it was to no avail.

Full log:

2022-12-20 08:54:25,159 [     19]   INFO - #c.i.i.AppStarter - ------------------------------------------------------ IDE STARTED ------------------------------------------------------
2022-12-20 08:54:25,389 [    249]   INFO - #c.i.i.p.PluginManager - Plugin PluginDescriptor(name=Groovy, id=org.intellij.groovy, descriptorPath=plugin.xml, path=~\Documents\plugins\Groovy, version=223.7571.182, package=org.jetbrains.plugins.groovy, isBundled=true) misses optional descriptor duplicates-groovy.xml
2022-12-20 08:54:25,389 [    249]   INFO - #c.i.i.p.PluginManager - Plugin PluginDescriptor(name=Groovy, id=org.intellij.groovy, descriptorPath=plugin.xml, path=~\Documents\plugins\Groovy, version=223.7571.182, package=org.jetbrains.plugins.groovy, isBundled=true) misses optional descriptor duplicates-detection-groovy.xml
2022-12-20 08:54:25,606 [    466]   INFO - #c.i.i.AppStarter - JNA library (64-bit) loaded in 380 ms
2022-12-20 08:54:25,619 [    479]   INFO - #c.i.i.AppStarter - IDE: IntelliJ IDEA (build #IC-223.7571.182, 29 Nov 2022 10:36)
2022-12-20 08:54:25,620 [    480]   INFO - #c.i.i.AppStarter - OS: Windows 10 (10.0, amd64)
2022-12-20 08:54:25,624 [    484]   INFO - #c.i.i.AppStarter - JRE: 17.0.5+1-b653.14 (JetBrains s.r.o.)
2022-12-20 08:54:25,624 [    484]   INFO - #c.i.i.AppStarter - JVM: 17.0.5+1-b653.14 (OpenJDK 64-Bit Server VM)
2022-12-20 08:54:25,634 [    494]   INFO - #c.i.i.AppStarter - PID: 14532
2022-12-20 08:54:25,734 [    594]   INFO - #c.i.i.p.PluginManager - Plugin PluginDescriptor(name=Kotlin, id=org.jetbrains.kotlin, descriptorPath=plugin.xml, path=~\Documents\plugins\Kotlin, version=223-1.7.20-release-201-IJ7571.182, package=org.jetbrains.kotlin, isBundled=true) misses optional descriptor performance-plugin.xml
2022-12-20 08:54:25,762 [    622]   INFO - #c.i.i.AppStarter - JVM options: [exit, -Xms128m, -Xmx750m, -XX:ReservedCodeCacheSize=512m, -XX:+UseG1GC, -XX:SoftRefLRUPolicyMSPerMB=50, -XX:CICompilerCount=2, -XX:+HeapDumpOnOutOfMemoryError, -XX:-OmitStackTraceInFastThrow, -XX:+IgnoreUnrecognizedVMOptions, -XX:CompileCommand=exclude,com/intellij/openapi/vfs/impl/FilePartNodeRoot,trieDescend, -ea, -Dsun.io.useCanonCaches=false, -Dsun.java2d.metal=true, -Djbr.catch.SIGABRT=true, -Djdk.http.auth.tunneling.disabledSchemes="", -Djdk.attach.allowAttachSelf=true, -Djdk.module.illegalAccess.silent=true, -Dkotlinx.coroutines.debug=off, -Xmx2048m, -Djb.vmOptionsFile=C:\Users\abc\AppData\Roaming\\JetBrains\\IdeaIC2022.3\idea64.exe.vmoptions, -Djava.system.class.loader=com.intellij.util.lang.PathClassLoader, -Didea.vendor.name=JetBrains, -Didea.paths.selector=IdeaIC2022.3, -Djna.boot.library.path=C:\Users\abc\Documents/lib/jna/amd64, -Dpty4j.preferred.native.folder=C:\Users\abc\Documents/lib/pty4j, -Djna.nosys=true, -Djna.nounpack=true, -Didea.platform.prefix=Idea, -Dsplash=true, --add-opens=java.base/java.io=ALL-UNNAMED, --add-opens=java.base/java.lang=ALL-UNNAMED, --add-opens=java.base/java.lang.ref=ALL-UNNAMED, --add-opens=java.base/java.lang.reflect=ALL-UNNAMED, --add-opens=java.base/java.net=ALL-UNNAMED, --add-opens=java.base/java.nio=ALL-UNNAMED, --add-opens=java.base/java.nio.charset=ALL-UNNAMED, --add-opens=java.base/java.text=ALL-UNNAMED, --add-opens=java.base/java.time=ALL-UNNAMED, --add-opens=java.base/java.util=ALL-UNNAMED, --add-opens=java.base/java.util.concurrent=ALL-UNNAMED, --add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED, --add-opens=java.base/jdk.internal.vm=ALL-UNNAMED, --add-opens=java.base/sun.nio.ch=ALL-UNNAMED, --add-opens=java.base/sun.nio.fs=ALL-UNNAMED, --add-opens=java.base/sun.security.ssl=ALL-UNNAMED, --add-opens=java.base/sun.security.util=ALL-UNNAMED, --add-opens=java.desktop/java.awt=ALL-UNNAMED, --add-opens=java.desktop/java.awt.dnd.peer=ALL-UNNAMED, --add-opens=java.desktop/java.awt.event=ALL-UNNAMED, --add-opens=java.desktop/java.awt.image=ALL-UNNAMED, --add-opens=java.desktop/java.awt.peer=ALL-UNNAMED, --add-opens=java.desktop/java.awt.font=ALL-UNNAMED, --add-opens=java.desktop/javax.swing=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.plaf.basic=ALL-UNNAMED, --add-opens=java.desktop/javax.swing.text.html=ALL-UNNAMED, --add-opens=java.desktop/sun.awt.datatransfer=ALL-UNNAMED, --add-opens=java.desktop/sun.awt.image=ALL-UNNAMED, --add-opens=java.desktop/sun.awt.windows=ALL-UNNAMED, --add-opens=java.desktop/sun.awt=ALL-UNNAMED, --add-opens=java.desktop/sun.font=ALL-UNNAMED, --add-opens=java.desktop/sun.java2d=ALL-UNNAMED, --add-opens=java.desktop/sun.swing=ALL-UNNAMED, --add-opens=jdk.attach/sun.tools.attach=ALL-UNNAMED, --add-opens=jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED, --add-opens=jdk.internal.jvmstat/sun.jvmstat.monitor=ALL-UNNAMED, --add-opens=jdk.jdi/com.sun.tools.jdi=ALL-UNNAMED, -Dide.native.launcher=true, -XX:ErrorFile=C:\Users\abc\\java_error_in_idea64_%p.log, -XX:HeapDumpPath=C:\Users\abc\\java_error_in_idea64.hprof]
2022-12-20 08:54:25,763 [    623]   INFO - #c.i.i.AppStarter - args:
2022-12-20 08:54:25,764 [    624]   INFO - #c.i.i.AppStarter - library path: C:\Users\abc\Documents\bin;C:\WINDOWS\Sun\Java\bin;C:\WINDOWS\system32;C:\WINDOWS;C:\windows\CCM\;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\windows\system32;C:\windows;C:\windows\System32\Wbem;C:\windows\System32\WindowsPowerShell\v1.0\;C:\windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\windows\system32\config\systemprofile\AppData\Local\Microsoft\WindowsApps;C:\Program Files (x86)\Adaptiva\AdaptivaClient\bin\x32;C:\Program Files (x86)\Adaptiva\AdaptivaClient\bin\x64;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Git\cmd;C:\Program Files\Docker\Docker\resources\bin;C:\ProgramData\DockerDesktop\version-bin;C:\Fortify\Fortify_SCA_and_Apps_20.2.4\bin;C:\Users\abc\AppData\Local\Programs\Python\Launcher\;C:\Fortify\Fortify_SCA_and_Apps_20.2.2\bin;C:\Users\abc\AppData\Local\Microsoft\WindowsApps;C:\Program Files\JetBrains\PyCharm 2020.2.3\bin;;C:\Users\abc\AppData\Local\Programs\MiKTeX\miktex\bin\x64\;C:\Users\abc\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\abc\Documents\apache-maven-3.6.3\bin;C:\Program Files\Java\jdk1.8.0_201\jre\bin;;.
2022-12-20 08:54:25,765 [    625]   INFO - #c.i.i.AppStarter - boot library path: C:\Users\abc\Documents\jbr\bin
2022-12-20 08:54:25,824 [    684]   INFO - #c.i.i.AppStarter - locale=en_CA JNU=Cp1252 file.encoding=Cp1252
  idea.config.path=C:\Users\abc\AppData\Roaming\JetBrains\IdeaIC2022.3
  idea.system.path=C:\Users\abc\AppData\Local\JetBrains\IdeaIC2022.3
  idea.plugins.path=C:\Users\abc\AppData\Roaming\JetBrains\IdeaIC2022.3\plugins
  idea.log.path=C:\Users\abc\AppData\Local\JetBrains\IdeaIC2022.3\log
2022-12-20 08:54:25,834 [    694]   INFO - #c.i.i.AppStarter - CPU cores: 4; ForkJoinPool.commonPool: java.util.concurrent.ForkJoinPool@6da75138[Running, parallelism = 3, size = 0, active = 0, running = 0, steals = 0, tasks = 0, submissions = 0]; factory: com.intellij.concurrency.IdeaForkJoinWorkerThreadFactory@1260f2bf
2022-12-20 08:54:26,054 [    914]   INFO - #c.i.i.p.PluginManager - Module intellij.sh.python is not enabled because dependency com.intellij.modules.python is not available
Module intellij.space.gateway is not enabled because dependency com.jetbrains.gateway is not available
Module intellij.space.php is not enabled because dependency com.jetbrains.php is not available
Module intellij.space.index is not enabled because dependency intellij.indexing.shared is not available
2022-12-20 08:54:26,501 [   1361]   INFO - #c.i.i.p.PluginManager - Loaded bundled plugins: Eclipse Keymap (223.7571.182), NetBeans Keymap (223.7571.182), Shell Script (223.7571.182), Mercurial (223.7571.182), Copyright (223.7571.182), Smali Support (223.7571.182), IntelliLang (223.7571.182), Gradle (223.7571.182), Markdown (223.7571.182), com.intellij.dev (223.7571.182), XSLT Debugger (223.7571.182), XPathView + XSLT (223.7571.182), Subversion (223.7571.182), Gradle DSL API (223.7571.182), Android Design Tools (223.7571.182), Machine Learning in Search Everywhere (223.7571.182), YAML (223.7571.182), Package Search (223.7571.182), JetBrains Marketplace Licensing Support (223.7571.182), Code With Me (223.7571.182), JavaFX (223.7571.182), GitHub (223.7571.182), Bytecode Viewer (223.7571.182), JetBrains Repository Search (223.7571.182), Grazie (223.7571.182), Visual Studio Keymap (223.7571.182), Ant (223.7571.182), IDEA CORE (223.7571.182), Projector Libraries for Code With Me and Remote Development (223.7571.182), Gradle-Maven (223.7571.182), Plugin DevKit (223.7571.182), Java IDE Customization (223.7571.182), Configuration Script (223.7571.182), Toml (223.7571.182), Java Internationalization (223.7571.182), Machine Learning Code Completion (223.7571.182), Java Bytecode Decompiler (223.7571.182), Properties (223.7571.182), Git (223.7571.182), Kotlin (223-1.7.20-release-201-IJ7571.182), WebP Support (223.7571.182), Groovy (223.7571.182), Maven (223.7571.182), Eclipse Interoperability (223.7571.182), Task Management (223.7571.182), TextMate Bundles (223.7571.182), Android (2022.1.1 Beta 2.223.7571.182), Java (223.7571.182), Space (223.7571.182), Gradle-Java (223.7571.182), UI Designer (223.7571.182), Java Stream Debugger (223.7571.182), Lombok (223.7571.182), Maven server api classes (223.7571.182), Qodana (223.7571.182), Terminal (223.7571.182), Shared Indexes (223.7571.182), Settings Sync (223.7571.182), Code Coverage for Java (223.7571.182), JUnit (223.7571.182), JetBrains maven model api classes (223.7571.182), Gradle Dependency Updater Implementation (223.7571.182), EditorConfig (223.7571.182), IDE Features Trainer (223.7571.182), Perforce Helix Core (223.7571.182), Windows 10 Light Theme (223.7571.182), com.intellij.tracing.ide (223.7571.182), Images (223.7571.182), TestNG (223.7571.182)
2022-12-20 08:54:27,454 [   2314]   INFO - #c.i.a.o.PathMacrosImpl - Loaded path macros: {MAVEN_REPOSITORY=C:\Users\abc\.m2\repository}
2022-12-20 08:54:27,455 [   2315]   INFO - #c.i.o.v.n.p.PersistentFSConnector - VFS uses strict names enumerator
2022-12-20 08:54:27,776 [   2636]   INFO - #c.i.o.v.n.p.PersistentFSConnector - VFS uses regular attributes storage
2022-12-20 08:54:28,059 [   2919]   INFO - #c.i.o.v.n.p.FSRecords - using REGULAR storage for VFS records
2022-12-20 08:54:28,389 [   3249]   INFO - #c.i.o.v.n.p.PersistentFSConnector - 310 ms to load free records and inverted name index
2022-12-20 08:54:28,613 [   3473]   INFO - #com.android.tools.idea.serverflags.ServerFlagInitializer - Enabled server flags:
2022-12-20 08:54:28,637 [   3497]   INFO - #c.i.i.p.ExpiredPluginsState - Plugins to skip: []
2022-12-20 08:54:28,756 [   3616]   INFO - #c.i.u.n.s.CertificateManager - Default SSL context initialized
2022-12-20 08:54:29,023 [   3883]   INFO - #o.j.i.BuiltInServerManager - built-in server started, port 63342
2022-12-20 08:54:29,424 [   4284]   INFO - #c.i.o.v.i.l.NativeFileWatcherImpl - Starting file watcher: C:\Users\abc\Documents\bin\fsnotifier.exe
2022-12-20 08:54:29,713 [   4573]   WARN - #c.i.u.s.SvgCacheManager - Icon cache will be recreated or previous version of data reused, (db=C:\Users\abc\AppData\Local\JetBrains\IdeaIC2022.3\icons-v6.db)
2022-12-20 08:54:31,180 [   6040]   INFO - #c.i.i.s.p.i.SharedIndexMainZipStorage - Shared Indexes Storage is opened and empty
2022-12-20 08:54:31,216 [   6076]   INFO - #c.i.o.v.i.l.NativeFileWatcherImpl - Native file watcher is operational.
2022-12-20 08:54:31,467 [   6327]   INFO - #c.i.o.v.i.w.WslFileWatcher - WSL file watcher: C:\Users\abc\Documents\bin\fsnotifier-wsl
2022-12-20 08:54:33,902 [   8762]   INFO - #c.i.o.u.i.UpdateCheckerService - channel: release
2022-12-20 08:54:37,038 [  11898]   INFO - #c.i.u.i.FileBasedIndexImpl - Indices to be built:FilenameIndex(v = 258)
2022-12-20 08:54:37,067 [  11927]   INFO - c.i.u.i.FileBasedIndexDataInitialization - Index data initialization done: 7459 ms. Initialized indexes: [FilenameIndex, TodoIndex, FrameworkDetectionIndex, filetypes, IdIndex, Trigram.Index, fileIncludes, DomFileIndex, RelaxSymbolIndex, Stubs, XmlTagNames, XmlNamespaces, SchemaTypeInheritance, html5.custom.attributes.index, yaml.keys.name, json.file.root.values, editorconfig.index.name, xmlProperties, XsltSymbolIndex, java.auto.module.name, bytecodeAnalysis, java.source.module.name, java.null.method.argument, java.fun.expression, java.binary.plus.expression, IdeaPluginRegistrationIndex, PluginIdDependenciesIndex, PluginIdModuleIndex, devkit.ExtensionPointClassIndex, devkit.ExtensionPointIndex, LombokConfigIndex, JavaFxControllerClassIndex, ant-imports, javafx.id.name, javafx.custom.component, org.jetbrains.kotlin.idea.versions.KotlinJvmMetadataVersionIndex, org.jetbrains.kotlin.idea.versions.KotlinJsMetadataVersionIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinPartialPackageNamesIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinClassFileIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinJavaScriptMetaFileIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinMetadataFileIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinMetadataFilePackageIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinModuleMappingIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinJvmModuleAnnotationsIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinBuiltInsMetadataIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinPackageSourcesMemberNamesIndex, org.jetbrains.kotlin.idea.vfilefinder.KotlinStdlibIndex, com.intellij.uiDesigner.FormClassIndex, org.jetbrains.kotlin.idea.vfilefinder.KlibMetaFileIndex, BindingXmlIndex, com.android.tools.idea.model.AndroidManifestIndex$Companion$NAME$1.NAME, NavXmlIndex].
2022-12-20 08:54:39,305 [  14165]   INFO - c.i.p.s.StubIndexImpl$StubIndexInitialization - Index data initialization done: 2237 ms. Initialized stub indexes: {gr.annot.members, org.jetbrains.kotlin.idea.stubindex.KotlinProbablyContractedFunctionShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinSuperClassIndex, org.jetbrains.kotlin.idea.stubindex.KotlinFullClassNameIndex, dom.namespaceKey, org.jetbrains.kotlin.idea.stubindex.KotlinProbablyNothingPropertyShortNameIndex, markdown.header.anchor, org.jetbrains.kotlin.idea.stubindex.KotlinScriptFqnIndex, java.anonymous.baseref, org.jetbrains.kotlin.idea.stubindex.KotlinInnerTypeAliasClassIdIndex, org.jetbrains.kotlin.idea.stubindex.KotlinJvmNameAnnotationIndex, org.jetbrains.kotlin.idea.stubindex.KotlinOverridableInternalMembersShortNameIndex, java.class.extlist, gr.script.fqn, org.jetbrains.kotlin.idea.stubindex.KotlinFileFacadeFqNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionByPackageIndex, org.jetbrains.kotlin.idea.stubindex.KotlinClassShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinMultifileClassPartIndex, markdown.header, org.jetbrains.kotlin.idea.stubindex.KotlinTypeAliasByExpansionShortNameIndex, gr.class.super, java.field.name, java.class.fqn, jvm.static.member.name, org.jetbrains.kotlin.idea.stubindex.KotlinFileFacadeShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinFilePartClassIndex, java.module.name, gr.annot.method.name, org.jetbrains.kotlin.idea.stubindex.KotlinProbablyNothingFunctionShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinFileFacadeClassByPackageIndex, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelPropertyByPackageIndex, org.jetbrains.kotlin.idea.stubindex.KotlinAnnotationsIndex, gr.anonymous.class, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelFunctionFqnNameIndex, dom.elementClass, gr.class.fqn, org.jetbrains.kotlin.idea.stubindex.KotlinFunctionShortNameIndex, kotlin.primeIndexKey, org.jetbrains.kotlin.idea.stubindex.KotlinExactPackagesIndex, gr.script.class, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelExtensionsByReceiverTypeIndex, gr.field.name, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelPropertyFqnNameIndex, java.method.name, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelTypeAliasByPackageIndex, java.class.shortname, org.jetbrains.kotlin.idea.stubindex.KotlinTypeAliasShortNameIndex, org.jetbrains.kotlin.idea.stubindex.KotlinExtensionsInObjectsByReceiverTypeIndex, gr.method.name, org.jetbrains.kotlin.idea.stubindex.KotlinSubclassObjectNameIndex, properties.index, java.annotations, jvm.static.member.type, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelClassByPackageIndex, org.jetbrains.kotlin.idea.stubindex.KotlinPropertyShortNameIndex, java.method.parameter.types, org.jetbrains.kotlin.idea.stubindex.KotlinTopLevelTypeAliasFqNameIndex}.
2022-12-20 08:55:03,873 [  38733]   INFO - #c.j.r.f.FollowMeManager - Register new user 0:'abc' with ClientId=ClientId(value=Host)
2022-12-20 08:55:05,229 [  40089]   INFO - #c.i.o.a.Experiments - Experimental features enabled for user: wsl.p9.support, wsl.prefer.p9.support, wsl.p9.show.roots.in.file.chooser, wsl.execute.with.wsl.exe, linux.native.menu, recent.and.edited.files.together, show.create.new.element.in.popup, search.everywhere.mixed.results, new.project.wizard, editor.reader.mode, new.large.text.file.viewer, terminal.shell.command.handling
2022-12-20 08:55:13,036 [  47896]   WARN - #o.j.i.maven - Using extension org.jetbrains.idea.maven.maven3.Maven3Support@7f50729b to start MavenServer
2022-12-20 08:55:13,547 [  48407]   INFO - #o.j.i.maven - Sent token to maven server


来源: stackexchange

问:
Can't Pass Messages with Servo/Ipc_channel for Rust
I'm stuck on implementing Servo/ipc_channel. I'm looking for a trivial example to do the following. I've read through all the documentation and I just can't find an example that makes sense to me either from the docs or from the test.rs.

Here's what I want to do in pseudocode -

I have a cargo crate that acts as a main process that creates a spawned process.

The main process would look like this -

```<code>let servername = CREATESERVER();
let (sender, receiver) = GETSERVER(servername);
let message = <Some message>
sender(<Send message>)
SPAWNSERVER(servername)
loop{
print(receiver)
}
</code>```

The spawned process should look like this -

```<code>let (sender, receiver) = GETSERVER(servernamefrommainprocess)
let messagespawn = <Some message in spawn process>
sender(messagespawn)
loop{
print(receiver)
}
</code>```

The issue is that IpcSender can connect to a server by name, but IpcReceiver can't, so I don't know how to receive messages from an IpcOneShotServer. The examples are wrapping IpcSenders within other channels in a way I don't understand.

Here's what I have for a trivial working repo, which is close to what I want and should give you an idea of what I'm looking to do.

ContentLicense: CC BY-SA 4.0

Body:
I'm stuck on implementing Servo/ipc_channel. I'm looking for a trivial example to do the following. I've read through all the documentation and I just can't find an example that makes sense to me either from the docs or from the test.rs.

Here's what I want to do in pseudocode -

I have a cargo crate that acts as a main process that creates a spawned process.

The main process would look like this -

let servername = CREATESERVER();
let (sender, receiver) = GETSERVER(servername);
let message = <Some message>
sender(<Send message>)
SPAWNSERVER(servername)
loop{
print(receiver)
}

The spawned process should look like this -

let (sender, receiver) = GETSERVER(servernamefrommainprocess)
let messagespawn = <Some message in spawn process>
sender(messagespawn)
loop{
print(receiver)
}

The issue is that IpcSender can connect to a server by name, but IpcReceiver can't, so I don't know how to receive messages from an IpcOneShotServer. The examples are wrapping IpcSenders within other channels in a way I don't understand.

Here's what I have for a trivial working repo, which is close to what I want and should give you an idea of what I'm looking to do.


问:
How to create a gutter for obsidian codeblocks?
Please don't be angry, I don't know what I am doing. My end goal is to create a simple plugin for Obsidian which adds line numbering to codeblocks in the editor/live-preview mode, and I can highlight specific lines. As far as I know Obsidian uses CodeMirror editor. I also found that there is theoretically a simple way to add a gutter as described here: https://codemirror.net/examples/gutter/ but I couldn't make it work. The below code does work (sort of...). It does add line numbering, but the text which the codeblocks contains disappears. I would really appreciate if someone could provide a simple example, or correct my code, or point me in the right direction.

My code so far:

class EmojiListPlugin implements PluginValue {
  decorations: DecorationSet;

  constructor(view: EditorView) {
    this.decorations = this.buildDecorations(view);
  }

  update(update: ViewUpdate) {
    if (update.docChanged || update.viewportChanged) {
      this.decorations = this.buildDecorations(update.view);
    }
  }

  destroy() {}

  buildDecorations(view: EditorView): DecorationSet {
    const builder = new RangeSetBuilder<Decoration>();
    let lineNumber = 1;

    for (let { from, to } of view.visibleRanges) {
      syntaxTree(view.state).iterate({ from, to, enter(node) {
          console.log("+++ node enter");
          if (node.type.id === 3 ) {
            // opening ```
          }
          if (node.type.id === 5 ) {
            builder.add(
              node.from,
              node.to,
              Decoration.replace({
                widget: new LineNumberingWidget(lineNumber ),
              })
            );
            lineNumber++;
          }
          if (node.type.id === 6 ) {
            // closing ```
            lineNumber = 1;
          }
        },
        leave(node)
        {
         // console.log("--- node exit");
        },
      });
    }
    return builder.finish();
  }// buildDecorations
}// EmojiListPlugin

const pluginSpec: PluginSpec<EmojiListPlugin> = {
  decorations: (value: EmojiListPlugin) => value.decorations,
  widget: (value: EmojiListPlugin) => new LineNumberingWidget(value.lineNumber),
};

class LineNumberingWidget extends WidgetType {
  lineNumber: number;
  constructor(lineNumber: number ) {
    super();
    this.lineNumber = lineNumber;
  }

  toDOM(view: EditorView): HTMLElement {
    // create an element for the line number
    const lineNumberElement = document.createElement("span");
    lineNumberElement.classList.add("gutter");
    lineNumberElement.innerText = `${this.lineNumber}: `;

    return lineNumberElement;
  }// toDOM
}// LineNumberingWidget

export const emojiListPlugin = ViewPlugin.fromClass(
  EmojiListPlugin,
  pluginSpec
);

export default class LineNumberingPlugin extends Plugin  {
  settings: LinkifySettings;
  viewPlugins: LinkifyViewPlugin[] = [];
  async onload() {
    this.registerEditorExtension( ViewPlugin.fromClass(EmojiListPlugin, pluginSpec));
    console.log("Plugin is registered");
  }
}
```


问:
How to programmatically gracefully exit from a Micronaut Application
My goal is to programmatically exit my application. I know that this works well with the PicocliRunner, but I can't figure out what is done differently there. Adding the "cli" environment didn't change it.

I added a reproducer here.

here is a summary of what i tried:

public class Application {
    public static void main(String[] args) {
        // MICRONAUT_ENVIRONMENTS=cli
        ApplicationContext run = Micronaut.run(Application.class, args);
        try {
            EmbeddedServer server = run.getBean(EmbeddedServer.class);
            HttpClient httpClient = HttpClient.create(server.getURL());
            String s = Mono.from(httpClient.retrieve("/hello")).blockOptional().orElseThrow();
            System.out.println(s); // prints 'world'
        } catch (Exception e) {
            e.printStackTrace();
        }

        run.close(); // .stop();, .destroyBean(run);
        System.out.println("closed"); // jvm does not exit
    }

    @io.micronaut.http.annotation.Controller
    public static class Controller {
        @Get("/hello")
        String get() {
            return "world";
        }
    }
}
```


问:
Position of the React-tooltip coming at the bottom of the map- React tooltip/ JS
I'm trying to display the country name on hover using simple-map react with react tooltip. I'm able to see the text somewhere at the bottom of the map and not at the position where I hover.

my app.js

```<code>import {Tooltip as ReactTooltip } from "react-tooltip";
function App() {
  const [content, setContent] = useState("");
  return (
    <div className="App">
      <MapChart setTooltipContent={setContent} />

      <ReactTooltip  backgroundColor="#ed0b70"
        textColor="black"
        id="ePost"
        place="top"
        effect="solid"
        position="absolute"
        overridePosition = {() => {return { left: 30, top: -40 };}}>{content}
      </ReactTooltip>
    </div>
  );
}
</code>```

Marker component:

```<code> <Marker key={index} coordinates={[marker.LONGITUDE, marker.LATITUDE]}}

                     onMouseEnter={() => {
                        setTooltipContent(`${CODE}`);
                      }}
                       onMouseLeave={() => {
                        setTooltipContent("");
                      }}
                      >
                      <circle r={10} fill="#BE8AED"
                          style={{cursor: "pointer"}}
                          />
                      </Marker>
</code>```

how else I can position the tooltip?

Body:
I'm trying to display the country name on hover using simple-map react with react tooltip. I'm able to see the text somewhere at the bottom of the map and not at the position where I hover.

my app.js

import {Tooltip as ReactTooltip } from "react-tooltip";
function App() {
  const [content, setContent] = useState("");
  return (

      <MapChart setTooltipContent={setContent} />

      <ReactTooltip  backgroundColor="#ed0b70"
        textColor="black"
        id="ePost"
        place="top"
        effect="solid"
        position="absolute"
        overridePosition = {() => {return { left: 30, top: -40 };}}>{content}
      </ReactTooltip>

  );
}

Marker component:

 <Marker key={index} coordinates={[marker.LONGITUDE, marker.LATITUDE]}}

                     onMouseEnter={() => {
                        setTooltipContent(`${CODE}`);
                      }}
                       onMouseLeave={() => {
                        setTooltipContent("");
                      }}
                      >
                      <circle r={10} fill="#BE8AED"
                          style={{cursor: "pointer"}}
                          />
                      </Marker>

how else I can position the tooltip?


问:
Eclipse is wrapping the lines even if I'm disabling the wrapping
I'm using Eclipse 2022.12. For some months, when I'm formatting my Java code, Eclipse is wrapping even if I set the line width to 200 characters. I created a new profile starting from "Eclipse 2.1" and I have disabled the line wrapping by doing this:

But Eclipse is still formatting like that (after the first parentesis):

```<code> final List<GrantedAuthority> authorities = getAuthorities(
           Arrays.asList(roleRepository.findByName("ROLE_USER")));
</code>```

Is it normal (and how to fix it ?) or a bug?

Body:
I'm using Eclipse 2022.12. For some months, when I'm formatting my Java code, Eclipse is wrapping even if I set the line width to 200 characters. I created a new profile starting from "Eclipse 2.1" and I have disabled the line wrapping by doing this:

But Eclipse is still formatting like that (after the first parentesis):

 final List<GrantedAuthority> authorities = getAuthorities(
           Arrays.asList(roleRepository.findByName("ROLE_USER")));

Is it normal (and how to fix it ?) or a bug?


问:
Django - ModelForm Change with ChoiceField
I have a ModelForm and I want to hide some fields and add help_text according to values getting from the ChoiceField:

For example:

if value_getting_from_the_choiceField == '1'
    hide_some fields in ModelForm
elif value_getting_from_the_choiceField == '2'
    add help text to some fields
```


问:
server-side application and enabling webpack cache?
I have a traditional mvc application (using spring mvc). And each endpoints return a html with the javascript and css files.

I can be able to configure webpack with multiple entries and it works fine. However it seems webpack builds all javascript files when I change only one of them. For instance when i changed one.js file for the one.html page, webpack will also run the its operation for two.js for the two.html page. Is there any way to resolve this issue?

Let me share the my webpack configuration:

const TerserPlugin = require("terser-webpack-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const WarningsToErrorsPlugin = require("warnings-to-errors-webpack-plugin");
const BundleTracker = require("webpack-bundle-tracker");

module.exports = (env, argv) => ({
  entry: {
      page_one: "./" + "src/main/resources/static/js/pages" + "/page_one.js",
      page_two: "./" + "src/main/resources/static/js/pages" + "/page_two.js",
  },
  output: {
    path: path.resolve(__dirname, "./target/classes/static"),
    filename:
      argv.mode === "production"
        ? "js/pages" + "/[name].js"
        : "js/pages" + "/[name].js?h=[contenthash]",
  },
  devtool: argv.mode === "production" ? false : "eval-source-map",
  optimization: {
    minimize: true,
    minimizer: [new TerserPlugin(), new CssMinimizerPlugin()],
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: "css/[name].css",
    }),

    new WarningsToErrorsPlugin({ writeToFileEmit: true }),
  ],
  module: {
    rules: [
      {
        test: /\.js$'/,
        include: path.resolve(__dirname, "./src/main/resources/static/js" ),
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env"],
          },
        },
      },
      {
        test: /\.css$/,
        include: path.resolve(__dirname, "./src/main/resources/static/css" ),
        use: [
          argv.mode === "production"
            ? MiniCssExtractPlugin.loader
            : "style-loader",
          {
            loader: "css-loader",
            options: {
              importLoaders: 1,
            },
          },
          {
            loader: "postcss-loader",
            options: {
              postcssOptions: {
                plugins: [require("tailwindcss"), require("autoprefixer")],
              },
            },
          },
        ],
      },
    ],
  },
  resolve: {
    modules: [path.resolve(__dirname, "./src/main/resources"), "node_modules"],
  },
  devServer: {
    port: 8081,
    compress: true,
    watchFiles: [
      "src/main/resources/templates/**/*.html",
      "src/main/resources/static/js/**/*.js",
      "src/main/resources/static/css/**/*.css",
    ],
    proxy: {
      "**": {
        target: http://localhost:8080, // server side url
        secure: false,
        prependPath: false,

      },
    },
  },
});
```
<p>Example html page:</p>
<pre class="lang-html prettyprint-override"><code><!DOCTYPE html>
<html
  xmlns:th="http://www.thymeleaf.org"
  xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"

>
  <head>

    <script defer th:src="@{/js/pages/page_one.js}"></script>
  </head>
  <body>
    ...
  </body>
</html>
</code>```

Body:
I have a traditional mvc application (using spring mvc). And each endpoints return a html with the javascript and css files.

I can be able to configure webpack with multiple entries and it works fine. However it seems webpack builds all javascript files when I change only one of them. For instance when i changed one.js file for the one.html page, webpack will also run the its operation for two.js for the two.html page. Is there any way to resolve this issue?

Let me share the my webpack configuration:

const TerserPlugin = require("terser-webpack-plugin");
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const WarningsToErrorsPlugin = require("warnings-to-errors-webpack-plugin");
const BundleTracker = require("webpack-bundle-tracker");

module.exports = (env, argv) => ({
  entry: {
      page_one: "./" + "src/main/resources/static/js/pages" + "/page_one.js",
      page_two: "./" + "src/main/resources/static/js/pages" + "/page_two.js",
  },
  output: {
    path: path.resolve(__dirname, "./target/classes/static"),
    filename:
      argv.mode === "production"
        ? "js/pages" + "/[name].js"
        : "js/pages" + "/[name].js?h=[contenthash]",
  },
  devtool: argv.mode === "production" ? false : "eval-source-map",
  optimization: {
    minimize: true,
    minimizer: [new TerserPlugin(), new CssMinimizerPlugin()],
  },
  plugins: [
    new MiniCssExtractPlugin({
      filename: "css/[name].css",
    }),

    new WarningsToErrorsPlugin({ writeToFileEmit: true }),
  ],
  module: {
    rules: [
      {
        test: /\.js$'/,
        include: path.resolve(__dirname, "./src/main/resources/static/js" ),
        use: {
          loader: "babel-loader",
          options: {
            presets: ["@babel/preset-env"],
          },
        },
      },
      {
        test: /\.css$/,
        include: path.resolve(__dirname, "./src/main/resources/static/css" ),
        use: [
          argv.mode === "production"
            ? MiniCssExtractPlugin.loader
            : "style-loader",
          {
            loader: "css-loader",
            options: {
              importLoaders: 1,
            },
          },
          {
            loader: "postcss-loader",
            options: {
              postcssOptions: {
                plugins: [require("tailwindcss"), require("autoprefixer")],
              },
            },
          },
        ],
      },
    ],
  },
  resolve: {
    modules: [path.resolve(__dirname, "./src/main/resources"), "node_modules"],
  },
  devServer: {
    port: 8081,
    compress: true,
    watchFiles: [
      "src/main/resources/templates/**/*.html",
      "src/main/resources/static/js/**/*.js",
      "src/main/resources/static/css/**/*.css",
    ],
    proxy: {
      "**": {
        target: http://localhost:8080, // server side url
        secure: false,
        prependPath: false,

      },
    },
  },
});

Example html page:

<!DOCTYPE html>

    ...


问:
Positioning views inside Cooordinator Layout in Android
I create the following view inside a Coordinator layout

```<code><com.noodles.numbersgrame.MyRotated90ArrowClass
    android:layout_width="135dp"
    android:layout_height="75dp"
    android:id="@+id/rotated90_arrow"
    android:textColor="@color/overlay_red_plusminus"
    android:elevation="15dp"

    android:textSize="18sp"
    android:textStyle="bold"
    android:rotation="-90"

    app:layout_anchor="@id/my_image_view"
    android:layout_gravity="top|center_horizontal"
    app:layout_anchorGravity="top|center_horizontal" />
</code>```

notice that I rotate the view -90 degrees.

Here is the picture of the view:

How can I make the arrow pointing up sit at the top of the hexagon? The hexagon has an id of my_image_view

I have tried setting android:layout_marginTop="-30dp"  and also android:layout_marginBottom="30dp"  but still the same problem.

I also tried app:layout_insetEdge="top" but still the same problem.

Thanks for any help.

Body:
I create the following view inside a Coordinator layout

<com.noodles.numbersgrame.MyRotated90ArrowClass
    android:layout_width="135dp"
    android:layout_height="75dp"
    android:id="@+id/rotated90_arrow"
    android:textColor="@color/overlay_red_plusminus"
    android:elevation="15dp"

    android:textSize="18sp"
    android:textStyle="bold"
    android:rotation="-90"

    app:layout_anchor="@id/my_image_view"
    android:layout_gravity="top|center_horizontal"
    app:layout_anchorGravity="top|center_horizontal" />

notice that I rotate the view -90 degrees.

Here is the picture of the view:

How can I make the arrow pointing up sit at the top of the hexagon? The hexagon has an id of my_image_view

I have tried setting android:layout_marginTop="-30dp"  and also android:layout_marginBottom="30dp"  but still the same problem.

I also tried app:layout_insetEdge="top" but still the same problem.

Thanks for any help.


问:
avoid Error Suspension functions can be called only within coroutine body Kotlin
I want to remove first from db then to do the logout.

But I receive the error:  Suspension functions can be called only within coroutine body when calling the logout method

My logout method

```<code>suspend fun doLogout(token: String) {

    val userId = appService.currentUser?.id

        realm.write {
            var user = query<UserInfo>("_id = $0", userId).first().find()
                user = findLatest(user)!!.also {
                    it.FCMToken.removeAt(productIndex)
                }
                copyToRealm(user)

                appService.currentUser?.logOut() // Suspension functions can be called only within coroutine body

        }
}
</code>```

Any easy way to solve this?
I want first to remove from db then do the logOut().

I want first to remove from db then do the logOut().

Body:
I want to remove first from db then to do the logout.

But I receive the error:  Suspension functions can be called only within coroutine body when calling the logout method

My logout method

suspend fun doLogout(token: String) {

    val userId = appService.currentUser?.id

        realm.write {
            var user = query<UserInfo>("_id = $0", userId).first().find()
                user = findLatest(user)!!.also {
                    it.FCMToken.removeAt(productIndex)
                }
                copyToRealm(user)

                appService.currentUser?.logOut() // Suspension functions can be called only within coroutine body

        }
}

Any easy way to solve this?
I want first to remove from db then do the logOut().

I want first to remove from db then do the logOut().


问:
How do I refresh information in NextAuth session?
I am currently playing around and building SaaS web application with NextJS, NextAuth, MongoDB and Stripe. My issue is when I change subscribtion of the current user in the database it isn't reflected in the session and I have to logout and login again to see the changes.

```<code>import { compare } from 'bcryptjs';
import NextAuth from 'next-auth';
import CredentialsProvider from 'next-auth/providers/credentials';
import connectMongo from '../../../database/connection';
import Users from '../../../models/Schema';

export default NextAuth({
    providers: [
        CredentialsProvider({
            name: 'Credentials',
            async authorize(credentials, req) {
                connectMongo().catch((error) => {
                    error: 'Connection Failed...!';
                });

                // check user existance
                const result = await Users.findOne({ email: credentials.email });
                if (!result) {
                    throw new Error('No user Found with Email Please Sign Up...!');
                }

                // compare()
                const checkPassword = await compare(
                    credentials.password,
                    result.password
                );

                // incorrect password
                if (!checkPassword || result.email !== credentials.email) {
                    throw new Error('Username or Password does not match');
                }

                return result;
            },
        }),
    ],
    session: {
        jwt: true,
    },
    jwt: {
        secret: process.env.JWT_SECRET,
    },
    callbacks: {
        async jwt({token, user}) {
            if(user) {
                token.stripeCustomerId = user.stripeCustomerId;
                token.subscribtionRole = user.subscribtionRole;
            }
            return token;
        },
        async session({session, token}) {
            session.user.stripeCustomerId = token.stripeCustomerId;
            session.user.subscribtionRole = token.subscribtionRole;
            return session;
        }
    }

});

</code>```

I've tried searching the documentation and various articles, but I haven't found anything that helps. I'm new to this and just learning, so there are a few things I don't understand and don't have that much knowledge, so any advice would be appreciated.

Body:
I am currently playing around and building SaaS web application with NextJS, NextAuth, MongoDB and Stripe. My issue is when I change subscribtion of the current user in the database it isn't reflected in the session and I have to logout and login again to see the changes.

import { compare } from 'bcryptjs';
import NextAuth from 'next-auth';
import CredentialsProvider from 'next-auth/providers/credentials';
import connectMongo from '../../../database/connection';
import Users from '../../../models/Schema';

export default NextAuth({
    providers: [
        CredentialsProvider({
            name: 'Credentials',
            async authorize(credentials, req) {
                connectMongo().catch((error) => {
                    error: 'Connection Failed...!';
                });

                // check user existance
                const result = await Users.findOne({ email: credentials.email });
                if (!result) {
                    throw new Error('No user Found with Email Please Sign Up...!');
                }

                // compare()
                const checkPassword = await compare(
                    credentials.password,
                    result.password
                );

                // incorrect password
                if (!checkPassword || result.email !== credentials.email) {
                    throw new Error('Username or Password does not match');
                }

                return result;
            },
        }),
    ],
    session: {
        jwt: true,
    },
    jwt: {
        secret: process.env.JWT_SECRET,
    },
    callbacks: {
        async jwt({token, user}) {
            if(user) {
                token.stripeCustomerId = user.stripeCustomerId;
                token.subscribtionRole = user.subscribtionRole;
            }
            return token;
        },
        async session({session, token}) {
            session.user.stripeCustomerId = token.stripeCustomerId;
            session.user.subscribtionRole = token.subscribtionRole;
            return session;
        }
    }

});

I've tried searching the documentation and various articles, but I haven't found anything that helps. I'm new to this and just learning, so there are a few things I don't understand and don't have that much knowledge, so any advice would be appreciated.


问:
Is it safe to pass a JWT token query param to a wss:// WebSocket connection?
I've got an endpoint that accepts an Authorization header with a JWT token, that's all good.

Now I'm adding a WebSocket endpoint, but not everyone can connect to it, I want to know who's connecting.

So my plan is to simply add the token as a query parameter like so:

```<code>wss://api.example.com/chat/ws?token=abc123
</code>```

So each user of the app would connect using their token.

But I'm new to WebSockets, is this safe? Is there any way other connected users could see the URL other users used to connect? The sessions are not shared right?

Body:
I've got an endpoint that accepts an Authorization header with a JWT token, that's all good.

Now I'm adding a WebSocket endpoint, but not everyone can connect to it, I want to know who's connecting.

So my plan is to simply add the token as a query parameter like so:

wss://api.example.com/chat/ws?token=abc123

So each user of the app would connect using their token.

But I'm new to WebSockets, is this safe? Is there any way other connected users could see the URL other users used to connect? The sessions are not shared right?


问:
How to get java files of all folder into source folder
I'm trying to create my workspace without IDE and I want to put files and packages in the source folder but I don't know how to compile all java files.

I searched and found it, but this command only get java files of source folder:

```<code>javac -d bin/ src/*.java
</code>```

I need to get java files of all folder into source folder.

Body:
I'm trying to create my workspace without IDE and I want to put files and packages in the source folder but I don't know how to compile all java files.

I searched and found it, but this command only get java files of source folder:

javac -d bin/ src/*.java

I need to get java files of all folder into source folder.


问:
ffmpeg merge audio and video streams on the fly
I'm trying to get a stream from Youtube and stream it via HTTP, but I have to use separate audio and video streams to get good quality. I don't know how to merge the streams on the fly with ffmpeg. (I'm using pytube)

I know I can do this by saving the streams, then merging them, and then streaming the output, but I would like to do it on the fly. This is my current code (which uses the old progressive streams):

```<code>yt = YouTube(f"https://www.youtube.com/watch?v={url}")
video = yt.streams.filter(file_extension='mp4', progressive=True).first()
async def stream(response):
    for chunk in pytube_request.stream(video.url):
        await response.write(chunk)
return ResponseStream(stream, content_type="audio/mp4")
</code>```

Body:
I'm trying to get a stream from Youtube and stream it via HTTP, but I have to use separate audio and video streams to get good quality. I don't know how to merge the streams on the fly with ffmpeg. (I'm using pytube)

I know I can do this by saving the streams, then merging them, and then streaming the output, but I would like to do it on the fly. This is my current code (which uses the old progressive streams):

yt = YouTube(f"https://www.youtube.com/watch?v={url}")
video = yt.streams.filter(file_extension='mp4', progressive=True).first()
async def stream(response):
    for chunk in pytube_request.stream(video.url):
        await response.write(chunk)
return ResponseStream(stream, content_type="audio/mp4")


问:
How to link to a Google drive file?
This link will access a file in the world of Amazon.

https://prd-tnm.s3.amazonaws.com/StagedProducts/Maps/USTopo/PDF/AL/AL_Alabaster_20201219_TM_geo.pdf

Is there an equivalent for linking to files in Google drive? I want to be able to use a static link to a file that I put in Google Drive from my web site's HTML code.

I made several efforts at finding a valid address for my files. None have been useful.

Title: How to link to a Google drive file?


问:
Title in Popup not changing dynamically
I want to change the popup title based on the result of the function. If the data was found "name = StringProperty("") needs to change to string StringProperty("Data Exists Already"), if data not found StringProperty("Data Not Found"). The confirmationtext function seems to run fine but the variable " name " not getting new string? Or it does but I am not assigning correctly in the .kv file? Any suggestions.

class in .py

```<code>class ConfirmationPopUp(Popup):
name = StringProperty("")
def confirmationtext(self,fileName):
    print(fileName)
    data_exist = function.data_exist(fileName)
    print(data_exist)

    if data_exist == 1:
        #print("found 1")
        self.name = StringProperty("Data Exists Already")
        Factory.ConfirmationPopUp().open()
    else:
        self.name = StringProperty("Data Not Found")
        Factory.ConfirmationPopUp().open()
        #print("not found 1")
</code>```

kv file

```<code><ConfirmationPopUp@Popup>:
id: conf_popup
auto_dismiss: False
title: root.name
title_align:"center"
size_hint:(None,None)
size:(350,125)
AnchorLayout:
    size_hint: 1,1
    anchor_y: "top"
    anchor_x: "center"
    spacing: dp(10)
    padding: [dp(8),dp(8),dp(8),dp(8)]
    AnchorLayout:
        anchor_y: "center"
        anchor_x: "left"
        ButtDash:
            text: "Yes"
            size_hint: 0.49, 0.5
            pos_hint: {"x":0.1, "y":0.1}
            on_release: self.file_confirmation()
            on_press: root.dismiss()
    AnchorLayout:
        anchor_y: "center"
        anchor_x: "right"
        ButtDash:
            text: "No"
            size_hint: 0.49, 0.5
            pos_hint: {"x":0.1, "y":0.1}
            on_release: root.dismiss()
</code>```

Title: Title in Popup not changing dynamically

Body:
I want to change the popup title based on the result of the function. If the data was found "name = StringProperty("") needs to change to string StringProperty("Data Exists Already"), if data not found StringProperty("Data Not Found"). The confirmationtext function seems to run fine but the variable " name " not getting new string? Or it does but I am not assigning correctly in the .kv file? Any suggestions.

class in .py

class ConfirmationPopUp(Popup):
name = StringProperty("")
def confirmationtext(self,fileName):
    print(fileName)
    data_exist = function.data_exist(fileName)
    print(data_exist)

    if data_exist == 1:
        #print("found 1")
        self.name = StringProperty("Data Exists Already")
        Factory.ConfirmationPopUp().open()
    else:
        self.name = StringProperty("Data Not Found")
        Factory.ConfirmationPopUp().open()
        #print("not found 1")

kv file

<ConfirmationPopUp@Popup>:
id: conf_popup
auto_dismiss: False
title: root.name
title_align:"center"
size_hint:(None,None)
size:(350,125)
AnchorLayout:
    size_hint: 1,1
    anchor_y: "top"
    anchor_x: "center"
    spacing: dp(10)
    padding: [dp(8),dp(8),dp(8),dp(8)]
    AnchorLayout:
        anchor_y: "center"
        anchor_x: "left"
        ButtDash:
            text: "Yes"
            size_hint: 0.49, 0.5
            pos_hint: {"x":0.1, "y":0.1}
            on_release: self.file_confirmation()
            on_press: root.dismiss()
    AnchorLayout:
        anchor_y: "center"
        anchor_x: "right"
        ButtDash:
            text: "No"
            size_hint: 0.49, 0.5
            pos_hint: {"x":0.1, "y":0.1}
            on_release: root.dismiss()


问:
Cannot create Entity in DB without exception
I run my app, and everything work nicely. My entities are created in the DB, but in spite of this, I have next exception.

```<code>Error executing DDL "alter table user add constraint UK_ob8kqyqqgmefl0aco34akdtpe unique (email)" via JDBC Statement
       org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table user add constraint UK_ob8kqyqqgmefl0aco34akdtpe unique (email)" via JDBC Statement
        at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:502) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:486) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:402) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:176) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:144) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:128) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]

        ... 35 common frames omitted
</code>```

My properties table is create

My Entities

```<code>Entity
@Table (name = "User")
public class User {

    @Id
    @GeneratedValue (strategy = GenerationType.IDENTITY)
    @Column (name = "user_id", nullable = false)
    private Long userId;

    @Basic
    @Column (name = "email", nullable = false, length = 4096, unique = true)
    private String userEmail;

    @Basic
    @Column (name = "password", nullable = false, length = 4096)
    private String userPassword;

    @ManyToMany (fetch = FetchType.EAGER)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinTable (name = "user_role",
                                   joinColumns = {@JoinColumn (name = "user_id")},
                                   inverseJoinColumns = {@JoinColumn (name = "role_id")})
    private Set <Role> roles = new HashSet<>();

    @OneToOne (mappedBy = "user")
    private Student student;

    @OneToOne (mappedBy = "user")
    private Instructor instructor;

    public User () {}
</code>```

If you know please say what I need to do, thanks!

Body:
I run my app, and everything work nicely. My entities are created in the DB, but in spite of this, I have next exception.

Error executing DDL "alter table user add constraint UK_ob8kqyqqgmefl0aco34akdtpe unique (email)" via JDBC Statement
       org.hibernate.tool.schema.spi.CommandAcceptanceException: Error executing DDL "alter table user add constraint UK_ob8kqyqqgmefl0aco34akdtpe unique (email)" via JDBC Statement
        at org.hibernate.tool.schema.internal.exec.GenerationTargetToDatabase.accept(GenerationTargetToDatabase.java:67) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlString(SchemaCreatorImpl.java:502) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.applySqlStrings(SchemaCreatorImpl.java:486) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.createFromMetadata(SchemaCreatorImpl.java:402) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.performCreation(SchemaCreatorImpl.java:176) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:144) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]
        at org.hibernate.tool.schema.internal.SchemaCreatorImpl.doCreation(SchemaCreatorImpl.java:128) ~[hibernate-core-6.1.5.Final.jar:6.1.5.Final]

        ... 35 common frames omitted

My properties table is create

My Entities

Entity
@Table (name = "User")
public class User {

    @Id
    @GeneratedValue (strategy = GenerationType.IDENTITY)
    @Column (name = "user_id", nullable = false)
    private Long userId;

    @Basic
    @Column (name = "email", nullable = false, length = 4096, unique = true)
    private String userEmail;

    @Basic
    @Column (name = "password", nullable = false, length = 4096)
    private String userPassword;

    @ManyToMany (fetch = FetchType.EAGER)
    @NotFound(action = NotFoundAction.IGNORE)
    @JoinTable (name = "user_role",
                                   joinColumns = {@JoinColumn (name = "user_id")},
                                   inverseJoinColumns = {@JoinColumn (name = "role_id")})
    private Set <Role> roles = new HashSet<>();

    @OneToOne (mappedBy = "user")
    private Student student;

    @OneToOne (mappedBy = "user")
    private Instructor instructor;

    public User () {}

If you know please say what I need to do, thanks!


问:
How to change state of selected chart but others who are not selected to use default state?

I try to change state of selected chart ( others who are not selected to use default state ), here is the list of charts in ChartWidget component which is child of SmartTradePageLayout:

```<code> const charts = [
{
 title: 'Chart-1',
 id: 0,
 content: options,
 isSelected: false,
},
{
 title: 'Chart-2',
 id: 1,
 content: options2,
 isSelected: false,
},
{
 title: 'Chart-3',
 id: 2,
 content: options3,
 isSelected: false,
},
{
 title: 'Chart-4',
 id: 3,
 content: options4,
 isSelected: false,
},
</code>```

]

In this part of code I use map and with handle data function I change color of selected chart but state of others is also changed.

```<code> const handleData = (getData) => {
 actions[uiActions.actionTypes.MULTICHART_UPDATES]({data: getData});
 actions[uiActions.actionTypes.MULTICHART_INVOKED](getData);
 setActive(getData.id);
 }

  charts.map((data, i) => {
        return  <div key={i} onClick={() =>  handleData(data)} className={active == i ?
        'bg-primary border-inset rounded-top' : 'bg-secondary border-inset roundedtop'}>
         <div className='p-1 cursor-pointer' > {data.title} </div>
         <TradingViewWidget  { ...data.content } />
          </div>
         }
</code>```

In this action file for updating state, I use handleClick function and get data for selected chart but state is updated in all charts.
Here is also part of model where I use empty data object to catch data of selected chart.

```<code> const handleClick = ( actions, payload ) => {
 const { data } = payload;
 const  { updateState } = actions;
 if (data.isSelected == false){
    updateState(data.isSelected = true);
    console.log('data:', payload);
  }
 }
</code>```

Model:

```<code> data: { },
</code>```

Here is SmartTradePageLayout parent component:

```<code>    const isContentAvailable = !isSingle ?
    Boolean(!isEmpty(packsState.selectedPair) && !isEmpty(exchanges) &&
    !isEmpty(packsState.exchangeData)) :
    Boolean(!isEmpty(exchanges) && singlePair.mainCoin && singlePair.pairCoin );

    !isContentAvailable ?
                <div className="smart-trade-chart-container">
                    <ChartWidget defaultPair={DEFAULT_PAIR}  />
                </div> :
                <div className="smart-trade-chart-container">
                    <ChartWidget/>
                </div>
</code>```

Body:
I try to change state of selected chart ( others who are not selected to use default state ), here is the list of charts in ChartWidget component which is child of SmartTradePageLayout:

 const charts = [
{
 title: 'Chart-1',
 id: 0,
 content: options,
 isSelected: false,
},
{
 title: 'Chart-2',
 id: 1,
 content: options2,
 isSelected: false,
},
{
 title: 'Chart-3',
 id: 2,
 content: options3,
 isSelected: false,
},
{
 title: 'Chart-4',
 id: 3,
 content: options4,
 isSelected: false,
},

]

In this part of code I use map and with handle data function I change color of selected chart but state of others is also changed.

 const handleData = (getData) => {
 actions[uiActions.actionTypes.MULTICHART_UPDATES]({data: getData});
 actions[uiActions.actionTypes.MULTICHART_INVOKED](getData);
 setActive(getData.id);
 }

  charts.map((data, i) => {
        return
  handleData(data)} className={active == i ?
        'bg-primary border-inset rounded-top' : 'bg-secondary border-inset roundedtop'}>

 {data.title}

         <TradingViewWidget  { ...data.content } />

         }

In this action file for updating state, I use handleClick function and get data for selected chart but state is updated in all charts.
Here is also part of model where I use empty data object to catch data of selected chart.

 const handleClick = ( actions, payload ) => {
 const { data } = payload;
 const  { updateState } = actions;
 if (data.isSelected == false){
    updateState(data.isSelected = true);
    console.log('data:', payload);
  }
 }

Model:

 data: { },

Here is SmartTradePageLayout parent component:

    const isContentAvailable = !isSingle ?
    Boolean(!isEmpty(packsState.selectedPair) && !isEmpty(exchanges) &&
    !isEmpty(packsState.exchangeData)) :
    Boolean(!isEmpty(exchanges) && singlePair.mainCoin && singlePair.pairCoin );

    !isContentAvailable ?

                    <ChartWidget defaultPair={DEFAULT_PAIR}  />

 :

                    <ChartWidget/>


问:
I want to write a function that increases the value of an int attribute by one [Java]
I'm extremely new to programming, and I'm trying to write a basic shopping cart app. Right now, I have a JPA entity class Product, a LineItem child table and class, and a Cart class. The Cart class has an addItem() method that the CartServlet uses to create a new LineItem and add it to a list of LineItems in the cart. It doesn't do this if an identical item already exists in the cart.

The LineItem class also has an attribute, private int quantity = 1. When the user adds an item to the cart, it sets the quantity to one. In my JSP, there's a text input field that displays the quantity, and the user can edit it, which updates the total price.

However, I want the quantity value to update when a user manually adds a duplicate item. So if I add an item to the cart, go back, and add it again, I want the quantity to be 2. I was going to write out my best guess, but I honestly don't even know where to start, so here's the addItem() method and the relevant servlet block for reference:

Cart.java

```<code>public void addItem(LineItem item)
{
    String title = item.getProduct().getTitle();
    int quantity = item.getQuantity();

    for (int i = 0; i < items.size(); i++)
    {
        LineItem lineItem = items.get(i);
        if (lineItem.getProduct().getTitle().equals(title))
        {
            lineItem.setQuantity(quantity);
            return;
        }
    }
}
</code>```

CartServlet.java

```<code>else if (action.equals("add"))
{
    if (cart == null)
    {
        cart = new Cart();
    }

    String title = request.getParameter("title");

    Product product = ProductUtil.selectProduct(title);
    if (product != null)
    {
        LineItem lineItem = new LineItem();
        lineItem.setProduct(product);
        cart.addItem(lineItem);
    }

    session.setAttribute("cart", cart);
    url = "/cart/cart.jsp";
}
</code>```

I don't know if would be best create another method in the Cart class (e.g. addQuantity()) and utilize it in the servlet, to do all of it in the servlet, or to add it to the addItems() method. I also don't really know how to do any of those things. If anyone could point me in the right direction, that would be great.

Body:
I'm extremely new to programming, and I'm trying to write a basic shopping cart app. Right now, I have a JPA entity class Product, a LineItem child table and class, and a Cart class. The Cart class has an addItem() method that the CartServlet uses to create a new LineItem and add it to a list of LineItems in the cart. It doesn't do this if an identical item already exists in the cart.

The LineItem class also has an attribute, private int quantity = 1. When the user adds an item to the cart, it sets the quantity to one. In my JSP, there's a text input field that displays the quantity, and the user can edit it, which updates the total price.

However, I want the quantity value to update when a user manually adds a duplicate item. So if I add an item to the cart, go back, and add it again, I want the quantity to be 2. I was going to write out my best guess, but I honestly don't even know where to start, so here's the addItem() method and the relevant servlet block for reference:

Cart.java

public void addItem(LineItem item)
{
    String title = item.getProduct().getTitle();
    int quantity = item.getQuantity();

    for (int i = 0; i < items.size(); i++)
    {
        LineItem lineItem = items.get(i);
        if (lineItem.getProduct().getTitle().equals(title))
        {
            lineItem.setQuantity(quantity);
            return;
        }
    }
}

CartServlet.java

else if (action.equals("add"))
{
    if (cart == null)
    {
        cart = new Cart();
    }

    String title = request.getParameter("title");

    Product product = ProductUtil.selectProduct(title);
    if (product != null)
    {
        LineItem lineItem = new LineItem();
        lineItem.setProduct(product);
        cart.addItem(lineItem);
    }

    session.setAttribute("cart", cart);
    url = "/cart/cart.jsp";
}

I don't know if would be best create another method in the Cart class (e.g. addQuantity()) and utilize it in the servlet, to do all of it in the servlet, or to add it to the addItems() method. I also don't really know how to do any of those things. If anyone could point me in the right direction, that would be great.


问:
is there a faster way to receive input with python? (USACO)
I'm new to competitive coding and was doing a practice USACO question with an input structure like this:

```<code>5 3
1
6
4
3
1
</code>```

the first number is the number of numbers below it, and the second number next to it would be needed for something else in the problem

heres the code I wrote to try to recieve the input

```<code>a = list(input())
n = int(a[0])
k = int(a[2])

diamonds = []

for x in range(n):
  this = int(input())
  diamonds.append(this)
</code>```

the first two numbers I put in a list, converted to int, then assigned them to two variables, I then created an array with a for loop to receive the list of numbers below, converting them to int first

although it works, I feel like this is inefficent and is wasting time, is there another, faster way of doing this?

Body:
I'm new to competitive coding and was doing a practice USACO question with an input structure like this:

5 3
1
6
4
3
1

the first number is the number of numbers below it, and the second number next to it would be needed for something else in the problem

heres the code I wrote to try to recieve the input

a = list(input())
n = int(a[0])
k = int(a[2])

diamonds = []

for x in range(n):
  this = int(input())
  diamonds.append(this)

the first two numbers I put in a list, converted to int, then assigned them to two variables, I then created an array with a for loop to receive the list of numbers below, converting them to int first

although it works, I feel like this is inefficent and is wasting time, is there another, faster way of doing this?


问:
AutomaticKeepAliveClientMixin not working with CupertinoSwitch
I have page where build ListView with CupertinoSwitch.

```<code>    class NewsPageRegistr extends StatefulWidget {
  NewsPageRegistr({Key key, this.model}) : super(key: key);
  RegistrationModel model;
  @override
  _NewsPageRegistrState createState() => _NewsPageRegistrState();
}

class _NewsPageRegistrState extends State<NewsPageRegistr>
    with AutomaticKeepAliveClientMixin<NewsPageRegistr> {
  @override
  bool get wantKeepAlive => true;

  var responseV;
  List<DigitalNews> digitalNews = [];
  @override
  void dispose() {

    super.dispose();
  }

  @override
  void initState() {
    fitchData();
    super.initState();
  }

  fitchData() async {
    responseV = await apiRegistrationDataList(DropMenuMode.news);
    for (var values in responseV) {
      digitalNews.add(DigitalNews.fromJson(values));
    }
  }

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return SingleChildScrollView(
      child: SafeArea(
        minimum: const EdgeInsets.fromLTRB(25, 0, 25, 0),
        child: Column(
          mainAxisSize: MainAxisSize.max,
          children: <Widget>[
            SizedBox(
              width: 400,
              height: 85,
              child: Text(
                "Ich möchte folgende Newsletter abonnieren",
                textAlign: TextAlign.left,
                style: GeneralStyles.titleStyle,
              ),
            ),
            ListView.builder(
                //padding: const EdgeInsets.symmetric(vertical: 8),
                physics: const NeverScrollableScrollPhysics(),
                shrinkWrap: true,
                itemCount: digitalNews.length,
                itemBuilder: (context, index) {
                  return CheckWidget(
                    title: digitalNews[index].displayName,
                    subtitle: digitalNews[index].displayDescription,
                    registrationName: digitalNews[index].name,
                    index: index,
                    model: widget.model,
                  );
                }),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 8.0),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Container(
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        OutlinedButton(
                            style: OutlinedButton.styleFrom(
                              backgroundColor: GeneralStyles.petrolColor,
                            ),
                            onPressed: () {
                              setState(() {});
                              widget.model.setCurrentPage(2);

                            },
                            child: const Text(
                              "Weiter",
                              style: TextStyle(
                                  color: Colors.white,
                                  fontWeight: FontWeight.w300,
                                  fontFamily: 'FiraSans'),
                            )),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

}
</code>```

I use AutomaticKeepAliveClientMixin but it not working when i jump to next page (on PageView).
I add AutomaticKeepAliveClientMixin on main widget when call PageView, add to CheckWidget and to NewsPageRegistr widget but it not working. when i jump to other page on PageView List NewsPageRegistr state is dispose.
Code of widget:

```<code>class CheckWidget extends StatefulWidget {

  RegistrationModel model;
  bool checker = false;
  final Function(String) onChanged;
  final String title;
  final String subtitle;
  final String registrationName;
  final int index;

  CheckWidget({Key key, this.onChanged, this.title, this.subtitle, this.registrationName, this.index,this.model}) : super(key: key);

  @override
  State<CheckWidget> createState() => _CheckWidgetState();
}

class _CheckWidgetState extends State<CheckWidget> {

  @override
  Widget build(BuildContext context) {

    return  Container(
      child: Row(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            Transform.scale(
              alignment: Alignment.centerLeft,
              scale: 0.8,
              child: CupertinoSwitch(
                value: widget.checker,
                activeColor: GeneralStyles.petrolColor,
                onChanged: (bool value) {
                  setState(() {
                    widget.checker = value;
                    if(value == true) {
                    widget.model.newsPapers[widget.index] = widget.registrationName;
                    }else {
                      widget.model.newsPapers[widget.index] = '';
                    }
                  });
                },
              ),
            ),
            Expanded(
              child: GestureDetector(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(widget.title.replaceFirst("Newsletter", "").trim(), style:TextStyle(
                      color: GeneralStyles.blackColor,
                      fontSize: 15,
                      fontFamily: 'FiraSans',
                      fontWeight: FontWeight.w400,
                    )),
                    Text(widget.subtitle, style:TextStyle(
                      color: GeneralStyles.blackColor,
                      fontSize: 13,
                      fontFamily: 'FiraSans',
                      fontWeight: FontWeight.w300,
                    )),
                  ],
                ),
                onTap: (){
                  setState(() {

                    if(widget.checker == false) {
                      widget.checker = true;
                     widget.model.newsPapers[widget.index] = widget.registrationName;
                    }else {
                      widget.checker = false;
                      widget.model.newsPapers[widget.index] = '';
                    }
                  });
                },
              ),
            ),
          ]
      ),
    );
  }

}
</code>```

Body:
I have page where build ListView with CupertinoSwitch.

    class NewsPageRegistr extends StatefulWidget {
  NewsPageRegistr({Key key, this.model}) : super(key: key);
  RegistrationModel model;
  @override
  _NewsPageRegistrState createState() => _NewsPageRegistrState();
}

class _NewsPageRegistrState extends State<NewsPageRegistr>
    with AutomaticKeepAliveClientMixin<NewsPageRegistr> {
  @override
  bool get wantKeepAlive => true;

  var responseV;
  List<DigitalNews> digitalNews = [];
  @override
  void dispose() {

    super.dispose();
  }

  @override
  void initState() {
    fitchData();
    super.initState();
  }

  fitchData() async {
    responseV = await apiRegistrationDataList(DropMenuMode.news);
    for (var values in responseV) {
      digitalNews.add(DigitalNews.fromJson(values));
    }
  }

  @override
  Widget build(BuildContext context) {
    super.build(context);
    return SingleChildScrollView(
      child: SafeArea(
        minimum: const EdgeInsets.fromLTRB(25, 0, 25, 0),
        child: Column(
          mainAxisSize: MainAxisSize.max,
          children: <Widget>[
            SizedBox(
              width: 400,
              height: 85,
              child: Text(
                "Ich möchte folgende Newsletter abonnieren",
                textAlign: TextAlign.left,
                style: GeneralStyles.titleStyle,
              ),
            ),
            ListView.builder(
                //padding: const EdgeInsets.symmetric(vertical: 8),
                physics: const NeverScrollableScrollPhysics(),
                shrinkWrap: true,
                itemCount: digitalNews.length,
                itemBuilder: (context, index) {
                  return CheckWidget(
                    title: digitalNews[index].displayName,
                    subtitle: digitalNews[index].displayDescription,
                    registrationName: digitalNews[index].name,
                    index: index,
                    model: widget.model,
                  );
                }),
            Padding(
              padding: const EdgeInsets.symmetric(vertical: 8.0),
              child: Row(
                mainAxisAlignment: MainAxisAlignment.end,
                children: [
                  Container(
                    child: Row(
                      mainAxisAlignment: MainAxisAlignment.end,
                      children: [
                        OutlinedButton(
                            style: OutlinedButton.styleFrom(
                              backgroundColor: GeneralStyles.petrolColor,
                            ),
                            onPressed: () {
                              setState(() {});
                              widget.model.setCurrentPage(2);

                            },
                            child: const Text(
                              "Weiter",
                              style: TextStyle(
                                  color: Colors.white,
                                  fontWeight: FontWeight.w300,
                                  fontFamily: 'FiraSans'),
                            )),
                      ],
                    ),
                  ),
                ],
              ),
            ),
          ],
        ),
      ),
    );
  }

}

I use AutomaticKeepAliveClientMixin but it not working when i jump to next page (on PageView).
I add AutomaticKeepAliveClientMixin on main widget when call PageView, add to CheckWidget and to NewsPageRegistr widget but it not working. when i jump to other page on PageView List NewsPageRegistr state is dispose.
Code of widget:

class CheckWidget extends StatefulWidget {

  RegistrationModel model;
  bool checker = false;
  final Function(String) onChanged;
  final String title;
  final String subtitle;
  final String registrationName;
  final int index;

  CheckWidget({Key key, this.onChanged, this.title, this.subtitle, this.registrationName, this.index,this.model}) : super(key: key);

  @override
  State<CheckWidget> createState() => _CheckWidgetState();
}

class _CheckWidgetState extends State<CheckWidget> {

  @override
  Widget build(BuildContext context) {

    return  Container(
      child: Row(
          mainAxisAlignment: MainAxisAlignment.start,
          children: <Widget>[
            Transform.scale(
              alignment: Alignment.centerLeft,
              scale: 0.8,
              child: CupertinoSwitch(
                value: widget.checker,
                activeColor: GeneralStyles.petrolColor,
                onChanged: (bool value) {
                  setState(() {
                    widget.checker = value;
                    if(value == true) {
                    widget.model.newsPapers[widget.index] = widget.registrationName;
                    }else {
                      widget.model.newsPapers[widget.index] = '';
                    }
                  });
                },
              ),
            ),
            Expanded(
              child: GestureDetector(
                child: Column(
                  mainAxisAlignment: MainAxisAlignment.start,
                  crossAxisAlignment: CrossAxisAlignment.start,
                  children: [
                    Text(widget.title.replaceFirst("Newsletter", "").trim(), style:TextStyle(
                      color: GeneralStyles.blackColor,
                      fontSize: 15,
                      fontFamily: 'FiraSans',
                      fontWeight: FontWeight.w400,
                    )),
                    Text(widget.subtitle, style:TextStyle(
                      color: GeneralStyles.blackColor,
                      fontSize: 13,
                      fontFamily: 'FiraSans',
                      fontWeight: FontWeight.w300,
                    )),
                  ],
                ),
                onTap: (){
                  setState(() {

                    if(widget.checker == false) {
                      widget.checker = true;
                     widget.model.newsPapers[widget.index] = widget.registrationName;
                    }else {
                      widget.checker = false;
                      widget.model.newsPapers[widget.index] = '';
                    }
                  });
                },
              ),
            ),
          ]
      ),
    );
  }

}