Problem in queue operation

hello friends,
in the vi below if I am putting more than one commands ie strings in command control all the commands start executing one by one and after all commands are finished again they start executing as they are in loop..
for example if in the command control :  S
                                                              Z
                                                              SI
these are the commands then the order of execution is like this S then Z then SI then again S then Z then SI again S....and so on till I stop the loop..
but what I want that it should work like S then Z then SI and SI(ie the last command) should continue execution till I stop the loop.. 
can anyone help me out as I got stuck with this problem..
thanx in advance
Solved!
Go to Solution.
Attachments:
VI.vi ‏52 KB

Hi Vikki,
It took me some time to do that and i am sure that is not the best way to do it but finally it works.
Hopefully that's good for your application. Have a look at the modified version.
Attachments:
VI[1].vi ‏50 KB

Similar Messages

  • Problem whit Update Operation, Error UPDATE_ROW_CONFLICT with Oracle DB

    Hello friends!, I have a problem whit UPDATE Operation with a Oracle DataBase, but it is rare because it works in "Java Sun Application Server" and not in Tomcat (5.5.12) , displaying the following error:
    "Error :Number of conflicts while synchronizing: 1 SyncResolver.UPDATE_ROW_CONFLICT row 5 values changed in database"
    part of the file log:
    "SEVERE: Error Description
    java.lang.RuntimeException: Number of conflicts while synchronizing: 1 SyncResolver.UPDATE_ROW_CONFLICT row 5 values changed in database
         at com.sun.data.provider.impl.CachedRowSetDataProvider.commitChanges(CachedRowSetDataProvider.java:878)
         at ido02004.EditPerson.saveButton_action(EditPerson.java:519)
    For any change of columns for table in Data Base.
    The code used in the page (EditPerson.jsp) is:
    public void init() {
    Object pid = getSessionBean1().getCurrentPersonId();
    RowKey personRowKey = ido_personsDataProvider.findFirst("PERSON_ID", pid);
    ido_personsDataProvider.setCursorRow(personRowKey);
    public String saveButton_action() {
    try {
    ido_personsDataProvider.setValue("USER_ID", userDD.getSelected());
    ido_personsDataProvider.setValue("STATUS", statusDD.getSelected());
    ido_personsDataProvider.setValue("NAME", name.getValue());
    ido_personsDataProvider.setValue("FUNCTION", function.getValue());
    ido_personsDataProvider.setValue("ADDRESS", address.getValue());
    ido_personsDataProvider.setValue("EMAIL", email.getValue());
    ido_personsDataProvider.setValue("PHONE", phone.getValue());
    ido_personsDataProvider.setValue("VALUATION", valuation.getValue());
    ido_personsDataProvider.commitChanges();
    catch (Exception ex) {
    log("Error Description", ex);
    error("Error :"+ex.getMessage());
    return null;
    Please, Some idea of why gives the error? Help!
    Thanks in advance!
    Ren�
    P.D. Excuse my English.

    Hi All!
    New Info:
    System.out.println(" date created : "+ido_personsDataProvider.getValue("DATE_CREATED"));
    System.out.println(ido_personsDataProvider.getCachedRowSet().getMetaData().getColumnClassName(13));When these lines are printed in Java Sun Application Server for JSC show this:
    [#|2006-05-05T17:12:50.264-0500|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=15;|
    date created : 2006-04-24 00:00:00.0|#]
    [#|2006-05-05T17:12:50.264-0500|INFO|sun-appserver-pe8.1_02|javax.enterprise.system.stream.out|_ThreadID=15;|
    java.sql.Timestamp|#]
    When these lines are printed in Tomcat show this:
    date created : 2006-04-24
    java.sql.Timestamp
    Why? the values of this date is different in one or another server. Problem of driver JDBC? I use driver: to ojdbc14.jar, in Tomcat for the connection to the BD Oracle. Maybe this originates error UPDATE_ROW_CONFLICT...
    Please, any idea?
    Thanks!

  • Problem in 'INS' operation in fm 'HR_INFOTYPE_OPERATION'

    Hi All,
    I am reading a text file and based on Rate type we have to do insertion or copy.
    If rate type is 'A' then we have to do copy operation with the help of fm 'HR_INFOTYPE_OPERATION'.
    If its 'C' then we have to do operation 'INS'.
    But while calling that fm with 'INS' operation its not inserting and giving an error-
    'Infotype 0171 could not be read for person 00060120 on 09/15/2010'.
    I tried giving other begda also but its not taking.
    I thought of creating new entry in infotype '0171' with this pernr but not able to create.
    Can anyone tell me what is the problem in 'INS' operation in this fm  'HR_INFOTYPE_OPERATION'.
    Thanks,
    Nidhi Srivastava

    Hi Nidhi,
    Did u check the PA30 transaction to insert the 0171 record manually for this employee.
    You can trace back to the error by setting the import parameter DIALOG_MODE of FM to '1', as this will open up the BDC session for PA30 in online mode.
    Thanks,
    RKP

  • Error - ipi, message queue operation failed

    we are trying to startup bmq but its finished with error.
    Please could you help us ?
    BEA MessageQ, V5.0 RP8, Wed Mar 29 13:13:49 EST 2000
    Copyright (c) 2000 BEA Systems, Inc. All rights reserved.
    ************ dmqgcp (12973) 16-FEB-2012 16:31:45 ************
    gcp, group control process for group 102 is running
    ************ dmqqe (12975) 16-FEB-2012 16:31:45 ************
    qe, queuing engine is running
    ************ dmqgcp (12973) 16-FEB-2012 16:31:45 ************
    ipi, message queue operation failed
    ************ dmqgcp (12973) 16-FEB-2012 16:31:45 ************
    gcp, initialization failure
    ************ dmqqe (12975) 16-FEB-2012 16:31:45 ************
    qe, caught signal 15
    ************ dmqqe (12975) 16-FEB-2012 16:31:45 ************
    qe, queuing engine is exiting
    ************ dmqgcp (12973) 16-FEB-2012 16:31:45 ************
    gcp, group control process for group 102 is exiting

    Could you please provide the init file and the OS information,
    Also, Please enable the DMQIPI_TRACE to get more trace if possible, thanks.
    Regards,
    /Lingtao
    Edited by: Lingtao on Mar 6, 2012 2:51 AM

  • I am having a problem in the operation of the program Adobe After Effects CS6

    I am having a problem in the operation of the program Adobe After Effects CS6 operating system windows 7 ultimate 64 bit

    DO not use the Classic theme and check your user privileges/ file permissions on your user folders.
    Mylenium

  • Problem with queues / stacks for a project

    I have to code a calculator that turns an infix expression, where the operator is in the middle, to a postfix expression, where the operators are at the end;
    so, for instance, 5 + 5 would really be 5 5 +, and 5 + 5 * 5 / 5 would be 5 5 5 5 + * /.
    I've gotten the addition and subtraction working fine, the only problem comes when I have to take into account order of operations (so far).
    So, that being said, here is the code:
    import java.util.*;
    public class iCalc {
          * @param args
         public static void main(String[] args) {
         //     Scanner scan = new Scanner(System.in);
         //     System.out.println("Equation:");
         //     String input = "55+5-10%16."; //might have to store each element in a linked list later
         //     evalExp(input);     //calls evalExp with the input
              String input2 = "55 + 5 * 10 + 16";//declare some dummy input
              //121
              String [] items = input2.split(" ");//split the string's elements into an array
              Queue<String> queue = new LinkedList<String>();//the queue
              Stack<String> stack = new Stack<String>();//make a new stack to store operators
              Stack<String> stackOutput = new Stack<String>();//output stack
              for (String s : items) {//scan the array
                  System.out.println("item : " + s);//print out what's being scanned
                  if(isNumber(s)) queue.add(s);//add it onto the queue
                  if(isOperator(s)) stack.push(s);//add it onto the stack
              //converts to postfix here
             while(!stack.isEmpty()) queue.add(stack.pop());
             evalExp(queue, stackOutput);
         public static void evalExp(Queue<String> exp, Stack<String> outputStack)
              System.out.println("Evaluating the expression...");
              int length = exp.size();
              int temp;
         while(length > 0)
              // 55 5 10 16 + * +
              // 55
              try{
                   length--;
                   System.out.println("Trying to see if the element is a number...");
                   if(isMultiplyOrDivide(exp))//is there a multiply or divide operator
                        int spot = findMultiplyOrDividePosition(exp);//if yes, finds its position in the operators and stores it as an int
                        temp = 0;
                        for(String s : exp)
                        {//PROBLEM: After the first iteration, it suddenly has an empty stack exception
                             temp++;//keeps track of how far you are into the queue
                             outputStack.push(exp.remove());//take the head of the queue, and push it onto the stack
                             if(temp == spot+1)
                                  break;     //(if there were enough elements in the queue popped, end this loop
                        outputStack.push(performMath(outputStack.pop(), outputStack.pop(), popTheOperator(exp)));
                   Double MyNum = Double.parseDouble(exp.remove());
                   String MyStackNum = "" + MyNum;
                   outputStack.push(MyStackNum);
                        if(outputStack.size() == 2)
                             length--;
                             String operator = popTheOperator(exp);
                             System.out.println("Two numbers have been popped, time to find the operator...");     
                             outputStack.push(performMath(outputStack.pop(), outputStack.pop(), operator));
                             for(String s : exp)
                                  if(s.equals(operator))
                                       exp.remove(s);
                                       break;
              }     catch(Exception ParseException){
                   outputStack.push(performMath(outputStack.pop(), outputStack.pop(), exp.remove()));               
              while(!outputStack.isEmpty()) System.out.println("The output stack is:" + outputStack.pop());     
         public static boolean isNumber(String s1)
              char[]arr2 = s1.toCharArray();
              for(int i = 0;i<s1.length();i++)
                   System.out.println("checking...." + s1);
                   if((!Character.isDigit(arr2))) return false;
              return true;
         public static boolean isOperator(String s2)
              char[]arr3 = s2.toCharArray();
              for(int i = 0;i<arr3.length;i++)
                   System.out.println("checking...." + arr3[i]);
                   if(findOperator(arr3[i])) return true;
              return false;
         public static boolean findOperator(char op)
                        if(op == '+' ||
                             op == '-' ||
                             op == '/' ||
                             op == '*' ||
                             op == '%' ||
                             op == '^' ||
                             op == '&' ||
                             op == '(' ||
                             op == ')' ||
                             op == '|' ||
                             op == '>' ||
                             op == '<' ||
                             op == '=' ||
                             op == '!' ) return true;          
              return false;          
         // 10 16 + + +
         public static String popTheOperator(Queue<String> myQueue)
              String current = "";
              for(String s: myQueue)
                   if(s.equals("*") || s.equals("/"))
                        current = s;
                   break;
              if(current == "")
                   for(String s: myQueue)
                        if(s.equals("+") || s.equals("-"))
                             current = s;
                             break;
         return current;     
         public static String performMath(String operand1, String operand2, String operator)
              String myString = "";
              double result = 0;
              double temp1 = Double.parseDouble(operand1);
              double temp2 = Double.parseDouble(operand2);
              if(operator.equals("+"))
                   result = temp1 + temp2;
              else if(operator.equals("-"))
                   result = temp2 - temp1;
              else if(operator.equals("/"))
                   result = temp1 / temp2;
              else if(operator.equals("*"))
                   result = temp1 * temp2;
              else if(operator.equals("%"))
                   result = temp1 % temp2;
              else if(operator.equals("^"))
                   result = Math.pow(temp1, temp2);
              else if(operator.equals("&"))
              else if(operator.equals("|"))
                   result = temp1 - temp2;
              else if(operator.equals(">"))
                   if(temp1 > temp2)
                        result = 1;
                   else result = 0;
              else if(operator.equals("<"))
                   if(temp1 < temp2)
                        result = 1;
                   else result = 0;
              else if(operator.equals("="))
                   if(temp1 == temp2)
                        result = 1;
                   else result = 0;
              else if(operator.equals("!"))
                   if(temp1 != temp2) result = 1;
                   else result = 0;
              myString = "" + result;
              return myString;
         public static boolean isMultiplyOrDivide(Queue<String> myQueue)
              for(String s : myQueue)//scan the queue
                   if(s.equals("*") || s.equals("/"))
                        return true;//it has found a multiply/divide operator!
              return false;
         public static int findMultiplyOrDividePosition(Queue<String> myQueue)
              int position = 0;
              for(String s: myQueue)
                   if(s.equals("+") ||
                                  s.equals("-") ||
                                  s.equals("%") ||
                                  s.equals("^") ||
                                  s.equals("&") ||
                                  s.equals("|") ||
                                  s.equals(">") ||
                                  s.equals("<") ||
                                  s.equals("=") ||
                                  s.equals("!")) position ++;
              return position;
    }I think that its trying to remove the head, but because the head was already removed, somehow its not letting it remove it; as if by removing the head, there is no new updated head.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

                   if(isMultiplyOrDivide(exp))//is there a multiply or divide operator
                        int spot = findMultiplyOrDividePosition(exp);//if yes, finds its position in the operators and stores it as an int
                        temp = 0;
                        for(String s : exp)
                        {//PROBLEM: After the first iteration, it suddenly has an empty stack exception
                             temp++;//keeps track of how far you are into the queue
                             outputStack.push(exp.remove());//take the head of the queue, and push it onto the stack
                             if(temp == spot+1)
                                  break;     //(if there were enough elements in the queue popped, end this loop
                        outputStack.push(performMath(outputStack.pop(), outputStack.pop(), popTheOperator(exp)));
                   }the problem is somewhere in here.

  • VISA - unable to queue operation & device reported an input protocol error.

    To summarise I have two main questions:
    How can I clear the VISA operation queue and what causes an input protocol error during transfer?
    I am using a Tektronix AFG3022B Function Generator with latest firmware connected via USB and LabVIEW 2013 SP1 patch 2 (13.0.1f2) 32bit with NI-VISA 5.4.1.
    If I have a small timeout, say 100ms, and perform a save operation and op complete query on the device (*SAV 1;OPC?), then do up to 10 VISA reads; the first few reads time out (as expected), but then I frequently get the following error:
    -1073807305 (0xBFFF0037) VI_ERROR_INP_PROT_VIOL. "Device reported an input protocol error during transfer."
    Once this occurs, the whole VISA session seems to become unstable and lots of the read operations fail returing this error code and not the timeout error (0xBFFF0015 (VI_ERROR_TMO)).
    This only seems to happen when I do save/recall operations (either internal or to a mass storage device connected to the instrument), all other commands/queries timeout for the first few reads (as expected) then return the value. Do you think this is probably down to poor instrument firmware/hardware? Or am I using the VISA incorrectly? I would have thought that attempting to read VISA data to soon should only generate a timeout error and not a protocol error.
    Reason for small timeouts:
    Instead of setting the timeout to 4 seconds and having no way of cancelling the read operation I set the timeout to 100ms and run a for loop up to 40 times ignoring timout errors unless it's the last loop iteration. This means I can the operation within ~100ms.
    What causes the VISA protocol error? I can't find much information on it.
    Once the protocol error occurs and I keep repeating the *SAV command, I get the following error:
    -1073807303 (0xBFFF0039) VI_ERROR_IN_PROGRESS. "Unable to queue the asynchronous operation because there is already an operation in progress."
    Once this error occurs, how can I force a clear on the VISA queue without unplugging/power cycling the instrument?
    Some NI I/O trace captures attached to show what happens and test VI.
    Using LV2014 SP1
    Attachments:
    VISA problems.zip ‏38 KB

    I thought I would try to duplicate your problems, but I only have a Tektronix TDS Scope that has USB.
    I am a big fan of using *OCP? to sync instruments control and your problem is of interest to me
    This very simple write/read returns the *OPC '1' return char consistently between 175-185 ms. No problem
    Trying your short timeout with a loop, I do not get what I or you expected.
    If I run this with an adequate timeout (something well longer than the needed 185 ms) it returns in between 175-185 ms with one time through the for loop. As expected. No problem.
    BUT! If I try setting the timeout to something below the needed 175 ms like your 100ms...
    Sometimes it works but it takes over 2000 ms to return but only goes though the for loop twice.
    But sometime it does not work at all, taking well over 10 sec to exit out of the for loop with a timeout error.
    I never see the queue error that you are seeing
    How long does it take to do a simple *SAV
    I don’t think the queue error is coming from the instrument. You would have to send the instruments the SYSTEM:ERROR? Request before the instrument would report any of the instruments errors. 
    Be sure to set your Termination Char setting. I prefer to turn it off for the Writes so I control when to send it. But turn it on for the Reads
    Also I noticed from your trace files that you use the *OPC? after a *IDN?. This is not needed as you will know the *IDN? is complete when your received the string back. In fact my Tektronix scope did not like it if I sent it "*IDN?;*OPC?\n". It would not send me anything back, not even the IDN.
    Is the SAV command on your instrument so long that you need to be able to break out of the loop?
    Omar

  • Middleware problem -Outbound queue is stuck in SAP R/3 system with message

    Hi Middleware gurus ,
    We are stuck with a serious issue . We are trying to download Business partners from SAP R/3 4.6c system to SAP CRM 5.2 system using CRM Middleware
    Previously we did a successful Initial download of 2 Business partners from SAP R/3 to CRM . Their BP numbers in CRM are 001 and 002 . The Delta load is working fine for the both the BPs which are already downloaded
    Now , the real problem is when we are trying to download a new Business partner . When we set the Filter ( BP no 003 ) in MW adaptor object CUSTOMER_MAIN and start the Initial load again , we see that the Outbound queue is getting stuck with message “STOP” .
    There are two queues generated in SAP R/3 system with names “MASS_CRM_CUSTOME” and “R3AD_CUSTOME” . The status for both the queues is “STOP” and when go for details it mentions “sapsuck ..SAPMSSY1 “ -Message no. SR 053.
    Even we checked the txn SMW01, the Bdocs message is "Recived ( Intermediate state) " for Bdoc type BUPA_MAIN.
    We really don’t as to why the Initial load worked fine with 2 BPs  and later when want to do more BP Initial Load the Outbound queue is getting stuck
    Also , by unlocking the 2nd queue “R3AD_CUSTOME” we are able to release it , but the first queue “MASS_CRM_CUSTOME*” is stuck
    Please help us urgently
    Regards
    Dinesh and Ritvij
    Email : [email protected]
    Mobile -+91=9704933315

    Hi Praveen and other Middleware gurus,
    We checked on this . Actually the RFC is used for connecting to SAP R/3 system.
    We also raised an OSS message on this and found a reply that in transaction CRMM_BUPA_MAP, we can map the required BP . But the SAP support guy recived an error received the error:
    An RFC link is not maintained in the Middleware
    Message no. CRM_BUPA_MAPPING051
    We have set the RFC link , but still the problem continues!!!
    Please help further..
    Regards
    Dinesh and Ritvij

  • Problem with queue timing out?

    Hi all,
    I am using a queue to send a cluster between parallel while loops (producer-consumer); however sometimes, but not on all occasions, the enqueue in the producer seems to "freeze" or maybe timesout for no reason (no timeout value is wired to the enqueue or any other element related to that queue process; so I assume it never timesout)...
    I have checked this and there is data in the cluster that is being enqueued, but the dequeue in the consumer loop is empty... This does not happen on every execution, just occassionally... If I stop and save the vi, it works fine again but the next occurence of this problem.... If I wire 0ms to the enqueue timeout it also works properly again...
    Any suggestions?
    Thanks,
    Jack

    Hi Yamaeda,
    Thanks for the input... Please see code attached (a number of subvis are a missing, but these only help with reading the data file and doing basic analysis on the data after the dequeue).... In a nutshell, there are 3 parallel while loops;  Loop 1: User Interface; Loop2 : Read, Convert, Plot; and Loop 3: Analyse and Write to File.
    The enqueue with the problem is in loop 2 (inside the "Plot" state, then inside the "False" case)... The loop is a rough state machine.
    There are no timeouts on the enqueue in loop 2 or corresponding dequeue in loop 3.... The dequeue does not timeout based on a constant "false" from an indicator when the problem occurs.
    When the dequeue does not work, memory usuage keep increasing until a "Memory Full Error" and the vi aborts.... This does not happen when it runs properly.
    The data being queued can be quite large (upto 1M rows x 7 columns of data and does occur quickly (basically, data in the top graph is min-max decimated based on graph pixel width as I read on the NI white paper for displatying large data sets; the data between the start and stop cursors is then sent as a subarray to the enqueue for a fully display on the bottom graph for closer analysis)... Perhaps the queue is filling? I did not know this was possible (I am using a100ms wait for loop timing).
    Any suggestions greatly appreciated.
    Thanks,
    Jack
    Attachments:
    Neuro Analysis 2.vi ‏461 KB

  • Problem with Queue Implementation

    Hi there !
    I can't solve the implementation of an exercize about Queue.My teacher wrote down just the interface Queue and the first part of the class ArrayQueue implementation.They are the following :
    public interface Queue<E>
       public int size();
       public boolean isEmpty();
       public E front() throws EmptyQueueException;
       public void enqueue (E element);
       public E dequeue() throws EmptyQueueException;
    public class ArrayQueue<E> implements Queue<E>
       public ArrayQueue(int cap)
          capacity = cap;
          Q = (E[]) new Object[capacity];
       public ArrayQueue()
          this(CAPACITY);
    }So the teacher asked to complete the code. I have tried and retried so many times for 3 days.I know it's so easy and I understood how it should work but when I try to write down the code I can't get the final solutions but only mistakes.
    During my attempts my better code was this :
    package queue;
    public class ArrayQueue<E> implements Queue<E>
         @SuppressWarnings("unchecked")
         public ArrayQueue(int cap)
            capacity = cap;
            Q = (E[]) new Object[capacity];
         public ArrayQueue()
            this(CAPACITY);
         public String toString()
            int count = 0;
            for(E element : Q)
                 return count +")"+(String)element;
            count++;
            return null;
         public void enqueue(E element)
              try
                   if(element == null)
                        throw new IllegalArgumentException();
                   if (size() == capacity)
                     throw new FullQueueException();
                   if(Q[rear] == null)
                      Q[rear] = element;
                      rear++;
              catch (FullQueueException e)
                   System.out.println("The Queue is Full !");
         public E dequeue() throws EmptyQueueException
              try
                 E temp;
                 if (isEmpty())
                      Q = (E[]) new Object[capacity];
                      front = 0;
                      rear = 0;
                     throw new EmptyQueueException();
                temp = Q[front];
                 Q[front] = null;
                 front++;
                 return temp;
              catch(EmptyQueueException e)
                   System.out.println("The Queue is Empty !");
              return null;
         public E front() throws EmptyQueueException
              try
                 if(Q[front] == null)
                           front++;
                 if (isEmpty())
                     throw new EmptyQueueException();
                 return Q[front];
              catch(EmptyQueueException e)
                   System.out.println("The Queue is Full !");
              return null;
         public int size()
              return (front + rear);
         public boolean isEmpty()
            return (front == rear);
        public Object[] getQueue()
            return Q;
         protected int capacity;
         public static final int CAPACITY = 1000;
         protected E Q[];
         protected int front = 0;
         protected int rear = 0;
    }But the problems are that I can add the element through the method enqueue() and delete it through dequeue() then,but after deleting it the array size is the same and when I print the array elements I see some null,so if I add a new element I get the message of the class FullQueueException because of the size which it's the same.
    Moreover if I delete all the elements and then I print the value returned by the method front() I get the NullPointerExceptionError because the returned value is null,but I think it should print it ! But he doesn't!
    How should I fix these problems ?
    I also wondered during all my attempts how to repeat this procedure after the array size limit is reached.What I really mean is if I delete the element Q[0] and the index front = 1 and rear = n - 1 for example,how can I add with the method enqueue() a new element in Q[0] again ?
    Can you help me courteously ?
    I hope my explanation was clear because of my English !
    Thanks in Advance !

    Thanks for all your suggestions men ^^ !
    I changed some things in the code :
    package queue;
    public class ArrayQueue<E> implements Queue<E>
         @SuppressWarnings("unchecked")
         public ArrayQueue(int cap)
            capacity = cap;
            Q = (E[]) new Object[capacity];
         public ArrayQueue()
            this(CAPACITY);
         public String toString()
              String s = "[";
              int count = 0;
              for (int i = front; i < rear; i++) {
                   count++;
                   s += Q.toString() + (i < rear - 1 ? "," : "");
              s += "] (" + count + " elements)";
              return s;
         public void enqueue(E element)
              try
                   if (size() == capacity - 1)
              throw new FullQueueException();
                   Q[rear] = element;
                   rear = (rear + 1) % capacity;
              catch (FullQueueException e)
                   System.out.println("The Queue is Full !");
         public E dequeue() throws EmptyQueueException
              try
              E temp;
              if(isEmpty())
              throw new EmptyQueueException();
         temp = Q[front];
              Q[front] = null;
              front = (front + 1) % capacity;
              return temp;
              catch(EmptyQueueException e)
                   System.out.println("The Queue is Empty !");
              return null;
         public E front() throws EmptyQueueException
              try
              if (isEmpty())
              throw new EmptyQueueException();
              return Q[front];
              catch(EmptyQueueException e)
                   System.out.println("The Queue is Empty !");
              return null;
         public int size()
              return (capacity - front + rear) % capacity;
         public boolean isEmpty()
    return (front == rear);
         protected int capacity;
         public static final int CAPACITY = 1000;
         protected E Q[];
         protected int front;
         protected int rear;
    }Now after I delete an element and I use the method enqueue() to add a new one the algorithm does,but
    after I delete all the elements I get an element null when I add the element in the array position n - 1.
    I have fixed the method toString() as pgt told me to do and it's really great,but dunno why sometimes when I delete an element it says the array has 0 elements also if the array is almost full !
    About my code changements,according to my university friend I should reduce front and rear mod the capacity and that's what marlin314 suggested me to do too and I had to change the expression if(size() == capacity) to if(size() == capacity - 1).But the algorithm doesn't work as it should do !                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • Problem with Queue and linked list

    Hi... i've got an assignment it start like this.
    You are required to write a complete console program in java includin main() to demonstrate the following:
    Data Structure: Queue, Priority Queue
    Object Involved: Linked-List, PrintJob
    Operations Involved:
    1. insert
    2. remove
    3. reset
    4. search
    Dats all... I've been given this much information... Can any1 try to help me please... How to make a start??? And wat does the print job means???
    Can any1 tell me wat am supposed to do...

    Hi,
    Why don't you start your demo like this?
    import java.io.IOException;
    public class Demo {
         public Demo() {
         public void startDemo() throws IOException {
              do {
                   System.out.println("String Console Demo ");
                   System.out.println("\t" + "1. Queue Demo");
                   System.out.println("\t" + "2. PriorityQueue Demo");
                   System.out.println("\t" + "3. LinkedList Demo");
                   System.out.println("\t" + "4. PrintJob Demo");
                   System.out.println("Please choose one option");
                   choice = (char) System.in.read();
                   showDemo(choice);
              } while (choice < '1' || choice > '4');
         public void showDemo(char ch) {
              switch (ch) {
              case '1':
                   System.out.println("You have chosen Queue Demo ");
                   showOperations();
                   break;
              case '2':
                   System.out.println("You have chosen Priority Queue Demo ");
                   showOperations();
                   break;
              case '3':
                   System.out.println("You have chosen LinkedList Demo ");
                   showOperations();
                   break;
              case '4':
                   System.out.println("You have chosen Print Job Demo ");
                   showOperations();
                   break;
         private void showOperations() {
              System.out.println("Please choose any operations ");
              System.out.println("\t" + "1. Insert ");
              System.out.println("\t" + "2. Remove ");
              System.out.println("\t" + "3. Reset ");
              System.out.println("\t" + "4. search ");
         public static void main(String[] args) throws IOException {
              Demo demo = new Demo();
              demo.startDemo();
         private char choice;
    Write a separate classes for the data structures show the initial elements and call the methods based on the operations then show the result.
    Thanks

  • Problem with queue and context change JAVA udf

    Hi all,
    MY scenorio is from source i get multiple instances and each instance i need to pass to different fields od target
    in one source instance i may get multiple values which i have to create multple nodes under one target instance.
    my source xml looka like below:
    - <CustomFieldsSegment>
    - <CustomFields Name="ForeignLanguageonPackaging">
      <Value Qualifier="en">English</Value>
      <Value Qualifier="fr">French</Value>
      </CustomFields>
    - <CustomFields Name="LayerHeight">
      <Value>5.0</Value>
      </CustomFields>
    - <CustomFields Name="LayerHeightUOM">
      <Value Qualifier="IN">Inches</Value>
      </CustomFields>
      </CustomFieldsSegment>
      </TargetMarketData>
      </ItemRegistration>
      </Payload>
      </ns:MT_TradeItemsExport>
    in the above xml the first custom field has qualifier "en' and "fr"
    i need to create 2 nodes under one target field.
    example:
    <AttrMany Name="ForeignLanguageonPackaging">
      <Value ="en">en</Value>
      <Value ="fr">fr</Value>
      </AttrMany>
    int eh source node <CustomFields Name="ForeignLanguageonPackaging"> may come in any matter .doesnt come always first
    and i wrote udf like below:
    public void queue(String[] a,String[] b,String[] c,ResultList result,Container container){
        // write your code here
    AbstractTrace traceObj = container.getTrace();
        int baseArrayIndex = 99;
        int ccCount = 0;
        boolean isfound = false;
        for (int i = 0; i < a.length; i++) {
               isfound = false;
            if (a<i>.equals(c[0])) {
            baseArrayIndex = i;
      traceObj.addInfo("initial  "+ i);
            for (int j = 0; j < b.length; j++) {
                if (b[j].equals(ResultList.CC)) {
                ccCount++;
                } else {
                if ( baseArrayIndex == ccCount ) {
                   result.addValue(b[j]);
      traceObj.addInfo("result  "+ b[j]);
                    isfound = true;
            break;
    if (!isfound)
    result.addSuppress();
      traceObj.addInfo("final result  "+ result);
    Please can anyone help me.
    Regards,
    jyothi

    Hi all,
    MY scenorio is from source i get multiple instances and each instance i need to pass to different fields od target
    in one source instance i may get multiple values which i have to create multple nodes under one target instance.
    my source xml looks like below:each ItemRegistration is one item at target
    -<ItemRegistration>
    - <CustomFieldsSegment>
    - <CustomFields Name="ForeignLanguageonPackaging">
    <Value Qualifier="en">English</Value>
    <Value Qualifier="fr">French</Value>
    </CustomFields>
    - <CustomFields Name="LayerHeight">
    <Value>5.0</Value>
    </CustomFields>
    - <CustomFields Name="LayerHeightUOM">
    <Value Qualifier="IN">Inches</Value>
    </CustomFields>
    </CustomFieldsSegment>
    </TargetMarketData>
    </ItemRegistration>
    -<ItemRegistration>
    - <CustomFieldsSegment>
    - <CustomFields Name="ForeignLanguageonPackaging">
    <Value Qualifier="en">English</Value>
    <Value Qualifier="fr">French</Value>
    </CustomFields>
    - <CustomFields Name="LayerHeight">
    <Value>5.0</Value>
    </CustomFields>
    - <CustomFields Name="LayerHeightUOM">
    <Value Qualifier="IN">Inches</Value>
    </CustomFields>
    </CustomFieldsSegment>
    </TargetMarketData>
    </ItemRegistration>
    </Payload>
    </ns:MT_TradeItemsExport>
    in the above xml the first custom field has qualifier "en' and "fr"
    i need to create 2 nodes under one target field.
    example:
    <AttrMany Name="ForeignLanguageonPackaging">
    <Value ="en">en</Value>
    <Value ="fr">fr</Value>
    </AttrMany>
    int eh source node <CustomFields Name="ForeignLanguageonPackaging"> may come in any matter .doesnt come always first
    and i wrote udf like below:
    public void queue(String] a,String[ b,String[] c,ResultList result,Container container){
    // write your code here
    AbstractTrace traceObj = container.getTrace();
    int baseArrayIndex = 99;
    int ccCount = 0;
    boolean isfound = false;
    for (int i = 0; i < a.length; i++) {
    isfound = false;
    if (a.equals(c[0])) {
    baseArrayIndex = i;
    traceObj.addInfo("initial "+ i);
    for (int j = 0; j < b.length; j++) {
    if (b[j].equals(ResultList.CC)) {
    ccCount++;
    } else {
    if ( baseArrayIndex == ccCount ) {
    result.addValue(b[j]);
    traceObj.addInfo("result "+ b[j]);
    isfound = true;
    if (!isfound)
    result.addSuppress();
    traceObj.addInfo("final result "+ result);
    if i have only one item at the source it is working but when 2items are comming from the source my udf is not working.
    can anyone help me if you have faced the similar problem or who is fimilar like this kind.
    Regards,
    jyothi
    Edited by: jyothi vonteddu on Oct 21, 2009 9:14 PM
    Edited by: jyothi vonteddu on Oct 21, 2009 9:22 PM

  • New problem again, This operation could not completed as there's no video

    I don' t understand what is the problem, I work with FCP 6.0 and Quicktime 7.4.1 very well until today, when I tray to capture from DV devices ( note that the capture window says PREVIEW DISABLED , but I can remote the camera, mark tc in , out FFW REW etc, message VTR IS OK) The capture is aborted with this message THIS OPERATION COULD NOT COMPLETED AS THERE IS NO VIDEO, when I tray to capture from JVC PRO HD there is no problem. ANY IDEAS????? I'm not work whit another FCP version because with other version there is a problem with JVC PRO HD DEVICES . I note that I'm not the only one with this problem, another curiosity is that at this mooring I capture a tape without a problem but with the second tape start the problem when I thread the tape. Who is possible that the problems are like a miscellanies problem. In the system profile the Camera and vcr dv appears connected to the mac. The fire wire is ok.
    <Edited by Moderator>

    Hi of course I use the correct easy setup,Ii tray with different cameras, vcr's, vtr's, dv , Dvcam, I tray with different fire wire etc. Note that "IMOVIE" capture material without problem, same tape, this problem is affected to other people, included me , but for week i no have this problem with FCP 6.0 and Quicktime 7.4.1 this problem starting to day in the middle of the batch capture, the first tape was captured , but in the second tape start the message, WAITING FOR TIME CODE, THE DEVICE MUST SET IN VTR MODE, of course that this two things are ok, and appears then message "This operation could not completed as there's no video" Note that quicktime pro is unable to capture material from DV device too. Imovie work OK with the same camera and vtr and the same tape. The problem is quicktime and FCP.
    http://discussions.apple.com/message.jspa?messageID=7418664#7418664
    http://discussions.apple.com/message.jspa?messageID=7390713#7390713
    http://discussions.apple.com/message.jspa?messageID=7365555#7365555
    http://discussions.apple.com/message.jspa?messageID=7344941#7344941
    http://discussions.apple.com/message.jspa?messageID=7335764#7335764
    http://discussions.apple.com/message.jspa?messageID=7335763#7335763

  • Problem with zip operating system command

    Hello,
    i have the following configuration in the file receiver adapter:
    Directory: /tmp/
    File Name Scheme: %name%.txt
    Variable substitution:
    Variable Name: name                 Reference: payload: record,1,name,1
    Run Operating system command:
    /usr/bin/zip /tmp/%f.zip %F
    The execution is succesful, but i have a small problem. The file name is "file.txt.zip", the .txt should appear but i dont know how to skip it, I have tried so many ways but it doesnt work, I should receive a file called "file.zip" With a file inside in txt format...
    Thanks,
    Luis

    Hi Sriram,
    Thanks, but that wouldnt work out, Im using the %f for my file name, so this move command shouldnt work for me, because my filename changes in every execution, so I cant write something like this: mv file.txt.zip file.zip
    The only solution I see would would be a command which deals with strings and that could remove the four last characters of "%f"..but I havent found anything for doing it.
    Regards,
    Luis

  • Problem with pending operations after migrating to gw2014

    Hi there, this saturday we have migrated to gw2014 from gw2014. We are in a cluster environment.
    We only have one primary domain with one post office, all users are in this post office.
    We have several secondary domains for gwia/webaccess only.
    Mail flow is ok. Mails are coming in and coming out, but administrative message between domains
    are not flowing. For example: if I add a new account in the post office, I cant see this new account
    in secondary. Also, for creating new domains, etc. I dont know whats happening, all mta's are open
    in mta console from the primary. This is a very critical issue for me...
    Where I can debug this pending operations ? How can I know whats happening ? I dont know if I have
    a network issue / problem or its something related to GW system...
    please help!
    Antonio

    Something like that happened to me also. It turned out that the gw install did not copyed the dc files to the mta, poa directory. After copying the dc files manually, admin messages started to flow again.

Maybe you are looking for