text:
Q: JavaFX application working in traditional way but not in web-start or browser launch Hello StackOverflowers...
This is my first post. OK so here is the problem:
I am working with a JavaFX project, an "Online Quizzing Application". I am using NetBeans7.3 RC1 and have set it up to build a self contained package as follows:
<!-- Self Contained Application -->
    <target name="-post-jfx-deploy">
        <fx:deploy width="${javafx.run.width}" height="${javafx.run.height}"
                   nativeBundles="all"
                   outdir="${basedir}/${dist.dir}" outfile="${application.title}">
            <fx:application name="${application.title}"
                            mainClass="${javafx.main.class}"/>
            <fx:resources>
                <fx:fileset dir="${basedir}/${dist.dir}" includes="*.jar"/>
            </fx:resources>
            <fx:info title="${application.title}" vendor="${application.vendor}"/>
        </fx:deploy>
    </target>
<!-- -->

The application basically has some kind of forms to enter details about Questions and Options along with a Button attached to a FileChooser to select an Image for a question/option. Then when everything is finished, the user can generate an XML by serializing the data and save it in some directory by selecting it from again a FileChooser. There are several scenes, and one contain the FileChooser.
The application works fine when lauched from NetBeans and from command prompt :
java -jar filename.jar

But when launched as a Web-Start or in a browser, it works till the FileChooser comes and no other buttons respond. I am then unable to move to the next scene.
I am aware about signing jars before deploying. So after googling a little I came to know I can generate a keystore and a self signed certificate from Java's keytool. I did just that:
keytool -genkey -alias myAlias -keyalg RSA -validity 360 -keysize 2048 -keystore keystore.jks -dname "CN=myDomain.com,OU=something, O=something, L=something, ST=something, C=something"

and generated a certificate as follows:
keytool -certreq -alias myAlias -file certificate.csr -keystore keystore.jks

Next I used NetBeans to sign my jars by setting the Project -> Properties -> Deployment, to use my keystore.jks file.
But the problem still persists. Can anyone provide a solution that actually work here?? Specifically, I would like to know whether I am missing anything here. That would really be helpful.
Here is the full Java Console Message:
You may ignore the java.io.FileNotFoundException: .\resources\DBDetails.properties (The system cannot find the path specified)
but the rest of it should have been fine, but I see there are ClassNotFoundException
Dont know why it is so, although all the jars are there.
Thank you.
Match: beginTraversal
Match: digest selected JREDesc: JREDesc[version 1.6+, heap=-1--1, args=null, href=http://java.sun.com/products/autodl/j2se, sel=false, null, null], JREInfo: JREInfo for index 0:
    platform is: 1.7
    product is: 1.7.0_13
    location is: http://java.sun.com/products/autodl/j2se
    path is: C:\Program Files\Java\jre7\bin\javaw.exe
    args is: null
    native platform is: Windows, x86 [ x86, 32bit ]
    JavaFX runtime is: JavaFX 2.2.5 found at C:\Program Files\Java\jre7\
    enabled is: true
    registered is: true
    system is: true

    Match: ignoring maxHeap: -1
    Match: ignoring InitHeap: -1
    Match: digesting vmargs: null
    Match: digested vmargs: [JVMParameters: isSecure: true, args: ]
    Match: JVM args after accumulation: [JVMParameters: isSecure: true, args: ]
    Match: digest LaunchDesc: file:/D:/My_Projects/JavaFX/OnlineQuizzingApp_JavaFX/dist/Online Quizzing App.jnlp
    Match: digest properties: []
    Match: JVM args: [JVMParameters: isSecure: true, args: ]
    Match: endTraversal ..
    Match: JVM args final:
    Match: Running JREInfo Version    match: 1.7.0.13 == 1.7.0.13
     Match: Running JVM args match: have:<>  satisfy want:<>
java.io.FileNotFoundException: .\resources\DBDetails.properties (The system cannot find the path specified)
    at java.io.FileInputStream.open(Native Method)
    at java.io.FileInputStream.<init>(Unknown Source)
    at com.sohail.online_quizzing_app.BootStrap.Initialize(BootStrap.java:34)
    at com.sohail.online_quizzing_app.OnlineQuizzingApp.start(OnlineQuizzingApp.java:57)
    at com.sun.javafx.applet.FXApplet2$1.run(FXApplet2.java:131)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:179)
    at com.sun.javafx.application.PlatformImpl$4$1.run(PlatformImpl.java:176)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:176)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
    at java.lang.Thread.run(Unknown Source)
CacheEntry[file:/D:/My_Projects/JavaFX/OnlineQuizzingApp_JavaFX/dist/Online Quizzing App.jnlp]: updateAvailable=true,lastModified=Fri Feb 15 15:44:02 IST 2013,length=1034
CacheEntry[file:/D:/My_Projects/JavaFX/OnlineQuizzingApp_JavaFX/dist/Online Quizzing App.jnlp]: updateAvailable=true,lastModified=Fri Feb 15 15:44:02 IST 2013,length=1034
CacheEntry[file:/D:/My_Projects/JavaFX/OnlineQuizzingApp_JavaFX/dist/Online Quizzing App.jar]: updateAvailable=true,lastModified=Fri Feb 15 15:43:48 IST 2013,length=231526
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1440)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
    at javafx.event.Event.fireEvent(Event.java:171)
    at javafx.scene.Node.fireEvent(Node.java:6863)
    at javafx.scene.control.Button.fire(Button.java:179)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
    at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
    at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
    at javafx.event.Event.fireEvent(Event.java:171)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3328)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3168)
    at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3123)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2265)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
    at com.sun.glass.ui.View.notifyMouse(View.java:922)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.reflect.misc.Trampoline.invoke(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1435)
    ... 52 more
Caused by: java.lang.NoClassDefFoundError: org/apache/commons/codec/binary/Base64
    at com.sohail.online_quizzing_app.methods.ManageImages.read(ManageImages.java:45)
    at com.sohail.online_quizzing_app.controller.AdminAddQuestionController.selectImage(AdminAddQuestionController.java:84)
    ... 62 more
Caused by: java.lang.ClassNotFoundException: org.apache.commons.codec.binary.Base64
    at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
    at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 64 more
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1440)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
    at javafx.event.Event.fireEvent(Event.java:171)
    at javafx.scene.Node.fireEvent(Node.java:6863)
    at javafx.scene.control.Button.fire(Button.java:179)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
    at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
    at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
    at javafx.event.Event.fireEvent(Event.java:171)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3328)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3168)
    at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3123)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2265)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
    at com.sun.glass.ui.View.notifyMouse(View.java:922)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.reflect.misc.Trampoline.invoke(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1435)
    ... 52 more
Caused by: java.lang.NoClassDefFoundError: org/simpleframework/xml/Serializer
    at com.sohail.online_quizzing_app.controller.AdminAddOptionController.buttonEventSave(AdminAddOptionController.java:114)
    ... 62 more
Caused by: java.lang.ClassNotFoundException: org.simpleframework.xml.Serializer
    at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
    at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 63 more
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1440)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
    at javafx.event.Event.fireEvent(Event.java:171)
    at javafx.scene.Node.fireEvent(Node.java:6863)
    at javafx.scene.control.Button.fire(Button.java:179)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
    at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
    at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
    at javafx.event.Event.fireEvent(Event.java:171)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3328)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3168)
    at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3123)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2265)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:173)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:292)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
    at com.sun.glass.ui.View.notifyMouse(View.java:922)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
    at com.sun.glass.ui.win.WinApplication$3$1.run(WinApplication.java:73)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.reflect.misc.Trampoline.invoke(Unknown Source)
    at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.reflect.misc.MethodUtil.invoke(Unknown Source)
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1435)
    ... 52 more
Caused by: java.lang.NoClassDefFoundError: org/simpleframework/xml/Serializer
    at com.sohail.online_quizzing_app.controller.AdminAddOptionController.buttonEventSave(AdminAddOptionController.java:114)
    ... 62 more
Caused by: java.lang.ClassNotFoundException: org.simpleframework.xml.Serializer
    at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
    at sun.plugin2.applet.JNLP2ClassLoader.findClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 63 more
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1440)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
    at javafx.event.Event.fireEvent(Event.java:171)
    at javafx.scene.Node.fireEvent(Node.java:6863)
    at javafx.scene.control.Button.fire(Button.java:179)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:193)
    at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:336)
    at com.sun.javafx.scene.control.skin.SkinBase$4.handle(SkinBase.java:329)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:64)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
    at javafx.event.Event.fireEvent(Event.java:171)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3328)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3168)
    at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3123)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1563)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2265)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:250)


text:
Q: Migrando dato BLOB de MySQLi a PDO Poseo el siguiente codigo funcional en MySQLi:
$sql = "SELECT contenido FROM contenido WHERE seccion = '$s' " ;
$resultado = mysqli_query($db, $sql) or mysqli_error($db);
$row = mysqli_fetch_assoc($resultado);
$rows = mysqli_num_rows($resultado);

pero estoy migrando a PDO intente con este codigo pero no da resultados esperados
$stmt = $conn->prepare("SELECT contenido FROM contenido WHERE seccion = '$s' ") ;
$stmt->execute();
$row = $stmt->fetch(PDO::FETCH_ASSOC);

El dato contenido se almacena en MySQL como un longblob no he logrado hacerlo funcionar he probado lo siguiente sin exito:
$stmt = $conn->prepare("SELECT contenido FROM contenido WHERE seccion = 'index' ") ;
 $stmt->execute();
 $stmt->bindColumn(1, $data, PDO::PARAM_LOB);
 $stmt->fetch(PDO::FETCH_BOUND);
 echo $data;

A: Yo los suelo castear a tipo varchar con utf8 para que me respete caracteres especiales, tildes, etc...
Básicamente lo hago así:

cast(CONTENIDO as varchar(8191) character set utf8) AS CONTENIDO

En tu ejemplo, quedaría así:
$stmt = $conn->prepare("SELECT cast(contenido as varchar(8191) character set utf8) AS contenido FROM contenido WHERE seccion = 'index' ");

Prueba así a ver si te funciona.
Suerte.

redpajama_set_name: RedPajamaStackExchange


text:
Q: Laravel Eloquent Model many-to-many or one-to-many I'm a little bit confused after reading Laravel Eloquent Model documentation. So I have this database structure:
task
   id
   name
   description

tag
   id
   name

task_tag
   id
   task_id
   tag_id

One task may has zero, one or many tags. Of course one tag may has connection to zero, one or many tasks.
I tried this, but not sure:
<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Task extends Model {
    public function tags() {
        return $this->hasMany('App\Tag');
    }
}

hasMany() is the best solution in this case or I need to use something else?

A: What you're describing sounds like a typical many-to-many relationship (including the pivot table you've outlined). hasMany() is intended to be used in One To Many relationships. For Many To Many, you should use belongsToMany(). So your Task model would look like:

namespace App;

use Illuminate\Database\Eloquent\Model;

class Task extends Model
{
    public function tags()
    {
        return $this->belongsToMany('App\Tag');
    }
}

Relevant docs.


text:
Q: How to connect agent to a Twilio outbound call before the customer? I'm trying to setup a seamless outbound calling experience for a Twilio Flex setup. I have the dialpad outbound as well as a callback feature from previously delivered callback/voicemail request tasks (agent can accept the task and make an outbound within).
I am making the call via deployed Twilio function and it looks like this:
client.calls
            .create({
                url: callHandlerCallbackURL, // to another Twilio function
                to: event.To,
                from: event.From,
                statusCallback: statusCallbackURL,
                statusCallbackEvent: ["ringing", "answered", "completed"]
            })

When the call is connected, Twilio makes a call to another function which is provided through the url property above. Within that function, I enqueue the call with some task attributes and it looks like this:
let twiml = new Twilio.twiml.VoiceResponse();
let enqueue = twiml.enqueue({
    workflowSid: `${context.TWILIO_WORKFLOW_SID}`,
    waitUrl: ''
});
enqueue.task(JSON.stringify(taskAttributes));
callback(null, twiml);

But the problem is the task comes in to Flex (to the agent) after the call is answered and this causes agent to miss a couple of seconds from the call. So, the customer opens the phone, starts speaking, but there is no one on the other side for a while.
Is there a straight-forward way to prevent this from happening?

A: I was able to resolve this by using a built-in action in Flex called StartOutboundCall.
With this action, the agent is transferred to the call canvas before the call starts and is already in the call before the customer answers. Overall, this is a much more "natural" flow to start an outbound call and prevents the confusion I mentioned above.
It is also simpler as you can start an outbound call with a couple of lines of code:
function clickToDial(destinationNumber) {
  Flex.Actions.invokeAction("StartOutboundCall", {
    destination: destinationNumber
  });
}

You can find more information here: https://www.twilio.com/docs/flex/developer/voice/dialpad-click-to-dial#the-outbound-call-action-1


text:
Q: Passing data between PHP sites in a scheduled task This question has been answered in one form or another, none that I can see directly applying to this example.
I have a Moodle site and a Wordpress site on two separate servers. I need to regularly transfer data from the Moodle site to the Wordpress site inside a Moodle scheduled task. The is no cap on the volume of data that will be passed. I have already built the scaffolding for the scheduled task.
What I still need:

*

*A PHP script in Moodle that will send data securely to the WP site (both are https.) This script will be called regularly by the scheduled task. Not sure if this should use POST, curl or something else.

*A PHP script that I can place on the WP site. This does not need to have a user interface, just a web address that the PHP script in Moodle can send data to. When data is passed to the script, it will save it to the WP database.

If there is a better architecture than this please let me know. Otherwise, any advise on how to build these two scripts would be greatly appreciated. Please keep in mind the data needs to be transferred securely and I don't have time to build an API script. Also, I need to make sure other sites can't activate the receiving script on the WP site and inject data.

A: This can easily be done by making an API in Wordpress which will take a POST request, and by using a cron job on a script which will get the data stored in the database(assuming you are using a database), and then make a POST request in the WordPress API.
Cron Jobs tutorial: https://code.tutsplus.com/tutorials/scheduling-tasks-with-cron-jobs--net-8800
Wordpress API tutorial: https://code.tutsplus.com/tutorials/introducing-the-wp-rest-api--cms-24533
--Edit--
Noticing that you said that you need a quick and dirty fix, you can probably use the same database and get the data through the database, that is the quickest solution i could think of.


text:
Q: Why does the .count() return the wrong number on a peewee query with | (union)? The first three queries below return the correct number, while the last one returns the wrong number. It should return 153, instead it returns 8193. I have no clue where that number comes from.
Iterating through the query correctly returns 153 records.
>>> Project.select().where(Project.number.between('2012-01', '2012-02')).count()
75
>>> Project.select().where(Project.number.between('2012-02', '2012-03')).count()
78
>>> Project.select().where(Project.number.between('2012-01', '2012-03')).count()
153
>>> (Project.select().where(Project.number.between('2012-01', '2012-02')) |
     Project.select().where(Project.number.between('2012-01', '2012-03'))).count()
8193

EDIT
Here is a function that reproduces the problem starting from an empty database.
def test(self):

    db = peewee.SqliteDatabase('test.db', check_same_thread=False)

    class Test(peewee.Model):
        num = peewee.IntegerField()
        class Meta:
            database = db

    Test.drop_table(True)
    Test.create_table(True)

    for i in range(1, 11):
        Test.create(num=i)

    q = Test.select().where(Test.num > 6) | Test.select().where(Test.num > 7)

    print(q)

    print('Count =', q.count())

    for i in q:
        print(i.num)

And here is its output. It shows that the iteration correctly returns 4 items, but the count is wrong:
<class 'DocFinder.DocFinder.DocFinder.test.<locals>.Test'> SELECT t2."id", t2."num" FROM "test" AS t2 WHERE (t2."num" > ?) UNION SELECT t3."id", t3."num" FROM "test" AS t3 WHERE (t3."num" > ?) [6, 7]
Count = 7
7
8
9
10

A: Try using .wrapped_count() instead.


text:
Q: Preformatted text in VB - What is the C# @ equivalent in vb? This is probably really obvious and I'm being dense. In C# I can do this:
string = @"this is
            some preformatted
            text";

How do I do this in VB?

A: Like others said, there's no @ operator, so if you get into heavy string manipulation, use String.Format
IMHO, this
Dim text As String = String.Format("this is {0} some preformatted {0} text", Environment.Newline)

is more readable than this
Dim text As String = "this is" & Environment.NewLine _
                 & " some preformatted" & Environment.NewLine _
                 & " text"

A: I don't think you can do this in VB. You have to do:
Dim text As String = "this is" & Environment.NewLine _
                     & " some preformatted" & Environment.NewLine _
                     & " text"

Edit: As suggested in comments, replaced VB specific vbNewLine by Environment.NewLine

A: Actually you can do this in vb.net. You use something called XML Literals.
Dim mystring = <string>this is
 some preformatted
 text</string>.Value

A: There isn't one.
In C# you have the ability to do something like this "This ends in a new line\n.", but in VB there's no concept of that, you have predefined variables that handle that for you like "This ends in a new line" & vbNewLine
Hence, there's no point in a string literal (@"something\n") because in VB it would be interpreted literally anyway.
The problem with VB .NET is that a statement is deemed terminated at the end of a line, so you can't do this
Dim _someString as String = "Look at me
  I've wrapped my string
    on multiple lines"

You're forced to terminate your string on every line and use an underscore to indicate you wish to continue your statement, which makes you do something like
Dim _someString as String = "Look at me " & vbNewLine &_
   "*** add indentation here *** I've wrapped my string " & vbNewLine &_
   vbTab & " on multiple lines" '<- alternate way to indent

A: VB is weak for string manipulation. No pre-formatting or inline escape characters. Any speacial characters need to be appended to the string.

A: You might want to try Alex Papadimoulis' "Smart Paster" add-in. It lets you paste a string into C# or VB code "as StringBuilder".


text:
Q: WPF: Sort a list box How do I sort a ListBox by two fields? (In this case the ApplicationName and InstanceName properties of my model class.)

A: It depends on your data source. Here are a couple of ways....
using linq on lisbox data source
from 101 LINQ Samples:
string[] digits = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };
var sortedDigits =
        from d in digits
        orderby d.Length, d
        select d;

use a CollectionView for your listbox and add a SortDescription
ICollectionView myDataView = CollectionViewSource.GetDefaultView(myData);

using (myDataView.DeferRefresh()) // we use the DeferRefresh so that we refresh only once
{
   myDataView.SortDescriptions.Clear();
   if (SortById)
      myDataView.SortDescriptions.Add(new SortDescription("ApplicationName", direction));
   if (SortByName)
         myDataView.SortDescriptions.Add(new SortDescription("InstanceName", direction));
}

A: you can try to add both fields into the listbox items SortDescriptions collection, smth like this:
listBox1.Items.SortDescriptions.Add(new SortDescription("ApplicatonName", ListSortDirection.Descending));
listBox1.Items.SortDescriptions.Add(new SortDescription("InstanceName", ListSortDirection.Descending));

above code should sort the listbox items in the descending order by fileds ApplicatonName and InstanceName
hope this helps, regards


text:
Q: Link to "/" works in some browsers only This link does not work in all browsers in my angularjs onepage app.
homepage

Depending on the browser the url becomes different. In some browser the url ends with a trailing "/#" and others with "/#/" e.g. "http://localhost/#" and "http://localhost/#/". This means that in non IE browsers request ending with /# fails to load ViewA
This is my route provider:
mainApp.config(["$routeProvider",
function ($routeProvider) {
    $routeProvider
        .when("/", {
            templateUrl: "Views/ViewA.html"
        })
        .when("/home", {
            templateUrl: "Views/ViewB.html"
        })
        .otherwise({
            redirectTo: "/"
        });
}]);

Is there a way to make the browsers behave the same? A library to reference?
My only references er:
angular.js
angular-route.js

A: I'd say your anchor should be:
homepage

A: I suggest you to take a look at the answer to a similar question here
It basically depends on the angular routing mode you want to use:

*

*Hashbang Mode;

*HTML5 Mode;

*Hashbang in HTML5 Mode

A: Adding a locationProvider with html5mode set to true, seems to solve my issues
mainApp.config(["$locationProvider", "$routeProvider",
function ($locationProvider, $routeProvider) {
    $locationProvider.html5Mode(true);
    $routeProvider
        .when("/", {
            templateUrl: "Views/ViewA.html"
        })
        .when("/home", {
            templateUrl: "Views/ViewB.html"
        })
        .otherwise({
            redirectTo: "/"
        });
}]);


text:
Q: How to render a foo.md markdown file in react? I have several .md files (containing long texts) and I want to render them through react. I tried to use markedown-it but the loader returns an error. Here is the webpack.config.js file:
var path = require('path');
var webpack = require('webpack');
var subscript = require('markdown-it');
var superscript = require('markdown-it');

module.exports = {
    entry: ['./src/first.jsx'],
    devtool: 'cheap-module-eval-source-map',
    output: { path: __dirname+"/app", filename: 'bundle.js' },
    module: {
        loaders: [
            {   test: /\.jsx?$/,
                loader: 'babel-loader',
                query: { presets: ['es2015', 'react'] },
                include: path.join(__dirname, 'src')
            },
            {   test:   /\.md/,
                loader: 'markdown-it'
            }
        ]
    },
    'markdown-it': {
        preset: 'default',
        typographer: true,
        use: [subscript, superscript]
    }
};

Is there something wrong with that file? How else I can add my *.md files to react?
After reading http://www.shoutinginfrench.com/today-i-made-react-load-markdown/ I tried to use markdown-loader. Following that, I added this to webpack.config file:
{   test: /\.md$/,
   loader: "html!markdown"
}

which worked with no problem. Then I tried to add the markdown file to the react component as follow:
import React from 'react';
import { Link } from 'react-router'
import markdownFile from './test-file.md';
 export const Test = React.createClass({
    rawMarkup(){
         return { __html: markdownFile };
     },
     render() {
         return (

         );
     }
 });

But I'm getting the following error:
ERROR in ./src/components/tst.jsx
Module not found: Error: Cannot resolve module 'html' in /Users/..../src/components
 @ ./src/components/tst.jsx 14:15-39

How can I fix it?!

A: add { test: /\.md$/, loader: "html!markdown" },{ test: /\.json$/, loader: "json" }    to your webpack.config.js .
npm install react-markdown --save-dev


text:
Q: How do i store key-value information that has variables in python? I'm creating an app to store tasks. However, I can't find a working solution that stores more than one task.
This is the code I'm running that you should need:
def newtaskwin():
    newtaskwin=Toplevel(todohome)
    newtaskwin.geometry()

    taskbxfrme=tk.Frame(newtaskwin)
    TaskNameLbl=tk.Label(newtaskwin, text='Task Name:').grid(row=1, column=0, pady=5)
    TaskNameEntry=ttk.Entry(newtaskwin, width=100)
    TaskNameEntry.grid(row=1, column=1, pady=5)

    GroupNameLbl=tk.Label(newtaskwin, text='Group:').grid(row=2, column=0, pady=5)
    GroupNameEntry=ttk.Entry(newtaskwin, width=100)
    GroupNameEntry.grid(row=2, column=1, pady=5)

    PriorityLbl=tk.Label(newtaskwin, text='Priority:').grid(row=3, column=0, pady=5)
    PriorityEntry=ttk.Entry(newtaskwin, width=100)
    PriorityEntry.grid(row=3, column=1, pady=5)

    start_date_lbl=tk.Label(newtaskwin, text='Start Date:').grid(row=4, column=0, pady=5)
    start_date_entry=ttk.Entry(newtaskwin, width=100)
    start_date_entry.grid(row=4, column=1, pady=5)

    end_date_lbl=tk.Label(newtaskwin, text='End Date:').grid(row=5, column=0, pady=5)
    end_date_entry=ttk.Entry(newtaskwin, width=100)
    end_date_entry.grid(row=5, column=1, pady=5)

    start_time_lbl=tk.Label(newtaskwin, text='Start Time:').grid(row=6, column=0, pady=5)
    start_time_entry=ttk.Entry(newtaskwin, width=100)
    start_time_entry.grid(row=6, column=1, pady=5)

    end_time_lbl=tk.Label(newtaskwin, text='End Time:').grid(row=7, column=0, pady=5)
    end_time_entry=ttk.Entry(newtaskwin, width=100)
    end_time_entry.grid(row=7, column=1, pady=5)

    def create_task():
        with dbm.open('taskstorage.db' , 'n') as taskdb:
            taskdb['name']=TaskNameEntry.get()
            taskdb['Group']=GroupNameEntry.get()
            taskdb['Priority']=PriorityEntry.get()
            taskdb['Start_Date']=start_date_entry.get()
            taskdb['End_Date']=end_date_entry.get()
            taskdb['Start_Time']=start_time_entry.get()
            taskdb['end_time']=end_time_entry.get()
            messagebox.showinfo('eTasks', 'Task saved')

    create_task_btn=tk.Button(newtaskwin, command=create_task, width=10, text='Save').grid(row=9, column=0)

I tried using json and dbm; json didn't allow me to store the dictionary with variables, dbm overwrote the previous data and json didn't dump the data because of the immutable and mutable data type rules in dictionaries in python.

A: JSON files cannot be appended to [afaik] without loading the previous data and then updating with new data before saving again [so, the file will be over-written, but since the old data was loaded, it will be saved again but with the addition of the new data]. You could have a function for loading lists from JSON files - something like
# import json
def list_fromJsonFile(filename, printWarnings=False):
    try:
        with open(filename, 'r') as f: retList = json.load(f)
    except Exception as e:
        retList = []
        if printWarnings: print('Failed to load', repr(e))
    if not isinstance(retList, list):
        if printWarnings: print('Returning as', [{'previous_data': type(retList)}])
        retList = [{'previous_data': retList}]
    return retList

With that, I don't see why this should cause any issues [in terms of JSON handling]:
    def create_task():
        storageFilePath = 'taskstorage.json' # path to storage
        tasksList = list_fromJsonFile(storageFilePath) # load previous data

        taskDict = {
            'name': TaskNameEntry.get()
            'Group': GroupNameEntry.get()
            'Priority': PriorityEntry.get()
            'Start_Date': start_date_entry.get()
            'End_Date': end_date_entry.get()
            'Start_Time': start_time_entry.get()
            'end_time': end_time_entry.get()
        }

        with open(storageFilePath, 'w') as jsonfile:
            json.dump(
                tasksList+[taskDict], jsonfile, indent=4,
                default=lambda o: getattr(o, '__dict__', str(o))
            )
        messagebox.showinfo('eTasks', 'Task saved')

[ As far as I'm aware, the values returned by Entry.get() are JSON-serializable, but still I passed default=lambda o: getattr(o, '__dict__', str(o)) to .dump just in case, so that any non-serializable values are converted to dictionaries (or, if that's not possible, to string).]
Since you're saving tasksList+[taskDict], you should not be losing any of the old data; and then, if you want to

be able to call each task separately by name

You can load the saved list and convert that list to a [nested] dictionary keyed to name.
tasks_list = list_fromJsonFile('taskstorage.json', printWarnings=True)
tasks_by_name = {t['name']: t for t in tasks_list if isinstance(t,dict) and 'name' in t}

Note that if there are any duplicate names, only the last task t of each name will remain in tasks_by_name.
You can loop through the task dictionaries with for task in tasks_list, or get a task (named task_name='task_1', for example) with tasks_by_name[task_name], or tasks_by_name['task_1'], or [if you're not sure that there's a task with that name] tasks_by_name.get(task_name).

If you don't want to have to load previous data every time you want to add a new task, I suggest using CSV files for storage instead.
# import os
# import pandas as pd

    def create_task():
        storageFilePath = 'taskstorage.csv' # path to storage

        # taskDict = {...} ## AS BEFORE

        wHed = not os.path.isfile(storageFilePath)
        pd.DataFrame([taskDict]).to_csv(storageFilePath,mode='a',index=False,header=wHed)
        messagebox.showinfo('eTasks',f'Task saved to {os.path.abspath(storageFilePath)}')

[ Passing mode='a' appends to file instead of over-writing old data, and the wHed flag is for adding the headers row if a new file is created. ]
In this case, a function like list_fromJsonFile is no longer needed as the tasks can be loaded with .read_csv.
# tasks_by_name = pd.read_csv('taskstorage.csv').set_index('name').to_dict('index')#maybe
tasks_list = pd.read_csv('taskstorage.csv').to_dict('records')
tasks_by_name = {t['name']: t for t in tasks_list if isinstance(t,dict) and 'name' in t}

dbm overwrote the previous data

From what I understand, you can only have one instance of each key in a dbm file. You could make the name part of the keys to keep from overwriting other tasks [as long as the names are unique].
    def create_task():
        with dbm.open('taskstorage.db' , 'c') as taskdb:
            tName = TaskNameEntry.get()
            taskdb[f'{tName} name']=tName
            taskdb[f'{tName} Group']=GroupNameEntry.get()
            taskdb[f'{tName} Priority']=PriorityEntry.get()
            taskdb[f'{tName} Start_Date']=start_date_entry.get()
            taskdb[f'{tName} End_Date']=end_date_entry.get()
            taskdb[f'{tName} Start_Time']=start_time_entry.get()
            taskdb[f'{tName} end_time']=end_time_entry.get()
        messagebox.showinfo('eTasks', 'Task saved')


text:
Q: Optimal way to use if-statement in MVC View I'm doing a summer internship as a web developer and this friday I had a problem I wasn't sure exactly which way was the "best" way to solve. I don't have the code here, but as it's not a code/syntax problem, but more of a "how do I go about this"-problem.
Basically, I have a model with a Customer class which I, in my controller, assign values from the database. So in my CustomerController I have a LINQ query which grabs values from the database and assigns these values to the corresponding variables in the Customer Model. Then, in my CustomerView, I show these variables in a table for each Customer. So I have a loop that basically says:
foreach (item in Model)
@item.Name
@item.Age
selfmadeDecryptFunction(@item.Email)

and so on. Thing is, another developer has written a crypt/decrypt function which doesn't work if the value is NULL or 0. Sometimes, the @item.Email is empty which because of this decryption results in an error. Because of this, I want to just print the string NULL when @item.Email is null, and not run the decrypt function.
What is the "best" way to go about this? Do I write inline javascript if-else? Is there something I can do in the LINQ query or in the CustomerController? What's the "correct" way? I don't really want to go ask my coworkers about this because it's quite basic, and I could fix this myself, but I want to know what the correct way to solve this problem is.

A: As you said:

Because of this, I want to just print the string NULL when @item.Email
  is null, and not run the decrypt function.

You can simply apply an if construct to solve that:
    foreach (item in Model)
    {
      @item.Name
      @item.Age
      @if(item.Email!=null)
      {
       item.Email
      }
      else
      {
        NULL
      }
   }

In the code above if @item.Email is not null then it will be as it is (real value from Model), and if it is null then NULL will be printed on a place where should be @item.Email written.


text:
Q: android live uploading How to upload a live video(instantaneous video capturing from camera) to a web server in android.

A: There is no direct API access to raw video data.
Android's MediaRecorder creates a file. You could continuously read that file and send data to the server. This does not work perfectly - on some phones MediaRecorder updates this file (= flushes data to file) very sporadically. You could see delays of between 10-30 seconds.

A: You should use a client software to capture the stream from the camera. Surely, you could use an RTSP client or a MMS. In addition, the Web server must be able to store the stream that you send to the server.
Regards!


text:
Q: Flip this android pathdata upside down I found a similar xml file on stack overflow but i don't have much knowledge in android path data.
<vector
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="8dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">

    <path
        android:fillColor="#FFff0000"
        android:pathData="M24 24v-24h-24v24a20 36 0 0 1 24 0z"/>

</vector>

This is what i found, but in this the curve is on bottom.
but I need that curve on top.
like the image bellow.
And the white part on the image bellow must be transparent.
Any solution's?

A: You can wrap the path into a group and set the rotation & pivotX,Y attributes:
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="24dp"
    android:height="8dp"
    android:viewportWidth="24.0"
    android:viewportHeight="24.0">
    <group
        android:pivotX="12"
        android:pivotY="12"
        android:rotation="180">
        <path
            android:fillColor="#FFff0000"
            android:pathData="M24 24v-24h-24v24a20 36 0 0 1 24 0z" />
    </group>
</vector>


text:
Q: How do you create a prototype-scoped @Bean with runtime arguments? With getBean(String name, Object... args)? How do you create a prototype-scoped @Bean with runtime arguments? With getBean(String name, Object... args)?
My question is a consequence of this question.
Why is this approach not used or mentioned in the Spring IoC documentation?
Is this a normal approach? Is there a more correct approach for create a prototype @Bean with runtime arguments?
If it is not normal approach, so could you explain why?
Pay attention, what i need set my arguments through constructor, not through setters.
@Autowired
private ApplicationContext appCtx;

public void onRequest(Request request) {
    //request is already validated
    String name = request.getParameter("name");
    Thing thing = appCtx.getBean(Thing.class, name);

    //System.out.println(thing.getName()); //prints name
}

-
public class Thing {

    private final String name;

    @Autowired
    private SomeComponent someComponent;

    @Autowired
    private AnotherComponent anotherComponent;

    public Thing(String name) {
        this.name = name;
    }

    public String getName() {
        return this.name;
    }
}

A: In terms of constructor injection, no. However, you can give Thing an init method and use an ObjectFactory:
@Autowired
private ObjectFactory<Thing> thingFactory;

public void onRequest(Request request) {
    //request is already validated
    Thing thing = thingFactory.getObject();
    thing.init("name");

    //System.out.println(thing.getName()); //prints name
}

With thing being:
@Component
@Scope("prototype")
public class Thing {

    private String name;

    @Autowired
    private SomeComponent someComponent;

    @Autowired
    private AnotherComponent anotherComponent;

    public init(String name) {
        this.name = name;
    }

}

Unfortunately, the name can't be final since it's not via the constructor. Would love to see if there are better ways to do this with constructor injection.

A: It is possible with the help of a bean factory:
@Configuration
public class ThingProvider {

    @Bean
    @Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
    public Thing create(String name) {
        return new Thing(name);
    }

}

Usage:
@Component
public class SomeBean {

    @Autowired
    private ThingProvider thingProvider;

    public void onRequest(Request request) {

        String name = request.getParameter("name");
        Thing thing = myProvider.create(name);
    }

}

What is often brought forward as an argument against appCtx.getBean(Thing.class, name) is that it requires to hard-wire Spring specific classes. Plus, there is no compile time check in case the Thing constructor changes.

A: In that case, your Thing class might mix constructor dependencies and runtime arguments, something like this:
public class Thing {

    private final SomeComponent someComponent;
    private final AnotherComponent anotherComponent;

    private final String name;

    @Autowired
    public Thing(SomeComponent someComponent,
                 AnotherComponent anotherComponent,
                 String name) {
        this.someComponent = someComponent;
        this.anotherComponent = anotherComponent;
        this.name = name;
    }

    public String getName() {
        return this.name;
    }
}

Then you can wrap them in configuration:
@Configuration
public class BeanConfig {

    @Autowired
    private SomeComponent someComponent;

    @Autowired
    private final AnotherComponent anotherComponent;

    @Bean
    @Scope(BeanDefinition.SCOPE_PROTOTYPE)
    public Thing createThing(String name) {
        return new Thing(someComponent, anotherComponent, name);
    }
}

Usage:
@Autowired
private BeanFactory beanFactory;

public void onRequest(Request request) {
    String name = request.getParameter("name");
    Thing thing = beanFactory.getBean(Thing.class, name);
}

It supposed to work, not sure if this is a good practice though.


text:
Q: Why My Unity 2D Platformer Game's Android Button Controller doesn't working correctly? So here I am a game developer who recently used unity and have almost given up on dealing with this stuff.
I'm currently working on a 2d platformer game.
And one that is left behind, the android control button.
I use "standard assets",
Unity's "CrossPlatformInput" to create the android controller I need.
And after being tested, it doesn't work at all to move the characters in the game.
I have followed the guide carefully and carefully many times, but the result is still the same
Can anyone help tell what happened?
this is the failing code i am using:
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityStandardAssets.CrossPlatformInput;

public class Pemain : MonoBehaviour
{
    public Rigidbody2D rb;
    public float movespeed = 5f;
    public int jumppower;
    public Transform groundCheck;
    public float groundCheckRadius;
    public LayerMask whatIsGround;
    private bool onGround;
    private Animator anim;
    private int facing;

    void Start ()
    {
        rb = GetComponent<Rigidbody2D>();
        anim = GetComponent<Animator>();
        jumppower = 5;
        facing = 1;
    }

    void FixedUpdate ()
    {
        onGround = Physics2D.OverlapCircle (groundCheck.position,groundCheckRadius,whatIsGround);
    }

    void Update () {

        float move = CrossPlatformInputManager.GetAxis("Horizontal");

        if (Input.GetKey(KeyCode.LeftArrow))
        {
            rb.velocity = new Vector2 (-movespeed, rb.velocity.y);
            anim.SetBool ("Walking", true);
            if (facing == 1)
            {
                transform.localScale = new Vector3 (-1f, 1f, 1f);
                facing = 0;
            }
        } else if (Input.GetKey(KeyCode.RightArrow))
        {
            rb.velocity = new Vector2(movespeed, rb.velocity.y);
            anim.SetBool ("Walking", true);
            if (facing == 0)
            {
                transform.localScale = new Vector3 (1f, 1f, 1f);
                facing = 1;
            }
        } else
        {
            anim.SetBool ("Walking", false);
        }
        if (Input.GetKey(KeyCode.Space) && onGround)
        {
            rb.velocity = new Vector2 (rb.velocity.x,jumppower);
        }
    }
}

A: You're not using the move variable at all in your code. So the CrossPlatformInput can't take any influence on the movement of your character. You should change the code to something similar to this.
float move = CrossPlatformInputManager.GetAxis("Horizontal");

if (move < -0.01f)
    {
        rb.velocity = new Vector2 (-movespeed, rb.velocity.y);
        anim.SetBool ("Walking", true);
        if (facing == 1)
        {
            transform.localScale = new Vector3 (-1f, 1f, 1f);
            facing = 0;
        }
    } else if (move > 0.01f)
    {
        rb.velocity = new Vector2(movespeed, rb.velocity.y);
        anim.SetBool ("Walking", true);
        if (facing == 0)
        {
            transform.localScale = new Vector3 (1f, 1f, 1f);
            facing = 1;
        }
    }

You might also want to brush up on your C# skills, as learning Unity and programming at the same time is very difficult.


text:
Q: Issue in React, Redux and Typescript issue I'm new to Redux and Typescript
I got the below issue in my App.tsx file
webpack compiled with 1 warning
ERROR in src/App.tsx:12:14
TS2345: Argument of type '(didspatch: Dispatch<Action>) => Promise<void>' is not assignable to parameter of type 'AnyAction'.
  Property 'type' is missing in type '(didspatch: Dispatch<Action>) => Promise<void>' but required in type 'AnyAction'.
    10 |
    11 |   useEffect(()=>{
  > 12 |     dispatch(artistsActions.getArtistes());
       |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
    13 |   },[])
    14 |
    15 |   const {loading, error, data} = useSelector((state) => state.artists);

App.tsx code
useEffect(()=>{
    dispatch(artistsActions.getArtistes());
},[])

Below is the action creator function
    export const getArtistes = () => async (dispatch: Dispatch<Action>)=> {
    try{
        dispatch({
            type: ActionType.GET_ARTIST_REQUEST
        });

        const {data} = await axios.get<Artists[]>(<API URL>);

        dispatch({
            type: ActionType.GET_ARTIST_SUCCESS,
            payload: data,
        });
    } catch(error: any) {
        dispatch({
            type:ActionType.GET_ARTIST_FAIL,
            payload: error.message
        })
    }
}

Can anyone help with this?

A: The root of the problem you're currently having is you're calling dispatch inside of the useEffect with nothing (the result of getArtistes returns void.
So, to fix that type error, change getArtistes to return an object and not dispatch anything (i.e., in the places where you're dispatching you should just return { type: ActionType.GET_ARTIST ... }
That said, you have more issues.
You need to understand asynchronous requests with REDUX. Your getArtistes method first dispatches some action, starts an async request, and then dispatches another action. In reality, you should look into Saga's or Thunks
This may end up looking something like this:
App.tsx
useEffect(()=>{
  dispatch({ type: 'GET_ARTISTS_REQUESTED' });
},[])

function* fetchArtistes(action) {
  try {
    const { data } = await axios.get<Artists[]>(<API URL>);

    yield put({
      type: 'GET_ARTIST_SUCCESS',
      payload: data,
    });
  } catch (e) {
    yield put({ type: 'GET_ARTIST_FAIL', payload: e.message });
  }
}

function* mySaga() {
  yield takeEvery("GET_ARTISTS_REQUESTED", fetchArtistes);
}


text:
Q: Sorting the non-NULLs Date in ascending or descending and null Date last display in listview in android? I have arraylist and all data nulldate and date add in one array list.and i display in listview all data.but my problem is i get nulldate first and avalible date in last i want to null date data before available date. and i want to sorting available date and null date data no sorting and and just list view in add.please help me....!!!!!!!!!!!
public class Approval extends Activity {
    protected static final All_Approval_data_dto All_Approval_data_dto = null;

    @Override
    public void onBackPressed() {
        super.onBackPressed();
        finish();
        list.clear();
    }

    private String assosiatetoken;
    ArrayList<All_Approval_data_dto> list = new ArrayList<All_Approval_data_dto>();
    ArrayList<All_Approval_Key_dto> alist = new ArrayList<All_Approval_Key_dto>();
    ArrayList<String> catState = new ArrayList<String>();
    ArrayList<String> uniCatState = new ArrayList<String>();
    ArrayList<ArrayList<All_Approval_data_dto>> masterState = new ArrayList<ArrayList<All_Approval_data_dto>>();
    private String req_id;
    ListView lv;
    Button back;
    ExpAdapter1 expAdapter;
    private Spinner spndata;
    String[] reqspinner = { "Request Date", "Last Update", "Submitter",
            "Owner", "State" };
    ArrayAdapter<String> adapter;
    private ExpandableListView exlistView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.approval);
        assosiatetoken = MyApplication.getToken();
        alist = DBAdpter.recursUserData(assosiatetoken);
        for (int i = 0; i < alist.size(); i++) {
            req_id = alist.get(i).requestId;
            list = DBAdpter.approvalUserData(assosiatetoken, req_id);

        }

        // setState();
        new doinbackground(this).execute();
        spndata = (Spinner) findViewById(R.id.list_all_quize);

        adapter = new ArrayAdapter<String>(this,
                android.R.layout.simple_spinner_item, reqspinner);
        spndata.setAdapter(adapter);
        lv = (ListView) findViewById(R.id.listapprovaldata);
        lv.setOnItemClickListener(new OnItemClickListener() {

            public void onItemClick(AdapterView<?> a, View v, int position,
                    long id) {
                Intent edit = new Intent(Approval.this, Approval_webview.class);
                // edit.putExtra("Cat_url", url_link);

                startActivity(edit);
            }
        });
        exlistView = (ExpandableListView) findViewById(R.id.ExpList);
        spndata.setOnItemSelectedListener(new OnItemSelectedListener() {
            public void onItemSelected(AdapterView<?> arg0, View arg1,
                    int position, long arg3) {

                switch (position) {
                case 0:
                    lv.setVisibility(View.VISIBLE);
                    exlistView.setVisibility(View.GONE);
                    Collections.sort(list, byDate);
                    for (int i = 0; i < list.size(); i++) {
                        Log.v("log_tag", "Data " + list.get(i).lastModifiedDate);
                        if (list.get(i).lastModifiedDate != null) {

                            Log.v("log_tag", "sorting "
                                    + list.get(i).lastModifiedDate);
                            lv.setAdapter(new MyListAdapter(
                                    getApplicationContext(), list));

                        }

                    }

                    break;
                case 1:
                    lv.setVisibility(View.VISIBLE);
                    exlistView.setVisibility(View.GONE);
                    Collections.sort(list, byDate1);
                    for (int i = 0; i < list.size(); i++) {
                        if (list.get(i).state != null) {
                            lv.setAdapter(new MyListAdapter(
                                    getApplicationContext(), list));
                        }
                    }
                    break;
                case 2:

                    break;

                case 3:

                    break;

                default:
                    break;
                }

            }

            public void onNothingSelected(AdapterView<?> arg0) {
                // TODO Auto-generated method stub
            }

        });

    }

    static final Comparator<All_Approval_data_dto> byDate = new Comparator<All_Approval_data_dto>() {
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a");

        @SuppressWarnings("unused")
        public int compare(All_Approval_data_dto ord1,
                All_Approval_data_dto ord2) {
            java.util.Date d1 = null;
            java.util.Date d2 = null;
            try {

                if (d1 == null) {
                    return (d2 == null) ? 0 : -1;
                } else if (d2 == null) {
                    return 1;
                }
                d1 = sdf.parse(ord1.lastModifiedDate);
                d2 = sdf.parse(ord2.lastModifiedDate);
            } catch (java.text.ParseException e) {
                // TODO Auto-generated catch block`
                e.printStackTrace();
            }
            // return (d1.compareTo(d2) > 0 ? 1 : -1);
            return (d1.getTime() > d2.getTime() ? -1 : 1); // descending
        }

    };

    /*
     * static final Comparator<AnalysisDto> byRatio = new
     * Comparator<AnalysisDto>() {
     *
     *
     * public int compare(Date date1, Date date2) { return
     * (date1.compareTo(date2)>0 ? 1 : -1); } };
     */
    static final Comparator<All_Approval_data_dto> byDate1 = new Comparator<All_Approval_data_dto>() {
        SimpleDateFormat sdf = new SimpleDateFormat("MM/dd/yyyy hh:mm:ss a");

        @SuppressWarnings("unused")
        public int compare(All_Approval_data_dto ord1,
                All_Approval_data_dto ord2) {
            java.util.Date d1 = null;
            java.util.Date d2 = null;
            try {

                if (d1 == null) {
                    return (d2 == null) ? 0 : -1;
                } else if (d2 == null) {
                    return 1;
                }
                d1 = sdf.parse(ord1.submitDate);
                d2 = sdf.parse(ord2.submitDate);

            } catch (java.text.ParseException e) {
                // TODO Auto-generated catch block`
                e.printStackTrace();
            }
            // return (d1.compareTo(d2) > 0 ? 1 : -1);
            return (d1.getTime() > d2.getTime() ? -1 : 1); // descending
            // return (d1.getTime() > d2.getTime() ? 1 : -1); //ascending
        }
    };

    class doinbackground extends AsyncTask<Void, Void, Void> {
        ProgressDialog pd;
        private Context ctx;

        public doinbackground(Context c) {
            ctx = c;
        }

        @Override
        protected void onPreExecute() {
            super.onPreExecute();
            pd = new ProgressDialog(ctx);
            pd.setMessage("Loading...");
            pd.show();

        }

        @Override
        protected Void doInBackground(Void... params) {
            return null;
        }

        @Override
        protected void onPostExecute(Void result) {
            super.onPostExecute(result);
            pd.cancel();

        }

    }

    public class MyListAdapter extends BaseAdapter {
        private ArrayList<All_Approval_data_dto> list;

        public MyListAdapter(Context mContext,
                ArrayList<All_Approval_data_dto> list) {
            this.list = list;
        }

        public int getCount() {
            return list.size();
        }

        public All_Approval_data_dto getItem(int position) {
            return list.get(position);
        }

        public long getItemId(int position) {
            return position;
        }

        public View getView(int position, View convertView, ViewGroup parent) {

            LayoutInflater inflator = (LayoutInflater) getSystemService(LAYOUT_INFLATER_SERVICE);
            convertView = inflator.inflate(R.layout.custom_approval_data, null);
            TextView req_id = (TextView) convertView.findViewById(R.id.req_txt);
            TextView date = (TextView) convertView.findViewById(R.id.date_txt);
            TextView owner = (TextView) convertView
                    .findViewById(R.id.owner_txt);
            TextView state = (TextView) convertView
                    .findViewById(R.id.state_txt);
            req_id.setText(list.get(position).requestId + " - "
                    + list.get(position).title);
            date.setText(list.get(position).lastModifiedDate + " - "
                    + list.get(position).submitDate);
            owner.setText(list.get(position).submitter);
            state.setText(list.get(position).state);
            return convertView;
        }
    }
}

A: try this this with your data and manage in ascending or descending
Java Array Sort descending?

A: replace your try/catch block with this
 try {

            if (ord1 == null) {
                return (ord2 == null) ? 0 : 1;
            } else if (ord2 == null) {
                return -1;
            }
            d1 = sdf.parse(ord1.lastModifiedDate);
            d2 = sdf.parse(ord2.lastModifiedDate);
        } catch (java.text.ParseException e) {
            // TODO Auto-generated catch block`
            e.printStackTrace();
        }


text:
Q: Using a C++ class that has an object of another C++ class in C# I've created a little demo for myself to practice combining C++ & C# (a very desirable skill for me).
It looks like this:

The issue arises from the fact that the class Person has a member of type Name.
What would be the correct way to expose these classes to C#?
For example how would I expose this constructor:
    Person(Name name);

It's kind of hard to explain but the issue is that this Person constructor accepts a Name object which is native, and I can't create this native object in C# and just pass it in the constructor, right? It wouldn't even be desirable.
And even if I write a wrapper for it (say ManagedName) I can't pass it to Person since there's no acceptable constructor.
How should I cope with this situation?
Here are the headers as requested:
Nullable: http://pastebin.com/z7zTCrAq
Name: http://pastebin.com/ALNp5c1a
Person: http://pastebin.com/nkWyUv9C

A: Here's one way to do it (C++/CLI)

class Name {
public:
    std::string firstName;
    std::string middleName;
    std::string lastName;
};
ref class ManagedName {
internal:
    Name* nameptr;
public:

    ManagedName() {
        nameptr = new Name();
    }
    ManagedName(System::IntPtr ptr) {
        nameptr = (Name*)(void*)ptr;
    }
    property System::String^ firstName {
        System::String^ get() {
            return gcnew System::String(nameptr->firstName.data());
        }
        void set(System::String^ val) {
            System::IntPtr strptr = System::Runtime::InteropServices::Marshal::StringToBSTR(val);
            nameptr->firstName = (char*)(void*)strptr;
            System::Runtime::InteropServices::Marshal::FreeBSTR(strptr);
        }
    };
    property System::String^ middleName {
        System::String^ get() {
            return gcnew System::String(nameptr->middleName.data());
        }
        void set(System::String^ val) {
            System::IntPtr strptr = System::Runtime::InteropServices::Marshal::StringToBSTR(val);
            nameptr->middleName = (char*)(void*)strptr;
            System::Runtime::InteropServices::Marshal::FreeBSTR(strptr);
        }
    };
    property System::String^ lastName {
        System::String^ get() {
            return gcnew System::String(nameptr->lastName.data());
        }
        void set(System::String^ val) {
            System::IntPtr strptr = System::Runtime::InteropServices::Marshal::StringToBSTR(val);
            nameptr->lastName = (char*)(void*)strptr;
            System::Runtime::InteropServices::Marshal::FreeBSTR(strptr);
        }
    };
};
class Person {
public:
    Name* name;
    std::string birthday;
    Person(Name* name) {
        this->name = name;
    }
};
ref class ManagedPerson {
public:
    ManagedPerson(ManagedName^ name) {
        //create an instance of the native class
        personPtr = new Person(name->nameptr);

    }
    property System::String^ Birthday {
        System::String^ get() {
            return gcnew System::String(personPtr->birthday.data());
        }

    };
    property ManagedName^ Name {
        ManagedName^ get() {
            return gcnew ManagedName(System::IntPtr(personPtr->name));
        }
    };
private:
    Person* personPtr;
};


text:
Q: PHP login error with following message I am new to PHP. I am trying to log in but it always gives me the following message:

'Invalid user name or password, Try again'.

Please if anyone could help me , I would greatly appreciate it.
<?php

$errors = array(
    1=>"Invalid user name or password, Try again",
    2=>"Please login to access this area"
);

$error_id = isset($_GET['err']) ? (int)$_GET['err'] : 0;

if ($error_id == 1) {
    echo '
'.$errors[$error_id].'
';
} elseif ($error_id == 2) {
    echo '
'.$errors[$error_id].'
';
}
?>

Login Page

<fieldset style="font-family: Arial; background-color: lightblue; color: rgb(0,0,100)">
<legend style="font-variant: small-caps; font-weight:bold"> Login Form </legend>
<form name="LoginForm" method="POST" action="authenticate.php">
 Username: <input placeholder="Type K-number" style="position: absolute; margin-left: 20px; width: 15am; left: 80px" type="text" name="username" /> *

 Password: <input type="password" placeholder="Type Password" style="position: absolute; margin-left: 20px; width: 15am; left: 80px" type="text" name="password" /> *

<input type="submit" value="Login" /> <input type="reset" />
</fieldset>
</form>

Here is my authenticate.php code:
    <?php
        require 'database.php';

        session_start();

        $username = "";
        $pass = "";

        if(isset($_POST['username'])){
            $username = $_POST['username'];
        }
        if (isset($_POST['password'])) {
            $password = $_POST['password'];

        }

        echo $username ." : ".$password;

        $q = 'SELECT * FROM username WHERE username=:username AND password=:password';

        $query = $db->prepare($q);

        $query->execute(array(':username' => $username, ':password' => $password));

        if($query->rowCount() == 0){
            header('Location: index.php?err=1');
        }else{

            $row = $query->fetch(PDO::FETCH_ASSOC);

            session_regenerate_id();
            $_SESSION['sess_user_id'] = $row['id'];
            $_SESSION['sess_username'] = $row['username'];
            $_SESSION['sess_userrole'] = $row['role'];

            echo $_SESSION['sess_userrole'];
            session_write_close();

            if( $_SESSION['sess_userrole'] == "0"){
                header('Location: adminpage.php');
            }else{
                header('Location: studentpage.php');
            }
        }
    ?>

A: Try replacing query line with this:
$q = "SELECT * FROM username WHERE username='$username' AND password='$password'";

The problem might be because you're missing the single quotes around the username and password. It looks like the actual query you're generating looks like this at the moment, so it doesn't know what jsmith and hello123 are:
SELECT * FROM username WHERE username=jsmith AND password=hello123;


text:
Q: Linux grep for file starting with certain letter AND contain certain words Trying to search a file directory for file names beginning with "h" and containing "enu"?
So far this is what I've got, I just don't know how to handle both grep statements in one command line?
find fs282/path/web/en_US.dic -exec grep "^h" {} \;

A: To look at the file names, use the -name condition of find. It should take regular filename patterns, so h*enu* matches what you want.
find /some/path -name "h*enu*"

grep would instead look at the contents of the files, line by line, so this would look for lines matching the pattern:
find /some/path -type f -exec grep '^h.*enu' /dev/null {} +

(The output would be the lines, not just the file names.)
grep expects a regular expression as opposed to glob wildcards for -name. Also, grep looks for matches within the lines as opposed to full matches with -name, hence the ^ to anchor the pattern at the start of the line. The /dev/null is only  there  to  make sure the file names are always printed for each matching line, even when there's only one  matching file. With the GNU implementation of grep, one may use the -H option instead.


text:
Q: Does current have a physical effect on wire? Does current have an effect on the wire it moves through? I think I heard somewhere that over time small wires in CPUs can move because of the current going through them. If it is a thing what's the technical term for it?

A: The vast majority of the time, the physical effect of a current through a wire is negligible.
High current densities can physically effect a wire in 4 very different ways:

*

*The electromigration effect ( as mentioned by sstobbe ) is the gradual movement of ions along the length of a conductor due to the momentum transfer of electrons moving in a wire. At high current density, eventually enough ions of the metal wire get pushed out of where they were originally placed to leave a gap (an open circuit) in that wire, or build up enough displaced ions to bridge the gap between that wire and some adjacent wire (a short circuit). This can cause long-term reliability issues -- when people design things to run right on the edge or slightly past manufacturer's recommendations, this effect allows the device to seem to work fine for a while, but lead to early failure.

*The resistive heating of wires, also known as Joule heating or "I squared R heating", is proportional to the square of the current through the wire. When an integrated circuit is stressed by voltages far beyond the manufacturer's recommendations, this effect often melts or vaporizes one or all of the small wires of the IC.

*The magnetostriction effect causes some materials to change shape when magnetized. This effect is the most common cause of transformer hum. (The current through the coils of the transformer creates a strong magnetic field, which leads to magnetostriction in those wires or in the ferrite core or both).

*In a strong magnetic field, the wire is physically shoved sideways by a force proportional to the current and to the magnetic field -- that force is sometimes called the Laplace force, but more often calculated as part of the Lorentz force (as alluded to by Uwe ). This effect also causes transformer hum.

A: Yes, at the nano-meter scale you always run into an issue titled Electromigration.
At the nano scale a conductor has to not only be rated for voltage drop but also for current density. To achieve sufficient reliability due to deterioration from electromigration.

A: If strong currents flow in two parallel conductors, the magnetic fields cause a force between the conductors, see https://en.wikipedia.org/wiki/Amp%C3%A8re%27s_force_law. But the currents flowing through small wires in a CPU are too small for movement.


text:
Q: UnsatisfiedLinkError: Using the Remedy API with Java I'm trying to run the example from this question about using the BMC remedy API. However I'm getting the below error message when trying to run the example, it appears to compile fine.
As I understand it I need to reference arapi71.jar. However that library is actually sitting in a different domain, so I can't reference it directly. I've copied over the whole folder that it sits in to my PC and added to the build path, this may be the issue, I'm new to using frameworks etc so if that's the problem let me know.
If that's isn't the problem and it should be ok to pull over all that info and reference it, what else could I be missing? This site here has some ideas about the path's etc, but it seems they are mostly on linux and I'm not 100% sure what it correlates to on windows (7 by the way though I don't think that makes a difference to environment variables). It mentions that not being able to find the .dll file could be an issue, this is in the folder, so I would assume it could still find it in there?
Any help would be much appreciated!
Exception in thread "main" java.lang.UnsatisfiedLinkError: com.bmc.arsys.api.Proxy.ARInitialization()J
at com.bmc.arsys.api.Proxy.ARInitialization(Native Method)
at com.bmc.arsys.api.Proxy.<init>(Unknown Source)
at com.bmc.arsys.api.ProxyJRpcBase.<init>(Unknown Source)
at com.bmc.arsys.api.ProxyJRpc.<init>(Unknown Source)
at com.bmc.arsys.api.ProxyManager.createProxy(Unknown Source)
at com.bmc.arsys.api.ProxyPool.get(Unknown Source)
at com.bmc.arsys.api.PoolingProxyManager.getProxy(Unknown Source)
at com.bmc.arsys.api.ARServerUser.createEntry(Unknown Source)
at CreateEntry.main(CreateEntry.java:34)

A: dann.dev,
From your stacktrace it appears that the directory that contains the arapi71.jar and all the native implementation is not on your Windows path.  You need to add the directory containing all the jars and dlls to your Windows path so that those files are found at runtime.
Typically, I run java apps that use the Remedy API with a wrapper batch file that adds the API directory to the path before executing the app.
Something like:

set PATH=%PATH%;<api directory>
java <params> MyApp

should configure what you need.
Hope that helps,
Ed


text:
Q: MS Access / VBA, check for desktop lock Basically, what I'm trying to find is a way for MS Access (2003) to detect if the user has done a Ctrl+Alt+Del and locked their workstation. If that happens, I want the open database to shut down. Currently, I have a hidden form that runs in the background that checks for inactivity, but it's unreliable.
Is there a way to do this in VBA, or should I do this another way (or both)?
Thanks!

A: You're not going to find a reliable way to do that from within Access.

*

*Ctrl/Alt/Del doesn't actually lock the computer, it brings up the Login dialog, so you'd need a secondary detection to see what option the user selects in that dialog.

*What if the user presses Win + L instead of Ctrl/Alt/Del?

*In Win7 (and Vista?) the user can Lock the computer from the Start menu - typically a mouse action, not keyboard.

*If Access isn't the application that has focus at the time the keys are pressed, it has no visibility of the action.

You might want to pursue more "reliable" methods of detecting idle time within the app itself. What is your current approach? Are you stuck with 2003, or could you possibly update to 2007/2010?
Maybe these?
http://www.tek-tips.com/viewthread.cfm?qid=933476
How to get the idle time in Windows XP using VBA?
Those are still timer-based, not looking at login state. The tek-tips code is VB, which may be adaptable for VBA, or may not. The SO link is VBA, and looks pretty similar, so there's potential.

A: To check for Locked System in Win 7 , you need to have an little trick. I have a code which when clicked , it will lock a system ( and records that time ). Then it will pause for 5 seconds (application.wait time method) which a user will not see as the system is locked. Then put a message box in code. When user will be back, he will see a message box popup which says "Is your break finished" . Put code for popup button to record time when Ok/Cancle button is clicked. In this way you are capturing both times - 1.when system is locked and when it is unlocked.
Please let me know if you have any issues. riyajshaikh7@gmail.com


text:
Q: Pareto Chart - when can be used? I have a question on the Pareto Chart.
I know it has been originally used in quality control, but do you think it is good to apply it to other domains as well?
I have recently built a Pareto Chart to display the potential pipeline of a business by its target markets.
I chose the Pareto because it was clear that the first two markets would potentially account for almost 80% of total potential sales, while the other 4 would not be very significant.
A colleague of mine told me that the Pareto chart is not a good choice to display these kinds of information and that is rarely used anyway. He suggested that a separate bar graph and a pie chart alongside it would convey a better message.
My question is if it was good to use the Pareto Chart in this case. I think it is a very powerful way to display what was behind those numbers compared to a two separate charts.


text:
Q: Cannot assign requested address error with bitcoin-abe I have been playing around with bitcoin-abe for the last few days, getting it to load the dogecoin blockchain.  Everything works perfectly on my localhost and when I go to http://localhost:2750 everything works fine.  Unfortunately, as soon as I move it to a live server with the following config:
dbtype sqlite3
connect-args doge.sqlite
port 2750
host SERVER_IP_ADDRESS
datadir = [{
        "dirname": "/home/ubuntu/.dogecoin",
        "chain": "Dogecoin",
        "code3": "DOGE",
        "address_version": "\u001e",
        "magic": "\u00c0\u00c0\u00c0\u00c0",
        "conf": "dogecoin.conf",
        "trim_depth": 40
        }]
commit-bytes = 100000
keep-scriptsig = false
int-type str

I get this error when I start up:
ubuntu@ip-10-198-38-95:~$ sudo python -m Abe.abe --config doge.conf
Opened /home/ubuntu/.dogecoin/blocks/blk00022.dat
Abe initialized.
Traceback (most recent call last):
  File "/usr/lib/python2.7/runpy.py", line 162, in _run_module_as_main
    "__main__", fname, loader, pkg_name)
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
    exec code in run_globals
  File "/usr/local/lib/python2.7/dist-packages/Abe/abe.py", line 2169, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/local/lib/python2.7/dist-packages/Abe/abe.py", line 2165, in main
    serve(store)
  File "/usr/local/lib/python2.7/dist-packages/Abe/abe.py", line 2047, in serve
    httpd = make_server(args.host, port, abe)
  File "/usr/lib/python2.7/wsgiref/simple_server.py", line 144, in make_server
    server = server_class((host, port), handler_class)
  File "/usr/lib/python2.7/SocketServer.py", line 408, in __init__
    self.server_bind()
  File "/usr/lib/python2.7/wsgiref/simple_server.py", line 48, in server_bind
    HTTPServer.server_bind(self)
  File "/usr/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
    SocketServer.TCPServer.server_bind(self)
  File "/usr/lib/python2.7/SocketServer.py", line 419, in server_bind
    self.socket.bind(self.server_address)
  File "/usr/lib/python2.7/socket.py", line 224, in meth
    return getattr(self._sock,name)(*args)
socket.error: [Errno 99] Cannot assign requested address

Is there something that I am missing?

A: OK so I was asleep at the helm.  I just needed to use 0.0.0.0 as the host.


text:
Q: Getting the current url from the webbrowser I've been trying to figure out how to get the current url to be used by the webbrowser in the following code:
Dim t As String = client.DownloadString("browserurl")

Here is my code so far:
    Dim client As New WebClient
    Dim t As String = client.DownloadString("browserurl")
    Dim p As String = ""
    Dim r As New System.Text.RegularExpressions.Regex(p)
    Dim v As String = reg.Match(t).Value

I'm trying to parse data from the websites which the webbrowser is visiting.


text:
Q: Passthrough is not supported, GL is swiftshader, ANGLE is When trying to run headless chrome with selenium I am getting this error:
[1021/151706.155:ERROR:gpu_init.cc(453)] Passthrough is not supported, GL is swiftshader, ANGLE is
my setup code:
from selenium import webdriver
import chromedriver_binary

chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--headless")
chrome_options.add_argument("--disable-gpu")
chrome_options.add_argument("window-size=1024,768")
chrome_options.add_argument("--no-sandbox")

driver = webdriver.Chrome(options=chrome_options)

driver version is 94.0.4606.61
win32

A: I was getting the same error/warning message, but chromium was running just fine for me. I managed to get rid of this message by adding this option to the command line:
--disable-features=DefaultPassthroughCommandDecoder


text:
Q: How can I properly use COUNTIFS with a defined named range? I have a formula that counts the number of contact attempts for each month. The problem I am facing is that the formula only goes up to row 2000. How can I rewrite my formula to adjust with newly added rows? Formula I am using
=COUNTIFS(clientmenu!M8:HD2000,">="&$O$25,clientmenu!M8:HD2000,"<="&$O$26)
Link to Workbook


text:
Q: Integral of [(1+2y^2)/(3-y)]dy (obtained from a differential equation) This question actually arises from this Differential Equations question:
Find the family of solutions for:
$\displaystyle(1+2y^2)\frac{dy}{dx} + (3-y)\cos x = 0$
I ruled out the methods I've so far learned in class (linear, exact, homogeneous, Bernoulli) and decided that it was a separable equation (correct me if I'm wrong), to reach:
$\displaystyle\int\frac{1+2y^2}{3-y}dy = -\int\cos x dx$
Although I like to think of Calculus as a strength of mine, I'm having difficulty with this seemingly simple integral on the left side. I've tried multiple methods of integration by parts, into double/triple integration by parts... What am I missing? Thanks

A: Divide $2y^2+1$ by $-y+3$. We get $-2y-6+\frac{19}{-y+3}$. Now the integration should be straightforward.


text:
Q: How to limit DatePicker to display only current year in React JS? I'm using KeyboardDatePicker in my React App to allow users select travel date but I want to limit the date selection to the current year only, meaning user shouldn't be able to select any next year date starting from January 1st 2022. My code:
import React, { useState } from "react";
import { MuiPickersUtilsProvider } from "@material-ui/pickers";
import DateFnsUtils from "@date-io/date-fns";

import { KeyboardDatePicker } from "@material-ui/pickers";

export default function App() {
  const [isOpen, setIsOpen] = useState(false);

  const [date, setDate] = useState();

  const handleDateChange = (date) => {
    setDate(date);
  };

  return (
    <div className="App">
      <MuiPickersUtilsProvider utils={DateFnsUtils}>
        <KeyboardDatePicker
          style={{ width: 200, height: 28 }}
          minDate={new Date()}
          disableToolbar={true}
          margin="none"
          variant="inline"
          value={date}
          inputVariant="outlined"
          emptyLabel="Select Date"
          format="MM/dd/yyyy"
          onChange={handleDateChange}
          KeyboardButtonProps={{
            onFocus: (e) => {
              setIsOpen(true);
            }
          }}
          PopoverProps={{
            disableRestoreFocus: true,
            onClose: () => {
              setIsOpen(false);
            }
          }}
          InputProps={{
            onFocus: () => {
              setIsOpen(true);
            }
          }}
          open={isOpen}
        />
      </MuiPickersUtilsProvider>
    </div>
  );
}

and codesandbox
when I add maxDate={new Date().getFullYear} date picker limits selection to the current month(June). How can I limit date selection so user can't select any date of the next year?. For exp. in 2021 user should be able to select the future dates only from 2021, in 2022 only dates from 2022 and etc.  Any help and advise is greatly appreciated.

A: You are setting a invalid type for the maxDate. maxDate expects a value of type Date.
To limit the value to only current year,
const lastDateOfYear = `12/31/${new Date().getFullYear()}`;
Assign this to maxDate,maxDate={new Date(lastDateOfYear)}


text:
Q: $U(n)$ is a subgroup of $SO(2n)$ How can I show that $U(n)$ is a subgroup of $SO(2n)$? I can see how we can identify $\mathbb{C}^n$ with $\mathbb{R}^{2n}$ by mapping $a+ib\mapsto (a,b)$, but after that I'm a bit confused. In particular, the determinant of a matrix in $U(n)$ has to be nonzero, whereas in $SO(2n)$ it has to be 1. How do we make this transition?

A: Hint: Think of the complex entry $a+bi$ as the $2\times2$ submatrix
$$
\pmatrix{a&-b\\b&a}
$$
More rigorously, consider the mapping that makes this replacement, and note that it is an injective, continuous homomorphism.

A: A determinant of a matrix in $U(n)$ is not merely nonzero, it is of absolute value 1.
Start with a trivial example. $U(1)$ is just a complex number of absolute value 1, so geometrically it sits on the unit circle. You can represent it as $cos(\theta) +i* sin(\theta)$. What's the real $2\times 2$ matrix that represents a rotation by the angle $\theta$? Is it in $SO(2)$?
Once you understand this example, extend to $U(n)$. Replace every complex element in the matrix by what you think is the right real counterpart, so you get a $2n \times 2n$ real matrix, and see if you can show it's in $SO(2n)$.

A: Let me write the answer, this is a good exercise.
All you have to do is to show the inclusion $U(n)\subset O(2n)$, which makes sense after identify $\mathbb{C}^n$ with $\mathbb{R}^{2n}$ by for instante $(z_1,\cdots,z_n) = (x_1+iy_1,\cdots,x_n+iy_n)\longleftrightarrow (x_1,\cdots,x_n,y_1,\cdots,y_n)$.
Consider then $U\in U(n)$, that is, $U \in Mat_{n\times n}(\mathbb{C})$ such that $UU^\dagger = U^\dagger U = 1$. Such matrices acts on $\mathbb{C}^n$ by $$(z_1,\cdots,z_n) \longmapsto (U_{1j}z_j,\cdots,U_{nj}z_j)$$
Using our identification, we will discover how $U(n)$ acts on $\mathbb{R}^{2n}$. To do so we decompose the matrices of $U(n)$ in real and imaginary parts: $$ U = U^R + iU^I $$ with $U^R,U^I \in Mat_{n\times n}(\mathbb{R})$ and
$$ UU^\dagger =  (U^R + iU^I)(U^R + iU^I)^\dagger = U^R (U^R)^T + U^I (U^I)^T + i\left( U^I(U^R)^T - U^R(U^I)^T \right)=1 $$
$$ U^\dagger U =  (U^R + iU^I)^\dagger(U^R + iU^I) =  (U^R)^TU^R +  (U^I)^TU^I + i\left( (U^R)^TU^I - (U^I)^TU^R \right)=1 $$
The condition follows as: $$U^R (U^R)^T + U^I (U^I)^T = (U^R)^TU^R +  (U^I)^TU^I = 1 \ \ (*)$$
$$ U^I(U^R)^T - U^R(U^I)^T = (U^R)^TU^I - (U^I)^TU^R = 0 \ \ (**)$$
With this notation:
$$ (z_1,\cdots,z_n) \longmapsto (U^R_{1j}z_j + iU^I_{1j}z_j,\cdots,U^R_{nj}z_j+iU^I_{nj}z_j) $$
writing in terms of $z_i=x_j+iy_j$  : $$ \left( (U^Rx)_1 - (U^Iy)_1 + i(U^Ix)_1+i(U^Ry)_1,\cdots, (U^Rx)_n - (U^Iy)_n + i(U^Ix)_n+(U^Ry)_n) \right) $$
Therefore, expliciting the identification: $$ (x_1,\cdots,x_n,y_1,\cdots,y_n)\longmapsto \left( (U^Rx)_1 - (U^Iy)_1, \cdots, (U^Rx)_n - (U^Iy)_n,(U^Ix)_1+(U^Ry)_1,\cdots, (U^Ix)_n+i(U^Ry)_n \right) $$
In matrix notation:
$$U = \begin{bmatrix}U^R& -U^I\\ U^I & U^R\end{bmatrix} \in Mat_{2n\times 2n}(\mathbb{R}) $$
To see that this matrix is on $SO(2n)$, we have to check the ortogonal condition: $UU^T=1$. This follows immediately by $(*)$ and $(**)$ :
$$ UU^T = \begin{bmatrix}U^R& -U^I\\ U^I & U^R\end{bmatrix}\begin{bmatrix}(U^R)^T& (U^I)^T\\ -(U^I)^T & (U^R)^T\end{bmatrix}  $$
$$\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \   = \begin{bmatrix}U^R(U^R)^T + U^I(U^I)^T& U^R(U^I)^T-U^I(U^R)^T\\ U^I(U^R)^T-U^R(U^I)^T & U^I(U^I)^T+U^R(U^R)^T\end{bmatrix}= \begin{bmatrix}1& 0\\ 0 & 1\end{bmatrix}$$
ps: Repeated indices always denotes sum over the indices $\left(a_jb_j=\sum_ja_jb_j\right)$