text:
Q: How to get error trace for the eclipse errors.? When I build the run project it gaves me an error

then when I tried to run it, it gave me another error

but no much details behind that
how to get error trace from eclipse & fix it.?
Thanks
I tried with deleting .project .classpath .settings files
also, eclipse clean build
as well as mvn eclipse:eclipse then mvn clean install
it works perfect with mvn exec:java
but not works with eclipse run-as application
Error log updated

Error log shows below, but not much information in there..
-----------------Exceptions at Build time-----------------
eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data file:/C:/Users/w127940/ws--2212-eclipse/ -product org.eclipse.epp.package.jee.product

org.eclipse.core.resources
Error
Thu Mar 02 08:14:01 CET 2023
Errors occurred during the build.

eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data file:/C:/Users/w127940/ws--2212-eclipse/ -product org.eclipse.epp.package.jee.product

org.eclipse.jdt.core
Error
Thu Mar 02 08:14:01 CET 2023
Errors running builder 'Java Builder' on project '****Service'.

java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:133)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:522)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:634)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:630)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveSuperType(TypeReference.java:602)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.findSupertype(ClassScope.java:1670)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectSuperclass(ClassScope.java:1176)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1454)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectMemberTypes(ClassScope.java:1143)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1464)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:394)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:521)
    at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:881)
    at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:394)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:379)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:214)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:311)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:79)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:276)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1020)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:247)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:392)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:395)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:506)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:454)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:536)
    at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:524)
    at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:420)
    at org.eclipse.ui.actions.BuildAction$1.runInWorkspace(BuildAction.java:291)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data file:/C:/Users/w127940/ws--2212-eclipse/ -product org.eclipse.epp.package.jee.product

org.eclipse.core.resources
Error
Thu Mar 02 08:13:59 CET 2023
Problems occurred when invoking code from plug-in: "org.eclipse.core.resources".

java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:133)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:522)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:634)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:630)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveSuperType(TypeReference.java:602)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.findSupertype(ClassScope.java:1670)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectSuperclass(ClassScope.java:1176)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1454)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectMemberTypes(ClassScope.java:1143)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1464)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:394)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:521)
    at org.eclipse.jdt.internal.compiler.Compiler.internalBeginToCompile(Compiler.java:881)
    at org.eclipse.jdt.internal.compiler.Compiler.beginToCompile(Compiler.java:394)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:444)
    at org.eclipse.jdt.internal.compiler.Compiler.compile(Compiler.java:426)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:379)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.compile(BatchImageBuilder.java:214)
    at org.eclipse.jdt.internal.core.builder.AbstractImageBuilder.compile(AbstractImageBuilder.java:311)
    at org.eclipse.jdt.internal.core.builder.BatchImageBuilder.build(BatchImageBuilder.java:79)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.buildAll(JavaBuilder.java:276)
    at org.eclipse.jdt.internal.core.builder.JavaBuilder.build(JavaBuilder.java:193)
    at org.eclipse.core.internal.events.BuildManager$2.run(BuildManager.java:1020)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:247)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:303)
    at org.eclipse.core.internal.events.BuildManager$1.run(BuildManager.java:392)
    at org.eclipse.core.runtime.SafeRunner.run(SafeRunner.java:45)
    at org.eclipse.core.internal.events.BuildManager.basicBuild(BuildManager.java:395)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:506)
    at org.eclipse.core.internal.events.BuildManager.basicBuildLoop(BuildManager.java:454)
    at org.eclipse.core.internal.events.BuildManager.build(BuildManager.java:536)
    at org.eclipse.core.internal.resources.Workspace.buildInternal(Workspace.java:524)
    at org.eclipse.core.internal.resources.Workspace.build(Workspace.java:420)
    at org.eclipse.ui.actions.BuildAction$1.runInWorkspace(BuildAction.java:291)
    at org.eclipse.core.internal.resources.InternalWorkspaceJob.run(InternalWorkspaceJob.java:43)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:63)

-----------------Exceptions at Run time-----------------
eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data file:/C:/Users/w127940/ws--2212-eclipse/ -product org.eclipse.epp.package.jee.product

org.eclipse.jdt.debug.ui
Error
Thu Mar 02 08:15:04 CET 2023
Internal Error

org.eclipse.core.runtime.CoreException: InvocationTargetException
    at org.eclipse.jdt.debug.ui.launchConfigurations.JavaApplicationLaunchShortcut.findTypes(JavaApplicationLaunchShortcut.java:167)
    at org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchShortcut.searchAndLaunch(JavaLaunchShortcut.java:115)
    at org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchShortcut.launch(JavaLaunchShortcut.java:274)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension.launch(LaunchShortcutExtension.java:419)
    at org.eclipse.debug.internal.ui.actions.LaunchShortcutAction.runInternal(LaunchShortcutAction.java:83)
    at org.eclipse.debug.internal.ui.actions.LaunchShortcutAction.runWithEvent(LaunchShortcutAction.java:135)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580)
    at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1090)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1075)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:778)
    at org.eclipse.jface.action.ActionContributionItem.lambda$8(ActionContributionItem.java:1206)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
Caused by: java.lang.reflect.InvocationTargetException
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:395)
    at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:470)
    at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:230)
    at org.eclipse.ui.internal.progress.ProgressManager.lambda$26(ProgressManager.java:836)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
    at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:869)
    at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:845)
    at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1003)
    at org.eclipse.jdt.internal.debug.ui.launcher.MainMethodSearchEngine.searchMainMethods(MainMethodSearchEngine.java:169)
    at org.eclipse.jdt.debug.ui.launchConfigurations.JavaApplicationLaunchShortcut.findTypes(JavaApplicationLaunchShortcut.java:165)
    ... 40 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:133)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:522)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:634)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:630)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveSuperType(TypeReference.java:602)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.findSupertype(ClassScope.java:1670)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectSuperclass(ClassScope.java:1176)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1454)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectMemberTypes(ClassScope.java:1143)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1464)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:394)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:589)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.accept(MatchLocator.java:381)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:337)
    at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getType(PackageBinding.java:195)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.findType(Scope.java:2025)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:3500)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:3187)
    at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:60)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:522)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:625)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:621)
    at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:282)
    at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:259)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:662)
    at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:388)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:571)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1503)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1628)
    at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:667)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:2033)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1363)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1400)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1542)
    at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:135)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:251)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:602)
    at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:670)
    at org.eclipse.jdt.internal.debug.ui.launcher.MainMethodSearchEngine.searchMainMethods(MainMethodSearchEngine.java:97)
    at org.eclipse.jdt.internal.debug.ui.launcher.MainMethodSearchEngine$1.run(MainMethodSearchEngine.java:166)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)

eclipse.buildId=4.26.0.20221201-1200
java.version=17.0.5
java.vendor=Eclipse Adoptium
BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=en_US
Framework arguments:  -product org.eclipse.epp.package.jee.product -product org.eclipse.epp.package.jee.product
Command-line arguments:  -os win32 -ws win32 -arch x86_64 -product org.eclipse.epp.package.jee.product -data file:/C:/Users/w127940/ws--2212-eclipse/ -product org.eclipse.epp.package.jee.product

org.eclipse.jdt.debug.ui
Error
Thu Mar 02 08:15:04 CET 2023
InvocationTargetException

java.lang.reflect.InvocationTargetException
    at org.eclipse.jface.operation.ModalContext.run(ModalContext.java:395)
    at org.eclipse.jface.dialogs.ProgressMonitorDialog.run(ProgressMonitorDialog.java:470)
    at org.eclipse.ui.internal.progress.ProgressMonitorJobsDialog.run(ProgressMonitorJobsDialog.java:230)
    at org.eclipse.ui.internal.progress.ProgressManager.lambda$26(ProgressManager.java:836)
    at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:74)
    at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:869)
    at org.eclipse.ui.internal.progress.ProgressManager.busyCursorWhile(ProgressManager.java:845)
    at org.eclipse.ui.internal.progress.ProgressManager.run(ProgressManager.java:1003)
    at org.eclipse.jdt.internal.debug.ui.launcher.MainMethodSearchEngine.searchMainMethods(MainMethodSearchEngine.java:169)
    at org.eclipse.jdt.debug.ui.launchConfigurations.JavaApplicationLaunchShortcut.findTypes(JavaApplicationLaunchShortcut.java:165)
    at org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchShortcut.searchAndLaunch(JavaLaunchShortcut.java:115)
    at org.eclipse.jdt.debug.ui.launchConfigurations.JavaLaunchShortcut.launch(JavaLaunchShortcut.java:274)
    at org.eclipse.debug.internal.ui.launchConfigurations.LaunchShortcutExtension.launch(LaunchShortcutExtension.java:419)
    at org.eclipse.debug.internal.ui.actions.LaunchShortcutAction.runInternal(LaunchShortcutAction.java:83)
    at org.eclipse.debug.internal.ui.actions.LaunchShortcutAction.runWithEvent(LaunchShortcutAction.java:135)
    at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:580)
    at org.eclipse.jface.action.ActionContributionItem.lambda$4(ActionContributionItem.java:414)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1090)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1075)
    at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:778)
    at org.eclipse.jface.action.ActionContributionItem.lambda$8(ActionContributionItem.java:1206)
    at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
    at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
    at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
    at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
    at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine$5.run(PartRenderingEngine.java:1155)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.e4.ui.internal.workbench.swt.PartRenderingEngine.run(PartRenderingEngine.java:1046)
    at org.eclipse.e4.ui.internal.workbench.E4Workbench.createAndRunUI(E4Workbench.java:155)
    at org.eclipse.ui.internal.Workbench.lambda$3(Workbench.java:643)
    at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:338)
    at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:550)
    at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:171)
    at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:152)
    at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:203)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:136)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
Caused by: java.lang.ArrayIndexOutOfBoundsException: Index 1 out of bounds for length 1
    at org.eclipse.jdt.internal.compiler.ast.QualifiedTypeReference.getTypeBinding(QualifiedTypeReference.java:133)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:522)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:634)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:630)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveSuperType(TypeReference.java:602)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.findSupertype(ClassScope.java:1670)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectSuperclass(ClassScope.java:1176)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1454)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectMemberTypes(ClassScope.java:1143)
    at org.eclipse.jdt.internal.compiler.lookup.ClassScope.connectTypeHierarchy(ClassScope.java:1464)
    at org.eclipse.jdt.internal.compiler.lookup.CompilationUnitScope.connectTypeHierarchy(CompilationUnitScope.java:394)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.completeTypeBindings(LookupEnvironment.java:589)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.accept(MatchLocator.java:381)
    at org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment.askForType(LookupEnvironment.java:337)
    at org.eclipse.jdt.internal.compiler.lookup.PackageBinding.getType(PackageBinding.java:195)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.findType(Scope.java:2025)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getTypeOrPackage(Scope.java:3500)
    at org.eclipse.jdt.internal.compiler.lookup.Scope.getType(Scope.java:3187)
    at org.eclipse.jdt.internal.compiler.ast.SingleTypeReference.getTypeBinding(SingleTypeReference.java:60)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.internalResolveType(TypeReference.java:522)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:625)
    at org.eclipse.jdt.internal.compiler.ast.TypeReference.resolveType(TypeReference.java:621)
    at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:282)
    at org.eclipse.jdt.internal.compiler.ast.LocalDeclaration.resolve(LocalDeclaration.java:259)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolveStatements(AbstractMethodDeclaration.java:662)
    at org.eclipse.jdt.internal.compiler.ast.MethodDeclaration.resolveStatements(MethodDeclaration.java:388)
    at org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration.resolve(AbstractMethodDeclaration.java:571)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1503)
    at org.eclipse.jdt.internal.compiler.ast.TypeDeclaration.resolve(TypeDeclaration.java:1628)
    at org.eclipse.jdt.internal.compiler.ast.CompilationUnitDeclaration.resolve(CompilationUnitDeclaration.java:667)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.process(MatchLocator.java:2033)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1363)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1400)
    at org.eclipse.jdt.internal.core.search.matching.MatchLocator.locateMatches(MatchLocator.java:1542)
    at org.eclipse.jdt.internal.core.search.JavaSearchParticipant.locateMatches(JavaSearchParticipant.java:135)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.findMatches(BasicSearchEngine.java:251)
    at org.eclipse.jdt.internal.core.search.BasicSearchEngine.search(BasicSearchEngine.java:602)
    at org.eclipse.jdt.core.search.SearchEngine.search(SearchEngine.java:670)
    at org.eclipse.jdt.internal.debug.ui.launcher.MainMethodSearchEngine.searchMainMethods(MainMethodSearchEngine.java:97)
    at org.eclipse.jdt.internal.debug.ui.launcher.MainMethodSearchEngine$1.run(MainMethodSearchEngine.java:166)
    at org.eclipse.jface.operation.ModalContext$ModalContextThread.run(ModalContext.java:122)


text:
Q: java3d simple way to translate object I am making my first program using Java3D. I have setup some transformGroups that I now need to move in calculated directions. When I looked this up, I found interpolators and alpha objects and waveforms and couldn't understand a word of it. I have done this in the past in OpenGL using simple vectors and frame refreshment. Is there a similar simple way in Java3d? Thanks.

A: There's no reason you couldn't do it with vectors and frame refresh in Java3D as well.
A simple way would be to attach a behavior to the scenegraph with a WakeupOnElapsedFrames(0) condition, and then have it update the needed transform every frame.
As its simplest, that is was the interpolators are doing for you.  Once you get that working, it will probably make more sense as to how you could do it with interpolators.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How do you take the value of a time formatted cell and put it into another cell? I am trying to create a sort of timesheet for my new job.  I have got to a point where it has worked out the hours for me, but it won't add up each day's hours into a total correctly.
For example:
Cells C19:G19 have all time formatted cells.
C19 has 07:20:00 for my hours worked that day.
When using the SUM(C19:G19) function for all the cells in that range, I'm getting 11:40 back. When in reality this value should be nearly 37:00.
Is there anyway to either correct this or extract the numbers so I can get the right number?

A: Welcome to SU.
It is worth knowing how Excel stores and deals with time and date formatted data. In the background, it is actually storing a single number (regardless whether it is time or date or time and date) called the date serial number. This serial number is the number of days (including fractions for hours/mins/secs/etc) since 0 January 1900. So, if you enter data in A1 as 12:00 and then change the format to "yyyy/mm/dd hh:mm", Excel will actually display "1900/01/00  12:00:00". If in B1 you enter the formula =A1+1, you are adding exactly one day and Excel will show "1900/01/01  12:00:00". If you change the formatting to "numbers", you will get 0.5 and 1.5.
To get the answer you are after, make sure the time you input is "0 biased"  i.e. relative to 1900/01/00 00:00 otherwise adding time together will not make any sense. When adding "0 biased" times together, Excel will naturally let every 24hours spill into a new day. If you are only display hh:mm, you will not see the roll-over into days. You have a few options to view the data correctly:

*

*Set a custom time format to [h]:mm or [m]:ss to display in either total hours or total minutes

*Set the answer's format to "numbers" and multiply by 24 to get the total hours. So a date serial of e.g. 1.7 days will be 40.8 hours, or 40 hours and 48 minutes (.8 * 60).


text:
Q: Importar varios archivos csv a R, sin perder su nombre original Estoy teniendo un problema ( espero que simple) en cuanto a la importación de múltiples archivos a R.
Mi idea es importar muchos csv y luego generar un df con todos los datos, esta parte la tengo resuelta.
El problema es que necesito que cada csv que importe tenga su nombre en una columna para no perder el rastro del mismo.
Esto es lo que tengo y me funciona bien, pero al crear el df final, pierdo el seguimiento de la fecha de cada csv que me une al dataframe final.
lista.archivos<- list.files(path="F:/RODRIGO/Lid/Lid_proyect/Archivos", pattern="*.csv")

df.list <- lapply(lista.archivos, read.csv)
df.final <- do.call("rbind", df.list)

Me gustaría crear antes de la unión, una columna que sea el nombre de mi archivo ya que tengo la fecha en la cual se tomo esos datos. Esa fecha esta presente en el nombre de mi csv. Tendré que hacer un bucle for?
processed_02_B_20191350_V002.csv (Nombre de mis csv con la fecha de la colecta de los datos)
No se si eso es posible o tendré que hacerlo a mano previamente en cada csv.
Gracias un saludo

A: Es bastan sencilla la solución, lo que falta inicialmente en la lista es ponerle un nombre a cada elemento:
names(df.list) <- lista.archivos

Ahora cada elemento tendrá el nombre del archivo y cuando hagas df.final <- do.call("rbind", df.list), ese nombre será parte del rowname de cada fila, si eventualmente lo quieres como un nombre de columna:
df.final$archivo <- rownames(df.final)
rownames(df.final) <- NULL

También, un poco más sencillo, es leer los csv mediante sapply() que ya se toma el trabajo de nombrar los elementos de la lista:
df.list <- sapply(lista.archivos, read.csv)


text:
Q: Vertical cell alignment with Bootstrap 4 I'm creating an admin page that queries then reports on the page weights of key pages for a site (landing, etc.)
As Bootstrap 4 is close, I have used it to create a layout, which I'm happy with. However for each row, the text in a cell is not vertically aligned. I can do a simple right alignment with:
.cell { text-align: right; }

but I want to vertically align as well. I believe that Bootstrap 4 is using flexbox. Is there some way to do vertical text alignment in a cell using flex? My example is here on CodePen

A: They are already aligned , it's padding inside button that's making text non-aligned on second column w.r.t. first.
add follwing css to second column text :
padding: .375rem 0;
font-size: 1rem;
font-weight: 400;
line-height: 1.5;
vertical-align: middle;


text:
Q: Create a task with attachments in Asana using Asana api I am trying to send an image using Asana's API but it just attaches a blank file.
This is the code I have been using.
client.attachments.create_on_task(task_id=123456789,file_content="Url_of_file",file_name='Name_of_File',file_content_type="image/jpeg")

I have tried using different file formats like .txt and .png but for some reason the Asana API is blocking my requests.It just posts a black image on Asana.
I have tried to convert the file to base64 as well but it still doesn't work
In this original documentation(below), it shows that we need to pass two arguments;one for the file's content and the other for file itself ('file').
def create_on_task(self, task_id, file_content, file_name, file_content_type=None, **options):
        """Upload an attachment for a task. Accepts a file object or string, file name, and optional file Content-Type"""
        path = '/tasks/%d/attachments' % (task_id)
        return self.client.request('post', path, files=[('file', (file_name, file_content, file_content_type))], **options)

But when I am trying to pass the arguments for file and file content it shows me an error.
Can somebody please help me with this?

A: Another user on the Asana development forum had the same problem using the Curl API. (https://forum.asana.com/t/sending-file-with-api/16897/2). Apparently it has something to do with the 'multipart form upload'.
Looking through another thread here on stackoverflow (How to send a "multipart/form-data" with requests in python?), it seemed the file object had to be read in binary was all.
so the parameters would be:
client.attachments.create_on_task(task_id=<task id here>,file_content=open(filename_with_path, 'rb'),file_name='Name_of_File',file_content_type="image/jpeg")


text:
Q: get correct json output from c# class Please check from Json output i wanted using JavaScriptSerializer. Then check class helper i created using json2csharp.com. Problem is in controller. I am not getting correct output as per my required Jason. I am doing correct in controller? Where the problem can be? Please ask question if you want to know something specific, sorry its hard to describe more clearly.
Helper Class Code:
public class ItemsFromFile
    {
        public string ASIN { get; set; }
        public string Title { get; set; }
        public List<Product> products { get; set; }

    }

    public class ItemsDeatails
    {
        public List<ItemsFromFile> ItemsFromFile { get; set; }
    }

    public class File
    {
        public string nameLocator { get; set; }
        public ItemsDeatails itemsDeatails { get; set; }
    }

    public class RootObject
    {
        public string Token { get; set; }
        public File file { get; set; }
    }

Controller code:
if (type == "Salefreaks")
                {
            var token = ctx.BulkStores.FirstOrDefault(x => x.StoreName == store && x.Type == 1).Token;

            var ItemsFromFile = new ItemsFromFile()
                    {
                        products = new List<Product>()
                    };

                    var ItemsDeatails = new ItemsDeatails()
                    {

                    };

                    var File = new File()
                    {
                        nameLocator = "testimport1"
                    };

                    var RootObject = new RootObject()
                    {
                        Token = token
                    };

            var singleItems = ctx.BulkScannedItems.Where(x => x.UserSellerScanRequestId == id).ToList();

                    foreach (var item in singleItems)
                    {
                        ItemsFromFile.products.Add(new Product { ASIN = item.ASIN, Title = item.EbayTitle });
                    }

                    var json = new JavaScriptSerializer().Serialize(RootObject);
         }

Required Json Output code:
{
  "Token": "7f3099b0-36b1",
  "file": {
    "nameLocator": "testimport1",
     "itemsDeatails": {
      "ItemsFromFile": [
      {
         "ASIN": "B011KVFT9Y",
         "Title": "Disney Batman Durable Party Beach Outdoor Adventure Camp Chair w/ Storage Bag"
       },
       {
         "ASIN": "B01D4KRBW2",
         "Title": "High Quality Diy Oil Painting Paint Number Kit Theme-Romantic Street A Frameless"
       }
      ]
    }
  }
}

A: Ensure that all your objects are assigned appropriately.
var token = ctx.BulkStores.FirstOrDefault(x => x.StoreName == store && x.Type == 1).Token;

var RootObject = new RootObject() {
    Token = token,
    file = new File() {
        nameLocator = "testimport1",
        itemsDeatails = new ItemsDeatails() {
            ItemsFromFile = new List<ItemsFromFile>()
        }
    }
};

var itemsFromFile = new ItemsFromFile();
itemsFromFile.products = new List<Product>();

var singleItems = ctx.BulkScannedItems.Where(x => x.UserSellerScanRequestId == id).ToList();

foreach (var item in singleItems) {
    itemsFromFile.products.Add(new Product { ASIN = item.ASIN, Title = item.EbayTitle });
}

RootObject.file.itemsDeatails.ItemsFromFile.Add(itemsFromFile);

var json = new JavaScriptSerializer().Serialize(RootObject);

That being said, it appears that you do not need the list of products inside of the ItemsFromFile class. This definition likely makes more sense:
public class ItemsFromFile {
    public string ASIN { get; set; }
    public string Title { get; set; }
}

Then your code would be something like this:
var token = ctx.BulkStores.FirstOrDefault(x => x.StoreName == store && x.Type == 1).Token;

var RootObject = new RootObject() {
    Token = token,
    file = new File() {
        nameLocator = "testimport1",
        itemsDeatails = new ItemsDeatails() {
            ItemsFromFile = new List<ItemsFromFile>()
        }
    }
};

var singleItems = ctx.BulkScannedItems.Where(x => x.UserSellerScanRequestId == id).ToList();

foreach (var item in singleItems) {
    RootObject.file.itemsDeatails.ItemsFromFile.Add(new ItemsFromFile { ASIN = item.ASIN, Title = item.EbayTitle });
}

A: You can initialize internal objects in the code in the constructor as well.
   public class RootObject
    {
        public string Token { get; set; }
        public File file { get; set; }
    }

    public class File
    {
        public File()
        {
            this.itemsDeatails = new ItemsDeatails();
        }
        public string nameLocator { get; set; }
        public ItemsDeatails itemsDeatails { get; set; }
    }

    public class ItemsDeatails
    {
        public ItemsDeatails(){
         this.ItemsFromFile = new List<ItemsFromFile>();
        }
        public List<ItemsFromFile> ItemsFromFile { get; set; }
    }

    public class ItemsFromFile
    {
        public ItemsFromFile(){
         this.products = new List<Product>();
        }

        public List<Product> products { get; set; }

    }

    public class Product {
        public string ASIN { get; set; }
        public string Title { get; set; }
    }

Initialize your items properly. And create Root Object from the ground up.
 Populate the internal classes first and then later ones.
   var itemDetails = new ItemsDeatails();

    itemDetails.ItemsFromFile = new ItemsFromFile();
    var singleItems = ctx.BulkScannedItems.Where(x => x.UserSellerScanRequestId == id).ToList();

    foreach (var item in singleItems)
            {
                itemDetails.ItemsFromFile.products.Add(new Product { ASIN = item.ASIN, Title = item.EbayTitle });
            }

    var fl = new File(){
        nameLocator = "testimport1",
        itemsDeatails = itemDetails
    }

    var token = ctx.BulkStores.FirstOrDefault(x => x.StoreName == store && x.Type == 1).Token;

    var root = new RootObject()
    {
        Token = token,
        file = fl
    }

    var json = new JavaScriptSerializer().Serialize(root);


text:
Q: Docker app supposed to output json to a dir on a volume, when running no data show I am working on a docker app. The purpose of this repo is to output some json into a volume. I am using a Dockerfile, docker-compose and a Makefile. I'll show the contents of each file below. Goal/desired outcome is that when I run using make up that the container runs and outputs the json.
Directory looks like this:
docker-compose.yaml
Dockerfile
Makefile
main/ # a directory

Here are the contents of directory Main:
example.R

Not sure the best order to show these files. Throughout my setup I refer to a variable $PROJECTS_DIR which is a global on the host / local:
echo $PROJECTS_DIR
/home/doug/Projects

Here are my files:
docker-compose.yaml:
version: "3.5"
services:
  nextzen_ga_extract_marketing:
    build:
      context: .
    environment:
      start_date: "2020-11-18"
      start_date: "2020-11-19"
    volumes:
      - ${PROJECTS_DIR}/Zen/nextzen_google_analytics_extract_pipeline:/home/rstudio/Projects/nextzen_google_analytics_extract_pipeline

Dockerfile:
FROM rocker/tidyverse:latest
ADD main main
WORKDIR "/main"
RUN apt-get update && apt-get install -y \
    less \
    vim
ENTRYPOINT ["Rscript", "example.R"]

Makefile:
.PHONY: build
build:
        docker-compose build

.PHONY: up
up:
        docker-compose pull
        docker-compose up -d

.PHONY: restart
restart:
        docker-compose restart

.PHONY: down
down:
        docker-compose down

Here is the contents of the 'main' file of the Docker app, example.R:
library(jsonlite)
unlink("../output_data", recursive = TRUE) # delete any existing data from previous runs
dir.create('../output_data')
write(toJSON(mtcars), '../output_data/ga_tables.json')

If I navigate into ${PROJECTS_DIR}/Zen/nextzen_google_analytics_extract_pipeline/main and then run sudo Rscript example.R then the file runs and outputs the json in '../output_data/ga_tables.json as expected.
I am struggling to get this to happen when running the container. If I navigate into ${PROJECTS_DIR}/Zen/nextzen_google_analytics_extract_pipeline/ and then in the terminal run make up for:
docker-compose pull
docker-compose up -d

I then see:
make up
docker-compose pull
docker-compose up -d
Creating network "nextzengoogleanalyticsextractpipeline_default" with the default driver
Creating nextzengoogleanalyticsextractpipeline_nextzen_ga_extract_marketing_1 ...
Creating nextzengoogleanalyticsextractpipeline_nextzen_ga_extract_marketing_1 .

It 'looks' like everything ran as expected with no errors. Except no output appears in directory output_data as expected?
I guess I'm misunderstanding or misusing ENTRYPOINT in the Dockerfile with ENTRYPOINT ["Rscript", "example.R"]. My goal is that this file would run when the container is run.
How can I 'run' (if that's the correct terminology) my app so that it outputs json into /output_data/ga_tables.json?
Not sure what other info to provide? Any help much appreciated, I'm still getting to grips with docker.

A: If you run your application from /main and its output is supposed to go into ../output_data (so effectively /output_data), you need to bind mount this directory to have this output available on host. Therefore I would update your docker-compose.yaml to read something like this:
    volumes:
      - /path/to/output_data/on/host:/output_data

Bear in mind however that your script will not be able to remove /output_data when bind-mounted this way, so you might want to change your step to removing directory contents and not directory itself.

A: In my case, I got this working when I used full paths as opposed to relative paths.


text:
Q: Use PreparedStatement with Sqlbrite I'm migrating all my sql related codes to use Sqlbrite. Currently I have code that look something like this:
Cursor cursor;
String name;
String[] selectionArgs = { name };
cursor = database.query(MySQLiteHelper.TABLE_USER, new String[] {"id"}, "name = ? COLLATE NOCASE AND ", selectionArgs, null, null, null);

Now I need to use SqlBrite, but I want to use Prepared Statement with it. Is there any way I can do this? I googled 'SqlBrite PreparedStatement' but couldn't find anything regarding this.

A: yes, you can use executeInsert and executeUpdateDelete on your instance of BriteDatabase. They accept a SQLiteStatement as a parameter.


text:
Q: Gird Boxes Intersected by a Circle General Questions: Given a circle on a grid, what are the coordinates of the boxes it intersects?
Okay, I'm trying to figure out how to create a square circle basically, for example, given the google image circle below:

I want to find the following (apologies for my ms paint) (red point is an example; I want all the boxes):

where the grid boxes are where coordinates are located, instead of at the intersections of the grid lines.
I'm currently using the circle equation:
$x = cx + r * cos(θ)$
$y = cy + r * sin(θ)$
(where $(cx, cy)$ is the center, $r$ is the radius, and $θ$ is the angle)
to obtain points on the circle. I wrote a program to test a bunch of radii, but it does not check for boxes, it uses the traditional coordinate plane, checks a whole bunch of angles, and spits out the number of unique points of the form $( ⌊x⌋, ⌊y⌋)$. The number of unique points appears to be equal to $8r$, but this is the number of unique floored points (not boxes). The above circle intersects 44 boxes. My overall goal, however, is to obtain the coordinates of each box intersected, rather than the number, and that is where I'm stuck. I think that what I need to do is calculate an angle interval, and then check every angle between $0$ and $360$ by adding the interval to $0$ some number of times. So, to sum things up, I need help calculating the coordinates of the grid boxes intersected by a circle (with known radius and center), and I think I can do this by using the parametric equation and an angle interval. Any help is appreciated!


text:
Q: Parse error in Android 5.0 , working in previous versions I have an apk to download from a website. It works fine in Android 4, but when I downloaded it with an Android 5.0 device, I got the typical error:
Parse Error
There was a problem while parsing the package
Can anyone shed a bit of light on what is happening?
My server code to get the apk file (I don't want to place the apk file directly to download in website):
InputStream is = ApkDownloadController.class.getResourceAsStream("/apk/fileName.apk");
        try {

        response.addHeader("Content-Description", "File Transfer");
        response.addHeader("Content-Type", " application/vnd.android.package-archive");
        response.addHeader("Content-Disposition", "attachment; filename=apkName.apk");
        response.addHeader("Content-Transfer-Encoding", "binary");

        ServletOutputStream out = response.getOutputStream();
        byte[] outputByte = new byte[4096];
        // copy binary contect to output stream
        while (is.read(outputByte, 0, 4096) != -1) {
            out.write(outputByte, 0, 4096);
        }
        is.close();
        out.flush();
        out.close();

Thanks all!


text:
Q: IBM ODM 8.8 - Error updating dynamic domain in DE (teamserver) I've implemented a dynamic domain that retrieves values from a database. I've repackaged the EAR file and redeployed at WAS successfully. I'm using ODM 8.8.
When I try to reload the domain at teamserver, I'm getting the following error:
javax.faces.FacesException: Error calling action method of component with id paneForm:asynchAction
     at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:72)
     at javax.faces.component.UICommand.broadcast(UICommand.java:109)
     at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
     at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
     at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.java:32)
     at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:95)
     at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:70)
     at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1232)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:781)
     at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:480)
     at com.ibm.ws.webcontainer.servlet.ServletWrapperImpl.handleRequest(ServletWrapperImpl.java:178)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.invokeTarget(WebAppFilterChain.java:136)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:97)
     at ilog.rules.teamserver.web.security.SecurityCheckPointFilter.doFilter(SecurityCheckPointFilter.java:118)
     at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
     at ilog.rules.teamserver.web.servlets.filter.IlrAccessFilter.doFilter(IlrAccessFilter.java:198)
     at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
     at ilog.rules.teamserver.web.servlets.filter.IlrRemoteSessionFilter.doFilterInternal(IlrRemoteSessionFilter.java:88)
     at ilog.rules.teamserver.web.servlets.filter.IlrRemoteSessionFilter.doFilter(IlrRemoteSessionFilter.java:66)
     at ilog.rules.teamserver.web.servlets.filter.IlrSessionFilter.access$001(IlrSessionFilter.java:32)
     at ilog.rules.teamserver.web.servlets.filter.IlrSessionFilter$1.doFilter(IlrSessionFilter.java:62)
     at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
     at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:106)
     at ilog.rules.teamserver.web.servlets.filter.IlrSessionFilter.doFilter(IlrSessionFilter.java:60)
     at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
     at ilog.rules.teamserver.web.servlets.filter.IlrFileUploadFilter.doFilter(IlrFileUploadFilter.java:45)
     at com.ibm.ws.webcontainer.filter.FilterInstanceWrapper.doFilter(FilterInstanceWrapper.java:195)
     at com.ibm.ws.webcontainer.filter.WebAppFilterChain.doFilter(WebAppFilterChain.java:91)
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.doFilter(WebAppFilterManager.java:967)
     at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:1107)
     at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:87)
     at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:940)
     at com.ibm.ws.webcontainer.WSWebContainer.handleRequest(WSWebContainer.java:1817)
     at com.ibm.ws.webcontainer.channel.WCChannelLink.ready(WCChannelLink.java:200)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:463)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.handleNewRequest(HttpInboundLink.java:530)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.processRequest(HttpInboundLink.java:316)
     at com.ibm.ws.http.channel.inbound.impl.HttpInboundLink.ready(HttpInboundLink.java:287)
     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:214)
     at com.ibm.ws.tcp.channel.impl.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:113)
     at com.ibm.ws.tcp.channel.impl.AioReadCompletionListener.futureCompleted(AioReadCompletionListener.java:175)
     at com.ibm.io.async.AbstractAsyncFuture.invokeCallback(AbstractAsyncFuture.java:217)
     at com.ibm.io.async.AsyncChannelFuture.fireCompletionActions(AsyncChannelFuture.java:161)
     at com.ibm.io.async.AsyncFuture.completed(AsyncFuture.java:138)
     at com.ibm.io.async.ResultHandler.complete(ResultHandler.java:204)
     at com.ibm.io.async.ResultHandler.runEventProcessingLoop(ResultHandler.java:775)
     at com.ibm.io.async.ResultHandler$2.run(ResultHandler.java:905)
     at com.ibm.ws.util.ThreadPool$Worker.run(ThreadPool.java:1881)
 Caused by: javax.faces.el.EvaluationException: Exception while invoking expression #{SelectionBean.asynchAction}
     at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:156)
     at org.apache.myfaces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:61)
     ... 51 more
 Caused by: java.lang.RuntimeException: javax.transaction.RollbackException
     at ilog.rules.teamserver.transaction.IlrConnectionHolderJTA.closeConnection(IlrConnectionHolderJTA.java:112)
     at ilog.rules.teamserver.transaction.IlrConnectionHolderJTA.popTx(IlrConnectionHolderJTA.java:55)
     at ilog.rules.teamserver.transaction.IlrTransactionManager.endTransaction(IlrTransactionManager.java:106)
     at ilog.rules.teamserver.transaction.IlrTransactionalInvocationHandler.invoke(IlrTransactionalInvocationHandler.java:47)
     at com.sun.proxy.$Proxy308.reloadDynamicDomains(Unknown Source)
     at ilog.rules.teamserver.model.impl.IlrAbstractSession.reloadDynamicDomains(IlrAbstractSession.java:1953)
     at ilog.rules.teamserver.web.beans.DynamicDomainsBean.reloadDynamicDomains(DynamicDomainsBean.java:66)
     at ilog.rules.teamserver.web.beans.SelectionBean.asynchAction(SelectionBean.java:521)
     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
     at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:95)
     at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:56)
     at java.lang.reflect.Method.invoke(Method.java:620)
     at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java:132)
     ... 52 more

The domain works fine at Rule Designer. I also know that my class that implements IlrBOMDomainValueProvider is called because I added some logs. Besides, when I select the option read to be updated and I really have a domain updated, the domain is shown at the list. The error just occurs when I try to update the domain clicking on the Update button.
Does anyone have any idea to help me with this error?


text:
Q: Is there any license restriction to avoid binary translation of CIL to custom bytecode? Prior to actual question, let me summarize what I'm trying to do. I plan to implement a small, JIT-enabled, register-based VM runtime. Instead of making a proper compiler (which is hard IMO) for a super-fancy home-brew language, I decided to implement a binary translator from a appropriate bytecode (much like Dalvik VM approach). Considering CIL vs. Java bytecode, CIL is best for my needs.
As a note, I wanted to list some important things to avoid possible confusions:

*

*Base Core Library (BCL) or any Microsoft specific assemblies won't be decompiled and translated. Instead, BCL references will be subject to substitution with my VM specific codes at translation phase (much like COSMOS Plugs approach).

*All CIL opcodes won't be translated. So, directly using CIL is not an option.

*"Any" .NET executable is not targetted for translation. .NET will be a tool, not target.

*Dalvik VM is good example what I'm trying to do. In Dalvik case, programs are written in Java, but Java byte codes translated into Dalvik opcodes. In my case, programs will be written in .NET, but CIL will be translated into "fancy" VM opcodes.

*Custom VM itself will be closed source and it will be in a free software initially. But, in time, it might be used in open source and/or commercial projects.

So, is there any license restriction to avoid me doing this? If so, how can I avoid the restrictions? Making only non-profit applications or making it open source?
EDIT: I won't use CLI, CLR or any other thing which is distributed from Microsoft. I won't redistribute or integrate SSCLI into my applications either. The question is about translating CIL code into custom byte codes which will be done with my own tools. So, it's actually decompilation of my own custom .NET executables into a different byte codes to serve my needs in production phase. So, essentially I'll use .NET compilers as a front-end for my decompiler, but I won't redistribute .NET compilers either.
EDIT2: CLI AND CIL ARE DIFFERENT THINGS!

A: If i had understood your question correctly i think all you are saying is that you will create your own system (compiler or Virtual machine) which takes CIL byte codes and do something interesting. This do something can be of course translating into executable or another IL which is later interpreted.
Now the question really is - the CIL being a Microsoft intellectual property will they sue you?
The wiki link of Mono provides some interesting links on this; Accordingly,

When Microsoft first announced their .NET Framework in June 2000 it
  was described as "a new platform based on Internet standards", and
  in December of that year the underlying Common Language Infrastructure
  was published as an open standard, "ECMA-335" - opening up the
  potential for independent implementations.

Here is the home for this reference. The Microsoft's development center's page gives good details. According to this CIL instruction set is part (part III) of the specs in overall CLI standard. The site also mentions that there are following companies involved in developing this standard.

Many of the organizations that have participated in the TC39/TG2 and
  TC39/TG3 work have volunteered to mirror this site. The links for the
  mirror sites are:
Intel Corporation,
  ISE (Eiffel),
  IT University, Copenhagen
  Kahu Research, New Zealand
  Microsoft Corporation
  Novell (Mono)

According to same wiki reference:

On July 6, 2009, Microsoft announced that it was placing their ECMA
  334 and ECMA 335 specifications under their Community Promise pledging
  that they would not assert their patents against anyone implementing,
  distributing, or using alternative implementations of .NET

Now based on all above research, we can say that - given that the ECMA is an open standard, you can actually do legally what you propose to do.
NOTE: there are some component not included in this spec. Also, using .NET CLR itself is not part this discussion.
DISCLAIMER: But yes, great many details go in legality. So since i am not lawyer, my advise to you is for free but without any warranty! :)


text:
Q: Some questions about curved spacetime QFT I'm reading Winitzki's Introduction to Quantum Effects in Gravity and I get some questions:

*

*In the remark of section 8.3, Page 105. When we calculate the energy-momentum tensor in Rindler space, because
$$
<0_R|(\partial_u \hat{\phi})^2|0_R>
$$
is singular on the future horizon at $u=0$ so the Rindler vacuum is a singular state. Here why should the energy-momentum contain the term $\partial_u \hat{\phi}$? $u$ is the coordinate in Minkovski spacetime and I think the EMT in Rindler spacetime should be in terms of $\partial_{\tilde{u}} \hat{\phi}$

*In equation (8.45) the delta function $\delta (0)$ should the volume of the V. But it comes from
$$
\int d\tilde{u}
$$
in the equation (8.38) and I think it doesn't make sense to interpret it as volume which should be
$$
\int dx
$$
3.About the Hawking effect in section 9.1, page 117. It is said that a non-external black hole formed as a result of collapse need not to consider the left-moving(outgoing) modes $u$ on the past light-like infinity. Also other lectures about Hawking effect also expand the field on the past light-like infinity only in terms of ingoing modes $v$, and on the future light-like infinity in terms of outgoing modes $v$. I get confused about that. They are modes and they are not particles. If I expand the field both in terms of $v$ and $u$ then what is going wrong?
They may be some naive questions. Thank you! :)


text:
Q: The Fortran compiled using Visual Studio Code on Mac causes "library not found for -lSystem" I tried to compile my code in Fortran by Visual Studio. I coded an easy example.
program fortran
    implicit none
    character*20 :: name
    print*,"what is your name"
    read *, name
    print *,"Hello ", name
end program fortran

But it can't execute on my Mac terminal. The error message is: '
ld: library not found for -lSystem
collect2: error: ld returned 1 exit status

I also noticed that on my right bottom corner of VS, it shows the active environment is not selected. I guess maybe it is related to the issue?  Plus, I also downloaded the intelapi toolkit.
So what should I do now?


text:
Q: Undefined variable in upload script I get following errors and I don't know why.
Notice: Undefined index: uploaded in C:\xampp\htdocs\site\upload.php on line 3
Notice: Undefined variable: uploaded_size in C:\xampp\htdocs\site\upload.php on line 7
Notice: Undefined variable: uploaded_type in C:\xampp\htdocs\site\upload.php on line 14
Notice: Undefined index: uploaded in C:\xampp\htdocs\site\upload.php on line 29

I tried to include the source of the php in this post but couldn't.
Here is link to pastebin: My source code
<?php
 $target = "upload/";
 $target = $target . basename( $_FILES['uploaded']['name']) ;
 $ok=1;

 //This is our size condition
 if ($uploaded_size > 350000)
 {
 echo "Your file is too large.
";
 $ok=0;
 }

 //This is our limit file type condition
 if ($uploaded_type =="text/php")
 {
 echo "No PHP files
";
 $ok=0;
 }

 //Here we check that $ok was not set to 0 by an error
 if ($ok==0)
 {
 Echo "Sorry your file was not uploaded";
 }

 //If everything is ok we try to upload it
 else
 {
 if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
 {
 echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded";
 }
 else
 {
 echo "Sorry, there was a problem uploading your file.";
 }
 }
 ?>

Edit 1 : I got the code from about.com about.com

A: 1.) In your $FILES array, there's no uploaded index defined. Possibly because it's $_FILES That's the first one. Try

print_r($FILES);
print_r($_FILES);

to see what is in there.
2.) ¿Where are you initializing those variables being used in the conditionals? You must extract data from the file element in the array and assign it to the variables before using it.

A: The first notice is telling you that on this line:
$target = $target . basename( $_FILES['uploaded']['name']) ;

There is no 'uploaded' index into the $_FILES array because no file was uploaded in a form with the file input named uploaded.
The next notice is telling you that on this line:
if ($uploaded_size > 350000)

You are accessing a variable named $uploaded_size which has never previously been defined, so how could it possibly hold some value greater than 350000?
Same issue with the next two notices. You seem to be missing some code, and are testing code for handling uploaded files without uploading a file, or without using a form with the enctype and input names it expects.

A: If you find that the $_FILES array does not contain any reference to your uploaded file, make sure your form tag includes enctype="multipart/form-data".


text:
Q: Yii2 populating dropdownlist using pjax I already updated my question here. The pjax is working now and reloading the specific container but the modal doesn't close. I don't have any idea what is the problem. Can someone help me?
modal.php
$this->registerJs(
'jQuery(document).ready(function($){
$(document).ready(function () {
    $("body").on("beforeSubmit", "form#form-person", function () {
        var form = $(this);
        if (form.find(".has-error").length)
        {
            return false;
        }
        $.ajax({
            url    : form.attr("action"),
            type   : "post",
            data   : form.serialize(),
            success: function (response)
            {
                $("#modalOfficials").modal("toggle");
                $.pjax.reload({container:"#for_from"}); //for pjax update
            },
            error  : function ()
            {
                console.log("internal server error");
            }
        });
        return false;
     });
    });
});');
?>

<?php yii\widgets\Pjax::begin(['id' => 'sign-up']) ?>
<?php $form = ActiveForm::begin(['id' => 'form-person', 'options' => ['data-pjax' => true]]); ?>
<?= $form->field($model, 'position')->textInput(['maxlength' => true]) ?>

<?= $form->field($model, 'fname')->textInput(['maxlength' => true]) ?>

<?= $form->field($model, 'mname')->textInput(['maxlength' => true]) ?>

<?= $form->field($model, 'lname')->textInput(['maxlength' => true]) ?>

    <?= Html::submitButton($model->isNewRecord ? 'Add' : 'Update', ['class' => $model->isNewRecord ? 'btn btn-success' : 'btn btn-primary', 'style' => 'width: 100%; padding: 10px 30px;']) ?>

<?php ActiveForm::end(); ?>
<?php yii\widgets\Pjax::end() ?>

A: I already solved my own question! The codes are correct. There is no problem in the codes. However, it doesn't working because of the conflicts of the two jquery libraries. Can someone give me an idea on how to solve it?

A: You do not need pjax if you are going to use jquery to run an ajax jquery. Just have it update the select element on success.
success: function (response)
            {
            var myOptions = response.data
            $.each(myOptions, function(val, text) {
            $('#select').append(
                $('<option></option>').val(val).html(text)
           );
});
            }


text:
Q: Is it possible to extract a superclass in Enterprise Architect? I would like to extract a super class from an existing class in my Class Diagram and was wondering if this is possible in Enterprise Architect?

A: No, not out of the box.
But EA comes with a scripting module, so you could script something.


text:
Q: debug a custom windows print processor? Working with the Windows Driver Development Kit sample package (v 8.1), I found a sample print processor implementation that I tried to use as a starting point for my own custom print processor ("GenPrint Print Processor Sample"). I managed to successfully build it in Visual Studio 2017 Community (changing PlatformToolset to "v141"), and I'm apparently able to successfully install it (by creating the registry item, "HKLM:\SYSTEM\CurrentControlSet\Control\Print\Environments\Windows x64\Print Processors\genprint" with item property "Driver" and value "genprint.dll", and copying the freshly built dll to %WinDir%/System32/spool/prtprocs/x64/). I can then set up a test printer and select my "genprint" print processor using Printer Properties > Advanced > Print Processor..., and I can even attach to the spooler process, spoolsv, from my debugger in Visual Studio and set a breakpoint in EnumPrintProcessorDatatypesW(...), and see it get hit when I reopen the Print Processor dialog for my test printer. So far, so good!
The problem comes when I set a breakpoint anywhere else, and queue up an actual job to the printer queue. Say at the beginning of OpenPrintProcessor(...). Or PrintDocumentOnPrintProcessor(...), or, you name it. Nothing, nada, zilch. It seems these functions are just never called at all, at least not the implementations exported by my DLL. I even resorted to inserting event logs ala Event Tracing for Windows (ETW) at the beginning of every function exported by the DLL, but the only logs ever generated are the ones for EnumPrintProcessorDatatypesW(...).
What on Earth might be going on?? Is it possible that, for some odd reason, the spooler is using a different print processor than mine, even though I explicitly associated mine with the print queue in question? And if so, why?
[Update: it looks like the behavior I'm seeing is down to "print driver isolation"; when I change the isolation mode for the driver associated with the queue to "None", then I can attach to the spoolsv process. Otherwise, my print processor is running in a separate process communicating with spoolsv via DCOM, as described at: https://blogs.technet.microsoft.com/askperf/2009/10/08/windows-7-windows-server-2008-r2-print-driver-isolation/ -- I'm guessing the system-wide default has been changed to use print driver isolation since post-Windows 7, unless you explicitly configure the driver to "None" (or it configures itself that way)]


text:
Q: Tumblr xAuth without oauth2 lib I'm working on a plugin for Autodesk Maya. The application's Python libraries aren't in the same location as the normal python libraries (Maya uses Python 2.6.4). Basically, the 3D artists are neither willing nor able to install oath2 to the correct location on their machines. Its equally likely that I'm ignorant of a way to do this for them.
Ultimately, I would like to be able to allow the 3D artists to download a simple python file, run it, sign in and click a button that uploads an update of what they're working on. I've already gotten an email version working - smpt doesn't have nearly as many hoops to jump through (not that that's necessarily a good thing).
Is there any way to deliver the functionality of the oauth2 module without having to do some complicated install? Do you know of any ways to bundle the oauth2 module without having to go through an installation process? My google-fu has failed me on these points thus far.

A: Modify ez_setup.py (also see this post), include everything up to the long line gap.
Then put:
use_setuptools()

from setuptools.command import easy_install
easy_install.main( ["oauth2"] )
from pkg_resources import require
require('oauth2')

Add whatever you need after this. Possible problems:

*

*user needs possibly to be admin (this could be circumvented but if the artist does not have admin then its not really their business to install stuff  anyway)

*clicking not possible user has to actually run the script inside maya with
script editor -> load script

*installer may be easier

*I did not actually have time to test this porperly

PS: Not all mayas run python 2.6.4


text:
Q: php - mysql avoid sql injections I have many functions like
updateUser($id,$username,$email)
updateMusic($id, $music)

etc...
Is there a generic function to avoid SQL injections ?
I just want to avoid using mysql_real_escape_string for each parameter I have
$username = mysql_real_escape_string($username);
$email= mysql_real_escape_string($email);
$music= mysql_real_escape_string($music);

A: *

*ALWAYS use prepared statements

*Do NOT use mysql driver, use mysqli or PDO

A: You should use parameterization and let the database driver handle it for you, i.e. with PDO:
$dbh = new PDO('mysql:dbname=testdb;host=127.0.0.1', $user, $password);
$stmt = $dbh->prepare('INSERT INTO REGISTRY (name, value) VALUES (:name, :value)');
$stmt->bindParam(':name', $name);
$stmt->bindParam(':value', $value);

// insert one row
$name = 'one';
$value = 1;
$stmt->execute();

Code from  Bobby-Tables.

A: you may use,
list($id,$music) = array_map('mysql_real_escape_string',array($id,$music))

but prepared statements rocks

A: No there isn't, but you can parse all your inputs ( eg. GET and POST ) at beggining of the script


text:
Q: VB.NET 4.0: ThreadStatic doesn't appear to be thread safe for my TdConnection property Here's my code:
<ThreadStatic()>
Dim _GlobalConnection As TdConnection

Public Property GlobalConnection As TdConnection
    Get
        If _GlobalConnection Is Nothing Then
            _GlobalConnection = New TdConnection
        End If
        If _GlobalConnection.State <> ConnectionState.Open Then
            OpenConnection(_GlobalConnection)
        End If
        Return _GlobalConnection
    End Get
    Set(ByVal value As TdConnection)
        _GlobalConnection = value
    End Set
End Property

It's in a module within an ASP.NET web app, so all members are shared/static by definition.  My goal here is essentially laziness.  I use connections everywhere, so it just made sense to have one property that is thread static so that it serves as a new instance per thread instead of dimming a new connection object every time I want to use it.
This seems to have been working until I decided to load the same page in two separate browsers.  When I do this, an exception is thrown that states the connection object is already in use.
I read in a Microsoft article that instance types are not guaranteed to be thread safe.  If this is the case, what can I do to ensure that this property and its field are thread safe?
Edit: What has be confused is that this code works within the page load event:
Dim Tasks As New List(Of Task)

Tasks.Add(Task.Factory.StartNew(Sub() ucEmployee.LoadData()))
Tasks.Add(Task.Factory.StartNew(Sub() ucSales.LoadData()))
Tasks.Add(Task.Factory.StartNew(Sub() ucServers.LoadData()))
Tasks.Add(Task.Factory.StartNew(Sub() ucApps.LoadData()))

Task.WaitAll(Tasks.ToArray())

Each one of those .LoadData() methods is executed in a separate thread and all of them reference my GlobalConnection property above.  I initially wrote all that without the ThreadStatic attribute.  After encountering errors, I made the GlobalConnection property ThreadStatic and the problem went away.  When this rolls out into production, this web app will be used by multiple people.  This is what prompted me to open the same page in two web browsers.  I thought that would have been two separate threads right there, but perhaps I am wrong about that.

A: You should have one connection per request instead of one per thread.
To do that, store it in HttpContext.Current.Items instead of the ThreadStatic field.
You should also close the connection in an EndRequest handler.

A: It's not working because it's not static, it needs to be static for the ThreadStatic attribute to apply


text:
Q: Set color item listview xml i've a Navigation Drawer and i would like that when i click on an item of the listview this change color. So i've this xml code.
<?xml version="1.0" encoding="utf-8"?>

    <android.support.v4.widget.DrawerLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:id="@+id/navigation_drawer"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

    <FrameLayout
        android:id="@+id/container"
        android:layout_width="match_parent"
        android:layout_height="match_parent"/>

    <ListView
    android:id="@+id/listview"
        android:layout_width="240dp"
        android:layout_height="match_parent"
        android:layout_gravity="start"
        android:choiceMode="singleChoice"
        android:textColor="@drawable/test"
        android:divider="@null"
        android:dividerHeight="0dp"
        android:background="#2F2F2F"/>

</android.support.v4.widget.DrawerLayout>

Test code is
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">

    <item android:state_selected="true" android:color="@android:color/black"/>
    <item android:state_focused="true" android:color="@android:color/black"/>
    <item android:state_pressed="true" android:color="@android:color/black"/>
    <item android:color="@android:color/black"/>

</selector>

But when i click remain the default color and not change in black. Why? Where is the problem and how can i fix it? Thanks in advance.

A: It's because you are changing the textColor of a textView not the view inside the ListView. It's not like css.
You must put android:textColor="@drawable/test" inside the TextView (or whatever view it is)

A: use android:listSelector="color/black" in your listview. Refer here


text:
Q: Splitting list in list and converting list into an integer list I am trying to spilt the following list so that I can use it for further purposes:
How to split ['1,1','2,2'] into [1,1,2,2] in python?

A: This list comprehension would work -
s = ['1, 1', '2, 2']
print [int(j) for i in s for j in i.split(',')]

Output
[1, 1, 2, 2]

A: Join the list on ',' and then split it back up and map to integers:
>>> l = ['1,1', '2,2']
>>> list(map(int, ','.join(l).split(',')))
[1, 1, 2, 2]


text:
Q: C# : dynamic polymorphism with non polymorphic classes I have a set of classes which I didn't write, and they're read only.
Let's say, for the example, that those classes are the following ones:
public class Base { }
public class B : Base { }
public class C : B { }
public class D : Base { }

I want to add a method Foo() on all these classes, I am using extension methods:
public static class Extensions {

  public static void Foo(this Base obj) {
      dynamic dynobj = obj;
      try {
        dynobj.Foo();
      }
      catch (RuntimeBinderException ex) {
          Console.WriteLine(ex.Message);
      }
  }

  public static void Foo(this B b) {
      Console.WriteLine("Foo in B");
  }

  public static void Foo(this C c) {
      Console.WriteLine("Foo in C");
  }

}

As you can see, I'm trying to use the keyword dynamic, expecting it know the real type of my object and call its Foo() method. But...  dynobj.Foo() always fails.
static void Main(string[] args) {
    List<Base> list = new List<Base>();
    list.Add(new B());
    list.Add(new C());
    list.Add(new D());

    list.ForEach(x => x.Foo());
}

I know I could use the Adaptor pattern, but I really have too many classes.
Is it a good idea to do that with dynamic? Is it possible to make this work?
Thank you.

A: This is because Foo never gets added as a method.  Extension methods are still just static methods in static classes, not actually associated directly with the class in question.  They are not like mix-ins (ruby).  The compiler just translates what looks like a call on your object to the static method.
Same as calling: Extensions.Foo(thing)
My best advice is to create a lookup table (Dictionary) that you can register the different versions of Foo.
Something like this (untested), perhaps?
public static class Extensions {

  private static Dictionary<Type, Action<Base>> callFoo = new Dictionary<Type, Action<Base>>
  {
    {typeof(B), b => (b as B).Foo()},
    {typeof(C), b => (b as C).Foo()}
  };

  public static void Foo(this Base obj) {
      try {
        callFoo[typeof(obj)](obj);
      }
      catch (RuntimeBinderException ex) {
          Console.WriteLine(ex.Message);
      }
  }

  public static void Foo(this B b) {
      Console.WriteLine("Foo in B");
  }

  public static void Foo(this C c) {
      Console.WriteLine("Foo in C");
  }

}

A: I sort of resolved my problem by keeping only Base' Foo() extension method and making the other extensions methods regular static methods taking B, C or D as a parameter.
 public static void Foo(this Base obj) {
      try {
        Foo_(obj as dynamic);
      }
      catch (RuntimeBinderException ex) {
          Console.WriteLine(ex.Message);
      }
  }

  private static void Foo_(B b) {
      Console.WriteLine("Foo in B");
      b.ListOfBs.ForEach(x => x.Foo());
  }

  private static void Foo_(C c) {
      Console.WriteLine("C.Name = {0}", c.Name);
  }

A: There's yet another reason why your solution wouldn't be a great idea - Base isn't defined as an abstract class, so there's a chance someone could instantiate it and, even if your technique worked, run into a stack overflow if they tried to call its Foo() method.
If you take away Base's Foo() method, does Foo() not get called as expected (does calling an instance of class C's Foo() extension method end up reaching B's Foo() extension method)?
If it doesn't work, you can always be old-fashioned and create wrapper classes.


text:
Q: CSS Box Formatting - Overlapping Issue I'm working on a blog section of my homepage and having issues with the formatting. I want to display two blocks in the same row(side by side) and I want that row to stay in the normal flow of the page. To do this I have both of the boxes in a container box.
Relevant code:

#container1 {
  display: block;
  position: static;
  margin-bottom: 20px;
  border-width: 1px;
  border-style: solid;
}
#pgPhoto {
  padding: 10px;
  display: inline-block;
  width: 20%;
  border-width: 10px;
  border-style: outset;
}
#statement {
  padding-left: 30px;
  padding-right: 30px;
  display: inline-block;
  float: right;
  border-width: 10px;
  border-style: outset;
}
#post1 {
  display: block;
  border-width: 10px;
  border-style: outset;
}

    <p1>
      Statement: Some Text
    </p1>

The post1 block overlaps the boxes above when they're floated. From what I understand this would be normal because they're taken out of the normal flow and the way around this is to make a container box that includes both of the side-by-side boxes. But it seems like floating the boxes inside of the container block also takes the container block out of the flow? Also is "display: inline-block;" supposed to make blocks display side-by-side? Because I can't get that to work properly either.


text:
Q: DoubleValue and FloatValue Implementation I am looking at the Apache Flink source code and reading the flink-core module. I don't understand why DoubleValue and FloatValue do not implement the NormalizableKey interface, but IntValue does.

A: The NormalizableKey interface defines methods to generate a fixed-length binary prefix key, i.e., a byte sequence. The purpose of the prefix key is to directly compare values on the raw bytes without expensive object deserialization.
Such a fixed-length prefix key is trivial to obtain for integer values such as Integer, Long, and, Short. However, the binary representation of floating point values (Float, Double) differs from integer values and consists of three parts: an exponent, a fraction, and a sign bit. Due to this representation floating point values can cover a huge value range (at the cost of precision). A binary representation for floating point values that can be compared without deserialization is not as easy to define as for integer values. Moreover, the most common use cases for normalized keys are grouping or joining. Since these operations require object equality, they are less common for floating point values.
That is why FloatValue and DoubleValue do not implement the NormalizableKey interface. Normalized keys would be beneficial for sorting data on floating point values.


text:
Q: Msg 102, Level 15, State 1, Line 3 Incorrect syntax near ',' I keep getting this error for this very simple insert:

Msg 102, Level 15, State 1, Line 3
  Incorrect syntax near ','.

INSERT INTO dbo.Players (ID_Player, Last_Name, First_Name, Position )
VALUES
(039,   'Astacio '  ,   'Pedro' , ' P ' ),
(040,   'Atchison'  ,   'Scott' , ' P ' ),
(041,   'Ayala'     ,   'Benny' , ' OF' );
GO

What is wrong?

A: If you want to do it in one statement then use select/union:
INSERT INTO dbo.Players (ID_Player, Last_Name, First_Name, Position)
select 039,   'Astacio ',  'Pedro', ' P ' union
select 040,   'Atchison',  'Scott', ' P ' union
select 041,   'Ayala'   ,  'Benny', ' OF';
GO


text:
Q: Why don't we have a better telescope than the Hubble Space Telescope? The Hubble Space Telescope (HST) was launched in 1990, more than 20 years ago, but I know that it was supposed to be launched in 1986, 24 years ago. Since it only took 66 years from the fist plane to the first man on the Moon why don't we have a better telescope in space after 24 years?

A: The key reason why there will never be a next-generation optical telescope in space is: adaptive optics.
In 1978 when funding for the HST started, adaptive optics was in its infancy. Only in the 1990's when computer technology had sufficiently advanced, did adaptive optics really take off. Modern earth-bound telescopes with adaptive optics are far more capable than anything we can bring into orbit at comparable costs.
To give you an idea: the European Extremely Large Telescope (E-ELT) sports a 1000 square meter light gathering area, and will be build and operated for a very tiny fraction of the 10+ billion USD total price tag of the HST (with a mere 4.5 square meter light gathering area).
It simply makes no sense anymore to send optical telescopes in space. This is different for telescopes operating at non-optical wavelengths for which the atmosphere has a low transmissibility. COBE, WMAP and Planck all operate at microwave wavelengths, Chandra at X-ray wavelengths, and the JWST is designed for infrared wavelengths,

A: A big reason is that through subsidized servicing missions the Hubble has been substantially upgraded over the years. Very few of the original HST instruments remain, and that has resulted in a dramatic expansion of the science gathering capabilities of Hubble over time.
Also, there has been a Hubble successor in the works for quite some time. The JWST is far larger and far more capable than the Hubble in many ways (although it lacks some capabilities the HST has, such as UV and full visible light coverage) but it is a hugely expensive project that is substantially over budget and behind schedule. But once it gets into space people won't be asking this question any more.

A: Money and willpower.  With any program (scientific, military, public works, etc.) it all depends on the amount of money someone is willing to put to it, and how much backing and protection that program has from getting money re-prioritized to other projects.  You are making a false dichotomy of attempting to present our past actions as a justification for actions we should have been able to take.  With the decisions made on many levels (i.e. to fight several wars, cancel various lift vehicle programs, etc.) that just doesn't translate very well.  Keep in mind that getting to the moon was all part of the "Space Race" which had many layered motivations, with science perhaps only being a side benefit to the projects.
The James Webb Telescope is the next generation telescope that is due to go up.  Although, the JWST is optimized for the infrared spectrum.  For visible spectrum telescopes, the most ambitions space based one planned is the Terrestrial Planet Finder.  However, the Hubble is still the belle of the ball.
This of course doesn't touch on the ground based observatories we have, some of which are truly spectacular!  I want to make a family vacation to Chile just to see some of them!

A: We do have larger telescopes, but they are located on the surface of Earth. The Hubble represents the largest aperture optical telescope which would fit in the shuttle's cargo bay, which was the main design limitation. We also have more modern telescopes in orbit, but they use different spectral ranges that the Hubble.

A: Given that HST already exists, it's been true for a long time that there is more scientific "bang for the buck" in building instruments whose strengths correspond to HSTs limitations, rather than trying to build an instrument that has the same strengths, but better. There are many telescopes and instruments that see different wavelengths, have wider apertures, or much larger fields of view, and so can do science that HST cannot.
Would a "Hubble but better" be a fantastic scientific instrument? Absolutely! But with the HST already there, you can probably get a better scientific return by building other, more complementary instruments.


text:
Q: How to access an array when it is within an arraylist? The overall goal of what I'm trying to do is to compare a string to index 0 of an array (that is held within an arraylist), and if the strings are the same (ignoring case), call a method that matches the case of the string to the translated word (held at index 1 of the array inside an arraylist). When I run this code and I print out the contents of my translated arraylist, I get all "no match" characters. I'm assuming this is because I'm not accessing the index I want in the correct manner. Please help!
public static String translate(String word, ArrayList<String[]> wordList) {
    if (word == "." || word == "!" || word == ";" || word == ":") {
        return word;
    }
    for (int i = 0; i < wordList.size(); i++) {
            String origWord = wordList.get(i)[0];
            String transWord = wordList.get(i)[1];

            if (word.equalsIgnoreCase(origWord)) { //FIXME may need to change if you need to switch from translated to original
                String translated = matchCase(word, transWord);
                return translated;
            }
    }
    String noMatch = Character.toString(Config.LINE_CHAR);

    return noMatch;
}

Sample Data and expected result
word = "hello"
wordList.get(i)[0] = "Hello"
wordList.get(i)[1] = "Hola"
(word and wordList.get(i)[0] match, so the next step is executed)
match case method is called and returns the translated word with the same case as the original word ->
translated = "hola"
returns the translated word.
(the for loop iterates through the entire wordList until it finds a match, then it calls the translate method)
**
Match Case's Code
 public static String matchCase(String template, String original) {
    String matched = "";
    if (template.length() > original.length()) {

        for (int i = 1; i <= original.length(); i++) {
            if (template.charAt(i-1) >= 'a' &&  template.charAt(i-1) <= 'z') {

                if (i == original.length()) {

                matched +=  original.substring(original.length() - 1).toLowerCase();

                }
                else {

                    matched += original.substring((i-1), i).toLowerCase();
                }

            }
            else if (template.charAt(i-1) >= 'A' && template.charAt(i-1) <= 'Z') {
                if (i == original.length()) {

                    matched += original.substring(original.length() - 1).toUpperCase();

                }
                else {

                    matched +=  original.substring((i-1), i).toUpperCase();

                }
            }
        }
        return matched;
     }
     else if (template.length() < original.length()) {
         int o;
            original.toLowerCase();
            for (int i = 1; i <= template.length(); i++) {
                if (template.charAt(i-1) >= 'a' &&  template.charAt(i-1) <= 'z') {
                    if (i == template.length()) {
                        matched += original.substring(original.length() - 1).toLowerCase();
                    }
                    else {
                        matched += original.substring((i-1), i).toLowerCase();
                    }
                }
                else if (template.charAt(i-1) >= 'A' && template.charAt(i-1) <= 'Z') {
                    if (i == template.length()) {
                        matched += original.substring(original.length() - 1).toUpperCase();
                    }
                    else {
                        matched += original.substring((i-1), i).toUpperCase();
                    }
                }
                String newMatched = matched + original.substring(i, original.length() - 1);
                matched = newMatched;
                newMatched = "";
            }

            return matched;
     }

   return original;
}

A: I have tested your code and it works rather well with the example you have provided. I cannot help for your bug.
There are however some bugs to notify and improvement to suggest:

*

*matchCase fails when template is shorter than the translated word.

*Never compare strings with ==. Use the equals method and look why .

*This is not really important but why is noMatch always computed. Why don't you declare it as a constant once?
public static final String NO_MATCH = String.valueOf(Config.LINE_CHAR);

*More importantly I think that matchCase is not really pertinent by design and is over complicated. I think that You should just determine if the word to translate is all lower case or upper case or with the first letter in uppercase and the following letters in lower case. What you do (comparing the case letter by letter) is not really pertinent when the length is different.

*When you consider a single character, use charAt instead of substringit is simpler and faster.

*You also might have a look a regex to analyze your Strings.

*Have you considered Maps for your translation lookup?

...


text:
Q: Angular route navigate I have some url that is like this
http://www.example.com/rights?activeOnly=false&party=12345
And i have some function that is like this
  cancel(): void {
      this.router.navigate([], {
        queryParams: {
          activeOnly: false
        }
      });
  }

The problem that i have is, when i call this function, it reacts like toggle, if there is just activeOnly in url, like this
http://www.example.com/rights?activeOnly=false
it just remove queryParams like this
http://www.example.com/rights
On second call it just add query params like this
http://www.example.com/rights?activeOnly=false
What i need is that route will always when function cancel is called, always be
http://www.example.com/rights?activeOnly=false
And to toggle values

A: You can change your function to like this
cancel(isActiveOnly?: boolean): void {
      this.router.navigate([], {
        queryParams: {
          activeOnly: isActiveOnly ? true : false
        }
      });
  }


text:
Q: 'IsNullOrWhitespace' in JavaScript? Is there a JavaScript equivalent to .NET's String.IsNullOrWhitespace so that I can check if a textbox on the client-side has any visible text in it?
I'd rather do this on the client-side first than post back the textbox value and rely only on server-side validation, even though I will do that as well.

A: For a succinct modern cross-browser implementation, just do:
function isNullOrWhitespace( input ) {
  return !input || !input.trim();
}

Here's the jsFiddle. Notes below.

The currently accepted answer can be simplified to:
function isNullOrWhitespace( input ) {
  return (typeof input === 'undefined' || input == null)
    || input.replace(/\s/g, '').length < 1;
}

And leveraging falsiness, even further to:
function isNullOrWhitespace( input ) {
  return !input || input.replace(/\s/g, '').length < 1;
}

trim() is available in all recent browsers, so we can optionally drop the regex:
function isNullOrWhitespace( input ) {
  return !input || input.trim().length < 1;
}

And add a little more falsiness to the mix, yielding the final (simplified) version:
function isNullOrWhitespace( input ) {
  return !input || !input.trim();
}

A: It's easy enough to roll your own:
function isNullOrWhitespace( input ) {

    if (typeof input === 'undefined' || input == null) return true;

    return input.replace(/\s/g, '').length < 1;
}

A: no, but you could write one
function isNullOrWhitespace( str )
{
  // Does the string not contain at least 1 non-whitespace character?
  return !/\S/.test( str );
}

A: Try this out
Checks the string if undefined, null, not typeof string, empty or space(s
/**
  * Checks the string if undefined, null, not typeof string, empty or space(s)
  * @param {any} str string to be evaluated
  * @returns {boolean} the evaluated result
*/
function isStringNullOrWhiteSpace(str) {
    return str === undefined || str === null
                             || typeof str !== 'string'
                             || str.match(/^ *$/) !== null;
}

You can use it like this
isStringNullOrWhiteSpace('Your String');

A: You can use the regex /\S/ to test if a field is whitespace, and combine that with a null check.
Ex:
if(textBoxVal === null || textBoxVal.match(/\S/)){
    // field is invalid (empty or spaces)
}

A: trim() is a useful string-function that JS is missing..
Add it:
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,"") }

Then: if (document.form.field.value.trim() == "")

A: You must write your own:
function isNullOrWhitespace(strToCheck) {
    var whitespaceChars = "\s";
    return (strToCheck === null || whitespaceChars.indexOf(strToCheck) != -1);
}

A: Pulling the relevant parts of the two best answers, you get something like this:
function IsNullOrWhitespace(input) {
    if (typeof input === 'undefined' || input == null) return true;
    return !/\S/.test(input); // Does it fail to find a non-whitespace character?
}

The rest of this answer is only for those interested in the performance differences between this answer and Dexter's answer.  Both will produce the same results, but this code is slightly faster.
On my computer, using a QUnit test over the following code:
var count = 100000;
var start = performance.now();
var str = "This is a test string.";
for (var i = 0; i < count; ++i) {
    IsNullOrWhitespace(null);
    IsNullOrWhitespace(str);
}
var end = performance.now();
var elapsed = end - start;
assert.ok(true, "" + count + " runs of IsNullOrWhitespace() took: " + elapsed + " milliseconds.");

The results were:

*

*RegExp.replace method = 33 - 37 milliseconds

*RegExp.test method    = 11 - 14 milliseconds


text:
Q: My php echo statements do not output expected array contents from SQL query I have the following code which selects ID's of a database with many regions in it.  I create the array as follows:
$old2 = $this->query("SELECT regionid FROM theregions WHERE regionparent = '808'");
$old2_array = mysqli_fetch_array($old2);

And then I try and output the array like so:
while($row = mysqli_fetch_array($old2)) {
    echo $row[0] . '
';
}

It produces the following:
800
834
933

However, if I use phpMyAdmin and run the same SQL statement, I get:
604
800
834
933

If I try using print_r(array_values($old2_array)); I get:
Array ( [0] => 604 [1] => 604 )

Have searched many SO pages, and have tried this:
$length = count($old2_array);
for ($i = 0; $i < $length; $i++) {
  echo $old2_array[$i], "
";
};

...which produces:
604

Notice: Undefined offset: 1 in /index.php on line 128

A: I understand that php echo do not handles arrays directly but you have to use a syntax that includes curvy brackets if Im right.
if I were you, I would use php var_dump(array_here)
or load the array variable into a single variable first before echo it

A: The answer is not to have that second line.  Once I remove this:
$old2_array = mysqli_fetch_array($old2);

Then the following loop works:
while( $reg = $old2->fetch_object() ) {
    echo $reg->region_id . "
";
}

For some reason, the mysqli_fetch_array() statement screws with following commands.