问:
Websphere MQ via JMS: NoClassDefFoundError
I'm trying to make a simple JMS client application for Websphere MQ 7.5
I already have ".bindings" file with connection factory and destination, which I'm trying to connecto to.
This is my simple Java code, that I'm trying to run on mac:

```<code>package com.company;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.naming.Context;
import javax.naming.directory.InitialDirContext;
import java.util.Hashtable;
public class Main {
    public static final String     cfLookup    = "TEST12";
    public static final String     icf         = "com.sun.jndi.fscontext.RefFSContextFactory";
    static              String     url         = "file:///tmp/JNDI";
    public static void main(String[] args) {
        InitialDirContext  ctx          = null;
        Destination myDest       = null;
        ConnectionFactory connFactory  = null;
        Hashtable environment = new Hashtable();
        try {
        environment.put(Context.INITIAL_CONTEXT_FACTORY, icf);
        environment.put(Context.PROVIDER_URL, url);
            ctx = new InitialDirContext( environment );
            connFactory = (ConnectionFactory)ctx.lookup( cfLookup );
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}
</code>```

And this is the exception:

```<code>Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/disthub2/impl/client/SessionConfig
    at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.setupDistHubTracing(WMQFactoryFactory.java:335)
    at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.<init>(WMQFactoryFactory.java:305)
    at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.getInstance(WMQFactoryFactory.java:186)
    at com.ibm.msg.client.wmq.factories.WMQComponent.getFactoryInstance(WMQComponent.java:140)
    at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:157)
    at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.setProviderFactory(JmsConnectionFactoryImpl.java:168)
    at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:293)
    at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
    at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
    at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at com.company.Main.main(Main.java:20)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
</code>```

It's pretty obvious, that some other libraries are required, but none of those JAR file I got copying from Websphere MQ client installation seem to work. And also it feels kinda strange that some provider specific class is needed to make a query against JNDI.
I already read a lot of topics at IBM and mqseries, but nothing helps. Any assistance would by higly appreciated.

Also with every run there is also a newly generated FDC file with more detailed information

```----------------------------------START FFST------------------------------------
/Users/***/IdeaProjects/JmsSample/FFDC/JMSCC0001.FDC PID:640

                                    JMS Common Client First Failure Symptom Report

Product          :- IBM WebSphere MQ classes for JMS
Date/Time        :- Sat Feb 06 16:56:23 MSK 2016
System time      :- 1454766983855
Operating System :- Mac OS X
UserID           :- ***
Java Vendor      :- Oracle Corporation
Java Version     :- 25.72-b15

Source Class     :- JmsFactoryFactory
Source Method    :- getIntance(int)
ProbeID          :- XI001005
Thread           :- name=main priority=5 group=main ccl=sun.misc.Launcher$AppClassLoader@372f7a8d

                                      Data
                                      ----

|   connectionTypeName  :-  com.ibm.msg.client.wmq
|   exception           :-  ExceptionDepth is 4
|   exception           :-
|   |   Cause:1       :-  java.lang.reflect.InvocationTargetException
|   |   Cause:2       :-  java.lang.NoClassDefFoundError: com/ibm/disthub2/impl/client/SessionConfig
|   |   Cause:3       :-  java.lang.ClassNotFoundException: com.ibm.disthub2.impl.client.SessionConfig
|   |   Message:2     :-  com/ibm/disthub2/impl/client/SessionConfig
|   |   Message:3     :-  com.ibm.disthub2.impl.client.SessionConfig
|   |   StackTrace:1  :-  java.lang.reflect.InvocationTargetException
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:182)
|   |       at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3314)
|   |       at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:283)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
|   |       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
|   |       at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
|   |       at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
|   |       at javax.naming.InitialContext.lookup(InitialContext.java:417)
|   |       at com.company.Main.main(Main.java:31)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
|   |   Caused by: java.lang.NoClassDefFoundError: com/ibm/disthub2/impl/client/SessionConfig
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.setupDistHubTracing(WMQFactoryFactory.java:335)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.<init>(WMQFactoryFactory.java:305)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.getInstance(WMQFactoryFactory.java:186)
|   |       at com.ibm.msg.client.wmq.factories.WMQComponent.getFactoryInstance(WMQComponent.java:140)
|   |       at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:157)
|   |       ... 19 more
|   |   Caused by: java.lang.ClassNotFoundException: com.ibm.disthub2.impl.client.SessionConfig
|   |       at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
|   |       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
|   |       ... 24 more
|   |
|   |   StackTrace:2  :-  java.lang.NoClassDefFoundError: com/ibm/disthub2/impl/client/SessionConfig
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.setupDistHubTracing(WMQFactoryFactory.java:335)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.<init>(WMQFactoryFactory.java:305)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.getInstance(WMQFactoryFactory.java:186)
|   |       at com.ibm.msg.client.wmq.factories.WMQComponent.getFactoryInstance(WMQComponent.java:140)
|   |       at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:157)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:182)
|   |       at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3314)
|   |       at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:283)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
|   |       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
|   |       at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
|   |       at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
|   |       at javax.naming.InitialContext.lookup(InitialContext.java:417)
|   |       at com.company.Main.main(Main.java:31)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
|   |   Caused by: java.lang.ClassNotFoundException: com.ibm.disthub2.impl.client.SessionConfig
|   |       at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
|   |       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
|   |       ... 24 more
|   |
|   |   StackTrace:3  :-  java.lang.ClassNotFoundException: com.ibm.disthub2.impl.client.SessionConfig
|   |       at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
|   |       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.setupDistHubTracing(WMQFactoryFactory.java:335)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.<init>(WMQFactoryFactory.java:305)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.getInstance(WMQFactoryFactory.java:186)
|   |       at com.ibm.msg.client.wmq.factories.WMQComponent.getFactoryInstance(WMQComponent.java:140)
|   |       at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:157)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:182)
|   |       at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3314)
|   |       at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:283)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
|   |       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
|   |       at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
|   |       at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
|   |       at javax.naming.InitialContext.lookup(InitialContext.java:417)
|   |       at com.company.Main.main(Main.java:31)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
|   |

                              Version information
                              -------------------

IBM WebSphere MQ JMS Provider
7.5.0.3
p750-003-140123
Production

Common Services for Java Platform, Standard Edition
7.5.0.3
p750-003-140123
Production

Java Message Service Client
7.5.0.3
p750-003-140123
Production

WebSphere MQ classes for Java Message Service
7.5.0.3
p750-003-140123
Production

                                  Stack trace
                                  -----------

Stack trace to show the location of the FFST call
|   FFST Location  :-  java.lang.Exception
|       at com.ibm.msg.client.commonservices.trace.Trace.getCurrentPosition(Trace.java:1959)
|       at com.ibm.msg.client.commonservices.trace.Trace.createFFSTString(Trace.java:1898)
|       at com.ibm.msg.client.commonservices.trace.Trace.ffstInternal(Trace.java:1787)
|       at com.ibm.msg.client.commonservices.trace.Trace.ffst(Trace.java:1660)
|       at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:214)
|       at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3314)
|       at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:283)
|       at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
|       at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
|       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
|       at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
|       at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
|       at javax.naming.InitialContext.lookup(InitialContext.java:417)
|       at com.company.Main.main(Main.java:31)
|       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|       at java.lang.reflect.Method.invoke(Method.java:498)
|       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
|

                            Property Store Contents
                            -----------------------

All currently set properties
|   awt.toolkit                    :-  sun.lwawt.macosx.LWCToolkit
|   file.encoding                  :-  UTF-8
|   file.encoding.pkg              :-  sun.io
|   file.separator                 :-  /
|   ftp.nonProxyHosts              :-  local|*.local|169.254/16|*.169.254/16
|   gopherProxySet                 :-  false
|   http.nonProxyHosts             :-  local|*.local|169.254/16|*.169.254/16
|   idea.launcher.bin.path         :-  /Applications/IntelliJ IDEA 15 CE.app/Contents/bin
|   idea.launcher.port             :-  7533
|   java.awt.graphicsenv           :-  sun.awt.CGraphicsEnvironment
|   java.awt.printerjob            :-  sun.lwawt.macosx.CPrinterJob
|   java.class.path                :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/tools.jar:/Users/vladimirpopov/IdeaProjects/JmsSample/out/production/JmsSample:/Users/vladimirpopov/IdeaProjects/JmsSample/com.ibm.mq.jar:/Users/vladimirpopov/IdeaProjects/JmsSample/com.ibm.mqjms.jar:/Users/vladimirpopov/Downloads/jar/jms.jar:/Users/vladimirpopov/Downloads/jar/jndi.jar:/Users/vladimirpopov/Downloads/jar/fscontext.jar:/Users/vladimirpopov/Downloads/jar/com.ibm.mq.commonservices.jar:/Users/vladimirpopov/Downloads/jar/com.ibm.mq.defaultconfig.jar:/Users/vladimirpopov/Downloads/jar/providerutil.jar:/Applications/IntelliJ IDEA 15 CE.app/Contents/lib/idea_rt.jar
|   java.class.version             :-  52.0
|   java.endorsed.dirs             :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/endorsed
|   java.ext.dirs                  :-  /Users/vladimirpopov/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
|   java.home                      :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre
|   java.io.tmpdir                 :-  /var/folders/v0/vk3bz2wn79q5_9qggqqf_ynh0000gn/T/
|   java.library.path              :-  /Users/vladimirpopov/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
|   java.runtime.name              :-  Java(TM) SE Runtime Environment
|   java.runtime.version           :-  1.8.0_72-b15
|   java.specification.name        :-  Java Platform API Specification
|   java.specification.vendor      :-  Oracle Corporation
|   java.specification.version     :-  1.8
|   java.vendor                    :-  Oracle Corporation
|   java.vendor.url                :-  http://java.oracle.com/
|   java.vendor.url.bug            :-  http://bugreport.sun.com/bugreport/
|   java.version                   :-  1.8.0_72
|   java.vm.info                   :-  mixed mode
|   java.vm.name                   :-  Java HotSpot(TM) 64-Bit Server VM
|   java.vm.specification.name     :-  Java Virtual Machine Specification
|   java.vm.specification.vendor   :-  Oracle Corporation
|   java.vm.specification.version  :-  1.8
|   java.vm.vendor                 :-  Oracle Corporation
|   java.vm.version                :-  25.72-b15
|   line.separator                 :-
|
|   os.arch                        :-  x86_64
|   os.name                        :-  Mac OS X
|   os.version                     :-  10.10.5
|   path.separator                 :-  :
|   socksNonProxyHosts             :-  local|*.local|169.254/16|*.169.254/16
|   sun.arch.data.model            :-  64
|   sun.boot.class.path            :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/classes
|   sun.boot.library.path          :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib
|   sun.cpu.endian                 :-  little
|   sun.cpu.isalist                :-
|   sun.io.unicode.encoding        :-  UnicodeBig
|   sun.java.command               :-  com.intellij.rt.execution.application.AppMain com.company.Main
|   sun.java.launcher              :-  SUN_STANDARD
|   sun.jnu.encoding               :-  UTF-8
|   sun.management.compiler        :-  HotSpot 64-Bit Tiered Compilers
|   sun.os.patch.level             :-  unknown
|   user.country                   :-  US
|   user.dir                       :-  /Users/vladimirpopov/IdeaProjects/JmsSample
|   user.home                      :-  /Users/vladimirpopov
|   user.language                  :-  en
|   user.name                      :-  vladimirpopov
|   user.timezone                  :-

                           WorkQueueMananger Contents
                           --------------------------

|   Current ThreadPool size      :-  0
|   Maintain ThreadPool size     :-  false
|   Maximum ThreadPool size      :-  -1
|   ThreadPool inactive timeout  :-  0

                               Runtime properties
                               ------------------

|   Available processors         :-  4
|   Free memory in bytes (now)   :-  107069912
|   Max memory in bytes          :-  1908932608
|   Total memory in bytes (now)  :-  128974848

                           Component Manager Contents
                           --------------------------

Common Services Components:
|   CMVC               :-  p750-003-140123
|   Class Name         :-  class com.ibm.msg.client.commonservices.j2se.J2SEComponent
|   Component Name     :-  com.ibm.msg.client.commonservices.j2se
|   Component Title    :-  Common Services for Java Platform, Standard Edition
|   Factory Class      :-  class com.ibm.msg.client.commonservices.j2se.CommonServicesImplementation
|   Version            :-  7.5.0.3
|   inPreferenceTo[0]  :-  com.ibm.msg.client.commonservices.j2me

Messaging Provider Components:
|   CMVC             :-  p750-003-140123
|   Class Name       :-  class com.ibm.msg.client.wmq.factories.WMQComponent
|   Component Name   :-  com.ibm.msg.client.wmq
|   Component Title  :-  IBM WebSphere MQ JMS Provider
|   Factory Class    :-  class com.ibm.msg.client.wmq.factories.WMQFactoryFactory
|   Version          :-  7.5.0.3
```

答:
I'm working with WAS8 but I believe that the answer will be similar.

You'll have to reference the libs located in the ${was8Path}/installedConnectors/wmq.jmsra.rar/ path.

I had a similar exception **Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/msg/client/commonservices/trace/Trace** and I solved it by referencing the ${was8Path}/installedConnectors/wmq.jmsra.rar/com.ibm.msg.client.commonservices.jar library to the project.

Body:
I'm trying to make a simple JMS client application for Websphere MQ 7.5
I already have ".bindings" file with connection factory and destination, which I'm trying to connecto to.
This is my simple Java code, that I'm trying to run on mac:

package com.company;
import javax.jms.ConnectionFactory;
import javax.jms.Destination;
import javax.naming.Context;
import javax.naming.directory.InitialDirContext;
import java.util.Hashtable;
public class Main {
    public static final String     cfLookup    = "TEST12";
    public static final String     icf         = "com.sun.jndi.fscontext.RefFSContextFactory";
    static              String     url         = "file:///tmp/JNDI";
    public static void main(String[] args) {
        InitialDirContext  ctx          = null;
        Destination myDest       = null;
        ConnectionFactory connFactory  = null;
        Hashtable environment = new Hashtable();
        try {
        environment.put(Context.INITIAL_CONTEXT_FACTORY, icf);
        environment.put(Context.PROVIDER_URL, url);
            ctx = new InitialDirContext( environment );
            connFactory = (ConnectionFactory)ctx.lookup( cfLookup );
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
}

And this is the exception:

Exception in thread "main" java.lang.NoClassDefFoundError: com/ibm/disthub2/impl/client/SessionConfig
    at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.setupDistHubTracing(WMQFactoryFactory.java:335)
    at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.<init>(WMQFactoryFactory.java:305)
    at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.getInstance(WMQFactoryFactory.java:186)
    at com.ibm.msg.client.wmq.factories.WMQComponent.getFactoryInstance(WMQComponent.java:140)
    at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:157)
    at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.setProviderFactory(JmsConnectionFactoryImpl.java:168)
    at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:293)
    at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
    at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
    at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
    at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
    at javax.naming.InitialContext.lookup(InitialContext.java:417)
    at com.company.Main.main(Main.java:20)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)

It's pretty obvious, that some other libraries are required, but none of those JAR file I got copying from Websphere MQ client installation seem to work. And also it feels kinda strange that some provider specific class is needed to make a query against JNDI.
I already read a lot of topics at IBM and mqseries, but nothing helps. Any assistance would by higly appreciated.

Also with every run there is also a newly generated FDC file with more detailed information

----------------------------------START FFST------------------------------------
/Users/***/IdeaProjects/JmsSample/FFDC/JMSCC0001.FDC PID:640

                                    JMS Common Client First Failure Symptom Report

Product          :- IBM WebSphere MQ classes for JMS
Date/Time        :- Sat Feb 06 16:56:23 MSK 2016
System time      :- 1454766983855
Operating System :- Mac OS X
UserID           :- ***
Java Vendor      :- Oracle Corporation
Java Version     :- 25.72-b15

Source Class     :- JmsFactoryFactory
Source Method    :- getIntance(int)
ProbeID          :- XI001005
Thread           :- name=main priority=5 group=main ccl=sun.misc.Launcher$AppClassLoader@372f7a8d

                                      Data
                                      ----

|   connectionTypeName  :-  com.ibm.msg.client.wmq
|   exception           :-  ExceptionDepth is 4
|   exception           :-
|   |   Cause:1       :-  java.lang.reflect.InvocationTargetException
|   |   Cause:2       :-  java.lang.NoClassDefFoundError: com/ibm/disthub2/impl/client/SessionConfig
|   |   Cause:3       :-  java.lang.ClassNotFoundException: com.ibm.disthub2.impl.client.SessionConfig
|   |   Message:2     :-  com/ibm/disthub2/impl/client/SessionConfig
|   |   Message:3     :-  com.ibm.disthub2.impl.client.SessionConfig
|   |   StackTrace:1  :-  java.lang.reflect.InvocationTargetException
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:182)
|   |       at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3314)
|   |       at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:283)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
|   |       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
|   |       at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
|   |       at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
|   |       at javax.naming.InitialContext.lookup(InitialContext.java:417)
|   |       at com.company.Main.main(Main.java:31)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
|   |   Caused by: java.lang.NoClassDefFoundError: com/ibm/disthub2/impl/client/SessionConfig
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.setupDistHubTracing(WMQFactoryFactory.java:335)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.<init>(WMQFactoryFactory.java:305)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.getInstance(WMQFactoryFactory.java:186)
|   |       at com.ibm.msg.client.wmq.factories.WMQComponent.getFactoryInstance(WMQComponent.java:140)
|   |       at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:157)
|   |       ... 19 more
|   |   Caused by: java.lang.ClassNotFoundException: com.ibm.disthub2.impl.client.SessionConfig
|   |       at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
|   |       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
|   |       ... 24 more
|   |
|   |   StackTrace:2  :-  java.lang.NoClassDefFoundError: com/ibm/disthub2/impl/client/SessionConfig
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.setupDistHubTracing(WMQFactoryFactory.java:335)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.<init>(WMQFactoryFactory.java:305)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.getInstance(WMQFactoryFactory.java:186)
|   |       at com.ibm.msg.client.wmq.factories.WMQComponent.getFactoryInstance(WMQComponent.java:140)
|   |       at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:157)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:182)
|   |       at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3314)
|   |       at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:283)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
|   |       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
|   |       at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
|   |       at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
|   |       at javax.naming.InitialContext.lookup(InitialContext.java:417)
|   |       at com.company.Main.main(Main.java:31)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
|   |   Caused by: java.lang.ClassNotFoundException: com.ibm.disthub2.impl.client.SessionConfig
|   |       at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
|   |       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
|   |       ... 24 more
|   |
|   |   StackTrace:3  :-  java.lang.ClassNotFoundException: com.ibm.disthub2.impl.client.SessionConfig
|   |       at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
|   |       at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
|   |       at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.setupDistHubTracing(WMQFactoryFactory.java:335)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.<init>(WMQFactoryFactory.java:305)
|   |       at com.ibm.msg.client.wmq.factories.WMQFactoryFactory.getInstance(WMQFactoryFactory.java:186)
|   |       at com.ibm.msg.client.wmq.factories.WMQComponent.getFactoryInstance(WMQComponent.java:140)
|   |       at com.ibm.msg.client.jms.internal.JmsFactoryFactoryImpl.getInstance(JmsFactoryFactoryImpl.java:157)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:182)
|   |       at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3314)
|   |       at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:283)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
|   |       at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
|   |       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
|   |       at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
|   |       at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
|   |       at javax.naming.InitialContext.lookup(InitialContext.java:417)
|   |       at com.company.Main.main(Main.java:31)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|   |       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|   |       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|   |       at java.lang.reflect.Method.invoke(Method.java:498)
|   |       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
|   |

                              Version information
                              -------------------

IBM WebSphere MQ JMS Provider
7.5.0.3
p750-003-140123
Production

Common Services for Java Platform, Standard Edition
7.5.0.3
p750-003-140123
Production

Java Message Service Client
7.5.0.3
p750-003-140123
Production

WebSphere MQ classes for Java Message Service
7.5.0.3
p750-003-140123
Production

                                  Stack trace
                                  -----------

Stack trace to show the location of the FFST call
|   FFST Location  :-  java.lang.Exception
|       at com.ibm.msg.client.commonservices.trace.Trace.getCurrentPosition(Trace.java:1959)
|       at com.ibm.msg.client.commonservices.trace.Trace.createFFSTString(Trace.java:1898)
|       at com.ibm.msg.client.commonservices.trace.Trace.ffstInternal(Trace.java:1787)
|       at com.ibm.msg.client.commonservices.trace.Trace.ffst(Trace.java:1660)
|       at com.ibm.msg.client.jms.JmsFactoryFactory.getInstance(JmsFactoryFactory.java:214)
|       at com.ibm.mq.jms.MQConnectionFactory.initialiseMQConnectionFactory(MQConnectionFactory.java:3314)
|       at com.ibm.mq.jms.MQConnectionFactory.<init>(MQConnectionFactory.java:283)
|       at com.ibm.mq.jms.MQQueueConnectionFactory.<init>(MQQueueConnectionFactory.java:81)
|       at com.ibm.mq.jms.MQQueueConnectionFactoryFactory.getObjectInstance(MQQueueConnectionFactoryFactory.java:77)
|       at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:321)
|       at com.sun.jndi.fscontext.RefFSContext.lookup(RefFSContext.java:146)
|       at com.sun.jndi.fscontext.FSContext.lookup(FSContext.java:127)
|       at javax.naming.InitialContext.lookup(InitialContext.java:417)
|       at com.company.Main.main(Main.java:31)
|       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
|       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
|       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
|       at java.lang.reflect.Method.invoke(Method.java:498)
|       at com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
|

                            Property Store Contents
                            -----------------------

All currently set properties
|   awt.toolkit                    :-  sun.lwawt.macosx.LWCToolkit
|   file.encoding                  :-  UTF-8
|   file.encoding.pkg              :-  sun.io
|   file.separator                 :-  /
|   ftp.nonProxyHosts              :-  local|*.local|169.254/16|*.169.254/16
|   gopherProxySet                 :-  false
|   http.nonProxyHosts             :-  local|*.local|169.254/16|*.169.254/16
|   idea.launcher.bin.path         :-  /Applications/IntelliJ IDEA 15 CE.app/Contents/bin
|   idea.launcher.port             :-  7533
|   java.awt.graphicsenv           :-  sun.awt.CGraphicsEnvironment
|   java.awt.printerjob            :-  sun.lwawt.macosx.CPrinterJob
|   java.class.path                :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/deploy.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/cldrdata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/dnsns.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/jaccess.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/jfxrt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/localedata.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/nashorn.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/sunec.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/sunjce_provider.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/sunpkcs11.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext/zipfs.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/javaws.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jfxswt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/management-agent.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/plugin.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/ant-javafx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/dt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/javafx-mx.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/jconsole.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/packager.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/sa-jdi.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/lib/tools.jar:/Users/vladimirpopov/IdeaProjects/JmsSample/out/production/JmsSample:/Users/vladimirpopov/IdeaProjects/JmsSample/com.ibm.mq.jar:/Users/vladimirpopov/IdeaProjects/JmsSample/com.ibm.mqjms.jar:/Users/vladimirpopov/Downloads/jar/jms.jar:/Users/vladimirpopov/Downloads/jar/jndi.jar:/Users/vladimirpopov/Downloads/jar/fscontext.jar:/Users/vladimirpopov/Downloads/jar/com.ibm.mq.commonservices.jar:/Users/vladimirpopov/Downloads/jar/com.ibm.mq.defaultconfig.jar:/Users/vladimirpopov/Downloads/jar/providerutil.jar:/Applications/IntelliJ IDEA 15 CE.app/Contents/lib/idea_rt.jar
|   java.class.version             :-  52.0
|   java.endorsed.dirs             :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/endorsed
|   java.ext.dirs                  :-  /Users/vladimirpopov/Library/Java/Extensions:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/ext:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java
|   java.home                      :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre
|   java.io.tmpdir                 :-  /var/folders/v0/vk3bz2wn79q5_9qggqqf_ynh0000gn/T/
|   java.library.path              :-  /Users/vladimirpopov/Library/Java/Extensions:/Library/Java/Extensions:/Network/Library/Java/Extensions:/System/Library/Java/Extensions:/usr/lib/java:.
|   java.runtime.name              :-  Java(TM) SE Runtime Environment
|   java.runtime.version           :-  1.8.0_72-b15
|   java.specification.name        :-  Java Platform API Specification
|   java.specification.vendor      :-  Oracle Corporation
|   java.specification.version     :-  1.8
|   java.vendor                    :-  Oracle Corporation
|   java.vendor.url                :-  http://java.oracle.com/
|   java.vendor.url.bug            :-  http://bugreport.sun.com/bugreport/
|   java.version                   :-  1.8.0_72
|   java.vm.info                   :-  mixed mode
|   java.vm.name                   :-  Java HotSpot(TM) 64-Bit Server VM
|   java.vm.specification.name     :-  Java Virtual Machine Specification
|   java.vm.specification.vendor   :-  Oracle Corporation
|   java.vm.specification.version  :-  1.8
|   java.vm.vendor                 :-  Oracle Corporation
|   java.vm.version                :-  25.72-b15
|   line.separator                 :-
|
|   os.arch                        :-  x86_64
|   os.name                        :-  Mac OS X
|   os.version                     :-  10.10.5
|   path.separator                 :-  :
|   socksNonProxyHosts             :-  local|*.local|169.254/16|*.169.254/16
|   sun.arch.data.model            :-  64
|   sun.boot.class.path            :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/resources.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/rt.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/sunrsasign.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jsse.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jce.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/charsets.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib/jfr.jar:/Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/classes
|   sun.boot.library.path          :-  /Library/Java/JavaVirtualMachines/jdk1.8.0_72.jdk/Contents/Home/jre/lib
|   sun.cpu.endian                 :-  little
|   sun.cpu.isalist                :-
|   sun.io.unicode.encoding        :-  UnicodeBig
|   sun.java.command               :-  com.intellij.rt.execution.application.AppMain com.company.Main
|   sun.java.launcher              :-  SUN_STANDARD
|   sun.jnu.encoding               :-  UTF-8
|   sun.management.compiler        :-  HotSpot 64-Bit Tiered Compilers
|   sun.os.patch.level             :-  unknown
|   user.country                   :-  US
|   user.dir                       :-  /Users/vladimirpopov/IdeaProjects/JmsSample
|   user.home                      :-  /Users/vladimirpopov
|   user.language                  :-  en
|   user.name                      :-  vladimirpopov
|   user.timezone                  :-

                           WorkQueueMananger Contents
                           --------------------------

|   Current ThreadPool size      :-  0
|   Maintain ThreadPool size     :-  false
|   Maximum ThreadPool size      :-  -1
|   ThreadPool inactive timeout  :-  0

                               Runtime properties
                               ------------------

|   Available processors         :-  4
|   Free memory in bytes (now)   :-  107069912
|   Max memory in bytes          :-  1908932608
|   Total memory in bytes (now)  :-  128974848

                           Component Manager Contents
                           --------------------------

Common Services Components:
|   CMVC               :-  p750-003-140123
|   Class Name         :-  class com.ibm.msg.client.commonservices.j2se.J2SEComponent
|   Component Name     :-  com.ibm.msg.client.commonservices.j2se
|   Component Title    :-  Common Services for Java Platform, Standard Edition
|   Factory Class      :-  class com.ibm.msg.client.commonservices.j2se.CommonServicesImplementation
|   Version            :-  7.5.0.3
|   inPreferenceTo[0]  :-  com.ibm.msg.client.commonservices.j2me

Messaging Provider Components:
|   CMVC             :-  p750-003-140123
|   Class Name       :-  class com.ibm.msg.client.wmq.factories.WMQComponent
|   Component Name   :-  com.ibm.msg.client.wmq
|   Component Title  :-  IBM WebSphere MQ JMS Provider
|   Factory Class    :-  class com.ibm.msg.client.wmq.factories.WMQFactoryFactory
|   Version          :-  7.5.0.3


来源: stackexchange

问:
Building Eigen3 with CXX_FLAGS
I'm trying to build Eigen3 using CMake as described in the installation menual:

```<code>root@60e449767588:/opt/tr/src/eigen/build_dir$ ../../cmake-3.8.1/bin/cmake  -DCMAKE_BUILD_TYPE=Release --build ..
</code>```

This is the output:

```<code>-- Standard libraries to link to explicitly: none
-- Found unsuitable Qt version "" from NOTFOUND
-- Could NOT find CHOLMOD (missing:  CHOLMOD_INCLUDES CHOLMOD_LIBRARIES)
-- Could NOT find UMFPACK (missing:  UMFPACK_INCLUDES UMFPACK_LIBRARIES)
-- Could NOT find SUPERLU (missing:  SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK)
-- Could NOT find PASTIX (missing:  PASTIX_INCLUDES PASTIX_LIBRARIES)
-- Could NOT find SCOTCH (missing:  SCOTCH_INCLUDES SCOTCH_LIBRARIES)
-- Could NOT find METIS (missing:  METIS_INCLUDES METIS_LIBRARIES)
-- Could NOT find SPQR (missing:  SPQR_INCLUDES SPQR_LIBRARIES)
-- Found unsuitable Qt version "" from NOTFOUND
-- Boost version: 1.64.0
-- Could NOT find GOOGLEHASH (missing:  GOOGLEHASH_INCLUDES GOOGLEHASH_COMPILE)
-- Could NOT find ADOLC (missing:  ADOLC_INCLUDES ADOLC_LIBRARIES)
-- Could NOT find MPFR (missing:  MPFR_INCLUDES MPFR_LIBRARIES MPFR_VERSION_OK) (Required is at least version "2.3.0")
-- Could NOT find GMP (missing:  GMP_INCLUDES GMP_LIBRARIES)
-- Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE)
-- Could NOT find FFTW (missing:  FFTW_INCLUDES FFTW_LIBRARIES)
-- Could NOT find OpenGL (missing:  OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR)
-- Could NOT find GLUT (missing:  GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing:  CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.0")
-- Found unsuitable Qt version "" from NOTFOUND
-- Qt4 not found, so disabling the mandelbrot and opengl demos
-- Could NOT find CHOLMOD (missing:  CHOLMOD_INCLUDES CHOLMOD_LIBRARIES)
-- Could NOT find UMFPACK (missing:  UMFPACK_INCLUDES UMFPACK_LIBRARIES)
-- Could NOT find SUPERLU (missing:  SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK)
-- Could NOT find PASTIX (missing:  PASTIX_INCLUDES PASTIX_LIBRARIES)
-- Could NOT find SCOTCH (missing:  SCOTCH_INCLUDES SCOTCH_LIBRARIES)
-- Could NOT find METIS (missing:  METIS_INCLUDES METIS_LIBRARIES)
-- ************************************************************
-- ***    Eigen's unit tests configuration summary          ***
-- ************************************************************
--
-- Build type:        Release
-- Build site:        60e449767588
-- Build string:      linux-4.4.0-78-generic-_-4.9.2-sse2-64bit
-- Enabled backends:  Boost.Multiprecision,
-- Disabled backends: Cholmod,  UmfPack,  SuperLU,  PaStiX,  METIS,  SPQR,  Qt4 support,  GoogleHash,  Adolc,  MPFR C++,  fftw,  OpenGL,
-- Default order:     Column-major
-- Maximal matrix/vector size: 320
-- SSE2:              Using architecture defaults
-- SSE3:              Using architecture defaults
-- SSSE3:             Using architecture defaults
-- SSE4.1:            Using architecture defaults
-- SSE4.2:            Using architecture defaults
-- AVX:               Using architecture defaults
-- FMA:               Using architecture defaults
-- AVX512:            Using architecture defaults
-- Altivec:           Using architecture defaults
-- VSX:               Using architecture defaults
-- ARM NEON:          Using architecture defaults
-- ARMv8 NEON:        Using architecture defaults
-- S390X ZVECTOR:     Using architecture defaults
-- C++11:             OFF
-- SYCL:              OFF
-- CUDA:              OFF
--
CXX:               /usr/bin/c++
 CXX_VERSION:       c++ (Debian 4.9.2-10) 4.9.2
 CXX_FLAGS:         -O3 -DNDEBUG -fPIC -DEIGEN_USE_MKL_ALL -DMKL_ILP64 -fopenmp -m64 -v -pedantic -Wall -Wextra -Wundef -Wcast-align -Wchar-subscripts -Wnon-virtual-dtor -Wunused-local-typedefs -Wpointer-arith -Wwrite-strings -Wformat-security -Wlogical-op -Wdouble-promotion -Wno-psabi -Wno-variadic-macros -Wno-long-long -fno-check-new -fno-common -fstrict-aliasing -ansi
 Sparse lib flags:

-- ************************************************************
--
-- Configured Eigen 3.3.3
--
-- Some things you can do now:
-- --------------+--------------------------------------------------------------
-- Command       |   Description
-- --------------+--------------------------------------------------------------
-- make install  | Install Eigen. Headers will be installed to:
--               |     <CMAKE_INSTALL_PREFIX>/<INCLUDE_INSTALL_DIR>
--               |   Using the following values:
--               |     CMAKE_INSTALL_PREFIX: /usr/local
--               |     INCLUDE_INSTALL_DIR:  include/eigen3
--               |   Change the install location of Eigen headers using:
--               |     cmake . -DCMAKE_INSTALL_PREFIX=yourprefix
--               |   Or:
--               |     cmake . -DINCLUDE_INSTALL_DIR=yourdir
-- make doc      | Generate the API documentation, requires Doxygen & LaTeX
-- make check    | Build and run the unit-tests. Read this page:
--               |   http://eigen.tuxfamily.org/index.php?title=Tests
-- make blas     | Build BLAS library (not the same thing as Eigen)
-- make uninstall| Removes files installed by make install
-- --------------+--------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/tr/src/eigen/build_dir
</code>```

My questions are:

How to remove the default value of CXX_FLAGS?

How to specify that I wish to work with C++11 or even 14?

How to specify that I wish to work with SYCL?

Thank you!

答:
As suggested in my comment, Eigen is a header only library (there are no source files), you do not need to build it. Just include the relevant headers where you want to use Eigen. You may copy the header files (using simple cp) to wherever it seems appropriate to you.

See the Getting Started manual:

In order to use Eigen, you just need to download and extract Eigen's
source code (see the wiki for download instructions). In fact, the
header files in the Eigen subdirectory are the only files required to
compile programs using Eigen. The header files are the same for all
platforms. It is not necessary to use CMake or install anything.

And the Eigen wiki mentions:

We use the CMake build system, but only to build the documentation and
unit-tests, and to automate installation. If you just want to use
Eigen, you can use the header files right away. There is no binary
library to link to, and no configured header file. Eigen is a pure
template library defined in the headers.

So, if you are not interested in building the unit-tests or the documentation, you do not need cmake for it.

Conclusion: You have to specify the compiler flags (CXX_FLAGS, ...) in the project which uses Eigen.

Note for CMake find_package: see the comment of Andrew W.

ContentLicense: CC BY-SA 3.0

Title: Building Eigen3 with CXX_FLAGS

Body:
I'm trying to build Eigen3 using CMake as described in the installation menual:

root@60e449767588:/opt/tr/src/eigen/build_dir$ ../../cmake-3.8.1/bin/cmake  -DCMAKE_BUILD_TYPE=Release --build ..

This is the output:

-- Standard libraries to link to explicitly: none
-- Found unsuitable Qt version "" from NOTFOUND
-- Could NOT find CHOLMOD (missing:  CHOLMOD_INCLUDES CHOLMOD_LIBRARIES)
-- Could NOT find UMFPACK (missing:  UMFPACK_INCLUDES UMFPACK_LIBRARIES)
-- Could NOT find SUPERLU (missing:  SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK)
-- Could NOT find PASTIX (missing:  PASTIX_INCLUDES PASTIX_LIBRARIES)
-- Could NOT find SCOTCH (missing:  SCOTCH_INCLUDES SCOTCH_LIBRARIES)
-- Could NOT find METIS (missing:  METIS_INCLUDES METIS_LIBRARIES)
-- Could NOT find SPQR (missing:  SPQR_INCLUDES SPQR_LIBRARIES)
-- Found unsuitable Qt version "" from NOTFOUND
-- Boost version: 1.64.0
-- Could NOT find GOOGLEHASH (missing:  GOOGLEHASH_INCLUDES GOOGLEHASH_COMPILE)
-- Could NOT find ADOLC (missing:  ADOLC_INCLUDES ADOLC_LIBRARIES)
-- Could NOT find MPFR (missing:  MPFR_INCLUDES MPFR_LIBRARIES MPFR_VERSION_OK) (Required is at least version "2.3.0")
-- Could NOT find GMP (missing:  GMP_INCLUDES GMP_LIBRARIES)
-- Could NOT find PkgConfig (missing:  PKG_CONFIG_EXECUTABLE)
-- Could NOT find FFTW (missing:  FFTW_INCLUDES FFTW_LIBRARIES)
-- Could NOT find OpenGL (missing:  OPENGL_gl_LIBRARY OPENGL_INCLUDE_DIR)
-- Could NOT find GLUT (missing:  GLUT_glut_LIBRARY GLUT_INCLUDE_DIR)
CUDA_TOOLKIT_ROOT_DIR not found or specified
-- Could NOT find CUDA (missing:  CUDA_TOOLKIT_ROOT_DIR CUDA_NVCC_EXECUTABLE CUDA_INCLUDE_DIRS CUDA_CUDART_LIBRARY) (Required is at least version "7.0")
-- Found unsuitable Qt version "" from NOTFOUND
-- Qt4 not found, so disabling the mandelbrot and opengl demos
-- Could NOT find CHOLMOD (missing:  CHOLMOD_INCLUDES CHOLMOD_LIBRARIES)
-- Could NOT find UMFPACK (missing:  UMFPACK_INCLUDES UMFPACK_LIBRARIES)
-- Could NOT find SUPERLU (missing:  SUPERLU_INCLUDES SUPERLU_LIBRARIES SUPERLU_VERSION_OK)
-- Could NOT find PASTIX (missing:  PASTIX_INCLUDES PASTIX_LIBRARIES)
-- Could NOT find SCOTCH (missing:  SCOTCH_INCLUDES SCOTCH_LIBRARIES)
-- Could NOT find METIS (missing:  METIS_INCLUDES METIS_LIBRARIES)
-- ************************************************************
-- ***    Eigen's unit tests configuration summary          ***
-- ************************************************************
--
-- Build type:        Release
-- Build site:        60e449767588
-- Build string:      linux-4.4.0-78-generic-_-4.9.2-sse2-64bit
-- Enabled backends:  Boost.Multiprecision,
-- Disabled backends: Cholmod,  UmfPack,  SuperLU,  PaStiX,  METIS,  SPQR,  Qt4 support,  GoogleHash,  Adolc,  MPFR C++,  fftw,  OpenGL,
-- Default order:     Column-major
-- Maximal matrix/vector size: 320
-- SSE2:              Using architecture defaults
-- SSE3:              Using architecture defaults
-- SSSE3:             Using architecture defaults
-- SSE4.1:            Using architecture defaults
-- SSE4.2:            Using architecture defaults
-- AVX:               Using architecture defaults
-- FMA:               Using architecture defaults
-- AVX512:            Using architecture defaults
-- Altivec:           Using architecture defaults
-- VSX:               Using architecture defaults
-- ARM NEON:          Using architecture defaults
-- ARMv8 NEON:        Using architecture defaults
-- S390X ZVECTOR:     Using architecture defaults
-- C++11:             OFF
-- SYCL:              OFF
-- CUDA:              OFF
--
CXX:               /usr/bin/c++
 CXX_VERSION:       c++ (Debian 4.9.2-10) 4.9.2
 CXX_FLAGS:         -O3 -DNDEBUG -fPIC -DEIGEN_USE_MKL_ALL -DMKL_ILP64 -fopenmp -m64 -v -pedantic -Wall -Wextra -Wundef -Wcast-align -Wchar-subscripts -Wnon-virtual-dtor -Wunused-local-typedefs -Wpointer-arith -Wwrite-strings -Wformat-security -Wlogical-op -Wdouble-promotion -Wno-psabi -Wno-variadic-macros -Wno-long-long -fno-check-new -fno-common -fstrict-aliasing -ansi
 Sparse lib flags:

-- ************************************************************
--
-- Configured Eigen 3.3.3
--
-- Some things you can do now:
-- --------------+--------------------------------------------------------------
-- Command       |   Description
-- --------------+--------------------------------------------------------------
-- make install  | Install Eigen. Headers will be installed to:
--               |     <CMAKE_INSTALL_PREFIX>/<INCLUDE_INSTALL_DIR>
--               |   Using the following values:
--               |     CMAKE_INSTALL_PREFIX: /usr/local
--               |     INCLUDE_INSTALL_DIR:  include/eigen3
--               |   Change the install location of Eigen headers using:
--               |     cmake . -DCMAKE_INSTALL_PREFIX=yourprefix
--               |   Or:
--               |     cmake . -DINCLUDE_INSTALL_DIR=yourdir
-- make doc      | Generate the API documentation, requires Doxygen & LaTeX
-- make check    | Build and run the unit-tests. Read this page:
--               |   http://eigen.tuxfamily.org/index.php?title=Tests
-- make blas     | Build BLAS library (not the same thing as Eigen)
-- make uninstall| Removes files installed by make install
-- --------------+--------------------------------------------------------------
--
-- Configuring done
-- Generating done
-- Build files have been written to: /opt/tr/src/eigen/build_dir

My questions are:

How to remove the default value of CXX_FLAGS?

How to specify that I wish to work with C++11 or even 14?

How to specify that I wish to work with SYCL?

Thank you!

ContentLicense: CC BY-SA 4.0


问:
PHP: number_format issue
Iv taken over a very old php project that is still currently in use.
Its a custom "shopping" website.

When a product gets ordered it inserts the money value into the database as a string of integers:

```<code>2000
</code>```

which then gets outputted as follows:

R20,00

Using this code

```<code>echo number_format($order['order_total'] / 100, 2, ",", "");
</code>```

My problem is that if an order gets placed to the value of R 15 256.00
The record gets inserted as such:

```<code>15256
</code>```

and gets outputted to the user as:

R 152,56

But it should ultimately show like this

R15, 256.00

I do understand that the problem comes in by dividing the amount by 100 in the above query. If i alter the query then the larger numbers appear fine but the smaller amounts such as R20,00 get shown as R2000,00

Any help would be great.

答:
You can you PHP's native function money_format(), which will format the number as a currency.
Using setlocale() you can set the appropriate locale.

```<code>setlocale(LC_MONETARY, 'en_IN');
echo money_format('%!i', 15256);
</code>```

This will output:

15,256.00

Title: PHP: number_format issue

Body:
Iv taken over a very old php project that is still currently in use.
Its a custom "shopping" website.

When a product gets ordered it inserts the money value into the database as a string of integers:

2000

which then gets outputted as follows:

R20,00

Using this code

echo number_format($order['order_total'] / 100, 2, ",", "");

My problem is that if an order gets placed to the value of R 15 256.00
The record gets inserted as such:

15256

and gets outputted to the user as:

R 152,56

But it should ultimately show like this

R15, 256.00

I do understand that the problem comes in by dividing the amount by 100 in the above query. If i alter the query then the larger numbers appear fine but the smaller amounts such as R20,00 get shown as R2000,00

Any help would be great.

Body:
You can you PHP's native function money_format(), which will format the number as a currency.
Using setlocale() you can set the appropriate locale.

setlocale(LC_MONETARY, 'en_IN');
echo money_format('%!i', 15256);

This will output:

15,256.00


问:
How to manage multiple tables, function, stored procedures and views (SQL Server)
I have multiple object in my database and i would like to list them give some description, accepted parameters and their types. The fastest way I know is to generate a database script and call it a day, but is there an easier way to archive this? I use Microsoft SSMS 2017 with SQL Server 2012.</p>

答:
You can query the table INFORMATION_SCHEMA.PARAMETERS (or sys.parameters).

Here is a simple query that extracts some of the data you requested; you can use this as a starting point and elaborate on this to get your desired output:

```<code>select P.SPECIFIC_SCHEMA,
   P.SPECIFIC_NAME,
   R.ROUTINE_TYPE,
   P.PARAMETER_MODE,
   P.PARAMETER_NAME,
   P.DATA_TYPE,
   P.CHARACTER_MAXIMUM_LENGTH
from INFORMATION_SCHEMA.PARAMETERS P
inner join INFORMATION_SCHEMA.ROUTINES R ON P.SPECIFIC_CATALOG = R.ROUTINE_CATALOG
   AND P.SPECIFIC_SCHEMA = R.ROUTINE_SCHEMA
   AND P.SPECIFIC_NAME = R.ROUTINE_NAME
order by P.SPECIFIC_SCHEMA, P.SPECIFIC_NAME, P.PARAMETER_MODE, P.PARAMETER_NAME
</code>```

Here is the output of this query on a simple database:

Body:
You can query the table INFORMATION_SCHEMA.PARAMETERS (or sys.parameters).

Here is a simple query that extracts some of the data you requested; you can use this as a starting point and elaborate on this to get your desired output:

select P.SPECIFIC_SCHEMA,
   P.SPECIFIC_NAME,
   R.ROUTINE_TYPE,
   P.PARAMETER_MODE,
   P.PARAMETER_NAME,
   P.DATA_TYPE,
   P.CHARACTER_MAXIMUM_LENGTH
from INFORMATION_SCHEMA.PARAMETERS P
inner join INFORMATION_SCHEMA.ROUTINES R ON P.SPECIFIC_CATALOG = R.ROUTINE_CATALOG
   AND P.SPECIFIC_SCHEMA = R.ROUTINE_SCHEMA
   AND P.SPECIFIC_NAME = R.ROUTINE_NAME
order by P.SPECIFIC_SCHEMA, P.SPECIFIC_NAME, P.PARAMETER_MODE, P.PARAMETER_NAME

Here is the output of this query on a simple database:


问:
Add UILabels with different width side by side programmatically
I want to add multiple UILabels programmatically side by side to a TableViewCell. The UILabels have different width.

The first cell in the picture shows the problem and the second cell what I would like to do.

In this example I want to add four UILabels to a TableViewCell. But the width of the TableViewCell is smaller than the width of the UILabels. Therefore I must increase the CellHeight and add the UILabels below to the other UILabels (like the second cell in the picture).

答:
You should put UICollectionView inside of a row of your UITableViewCell.
Each cell of your UICollectionView will have a multi UILabel. Update the dataSource for your UICollectionView depending on your label count. Set isScrollEnabled false of that UICollectionView and set automatic row height for UITableViewCell.

Also, set flow layout to UICollectionView :

```<code>if let flowLayout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout { flowLayout.estimatedItemSize = CGSizeMake(1, 1) }
</code>```

Adjust cell size like below:

```<code>func collectionView(_ collectionView: UICollectionView,
                        layout collectionViewLayout: UICollectionViewLayout,
                        sizeForItemAt indexPath: IndexPath) -> CGSize {

        let size: CGSize = keywordArray[indexPath.row].size(attributes: [NSFontAttributeName: UIFont.systemFont(ofSize: 14.0)])
        return CGSize(width: size.width + 45.0, height: keywordsCollectionView.bounds.size.height)
    }
</code>```

Body:
You should put UICollectionView inside of a row of your UITableViewCell.
Each cell of your UICollectionView will have a multi UILabel. Update the dataSource for your UICollectionView depending on your label count. Set isScrollEnabled false of that UICollectionView and set automatic row height for UITableViewCell.

Also, set flow layout to UICollectionView :

if let flowLayout = collectionView.collectionViewLayout as? UICollectionViewFlowLayout { flowLayout.estimatedItemSize = CGSizeMake(1, 1) }

Adjust cell size like below:

func collectionView(_ collectionView: UICollectionView,
                        layout collectionViewLayout: UICollectionViewLayout,
                        sizeForItemAt indexPath: IndexPath) -> CGSize {

        let size: CGSize = keywordArray[indexPath.row].size(attributes: [NSFontAttributeName: UIFont.systemFont(ofSize: 14.0)])
        return CGSize(width: size.width + 45.0, height: keywordsCollectionView.bounds.size.height)
    }


答:
At first you have to make for labels.

```<code>override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CustomCell

        let label1 = UILabel(frame: CGRect(x: 5, y: 5, width: 100, height: 25))
        label1.text = "Label 1"
        let label2 = UILabel(frame: CGRect(x: 110, y: 5, width: 225, height: 25))
        label2.text = "Label 2"
        let label3 = UILabel(frame: CGRect(x: 5, y: 40, width: 100, height: 25))
        label3.text = "Label 3"
        let label4 = UILabel(frame: CGRect(x: 110, y: 40, width: 225, height: 25))
        label4.text = "Label 4"
        cell.addSubview(label1)
        cell.addSubview(label2)
        cell.addSubview(label3)
        cell.addSubview(label4)

    return cell
}
</code>```

Each label has different width and different position. You can play with it

Title: Add UILabels with different width side by side programmatically

Body:
I want to add multiple UILabels programmatically side by side to a TableViewCell. The UILabels have different width.

The first cell in the picture shows the problem and the second cell what I would like to do.

In this example I want to add four UILabels to a TableViewCell. But the width of the TableViewCell is smaller than the width of the UILabels. Therefore I must increase the CellHeight and add the UILabels below to the other UILabels (like the second cell in the picture).

Body:
At first you have to make for labels.

override func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
    let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as! CustomCell

        let label1 = UILabel(frame: CGRect(x: 5, y: 5, width: 100, height: 25))
        label1.text = "Label 1"
        let label2 = UILabel(frame: CGRect(x: 110, y: 5, width: 225, height: 25))
        label2.text = "Label 2"
        let label3 = UILabel(frame: CGRect(x: 5, y: 40, width: 100, height: 25))
        label3.text = "Label 3"
        let label4 = UILabel(frame: CGRect(x: 110, y: 40, width: 225, height: 25))
        label4.text = "Label 4"
        cell.addSubview(label1)
        cell.addSubview(label2)
        cell.addSubview(label3)
        cell.addSubview(label4)

    return cell
}

Each label has different width and different position. You can play with it


问:
how to group by the array values dynamically in javascript
hi all i am using javascript i have a set of array i need to group by the object

code

```<code> var data = [{BuildingID: "5", FloorId: "65", one: 12, two: 15,three: 12},
            {BuildingID: "5", FloorId: "65", one: 12, two: 15,three: 12},
            {BuildingID: "6", FloorId: "65", one: 12, two: 15,three: 12},
            {BuildingID: "6", FloorId: "65", one: 12, two: 15,three: 12}]
</code>```

i am trying to do group by the BuildingID add one,two,three
NOTE:one two three is not static

Excepted Output

```<code>  var data = [{BuildingID: "5", FloorId: "65", one: 24, two: 30,three: 24},
              {BuildingID: "6", FloorId: "65", one: 24, two: 30,three: 24} ]
</code>```

答:
here is a snippet code that work for me,

it assums you know the key attribute of the object

```<code>var arr = [ { id: 1, name: 'bob' }, { id: 1, name: 'bill' }, { id: 1, name: 'bill' } ]

var noDuplicate = [];
var unique = {};

$.each(arr, function(key, item) {

    if (! unique[item.id + "-" + item.name]) {
        noDuplicate.push(item);
        unique[item.id + "-" + item.name] = true;
    }
});

console.log(noDuplicate);
</code>```

hope it helps ;)

regards.

Body:
hi all i am using javascript i have a set of array i need to group by the object

code

 var data = [{BuildingID: "5", FloorId: "65", one: 12, two: 15,three: 12},
            {BuildingID: "5", FloorId: "65", one: 12, two: 15,three: 12},
            {BuildingID: "6", FloorId: "65", one: 12, two: 15,three: 12},
            {BuildingID: "6", FloorId: "65", one: 12, two: 15,three: 12}]

i am trying to do group by the BuildingID add one,two,three
NOTE:one two three is not static

Excepted Output

  var data = [{BuildingID: "5", FloorId: "65", one: 24, two: 30,three: 24},
              {BuildingID: "6", FloorId: "65", one: 24, two: 30,three: 24} ]

Body:
here is a snippet code that work for me,

it assums you know the key attribute of the object

var arr = [ { id: 1, name: 'bob' }, { id: 1, name: 'bill' }, { id: 1, name: 'bill' } ]

var noDuplicate = [];
var unique = {};

$.each(arr, function(key, item) {

    if (! unique[item.id + "-" + item.name]) {
        noDuplicate.push(item);
        unique[item.id + "-" + item.name] = true;
    }
});

console.log(noDuplicate);

hope it helps ;)

regards.


问:
How to use angular2-data-table
Can't find any tutorial of how to use angular2-data-table library is here: https://github.com/swimlane/angular2-data-table

The documentation seems to be lacking simple examples.

Can any one give me a simple example of using datatable in angular2

答:
On this page with demos http://swimlane.github.io/ngx-datatable/ there is link to source link on top of every demo page. That helped me to understand the library a bit.

It seems authors made it almost impossible to spot that source link.

Title: How to use angular2-data-table


问:
wrap s-expression in slime (emacs)
Is there a short way to wrap an s-expression using slime?

Suppose i have finished some piece of code and I realize I need a variable (e.g. for efficiency reasons) and therefore want to wrap it with let or want to make it tail recursive and need to wrap it with labels, what is the fastest way to do this? Is there a shortcut?

IntelliJ (a Java IDE) allows things like:

x > 3.if + TAB

yielding

```<code>if (x > 3) {

    }
</code>```

So are there any "sexp-wrapping" shortcuts (postfix or prefix) in slime/emacs?

答:
The bar represents the cursor.

With paredit

There is a wrap-round command, bound to M-(. But when adding context to an expression, I generally do as follows:

```<code>|code
</code>```

Open the parenthesis (the closing one is added automatically):

```<code>(|)code
</code>```

... type ...

```<code>(let |)code
</code>```

Call paredit-forward-slurp-sexp (C-right)

```<code>(let | code)
</code>```

See also the The Animated Guide to Paredit.

Without paredit

```<code>|code
</code>```

Call mark-sexp (C-M-Space), then kill the region; type and yank (paste) the text where you need it.

See also Expressions with Balanced Parentheses (e.g. forward-sexp), available in Emacs.

Title: wrap s-expression in slime (emacs)

Body:
Is there a short way to wrap an s-expression using slime?

Suppose i have finished some piece of code and I realize I need a variable (e.g. for efficiency reasons) and therefore want to wrap it with let or want to make it tail recursive and need to wrap it with labels, what is the fastest way to do this? Is there a shortcut?

IntelliJ (a Java IDE) allows things like:

x > 3.if + TAB

yielding

if (x > 3) {

    }

So are there any "sexp-wrapping" shortcuts (postfix or prefix) in slime/emacs?

Body:
The bar represents the cursor.

With paredit

There is a wrap-round command, bound to M-(. But when adding context to an expression, I generally do as follows:

|code

Open the parenthesis (the closing one is added automatically):

(|)code

... type ...

(let |)code

Call paredit-forward-slurp-sexp (C-right)

(let | code)

See also the The Animated Guide to Paredit.

Without paredit

|code

Call mark-sexp (C-M-Space), then kill the region; type and yank (paste) the text where you need it.

See also Expressions with Balanced Parentheses (e.g. forward-sexp), available in Emacs.


问:
How to manage shared_ptr that points to internal data of already referenced object?
Suppose I have these classes:

```<code>struct Engine {
  int engine_data;
};

struct Car {
  shared_ptr<Engine> engine;
  int car_data;
};
</code>```

For performance reasons, I want to make them tightly packed in memory (but I don't want to lose the flexibility of the design). So, I can create a "packed" structure, and a factory that will transparently return a new B instance:

```<code>struct PackedCarAndEngine {
    Engine engine;
    Car car;
};

shared_ptr<Car> new_Car() {
    shared_ptr<PackedCarAndEngine> packed = make_shared<PackedCarAndEngine>();

    // uses aliasing shared_ptr constructor
    packed->car.engine = shared_ptr<Engine>(packed, &packed->engine);

    // again
    shared_ptr<Car> car = shared_ptr<Car>(packed, &packed->car);

    return car;
}
</code>```

The problem is that this "car" instance will never be destroyed, because it have a reference count of two. When it dies, it will have a reference count of one, forever. Do you know a better way to keep using the internal shared_ptr's (so that I can attribute an "unpacked" reference if I want), and still make this packed structure?

UPDATE

I could use a no-op deleter, but then it would be very dangerous if I decide to keep the engine but not the car:

```<code>    // ...
    packed->car.engine = shared_ptr<Engine>(&packed->engine, do_nothing_deleter);
    // ...

shared_ptr<Car> my_car = new_Car();
shared_ptr<Engine> my_engine = my_car->engine;
my_car.reset(); // Danger: engine was destroyed here!!!
cout << my_engine->engine_data; // Crash!
</code>```

答: Consider using weak_ptr instead of shared_ptr inside struct Car, it does not contribute to reference count, but can be converted to a shared_ptr when needed.

ContentLicense: CC BY-SA 2.5

Body:
Suppose I have these classes:

struct Engine {
  int engine_data;
};

struct Car {
  shared_ptr<Engine> engine;
  int car_data;
};

For performance reasons, I want to make them tightly packed in memory (but I don't want to lose the flexibility of the design). So, I can create a "packed" structure, and a factory that will transparently return a new B instance:

struct PackedCarAndEngine {
    Engine engine;
    Car car;
};

shared_ptr<Car> new_Car() {
    shared_ptr<PackedCarAndEngine> packed = make_shared<PackedCarAndEngine>();

    // uses aliasing shared_ptr constructor
    packed->car.engine = shared_ptr<Engine>(packed, &packed->engine);

    // again
    shared_ptr<Car> car = shared_ptr<Car>(packed, &packed->car);

    return car;
}

The problem is that this "car" instance will never be destroyed, because it have a reference count of two. When it dies, it will have a reference count of one, forever. Do you know a better way to keep using the internal shared_ptr's (so that I can attribute an "unpacked" reference if I want), and still make this packed structure?

UPDATE

I could use a no-op deleter, but then it would be very dangerous if I decide to keep the engine but not the car:

    // ...
    packed->car.engine = shared_ptr<Engine>(&packed->engine, do_nothing_deleter);
    // ...

shared_ptr<Car> my_car = new_Car();
shared_ptr<Engine> my_engine = my_car->engine;
my_car.reset(); // Danger: engine was destroyed here!!!
cout << my_engine->engine_data; // Crash!


问:
ExtJS 4: add success/failure callbacks to form.dom.submit() action
I have a button which creates a hidden form and calls form.dom.submit() on click. I need to add a success and failure callbacks to submit action.
Here's the code:

```<code>Ext.define("DownloadButton", {
  extend: 'Ext.button.Button',
  download: function (me, event) {
    this.form.dom.submit();
  },
  initComponent: function () {
    this.handler = Ext.Function.bind(this.download, this.scope || this);
    this.callParent(arguments);
  },
  afterRender: function () {
    this.callParent(arguments);
    this.form = this.getEl().createChild({
        tag: 'form',
        cls: 'x-hidden',
        method: 'POST',
        action: this.fileUrl,
        target: this.getId() + '-form-iframe'
    });
    this.getEl().appendChild(this.form);
  }
});
</code>```

Have tried to add params to submit

```<code>this.form.dom.submit({
  success: function(response) {
    console.log('success');
  },
  failure: function(response) {
    console.log('failure');
  }
});
</code>```

But this didn't help.

答:
You are creating a form DOM element, instead of ExtJS form.

When you create an ExtJS form, you can call the submit method with its options, including success and failure. When you set the standardSubmit option to true, you can then set the target option.

Something like this should work:

```<code>// Form creation
this.form = Ext.create('Ext.form.Panel', {
    hidden: true,
    method: 'POST',
    url: this.fileUrl,
    standardSubmit: true,
});

// Form submit
var target = this.getId() + '-form-iframe';
this.form.submit({
    target: target,
    success: function(response) {
        console.log('success');
    },
    failure: function(response) {
        console.log('failure');
    }
});
</code>```

However, I don't see any reason to use a hidden form, when you can use a simple AJAX request:

```<code>Ext.Ajax.request({
    url: this.fileUrl,
    success: function(response) {
        console.log('success');
    },
    failure: function(response) {
        console.log('failure');
    }
});
</code>```

Body:
I have a button which creates a hidden form and calls form.dom.submit() on click. I need to add a success and failure callbacks to submit action.
Here's the code:

Ext.define("DownloadButton", {
  extend: 'Ext.button.Button',
  download: function (me, event) {
    this.form.dom.submit();
  },
  initComponent: function () {
    this.handler = Ext.Function.bind(this.download, this.scope || this);
    this.callParent(arguments);
  },
  afterRender: function () {
    this.callParent(arguments);
    this.form = this.getEl().createChild({
        tag: 'form',
        cls: 'x-hidden',
        method: 'POST',
        action: this.fileUrl,
        target: this.getId() + '-form-iframe'
    });
    this.getEl().appendChild(this.form);
  }
});

Have tried to add params to submit

this.form.dom.submit({
  success: function(response) {
    console.log('success');
  },
  failure: function(response) {
    console.log('failure');
  }
});

But this didn't help.

Body:
You are creating a form DOM element, instead of ExtJS form.

When you create an ExtJS form, you can call the submit method with its options, including success and failure. When you set the standardSubmit option to true, you can then set the target option.

Something like this should work:

// Form creation
this.form = Ext.create('Ext.form.Panel', {
    hidden: true,
    method: 'POST',
    url: this.fileUrl,
    standardSubmit: true,
});

// Form submit
var target = this.getId() + '-form-iframe';
this.form.submit({
    target: target,
    success: function(response) {
        console.log('success');
    },
    failure: function(response) {
        console.log('failure');
    }
});

However, I don't see any reason to use a hidden form, when you can use a simple AJAX request:

Ext.Ajax.request({
    url: this.fileUrl,
    success: function(response) {
        console.log('success');
    },
    failure: function(response) {
        console.log('failure');
    }
});


问:
Stripe testing in LIVE mode
We would like to know how we can test stripe in LIVE for an e-commerce website? The site basically is an e-commerce website and courses are purchased online, how do we test LIVE transactions without using real-time credit cards in stripe?</p>

答:
The purpose of Stripe test mode is to ensure that you get your code into a perfectly working state, and that each type of transaction you are dealing with is fully covered. You can even validate that WebHooks are working by pointing them at your application's test API endpoints.

There's not really a way of 'testing' inside of the live environment as such - typical practice would be to make a real transaction using a company credit card, or one that you are in control of. You can then logon to Stripe Admin and refund the payment once it succeeds.

This is the same with most payment gateways, although there are some that have test mode built into the live API, and used via a specific header, parameter or tracking identifier. Although, this is really just the same end result - you are still testing in test mode.

Title: Stripe testing in LIVE mode


问:
QFileSystemWatcher unresolved external
I'm fiddling around with the QFileSystemWatcher, following this example. But when compiling I'm getting an unresolved external symbol error.
Here is my code:

```<code>#include <QCoreApplication>
#include <QFileSystemWatcher>
#include <QObject>

#include <iostream>

class MyClass : public QObject
{
    Q_OBJECT

public:
    MyClass(QObject* parent = nullptr) : QObject(parent){}

public slots:
    void on_dir_change(const QString& path)
    {
        std::cout << "folder modified: (" << path.toStdString() << ")" <<
std::endl;
    }
};

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

    QFileSystemWatcher watcher;
    watcher.addPath("C:/test");

    MyClass* mc = new MyClass();

    QObject::connect(&watcher, SIGNAL(directoryChanged(QString)), mc,
SLOT(on_dir_change(QString)));

    return a.exec();
}
</code>```

Which on compiling yields the following error messages:

main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl MyClass::metaObject(void)const " (?metaObject@MyClass@@UEBAPEBUQMetaObject@@XZ)

main.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl MyClass::qt_metacast(char const *)" (?qt_metacast@MyClass@@UEAAPEAXPEBD@Z)

main.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl MyClass::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MyClass@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)

debug\FileSystemWatcherTest.exe : fatal error LNK1120: 3 unresolved externals

What am I doing wrong?

答: Try to place MyClass definition in a separate .h file

Title: QFileSystemWatcher unresolved external

Body:
I'm fiddling around with the QFileSystemWatcher, following this example. But when compiling I'm getting an unresolved external symbol error.
Here is my code:

#include <QCoreApplication>
#include <QFileSystemWatcher>
#include <QObject>

#include <iostream>

class MyClass : public QObject
{
    Q_OBJECT

public:
    MyClass(QObject* parent = nullptr) : QObject(parent){}

public slots:
    void on_dir_change(const QString& path)
    {
        std::cout << "folder modified: (" << path.toStdString() << ")" <<
std::endl;
    }
};

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

    QFileSystemWatcher watcher;
    watcher.addPath("C:/test");

    MyClass* mc = new MyClass();

    QObject::connect(&watcher, SIGNAL(directoryChanged(QString)), mc,
SLOT(on_dir_change(QString)));

    return a.exec();
}

Which on compiling yields the following error messages:

main.obj : error LNK2001: unresolved external symbol "public: virtual struct QMetaObject const * __cdecl MyClass::metaObject(void)const " (?metaObject@MyClass@@UEBAPEBUQMetaObject@@XZ)

main.obj : error LNK2001: unresolved external symbol "public: virtual void * __cdecl MyClass::qt_metacast(char const *)" (?qt_metacast@MyClass@@UEAAPEAXPEBD@Z)

main.obj : error LNK2001: unresolved external symbol "public: virtual int __cdecl MyClass::qt_metacall(enum QMetaObject::Call,int,void * *)" (?qt_metacall@MyClass@@UEAAHW4Call@QMetaObject@@HPEAPEAX@Z)

debug\FileSystemWatcherTest.exe : fatal error LNK1120: 3 unresolved externals

What am I doing wrong?


问:
Dynamiclly append different class with increment numereic value by click event
I have a span tag and a button tag

```<code><span class="myspan">1</span>
<button id="add">Add +1</button>
var arr=["myspan1","myspan2","myspan3","myspan4"}
</code>```

I want to append more span tag with new class from  this array with increment value by clicking button.
Like this output:

```<code><span class="myspan1">1</span>
<span class="myspan2">2</span>
<span class="myspan3">3</span>
<span class="myspan4">4</span>
</code>```

i  try `
this JsFiddle

But i can not add class name to new append tag from array.

Another useful link for appending tag with new class from array
http://jsbin.com/nojipowo/2/edit?html,css,js,output
...
But i can not bring my desire output at any case...enter code here

value increaseesenter code here this snippet

    <button onclick="buttonClick();">Click Me</button>    <input type="text" id="inc" value="0"></input>```
</div>
</div>
</p>

<p>another attempt...anyone can help.. to get desire output</p>

<p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
<div class="snippet-code">
<pre class="snippet-code-js lang-js prettyprint-override"><code>var i=6;
var backgrounds = ["myspan1", "myspan2", "myspan4"];
var elements = document.getElementsByClassName("myspan");var len = backgrounds.length;

$("#add").click( function() {
(i < elements.length){

  $(".new-field").append('<span class="myspan">1</span><script');
    var value = parseInt($(".myspan").text(), 10) + 1;
    elements[i].className += ' ' + backgrounds[i%len];
    i++;
    $(".background").text(i);
    }
});</code>```

*/```
<pre class="snippet-code-html lang-html prettyprint-override"><code><span class="myspan">1</span>

<button id="add">Add +1</button>
<div class="new-field">

</div></code>```

答:
Check the fiddle. Hope this helps!

HTML :

```<code><div id="mainContainer">
<span class="myspan">1</span>
</div>
<button id="add">Add +1</button>
</code>```

JS :

```<code>var arr = ["myspan1", "myspan2", "myspan3", "myspan4"];

$("#add").on("click", function() {
var spans = $("span");
var classList = [];
$.each(spans, function() {
    var elemCls = $(this).attr('class').length > 1 ? $(this).attr('class').split(' ') : $(this).attr('class');
    if (elemCls) {

        $.each(elemCls, function() {

            classList.push(this.toString());
        });
    }
});
$.each(arr, function(i, e) {

    if ($.inArray(e, classList) == -1) {

        $("#mainContainer").append("<span class='" + e + "'>" + parseInt(spans.length + 1) + "</span>");
        return false;
    }
});
});
</code>```

Body:
I have a span tag and a button tag

1
<button id="add">Add +1</button>
var arr=["myspan1","myspan2","myspan3","myspan4"}

I want to append more span tag with new class from  this array with increment value by clicking button.
Like this output:

1
2
3
4

i  try `
this JsFiddle

But i can not add class name to new append tag from array.

Another useful link for appending tag with new class from array
http://jsbin.com/nojipowo/2/edit?html,css,js,output
...
But i can not bring my desire output at any case...enter code here

value increaseesenter code here this snippet

    <button onclick="buttonClick();">Click Me</button>    <input type="text" id="inc" value="0"></input>

another attempt...anyone can help.. to get desire output

var i=6;
var backgrounds = ["myspan1", "myspan2", "myspan4"];
var elements = document.getElementsByClassName("myspan");var len = backgrounds.length;

$("#add").click( function() {
(i < elements.length){

  $(".new-field").append('1

Body:
Check the fiddle. Hope this helps!

HTML :

<div id="mainContainer">
<span class="myspan">1</span>
</div>
<button id="add">Add +1</button>

JS :

var arr = ["myspan1", "myspan2", "myspan3", "myspan4"];

$("#add").on("click", function() {
var spans = $("span");
var classList = [];
$.each(spans, function() {
    var elemCls = $(this).attr('class').length > 1 ? $(this).attr('class').split(' ') : $(this).attr('class');
    if (elemCls) {

        $.each(elemCls, function() {

            classList.push(this.toString());
        });
    }
});
$.each(arr, function(i, e) {

    if ($.inArray(e, classList) == -1) {

        $("#mainContainer").append("<span class='" + e + "'>" + parseInt(spans.length + 1) + "</span>");
        return false;
    }
});
});


问:
Applying Solver to multiple
I'm new to VBA, trying to apply Solver to multiple cells.
But I get an error: Sub or Function not defined.

Here is the code:

```<code>  Sub SolverRepeat()
Dim i As Integer
For i = 4 To 8763
    SolverReset
        SolverOk SetCell:="$BQ$" & i, MaxMinVal:=2, ValueOf:="0", ByChange:="$BI$" & i, Engine:=1, EngineDesc:="GRG Nonlinear"
    SolverSolve True
    Next i
End Sub
</code>```

答:
Most likely you have not added the reference to your VBA project.

To do this:
In the Visual Basic Editor, with a module active, click References on the Tools menu, and then select Solver under Available References. If Solver does not appear under Available References, click Browse, and then open Solver.xlam in the \Program Files\Microsoft Office\Office14\Library\SOLVER subfolder.

Source: Using the Solver VBA Functions

Title: Applying Solver to multiple

Body:
I'm new to VBA, trying to apply Solver to multiple cells.
But I get an error: Sub or Function not defined.

Here is the code:

  Sub SolverRepeat()
Dim i As Integer
For i = 4 To 8763
    SolverReset
        SolverOk SetCell:="$BQ$" & i, MaxMinVal:=2, ValueOf:="0", ByChange:="$BI$" & i, Engine:=1, EngineDesc:="GRG Nonlinear"
    SolverSolve True
    Next i
End Sub


问:
How do you set only certain bits of a byte in C without affecting the rest?
Say I have a byte like this 1010XXXX where the X values could be anything. I want to set the lower four bits to a specific pattern, say 1100, while leaving the upper four bits unaffected. How would I do this the fastest in C?</p>

答:
You can set all those bits to 0 by bitwise-anding with the 4 bits set to 0 and all other set to 1 (This is the complement of the 4 bits set to 1).  You can then bitwise-or in the bits as you would normally.

ie

```<code> val &= ~0xf; // Clear lower 4 bits. Note: ~0xf == 0xfffffff0
 val |= lower4Bits & 0xf; // Worth anding with the 4 bits set to 1 to make sure no
                          // other bits are set.
</code>```

Body:
You can set all those bits to 0 by bitwise-anding with the 4 bits set to 0 and all other set to 1 (This is the complement of the 4 bits set to 1).  You can then bitwise-or in the bits as you would normally.

ie

 val &= ~0xf; // Clear lower 4 bits. Note: ~0xf == 0xfffffff0
 val |= lower4Bits & 0xf; // Worth anding with the 4 bits set to 1 to make sure no
                          // other bits are set.


问:
Dynamic Class creation and access class properties c#
I want to create a class dynamically and add properties to that class dynamically
and after that I want to create a object of that class and Generic list of that class and access it something like this :

答:
You can create a List of your class with:

```<code>List<ClassA> list = new List<ClassA>();
</code>```

And add your created object of that class to The List with:

```<code>list.Add(dynamic);
</code>```

Body:
You can create a List of your class with:

List<ClassA> list = new List<ClassA>();

And add your created object of that class to The List with:

list.Add(dynamic);