Getting cryptic "org.apache.openjpa.persistence.PersistenceException: null" exception when using entity manager with OpenJPA in embedded TomEE 8.0

Question: I was trying to write tests for a Java Enterprise web application developed using the Apache TomEE Maven plugin. The application works just fine and everything seems to be functioning correctly. I thought of using JUnit Jupiter 5 and the EJBContainer API with embedded TomEE 8.0.0 (I'm using the same version for the TomEE Maven Plugin). However, after I bootstrap the embedded container, as soon as a method that uses an entity manager is called, a very confusing exception is launched. Here follows the exception, along with some infos logged by the embedded container just before it is thrown.
<code>dic 14, 2019 2:55:27 AM null
INFO: Starting OpenJPA 3.1.0
dic 14, 2019 2:55:28 AM null
INFO: Using dictionary class "org.apache.openjpa.jdbc.sql.HSQLDictionary" (HSQL Database Engine 2.3.2 ,HSQL Database Engine Driver 2.3.2).
dic 14, 2019 2:55:28 AM null
INFO: Connected to HSQL Database Engine version 2.2 using JDBC driver HSQL Database Engine Driver version 2.3.2.
dic 14, 2019 2:55:28 AM null
INFO: Creating subclass and redefining methods for "[class application.entities.User, class application.entities.Vote, class application.entities.Report, class application.entities.BacklogEntry, class application.entities.Review]". This means that your application will be less efficient than it would if you ran the OpenJPA enhancer.
dic 14, 2019 2:55:28 AM org.apache.openejb.util.LogStreamAsync run
SEVERE: EjbTransactionUtil.handleSystemException: null
<openjpa-3.1.0-rafcec21a1d489dff682a3ce7986fac6a1c80e8e0 fatal general error> org.apache.openjpa.persistence.PersistenceException: null
    at org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:97)
    at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:178)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:316)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:240)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:216)
    at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:166)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:262)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:64)
    at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:208)
    at org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:125)
    at org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:145)
    at org.apache.openejb.persistence.JtaEntityManager.find(JtaEntityManager.java:220)
    at application.model.UsersAgent.getUser(UsersAgent.java:46)
    at application.model.UsersAgent.createUser(UsersAgent.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
    at org.apache.bval.cdi.BValInterceptor.invoke(BValInterceptor.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
    at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:191)
    at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:102)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
    at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
    at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:252)
    at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:212)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:260)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:89)
    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:349)
    at application.model.UsersAgent$$LocalBeanProxy.createUser(application/model/UsersAgent.java)
    at application.model.UsersAgentTest.test(UsersAgentTest.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
    at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:139)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:131)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:81)
    at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
    at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
    at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:86)
    ... 106 more
Caused by: java.lang.VerifyError
    at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
    at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)
    ... 111 more

javax.ejb.EJBException: The bean encountered a non-application exception; nested exception is:
    <openjpa-3.1.0-rafcec21a1d489dff682a3ce7986fac6a1c80e8e0 fatal general error> org.apache.openjpa.persistence.PersistenceException: null

    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.convertException(BaseEjbProxyHandler.java:449)
    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:353)
    at application.model.UsersAgent$$LocalBeanProxy.createUser(application/model/UsersAgent.java)
    at application.model.UsersAgentTest.test(UsersAgentTest.java:42)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.junit.platform.commons.util.ReflectionUtils.invokeMethod(ReflectionUtils.java:675)
    at org.junit.jupiter.engine.execution.MethodInvocation.proceed(MethodInvocation.java:60)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$ValidatingInvocation.proceed(InvocationInterceptorChain.java:125)
    at org.junit.jupiter.engine.extension.TimeoutExtension.intercept(TimeoutExtension.java:139)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestableMethod(TimeoutExtension.java:131)
    at org.junit.jupiter.engine.extension.TimeoutExtension.interceptTestMethod(TimeoutExtension.java:81)
    at org.junit.jupiter.engine.execution.ExecutableInvoker$ReflectiveInterceptorCall.lambda$ofVoidMethod$0(ExecutableInvoker.java:115)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.lambda$invoke$0(ExecutableInvoker.java:105)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain$InterceptedInvocation.proceed(InvocationInterceptorChain.java:104)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.proceed(InvocationInterceptorChain.java:62)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.chainAndInvoke(InvocationInterceptorChain.java:43)
    at org.junit.jupiter.engine.execution.InvocationInterceptorChain.invoke(InvocationInterceptorChain.java:35)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:104)
    at org.junit.jupiter.engine.execution.ExecutableInvoker.invoke(ExecutableInvoker.java:98)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.lambda$invokeTestMethod$6(TestMethodTestDescriptor.java:202)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.invokeTestMethod(TestMethodTestDescriptor.java:198)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:135)
    at org.junit.jupiter.engine.descriptor.TestMethodTestDescriptor.execute(TestMethodTestDescriptor.java:69)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:135)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
    at java.util.ArrayList.forEach(ArrayList.java:1257)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.invokeAll(SameThreadHierarchicalTestExecutorService.java:38)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$5(NodeTestTask.java:139)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$7(NodeTestTask.java:125)
    at org.junit.platform.engine.support.hierarchical.Node.around(Node.java:135)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.lambda$executeRecursively$8(NodeTestTask.java:123)
    at org.junit.platform.engine.support.hierarchical.ThrowableCollector.execute(ThrowableCollector.java:73)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.executeRecursively(NodeTestTask.java:122)
    at org.junit.platform.engine.support.hierarchical.NodeTestTask.execute(NodeTestTask.java:80)
    at org.junit.platform.engine.support.hierarchical.SameThreadHierarchicalTestExecutorService.submit(SameThreadHierarchicalTestExecutorService.java:32)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestExecutor.execute(HierarchicalTestExecutor.java:57)
    at org.junit.platform.engine.support.hierarchical.HierarchicalTestEngine.execute(HierarchicalTestEngine.java:51)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:248)
    at org.junit.platform.launcher.core.DefaultLauncher.lambda$execute$5(DefaultLauncher.java:211)
    at org.junit.platform.launcher.core.DefaultLauncher.withInterceptedStreams(DefaultLauncher.java:226)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:199)
    at org.junit.platform.launcher.core.DefaultLauncher.execute(DefaultLauncher.java:132)
    at com.intellij.junit5.JUnit5IdeaTestRunner.startRunnerWithArgs(JUnit5IdeaTestRunner.java:69)
    at com.intellij.rt.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:33)
    at com.intellij.rt.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:230)
    at com.intellij.rt.junit.JUnitStarter.main(JUnitStarter.java:58)
Caused by: <openjpa-3.1.0-rafcec21a1d489dff682a3ce7986fac6a1c80e8e0 fatal general error> org.apache.openjpa.persistence.PersistenceException: null
    at org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:97)
    at org.apache.openjpa.enhance.ManagedClassSubclasser.prepareUnenhancedClasses(ManagedClassSubclasser.java:178)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.loadPersistentTypes(AbstractBrokerFactory.java:316)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.initializeBroker(AbstractBrokerFactory.java:240)
    at org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:216)
    at org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:166)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:262)
    at org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:64)
    at org.apache.openejb.assembler.classic.ReloadableEntityManagerFactory.createEntityManager(ReloadableEntityManagerFactory.java:208)
    at org.apache.openejb.persistence.JtaEntityManagerRegistry.getEntityManager(JtaEntityManagerRegistry.java:125)
    at org.apache.openejb.persistence.JtaEntityManager.getEntityManager(JtaEntityManager.java:145)
    at org.apache.openejb.persistence.JtaEntityManager.find(JtaEntityManager.java:220)
    at application.model.UsersAgent.getUser(UsersAgent.java:46)
    at application.model.UsersAgent.createUser(UsersAgent.java:71)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
    at org.apache.bval.cdi.BValInterceptor.invoke(BValInterceptor.java:160)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
    at org.apache.openejb.monitoring.StatsInterceptor.record(StatsInterceptor.java:191)
    at org.apache.openejb.monitoring.StatsInterceptor.invoke(StatsInterceptor.java:102)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext$Invocation.invoke(ReflectionInvocationContext.java:205)
    at org.apache.openejb.core.interceptor.ReflectionInvocationContext.proceed(ReflectionInvocationContext.java:186)
    at org.apache.openejb.core.interceptor.InterceptorStack.invoke(InterceptorStack.java:85)
    at org.apache.openejb.core.stateless.StatelessContainer._invoke(StatelessContainer.java:252)
    at org.apache.openejb.core.stateless.StatelessContainer.invoke(StatelessContainer.java:212)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler.synchronizedBusinessMethod(EjbObjectProxyHandler.java:265)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler.businessMethod(EjbObjectProxyHandler.java:260)
    at org.apache.openejb.core.ivm.EjbObjectProxyHandler._invoke(EjbObjectProxyHandler.java:89)
    at org.apache.openejb.core.ivm.BaseEjbProxyHandler.invoke(BaseEjbProxyHandler.java:349)
    ... 65 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.openjpa.enhance.ClassRedefiner.redefineClasses(ClassRedefiner.java:86)
    ... 106 more
Caused by: java.lang.VerifyError
    at sun.instrument.InstrumentationImpl.retransformClasses0(Native Method)
    at sun.instrument.InstrumentationImpl.retransformClasses(InstrumentationImpl.java:144)
    ... 111 more
</code>
It's worth noting that the embedded container logs the following line, which does not appear when I start the application normally using the TomEE Maven plugin:
<code>INFO: Creating subclass and redefining methods for "[class application.entities.User, class application.entities.Vote, class application.entities.Report, class application.entities.BacklogEntry, class application.entities.Review]". This means that your application will be less efficient than it would if you ran the OpenJPA enhancer.
</code>
And the same goes for the following line, which is not included in the previous block:
<code>INFO: JAVA AGENT NOT INSTALLED. The JPA Persistence Provider requested installation of a ClassFileTransformer which requires a JavaAgent.  See http://tomee.apache.org/javaagent.html
</code>
I tried following the instruction provided at the URL http://tomee.apache.org/javaagent.html, which would most likely solve the issue, but those seem to be outdated and ultimately I can't get them to work.
Then I went and switched my persistence provider for the test from the default OpenJPA 3.1.0 to EclipseLink 2.7.5 (currently the latest version), and everything seems to be working fine... until it doesn't. The Criteria API is used to write queries in the application, and some of them use the JOIN clause along with a GROUP BY, and because of some nasty bug EclipseLink simply ignores the GROUP BY when formulating the JPQL equivalent query. I tried to temporarly fix that by writing these queries in plain JPQL, but some of them use the COALESCE function in the ORDER BY clause, and what do you know... that's not supported by OpenJPA, causing the application to throw errors when ran in a non-testing environment. But that isn't really related to the main issue, so let's move on.
Here follows my test class:
<code>public class UsersAgentTest {

    private static EJBContainer container;

    @BeforeAll
    public static void initializeContainer() {
        Properties properties = new Properties();
        properties.put("openejb.altdd.prefix", "test");
        container = EJBContainer.createEJBContainer(properties);
    }

    @AfterAll
    public static void stopContainer() {
        if (container != null)
            container.close();
    }

    @Test
    public void test() throws NamingException {
        Context context = container.getContext();
        UsersAgent usersAgent = (UsersAgent) context.lookup("java:global/soundrate/UsersAgent");
        User user = new User()
                .setUsername("test_user")
                .setEmail("email@example.com")
                .setPassword("password123")
                .setSignUpDate(new Date())
                .setRole(User.Role.USER);
        usersAgent.createUser(user);
        Assertions.assertNotNull(usersAgent.getUser("test_user"));
    }

}
</code>
These are the <code>test.persistence.xml</code> and <code>test.resources.xml</code> files:
<code><persistence xmlns="http://xmlns.jcp.org/xml/ns/persistence"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence
                                 http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd"
             version="2.1">
    <persistence-unit name="soundrateTestPersistenceUnit" transaction-type="JTA">
        <jta-data-source>jdbc/soundrateTestDataSource</jta-data-source>
        <properties>
            <property name="javax.persistence.schema-generation.database.action"
                      value="drop-and-create"/>
        </properties>
    </persistence-unit>
</persistence>
</code>
<code><resources>
    <Resource id="jdbc/soundrateTestDataSource" type="javax.sql.DataSource">
        JdbcDriver = org.hsqldb.jdbcDriver
        JdbcUrl = jdbc:hsqldb:mem:soundrate
    </Resource>
</resources>
</code>
The <code>persistence.xml</code> and <code>resources.xml</code> files are pretty much identical, with the only differences being the datasource and persistence unit names and the JDBC URL (with the test database being in-memory and the main one being file based, although since I'm using the TomEE Maven plugin there isn't much of a practical difference).
Please note that when injecting the entity managers throughout the application using the <code>PersistenceContext</code> annotation, I'm not specifying the <code>unitName</code> element to ensure that the correct persistence unit is used depending on wether tests are being ran or not; no ambiguity arises since both <code>persistence.xml</code> and <code>test.persistence.xml</code> define only one persistence unit each, so the proper one is automatically picked by the container (when running tests the main resource files are ignored in favor of the test ones).
As stated before, the exception is thrown as soon as an entity manager method is called (even <code>entityManager.getProperties()</code>). In the test, the method <code>userAgent.createUser(user)</code> is called, which looks like this:
<code>public void createUser(@NotNull final User user) {
    this.entityManager.persist(user);
}
</code>
Answer: In the end I've been able to solve the issue by adapting the instructions provided here.
Precisely, I added the following block to the <code>plugins</code> section in the POM file.
<code><plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-surefire-plugin</artifactId>
    <version>3.0.0-M4</version>
    <configuration>
        <forkCount>1</forkCount>
        <reuseForks>false</reuseForks>
        <argLine>-javaagent:"${project.build.directory}/openejb-javaagent-8.0.0.jar"</argLine>
        <workingDirectory>${project.build.directory}</workingDirectory>
    </configuration>
</plugin>
<plugin>
    <groupId>org.apache.maven.plugins</groupId>
    <artifactId>maven-dependency-plugin</artifactId>
    <version>3.1.1</version>
    <executions>
        <execution>
            <id>copy</id>
            <phase>process-resources</phase>
            <goals>
                 <goal>copy</goal>
            </goals>
            <configuration>
                <artifactItems>
                    <artifactItem>
                        <groupId>org.apache.tomee</groupId>
                        <artifactId>openejb-javaagent</artifactId>
                        <version>8.0.0</version>
                        <outputDirectory>${project.build.directory}</outputDirectory>
                    </artifactItem>
                </artifactItems>
            </configuration>
        </execution>
    </executions>
</plugin>
</code>
Should you be here for running into the same issue, ensure that the version of the <code>openejb-javaagent</code> artifact matches the one specified in the <code><argline></code> tag (<code>8.0.0</code> in this case).


Book on the Method of Sieves

Question: I am seeking recommendations for a good book on the method of sieves, with clear explanations of its differences to the method of kernel, its statistical properties as well as its application.
The level of the book should be suitable for a graduate math and statistics degree.
Answer: Here are some resources (not all books):
Papers:
Chapter 76 Large Sample Sieve Estimation of Semi-Nonparametric Models (Handbook of Econometrics)
I consider this the gold standard treatment of Sieve, it is theory heavy
Sieve Extremum Estimation
This is an easier version of the above
Nonparametric Sieve Regression: Least Squares, Averaging Least Squares, and Cross-Validation
Books:
Abstract inference by  Ulf Grenander  This is the founding treatment
All of Nonparametric Statistics  by  Larry Wasserman
Ch.8 and 10 would be helpful
Empirical Processes in M-Estimation by  Sara A. van de Geer This book is good for learning the techniques needed for the asymptotic analysis of sieve
Mathematical Foundations of Infinite-Dimensional Statistical Models
This is not about sieves but the chapter on approximation theory is very relevant to sieve
Videos:
Nonparametric Sieve Estimation

Book on the Method of Sieves


Introducing a dummy argument via STL or Boost

Question: Suppose one wants to fill a vector with random numbers. Then there is a following obvious solution:
vector<int> result;
result.resize(n);
for (int i = 0; i < n; ++i) {
    result[i] = generateRandomNumber();
}

OK, it obviously works, but I would like to understand what is the simplest STL/Boost way to get rid of the for loop. It is tempting to use std::transform, but it takes a function with one argument. Is there any nice STL way to introduce a dummy argument in a function?
Answer: The C++ standard library has std::generate() and std::generate_n();
For example:
#include <iostream>
#include <cstdlib>
#include <algorithm>
#include <vector>
#include <iterator>
int generateRandomNumber()
{
    return std::rand();
}
int main()
{
    int n = 10;
    std::vector<int> result;
    generate_n(back_inserter(result), n, generateRandomNumber);
    copy(result.begin(), result.end(), std::ostream_iterator<int>(std::cout, " "));
    std::cout << '\n';
}

test: https://ideone.com/5xD6P
As for the second question, if I understand it correctly, is how to create a functor that takes an int argument, ignores it, and calls your int f()?
C++98 way is to actually write the whole functor:
struct IgnoreArgument
{
    typedef int(*fp_t)();
    fp_t fp;
    IgnoreArgument(fp_t f) : fp(f) {}
    int operator()(int) const { return fp(); }
};
...
transform(v.begin(), v.end(), v.begin(), IgnoreArgument(f));

test: https://ideone.com/DTsyl
C++11 way is to use a lambda expression
transform(v.begin(), v.end(), v.begin(), [](int){return f();});

test: https://ideone.com/nAPXI
And the C++98/boost way is to use boost::bind
transform(v.begin(), v.end(), v.begin(), boost::bind(f));

test: https://ideone.com/cvd88
Comment: Thank you greatly. But the question about dummy variable is still open.
Comment: @Ilya Razenshteyn Could you give an example of how such variable would be used?
Comment: Suppose I have a function int f(), now I want to produce a function int g(int) { return f(); } using standard things.
Comment: Why not `generate_n(back_inserter(result), n, std::rand);` ?
Comment: @Rob OP had `generateRandomNumber()`, I only gave it sample content to have a compilable example.
Comment: Thanks. I thought it might be something more subtle.
Answer: Use generate_n with how many elements you want, along with a back_insert_iterator to the vector where you want them stored, and a pointer to the function that generates the numbers.
#include <vector>
#include <algorithm>

int generateRandomNumber()
{
    static int i = 0;
    return 42 + (i++);
}

int main()
{
    std::vector<int> vi;
    std::generate_n(back_inserter(vi), 10, &generateRandomNumber);
}

Note that by using the back_insert_iterator as I do here, you do not have to pre-size the vector, which is kludgy at best.
Comment: @Ilya:  Then replace the `back_inserter` in my example with `.begin()`
Comment: Thank you, but, again, the question about dummy variable is still open. It would be great to find it out.
Comment: @Ilya:  Maybe I don't understand the question then?  What dummy variable?
Answer: The problem here is that transform just isn't the right choice for the task at hand. The intent of transform is to take some inputs, transform each in some prescribed way, and produce an output for each of those inputs.
In this case, you don't have any inputs. transform would make sense if the values in the vector were based (somehow or other) in values in some existing vector.
generate_n is really the right solution to the problem -- it's intended to invoke some function/functor N times, producing N results, and assigning those to the output iterator (and its successors) that you supply. Since it's intended to generate values (rather than transforming existing values) the function/functor doesn't take an input, and you don't have to provide "fake" input.
As far as the "dummy" argument goes, wanting/needing it is probably a pretty good sign that (as in this case) you're using the wrong algorithm, and just shouldn't do that.
You do, however, sometimes get into the reverse situation: you want to use an algorithm that doesn't supply an argument, but you want to be able to supply an argument. For example, let's assume you wanted to be able to set the numbers in your array to a random number, with some lower and/or upper bound specified by the user. In this case, you want to be able to specify the bound(s) that'll be passed to your random number function, but neither generate nor generate_n has any provision for doing so.
In this case, you have two possibilities. One is bind (originally boost::bind, but now included in C++11). What I prefer as a rule is to use a functor, and I pass the argument(s) to the ctor:
class gen_random {
    int lower;
    int upper;
public:
    gen_random(int lower = 0, int upper = RAND_MAX) : lower(lower), upper(upper) {}

    int operator() { return rand_range(lower, upper);
};

int main() {
    std::vector<int> rand_ints;

    std::generate_n(std::back_inserter(rand_ints), 10, gen_random(1, 6));
    return 0;
}


sql server XML parameter with namespace attribute

Question: I am passing xml data to a stored procedure. if the xml contains xmlns attributes , it is failing .when i remove xmlns it is working fine. how can i remove xmlns before passing in to stored procedure. i am using sql server 2008 .
Answer: Don't try to avoid them - use them!
The easiest way to do this is by using the WITH XMLNAMESPACES construct - something like:
;WITH XMLNAMESPACES(DEFAULT 'http://your.name.space.here/2011/June')
(
   -- your XQuery/XPath code here - it will by default use the namespace given
)

You can easily have multiple namespaces, too - and you can give them prefixes as well (and use those in your XPath expressions):
;WITH XMLNAMESPACES('http://your.name.space.here/2011/June' AS ns)
(
   -- your XQuery/XPath code here - it will by default use the namespace given
   ....... xmlcolumn.value('(/ns:root/ns:subelement......)[1]', 'int'). .....
)

See the MSDN docs on Adding XML Namespaces for more details and more explanations


How do I merge between branches when the package name is different?

Question: I'm wondering if there is a easy way to merge between branches of the same Android project where the package name (and thus directory names) are different.  Since I will have many branches and all of them need to be kept up to date, I am looking at the best way to do these merges efficiently.
The directory tree of our Android project looks like this
<code>\assets
\libs\...
\res\...
\src\com\mycompany\mainproject
AndroidManifest.xml
build.xml
myproject.iml
myproject.ipr
</code>
When we make a customized version for a client, I would change the package name, such as client1app or client2app.  You need different package names if they are to exist in the Android Market as different apps for different clients.  So I make separate branches which contains identical filenames and directory structure, except for the src folder name which must be changed to match the package name.  So client1app or client2app will have the following directory structure:
<code>\src\com\mycompany\client1app
\src\com\mycompany\client2app
</code>
The filesnames under those folders are still identical to mainproject.  It's just that the directory name is different.  (The file content is mostly identical except for the package clause.)
We use SVN for source control.  So when I cherrypick merge from mainproject to client1app, I think I would have to merge the top level files and other directories first, and then perform a merge manually for src\com\mycompany\mainproject to src\com\mycompany\client1app.  That's five different merges, (for top level and four subdirectories).   If it weren't for the directory names being different, this would be a easy single step merge, and I know how to do that.
Question 1: Is there any configuration I could to tell SVN that \src\com\mycompany\mainproject and \src\com\mycompany\client1app contain the same filenames when merging?  Or some other way to cherrypick merge easily between the two branches?
Question 2: Would Git be a better fit for this?
Answer: An Android Library project with the common code would help you the most with this. Then you wouldn't have to do any merging at all.
Answer:
Is there any configuration I could to tell SVN that \src\com\mycompany\mainproject and \src\com\mycompany\client1app contain the same filenames when merging?

No. SVN really doesn't track renames as renames, merges of renamed and changed files generate errors "Tree conflict" (I  suppose /not tested/, same effect will appear on dir renames)

Would Git be a better fit for this?

Yes, Git or Mercurial or Bazaar have rename-tracking and more easy merge-path as result. I, personally, prefer more Mercurial style of manual selection than Git heuristic, but tastes can differ


SQL to powerBI expression?

Question: How to write this expression in PowerBI
select distinct([date]),Temperature from Device47A8F where Temperature>25

Totally new to PowerBI. Is there any tool that can change the query from sql to PowerBI expression?
I have tried so many type of different type of expressions but getting error, Most of the time I am getting this:
The expression refers to multiple columns. Multiple columns cannot be converted to a scalar value.

Need help, Thanks.
Comment: Can you provide a sample Data? Anyway, I recommend you to look at sqlbi.com and eventually get one of the DAX books to starrt. Because the language DAX is hard to master and even to understand fully. You might do that through slicers or pickers.
Answer: After I posted my answer, wondered if your expected result is get only one date by temperature, In other words, without repeated dates in your result set.
A side note: select distinct([date]),Temperature from Device47A8F where Temperature>25 returns repeated dates since DISTINCT keyword evaluate distinct columns values specified in the SELECT statement, it doesn't return distinct values in a specific column even if you surround it with parenthesis.
Now what brings us here. What I can see in your error is that you are trying to use a table-valued (produces a table with multiple columns) expression in a measure which only accepts scalar-valued (calculate only one value).
Supposing you have a table like this:

Running your SQL query you will get the highlighted in yellow rows:

You can see 01/09/2016 date is repeated. If you want to create a measure you have to define what calculation you want to show for temperature. i.e, average, max or min etc.
In the below expression is being calculated the maximum temperature greater than 25 per date:
MaxTempGreaterThan25 =
CALCULATE ( MAX ( Device47A8F[Temperature] ), Device47A8F[Temperature] > 25 )

In this case the measure MaxTempGreaterThan25 is calculated per date.

If you don't want to produce a measure but a table. In the Power BI Tool bar select Modeling tab and click New Table icon.

Use this expression:
MyTemperatureTable =
FILTER ( Device47A8F, Device47A8F[Temperature] > 25 )

It should produce a new table named MyTemperatureTable like this:

I recommend you learn some basics about DAX, it is pretty different from SQL / T-SQL and there are things you can't do depending on your model and data.
Let me know if this helps.
Answer: You probably don't need to write any code if your objective is to show the result in a Power BI visual e.g. a table.  Power BI naturally aggregates data if the datatype is numeric (e.g. Temperature).
I would just add a Table visual on a Report page and add the Date and Temperature columns to it. Then in Visualizations / Fields / Values I would click the little down-arrow on the Temperature field and set the Aggregation e.g. Maximum.  Then in Visualizations / Fields / Filters I would click the little down-arrow on the Temperature field and set the Filter e.g. is greater than: 25
Hard-coded solutions are unlikely to survive the next question from your users e.g. "but what if I want to see Temperature > 24? Or 20? Or 30?"

SQL to powerBI expression?


Is the chance of independent events just summed, when calculating overall chances of any event?

Question: I'm not a mathematician or statistician (my last exposure was over 30 years ago with stats classes in school).
My problem is if events are independent do you just add them together to get the overall chance of the event (my school exposure at least makes me think that maybe it is not that simple).
The actual problem:
I'm about to have a heart operation.
There are chances of serious complications.
1% risk of A (cardiac perforation)
1% risk of B (stroke)
1% risk of C (pulmonary vein stenosis)
1% risk of D (vascular damage)
0.2% risk of E (mitral valve damage)
So, is my chance of a serious complication 4.2% (A + B + C + D + E)?
Or since each event has no influence on occurrence of other events is chance of a complication more like 1% being the highest risk value?
Or something in between?
I did try searching here for an answer but everything rapidly got into stats maths and complex formulae, then I got lost, so please keep it simple for me    <:-)
Answer: If you're asking "What is the probability of at least one serious complication?", then you don't add the probabilities.
(Consider: if there were 35 complications that each occurred 3% of the time that would imply that your chance of no complications was less than zero!)
If you assume the occurrence of the various kinds of complications are all mutually independent (which would seem unlikely to me), then:
You work out the probability that there are no complications, and subtract that from 1.
That is
$
P(\text{at least one complication}) = 1 - P(\text{no complications})\\
= 1 - P(\text{no complication A})P(\text{no complication B})\ldots P(\text{no complication E})\\
= 1 - (1-P(\text{A occurs}))(1-P(\text{B occurs}))\ldots(1-P(\text{E occurs}))\\
$
In your example:
1% risk of A (cardiac perforation)
1% risk of B (stroke)
1% risk of C (pulmonary vein stenosis)
1% risk of D (vascular damage)
0.2% risk of E (mitral valve damage)
If we assume these to be independent (as I said, somewhat dubiously), the chance of at least one complication is $1 - 0.99 \times  0.99 \times  0.99 \times  0.99 \times 0.998 = 4.13\%$
If the probabilities are all small and there aren't too many of them, it's almost the same as adding, but a bit less.
However, there will be a tendency for problems to occur together (some of those other complications would be associated with higher risk of stroke, I'd imagine) - and that lowers the chance that there will be any complications (while increasing the chance of more than one of them). So in general, the chance of some complication will tend to be lower than what you work out via the independence assumption.


What is the name of the "wrong" vibrato

Question: Allison Sparrow posted this video on the right way to do vibrato, as opposed to a wrong one she also demonstrated quite poorly.
What is the name of this "wrong" technique? Asking on reddit gave me few answers, but it seems to be a common trap students fall into on their way to learning vibrato.
At best, it is an imitation of the vibrato sound, but since it doesn't make it in any of the 3 standard ways in which vibrato is done, it isn't considered "vibrato", but the effect is still made.
What is the name of this technique?
Comment: @CarlWitthoft Just wait till some avant garde composer decides this is exactly the sound that he/she wants to hear. Then it will have a name ;)
Comment: Why would there be a name for something which is never to be done?
Comment: I added the youtube link for you. It makes it easier to answer if the potential person does not have to go between different browser tabs when answering. Feel free to reverse the edit if you wish.
Comment: Do some people actually do vibrato like this? >.<
Answer: Any time you change the length or the tension in a string, you'll change the pitch.  The "wrong" method in the video involves releasing the contact point, letting the finger "float."  This is grossly wrong whether or not you're trying to get a vibrato, since you lose an incredible amount of sonority and risk having high harmonics show up.
There's no reason to name this anything other than "one of a dozen wrong ways to produce a clean sound."
I'll note in passing that electric guitarists often bend notes by applying transverse force to the string, but again not releasing the pressure.  I believe this is largely because the existence of frets makes a longitudinal vibratro rather difficult.  (and then there's a whammy bar :-) ).
Answer: Just to restate what was already said in previous comments: this technique should be called transversal vibrato. It is actually the standard technique on many fretted string instruments, in particular steelstring guitar.
On fretless instruments, the preferred longitudinal vibrato is just the obvious way to go: it periodically alters the sounding length of the string (not possible on fretted instruments) and therefore the pitch, but doesn't much change the sound in any other way.
Transversal vibrato, on the other hand, does a whole bunch of things combined:

It stretches the entire string, thereby changing its tension. This is what also affects the pitch. In fact, on fretted instruments, changing the tension is really the only way to modulate pitch. On classical guitar, longitudinal vibrato is the preferred technique, but here it actually works by changing the tension, not the free length.
It rubs the string across the fretboard. Because that isn't perfectly smooth, this causes a little bit kind of a kind raspy sound. This is picked up by the string and can excite it, particularly in higher harmonics. In fact it's a bit comparable to the action of the bow hair on the string – not really relevant on violin where you have a proper bow to sustain notes, but this phenomenon is quite desired by guitar players, particularly in blues music.
It alters the pressure down to the fretboard. This point is less relevant on fretted instruments because you have more space to build up enough pressure to keep the string firmly on the surface all the time; but in fretless instruments it can easily happen that the string doesn't touch the fretboard anymore. This has a quite strong and hard to predict influence on the string's response – at sul tasto / low bow pressure or in pizzicato is mostly dampens the string, giving a more delicate sound with little resonance. At higher bow pressure, it tends to force the string into high-frequency modes. If you do this deliberately with sul ponticello bowing, you can achieve quite expressive screaching sounds.

I personally use transversal vibrato on cello mainly for one purpose: to add vibrato to natural flageolett notes. Like on fretted instruments, changing the free length is not possible in natural harmonics, but you can alter the tension. The resulting vibrato can actually sound quite sweet and æthereal.
Answer: It's true. It doesn't have a name because it's not a thing. As a violin teacher, if someone did that I would stop them and say,"You're not doing vibrato correctly." I get what you're asking for, a name for the incorrect thing, but there is no name for it since it's simply being done incorrectly. Like, if you filled out the paperwork correctly, you are now registered to vote. If you don't fill it out correctly, there's no word for that except "you improperly registered to vote". The end result of this incorrect, unnamed action is that you can't vote. As in the case of vibrato. If you do it wrong, you won't get the right sound effect.
As to your question of isn't it all the same because the effect is the same - the answer is no. The sound is not the same. When done in slow-motion the sound does seem similar because as the finger is pressing down the string it is bending it down; same on lifting it up (as part of that incorrect pulsing action). However, speed it up and you will at once see that the vibration of the string is lost, which is where all of the sound is found - in a constantly vibrating string. In order for a sound on the violin to remain clear sounding, the string must keep vibrating. If inhibited, by either a crooked bow, a sliding (drifting) bow or in this case, a sudden change from held-down finger to half held-down finger (which changes the vibration tremendously), the effect is a scratchy, unclear sound. Keep the finger down, or keep it floating on top as in harmonics and you are golden. Switch it too suddenly and you've gone and messed up your smooth vibration. Vibrato doesn't mess with the vibration of the string.
If a student forced me to call it something, I would call it a pulse, but I would hate to call it a name lest someone think it is a thing.
Comment: Just because it's wrong on violin doesn't mean it shouldn't have a name. Would you argue that the act of taking away stuff from other people shouldn't have a name, like, _theft_, just because it's wrong? It's even more nuanced here, because at least on steelstring guitar this vibrato technique definitely makes some sense. And as already mentioned it does have a name: _transversal vibrato_ (as opposed to the correct _longitudinal vibrato_).
Comment: And FWIW, I think it can even make sense on bowed string instruments occasionally, though obviously you shouldn't use it as the default technique. But transversal vibrato _can_ be used as a special effect, precisely because it has strange influences on the sound. In particular, it can be combined with sul ponticello to achieve a screaching tremulant sound with more overtones than fundamental. In fact you can use it to vibrate flageolett tones!

What is the name of the "wrong" vibrato


Generate the use cases from user stories

Question: i am a student and i must do a project.I want to generate Use cases- and class diagrams from user stories. Is there any suggestion to do that.
i have already used the papyrus plugin but it can not help me .It does just reversing java code to class diagrams
Comment: What you want is not possible. Take, for example, the following user story: "As a student, I want to subscribe for a course, in order to find a decent job in the future." No tooling will ever be able to generate a proper class diagram or a proper use case from this single sentence.
Comment: Try Visual Paradigm. It lets you convert UML into basic class outlines https://www.visual-paradigm.com/features/
Comment: you have not recognize my problem .I want to convert  User stories to Class Diagrams and Use cases
Comment: I don't get it. You are asking for UC from user stories and in the details you ask to RE Java code. What?
Answer: Converting a user story into a use case is not something that a tool will help you do, it is, however, something that a tool, like Papyrus and many others, will help you represent and that provides you with graphical elements to extract and visualize structure and behaviour from your analysis of the problem. Tools are, well, tools, not a panacea to your problems as they will not think for you.
Simply stated...
A user story is typically "As a user, I want to do something so I can have a result/benefit.
A use case (which is really textual, BTW) is typically: precondition, actions and responses, post-conditions, alternate scenarios, etc.
In UML, the user becomes an actor and the __do something_ becomes your use case. The result/benefit represents the goal/success factor for your use case (and, in some way, post-conditions). Pre- and post-conditions are constraints. actions and responses can be expressed as interactions (sequence diagrams), activities, and state machines.
From this point on, you have to start thinking about how you will implement this and there are many techniques that can do this (functional decomposition, behavioural decomposition, mapping to patterns such as MVC, etc.). Which one you use will depend on your background, domain or expertise, preference, etc.
Answer: I changed my answer after reading your comments.
Take a look at Enterprise Architect. Does not do that kind of "magic", but still has many tools and diagrams that allow to capture most steps from the software analysis/design process. You can download a free trial.


Finding probability a loss will be more than twice the second loss

Question: Question: Losses follow an exponential distribution with mean $1$. Two independent losses are
observed.
Calculate the probability that either of the losses is more than twice the other.
My Attempt: $P(L_1 < x) = 1-e^{-x}$, $P(L_2 > 2x) = e^{-2x}$ <-- This step is where I go wrong. Instead of $P(L_1 < x)$ apparently I'm supposed to use $P(L_1 > x)$ but for the life of me I can't conceptualize why. Doesn't this allow for loss $1$ to be $3$ and loss $2$ to be $4$?
$$P(L_1 < x \land L_2 > 2x) = e^{-2x}-e^{-3x}$$
Integrating over all $x$: $\frac{1}{2} - \frac{1}{3} = \frac{1}{6}$
Multiplying by $2$ to account for Loss $2$ being bigger than Loss $1$: $\frac{1}{6}\times2 = \frac{1}{3}$
My answer: $\frac{1}{3}$ Correct answer: $\frac{2}{3}$
Comment: Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
Answer: For problems like these, I encourage you to think about the losses as represented by an ordered pair, say $(X, Y)$, and plotted on a coordinate plane.  So $X$ and $Y$ are independent and identically distributed exponential random variables with densities $f_X(x) = e^{-x}$ and $f_Y(y) = e^{-y}$.
Now consider the event that neither loss is twice the other (i.e., the complementary event of what is being asked in the question).  In the first quadrant of the $XY$-coordinate plane, imagine coloring all ordered pairs $(X,Y)$ that meet this condition.  What does this region look like?
A little thought (and maybe some sketching) should convince you that the region is bounded by two lines, one corresponding to $Y = 2X$, and (by an elementary symmetry argument) the other by $X = 2Y$.  Thus we can characterize this region by the compound inequality
$$0 < X/2 < Y < 2X. \tag{1}$$
It follows that the desired probability is simply $1 - \Pr[X/2 < Y < 2X]$, remembering that the event $(1)$ is the complement of what we wish to compute.  How do we do the calculation?  One way is to simply compute the double integral of the joint density of $(X,Y)$ over the specified region:
$$\begin{align}
\Pr[X/2 < Y < 2X]
&= \int_{x=0}^\infty \int_{y=x/2}^{2x} f_{X,Y}(x,y) \, dy \, dx \\
&= \int_{x=0}^\infty \int_{y=x/2}^{2x} e^{-x} e^{-y} \, dy \, dx \\
&= \int_{x=0}^\infty e^{-x} \bigl[ -e^{-y} \bigr]_{y=x/2}^{2x} \, dx \\
&= \int_{x=0}^\infty e^{-x} (e^{-x/2} - e^{-2x}) \, dx \\
&= \int_{x=0}^\infty e^{-3x/2} - e^{-3x} \, dx \\
&= \left[ -\frac{2}{3}e^{-3x/2} + \frac{1}{3}e^{-3x} \right]_{x=0}^\infty \\
&= 0 - \left( -\frac{2}{3} + \frac{1}{3} \right) \\
&= \frac{1}{3}. \tag{2}
\end{align}$$
Then again remembering to compute the complement, the desired probability is $1 - 1/3 = 2/3$, as claimed.
Another way to solve the question, and probably the originally intended method, is to note the symmetry of the variables $X$ and $Y$ and compute directly the probability that, say, the second loss is more than twice the first; e.g.,
$$\Pr[Y > 2X] = \int_{x=0}^\infty S_Y(2x) f_X(x) \, dx, \tag{3}$$ where $S_Y = 1 - F_Y$ is the survival function.  But since $S_Y$ is the same as $S_X$, as $X$ and $Y$ are iid, then we have $$\Pr[Y > 2X] = \int_{x=0}^\infty e^{-2x} e^{-x} \, dx = \int_{x=0}^\infty e^{-3x} \, dx = \frac{1}{3}. \tag{4}$$
But now you have to remember that this is only one half of the total probability, because by symmetry, the other event is $X > 2Y$--the first loss is more than twice the second.  So the answer is $2/3$, which is what we obtained after taking the complement of the double integral in $(2)$.

As a further exercise, how would you generalize this problem:  suppose $X$ and $Y$ remain independent exponentially distributed random variables, but are no longer identically distributed?  Specifically, say $X$ has mean $\mu$ and $Y$ has mean $\theta$.  And instead of twice, consider the outcome where one loss is more than $k$ times the other, for some $k > 1$.  What is the desired probability in terms of $k, \mu, \theta$?  Which computational approach would you prefer using?
Answer: There's a few problems with your proof:

By considering $P(L_1<x, L_2>2x)$, you're not accounting for some possibilities, e.g. if $x=4$, this doesn't allow $L_1=3$, $L_2=7$. What you want is $P(L_2>2L_1)$
Integrating $P(L_1<x, L_2>2x)$ over all $x$ makes no sense. Remember you only ever integrate PDFs.

With that said, here's how to do it:

The joint PDF is $f(x,y)=e^{-x}e^{-y}$ because $L_1, L_2$ are independent.
As I mentioned in 1 above, what we're interested in is $P(L_2>2L_1)=\int_{x=0}^\infty \int_{y=2x}^\infty f(x,y) \; dx dy = 1/3$
As you correctly noticed, you then need to multiply this by 2 to account for the other way round


RDS Connection Broker High Availability cannot connect to database

Question: Scenario
You want to configure Remote Desktop Services Connection Broker in High Availability mode, using (at least) Windows Server 2016.
You have completed and verified all prerequisites:

database is accessible over network (all firewalls and routing OK),
database permissions are OK (db_creator for the group containing all target RDS CB hosts),
SQL driver is installed and connection string is correct.

You begin configuring High Availability either via Wizard:

or via Powershell:
Set-RDConnectionBrokerHighAvailability `
    -ClientAccessName "rds.contoso.com" `
    -DatabaseConnectionString "DRIVER=SQL Server Native Client 11.0;SERVER=db.contoso.com;Trusted_Connection=Yes;APP=Remote Desktop Services Connection Broker;DATABASE=rdscbha"

You omit the "Folder to store database" or -DatabaseFilePath because, well, it's optional and your MSSQL is already configured on where to store the new databases by default.
Problem
You get the following error message on GUI:

or the following error on PowerShell:
The database specified in the connection string DRIVER=SQL Server Native Client 11.0;SERVER=db.contoso.com;Trusted_Connection=Yes;APP=Remote Desktop Services Connection Broker;DATABASE=master is not available from the RD Connection Broker server RDS-01.CONTOSO.COM. Ensure that the database server is available on the network, the SQL Server Native Client is installed on all RD Connection Broker servers, and the computer accounts of the RD Connection Broker servers are members of the RDS Management Servers group on the database server.
    + CategoryInfo          : NotSpecified: (:) [Write-Error], RDManagementException
    + FullyQualifiedErrorId : SetRdmsHighAvailability,Microsoft.PowerShell.Commands.WriteErrorCommand
    + PSComputerName        : localhost
Diagnostics
You are really sure literally everything is OK. You can start PowerShell as SYSTEM user using psexec -is powershell and create the database to your liking using PowerShell SQL tools and the correct driver.
Nothing is wrong.
One thing is odd, though. You check your firewall using GUI wizard or PowerShell command and you see absolutely no SQL server connection attempt.
What's wrong?
Answer: Despite what Microsoft claims in the UI or the PowerShell command...
...the database path is not optional!
Yep. Once you add the database path, everything starts working!
Magically, if though you only specify your database path, eg.:
C:\ClusterStorage\SQL Data\MSSQL13.MSSQLSERVER\MSSQL\DATA

if your logs have different default path, the newly created database will be created correctly:
C:\ClusterStorage\SQL Log\MSSQL13.MSSQLSERVER\MSSQL\DATA

Comment: it must be a cluster SQL? i'm have standalone MS SQL Express server with same problem as You
Comment: I believe it doesn't matter whether it's a cluster or not. Did not use a non-clustered database for many years, though.
Answer: This topic might be a bit old, but we only recently upgraded to 2016 RD Server Farm, and all other stuff I found while googling did not work, your answer finally pointed me to the solution. So I thought I'd share some extra info, if someone still plans to do an upgrade.
I would like to add, it also didn't work when I tried to use a different path than the default database root directory path. You can get your path in the options of the server in MS SQL Server Management Studio.
In that folder there's a service account user named MSSQLSERVER with Full Rights, the broker seems to use that to create the database.
In every other folder on the server it showed the same error that was posted above.
Additional Info:
When you want to add a second server to the HA Broker, you need to map the RDS Broker Security group as a dbowner on the newly created database first. This isn't done automatically.
Answer: Try adding like this. It should work.
DRIVER=SQL Server Native Client 11.0;SERVER=db.contoso.com,1434;Trusted_Connection=Yes;APP=Remote Desktop Services Connection Broker;Database=RDSDB

Answer: The thing is in permissions inside MS SQL instance.
You should go into SQL → Security → Logins → RemoteAppBrokersGroup → Properties → Securables → Create any database (you dont get this checkbox automatically when assign dbcreate permissions)


Classification of flat complex line bundles

Question: I'm having a contradiction with two different classifications of flat complex line bundles over a manifold $X$.  Suppose for simplicity that $H^2(X;\mathbb Z) = 0 = H^1(X;\mathbb C)$.  Then the only complex line bundle is the trivial one and (thinking in terms of connection 1-forms) isomorphism classes of line bundles with connection become just one-forms on $X$ modulo gauge transformations $\Omega^1(X;\mathbb C) \ni \theta \mapsto \theta^g:=\theta + g^{-1} dg$ where $g: X \to \mathbb C^\times$.  If $f: X \to \mathbb C$ is arbitrary and $g = e^f$ then $\theta^g = \theta + df$ is cohomologous to $\theta$.  Since $H^1(X;\mathbb C) = 0$ any 1-forms are cohomologous so there is just one equivalence class of flat connections.
On the other hand, the Riemann-Hilbert correspondence says that there is a 1-to-1 correspondence between iso classes of flat line bundles with flat connection and representations of $\pi_1(X)$ on $\mathbb C$.  But in the situation above $\pi_1(X)$ can be something like $\mathbb Z/n\mathbb Z$, which has more than one rep on $\mathbb C$.
What am I missing?  Is the equivalence of flat bundles under Riemann-Hilbert stronger than gauge equivalence?
Answer: The problem is my example isnt possible: if the first homology group has torsion then by the universal coefficient theorem so does the second cohomology.


R2CV increases over R2

Question: I have a dataset:
X      Y
4706   77983
7217   48187
5314   1098
10725  91683
10725  27366

And want to show that there is no correlation.
Residual standard error: 3248 on 3 degrees of freedom
Multiple R-squared:  0.04654,   Adjusted R-squared:  -0.2713
F-statistic: 0.1464 on 1 and 3 DF,  p-value: 0.7275

So I say with an R$^2$ of 0.04654 I show this. Now someone tells me I should use cross-validated coefficient of determination R2CV (an R-language leave one out routine) but I have no experience with this. I used the R library SMIR and obtain a R2CV = 0.9857383.
How does this make sense?
Answer: If the main purpose you have here is to prove that there is no correlation between variables X and Y, I really don't see how leave-one-out cross-validation would be any more informative than the regular R².
Either way, I think that something is going wrong in the way the crossvalidation R² is calculated. At best, it should stay around the same ballpark as the regular R², and definitely it can't suddenly increase to >0.98.
I assume your dataset is bigger than the example and you fit a linear model with it? Otherwise I don't really understand what is going on. Could you be a bit more explicit?
Answer: It does not make sense to use leave one out and calculate R$^2$ in this case, but doing leave outs for R-values does make sense, as follows. Consider how the data looks when plotted, which is the first thing one does to examine data:

From this plot one can see that the only leave out that would not have a rather higher R-value is the point in the center.
Yet another consideration is how certain we are considering the R-value obtained.
r statistic     0.22
95% CI         -0.82 to 0.92 (normal approximation)

t statistic     0.38
DF              3
2-tailed p      0.7275 (t approximation)

From this test, we are not at all certain what the r statistic would look like for more data. It could be anywhere from -0.82 to 0.92 95% of the time.
There is, however, another way to show this for which doing leave outs makes sense.
Left out    correlation
LO 1        0.648913462
LO 2        0.215218829
LO 3       -0.212840764
LO 4       -0.252876895
LO 5        0.531591619

Note that the correlation for sequentially leaving out the first (LO 1), the second (LO 2) and so forth up to the LO 5 coordiante pair (not correlation squared, which in this case would be misleading) varied from -0.25 to 0.65. This is just another way of saying that the correlation could be anything for this particular data. Note also, that there is no proper way to combine these values to get an R$^2$ of 0.9857383, and R2CV is not the correct routine to use for this.
Comment: +1/-1.  I think the underlying idea (of plotting the points and showing how no estimate of $R^2$ made by removing single points could possibly come close to the alleged cross-validate value) is a great one.  Unfortunately, the text itself--culminating in the nonsensical and misleading assertions "cannot assume $y$ is a dependent variable" and that "OLS usage is ... inappropriate"--is problematic.  A low $R^2$ does not in any way imply the OLS model or calculations are inappropriate.
Comment: @whuber OK, took it out. Although frankly OLS does not say what people think it does. That is, least error predictions of $y$ do not specify the functional relationship between $x$ and $y$ except under unusual circumstances that are more often not met than met.
Comment: @whuber BTW, thanks for reading my answer. This is a other example of https://stats.meta.stackexchange.com/q/5398/99274, which I also changed but you still have closed.
Answer: You can answer this by doing a direct test on the sample correlation.  One approach would be to calculate the correlation between these two variables directly and then recalculate the correlation many times with the values in the first column permuted so that there is no correlation, and see how your observed correlation compares with correlations that arise purely by chance. (One benefit of this approach is that it doesn't require any distributional assumptions, which is appealing here since we have such a small sample size.)
Here is some sample Python code using the resample package that does this using 1,000 random permutations (which is probably a lot more than is needed, but it doesn't hurt).  The return value of corr_test is a dictionary that gives both the sample correlation and the proportion of the permutation distribution that is less than or equal to that value.
import numpy as np
from resample.permutation import corr_test

x = np.array([4706, 7217, 5314, 10725, 10725])
y = np.array([77983, 48187, 1098, 91683, 27366])

corr_test(x, y, b=1000, random_state=2357)

According to a local run I get that the sample correlation lies somewhere in the middle of the permutation distribution (it's around the 0.657 quantile), which means the correlation is explainable by chance.

R2CV increases over R2


Como o Windows gerencia os frameworks de instalação?

Question: Hoje estava a perguntar me como funciona o gerenciamento dos frameworks no Windows.
Vai sair a nova versão .NET 5, isso significa que terei de instalar esta versão para instalar programas feitos com esta versão no Windows?
Por exemplo os programas feitos em .NET 5 para desktop quando os instalar terei de instalar também o .NET 5 ou isso vem nos updates do Windows?
Answer: Não, o .NET 5 não é instalável, assim como qualquer .NET Core que no fundo é o .NET 5 em diante. Ele gera uma aplicação auto contida com tudo o que precisa e por isso basta copiar na máquina e executar direto. Chama e executa, simples assim.
Ele não vai fazer nada de especial como instalar algo antes. O .NET Core 3, ou .NET 5, tem tudo o que ele precisa nele mesmo de forma simples e não tem aquelas dificuldades que fizeram as pessoas adotarem a web para não ter que instalar algo (e passaram ter problemas muito piores).
Inclusive já está disponível (nem precisa esperar o .NET 5, já tem no .NET Core 3) a possibilidade de gerar um executável único com tudo o que precisa sem ter que se preocupar com dependências. Por isso não tem nada que gerenciar na máquina que vai executar. Sua única preocupação é em configurar o deploy quando tudo estiver pronto na sua máquina de desenvolvimento, mas isso é super fácil e feito com o CLI dotnet que está ajunto do .NET Core.
O .NET 5 não depende de algo instalado previamente e roda em qualquer sistema operacional suportado, mesmo não Windows. Então não tem que instalar nada, nem mesmo sua aplicação (precisa só estar disponível, dá pra executar até remotamente).
Não tem nada para atualizar, você tem um executável e é aquilo. A atualização pode ser feita da forma mais simples possível, copia o executável novo com a nova versão (ou chama ele remotamente). Pode ter um mecanismo mais sofisticado mas é problema seu desenvolver ou usar uma biblioteca que ajude, já tem algumas.
O .NET 5 (ou Core 3) nada tem a ver com o .NET Framework e não tem porque ele vir com o Windows, inclusive porque ele foi feito para rodar em outros sistemas operacionais também. Ele não funciona mais como o .NET Framework funcionava que estava no Windows e era dependência. O Windows não tem que ter nada ou fazer qualquer coisa para sua aplicação funcionar. Claro tem que ter o básico do sistema operacional, mas nada especial para ele. Repito, até porque ele roda em diversos outros sistemas operacionais. Mudou completamente a forma como ele funciona comparando com o que está acostumado com o .NET Framework.
Estou sendo repetitivo porque aparentemente não ficou claro que só tem um executável que você chama e executa na hora que precisa, e não tem mais nada.
Claro que se você pode criar um instalador e fazer algum tipo de instalação, mas não é necessário. Claro que se quiser pode mandar um monte de arquivos separados, mas não precisa, são coisas opcionais e que eu não vejo vantagem alguma. Um instalador poderia fazer algumas coisas extras antes de executar a primeira vez, mas dá para fazer o mesmo na primeira vez que o executável é chamado naquela máquina.
Comment: Não existem updates, não existe nada instalado, é tudo auto contido, não precisa de nada. Se você quiser atualizar algo você chama ou copia uma nova versão do executável e boa. Se quiser que seja automático faz algum mecanismo pra isso, existem bibliotecas que ajudam, mas só para quem quer algo mais sofisticado. Tudo que estou escrevendo aqui é repetição do que está na resposta, mas falarei de novo: Esquece o .NET Framework, não tem nada a ver com ele, mudou a forma de lidar com isso.
Comment: Do ponto de vista do utilizador, basta ele instalar a aplicação no windows e o programa irá correr? Ao instalar ele instala o .net 5 ou isso não tem nada haver?
Comment: Ele não precisa instalar, basta chamar o executável. Não precisa instalar nada, nem sua aplicação, nem nada, não há processo de instalação.
Comment: São então os updates do windows que mantém a compatibilidade das aplicações desenvolvidas para o desktop desenvolvidas sobre esta nova framework?


Solve linear equation

Question: I am working on some practice linear algebra problems but I am not understanding how the answers where gotten for the following problem.
Problem:
find all values of $a$ for which the resulting linear system has (a) no solution, (b) a unique solution, and (c) infinitely many solutions.
\begin{cases} x + y - z =2\\ x + 2y + z = 3 \\ x + y + (a^2 -5)z = a \end{cases}
Answer:
(a) $a= -2,\;$ (b) $\;a\neq \pm2,\;$ (c) $a=2$
I can't for the life figure how they got the answer in the book. I only got as far as the row echelon matrix.
$\begin{bmatrix}1 & 1 & -1 & 2\\0 & 1 & 2 & 1\\ 0 & 0 & a^2 - 4 & a-2\end{bmatrix}$
Can anyone recommend an approach for solving the problem.
Comment: What are $b$ and $c$?
Comment: @Bernard thats what I am wondering.  It is from the text Introductory Linear Algebra with applications 7th edition.
Answer: Having the matrix in something approaching row echelon form is definitely the right way to go, and you are nearly done once you have it. Unfortunately I think you did your final row operation incorrectly; my row echelon form matrix looks like this:
$$
\begin{bmatrix}1 & 1 & -1 & 2\\0 & 1 & 2 & 1\\ 0 & 0 & a^2-4 & a-2\end{bmatrix}
$$
Is this enough to show you the way?
Comment: @user1238097 The distinction has to come from how we interpret each row of this augmented matrix; when $a=-2$, the final row reads as $[0,0,0,-4]$, which in the language of equations reads $0=-4$. Of course, it cannot be that $0=-4$, and that tells us the system of equations we started with was inconsistent (that it had no solutions). Instead, if $a=2$, the final row is $[0,0,0,0]$, which reads $0=0$, which is true but uninformative. This means there is a free variable, and we will have infinitely many solutions.
Comment: @user1238097 When $a\neq \pm 2$, what happens? We could go from row echelon form to reduced row echelon form (since we know we can divide by $a^2-4$ safely), and we will end up with an identity matrix in the left hand portion of the augmented matrix, which means there is a unique solution.
Comment: I think I get where the a^2 - 4 gives the + or - 2.  The not equal is because its a quadratic equation?
Comment: oh wow that makes a lot of sense definitely.
Answer: Hint:
A non-homogeneous linear system has solutions if and only if the matrix of the homogeneous side and the augmented matrix have the same rank. Furthermore, this rank is the codimension of the affine space of solutions.
Thus here, there is a unique solution if and only if the matrix $\;\smash{\begin{bmatrix}1&1&-1\\ 1&2&1\\1&1&a^2-5\end{bmatrix}}$ has rank $3$. You can obtain its rank with row reduction.
Comment: Thanks for the hint I need to go back to look at homogenous systems section in the book.
Answer: The standard start:
The matrix is
$\begin{bmatrix}
1 & 1 & -1 & 2\\
1 & 2 & 1 & 3\\
1 & 1 & a^2-5 & a
\end{bmatrix}
$
The 3x3 determinant  is
$2(a^2-5)+1-1-(1+(a^2-5)-2)
=a^2-4
$
so,
if $a^2 \ne 4$,
there is a unique solution.
Comment: Non-square matrices don't have a determinant.
Comment: I take issue with this answer, as it is a bit sloppy; you cannot take the determinant of a $3\times 4$ matrix. The approach is nice, but you should clean up your explanation.
Comment: So I don't have to the linear equations to solve this wow.
Comment: @ImNotTheGuy it is definitely a bit more confusing.
Comment: OK - I'll fix it.
Answer: note: in the original version of the question the answer for part b was subtuly wrong, it should say $a \neq \pm 2$
I would start by getting rid of x by subtracting one of the cases (I went for the first one) from the other two.
$$ (2y + z)-(y-z) = 3 - 2 $$
$$ (y + (a^2 -5)z) - (y-z) = a - 2 $$
Multiplying out and simplifying.
$$ y + 2z = 1 $$
$$ (a^2 -4)z = a - 2 $$
So how do you solve an equation like that? you would want to divide it through by $(a^2 -4)$ but it is only valid to do that if $(a^2 -4) \neq 0$. Some elementary knowlage of quadratics tells us that $(a^2 -4) \neq 0$ when $a \neq \pm 2$. Therefore when $a \neq \pm 2$ our equation gives a single value for z which in turn gives a single value for y which in turn gives a single value for x.
Ok what about when $a = \pm 2$ well since we only have to cases left we can just substitute them in.
$$ 0z = -2 - 2 = -4 $$
$$ 0z = 2 - 2 = 0 $$
The first equation clearly has no soloutions, the second clearly has an infinite soloution set.
Comment: The method I used does not involve calculating or knowing about determinants, It's just the elimination method of solving simultaneous equations (which turned out to be unusually simple in this case, because we didn't have to do any scaling before we could perform elimination of x and because y happened to drop out of the third equation at the same time as x) combined with being mindful of the possibility of division by zero.
Comment: fixed that error.
Comment: I am still in the intro portion of the course, but is this method only possible if you know determinants?
Answer: our equations: (a^2 means a * a)
x+y−z=2
x+2y+z=3
x+y+(a^2−5)z=a
general equation form:
a1*x+b1*y+c1*z = d1
a2*x+b2*y+c2*z = d2
a3*x+b3*y+c3*z = d3
matrix A:
a1 b1 c1
a2 b2 c2
a3 b3 c3
matrix B:
d1 b1 c1
d2 b2 c2
d2 b3 c3
matrix C:
a1 d1 c1
a2 d2 c2
a3 d3 c3
matrix D:
a1 b1 d1
a2 b2 d2
a3 b3 d3
x = det(B) / det(A);
y = det(C) / det(A);
z = det(D) / det(A)
matrix A general format:
a11 a12 a13
a21 a22 a23
a31 a32 a33
det(A) = a11*a22*a33 + a12*a23*a31 + a13*a21*32 - a13*a22*a31 - a12*a21*a33 - a11*a23*a32
det(B) = d1*b2*c3 + b1*c2*d3 + c1*d2*b3 - c1*b2*d3 - b1*d2*c3 - d1*c2*b3
det(C) = a1*d2*c3 + d1*c2*a3 + c1*a2*d3 - c1*d2*a3 - d1*a2*c3 - a1*c2*d3
det(D) = a1*b2*d3 + b1*d2*a3+ d1*a2*b3 - d1*b2*a3- b1*a2*d3 - a1*d2*b3
assuming if my math below is correct, we get:
det(A) = a^2 - 4
det(B) = a^2+3a-10
det(C) = a^2-2a
det(D) = a - 2
x = (a^2+3a-10) / (a^2 - 4)
y = (a^2+3a-10) / (a^2 - 4)
z = (a-2)/(a^2 - 4)
If a^2 = 4, then the equation has no solution b/c we can't divide by zero
So, we can't have a = -2 or a = 2
Otherwise, the equation has the unique solution.
Comment: For some basic information about writing mathematics at this site see, *e.g.*, [here](/help/notation), [here](//math.meta.stackexchange.com/q/5020), [here](//meta.stackexchange.com/a/70559) and [here](//math.meta.stackexchange.com/q/1773)

Solve linear equation


Two general questions about log-normal distributions: shift and mixture

Question: I have the two following questions:

Imagine I have two sets of observations, and both sets have a lognormal distribution. Now, given I look at the union of the two sets - is the distribution still a lognormal?
Given now I have again a set of observations with lognormal distribution. Given I add or subtract a scalar to $LogN(\mu, \sigma^2)$, what happens to each observation. Let's say I have a right shift of +2. Does that imply, that the value of each observation is bigger by 2?

Thanks
Answer:
This is true only if the parameters of both populations are the same. Otherwise you may end up with a bimodal sample. In order to check this you may want to use a test of homogeneity. See

http://www.ltcconline.net/greenl/Courses/201/Regression/HomogeneityCollaborative/homogeneity.html
This can be done either by using parametric or nonparametric methods. See also page 92 of "Statistical Inference in Science" by D. Sprott.
Comment: When two sets of observations appear to have the same distribution, they can be viewed as two independent sets of iid draws from that common distribution, whence the unions of these *observations* will appear to have the same distribution.  (A union of *distributions* makes no sense; the concept you may be referring to is a *mixture*.)
Comment: thank you..is this true for the union of arbitrary distributions, that the union's distribution is the same as the original distribution given the parameters of the original distributions are (approximately) the same? But the parameters of the distributions union is not the same as the orignal parameters I assume? And after all: Why exactly is this the case? Thank you^1000
Comment: I didn't *mean* "union of distributions" but "union of observations". I thought that would make some sense. Anyway: Thank you! what about the question regarding the shift?


How to force JSON when using FreeRADIUS REST Module

Question: I have compiled in JSON support to FreeRADIUS 3.0.2 however I note that if I configure authorisation to use POST it is sending RADIUS attributes encoded as application/x-www-form-urlencoded
Is there a way to force this to POST JSON content?
Answer: Ensure you compile with json-c and set the
.body config item to json.
Comment: OK thanks, figured it out, was missing body = "json" in my authorize section in the rest configuration file


how to populate values in my Qdialogbox's linedits?

Question: In my main window, I have a QlistWidget named employee_list and the items in this QListWidget are like this :
<FIRM-1> name="Anna Ken" age="25" job="QtMaster" ,
<FIRM-2> name="Sir Ron" age="50" job="QtSlave"

So when I click the items in employee_list QlistWidget, a dialogbox shows up with 3 fields name,age,job like this

but when this dialog box shows up, i want the fields name,age,job to be populated , like this, How can i achieve this ?

so far i have tried this.
void MainWindow::on_employee_list_itemDoubleClicked(QListWidgetItem* item)
{
    QString test = item->text();             // getting the item text
    std::string test_s = test.toStdString();  //converting it to string from Qstring
    string name_part = "";                     //creating a variable in which name will be stored

        int name_pos = test_s.find("name=\"");
        for (int i = name_pos + 6; i < test_s.length();i++)
        {
            if (test_s[i] != '\"')
                name_part += test_s[i];
            else
                break;                         //extracting name in the item's text, after this the name_part variable value is Sir ron.  // similar code for extarcting age and job.

    if (test_s.find("<FIRM-1>") != std::string::npos)   //if item contains text <FIRM-1> then show this dialogue
    {
        GrpComd grpComd;   //creating instance of dialog
        grpComd.exec();    //showing it

       grpComd.name_lineedit->settext(name_part);  // i tried this to populate name in name_linedit but getting error , access violation reading location
    }
}

Comment: @eyllanesc, thanks for the edit, my reputation being less than 10, i was not able to post images normally.
Answer: Since we can't see your code for GrpComd, we have no way of knowing whether or not you initialized that pointer. Or even if it is a public member.
Regardless, you should be setting the text before you call dialog exec(). And the method of QLineEdit is setText not "settext" -- note the capital 'T'
Answer: you have to fill and then display i.e. setText() and after that show() or exec():
if (test_s.find("<FIRM-1>") != std::string::npos)
{
    GrpComd grpComd;
    grpComd.setName(clickedName);
    grpComd.setJob(clickedJob);
    grpComd.setAge(clickedAge);
    grpComd.exec();
}

or even better, if not already defined, create a constructor with those fields.
GrpComd::GrpComd(const QString& name,const QString& job, uint age);

Comment: Thanks, this helped my problem.


TableRow divisão de linhas - Layout

Question: Estava olhando sobre TableRow e desenvolvendo uma app de teste com este modelo de layout e surgiu uma dúvida.
Tenho uma Tabela com 1 Linha e duas colunas, cuja situação é apresentada na figura abaixo. Porém na coluna 2 ela não está totalmente preenchida por conteúdo, é possível eu "dividir" esta coluna como esta e inserir outro textView abaixo deste que ela ja possui para completar o conteúdo? Pois ai eu inseriria o valor da temperatura abaixo da escrita "Temperatura"
Answer: TableRow deve ser usado dentro de TableLayout, caso não seja se comporta como um Linearlayout horizontal.
Sendo TableRow um layout(extends LinearLayout) pode conter qualquer view, incluindo outro tipo de layout.
Assim, para conseguir ter os dois TextView um por debaixo do outro, coloque-os dentro de um LinearLayout com orientação vertical:
<code>...
    <TableLayout xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent">

        <TableRow>
            <ImageView
                android:src="@drawable/ic_weathernow"/>
            <LinearLayout
                android:orientation="vertical">
                <TextView
                    android:layout_height="match_parent"
                    android:layout_width="wrap_content"
                    android:text="Temperatura"/>
                <TextView
                    android:layout_height="match_parent"
                    android:layout_width="wrap_content"
                    android:text="28º"
                    android:layout_gravity="center"/>
            </LinearLayout>
        </TableRow>
    </TableLayout>
...
</code>
Comment: Opa, muito obrigado! Para esta solução deu certo! Agora estou inserindo uma table row com 2 colunas e outra tablerow com 4 colunas sendo 2 imageview e 2 textview (alternadas) e está aparecendo somente uma imageview e uma textview, sabe me dizer o que pode ser?
Comment: Pode ser por várias razões. O melhor é dar esta pergunta como [resolvida](http://pt.stackoverflow.com/help/someone-answers) e fazer outra.

TableRow divisão de linhas - Layout


Area of Plane Figures

Question: Do all plane figures have some area (may be zero, finite or infinite)? What I mean to say is that, do all subsets of the Cartesian plane have area? By area I mean area in the euclidean sense.
Comment: I believe that Euclid postulated each region of the plane having an area.
Answer: If I understand you correctly, you are essentially asking whether all subsets of the plane are measurable according to the Lebesgue measure.
There are some well-known examples of non-measurable sets. The most common one with an obvious geometric interpretation is probably one of those involved in the Banach–Tarski paradox. That paradox is a description of how one can split a ball into a finite number of sets of points, and then reassemble these using rigid motions to obtain two copies of the original ball. This doesn't make sense if all the point sets had well-defined volume. As this is a ball in 3d, and not a planar figure, it doesn't directly serve as a counterexample to what you are asking. But it demonstrates the kind of thinking you'd likely have to employ. In particular, according to the Wikipedia article on non-measurable sets, the existence of these can only be demonstrated using the axiom of choice, and many constructions building on that axiom are hard to imagine in a geometric fashion.
Following the tags lebesgue-measure and measure-theory (which you might want to add to your question) I found Nonmeasureable subset of ${\mathbb{R}}^2$ such that no three points are collinear? Comments there by PhoemueX indicate that such sets do exist, and that Sierpinski has constructed one. So if you want an explicit example, looking up the literature on this might serve, although there are probably easier examples without the additional non-collinearity constraint.
To summarize: no, not all subsets of the plane have an area.
Comment: What are "some well-known examples of non-measurable sets"?  (I'm already aware of "some well-known" ways to show that the axiom of choice implies the _existence_ of non-measurable sets.)

Area of Plane Figures


Custom unlock item button in sitecore experience editor

Question: In Sitecore 8.1 update 2, how do we add a custom web edit button in experience editor to unlock items locked by other users using non admin authors in sitecore.
Getting below error while executing the command.
ERROR Error processing command url:/-/speak/request/v1/expeditor/ExperienceEditor.CustomUnlockItem error:System.InvalidOperationException: Could not retrieve request class for url:/-/speak/request/v1/expeditor/ExperienceEditor.CustomUnlockItem
   at Sitecore.ExperienceEditor.Speak.Server.RequestHandler.Process(HttpContext context)
   at Sitecore.ExperienceEditor.Speak.Server.RequestHandler.ProcessRequest(HttpContext context)

Comment: Please post the solution as an answer
Comment: Can you provide what you have configured already to help diagnose the issue you are having?
Comment: Sorry it was i config issue ...got resolved thanks
Answer: After correcting the config  it was working fine, below is the correct configuration.
<configuration xmlns:patch="http://www.sitecore.net/xmlconfig/" xmlns:x="http://www.sitecore.net/xmlconfig/">
  <sitecore>
    <commands>

      <command name="webedit:customlock">
        <patch:attribute name="type"><NameSpace>.CustomLock,<Assembly></patch:attribute>
      </command>

    </commands>

    <sitecore.experienceeditor.speak.requests>

        <request name="ExperienceEditor.CustomUnlockItem" type="<NameSpace>.CustomUnlockItem, <Assembly>" />

        <request name="ExperienceEditor.GenerateFieldEditorUrl" type="<NameSpace>.GenerateFieldEditorUrl, <Assembly>" />

        </sitecore.experienceeditor.speak.requests>

  </sitecore>
</configuration>