Non-trivial selectManyCheckbox example

Hi
Does anyone know of a good tutorial or complete working example of how to use h:selectManyCheckbox ? All the examples I can find on the web are quite basic - either just JSF fragments, or using simple hard-coded individual f:selectItem tags.
I would love to see a fully working example using a list or array of values from a backing bean, a setter for the user's checked checkboxes, maybe a converter for the values, and all the Java code of the backing bean.
If you have a non-trivial working selectManyCheckbox (either Sun "h" or MyFaces Tomahawk "t" will do) please please post here.
Thanks very much
Matt West.

It's fairly straightforward:<h:selectManyCheckbox value="#{myBean.selectedItems}">
    <f:selectItems value="#{myBean.selectItems}" />
</h:selectManyCheckbox>MyBeanprivate List < T > selectedItems;
private List < SelectItem < T, String > > selectItems;
// with default getters and settersWhere T represents the object type to be selected and String should represent the label of the checkbox.
Note: remove spaces around the < and the >, because the parser of this forum doesn't correctly parse nested parameter types.

Similar Messages

  • How to connect one SAP system to Non-SAP system(Example:Window's7)?

    Hi Experts,
        In general, One SAP system can connect another SAP system through RFC.How to  connect One SAP system  to Non-SAP system(example:window's 7) and is it possible through RFC?
    Thanks and Regards,
    Nageswar

    Hello  Wolfgang Schaper,
    Thank you so much for quick response.
    As you told I am trying to work with BRFplus/DSM to call decision services from nonABAP systems,so I tried with RFC.But it is not possible as you told.
    Please give any solution Without using Web Services, is there any ways to connect from SAP system  with the Non-SAP Systems.

  • Glazedlists - can't make filter work in non-trivial app

    Hey, has anyone here used glazedlists in a non-trivial application?
    https://glazedlists.dev.java.net/
    They're really nifty - or would be, if I could get them to work in my own appliction. (In a nutshell, it's a table that is smart, and can do on-the-fly filtering and sorting without you having to code it. Way cool).
    The demo works for me, from the jar as well as when I build it from source. I take the demo code and paste it (with trivial modifications to make it fit) into my application, and now the filtering doesn't do anything - and staring at the code, I havn't been able to spot any significant differences between my code and the demo (other than those required to make it fit in - package names and such). I suspect there's a threading or interface issue, where my code is listening for something and not passing it along (or something like that), but I don't have the experience to say for sure. I'm not posting code here because it's big, and mostly non-related to the problem at hand I suspect. ( I think it's something subtle, and not my cut&paste, because the demo code is small - a few screens for the whole app)
    Any swing gurus have any pearls of troubleshooting wisdom? I'm gonna keep beating on it, but thought I'd see if anyone had some insight on this...
    -- Tom Bortels

    guernseybozrah wrote:
    is there anyone out there that can throw light on my mac book pro eurosport player which works great on my ipad but havent got a clue how to get it to work in the mac boo pro. its sat in itunes and when clicked on nothing happens.
    You can't use an iPad app on your Mac. The operating systems on your MacBook and your iPad are completely different, so apps designed for one will not work on the other. You'll need to see if the developer of the app offers a version for Mac OS X as well, in which case you'll probably have to purchase it separately.
    Regards.

  • Non-trivial Database editing examples

    Hi everyone,
    I'm searching for examples of database editing and setting properties that are more complex than the ones that ship with LabWindows/CVI.  As far as I can tell, these don't even edit the database, they just manipulate aliases and parse through the different clusters/frames/signals, despite being titled "Managing Databases".  Anyone out there know where I can find this kind of info?  Thanks!
    - Brandon
    EDIT: I'm using the XNET API

    Those examples do edit a database, the database just happens to be in memory instead of on disk.  To be honest whenever I need to actually edit a DBC file I usually resort to Vectors database editing software which runs without needing any particular hardware or software license.
    But if you are strickly in the XNET world, import the DBC, then use the "Database Editor" to edit the XNET database.  This is saved as an XML but contains much of the same information as DBC.  You can also programatically import a DBC to use in XNET if you periodically get updates.
    My conversion library does this in the examples.
    https://decibel.ni.com/content/docs/DOC-39793
    Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
    If 10 out of 10 experts in any field say something is bad, you should probably take their opinion seriously.

  • How can I solve a system of linear equations for the non trivial solution?

    I want to solve the equation A Q =0 where A is a 1xn matrix and Q is an nxn matrix for A. I tried using the Solve Linear Equations sub.vi but it just gave me the trivial solution. What can I do to solve this?

    Larry of KochLab,
    Have you looked at the MathScript Node? Would it be possible to post a simple example of what you are trying to do?
    Ben Sisney
    FlexRIO V&V Engineer
    National Instruments

  • Non-blocking SSLEngine example

    Since the example of using SSLEngine with non-blocking IO that comes with Java is quite limited, I have decided to release my own for anyone who wants to see how I solved the various problems that you must face. The example is designed to be a generic non-blocking server that supports SSL.
    This is only meant to be an example, as I wrote this mostly in order to learn how to use the SSLEngine, and therefore has certain limitations, and is not thouroughly tested.
    You can download the file at: http://members.aol.com/ben77/nio_server2.tar.gz
    Here is also the code for SecureIO, which is roughly analagous to the Java example's ChannelIOSecure:
    package nio_server2.internalio;
    import java.io.IOException;
    import java.nio.ByteBuffer;
    import java.nio.channels.*;
    import java.util.concurrent.*;
    import javax.net.ssl.*;
    import static javax.net.ssl.SSLEngineResult.HandshakeStatus.*;
    * Does IO based on a <code>SocketChannel</code> with all data encrypted using
    * SSL.
    * @author ben
    public class SecureIO extends InsecureIO {
          * SSLTasker is responsible for dealing with all long running tasks required
          * by the SSLEngine
          * @author ben
         private class SSLTasker implements Runnable {
               * @inheritDoc
              public void run() {
                   Runnable r;
                   while ((r = engine.getDelegatedTask()) != null) {
                        r.run();
                   if (inNet.position() > 0) {
                        regnow(); // we may already have read what is needed
                   try {
                        System.out.println(":" + engine.getHandshakeStatus());
                        switch (engine.getHandshakeStatus()) {
                             case NOT_HANDSHAKING:
                                  break;
                             case FINISHED:
                                  System.err.println("Detected FINISHED in tasker");
                                  Thread.dumpStack();
                                  break;
                             case NEED_TASK:
                                  System.err.println("Detected NEED_TASK in tasker");
                                  assert false;
                                  break;
                             case NEED_WRAP:
                                  rereg(SelectionKey.OP_WRITE);
                                  break;
                             case NEED_UNWRAP:
                                  rereg(SelectionKey.OP_READ);
                                  break;
                   } catch (IOException e) {
                        e.printStackTrace();
                        try {
                             shutdown();
                        } catch (IOException ex) {
                             ex.printStackTrace();
                   hsStatus = engine.getHandshakeStatus();
                   isTasking = false;
         private SSLEngine engine;
         private ByteBuffer inNet; // always cleared btwn calls
         private ByteBuffer outNet; // when hasRemaining, has data to write.
         private static final ByteBuffer BLANK = ByteBuffer.allocate(0);
         private boolean initialHandshakeDone = false;
         private volatile boolean isTasking = false;
         private boolean handshaking = true;
         private SSLEngineResult.HandshakeStatus hsStatus = NEED_UNWRAP;
         private boolean shutdownStarted;
         private static Executor executor = getDefaultExecutor();
         private SSLTasker tasker = new SSLTasker();
         private ByteBuffer temp;
          * @return the default <code>Executor</code>
         public static Executor getDefaultExecutor() {
              return new ThreadPoolExecutor(3, Integer.MAX_VALUE, 60L,
                        TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
                        new DaemonThreadFactory());
         private static class DaemonThreadFactory implements ThreadFactory {
              private static ThreadFactory defaultFactory = Executors
                        .defaultThreadFactory();
               * Creates a thread using the default factory, but sets it to be daemon
               * before returning it
               * @param r
               *            the runnable to run
               * @return the new thread
              public Thread newThread(Runnable r) {
                   Thread t = defaultFactory.newThread(r);
                   t.setDaemon(true);
                   return t;
          * @return the executor currently being used for all long-running tasks
         public static Executor getExecutor() {
              return executor;
          * Changes the executor being used for all long-running tasks. Currently
          * running tasks will still use the old executor
          * @param executor
          *            the new Executor to use
         public static void setExecutor(Executor executor) {
              SecureIO.executor = executor;
          * Creates a new <code>SecureIO</code>
          * @param channel
          *            the channel to do IO on.
          * @param sslCtx
          *            the <code>SSLContext</code> to use
         public SecureIO(SocketChannel channel, SSLContext sslCtx) {
              super(channel);
              engine = sslCtx.createSSLEngine();
              engine.setUseClientMode(false);
              int size = engine.getSession().getPacketBufferSize();
              inNet = ByteBuffer.allocate(size);
              outNet = ByteBuffer.allocate(size);
              outNet.limit(0);
              temp = ByteBuffer.allocate(engine.getSession()
                        .getApplicationBufferSize());
         private void doTasks() throws IOException {
              rereg(0); // don't do anything until the task is done.
              isTasking = true;
              SecureIO.executor.execute(tasker);
          * Does all handshaking required by SSL.
          * @param dst
          *            the destination from an application data read
          * @return true if all needed SSL handshaking is currently complete.
          * @throws IOException
          *             if there are errors in handshaking.
         @Override
         public boolean doHandshake(ByteBuffer dst) throws IOException {
              if (!handshaking) {
                   return true;
              if (dst.remaining() < minBufferSize()) {
                   throw new IllegalArgumentException("Buffer has only "
                             + dst.remaining() + " left + minBufferSize is "
                             + minBufferSize());
              if (outNet.hasRemaining()) {
                   if (!flush()) {
                        return false;
                   switch (hsStatus) {
                        case FINISHED:
                             handshaking = false;
                             initialHandshakeDone = true;
                             rereg(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
                             return true;
                        case NEED_UNWRAP:
                             rereg(SelectionKey.OP_READ);
                             break;
                        case NEED_TASK:
                             doTasks();
                             return false;
                        case NOT_HANDSHAKING:
                             throw new RuntimeException(
                                       "NOT_HANDSHAKING encountered when handshaking");
              SSLEngineResult res;
              System.out.println(hsStatus + "1" + handshaking);
              switch (hsStatus) {
                   case NEED_UNWRAP:
                        int i;
                        do {
                             rereg(SelectionKey.OP_READ);
                             i = super.read(inNet);
                             if (i < 0) {
                                  engine.closeInbound();
                                  handshaking = false;
                                  shutdown();
                                  return true;
                             if (i == 0 && inNet.position() == 0) {
                                  return false;
                             inloop: do {
                                  inNet.flip();
                                  temp.clear();
                                  res = engine.unwrap(inNet, temp);
                                  inNet.compact();
                                  temp.flip();
                                  if (temp.hasRemaining()) {
                                       dst.put(temp);
                                  switch (res.getStatus()) {
                                       case OK:
                                            hsStatus = res.getHandshakeStatus();
                                            if (hsStatus == NEED_TASK) {
                                                 doTasks();
                                            // if (hsStatus == FINISHED) {
                                            // // if (!initialHandshakeDone) {
                                            // // throw new RuntimeException(hsStatus
                                            // // + " encountered when handshaking");
                                            // initialHandshakeDone = true;
                                            // handshaking=false;
                                            // key.interestOps(SelectionKey.OP_READ
                                            // | SelectionKey.OP_WRITE);
                                            // TODO check others?
                                            break;
                                       case BUFFER_UNDERFLOW:
                                            break inloop;
                                       case BUFFER_OVERFLOW:
                                       case CLOSED:
                                            throw new RuntimeException(res.getStatus()
                                                      + " encountered when handshaking");
                             } while (hsStatus == NEED_UNWRAP
                                       && dst.remaining() >= minBufferSize());
                        } while (hsStatus == NEED_UNWRAP
                                  && dst.remaining() >= minBufferSize());
                        if (inNet.position() > 0) {
                             System.err.println(inNet);
                        if (hsStatus != NEED_WRAP) {
                             break;
                        } // else fall through
                        rereg(SelectionKey.OP_WRITE);
                   case NEED_WRAP:
                        do {
                             outNet.clear();
                             res = engine.wrap(BLANK, outNet);
                             switch (res.getStatus()) {
                                  case OK:
                                       outNet.flip();
                                       hsStatus = res.getHandshakeStatus();
                                       if (hsStatus == NEED_TASK) {
                                            doTasks();
                                            return false;
                                       // TODO check others?
                                       break;
                                  case BUFFER_OVERFLOW:
                                       outNet.limit(0);
                                       int size = engine.getSession()
                                                 .getPacketBufferSize();
                                       if (outNet.capacity() < size) {
                                            outNet = ByteBuffer.allocate(size);
                                       } else { // shouldn't happen
                                            throw new RuntimeException(res.getStatus()
                                                      + " encountered when handshaking");
                                  case BUFFER_UNDERFLOW: // engine shouldn't care
                                  case CLOSED:
                                       throw new RuntimeException(res.getStatus()
                                                 + " encountered when handshaking");
                        } while (flush() && hsStatus == NEED_WRAP);
                        break;
                   case NEED_TASK:
                        doTasks();
                        return false;
                   case FINISHED:
                        break; // checked below
                   case NOT_HANDSHAKING:
                        System.err.println(hsStatus + " encountered when handshaking");
                        handshaking = false;
                        initialHandshakeDone = true;
                        rereg(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
              if (hsStatus == FINISHED) {
                   // if (!initialHandshakeDone) {
                   // throw new RuntimeException(hsStatus
                   // + " encountered when handshaking");
                   initialHandshakeDone = true;
                   handshaking = false;
                   rereg(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
              System.out.println(hsStatus + "2" + handshaking);
              return !handshaking;
          * Attempts to flush all buffered data to the channel.
          * @return true if all buffered data has been written.
          * @throws IOException
          *             if there are errors writing the data
         @Override
         public boolean flush() throws IOException {
              if (!outNet.hasRemaining()) {
                   return true;
              super.write(outNet);
              return !outNet.hasRemaining();
          * @return the largest amount of application data that could be read from
          *         the channel at once.
         @Override
         public int minBufferSize() {
              return engine.getSession().getApplicationBufferSize();
          * Begins or proceeds with sending an SSL shutdown message to the client.
          * @return true if all needed IO is complete
          * @throws IOException
          *             if there are errors sending the message.
         @Override
         public boolean shutdown() throws IOException {
              if (!shutdownStarted) {
                   shutdownStarted = true;
                   engine.closeOutbound();
              if (outNet.hasRemaining() && !flush()) {
                   return false;
              SSLEngineResult result;
              do {
                   outNet.clear();
                   result = engine.wrap(BLANK, outNet);
                   if (result.getStatus() != SSLEngineResult.Status.CLOSED) {
                        throw new IOException("Unexpected result in shutdown:"
                                  + result.getStatus());
                   outNet.flip();
                   if (outNet.hasRemaining() && !flush()) {
                        return false;
              } while (result.getHandshakeStatus() == NEED_WRAP);
              return !outNet.hasRemaining();
          * Reads all possible data into the <code>ByteBuffer</code>.
          * @param dst
          *            the buffer to read into.
          * @return the number of bytes read, or -1 if the channel or
          *         <code>SSLEngine</code> is closed
          * @throws IllegalStateException
          *             if the initial handshake isn't complete *
          * @throws IOException
          *             if there are errors.
          * @throws IllegalStateException
          *             if the initial handshake isn't complete
          * @throws IllegalArgumentException
          *             if the remaining space in dst is less than
          *             {@link SecureIO#minBufferSize()}
         @Override
         public int read(ByteBuffer dst) throws IOException {
              if (!initialHandshakeDone) {
                   throw new IllegalStateException("Initial handshake incomplete");
              if (dst.remaining() < minBufferSize()) {
                   throw new IllegalArgumentException("Buffer has only "
                             + dst.remaining() + " left + minBufferSize is "
                             + minBufferSize());
              int sPos = dst.position();
              int i;
              while ((i = super.read(inNet)) != 0
                        && dst.remaining() >= minBufferSize()) {
                   if (i < 0) {
                        engine.closeInbound();
                        shutdown();
                        return -1;
                   do {
                        inNet.flip();
                        temp.clear();
                        SSLEngineResult result = engine.unwrap(inNet, temp);
                        inNet.compact();
                        temp.flip();
                        if (temp.hasRemaining()) {
                             dst.put(temp);
                        switch (result.getStatus()) {
                             case BUFFER_UNDERFLOW:
                                  continue;
                             case BUFFER_OVERFLOW:
                                  throw new Error();
                             case CLOSED:
                                  return -1;
                             // throw new IOException("SSLEngine closed");
                             case OK:
                                  checkHandshake();
                                  break;
                   } while (inNet.position() > 0);
              return dst.position() - sPos;
          * Encrypts data and writes it to the channel.
          * @param src
          *            the data to write
          * @return the number of bytes written
          * @throws IOException
          *             if there are errors.
          * @throws IllegalStateException
          *             if the initial handshake isn't complete
         @Override
         public int write(ByteBuffer src) throws IOException {
              if (!initialHandshakeDone) {
                   throw new IllegalStateException("Initial handshake incomplete");
              if (!flush()) {
                   return 0;
              int written = 0;
              outer: while (src.hasRemaining()) {
                   outNet.clear(); // we flushed it
                   SSLEngineResult result = engine.wrap(src, outNet);
                   outNet.flip();
                   switch (result.getStatus()) {
                        case BUFFER_UNDERFLOW:
                             break outer; // not enough left to send (prob won't
                        // happen - padding)
                        case BUFFER_OVERFLOW:
                             if (!flush()) {
                                  break outer; // can't remake while still have
                                  // stuff to write
                             int size = engine.getSession().getPacketBufferSize();
                             if (outNet.capacity() < size) {
                                  outNet = ByteBuffer.allocate(size);
                             } else { // shouldn't happen
                                  throw new RuntimeException(hsStatus
                                            + " encountered when handshaking");
                             continue; // try again
                        case CLOSED:
                             throw new IOException("SSLEngine closed");
                        case OK:
                             checkHandshake();
                             break;
                   if (!flush()) {
                        break;
              return written;
         private boolean hasRemaining(ByteBuffer[] src) {
              for (ByteBuffer b : src) {
                   if (b.hasRemaining()) {
                        return true;
              return false;
          * Encrypts data and writes it to the channel.
          * @param src
          *            the data to write
          * @return the number of bytes written
          * @throws IOException
          *             if there are errors.
          * @throws IllegalStateException
          *             if the initial handshake isn't complete
         @Override
         public long write(ByteBuffer[] src) throws IOException {
              if (!initialHandshakeDone) {
                   throw new IllegalStateException("Initial handshake incomplete");
              if (!flush()) {
                   return 0;
              int written = 0;
              outer: while (hasRemaining(src)) {
                   outNet.clear(); // we flushed it
                   SSLEngineResult result = engine.wrap(src, outNet);
                   outNet.flip();
                   switch (result.getStatus()) {
                        case BUFFER_UNDERFLOW:
                             break outer; // not enough left to send (prob won't
                        // happen - padding)
                        case BUFFER_OVERFLOW:
                             if (!flush()) {
                                  break outer; // can't remake while still have
                                  // stuff to write
                             int size = engine.getSession().getPacketBufferSize();
                             if (outNet.capacity() < size) {
                                  outNet = ByteBuffer.allocate(size);
                             } else { // shouldn't happen
                                  throw new RuntimeException(hsStatus
                                            + " encountered when handshaking");
                             continue; // try again
                        case CLOSED:
                             throw new IOException("SSLEngine closed");
                        case OK:
                             checkHandshake();
                             break;
                   if (!flush()) {
                        break;
              return written;
         private void checkHandshake() throws IOException {
              // Thread.dumpStack();
              // System.out.println(engine.getHandshakeStatus());
              outer: while (true) {
                   switch (engine.getHandshakeStatus()) {
                        case NOT_HANDSHAKING:
                             initialHandshakeDone = true;
                             handshaking = false;
                             rereg(SelectionKey.OP_READ | SelectionKey.OP_WRITE);
                             return;
                        case FINISHED:
                             // this shouldn't happen, I don't think. If it does, say
                             // where.
                             System.err.println("Detected FINISHED in checkHandshake");
                             Thread.dumpStack();
                             break outer;
                        case NEED_TASK:
                             if (isTasking) {
                                  while (isTasking) { // TODO: deal with by reg?
                                       Thread.yield();
                                       try {
                                            Thread.sleep(1);
                                       } catch (InterruptedException ex) {
                                            // TODO Auto-generated catch block
                                            ex.printStackTrace();
                                  break;
                             doTasks();
                             break;
                        case NEED_WRAP:
                             rereg(SelectionKey.OP_WRITE);
                             break outer;
                        case NEED_UNWRAP:
                             rereg(SelectionKey.OP_READ);
                             break outer;
              handshaking = true;
              hsStatus = engine.getHandshakeStatus();
          * @return true if the channel is open and no shutdown message has been
          *         recieved.
         @Override
         public boolean isOpen() {
              return super.isOpen() && !engine.isInboundDone();
    }

    That's the reason for checkHandshake(), it is called on every read and write and detects a new handshake and configures the setup properly. As far as the server requesting a new handshake, I did not put that in. It would be simple enough though, you would just need to call SSLEngine.beginHandshake() + then call checkHandshake().
    Also, my echo server example had a bug, I forgot to call bu.flip() before queueWrite(), so I fixed that, as well as adding an onConnect method that is called when a connection has been established. The new version should be up at the origional address shortly.

  • Looking for an alternative to an enum (or any non trivial type)

    Hi. I am making a class to manage geometric points, as in [x, y, z]. some languages, such as scripting language 'adobe actionscript' support certain special values such as NaN (or 'not a number'), and I can do things such as
    var _some_var:Number = Number.NaN;
    the previous sentence is something like assigning null to a pointer. NaN is not a valid value, so I can not operate with a var that has nan as a value.
    I want to do something like that in my class, but I can not use a number value and then say, 'this value is never gonna happen by itself, so if the var has that value is because is in nan state. for any value that I choose, if is a valid value, will be enough
    to consider it as an invalid alternative. instead of that, the vars are handled in pairs, so for each numeric coordinate, such as x, there is also a bool that says if the numeric value is defined
    in each point, there are the x, y and z coordinates, plus defx, defy and defz.
    the constructor is something like
    point() {
    x= 0;
    y= 0;
    z= 0;
    defx = false;
    defy=false;
    defz=false
    and since all vars are private, I use accessors such as
    setX(double _x) {
    x = _x;
    defX = true;
    so how do I assign a NaN to a var that has already a value?, or, how do I set the var 'defX' to false again?
    since setX(_some_value) is the same as x = _some_value, the idea would be that I could write something like
    setX(NaN), and that would 'undefine' X.
    since I can overload functions, and create functions with different prototypes for different types of values, even though the functions are called the same way, that's what I am doing.
    I had two choices: the first one is (copy paste from my file)
    //#ifndef _nan
    //#define _nan
    //#define NaN "NaN"
    //#endif
    not the one I chose because it does not seem better than my second choice (that's why it appears as a comment), or does not solve the problem I have with the choices I have thought so far:
    (in file 'especiales.h')
    #ifndef _especiales
    #define _especiales
    enum EEspecial {NaN};
    #endif
    and in the file for the point definition (as inline functions)
    void setX(double _x) {
                    x = _x;
                    defX = true;
            void setX(EEspecial _e) {
                    if (_e == NaN)
                        defX = false;
                    else
                        throw coordIndefException();
            double getX();
            bool definidoX() {return defX;}
    it works, it does not throw an error or there are no syntax problems; but there is a problem in my head. In the previous sentences there are two functions, one that takes a numeric value and sets it in x, and sets x as defined. on that receives not a numeric
    value but a special value, that if it turn out to be nan, will unset the x var, and set it as undefined.I checked it with these simple lines:
        geometriaPunto _ensayo;
       try {
            _ensayo.setX(NaN);
            cout << _ensayo.getX() << "\n";
        } catch (exception _e) {
            cout << _e.what() << "\n";
    this works fine. if I place a 0 in setX, it will print 0. if I place a NaN in the parenthesis, it will write the exception name. This works fine. But as far as I know, all basic var types, and all enums, also have implicit conversions to numeric values.
    so even though it works here, as I understand, telling it setX(0) is the same as setX(NaN) (which would be the implicit conversion of NaN, since is the first value in the enum). none of those are double (because I did not wrote it as setX(0.0) ), so my guess
    is that even though it works here, it was just luck, and some other c compile may understand it different, since there is not much difference between function_name(int) or function_name(enum_type)
    what would be the best way, most clear way to overload 'setX()' so it does accept a type that can not be confused with a numeric value, yet it does not make my code way more obscure and does not create ambiguity?
    tnx

    this is the last post I will make on this thread, as I find your answers useless and I already have what I need, but concerning your answers:
    "You said it worked for you in your 'adobe actionscript' code - why wouldn't the same technique work in C++ code? Number.NaN is a Number value, and it doesn't prevent you from doing operations in a var that holds that value - but that didn't
    seem to concern you before."
    have you ever worked with actionscript or did you just post because you had to post anything. yes, I can assign NaN to a numeric var in actionscript, just like I can assign null to a pointer. null is a value (0), if I add something to a var that has null,
    it will not have null anymore, if the compiler or the executable don't verify this behavior that should throw an exception. In actionscript, if a var has nan and I add something to it, it will still have nan, because nan is not a value, is a state, and probably
    actionscriopt also handles numeric vars with some other types of vars, to make these kind of validations. If I add 1 to garbage, I will still have garbage, and if I choose a random value to be chosen as nan, I or anybody else can not assure this value will
    not be the result of a valid operation
    2. "Is your question about C#, and not C++? If it is, you are in the wrong forum."
    why do you ask, did you see the previous sentences written in c#, or do you still have to answer crap if you don't answer something related to the question. if somebody has been writing things in other languages (including java or the same actionscript,
    which support that kind of behavior for properties and accessors), seems logic that I want to maintain that programing style, which will help somebody who also has been writing in those languages and then tries to read this new source, written in c++

  • Non-Cumulative keyfigure example

    Hi all,
          To test for non-cumulative keyfigures I have modeled a keyfigure noofemployees and below is my model
    <b>Infocube has following characteristics, timecharacteristics and keyfigures</b>
    Charteristics: Companycode
    TimeChar: 0calmonth
    Keyfigures: salesrevenue and noofemployees
    <b>My infosource has following infoobjects</b>
    Companycode,0calday,salesrevenue,nofoemployees
    In update rules, I wrote a formulae(0calmonth2) to convert 0calday to 0calmonth.
    I want to generate a report to know for every company, its monthly sales and number of employees.
    I created numberofemployees as a cumulative keyfigure with exception aggregation as Maximum(to get the maximum number of employees in one month instead of aggregating the values).  I don't know if I am doing something wrong, but my keyfigure noofemployees is aggregated for each month. 
    Please let me know if I created the keyfigure noofemployees correctly.
    thanks,
    Sabrina.

    Hi Sabrina,
    A non-cumulative keyfigure can be modeled in BW either using
    -a cumulative keyfigure that stores the non-cumulative value changes of the non-cumulative keyfigure or
    -Two cumulative keyfigures which represent the inflow and outflow values of the non-cumulative keyfigure.
    The keyfigures used to define the non-cumulative keyfigure - keyfigure for non-cumulative value change or keyfigures for inflow and outflow - should themselves be cumulative keyfigures and have the following properties.
    •     Standard aggregation -> Summation
    •     Exception aggregation -> Summation
    So as per the definition you first create a cumulative Key figure to capture the non-cumulative value changes of the non-cumulative keyfigure.Say ZKF1 and assign following properties:
    Aggregation: Summation
    Exception Aggregation:Summation.
    Now create a Non-cummulative Key Figure say ZKF2 and assign following properties:
    Aggregation: Summation
    Exception Aggregation:Last Value
    Non Cummulative Value Change:ZKF1.
    This will give you non-cumulative keyfigures "number of employees" correctly.
    Hope this helps.Please grant points if it solves your purpose.
    Regards,
    Ashish

  • Convert tab separated text to non-trivial xml. (pwsafe -- KeePassx)

    I'd like to take the output of `pwsafe --exportdb > database.txt` and convert it to a KeePassX XML friendly format (feature request in pwsafe).
    I found flat file converter but the syntax is beyond me with this example.  Solutions are welcomed.
    More details
    Here is the pwsafe --> KeePassX XML translations.  The pwsafe export is simply a txt file with 6 fields (the first field can be ignored):
    uuid= doesn't translate
    group= group>title
    name= entry>title
    login= entry>username
    passwd= entry>password
    notes= entry>comment
    Example txt file for conversion (exported from pwsafe):
    # passwordsafe version 2.0 database"
    uuid group name login passwd notes
    "123d9-daf-df-3423423" "retail" "amazon" "myamazonuser" "sjfJ849" "superfluous comment"
    "4599d934-dsfs-324" "retail" "netflix" "netflixuser" "dj3W$#" ""
    "4kdfkd-434-jj" "email" "gmail" "mygmail" "dfkpass" ""
    Example xml in keepassx xml:
    <!DOCTYPE KEEPASSX_DATABASE>
    <database>
    <group>
    <title>Internet</title>
    <entry>
    <title>github</title>
    <username>githubusername</username>
    <password>githubpassword</password>
    <comment>optional comment</comment>
    </entry>
    </group>
    <group>
    <title>retail</title>
    <entry>
    <title>amazon</title>
    <username>username</username>
    <password>myamazonpw</password>
    </entry>
    </group>
    <group>
    <title>retail</title>
    <entry>
    <title>netflix</title>
    <username>username</username>
    <password>mynfxpw</password>
    </entry>
    </group>
    </database>
    Last edited by graysky (2015-06-14 18:27:17)

    It seems that ffe does not work quite well with tab/space separated list (at least I was not able to get it working). However you can use sed to replace tabs with commas:
    sed -e "s/\t/,/g" input.txt | ffe -c pwsafe.rc -s example.txt -l 2>/dev/null
    and this is pwsafe.rc
    structure pwsafe {
    type separated , *
    output group
    quoted
    header first
    record line {
    field uuid * * noprint
    field title
    field title * * entry
    field username * * entry
    field passwordd * * entry
    field comment * * entry
    output noprint {
    data ""
    no-data-print no
    output entry {
    data " <%n>%t</%n>\n"
    no-data-print no
    output group {
    file_header "<!DOCTYPE KEEPASSX_DATABASE>\n <database>\n"
    record_header " <group>\n"
    data " <%n>%t</%n>\n <entry>\n"
    record_trailer " <entry>\n </group>\n"
    file_trailer "</database>\n"
    no-data-print no
    If you are not bound to ffe, maybe it is easier to use a python script which is simpler to modify and it is more flexible. Something like the following should work:
    #!/usr/bin/python
    import sys
    from xml.dom import minidom
    class Converter(object):
    def __init__(self, filename):
    self.url = filename
    def convert(self):
    inp_f = open(self.url, 'r')
    data = inp_f.readlines()
    inp_f.close()
    # xml document model
    doc = minidom.Document()
    root = doc.createElement('database')
    doc.appendChild(root)
    for line in data:
    if '"' not in line:
    continue
    fields = line.split('\t')
    if len(fields) < 6:
    continue
    # uuid = fields[0].strip('"') # unused
    group = fields[1].strip('" ')
    name = fields[2].strip('" ')
    login = fields[3].strip('" ')
    passwd = fields[4].strip('" ')
    notes = fields[5].strip('" \n')
    group_node = doc.createElement('group')
    root.appendChild(group_node)
    # <group>
    group_title_node = doc.createElement('title')
    group_node.appendChild(group_title_node)
    group_title_node.appendChild(doc.createTextNode(group))
    # one <entry> per <group>
    entry_node = doc.createElement('entry')
    group_node.appendChild(entry_node)
    # <entry> -> <title>
    entry_title_node = doc.createElement('title')
    entry_title_node.appendChild(doc.createTextNode(name))
    entry_node.appendChild(entry_title_node)
    # <entry> -> <username>
    entry_uname_node = doc.createElement('username')
    entry_uname_node.appendChild(doc.createTextNode(login))
    entry_node.appendChild(entry_uname_node)
    # <entry> -> <password>
    entry_passwd_node = doc.createElement('password')
    entry_passwd_node.appendChild(doc.createTextNode(passwd))
    entry_node.appendChild(entry_passwd_node)
    # <entry> -> <comments>
    entry_comment_node = doc.createElement('comment')
    entry_comment_node.appendChild(doc.createTextNode(notes))
    entry_node.appendChild(entry_comment_node)
    print('<!DOCTYPE KEEPASSX_DATABASE>')
    print(root.toprettyxml(' ', '\n'))
    if __name__ == "__main__":
    try:
    ifname = sys.argv[1]
    except IndexError:
    print("Input file name required")
    sys.exit(1)
    cc = Converter(ifname)
    cc.convert()
    NOTE: I'm assuming from the example you posted that every <group> node contains only one <entry> child node.
    --edit[0]: corrected a typo in the python code (just realized that it is <comment> instead of <comments ) and made the parsing function more reliable
    Last edited by mauritiusdadd (2015-06-15 09:29:01)

  • Non-trivial problem with NoClassDefFoundError

    I want my Java 1.4.2. program to use the Apache Commons CLI library, version 1.2. Within Eclipse, I can get the program to use the org.apache.commons.cli 1.2 jar file (I just add the jar to the build path). However, if I export the program as a jar and run the jar under DOS or Unix, I get the NoClassDefFoundError. I tried to fix the command path, by creating a CLASSPATH environment variable. This didn't fix the problem. I tried to include the path using the -classpath option under the java command. This didn't fix the problem either.
    A while ago, I was able to use version 1.1 on a Java 1.5 program (under Mac OS X).
    So I am stumped. How should I proceed?
    Thank You.

    NoClassDefFoundError can mean several things but one of them is that a .class file was found in the correct place but it didn't contain the expected Java class. For example, it has been renamed, or the directory structure doesn't correspond to the package structure.

  • A non-trivial typo in the man page for pthread_cleanup_push()?

    On my Solaris 9 and 10 systems, the prototype of the pthread_cleanup_push() function is, according to the man page:
    void pthread_cleanup_push(void (*handler, void *), void *arg);
    Should it be
    void pthread_cleanup_push(void (*routine) (void *), void *arg); ?
    Alternatively, if both are correct, what are the differences between the two? I tried to use the first format to write some test code and got a bunch of syntax errors.

    Ditto for pthread_create():
    int pthread_create(pthread_t thread,  const  pthread_attr_t attr,
    void *(*start_routine, void*),void *arg);                                                                                                                                                                                                                                                                                       

  • J2EE Engine Web Administration: 404 on /admin/j_security_check

    Environment: sneak-preview from June (the latest version), running on a Linux machine.
    I'm trying to run the SAP J2EE Engine Web Administration application - i.e. http://b3.lab:50000/admin/LoginForm.jsp .
    If I use J2EE_ADMIN/ADMIN for the user/password, I get a 404 screen, for the URL http://b3.lab:50000/admin/j_security_check (The requested resource does not exist.
    Details:     
    Go to main page of this application!)
    Note that this is different from a wrong user or password - in this case I get a http://b3.lab:50000/admin/LoginError.html page with an "incorrect username or password" - which is the expected outcome.
    Any idea if the application is supposed to work?
    BTW - I'm getting quite a few exceptions on other apps as well. For example - the "PC-shop" -> browse -> printer -> click-any-printer gets the exception below:
    java.lang.NullPointerException
         at jsp_details1121113843848._jspService(jsp_details1121113843848.java:8)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:467)
         at com.sap.engine.services.servlets_jsp.server.servlet.JSPServlet.service(JSPServlet.java:181)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    TIA!
    Message was edited by: Efri Nattel-Shay
    I'm popping up this questions, and raise
    Is there any non-trivial J2EE example application that is deployed / can be "tutorially" deployed on the sneak preview Linux version? By non-trivial I mean that it has web, ejb and db portions? (which is pretty modest requirements, I think).
    Thank you,
    Efri Nattel-Shay

    Solution provided is here:
    http://wiki.sdn.sap.com/wiki/display/TechTSG/(JSTTSG)(Web)Problems-P148

  • Examples of bigger apps?

    hi, I'm having a frustrating time... can anybody help?
    I know VC++ fairly well in an amateurish way and I really don't understand how Java apps of any size work... do they use the application-document-view architecture which seems to underpin most VC++ projects? It is proving very difficult to find non-trivial Java apps unless they are way over my head... Where can I get hold of a basic Java application skeleton?
    Also, no books online or otherwise seem to explain how you go about splitting things up into discrete classes and yet letting them communicate adequately with one another... or what is the "ancestor" or indeed "parent" of a component... is it a JFrame?... where is all this documented? Where are examples of larger apps? Of the process by which they are developed?
    Also, because so much code is taken up with just getting on top of the GUI and the layout managers, programs of any significance seem to grow at a frightening rate meaning that you soon do in fact have to split things up...
    And then you find a passing comment in a doc saying "keep your GUI code separate from the business logic"... OK, care to spend a bit of time on that?
    Please somebody recommend an online resource...??
    Mike

    this is a crosspost of http://forum.java.sun.com/thread.jsp?forum=54&thread=157095

  • Purpose of Non Cumulative key figures

    Whatu2019s the purpose of Non Cumulative key figures?

    Hi....
    There is an explanation of advantages and disadvantages of using non-cumulative key figures in "How to handle inventory management scenarios in BW" white paper:
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/biw/how%20to%20handle%20inventory%20management%20scenarios.pdf
    Also Check..........
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/e0b8dfe6-fe1c-2a10-e8bd-c7acc921f366
    http://help.sap.com/saphelp_nw04/helpdata/en/80/1a62dee07211d2acb80000e829fbfe/frameset.htm
    http://help.sap.com/saphelp_nw04s/helpdata/en/80/1a6305e07211d2acb80000e829fbfe/frameset.htm
    Re: Non-Cumulative keyfigure example
    Hope this helps.....
    Regards,
    Debjani........
    Edited by: Debjani  Mukherjee on Oct 27, 2008 3:46 AM

  • External Tables & Non English Characters

    Hi
    I am new to external tables, i wanted to know what i need to do to upload the data which is of non-English characters,
    Example
    i need to upload the data where the single file will have data for more than one non-english characters.
    1. English
    2. Chinese
    3. Korean
    let me know if any other alternative exists for the same.
    Regards
    Yram

    Hi,
    a good reference for External Tables is the manual: http://download.oracle.com/docs/cd/B19306_01/server.102/b14215/part_et.htm
    If they are in one file, you can upload them all at once. Important will be how the data is stored in the file (UTF-8, UTF-16). This information you should set in the external table by using the CHARACTERSET clause, see the manual.
    Your database also needs to support these characters!
    Herald ten Dam
    htendam.wordpress.com

Maybe you are looking for