text:
Q: Tomcat v10 on eclipse: SEVERE: A child container failed during start I tried to create a Dynamic Web Project which uses Tomcat. I constructed a hello world project, which works fine. But I don't know what happens that it crashed and shows error. The log is given in the following. I searched the forums and someone said the concern is about web.xml file or the version of JDK. It is appreciated if this issue is investigated considering the program works fine first.
It worth mentioning that Tomcat works fine from the console. Additionally, I had a clean installation of eclipse and Tomcat, but the problem still exists.
Thank you
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version name:   Apache Tomcat/10.0.27
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server built:          Oct 3 2022 14:18:31 UTC
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Server version number: 10.0.27.0
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Name:               Windows 10
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: OS Version:            10.0
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Architecture:          x86
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Java Home:             C:\Program Files (x86)\Java\jre1.8.0_301
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Version:           1.8.0_301-b09
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: JVM Vendor:            Oracle Corporation
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_BASE:         E:\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: CATALINA_HOME:         C:\Program Files\Apache\apache-tomcat-10.0.27
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.base=E:\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dcatalina.home=C:\Program Files\Apache\apache-tomcat-10.0.27
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dwtp.deploy=E:\eclipse\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Djava.endorsed.dirs=C:\Program Files\Apache\apache-tomcat-10.0.27\endorsed
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.VersionLoggerListener log
INFO: Command line argument: -Dfile.encoding=Cp1252
Feb 06, 2023 10:50:01 PM org.apache.catalina.core.AprLifecycleListener init
WARNING: The Apache Tomcat Native library failed to load. The error reported was [C:\Program Files\Apache\apache-tomcat-10.0.27\bin\tcnative-1.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform]
java.lang.UnsatisfiedLinkError: C:\Program Files\Apache\apache-tomcat-10.0.27\bin\tcnative-1.dll: Can't load AMD 64-bit .dll on a IA 32-bit platform
    at java.lang.ClassLoader$NativeLibrary.load(Native Method)
    at java.lang.ClassLoader.loadLibrary0(Unknown Source)
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.load0(Unknown Source)
    at java.lang.System.load(Unknown Source)
    at org.apache.tomcat.jni.Library.<init>(Library.java:41)
    at org.apache.tomcat.jni.Library.initialize(Library.java:234)
    at org.apache.catalina.core.AprLifecycleListener.init(AprLifecycleListener.java:201)
    at org.apache.catalina.core.AprLifecycleListener.lifecycleEvent(AprLifecycleListener.java:138)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:423)
    at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:135)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:747)
    at org.apache.catalina.startup.Catalina.load(Catalina.java:769)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:305)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:475)

Feb 06, 2023 10:50:01 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-nio-8080"]
Feb 06, 2023 10:50:01 PM org.apache.catalina.startup.Catalina load
INFO: Server initialization in [428] milliseconds
Feb 06, 2023 10:50:01 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service [Catalina]
Feb 06, 2023 10:50:01 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet engine: [Apache Tomcat/10.0.27]
Feb 06, 2023 10:50:01 PM org.apache.catalina.util.SessionIdGeneratorBase createSecureRandom
WARNING: Creation of SecureRandom instance for session ID generation using [SHA1PRNG] took [162] milliseconds.
Feb 06, 2023 10:50:02 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]]
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:926)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:886)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]]
    at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
    ... 21 more
Caused by: java.lang.NoClassDefFoundError: javax/el/CompositeELResolver
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2510)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:877)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1413)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1257)
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Unknown Source)
    at java.lang.Class.getDeclaredFields(Unknown Source)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:104)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:269)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:89)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:332)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:989)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5085)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    ... 27 more
Caused by: java.lang.ClassNotFoundException: javax.el.CompositeELResolver
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1449)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1257)
    ... 47 more

Feb 06, 2023 10:50:02 PM org.apache.catalina.core.ContainerBase startInternal
SEVERE: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:926)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:938)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:886)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
    ... 13 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]]
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:926)
    ... 21 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]]
    at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
    ... 21 more
Caused by: java.lang.NoClassDefFoundError: javax/el/CompositeELResolver
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2510)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:877)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1413)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1257)
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Unknown Source)
    at java.lang.Class.getDeclaredFields(Unknown Source)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:104)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:269)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:89)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:332)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:989)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5085)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    ... 27 more
Caused by: java.lang.ClassNotFoundException: javax.el.CompositeELResolver
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1449)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1257)
    ... 47 more

Feb 06, 2023 10:50:02 PM org.apache.catalina.startup.Catalina start
SEVERE: The required Server component failed to start so Tomcat is unable to start.
org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:938)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:265)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:432)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:930)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:795)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:345)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:476)
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: A child container failed during start
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:926)
    ... 13 more
Caused by: org.apache.catalina.LifecycleException: A child container failed during start
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:938)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:886)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
    ... 13 more
Caused by: java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]]
    at java.util.concurrent.FutureTask.report(Unknown Source)
    at java.util.concurrent.FutureTask.get(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:926)
    ... 21 more
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]]
    at org.apache.catalina.util.LifecycleBase.handleSubClassException(LifecycleBase.java:440)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:198)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1396)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1386)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.util.concurrent.AbstractExecutorService.submit(Unknown Source)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:919)
    ... 21 more
Caused by: java.lang.NoClassDefFoundError: javax/el/CompositeELResolver
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClassInternal(WebappClassLoaderBase.java:2510)
    at org.apache.catalina.loader.WebappClassLoaderBase.findClass(WebappClassLoaderBase.java:877)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1413)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1257)
    at java.lang.Class.getDeclaredFields0(Native Method)
    at java.lang.Class.privateGetDeclaredFields(Unknown Source)
    at java.lang.Class.getDeclaredFields(Unknown Source)
    at org.apache.catalina.util.Introspection.getDeclaredFields(Introspection.java:104)
    at org.apache.catalina.startup.WebAnnotationSet.loadFieldsAnnotation(WebAnnotationSet.java:269)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:89)
    at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:67)
    at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:332)
    at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:989)
    at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:303)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5085)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    ... 27 more
Caused by: java.lang.ClassNotFoundException: javax.el.CompositeELResolver
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1449)
    at org.apache.catalina.loader.WebappClassLoaderBase.loadClass(WebappClassLoaderBase.java:1257)
    ... 47 more

Feb 06, 2023 10:50:02 PM org.apache.coyote.AbstractProtocol pause
INFO: Pausing ProtocolHandler ["http-nio-8080"]
Feb 06, 2023 10:50:02 PM org.apache.catalina.core.StandardService stopInternal
INFO: Stopping service [Catalina]
Feb 06, 2023 10:50:02 PM org.apache.coyote.AbstractProtocol destroy
INFO: Destroying ProtocolHandler ["http-nio-8080"]

A: solved. I changed the version of Tomcat from 10 to 9.


text:
Q: Thinkpad W510 gets slow after 5 mins of regular activity (CPU thread fully loaded) I own a Lenovo Thinkpad W510. Since I got it, I always run into this problem, especially when running Ubuntu. After starting the laptop and using Chrome or Firefox with just 4-5 tabs open and eventually have Skype open (so nothing fancy), the system gets really slow. I have to reboot to get back to normal. I checked System Monitor and it looks like when having this problem, one of the CPU threads is always on full load.

When checking the "Processes" tab, I don't see any process taking more than 3% of CPU.
These are my specs:

*

*Ubuntu 15.10

*Intel i7 Q820 @ 1.73GHZ

*8GB RAM

*SSD Kingston V300 SATA III

I had this problem not only with Ubuntu 15, but with Ubuntu 14 as well. Tried to replace Unity with gnome & something else, with no effect. I also had Windows installed and as I remember, something was happening with that as well, but still, the situation was a bit better. I just got the SSD so it's a fresh install.
Do you have any idea why this would happen? I'm a Linux noob, btw :)

A: I just bought one of these used a few weeks ago and have run into a lot of trouble with performance. Make certain you are not using a 90W power supply as the ThinkPad will throttle itself substantially. A 135W power supply was standard and ought to avail the unit's full power to you.
Mine came with a 90W supply and I noticed a dramatic increase in performance by unplugging it and running from battery power.

redpajama_set_name: RedPajamaStackExchange


text:
Q: How to add an image properly? If I add an Image into my XML file, it works properly. But I am wondering if I don't have to Change my Java-code to add an image?  The image has no function. It is only there to look at it. As I said  my activity works, because I can see the image in my activity. But I am wondering if I have to mention the image in my Java-Code?

A: If the reference of the image is called from your layout, and it loads correctly, you don´t have to change anything.

A: There's no need to mention it in Java code, if your sole requirement is just to display the image. It's required only when you need to modify the behavior of some UI element at runtime (e.g. if you need to enable or disable a button at runtime based on certain conditions, then you need to get a reference to it and modify it in Java code). But as per your question, only adding in xml is enough.

A: picasso jar i think you will need it to solve caching issue and to load pics from url without doing code by your self
it just need the imageview and it will load any image either from sd card , drawable folder or from url.
all imageview layout will be same as it is.
try it http://square.github.io/picasso/


text:
Q: How to configure Web Inspector on Windows 7 using iPad I have to use Web Inspector on windows 7.
I have installed safari ( ver 5.1.7) browser on Windows 7 and basically well known about Preference Setting and Develpe menu option. But in develop menu my device is not Appearing.
Is this possible to use Web inspector with Windows?
Please Help.

A: Safari 5 does not have that feature. You need Safari 6, which is not (currently) available for Windows.
I regularly use weinre. It basically runs a webserver that in turn acts as an inspector-enhanced proxy to browse webpages and websites. The inspector can be started by adding a script to your page or running a bookmarklet.

weinre is a debugger for web pages, like FireBug (for FireFox) and Web Inspector (for WebKit-based browsers), except it's designed to work remotely, and in particular, to allow you debug web pages on a mobile device such as a phone.

To install it, you will need NodeJS and NPM (included with NodeJS). You will also need a WebKit-based browser on the desktop/receiver end (Safari, Google Chrome, or Chromium). It should work on Windows, OSX, and Linux.

*

*Official page: https://people.apache.org/~pmuellr/weinre/

*Documentation & Getting Started: https://people.apache.org/~pmuellr/weinre/docs/latest/


text:
Q: Show that λ +c is an eigenvalue of B $A$ is a matrix with eigenvalue $λ$.
$B=A+cI$ where $c \in R$ and I is the identity matrix.
How do I prove that $λ+c$ is an eigenvalue of $B$? I don't know how to do this, so I don't have what to share regarding my work.
Second, we suppose (1) $X_A(λ)=λ(λ-1)(λ^2+1)$ and c=1. I have to compute $X_B(λ)$ and determine $det(B)$. Regarding the computation of $X_B(λ)$, I am thinking of replacing $λ$ with $λ+1$ (since $λ+c$ is the eigenvalue of B) from the formula number 1. And for the determinant, I am thinking of simply solving the equation I will get in the end. Is this correct?
Thank you

A: Notice that $$B-(\lambda+c)I=A+cI-(\lambda+c)I=A-\lambda I$$ hence $$\det(B-(\lambda+c)I)=\det(A-\lambda I)=0$$
For your second question, your claims are correct.


text:
Q: How to recover from an unwanted merge of meta/config? I've been modifying gerrit access files locally, instead of doing this in the UI - easier when you have bulk operations.
To access these files, I need to "git pull origin refs/meta/config" - this is how they show up in the project.
Now I'd like them gone, I'd like not to see them in the project anymore - how can I make files belonging to that ref disappear? How to un-fetch that ref?

A: Using git-pull you have merged the reference refs/meta/config into the current branch (maybe master). Where have you seen that command line? If you want to modify files in the meta/config ref, you should use command lines similar to those recommended here:
git fetch origin refs/meta/config:refs/remotes/origin/meta/config
git checkout meta/config
//edit... and then push:
git push origin meta/config:meta/config

Now the issue is that you did used git-pull. Using git log --merges --first-parent, try to find the revision where you have merged that branch. And then git git revert <commit-id> to undo that merge.

A: Assuming the ref is also locally called refs/meta/config, and that the files were never committed to another branch like master:
git checkout master
git update-ref -d refs/meta/config

If that doesn't work, see if the ref was stored locally with a different name (possibly something like refs/remotes/origin/meta/config) using
git branch -a

You will need to prepend refs/ to the output that branch shows.


text:
Q: How to pass nested soap request parameters using TCLWS package? This is the sample request I would like to make, to get the matching results from TABLE1 & TABLE2
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:urn="urn:my:functions">
   <soapenv:Header/>
   <soapenv:Body>
      <urn:MY_TABLES>
         <!--You may enter the following 50 items in any order-->
         <TABLE1>
            <!--Zero or more repetitions:-->
            <item>
               <!--Optional:-->
               <FIELD1>%</FIELD1>
            </item>
         </TABLE1>

         <TABLE2>
            <!--Zero or more repetitions:-->
            <item>
               <!--Optional:-->
               <FIELD1>%</FIELD1>
            </item>
         </TABLE2>

         <TABLE1_FLAG>Y</TABLE1_FLAG>
         <TABLE2_FLAG>Y</TABLE2_FLAG>
      </urn:MY_TABLES>
   </soapenv:Body>
</soapenv:Envelope>

I am trying to simulate this SOAP GUI request with the following TCL Code using the TCLWS package
package require WS::Client
package require WS::Utils

set wsdlInfo [::WS::Client::GetAndParseWsdl "https://mytablesurl.com"]
# The parsing happens successfully

# But making a request as below throws me errors
set argList {TABLE1 {item {FIELD1 %}} TABLE1_FLAG Y TABLE2 {item {FIELD1 %}} TABLE2_FLAG Y}
puts [::WS::Client::DoCall MY_TABLESService MY_TABLES $argList]

Error thrown
can't read "simpleTypes(Client,Z_OSS_RFC_TABLESService,TABLE1)": no such element in array
    while executing
"set xns $simpleTypes($mode,$service,$typeName)"
    (procedure "convertDictToType" line 30)
    invoked from within
"convertDictToType $mode $service $doc $retNode $resultValue $itemType"
    (procedure "::WS::Utils::convertDictToType" line 196)
    invoked from within
"::WS::Utils::convertDictToType Client $serviceName $doc $reply $argList $xns:$msgType $forceNs"
    (procedure "buildDocLiteralCallquery" line 81)
    invoked from within
"buildDocLiteralCallquery $serviceName $operationName $url $argList"
    (procedure "buildCallquery" line 16)
    invoked from within
"buildCallquery $serviceName $operationName $url $argList"
    invoked from within
"::WS::Client::DoCall MY_TABLESService MY_TABLES $argList"
    invoked from within

How can I pass these parameters to the ::WS::Client::DoCall?


text:
Q: Modify shortcode to work with custom post types I have this shortcode which works fine with posts but I need to modify it to take arguments for custom post type and custom taxonomy.
<?php
// [blog_posts]
function shortcode_latest_from_blog($atts, $content = null) {
    $sliderrandomid = rand();
    extract(shortcode_atts(array(
        "posts" => '8',
        "columns" => '4',
        "category" => '',
        "style" => 'text-normal',
        "image_height" => 'auto',
        "show_date" => 'true',
        "excerpt" => 'true',
    ), $atts));
    ob_start();
    ?>

            <div id="slider_<?php echo $sliderrandomid ?>" class="iosSlider blog-posts <?php if($style  == 'text-overlay') { ?>slider-center-arrows<?php } ?>" style="min-height:<?php echo $image_height; ?>;height:<?php echo $image_height; ?>;">
                <ul class="slider large-block-grid-<?php echo $columns ?> small-block-grid-2">

                    <?php
                    $args = array(
                        'post_status' => 'publish',
                        'post_type' => 'post',
                        'category_name' => $category,
                        'posts_per_page' => $posts
                    );

                    $recentPosts = new WP_Query( $args );

                    if ( $recentPosts->have_posts() ) : ?>

                        <?php while ( $recentPosts->have_posts() ) : $recentPosts->the_post(); ?>

                        <li class="ux-box text-center post-item ux-<?php echo $style; ?>">

                                <a href="<?php the_permalink() ?>">

                                        <div class="entry-image-attachment" style="max-height:<?php echo  $image_height; ?>;overflow:hidden;">
                                            <?php the_post_thumbnail('medium'); ?>

<?php the_title(); ?>

                                        <?php if($excerpt != 'false') { ?>

<?php
                                                $excerpt = get_the_excerpt();
                                                echo string_limit_words($excerpt,15) . '[...]';
                                            ?>

                                         <?php } ?>

                                   <?php if($show_date != 'false') {?>

                                                                <?php echo get_the_time('d', get_the_ID()); ?>
                                                                <?php echo get_the_time('M', get_the_ID()); ?>

                                    <?php } ?>

                        <?php endwhile; // end of the loop. ?>

                    <?php

                    endif;
                    wp_reset_query();

                    ?>

                    <a href="javascript:void(0)" class="nextSlide prev_<?php echo $sliderrandomid ?>">
                    <a href="javascript:void(0)" class="prevSlide next_<?php echo $sliderrandomid ?>">

    <?php
    $content = ob_get_contents();
    ob_end_clean();
    return $content;
}

function string_limit_words($string, $word_limit) {
    $words = explode(' ', $string, ($word_limit + 1));
    if(count($words) > $word_limit)
    array_pop($words);
    return implode(' ', $words);
}

add_shortcode("blog_posts", "shortcode_latest_from_blog");

A: This part of the code is what defines the arguments that can be passed with the shortcode:
extract(shortcode_atts(array(
        "posts" => '8',
        "columns" => '4',
        "category" => '',
        "style" => 'text-normal',
        "image_height" => 'auto',
        "show_date" => 'true',
        "excerpt" => 'true',
    ), $atts));

This allows you to later on use this values as $posts, $columns and so forth. If no value is passed in the shortcode, the default value will be used. In this case $posts = 8 (number posts to show)
This is the query that gets the posts based on the values passed:
$args = array(
     'post_status' => 'publish',
     'post_type' => 'post',
     'category_name' => $category,
     'posts_per_page' => $posts
);

So, if you want to be able to pick the post type, by passing it via the shortcode, you do something like:
extract(shortcode_atts(array(
            "post_type" => 'post',
            "posts" => '8',
            "columns" => '4',
            "category" => '',
            "style" => 'text-normal',
            "image_height" => 'auto',
            "show_date" => 'true',
            "excerpt" => 'true',
        ), $atts));

You can modify the query to use that value:
$args = array(
     'post_status' => 'publish',
     'post_type' => $post_type,
     'category_name' => $category,
     'posts_per_page' => $posts
);

When writing the shortcode you can do [blog_posts post_type="my_custom_post_type"]
The same idea can be done with the custom taxonomy. If you are only using one custom post type and that will never change, then you can skip the first step and just change the query directly. Also check out the codex to understand how wp_query works, and what values it expects:
http://codex.wordpress.org/Class_Reference/WP_Query


text:
Q: visual studio crashing if tried to launch xamarin.windows on device I was able to run my xamarin.windows project in device earlier but suddenly I am getting this problem that is whenever I try to run the app on device its crashing the visual studio.Please find the screenshot below

List of things I tried sofar:

*

*Removed and added the nugget packages

*devenv resetuserdata

*Removing and readding the windows developer license
Nothing worked so far
Here is the eventviewer error log:


text:
Q: When is it required to define a separate function in Python In my code, I am printing a menu
print(num_chars * char)

for option in options:
    print("{:d}. {:s}".format(option, options[option]))

print(num_chars * char)

The code print(num_chars * char) prints a separator/delimiter in order to "beautify" the output. I have learned from several coding tutorials that I am not allowed to write the same code more than once.
Is it really preferable to define a function
def get_char_repeated(char='*', num_chars=30):
    """
    Return the character repeated an arbitrary number of times
    """
    return num_chars * char

and call this two times in my original code?
Are there any alternatives if I need to print nice looking menu from a dictionary?
Thank you.

A:
I have learned from several coding tutorials that I am not allowed to write the same code more than once.

This principle, called "don't repeat yourself" (DRY) is a good rough guideline. For every programmer who writes too many functions (splitting code into too small units), there are 20 who write too few.
Don't go overboard with it, though. The reasoning behind DRY is to make reading and changing the code later on easier. print(num_chars * char) is pretty basic already, and super-easy to understand and change, so it doesn't really pay off to factor it into a function.
If the repeated code grows to 3 lines, you can (and probably should) factor it out then.

A: It's not necessary at that level. What might be helpful is if you were often doing that whole block of code, you could easily change it to
def printOptions(options, char='*', num_chars=30):
    print(num_chars * char)

    for option in options:
        print("{:d}. {:s}".format(option, options[option]))

    print(num_chars * char)

The main point of functions is to save time with blocks of code you use a lot in a very similar way by not retyping/copy pasting them. But they also save time when you make changes. If you used the same function in 10 different places you still only need to change it once for all 10 uses to be updated rather than having to find all 10 manually and update them.
So if you decided you wanted to put a title header into this menu printing section and you had used it as this or a similar function in a bunch of places, you could quite easily update them all without difficulty.

A: I find it a good rule, that if the code you're turning into a function is used more than once and takes up more than 3 lines, it is a candidate to be turned into a function.  If it is a very complex single line of code (like this x = [ i**j for i in z for j in y ]) and is used more than twice, it could be a candidate to turn into a function.
It may be a matter of preference where you draw the line but the basic idea is if it makes your code easier to read or easier to write, turning something into a function can be a good idea.  If it makes your code harder to read (because every time you see the function you have to look back at the specifics of what it does), you probably should not have turned that code into a function.


text:
Q: Ubuntu Software Center not recognising my network connection I have installed Oneiric Beta on my laptop. As my Mobile Broadband refused to connect to Internet through network manager I'm now using wvdial to connect. Hence the network manager shows I'm not connected to any networks. When I try to install software from Ubuntu Software Center the 'Install' option remains disabled and under reviews section it says no network connection! As a workaround I kept installing applications from terminal which works fine.
Therefore, my question is how to make Software Center recognize that I am connected to Internet?

A: You can't ... yet.
Please file a bug for both these issues: it's definitely an issue to not be able to override what NetworkManager tells Software Center, and it's also an issue that NetworkManager can't handle your Mobile Broadband connection.
As a workaround, if you're not using one of your connections, you could add dummy entries to /etc/network/interfaces to trick NetworkManager into thinking you're online. The way to do this:
auto eth0
iface eth0 manual

If you don't need to use your wired connection. Then reboot or restart NetworkManager. Of course this will break it for when you really need to use it :(

A: The answer for this question, worked for me. The suggestion is to stop and start network-manager as follow:
sudo stop network-manager

and then
sudo start network-manager

This fixes the issue with Ubuntu Software Center not detecting you Internet connection.

A: Manually entering the connection settings solved my software center network detection problem.
Click on the network icon in your taskbar, go to Edit connections, edit your connection and under IPv4 designate a Manual method, and then add IPv4 address, network mask and default gateway
I understand this might not help mobile broadband users, but hey... worth a shot

A: i have same problem  Install Boutton can be used and i have message  No network connection / ALL THIS PROBLEM  juste after using file for network connection beacause i have fixe my ip with on etc/Network/Interfaces ,  and after my software center can not detect any network ..

Solution, if you don't need use Network-Manager , Remove It, and your software Center by default switch automatically to use  etc/Network/Interfaces   to connect to internet .


text:
Q: Filter out rows based on difference in timestamps in SQL Server I have data of this format in SQL Server:
     Timestamp          CustomerID      Product
2019-07-17 21:31:56.000     315          12317
2019-07-19 09:16:43.000     315          55300
2019-07-19 09:41:11.000     315          53100
2019-03-16 18:00:15.000    3141          53100
2019-03-19 18:45:39.000    3141          10328
2019-05-17 10:50:44.000    3141          55300

I need to filter out the rows where the product belongs to the same CustomerID group and purchased within 1/2 hour after the previous product was purchased.
Example : Row 3 in which product has been purchased by Customer 315 has to be removed as it was purchased within 1/2 hr of the previous product.
Note : Product should belong to the same customer while taking the time difference i.e. if 2 products were purchased by different customers within 1/2 hour, they should not be affected.
I can also take the data into R and do the manipulation there but i want to reduce the table size as much as possible.

A: You can use a CTE with LAG to get the timestamp for the customer's previous purchase and then compare those values using DATEDIFF to select only purchases not made within 30 minutes of the prior purchase:
WITH CTE AS (
  SELECT *,
         LAG(Timestamp) OVER (partition BY CustomerID ORDER BY Timestamp) AS prev_TS
  FROM purchases
)
SELECT Timestamp, CustomerID, Product
FROM CTE
WHERE prev_TS IS NULL OR datediff(minute, prev_TS, Timestamp) > 30

Output:
Timestamp               CustomerID  Product
2019-07-17T21:31:56Z    315         12317
2019-07-19T09:16:43Z    315         55300
2019-03-16T18:00:15Z    3141        53100
2019-03-19T18:45:39Z    3141        10328
2019-05-17T10:50:44Z    3141        55300

Demo on SQLFiddle
Update
As @GordonLinoff pointed out, it would be more efficient not to use DATEDIFF() for this purpose, but instead make a direct comparison of the times:
WHERE prev_TS IS NULL OR
     Timestamp > dateadd(minute, 30, prev_TS)

This allows use of an index on Timestamp.
Updated demo on SQLFiddle

A: Try this:
select
cast('2019-07-17 21:31:56.000' as smalldatetime) as Timestamp,     315 as CustomerID,          12317 as Product into TblProduct
union select '2019-07-19 09:16:43.000',     315,          55300
union select '2019-07-19 09:41:11.000',    315,           53100
union select '2019-03-16 18:00:15.000',    3141,          53100
union select '2019-03-19 18:45:39.000',    3141,          10328
union select '2019-05-17 10:50:44.000',    3141,          55300

select t1.CustomerID, t1.Product, t1.Timestamp, t2.Timestamp, datediff(minute, t1.Timestamp,t2.Timestamp)
from TblProduct t1 inner join TblProduct t2 on t1.CustomerID = t2.CustomerID and t2.Timestamp > t1.Timestamp
where datediff(minute, t1.Timestamp,t2.Timestamp) > 30


text:
Q: Different MSE for each observation for SARIMA-model I am doing a time series forecast with the SARIMA-model in STATA. I wanted to calculate the MSE to set up confidence intervals for my prediction. I have done that using the following command:
predict MSE, mse dynamic(tm(2022m5))
STATA then generates a new variable of course with the MSE in it. Now I am wondering why the MSE is not similar for each observation. It is about roughly the same value for all observations of one year with some exceptions. It heavily differs for different years though.
For me (if i have not fundamentally misunderstood the concept of MSE) it just does not make sense to have different values for the MSE for each observation.
I would apreciate any help.

A: The concept of MSE:
MSE measures the amount of error in statistical models. It assesses the average squared difference between the observed and predicted values.
MSE = SUM(square(Real_Y(i'th) - Predicted_Y(i'th)))/(the-number-of-observations)
Since STATA generates new random variables you have to use set seed to initialize a pseudorandom generator
this article will help you to understand set seed
https://www.stata.com/manuals13/rsetseed.pdf


text:
Q: ReactJS How to loop through an array and fetch specific attribute of Object inside another array So I have an array of users which are tied to specific teams, each user with specific permissions. If the user is tied to multiple teams, all these teams are available too in the array:
[
{
    "name" : "user1",
    "teams": [
        {"id": "123", "name": "team-1", "permissions" : 1}
    ]
},
{
    "name" : "user2",
    "teams": [
        {"id": "123", "name": "team-1", "permissions" : 3}
    ]
},
{
    "name" : "user3",
    "teams": [
        {"id": "456", "name": "team-2", "permissions" : 3},
        {"id": "789", "name": "team-3", "permissions" : 3},
        {"id": "123", "name": "team-1", "permissions" : 3},
        {"id": "233", "name": "team-4", "permissions" : 3}

    ]
}

]

so now I want this:
I got the ID of the current Team I'm looking at (ID: 123), how can I map the array, so that I can display only the permissions for the team with the ID: 123?
I did the following, but that doesnt work, since the first Item of User3 is the wrong team.
 const MembersTable = observer(({ state }) => (

         Name
         Email
         Permissions

      {state.accounts.map((account, i) => <MembersTableData state={state} account={account} team={account.teams} key={i}/>)}

))

const MembersTableData = observer(({ state, account, organization }) => (

      {account.fullName}

    {account.email}

     {team[0].permissions == 1 && member}
     {team[0].permissions == 2 && administrator}
     {team[0].permissions == 3 && super admin}

 ))

this.state.team is "123" in this case.
How can I solve this?

A: team[0] will always have the first team that the user is part of. What you want is the team that has an id property that equals this.state.team. Thus, instead of team[0] try doing:
{team.find(t => t.id == this.state.team).permissions == 3 && super admin}
Of course this goes for "member" and "admin" as well.

A: You should try this
const getTeamData = (data, teamId) => data.map(users => users.teams.filter(team => team.id === teamId )).reduce((acc, current) => acc.concat(current));

/**

[ {
  id: "123",
  name: "team-1",
  permissions: 1
}, {
  id: "123",
  name: "team-1",
  permissions: 3
}, {
  id: "123",
  name: "team-1",
  permissions: 3
}]
*/


text:
Q: Is there a significant GC performance gain by re using float arrays in Java? I am developing an Android game in Java, and the garbage collector regularly kicks in and causes a lag spike.
After looking at my object allocation, a big portion of what gets recycled is a float[]. I create a new float[] every frame for multiple objects.
Does it make sense to re use a float[] or is the performance impact of it insignificant (especially compared to objects).
public float[] rectangleToVerts(float x, float y, float width, float height)
    float[] verts = new float[8];

    verts[0] = x - width / 2;
    verts[1] = y + height / 2;
    verts[2] = x + width / 2;
    verts[3] = y + height / 2;
    verts[4] = x + width / 2;
    verts[5] = y - height / 2;
    verts[6] = x - width / 2;
    verts[7] = y - height / 2;

    return verts;
}

public void tick(){
    shape.setVertices(rectangleToVerts(x, y, 5, 5);
}

VERSUS
public float[] rectangleToVerts(float x, float y, float width, float
    height, float[] verts)

    verts[0] = x - width / 2;
    verts[1] = y + height / 2;
    verts[2] = x + width / 2;
    verts[3] = y + height / 2;
    verts[4] = x + width / 2;
    verts[5] = y - height / 2;
    verts[6] = x - width / 2;
    verts[7] = y - height / 2;

    return verts;
}

private float[8] verts;

public void tick(){
    shape.setVertices(rectangleToVerts(x, y, 5, 5, verts);
}

A: It's difficult to say exactly how much more efficient your code will be in the second example, but it is certainly more efficient. Each array is itself an object, and the fewer new references you create, the less often the Garbage Collector will run. Since you said that a large portion of what gets recycled is float[] types, this seems like a likely candidate. If you're working in Android Studio 3.0 or higher, you can use the Memory Profiler to see how memory is allocated by your program and determine if this is in fact the source of your slowdown.
As a side note, you're also calculating the values of each vertex twice. (For instance, verts[0] and verts[6] are both being set to x - width / 2.) A quick and easy optimization might look like this:
public float[] rectangleToVerts(float x, float y, float width, float height, float[] verts)
{
    verts[0] = x - width / 2;
    verts[6] = verts[0];

    verts[1] = y + height / 2;
    verts[3] = verts[1];

    verts[2] = x + width / 2;
    verts[4] = verts[2];

    verts[5] = y - height / 2;
    verts[7] = verts[5];

    return verts;
}

Hope this helps!


text:
Q: AWS SDK 3 WriteGetObjectResponseCommand issue On my current project we are trying to migrate to AWS SDK version 3 (Javascript). We are using s3 object lambdas and have faced and issue with WriteGetObjectResponseCommand command.
WriteGetObjectResponseCommand code:
import { S3Client, S3 } from '@aws-sdk/client-s3';
const s3Client = new S3Client({});

async function passTransformedPhoto(
  body: Buffer,
  outputRoute: string,
  outputToken: string,
): Promise<WriteGetObjectResponseCommandOutput> {
  try {
    const writeGetObjectParams: WriteGetObjectResponseCommandInput = {
      RequestRoute: outputRoute,
      RequestToken: outputToken,
      Body: body,
    };

    const command = new WriteGetObjectResponseCommand(writeGetObjectParams);

    return s3Client.send(command);
  } catch (e) {
    console.log('Error happens in passTransformedPhoto', e);
  }

The same issue with the aggregated client:
import { S3Client, S3 } from '@aws-sdk/client-s3';
const s3Aggregated = new S3({});

async function passTransformedPhoto(body: Buffer, outputRoute: string, outputToken: string) {
  try {
    const result = await s3Aggregated.writeGetObjectResponse({
      RequestRoute: outputRoute,
      RequestToken: outputToken,
      Body: body,
    });
    return result;
  } catch (e) {
    console.log('Error happens in passTransformedPhoto', e);
  }
}

Error:
INFO    TypeError: Cannot destructure property 'service' of 'bucketName' as it is undefined.
    at getEndpointFromArn (/var/task/node_modules/@aws-sdk/middleware-bucket-endpoint/dist/cjs/bucketHostname.js:26:13)
    at Object.bucketHostname (/var/task/node_modules/@aws-sdk/middleware-bucket-endpoint/dist/cjs/bucketHostname.js:17:13)
    at /var/task/node_modules/@aws-sdk/middleware-bucket-endpoint/dist/cjs/bucketEndpointMiddleware.js:47:67
    at processTicksAndRejections (internal/process/task_queues.js:95:5)

Environment:
@aws-sdk/client-s3: 3.18.0
Node.js: v 14.17.0
typescript: 4.3.2

Any help or clarification on this issue is much appreciated.

A: Maybe try including all the expected S3Client config options:
const config = {
    region: <region>,
    bucketEndpoint: true,
}

const client = new S3Client(config);


text:
Q: Understanding Arrays and Functions The program that I'm showing you asks the user for no. of people and asks each person how many pancakes did the the person eat. Afterwards it prints the biggest number of pancakes.
Okay up until now I found it easy to do.
What I would like to do is (without using pointers) state the person who ate the most.
Here's what I did so far.
#include <stdio.h>

int main()
{
int person, i;
int pancake[50];

printf("Enter Number Of People: ");
scanf("%d", &person);

for (i=1; i<=person; i++)
{
    printf("Person [%d]: ", i);
    scanf("%d",&pancake[i]);
}

for (i=1; i<=person; i++)
  {
    if (pancake[1]<pancake[i])
    {
        pancake[1] = pancake[i];
    }
  }
  printf("Most pancakes eaten is %d\n", pancake[1]);
}

Any ideas how to find that or is it necessary for me to use pointers?

A: No need to use pointers. I am posting full modified1. code because of many errors/typos in your code.
#include <stdio.h>
#include <string.h>
int main(void)
{
    int person, i;
    int pancake[50];

    printf("Enter Number Of People: ");
    scanf("%d", &person);
    char name[person][30];              // 2D array to store the name of persons. Note that I used variable length arrays.

   for (i=0; i < person; i++)
   {
       printf("Person [%d]: ", i+1);
       scanf("%d",&pancake[i]);
       printf("Person %d name: ", i+1);
       getchar();                       // To eat up the newline left behind by previous scanf.
       fgets(name[i], 30, stdin);       // To read the persons name. I removed the scanf.
   }

   for (i=0; i<person-1; i++)
   {
       if (pancake[0]<pancake[i+1])
       {
           pancake[0] = pancake[i+1];
           strcpy(name[0] , name[i+1]);  // A function in <string.h> to copy strings.
       }
   }
   printf("Most pancakes eaten is %d by %s \n", pancake[0], name[0]);
}

1. Some useful links:
I. fscanf.
II. getchar.
III. strcpy.

A: Modified version of @haccks solution that shows how to do without pointers in an efficient manner. Note the eliminiation of magic numbers into #defines, the return inserted so it compiles
#include <stdio.h>
#include <string.h>

#declare NUM_PANCAKES 50
#declare NAME_LENGTH_MAX 30

int main(void)
{
    int person, i;
    int pancake[NUM_PANCAKES];
    int best_index = 0;
    int most_pancakes = 0;

    printf( "Enter Number Of People: ");
    scanf( "%d", &person);
    char name[person][NAME_LENGTH_MAX]; /* variable length list... */

    /* get the data */
    for ( i = 0; i < person; i++ )
    {
        printf( "Person [%d]: ", i + 1);
        scanf( "%d", &pancake[i] );
        printf( "Person %d name: ", i + 1 );
        getchar();
        fgets( name[i], NAME_LENGTH_MAX, stdin );
    }

    /* find the answer */
    for ( i = 0; i < person - 1; i++ )
    {
        if ( pancake[i] > most_pancakes )
        {
            most_pancackes = pancake[i];
            best_index = i;
        }
    }
    printf( "Most pancakes eaten is %d by %s \n",
           pancake[best_index],
           name[best_index] );

    return 0;
}


text:
Q: Add click event listener to a same button twice with the different functions and want to cancel the first one Add click event listener to a same button twice with the different functions and want to cancel the first one to be triggered always and cancel the second one?
 element.addEventListener('click', startDragDrop, false);
 element.addEventListener('click', spyOnUser, false);

Is there any way apart from detachEvent and how can I make sure always first one is triggered?
P.S. : I cannot remove the code for attaching the second listener and all I can do is make sure always first one is triggered and cancelling the second one which is attached.


text:
Q: How to get a react Refs using recompose? I need to get a dom reference for a stateless react component during componentDidMount using recompose. I tried to inspect this inside that function bu I cannot get a reference of the dom.
I would like to know how to access the dom for that component.
const ComponentX = ({
  classes,
}: Props) => (
  <div>
   Some content
  </div>
)

export const ComponentX = compose<Props, OuterProps>(
  lifecycle({
    componentDidMount() {
       // get a reference component dom
    },
  }),
  setDisplayName('ComponentX'),
  injectSheet(styles),
)(ComponentXComp)


text:
Q: Semi-supervised learning: Classification vs Clustering In the context of a semi-supervised learning problem, what's the difference between using a classification algorithm vs a clustering algorithm?
Traditionally classification is supervised and clustering is unsupervised. However in this context, unlike traditional supervised learning, only a very small amount of labeled data is used. This blurs the lines between the two.
Both modified classification algorithms and modified clustering algorithms exist to solve semi-supervised problems. However, in every scenario I can think to try, the majority of modified (or even sometime unmodified) classification algorithms significantly out perform the modified clustering algorithms.
If this is the case, why is there so much interest in creating modified clustering algorithms? (based on the multitude of papers attempting this)

A: In semi-supervised learning, there's more focus on modified clustering algorithms because of the desire to find out the majority class membership in various clusters.  Obviously, in supervised classification analysis, you have the truth table (known class labels of every object).  But in clustering, you start with unknown class labels, develop the pattern of clusters, and then may want to know what kind of objects are in each cluster.  Working backwards, from classification analysis to cluster isn't typically helpful since you know the truth table (class labels) prior to analysis.  But working from clustering upward to classification is more common because it is usually expensive to get true class labels -- and hence a smaller handful of true class labels are overlayed on top of the clusters, based on where their feature values render there location.
But you can essentially perform "modified clustering" without use of a semi-supervised algorithm and without true class labels.  Here, I typically cluster the data first, and then run ANOVA and chi-squared analysis on all of the input features, with cluster number as the grouping variable.  There's no need for true class labels of objects, because you can instead directly determine if objects (subjects) in cluster $1,2,\ldots,k$, etc., are older, weigh more, have greater protein expression, more mutations, etc., than objects other clusters.


text:
Q: Data not displayed while it is in the table i'm currently creating a search engine using javascript (for real time search) and php (to link to the database). Actualy, my query works fine, the only problem is that he doesn't displayed the info of the other table (see my code/explantions below).
$search_val = htmlspecialchars($_POST['search_term']);
if(isset($search_val))
{
  if (empty($search_val)) {
    echo "";
    exit();
  }
  // $sql = "(SELECT 'steam' as identifier, firstname, lastname FROM users WHERE firstname LIKE '%$search_val%' OR lastname LIKE '%$search_val%') UNION (SELECT 'receiver' as identifier, date, content FROM bills WHERE date LIKE '%$search_val%' OR content LIKE '%$search_val%')
  // $sql = "SELECT * FROM users LEFT JOIN bills ON users.steam = bills.receiver WHERE (users.firstname LIKE '%$search_val%' OR users.lastname LIKE '%$search_val%' OR bills.date LIKE '%$search_val%' OR bills.content LIKE '%$search_val%' OR bills.amount LIKE '%$search_val%' OR bills.id LIKE '%$search_val%')";
  $nRows = $vlife->query("SELECT COUNT(*) FROM users LEFT JOIN bills ON CONCAT(users.firstname, users.lastname) = bills.receiver
  WHERE (users.firstname LIKE '%$search_val%' OR CONCAT(users.firstname,' ',users.lastname) LIKE '%$search_val%'
  OR users.lastname LIKE '%$search_val%' OR bills.date LIKE '%$search_val%' OR bills.content LIKE '%$search_val%'
  OR bills.amount LIKE '%$search_val%' OR bills.id LIKE '%$search_val%')")->fetchColumn();
  if ($nRows == 0) {
    echo "
La base de données ne contient aucuns ".$search_val."
";
    exit();
  } else {
    echo '
Il y a  $nRows "$search_val" dans la base de données
';
  }

  $sql = "SELECT * FROM users LEFT JOIN bills ON CONCAT(users.firstname, users.lastname) = bills.receiver
  WHERE (users.firstname LIKE '%$search_val%' OR CONCAT(users.firstname,' ',users.lastname) LIKE '%$search_val%'
  OR users.lastname LIKE '%$search_val%' OR bills.date LIKE '%$search_val%' OR bills.content LIKE '%$search_val%'
  OR bills.amount LIKE '%$search_val%' OR bills.id LIKE '%$search_val%')";
  $statement = $vlife->query($sql);
  while ($data = $statement->fetch()) {
    echo "
";
      echo "
";
        echo "

";
        echo "
 Identité
";
        echo "
Nom
";
        echo $data['lastname'];
        echo "
Prénom
";
        echo $data['firstname'];
        echo "
Age
";
        echo $data['year']."ans";
        echo "
Adresse
";
        echo $data['adress'].".";
        echo "
";
        echo "button";
      echo "
";
      echo "
";
        echo "
 Casier Judicaire
";
        echo $data['date']."
";
        echo $data['content']."
";
        echo $data['amount']."$
";
      echo "
";
    echo "
";
    echo "
";

    // I will have to change that i know :)
  }
  $statement->closeCursor();
  exit();
}

My "users" table:
My "bills" table:
The results:
As you can see, this part doesn't show:
echo $data['date']."
";
echo $data['content']."
";
echo $data['amount']."$
";

Any ideas ?
PS: I know that the problem comes from the SQL but i don't know what to do, i tried many things like UNION (ALL) (display more that expected) and LEFT JOIN (doesn't display everything)

A: It looks to me that you have an error in your query.. specifically, on the ON of the LEFT JOIN, look at it:
FROM users LEFT JOIN bills ON CONCAT(users.firstname, users.lastname) = bills.receiver

If you concat two strings such as uh, "Red" and "John" the result will obviously be "RedJohn" while in bills.receiver you have a space between the two strings.
You need to concat with also a space between firstname and lastname for the join (as you do in the where) to find something on the right table.
Also, I suggest you to try the query directly from a sql client to check, makes things more easy to fix on the fly while you experiment.
Edit:
Also, if you look at your where, check this:
WHERE (users.firstname LIKE '%$search_val%'
    OR CONCAT(users.firstname,' ',users.lastname) LIKE '%$search_val%'
    OR users.lastname LIKE '%$search_val%'

Can't you just check using the concat expression? The other two are redundant, since you use a LIKE


text:
Q: how to modify xml file using xslt I need to change the value of particular element of a node in a xml through xsl file Below is my xml data
<hospitals>
  <hospital>
    <department>
      <clinic>
        <cid>8</cid>
        <clinicName>clinic8</clinicName>
        <status>1</status>
      </clinic>
      <clinic>
        <cid>9</cid>
        <clinicName>clinic9</clinicName>
        <status>0</status>
      </clinic>
      <depId>3</depId>
      <departmentName>dental</departmentName>
    </department>
    <hospId>2</hospId>
    <hospitalName>appolo</hospitalName>
  </hospital>
  <hospital>
    <department>
      <clinic>
        <cid>82</cid>
        <clinicName>clinic82</clinicName>
        <status>0</status>
      </clinic>
      <clinic>
        <cid>92</cid>
        <clinicName>clinic92</clinicName>
        <status>0</status>
      </clinic>
      <depId>4</depId>
      <departmentName>mental</departmentName>
    </department>
    <hospId>2</hospId>
    <hospitalName>manipal</hospitalName>
  </hospital>
</hospitals>

for example, I need to select clinic9 based on its id ie 9 and change the status 0 to 1
I tried like this
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:param name="hospId"/>
<xsl:param name="depId" />
<xsl:param name="clinicId"/>
<xsl:output omit-xml-declaration="yes" indent="yes"/>
<xsl:strip-space elements="*"/>
<xsl:template match="node()|@*">
  <xsl:copy>
    <xsl:apply-templates select="node()|@*"/>
  </xsl:copy>
</xsl:template>
<xsl:template match="hospitals/hospital[hospId='2']/department[depId='3']/clinic[cid='9']">
<xsl:choose>
 <xsl:when test="cid ='9'">
  <xsl:element name="status">123</xsl:element>
  </xsl:when>
</xsl:choose>
</xsl:template>
  </xsl:stylesheet>

But the value is not changing...

A: If you are trying to modify/replace a specific element, you need to match that element. For example, if you are trying to replace a specific status element, you need to match that specific element.
Modified XSLT
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
    <xsl:output omit-xml-declaration="yes" indent="yes"/>
    <xsl:strip-space elements="*"/>

    <xsl:param name="hospId" select="'2'"/>
    <xsl:param name="depId" select="'3'"/>
    <xsl:param name="clinicId" select="'9'"/>

    <xsl:template match="node()|@*">
        <xsl:copy>
            <xsl:apply-templates select="node()|@*"/>
        </xsl:copy>
    </xsl:template>

    <xsl:template match="hospitals/hospital[hospId='2']/department[depId='3']/clinic[cid='9']/status">
        <status>123</status>
    </xsl:template>
</xsl:stylesheet>

XML Output
<hospitals>
   <hospital>
      <department>
         <clinic>
            <cid>8</cid>
            <clinicName>clinic8</clinicName>
            <status>1</status>
         </clinic>
         <clinic>
            <cid>9</cid>
            <clinicName>clinic9</clinicName>
            <status>123</status>
         </clinic>
         <depId>3</depId>
         <departmentName>dental</departmentName>
      </department>
      <hospId>2</hospId>
      <hospitalName>appolo</hospitalName>
   </hospital>
   <hospital>
      <department>
         <clinic>
            <cid>82</cid>
            <clinicName>clinic82</clinicName>
            <status>0</status>
         </clinic>
         <clinic>
            <cid>92</cid>
            <clinicName>clinic92</clinicName>
            <status>0</status>
         </clinic>
         <depId>4</depId>
         <departmentName>mental</departmentName>
      </department>
      <hospId>2</hospId>
      <hospitalName>manipal</hospitalName>
   </hospital>
</hospitals>

A: It sounds as if you are trying to use XSLT to change the original XML file. XSLT cannot change the original file. You may use it to transform the XML and output it to another XML through the use of a program or script that runs XSLT.


text:
Q: Unable To Load Redash Page to get API Key During Installation of Formsflow ai Please can anyone help profer a solution. I am installing Formsflow ai on Docker Desktop following the Docker Based Quick Installation instructions on the formsflow page. On the command line,the Redash API Key is requested but when i go to Http://localhost:7000 for opening the Redash Application, i get Internal Server Error: "The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application."
Pls can anyone help for how to resolve this.
I have not done anything as am new to this.


text:
Q: Defualt id generated by Eclipse has char inside the value, and the variable type is long. How? This is not new, but I wonder how come java can assign something like, 1L to long datatype.
private static final long serialVersionUID = 1L;

where the definition of long data type is,

long: The long data type is a 64-bit signed two's complement integer.
  It has a minimum value of -9,223,372,036,854,775,808 and a maximum
  value of 9,223,372,036,854,775,807 (inclusive). Use this data type
  when you need a range of values wider than those provided by int.

From : Oracle, Java primitive datatypes

A: The L indicates that it is a long. In other words, 1 is an int whereas 1L is a long. It is specified in the Java Language Specification #3.10.1:

An integer literal is of type long if it is suffixed with an ASCII letter L or l (ell); otherwise it is of type int.
  The suffix L is preferred, because the letter l (ell) is often hard to distinguish from the digit 1 (one).


text:
Q: Linking properly object files with nvcc (CUDA-RINSIDE) I'm trying to make Rinside work with some CUDA code. The first time I tried to compile them directly with NVCC but it was impossible to handle Rinside with nvcc, so now I'm trying another way.
I compile Rinside code with g++ and obtain the object files (.o) then compile some CUDA code with nvcc and obtain the other .o, then link them together but I get some "unreference error".
This is the RINSIDE CODE:
#include <RInside.h>                            // for the embedded R via RInside

extern "C"
void someCUDAcode();

int main(int argc, char *argv[]) {

    RInside R(argc, argv);                      // create an embedded R instance
    someCUDAcode();
    exit(0);

}

And this is the CUDA CODE:
#include <cuda.h>
#include <cuda_runtime.h>
#include <R.h>

__global__ void mykernel(int a){
  int id = threadIdx.x;
  int b = a;
  b++;
  id++;
}

extern "C"
void someCUDAcode() {
  mykernel<<<1, 1>>>(1);
}

And this is my makefile:
## and set R_HOME accordingly as an environment variable
R_HOME :=       $(shell R RHOME)

sources :=      $(wildcard *.cpp)
programs :=         $(sources:.cpp=)

## include headers and libraries for R
RCPPFLAGS :=        $(shell $(R_HOME)/bin/R CMD config --cppflags)
RLDFLAGS :=         $(shell $(R_HOME)/bin/R CMD config --ldflags)
RBLAS :=        $(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
RLAPACK :=      $(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)

## if you need to set an rpath to R itself, also uncomment
#RRPATH :=      -Wl,-rpath,$(R_HOME)/lib

## include headers and libraries for Rcpp interface classes
## note that RCPPLIBS will be empty with Rcpp (>= 0.11.0) and can be omitted
RCPPINCL :=         $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
##RCPPLIBS :=       $(shell echo 'Rcpp:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

## include headers and libraries for RInside embedding classes
RINSIDEINCL :=      $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RINSIDELIBS :=      $(shell echo 'RInside:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

## compiler etc settings used in default make rules
ifeq ($(HOST_OS),darwin)
    CXX := clang++ $(shell $(R_HOME)/bin/R CMD config CXX)
else
    CXX := $(shell $(R_HOME)/bin/R CMD config CXX)
endif
CPPFLAGS :=         -Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)
CXXFLAGS :=         $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R CMD config CXXFLAGS)
LDLIBS :=       $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS)

#########################################
CUDA_HOME = /usr/local/cuda-9.1

# This defines what the shared object libraries will be
PKG_LIBS= -L/usr/local/cuda-9.1/lib64 -Wl,-rpath,/usr/local/cuda-9.1/lib64 -lcudart -d

NVCC = $(CUDA_HOME)/bin/nvcc
CUDA_INC = $(CUDA_HOME)/include
CUDA_LIB = $(CUDA_HOME)/lib64
R_INC = /usr/share/R/include
LIBS = -lcudart -d
NVCC_FLAGS = -Xcompiler "-fPIC" -I$(R_INC)

##-gencode arch=compute_20,code=sm_20 -gencode arch=compute_30,code=sm_30 -gencode arch=compute_35,code=sm_35
### Define objects
cu_sources := $(wildcard *cu)
cu_sharedlibs := $(patsubst %.cu, %.o,$(cu_sources))

cpp_sources := $(wildcard *.cpp)
cpp_sharedlibs := $(patsubst %.cpp, %.o, $(cpp_sources))

OBJECTS = $(cu_sharedlibs) $(cpp_sharedlibs)

all : test.exe

test.exe: $(OBJECTS)

%.o: %.cpp $(cpp_sources)
        $(CXX) $< -c -fPIC -I$(CPPFLAGS) $(CXXFLAGS) $(LDLIBS)

%.o: %.cu $(cu_sources)
        $(NVCC) $(NVCC_FLAGS) -I$(CUDA_INC) $< -c

When I do "make" the makefile compile properly everything, I obtain my .o files but, then can't create the executable. When I try to compile them with "nvcc test.o cuda.o" I get this error:
pesco@pesco-PC:~/Scrivania/PURECUDA$ nvcc -o someCUDAcode.o test.o
test.o: nella funzione "Rcpp::Rstreambuf<false>::xsputn(char const*, long)":
/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include/Rcpp/iostream/Rstreambuf.h:56: riferimento non definito a "REprintf"
test.o: nella funzione "Rcpp::Rstreambuf<false>::sync()":
/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include/Rcpp/iostream/Rstreambuf.h:80: riferimento non definito a "R_FlushConsole"
test.o: nella funzione "Rcpp::Rstreambuf<true>::sync()":
/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include/Rcpp/iostream/Rstreambuf.h:76: riferimento non definito a "R_FlushConsole"
test.o: nella funzione "Rcpp::Rstreambuf<true>::xsputn(char const*, long)":
/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include/Rcpp/iostream/Rstreambuf.h:52: riferimento non definito a "Rprintf"
/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include/Rcpp/iostream/Rstreambuf.h:52: riferimento non definito a "Rprintf"
test.o: nella funzione "Rcpp::Rstreambuf<false>::xsputn(char const*, long)":
/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include/Rcpp/iostream/Rstreambuf.h:56: riferimento non definito a "REprintf"
test.o: nella funzione "main":
/home/pesco/Scrivania/PURECUDA/test.cpp:18: riferimento non definito a "RInside::RInside(int, char const* const*, bool, bool, bool)"
/home/pesco/Scrivania/PURECUDA/test.cpp:19: riferimento non definito a "someCUDAcode"
/home/pesco/Scrivania/PURECUDA/test.cpp:18: riferimento non definito a "RInside::~RInside()"
collect2: error: ld returned 1 exit status

but I don't know how to handle this error. How can I link them together properly? Thank you :)
I'm working with:
CUDA 9.1:
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2017 NVIDIA Corporation
Built on Fri_Nov__3_21:07:56_CDT_2017
Cuda compilation tools, release 9.1, V9.1.85

NVIDIA DRIVER:
pesco@pesco-PC:~/Scrivania/PURECUDA$ nvidia-smi
Mon Jul 23 11:16:50 2018
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 390.48                 Driver Version: 390.48                    |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|===============================+======================+======================|
|   0  GeForce GT 740M     Off  | 00000000:01:00.0 N/A |                  N/A |
| N/A   58C    P8    N/A /  N/A |    110MiB /  2004MiB |     N/A      Default |
+-------------------------------+----------------------+----------------------+

UBUNTU 16.04 LTS
G++: g++ (Ubuntu 5.4.0-6ubuntu1~16.04.10) 5.4.0 20160609
I hope I was clear, sorry for my English!

A: As @talonmies suggested you can resolve the "unreference error" just adding the CUDA object file and library while compiling it with g++, to be exactly I taked a fresh makefile located in the example folder of RInside and then I added to LDLIBS the path of the .o and the .so I just obtained from the previous compilation I made and everything worked, I don't know If it work properly but, at least we have an executable! To be exactly this is the new makefile:
R_HOME :=       $(shell R RHOME)

sources :=      $(wildcard *.cpp)
programs :=         $(sources:.cpp=)

## include headers and libraries for R
RCPPFLAGS :=        $(shell $(R_HOME)/bin/R CMD config --cppflags)
RLDFLAGS :=         $(shell $(R_HOME)/bin/R CMD config --ldflags)
RBLAS :=        $(shell $(R_HOME)/bin/R CMD config BLAS_LIBS)
RLAPACK :=      $(shell $(R_HOME)/bin/R CMD config LAPACK_LIBS)

## if you need to set an rpath to R itself, also uncomment
#RRPATH :=      -Wl,-rpath,$(R_HOME)/lib

## include headers and libraries for Rcpp interface classes
## note that RCPPLIBS will be empty with Rcpp (>= 0.11.0) and can be omitted
RCPPINCL :=         $(shell echo 'Rcpp:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RCPPLIBS :=         $(shell echo 'Rcpp:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

##NVCC HEADER AND DECLARATION TO CREATE THE CUDA OBJECT FILE

## include headers and libraries for RInside embedding classes
RINSIDEINCL :=      $(shell echo 'RInside:::CxxFlags()' | $(R_HOME)/bin/R --vanilla --slave)
RINSIDELIBS :=      $(shell echo 'RInside:::LdFlags()'  | $(R_HOME)/bin/R --vanilla --slave)

## compiler etc settings used in default make rules
CXX :=          $(shell $(R_HOME)/bin/R CMD config CXX)
CPPFLAGS :=         -Wall $(shell $(R_HOME)/bin/R CMD config CPPFLAGS)
CXXFLAGS :=         $(RCPPFLAGS) $(RCPPINCL) $(RINSIDEINCL) $(shell $(R_HOME)/bin/R CMD config CXXFLAGS)
LDLIBS :=       $(RLDFLAGS) $(RRPATH) $(RBLAS) $(RLAPACK) $(RCPPLIBS) $(RINSIDELIBS) /home/pesco/Scrivania/NEWTRY/someCUDAcode.o /usr/local/cuda/lib64/libcudart.so

all:        $(programs)
            @test -x /usr/bin/strip && strip $^

run:            $(programs)

clean:
            rm -vf $(programs)
            rm -vrf *.dSYM

And the new .cpp:
#include <RInside.h>

extern "C"
void someCUDAcode();
           // for the embedded R via RInside

int main(int argc, char *argv[]) {

    RInside R(argc, argv);              // create an embedded R instance

    someCUDAcode();

    R["txt"] = "Hello, world!\n";   // assign a char* (string) to 'txt'

    R.parseEvalQ("cat(txt)");           // eval the init string, ignoring any returns

    exit(0);
}

this is what I obtain doing "make":
g++ -I/usr/share/R/include -I/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/Rcpp/include -I/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/RInside/include -g -O2 -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -g -Wall    rinside_sample0.cpp  -Wl,--export-dynamic -fopenmp  -L/usr/lib/R/lib -lR -lpcre -llzma -lbz2 -lz -lrt -ldl -lm  -lblas -llapack  -L/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/RInside/lib -lRInside -Wl,-rpath,/home/pesco/R/x86_64-pc-linux-gnu-library/3.2/RInside/lib /home/pesco/Scrivania/NEWTRY/someCUDAcode.o /usr/local/cuda/lib64/libcudart.so -o rinside_sample0

and running the executable:
pesco@pesco-PC:~/Scrivania/NEWTRY$ ./rinside_sample0
Hello, world!


text:
Q: im trying to add commandLink to my visualforce form but it doesnt exist im trying to add commandlink to my vf pageblock table but its not even exist. I get 0 error in developer console but it doesnt work. i tried to add it into column and it doesnt work tried alot of things please help me
    <apex:page standardController="Account" >
   <apex:form >

    <apex:pageBlock title="Account Primary Contact" mode="edit">
        <apex:pageBlockButtons >
           <apex:commandButton action="{!save}" value="Save"/>
        <apex:commandButton action="{!cancel}" value="Cancel"/>
        </apex:pageBlockButtons>
       <apex:pageBlockSection >

           <apex:inputField value="{! Account.Name }"/>
           <apex:inputField value="{! Account.Phone }"/>
           <apex:inputField value="{! Account.ID }"/>
           <apex:inputField value="{! Account.Type}"/>
           <apex:inputField value="{! Account.Phone }"/>
           <apex:inputField value="{! Account.AccountNumber }"/>
           <apex:inputField value="{! Account.Active__c }"/>
        </apex:pageBlockSection>
    </apex:pageBlock>

   </apex:form>
     <apex:pageBlock title="Search Related Contacts">
        <apex:pageBlockSection ></apex:pageBlockSection>
     </apex:pageBlock>

    <apex:pageBlock title="Related Contacts">
        <apex:form>

   <apex:pageBlockTable value="{!Account.contacts}" var="contact">
      <apex:column value="{!contact.Name}"/>
      <apex:column value="{!contact.Title}"/>
      <apex:column value="{!contact.Phone}"/>
      <apex:column value="{!contact.Is_Primary_Contact__c}"/>

       <apex:commandLink action="{!save}" value="set"/>

   </apex:pageBlockTable>
     </apex:form>
</apex:pageBlock>
</apex:page>


text:
Q: Integral $\int_0^1 \ln(x)^n \operatorname{Ei}(x) \, dx$ I've conjectured the following identity for $n\geq0$ integers:
$$
\int_0^1 \ln(x)^n \operatorname{Ei}(x) \, dx = (-1)^{n+1}n! \cdot \left(-\operatorname{Ei}(1)+\sum_{k=1}^{n+1} {_kF_k}\left(\begin{array}c1,1,\dots,1\\2,2,\dots,2\end{array}\middle|\,1\right)\right),
$$
where $\ln$ is the natural logarithm, $\operatorname{Ei}$ is the exponential integral and ${_pF_q}$ is the generalized hypergeometric function.
For $n=0$ it is $1-e+\operatorname{Ei}(1)$ and for $n=1$ it is $e-1-\gamma$, where $e$ is base of the natural logarithm, and $\gamma$ is the Euler-Mascheroni constant.
How could we prove this identity?

A: We can do the first two cases by integrating by parts and using the fact that $$\text{Ei}(x) = \ln (x) + \gamma + \mathcal{O}(x) \, , \quad x>0.$$
For the first one, we have
$$ \begin{align} \int_{0}^{1} \text{Ei}(x) \, dx &= x \text{Ei}(x) \Big|^{1}_{0^{+}} - \int_{0}^{1}e^{x} \, dx \\ &= \text{Ei}(1)- e +1. \end{align}$$
And for the second one, we have
$$\begin{align}\int_{0}^{1} \ln(x) \text{Ei}(x) \, dx &= \text{Ei}(x) \left(x\ln (x) -x \right) \Bigg|^{1}_{0^{+}}-\int_{0}^{1} e^{x} \ln (x) \, dx + \int_{0}^{1} e^{x} \, dx \\ &= -\text{Ei}(1) - \Big(e^{x} \ln(x) - \text{Ei}(x) \Big) \Bigg|^{1}_{0^{+}} + e -1 \\ &= - \text{Ei}(1) + \text{Ei}(1) - \gamma + e -1 \\ &= -\gamma + e -1 \end{align}$$
since
$$\lim_{x \to 0^{+}} \Big(e^{x} \ln(x) - \text{Ei}(x) \Big) = \lim_{x \to 0^{+}} \Big(\big(1+\mathcal{O}(x) \big)\ln(x) - \ln(x) - \gamma + \mathcal{O}(x) \Big) = - \gamma.$$


text:
Q: Android: Refresh bitmap with new data I am trying to create a 15fps "bitmap video" of random pixel colors.  The following code displays one bitmap correctly, however does not update/refresh the image with a new random one.  Can anyone please help me figure out why?
public class ViewThread extends Thread {
    private SurfaceHolder mHolder;
    private Panel mPanel;
    private boolean mRun = false;

    public ViewThread( Panel panel) {
        mPanel = panel;
        mHolder = mPanel.getHolder();
    }

    public void setRunning(boolean run) {
        mRun = run;
    }

    @Override
    public void run() {
        Canvas canvas = null;
        while (mRun) {
            canvas = mHolder.lockCanvas();
            if (canvas != null) {
                mPanel.doDraw(canvas);
                mHolder.unlockCanvasAndPost(canvas);
            }
        }
    }
}

public class Panel extends SurfaceView implements SurfaceHolder.Callback {
    private ViewThread mThread;
    private Bitmap mBitmap;
    private int[]   mcolors;

    public Panel(Context context) {
        super(context);
        init();
    }

    private void init() {
        getHolder().addCallback(this);
        mThread = new ViewThread(this);

        // create a graphic
        mcolors = colorMap();
        int[] colors = mcolors;
        mBitmap = Bitmap.createBitmap(colors, 64, 64, Bitmap.Config.ARGB_8888);
        mBitmap = Bitmap.createScaledBitmap(mBitmap, 256, 256, false);
    }

    protected void doDraw(Canvas canvas) {
        canvas.drawColor(Color.BLACK);
        canvas.drawBitmap(mBitmap, 8, 8, null);
    }

    public void surfaceChanged(SurfaceHolder holder, int format, int width, int height) {
    }

    //@Override
    public void surfaceCreated(SurfaceHolder holder) {
        if (!mThread.isAlive()) {
            mThread = new ViewThread(this);
            mThread.setRunning(true);
            mThread.start();
        }
    }

    public void surfaceDestroyed(SurfaceHolder holder) {
         if (mThread.isAlive()) {
             mThread.setRunning(false);
         }
    }
}

private static int[] colorMap() {

     int[] ltable = { 0xff000000, 0xff00000f, 0xff00001e, 0xff00002d, 0xff00003c, 0xff00004b,
                    0xff00005a, 0xff000069, 0xff000078, 0xff000087, 0xff000096, 0xff0000a5,
                    0xff0000b4, 0xff0000c3, 0xff0000d2, 0xff0000e1, 0xff0000f0, 0xff0000ff,
                    0xff0f00ff, 0xff1e00ff, 0xff2d00ff, 0xff3c00ff, 0xff4b00ff, 0xff5a00ff,
                    0xff6900ff, 0xff7800ff, 0xff8700ff, 0xff9600ff, 0xffa500ff, 0xffb400ff,
                    0xffc300ff, 0xffd200ff, 0xffe100ff, 0xfff000ff, 0xffff00ff, 0xffff00f0,
                    0xffff00e1, 0xffff00d2, 0xffff00c3, 0xffff00b4, 0xffff00a5, 0xffff0096,
                    0xffff0087, 0xffff0078, 0xffff0069, 0xffff005a, 0xffff004b, 0xffff003c,
                    0xffff002d, 0xffff001e, 0xffff000f, 0xffff0000 };

     int[] mcolors = new int[4096];
     Random rand = new Random();

     for(int i=0; i < 4096; i++)
     {
         int num = rand.nextInt(52);
         mcolors[i] = ltable[num];
     }

     return mcolors;
}

}

A: It appears to me that you are calling your thread only once when surfaceCreated() is called. After that, your thread is never called again. I believe you need something like timer and reinitiate thread or call thread run() method to display another image.
[EDIT]
Few other things
1) Recreate your canvas holder in every while loop.
while (run) {
         c = null;
         try {
            c =  panel.getHolder().lockCanvas();

2) Also, after android 1.5 a surfaceview can't be refresh more 40-45 time per second so try reducing fps to 30 and see if it makes any difference.
Example: http://www.anddev.org/android-2d-3d-graphics-opengl-problems-f55/surfaceview-portage-1-5-other-version-of-android-t15675.html


text:
Q: Facebook feed - remove extra Facebook JS from anchor Please help me to replace all the additional Facebook information from here using C# .net Regex Replace method.
Example
http://on.fb.me/OE6gnBsomehtml

Output
somehtml on.fb.me/OE6gnB somehtml

I tried following regex but they didn't work for me
searchPattern = ")?([.]*)?()?";
replacePattern = "$3";

Thanks

A: I manage to do this using regex with following code
 searchPattern = "(.*?)";
          string html1 = Regex.Replace(html, searchPattern, delegate(Match oMatch)
    {
        return string.Format("{1}", HttpUtility.UrlDecode(oMatch.Groups[2].Value), oMatch.Groups[4].Value);

    });

A: You can try this (System.Web has to be added to use System.Web.HttpUtility):
        string input = @"http://on.fb.me/OE6gnBsomehtml";
        string rootedInput = String.Format("<root>{0}</root>", input);
        XDocument doc = XDocument.Parse(rootedInput, LoadOptions.PreserveWhitespace);

        string href;
        var anchors = doc.Descendants("a").ToArray();
        for (int i = anchors.Count() - 1; i >= 0;  i--)
        {
            href = HttpUtility.ParseQueryString(anchors[i].Attribute("href").Value)[0];

            XElement newAnchor = new XElement("a");
            newAnchor.SetAttributeValue("href", href);
            newAnchor.SetValue(href.Replace(@"http://", String.Empty));

            anchors[i].ReplaceWith(newAnchor);
        }
        string output = doc.Root.ToString(SaveOptions.DisableFormatting)
                        .Replace("<root>", String.Empty)
                        .Replace("</root>", String.Empty);


text:
Q: Add to array in Mongoose schema I have a mongoose schema model that looks like the below example. The accounts field is an array of account IDs.
var ListingSchema = new Schema({
  listing: { type: String, required: true },
  admin: { type: String, required: true, index: true },
  accounts: [{ type: String, index: true }]
});

Now in my Node/Express backend, I add an entry like so:
Listing.create({
  listing: req.body.id,
  admin: req.session.userID,
  account: req.session.userID
}, function (err){
  if (err) throw err;
  else res.send({success:true});
});

However I'm not adding to the account field correctly because it's an array. How can I do that?

A: For a create try this:
var accounts = [req.session.userID];

Listing.create({
  listing: req.body.id,
  admin: req.session.userID,
  accounts: accounts
}, function (err){
  if (err) throw err;
  else res.send({success:true});
});

For an update try this:
{ $push: { accounts: 'value' }

A: var accounts = [req.session.userID];

And
accounts: [{ type: String, index: true }]

should be
accounts: [{ type: Array, index: true }]


text:
Q: Record request and response from client layer for audit logging in .net core without using middleware Is there a way of logging the request and response from the client layer(not from controller as we can use middleware to log the same there).
I am looking to eliminate developer code for audit log here (//log request ,//log response and and creating  a provider context ) instead move them to a common handler , may be inherit from delegating handler delegating handler and have the Audit log code there.
Any ideas ?
Currently we have audit logging in the client where another service is called but the developer has to do the following :
Client layer code:
    {
        IRestResponse response = null;
        ConnectorHTMLResponse CCMSResponse = null;

        request.Validate(request.TemplateName);

        var providerContext = _messageTracker.CreateProviderContext(correlationId, "MailTrigger", "GetHTML", OperationProtocols.HTTPS);

      //log request
      await providerContext.StartAsync(request, param => request.TemplateName);

        var bodyJson = ToBodyJson(request, TemplateType.HTML);

        try
        {
            response = await ExecuteAsync(bodyJson, correlationId);
        }
        catch (Exception ex)
        {
            await providerContext.RaiseExceptionAsync(ex);
            throw;
        }
        Response = ConstructHTMLDocumentDetails(ValidateResponse(response));

        //log response
            await providerContext.CompletedAsync(Response);

        return Response;
    }

//and in the message tracker(Common code )

 public static ProviderContext CreateProviderContext(this IMessageTracker messageTracker, string correlationId, string systemId, string operationName, OperationProtocols protocol)
    {
        var context = new ProviderContext(
            messageTracker,
            correlationId,
            systemId,
            operationName,
            Assembly.GetCallingAssembly().GetName().Name,
            protocol
        );

        return context;
    }

 public async Task StartAsync<T>(T payload, Func<T, string> primaryIdentifierFunc = null, Func<T, string> secondaryIdentifierFunc = null)
    {
        await StartAsync(payload, primaryIdentifierFunc?.Invoke(payload), secondaryIdentifierFunc?.Invoke(payload));
    }

 public async Task CompletedAsync<T>(T payload, Func<T, string> primaryIdentifierFunc = null, Func<T, string> secondaryIdentifierFunc = null)
    {
        _source.Payload = payload.AsPayload();
        _source.PrimaryIdentifier = primaryIdentifierFunc?.Invoke(payload) ?? _source.PrimaryIdentifier;
        _source.SecondaryIdentifier = secondaryIdentifierFunc?.Invoke(payload) ?? _source.SecondaryIdentifier;

        await _tracker.TrackProviderResponseAsync(
           //track in cloud
        );
    }``


text:
Q: Passing multiple value tu ActionResult I have this code in mvc 3 razor
@using (Html.BeginForm("MyAction", "MyController"))
{
    <input type="text" id="txt" name="txt"/>
    <input type="image" src="image.gif" alt="" />
}

in controller I have this code
[HttpPost]
public ActionResult MyAction(string text)
{
    //TODO something with text and return value...
}

now, how to send a new value, for exemple id to Action result??? Thanks

A: You use a view model:
public class MyViewModel
{
    public string Text { get; set; }

    // some other properties that you want to work with in your view ...
}

and then pass this view model to the view:
public ActionResult MyAction()
{
    var model = new MyViewModel();
    model.Text = "foo bar";
    return View(model);
}

[HttpPost]
public ActionResult MyAction(MyViewModel model)
{
    // remove the Text property from the ModelState if you intend
    // to modify it in the POST controller action or HTML helpers will
    // use the old value
    ModelState.Remove("Text");
    model.Text = "some new value";
    return View(model);
}

and then the view is strongly typed to this model:
@model MyViewModel

@using (Html.BeginForm("MyAction", "MyController"))
{
    @Html.EditorFor(x => x.Text)
    <input type="image" src="image.gif" alt="" />
}


text:
Q: What is the AngularJS way of handling a modal like this I know you're not supposed to put your display logic inside of a controller and I'm struggling with the proper AngularJS way to approach this.
I'm presenting forms inside modals. I'm using Zurb Foundation's reveal for the modal.
Markup:

Add Widget

New Widget

  <form>
    <fieldset>
      <legend>Widget Name</legend>
      <input type="text" ng-model="ui.add_widget_value" />
    </fieldset>

Add Widget

Cancel

  </form>

Controller:
  ...
  $scope.modalAddWidget = function() {
    $("#modalAddWidget").reveal();
  }
  $scope.addWidget = function() {
    $scope.myobject.widgets.push({"name": $scope.ui.add_widget_value});
    $scope.ui.add_widget_value = '';
    $('#modalAddWidget').trigger('reveal:close');
  }
  $scope.addBudgetCancel = function() {
    $scope.ui.add_widget_value = '';
    $('#modalAddWidget').trigger('reveal:close');
  }
  ...

Note: $scope.ui is an object I am using to store UI values that shouldn't be bound to my object until the user actually clicks "Add Widget"
$scope.myobj is where my data is stored.
Foundation's $("#modalAddWidget").reveal(); function presents the modal overlay.
Since I shouldn't be putting my display code inside the controller, what is the proper way to approach this?

A: You don't want to manipulate the DOM (or even reference it) from your controllers.
A directive is best here.
app.directive('revealModal', function (){
   return function(scope, elem, attrs) {
     scope.$watch(attrs.revealModal, function(val) {
        if(val) {
           elem.trigger('reveal:open');
        } else {
           elem.trigger('reveal:close');
        }
     });
     elem.reveal();
   }
});

then in your controller:
$scope.modalAddWidget = function (){
   $scope.ui = { add_widget_value: '' };
   $scope.showModal = true;
};

$scope.addWidget = function (){
    $scope.myobject.widgets.push({"name": $scope.ui.add_widget_value});
    $scope.ui.add_widget_value = '';
    $scope.showModal = true;
};

And in your HTML

Add Widget

New Widget

  <form name="addWidgetForm" ng-submit="addWidget()">
    <fieldset>
      <legend>Widget Name</legend>
      <input type="text" name="widgetValue" ng-model="ui.add_widget_value" required />
      required
    </fieldset>
    <button type="submit" class="small button right">Add Widget</button>

Cancel

  </form>

Basically you'd set a boolean in your scope to show and hide your modal. (I'm not sure of reveal modal's open/close mechanism, so I'm guessing in my code above).
ALSO: I went through the effort of adding some validation in there.


text:
Q: PHP and MySQL SELECT problem Trying to check if a name is already stored in the database from the login user. The name is a set of dynamic arrays entered by the user threw a set of dynamic form fields added by the user. Can some show me how to check and see if the name is already entered by the login user? I know my code can't be right. Thanks!
MySQL code.
SELECT *
FROM names
WHERE name = '" . $_POST['name'] . "'
AND userID = '$userID'

Here is the MySQL table.
CREATE TABLE names (
id INT UNSIGNED NOT NULL AUTO_INCREMENT,
userID INT NOT NULL,
name VARCHAR(255) NOT NULL,
meaning VARCHAR(255) NOT NULL,
PRIMARY KEY (id)
);

A: If $_POST['name'] is actually an array of strings, as you say, then try this PHP:
$namesString = '';
foreach ($i=0; $i < count($_POST['name']) $i++)
{
    $namesString .= "'" . mysql_real_escape_string($_POST['name'][$i]) . "'";
    if(isset($_POST['name'][$i + 1]) $nameString .= ', ';
}

With this query:
 SELECT * FROM `names`
 WHERE `name` IN ( $namesString )
    AND `userID` = '$userID'

The query will return all the rows in which the name is the same as string in $_POST['name'].

A: First of all, if the userID field is unique, you should add a unique index on it in your table.
Also, watch out for SQL injection attacks!
Using something like this is much more secure:
$sqlQuery = sprintf('SELECT COUNT(id) AS "found" FROM names WHERE userID = "%s"', mysql_real_escape_string($_POST['name'], $conn));

This SQL query will return 1 row with 1 field (named found) which will return you the number of matched rows (0 if none). This is perfect if you only want to check if the userID exists (you don't need to fetch all data for this).
As for the dynamic array, you will have to post more information and I'll update my answer.
Meanwhile here are some usefull PHP functions that can help you do what you want:
For MySQL queries:

*

*mysql_connect

*mysql_real_escape_string

*mysql_query

*mysql_fetch_assoc
For your list of users:

*

*explode

*implode

A: Stated as you say, I'm quite sure the code does exactly what you are asking for. The SELECT should return the records that respond both to the name sent and the current user ID.
If you need some php code, here it is (should be refined):
$result = mysql_query('YOUR SELECT HERE');
if (!$result) {
   die('ERROR MESSAGE');
} else {
   $row = mysql_fetch_assoc($result));
   // $row is an associative array whose keys are the columns of your select.
}

Remember to escape the $_POST.


text:
Q: How to update MongoDB quickly? There is a MongoDB collection A, and another file is text file, now I want to use mapreduce to read the text file and test whether each record exist in A, if it does, the update the record in A according to the corresponding record from text file, or insert the record to A. Now I use the MongoUpdateWritable class to do this thing, but it is too slow, can someone tell me how to improve the speed to do this thing?
The code sample is as fllows:
    query.append("x", x);

    update.append("$set", appendObj.append("y", y));

    muw.setQuery(record);
    muw.setModifiers(update);

    context.write(NullWritable.get(), muw);

    job3.setMapOutputValueClass(MongoUpdateWritable.class);
    job3.setOutputFormatClass(MongoOutputFormat.class);