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 !                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

Similar Messages

  • Problem with JPA Implementations and SQL BIGINT in primary keys

    I have a general Question about the mapping of the SQL datatype BIGINT. I discovered, that there are some different behaviour depending on the JPA implementation. I tested with TopLink Essentials (working) and with Hibernate (not working).
    Here is the case:
    Table definition:
    /*==============================================================*/
    /* Table: CmdQueueIn */
    /*==============================================================*/
    create table MTRACKER.CmdQueueIn
    CmdQueueInId bigint not null global autoincrement,
    Type int,
    Cmd varchar(2048),
    CmdState int,
    MLUser bigint not null,
    ExecutionTime timestamp,
    FinishTime timestamp,
    ExecutionServer varchar(64),
    ScheduleString varchar(64),
    RetryCount int,
    ResultMessage varchar(256),
    RecordState int not null default 1,
    CDate timestamp not null default current timestamp,
    MDate timestamp not null default current timestamp,
    constraint PK_CMDQUEUEIN primary key (CmdQueueInId)
    The java class for this table has the following annotation for the primary key field:
    @Id
    @GeneratedValue(strategy=GenerationType.IDENTITY)
    @Column(name = "CmdQueueInId", nullable = false)
    private BigInteger cmdQueueInId;
    When using hibernate 3.2.1 as JPA provider I get the following exception:
    avax.persistence.PersistenceException: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
    at org.hibernate.ejb.AbstractEntityManagerImpl.throwPersistenceException(AbstractEntityManagerImpl.java:629)
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:218)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.orm.jpa.SharedEntityManagerCreator$SharedEntityManagerInvocationHandler.invoke(SharedEntityManagerCreator.java:176)
    at $Proxy16.persist(Unknown Source)
    at com.trixpert.dao.CmdQueueInDAO.save(CmdQueueInDAO.java:46)
    at com.trixpert.test.dao.CmdQueueInDAOTest.testCreateNewCmd(CmdQueueInDAOTest.java:50)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at junit.framework.TestCase.runTest(TestCase.java:154)
    at junit.framework.TestCase.runBare(TestCase.java:127)
    at
    Caused by: org.hibernate.id.IdentifierGenerationException: this id generator generates long, integer, short or string
    at org.hibernate.id.IdentifierGeneratorFactory.get(IdentifierGeneratorFactory.java:59)
    at org.hibernate.id.IdentifierGeneratorFactory.getGeneratedIdentity(IdentifierGeneratorFactory.java:35)
    at org.hibernate.id.IdentityGenerator$BasicDelegate.getResult(IdentityGenerator.java:157)
    at org.hibernate.id.insert.AbstractSelectingDelegate.performInsert(AbstractSelectingDelegate.java:57)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2108)
    at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:2588)
    at org.hibernate.action.EntityIdentityInsertAction.execute(EntityIdentityInsertAction.java:48)
    at org.hibernate.engine.ActionQueue.execute(ActionQueue.java:248)
    at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:290)
    at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:180)
    at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:108)
    at org.hibernate.event.def.DefaultPersistEventListener.entityIsTransient(DefaultPersistEventListener.java:131)
    at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:87)
    at org.hibernate.event.def.DefaultPersistEventListener.onPersist(DefaultPersistEventListener.java:38)
    at org.hibernate.impl.SessionImpl.firePersist(SessionImpl.java:618)
    at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:592)
    at org.hibernate.impl.SessionImpl.persist(SessionImpl.java:596)
    at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:212)
    ... 34 more
    This means, that their ID generator does not support java.math.BigInteger as datatype.
    But the code works if I take TopLink essentials as JPA Provider.
    Looking at the spec shows the following:
    In chapter 2.1.4 "If generated primary keys are used, only integral types will be portable." Integral datatypes are byte, short, int, long and char. This would mean, that the Hibernate implementation fits the spec but there seem to be a problem in general with BIGINT datatypes.
    I use a SYBASE database. There it is possible to declare a UNSIGNED BIGINT. The range of numbers is therefore 0 - 2^64 - 1. Since in Java a long is always signed it would mean its range is from -2^63 -1 to 2^63 -1. So a mapping of BIGINT to java.lang.long could result in an overflow.
    The interesting thing is, that I used NetBeans to reverse engineer an existing database schema. It generated for all Primary Keys of Type BIGINT automatically a java.math.BigInteger. But for other fields (not being keys) it mapped BIGINTs to java.lang.long.
    It looks like there are some problems with either the spec itself or the implementation of it. While TopLink seems to handle the problem correctly, Hibernate doesn't. But Hibernate seems to fulfill the spec.
    Is anybody familiar with the Spec reading this and can elaborate a little about this situation?
    Many thanks for your input and feedback.
    Tom

    Not sure if I clearly understand your issue, would be good if you can explain it a bit more clearly.
    "I select a value from LOV and this value don't refresh in the view"
    If you mean ViewObject, check if autoSubmit property is set to true.
    Amit

  • 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 WM_ENHANCMENT implementation

    Hi all,
    I deeply need to use  throughout transaction LT04 (Create Transfer Order from TR) the BADI
    WM_ENHANCMENT wich would allow me to export and record some essential data along with the saving and creation of the order,
    I don't expressly use the existing user exit EXIT_SAPLL03T_001 as it doesn't work within that transaction.
    Problem is I can't find a proper way to implement WM_ENHANCMENT Badi,
    Sure thing it doesn't provide the classic implementation mode in SE18 (Implement.->Create) stopping message is:
    "BAdI definition WM_ENHANCMENT is only provided for SAP internal use",
    Beside: no way to Implementation by using enhancement spot, and/or copying interfaces, classes so on, may be I'm not taking properly the required steps, (I'm still not used to build Badi's implamentation by new way),
    Please; Does anybody would provide me the true goods step by step moves to implement this perculiar Badi from SE18 or SE19, (I repeat the classic Badi impl. can't be done),
    Many thanks in advance,
    Sergio,

    Hi Chauxu, actually I didnu2019t try to use that BADI yet, as we ran for a temporary different solution, at present we schedule a custom program wich goes alone for all new created orders and fill in
    additional data we need, anyway I think I'll give some afford to modify that badi when lu2019ll gett some moment,
    Goodbye,
    Sergio,

  • 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.

  • Problems with "queue" to Media Encoder

    I just downloaded the latest CC updates yesterday which was for AME and PPCC ...
    After the update when i go to >EXPORT> MEDIA > then press queue it locks up/stalls. Nothing goes to AME. I have to keep turning off the process.
    I tried a 3 minute clip and it worked but anything above 20 mins it stalls...
    Rather than "queue" i have to use "export" which means i cannot use premiere pro while it exports my project. I usually have to export 4-5 things from one project so its very time consuming and its waisting alot of my time.
    I tried opening up AME seperately then either drag and drop or go to >add files and adding the sequences from the project, but when i do this i get a message that say "READING XMP' and it just stays like that for ever unless i kill it through task manager...
    I run a production company so these kind of issues are super frustrating and costing me money.
    Im guessing its has someonthing to do with the new updates as this wasnt occuring before the updates... has anyone had same issues ?
    Shouldnt be having these basic problems.... Pls fix or help asap ADOBE !!!
    windows 7
    adobecc
    i7-2600K 3.40Ghz
    16GB ram
    just realised some other wierd things since the update..... is there anyway of taking off the latest updates and rolling back to the previous version ?

    Just a comment:
    I'd say you found a workaround...not a solution, though it's helpful to know there IS a way around the problem.
    I'm having a similar problem, and am still searching for an answer. (Unfortunately, my project is due tonight, and I'll suffer the lengthy software-only encoding, spending time in this forum rather than gamble/waste time experimenting/uninstalling/re-installing). This is ruining my Easter weekend.
    This is my 2nd round of problems using CC (a few months back I uploaded a file which went missing for a few days while Adobe scrambled to fix what was apparentyl a widespread problem, while I had to re-build a project from a prior version. That took me days, though I did it before the file I uploaded was "found". And, of course, I encountered the problem following the latest update at the time...just like today's problem).
    I get the sense they're pushing things out, i.e. new "versions"/"updates", before adequate testing is done. I worked in QA for many years in the corp hq of a Fortune 500, and was afraid CC would suffer the "rush" to distribute without proper testing. I feel as if end-users are testing new updates, which makes me question the reliability of new releases. Unfortunately, this raises questions about CC being "professional-level software". If it's not thoroughly tested, how can professionals rely on it?
    End of rant...Thanks.

  • Problems with List Implementation

    I have a list implementation that is like a linked list but contains 'n' elements in each node, set to 8 by default.
    The list has a head node, and a tail node.
    This is a revisit on an assignment, I'm trying to fix it.
    The problem is when a number of elements have been added and then deleted from the end of the list. Then more elements are added.
    I'm using a JUnit test case to test this, and what happens is about 25 elements are added and removed, but when it gets to adding a new elements after recently deleting some items towards the end of the list. My list fails because, I am unable to assign value to my tail from within my iterator.
    The compiletime error I get is:
    Type mismatch: cannot convert from chunklist.ChunkList<T>.Chunk<T> to chunklist.ChunkList<T>.Chunk<T>
    I need to assign my tail to the previous Chunk (node), because in my iterator when I delete a Chunk the tail doesn't get automatically assigned to the previous.
    Anyone know how I can get around this retarded error? or what I can do to solve my problem?
    Edit: casting to Chunk<T> doesn't work either it's the same compiletime error
    I have deleted all irrelevant methods and comments from this: The error is in the deleteChunk() method. I need to point tail back to the previous node there.
    package chunklist;
    import java.util.AbstractCollection;
    import java.util.Collection;
    import java.util.Iterator;
    import java.util.NoSuchElementException;
    public class ChunkList<T> extends AbstractCollection<T>
        @SuppressWarnings({ "unchecked", "hiding" })
        private class Chunk<T>
            private T[] data;
            private Chunk<T> next;
            private int chunkSize;
            public Chunk()
                this.data = (T[])new Object[ARRAY_SIZE];
                this.next = null;
                this.chunkSize = 0;
            public boolean equalsChunk(Chunk<T> c)
                if (c == null)
                    return false;
                else if (this.chunkSize != c.chunkSize)
                    return false;
                else if (this.next != c.next)
                    return false;
                else
                    for(int i=0; i<this.chunkSize; ++i)
                        if (!(this.data.equals(c.data[i])))
    return false;
    return true;
    }// end of Chunk<T>
    @SuppressWarnings({ "hiding", "unchecked" })
    private class ChunkItr<T> implements Iterator<T>
    private Chunk<T> currentChunk;
    private Chunk<T> previousChunk;
    private Chunk<T> nextChunk;
    private int currentElement;
    public ChunkItr()
    currentChunk = (Chunk<T>) head;
    previousChunk = null;
    nextChunk = (Chunk<T>) head.next;
    currentElement = 0;
    @Override
    public boolean hasNext()
    if (currentChunk == null)
    return false;
    else
    if (currentElement < currentChunk.chunkSize)
    return true;
    return (currentChunk.next != null);
    @Override
    public T next()
    if (!hasNext())
    throw new NoSuchElementException();
    T elementToReturn = null;
    while (elementToReturn == null)
    if ((currentElement == ARRAY_SIZE) ||
    (currentElement == currentChunk.chunkSize))
    previousChunk = currentChunk;
    currentChunk = currentChunk.next;
    currentElement = 0;
    if (nextChunk != null)
    nextChunk = currentChunk.next;
    if (currentChunk.data[currentElement] != null)
    elementToReturn = (T) currentChunk.data[currentElement];
    ++currentElement;
    return elementToReturn;
    @Override
    public void remove()
    if (currentChunk == null)
    throw new IllegalStateException();
    else
    for (int i=currentElement-1;i<currentChunk.chunkSize;++i)
    { // shift everything down
    if ( (i != 7) && (i >= 0) )
    currentChunk.data[i] = currentChunk.data[i+1];
    else if (i==7)
    break;
    currentChunk.data[currentChunk.chunkSize-1] = null;
    --currentChunk.chunkSize;
    --numOfElements;
    --currentElement;
    if (currentElement < 0)
    currentElement = 0;
    if (currentChunk.chunkSize <= 0)
    deleteChunk();
    public void deleteChunk()
    if (previousChunk == null) //* @head *//
    if (head.next != null)
    head = head.next;
    currentChunk = (Chunk<T>) head;
    nextChunk = currentChunk.next;
    currentElement = 0;
    else currentElement=0;
    else if (nextChunk == null) //* @tail *//
    currentChunk = previousChunk;
    currentChunk.next = null;
    nextChunk = currentChunk.next;
    currentElement = currentChunk.chunkSize;
    tail = currentChunk; // THIS DOESN'T WORK, << ERROR HERE
    else //* @middle *//
    currentChunk = currentChunk.next;
    previousChunk.next = currentChunk;
    nextChunk = currentChunk.next;
    currentElement = 0;
    // back @ head? (just deleted Chunk before head)
    if (currentChunk.equalsChunk((Chunk<T>) head))
    previousChunk = null;
    } // end ChunkItr
    private static final int ARRAY_SIZE = 8;
    private Chunk<T> head;
    private Chunk<T> tail;
    private int numOfElements;
    public ChunkList()
    head = null;
    tail = null;
    numOfElements = 0;
    public void addNewChunk()
    if (head == null)
    head = new Chunk<T>();
    tail = head;
    else
    tail.next = new Chunk<T>();
    tail = tail.next;
    @Override
    public boolean add(T t)
    if (t == null)
    throw new IllegalArgumentException();
    if (head == null)
    addNewChunk();
    if (tail.chunkSize == ARRAY_SIZE)
    addNewChunk();
    tail.data[tail.chunkSize] = t;
    numOfElements++;
    tail.chunkSize++;
    return true;
    @Override
    public Iterator<T> iterator()
    return new ChunkItr<T>();
    @Override
    public boolean remove(Object o)
    // creates iterator and calls iterators remove method when it finds o.
    Edited by: G-Unit on Nov 14, 2010 5:07 AM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    YoungWinston wrote:
    Possibly, but I suspect you'll need to be prepared to defend your design choice with more than just test results. Why did you choose this pattern? Because it's an assignment. I will do some reading when I get around it to it. But for now I don't have time, and don't care to make time. This assignment was annoying as... So many fiddly little errors that took me too long to figure out. For now I hate Lists, I'm happy using the default ones.
    1. Introduction
    This document is the Project Specification for a ChunkList class to be developed by DBSD202 students this semester.
    2. What you must do
    The requirements specifications are detailed below:
    ChunkList
    In this first part of the assignment we will create a data structure called a ChunkList. The ChunkList class implements the Collection interface and >>serves a replacement for ArrayList or LinkedList. A ChunkList is like a regular linked list, except each node contains a little fixed size array of elements >>instead of just a single element. Each node also contains its own "size" int to know how full it is.
    The ChunkList will have the following features...
    The ChunkList object contains a head pointer to the first chunk, a tail pointer to the last chunk, and an int to track the logical size of the whole >>collection. When the size of the list is 0, the head and tail pointers are null.
    Each chunk contains a fixed size T[] array, an int to track how full the chunk is, and a next pointer. The constant ARRAY_SIZE = 8; in the chunk >>class defines the fixed size of the array. Elements should be added to the array starting at its 0 index. The elements in each little array should be >>kept in a contiguous block starting at 0 (this will require shifting elements around in the little array at times). (You may want to do some testing >>with ARRAY_SIZE set to smaller values, but turn it in set to 8.)
    ChunkList should be a subclass of AbstractCollection which provides some basic facilities built on top of your add(), iterator(), size() etc. primitives. >>Chunk should be an inner class defined inside of ChunkList. Only ChunkList will see or use the Chunk class directly. It's stylistically ok if ChunkList >>accesses the state (.next, .data, ...) of the Chunk objects, since Chunk essentially is just an integrated part of ChunkList. Add utility methods to >>Chunk where it helps to keep things receiver-
    relative (remove for example). ChunkIterator should be a private inner class as in the lecture example.
    ChunkList must support the messages: constructor, add(), size(), and iterator(). The iterator must support hasNext(), next(), and remove(). It's >>valid for the client to add "null" as an element, so you cannot use null as some sort of special marker in the array -- use your size int in each chuck. >>Make sure that size() and hasNext() are consistent about the size of the collection.
    The empty collection should be implemented as null head and tail pointers. Only allocate chunks when actually needed.
    The add() operation should add new elements at the end of the overall collection -- i.e. new elements should always go into the tail chunk. If the >>tail chunk is full, a new chunk should be added and become the new tail. We are not going to trouble ourselves shifting things around to use >>empty space in chunks in the middle of the list. We'll only look at the tail chunk.
    Do not use a dummy node because (a) it does not help the code much, and (b) dummy nodes are lame.
    Keep a single "size" variable for the whole list that stores the total number of client data elements stored in the list, so you can respond to size() in >>constant time. Similarly, keep a separate size in each chunk to know how full it is. Likewise, add(), hasNext(), next(), and remove() should all run in >>O(1) constant time (they may do computations proportional to ARRAY_SIZE, but not proportional to the overall collection length).
    When using iterator.remove() to remove an element from a Chunk, overwrite the pointer to that element with a null to help the garbage >>collector. This is not a requirement, but it's a nice touch.
    When an iterator.remove() operation causes a chunk to contain zero elements, that chunk should be removed from the list immediately. The code >>for deletion is quite tricky. You may store a "previous" pointer in each chunk if you wish. It is possible to code it without previous pointers by >>keeping extra pointers in the iterator to remember the two previously seen chunks during iteration. Chunk deletion will need to work for many >>boundary cases -- the first chunk, the last chunk, and so on. This is probably the trickiest part of the whole thing.
    When called with correct inputs, ChunkList should return the correct result. However, when called with incorrect inputs -- e.g. iterator.remove() >>without first calling next() -- ChunkList does not need to do anything in particular. It's fine if
    your code just gives the wrong output or throws a null pointer or other exception. This is a slight relaxation of the formal Collection interface which >>guarantees to throw particular exceptions for particular errors.
    ChunkList Advice — Tight Code
    The ChunkIterator is a tricky bit of code. There are about 4 different cases to get right, depending on if the removed chunk was first or last in the >>list. Don't have a separate copy of the remove code for each special case. If you find yourself copying and pasting code, you're doing it wrong. >>Clean up the solution so there is one copy of the remove code and then a few lines to deal with the special cases. This is just general coding style >>advice – avoid proliferating copies of the code for slightly different cases. Try to factor the code down so one copy of the code deals with many >>cases. The remove() method should be about 15 lines long.
    Testing
    The ChunkList is extremely well suited to unit-testing. This is good, since the ChunkList has such a large number of tricky little boundary cases >>where it can go awry. We will unit-test the ChunkList aggressively, since it's the best way to get the code right.
    1. ChunkList Basic Testing
    To get started, write some basic unit tests that build up a ChunkList of Strings with add(), and then iterate over it and remove a few elements, >>checking that the list look right before and after the removes. These tests will get the most basic add()/iterator()/remove() code working.
    2. ChunkList Super Test
    I will provide code for an extremely aggressive test on the ChunkList. Only try this after your basic tests are working. Because the ArrayList (known >>to be correct) and the ChunkList both implement the Collection interface, we can use a unit-test strategy where we do the same operation on >>both an ArrayList and ChunkList, and then verify that they get the same output after each operation.
    The SuperTest creates both an ArrayList and a ChunkList. We'll call an "operation" either a single addition or an iteration down the collection doing >>a few random removes. Do the same random operation to both the ArrayList and ChunkList, and then check that the two look the same, element >>by element. Then loop around and do that 4999 more times, checking the two again after each random operation. We want to push on the >>ChunkList
    to get every weird combination of list length and this or that chunk being full or empty at the time of add or series of removes in some position.
    When you get it take a look at the SuperTest code. It creates a Random(1) for its random number generation, object passing 1 as the seed. In >>this way, the series of "random" operations is the same every time the test is run.
    3. ChunkList SpeedTest
    The unit-tests should work on the correctness of the ChunkList, and that's the most important thing. Look at the source of the provided >>ChunkSpeed class and try running it. It runs a timing test on the ArrayList, LinkedList, and ChunkList classes. The test is a crude simulation of >>collection add/remove/iterate use. ChunkSpeed prints the milliseconds required to do the following representative mix of operations...
    - Use add() to build a 50,000 element collection
    - Create an iterator to iterate halfway through the collection
    - Use the iterator to remove 10,000 elements at that point
    - Creates and runs iterators to run over the whole collection 5 times
    The speeds seen depend on many factors, including the ARRAY_SIZE, the specific hardware, the system load, JVM version, etc., and some runs >>will be way off because the GC thread runs during part of the test. Broadly speaking, on average the ChunkList should be roughly as fast or faster >>than the LinkedList, and a lot faster (a factor of 10 or so) than the ArrayList. The speed numbers have a lot of noise in them, so don't worry about >>a single run. The ChunkList might be slower than the LinkedList on occasion. However, if your ChunkList is consistently slower than the Linked List >>or ArrayList, there is probably something wrong with your ChunkList algorithm -- some operation that is supposed to be O(1) is O(n). The most >>important methods to be fast are hasNext() and next(), since they are the most commonly called by the client.Edited by: G-Unit on Nov 15, 2010 7:31 AM
    Edited by: G-Unit on Nov 15, 2010 7:44 AM

  • 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

  • Problem with Queues

    I have two sensors on a conveyor system that will determine if an object needs to be rejected or not. Another sensor is located 80 cm away where the object will be kicked off the conveyor belt. I was told to use queues but haven't had any luck so far. Could someone explain how they work, and if possible, post a sample code roughly relating to my conveyor system? Thank you!
    Solved!
    Go to Solution.

    Think of a queue as a line at the movie theater. As people come up they get in line. When the person selling tickets is ready they will get the first person in line and sell them a ticket. As more people arive they will get in the end of the line. This process will continue until there is no one left in line. The ticket seller will always take the person at the front of the line and new people will be placed at the end of the line.
    There are examples that ship with LabVIEW illustrating how to use queues. Use the example finder and search for queues.
    As for your particular situation more detail would be needed in order to give better advice.
    Mark Yedinak
    "Does anyone know where the love of God goes when the waves turn the minutes to hours?"
    Wreck of the Edmund Fitzgerald - Gordon Lightfoot

  • Problem with SQLData implementation

    Hi,
    I am facing a problem while retrieving an ARRAY.
    I am using jdbc thin driver 8.1.7.1 (patched version) to connect to the 9i Database(9.0.1.2.0).
    Code:
    public class Employee implements SQLData
         public int iEmpNumber;
         public String strName;
         Address[] objEmpAddress;
         String sql_type="APPS.EMPLOYEE";
         public Employee()
         public String getName()
              return strName;
         public Employee(int iEmpNumber,String strName,Address[] objEmpAddress)
              try
                   this.iEmpNumber=iEmpNumber;
                   this.strName=strName;
                   this.objEmpAddress=objEmpAddress;
              }catch(Exception e){}
         public String getSQLTypeName() throws SQLException
         return sql_type;
         public void readSQL(SQLInput stream, String typeName)
         throws SQLException
              sql_type =typeName ;
              iEmpNumber = stream.readInt();
              strName = stream.readString();
              Array b=stream.readArray();
    ****Here I am getting b as null**********************************
    Object[] d=(Object[])b.getArray();
              Address[] e=new Address[d.length];
              for(int i=0;i<d.length;i++)
                   e=(Address)d[i];
              objEmpAddress=e;
         public void writeSQL(SQLOutput stream)
         throws SQLException
              try{
              OracleConnection conn=(OracleConnection)DriverManager.getConnection ("jdbc:oracle:thin:@nandini:1510:crp","sadas", "asd");
              stream.writeInt(iEmpNumber);
              stream.writeString(strName);
              ArrayDescriptor desc = ArrayDescriptor.createDescriptor("APPS.ADDTABLE",conn);
              ARRAY a=new ARRAY(desc,conn,objEmpAddress);
              stream.writeArray(a);
              }catch(Exception e){ System.out.println("Exception Occured in writeSQL of Employee"+e);}
    Any suggestion would be greatly helpful.
    Thanks and Regards,
    Ramesh Jetty.

    Hi Curt,
    I could do that also but this would sort of defeat the purpose of taking advantage
    of using the DB Control in Workshop. The DB Control is supposed to take care
    all of the DB connection logic for us.
    Bao.
    "Curt Smith" <[email protected]> wrote:
    >
    That tact I would have take wuold have packaged the std logic to get
    initialcontext
    and lookup on my other conn pool JNDI name. I can't imagine why this
    tact would
    fail.
    What's your thoughts?
    curt

  • Problem with Queue and threads

    Hello,
    the following is the code :
    public class Tester extends Thread
    private String fname;
    public String getFname()
       return fname;
    public void setFname(String fname)
       this.fname = fname;
    public Tester(String fname){
       super();
      this.fname = fname;
    }Heres another class
    class N {
        Thread r = null;
        public void checkQ()
          Queue q = new ConcurrentLinkedQueue<N>();
          for(int i = 0; i < 13; i++)
             System.out.println("FOR I is "+i);
             r = new Tester("Name" + i);
             q.offer(r);
             processq(q);
        public void processq(Queue queueOfM)
           if(queueOfM.size() > 10)
              System.out.println("size of queueofM is "+queueOfM.size());
            for(int j=0; j < queueOfM.size();j++)
                 System.out.println("J is "+j);
                 this.r = (Thread)queueOfM.poll();
                 this.r.start();
       }When run, the code prints :
    FOR I is 0
    FOR I is 1
    FOR I is 2
    FOR I is 3
    FOR I is 4
    FOR I is 5
    FOR I is 6
    FOR I is 7
    FOR I is 8
    FOR I is 9
    FOR I is 10
    size of queueofm is 11
    J is 0
    J is 1
    J is 2
    J is 3
    J is 4
    J is 5
    FOR I is 11
    FOR I is 12I was expecting the code to print the J till 11.
    Could you please help me find where I went wrong ?

    I think I may have been asking a wrong question.
    class N {
        Thread r = null;
        public void checkQ()
          Queue q = new ConcurrentLinkedQueue<N>();
          for(int i = 0; i < 13; i++)
             System.out.println("FOR I is "+i);
             r = new Tester("Name" + i);
             q.offer(r);
             processq(q);
        public void processq(Queue queueOfM)
           if(queueOfM.size() > 10)
              System.out.println("size of queueofM is "+queueOfM.size());
            for(int j=0; j < queueOfM.size();j++)
                 System.out.println("J is "+j);
                 this.r = (Thread)queueOfM.poll();
                 this.r.start();
              }The if in the processq method will come true when I is 11. so, once in the if, the for loop is executed. The j is checked till it is < 11 and then the value of j is being printed. So, as I was expecting J should print till atleast 10. However it is printing till 5 and quitting the loop, I dont know how or why, for which I was thinking if someone could show me why.

  • Problem with Queue Table while dropping schema

    Hi,
    I want to DROP a schema, but it gives the following error while trying to drop it:
    ORA-00604: error occurred at recursive SQL level 1
    ORA-24005: must use DBMS_AQADM.DROP_QUEUE_TABLE to drop queue tables
    From TOAD, I found that no queue or queue_table exists in the database presently.
    I'm using 10.2.0.2 RAC database.
    Can anyone help me to drop the schema?
    Thanks in advance..
    Regards,
    Anjan

    I have followed the doc 203225.1..
    Now getting the following error:
    ORA-00081: address range [0x60000000000A89A0, 0x60000000000A89A4) is not readable
    ORA-00600: internal error code, arguments: [kzdukl3], [24], [], [], [], [], [], []

  • Problem with Queue

    Scenario is SAP ->XI -> Target system. Here Im using BPM to collect Idocs.
    But when I trigger IDoc frm WE19,the message coming to XI and getting inside the queue always.
    When I clicked on the blocked message its giving err saying that "Password logon no longer possible - too many failed"
    What may be the prob here?
    Please help here.
    Thanks,
    Regards,
    Naresh

    Hi,
    This error "Password logon no longer possible - too many failed" can be handled by the security team who would recreate a new password for the user and distribute it to the other systems.
    Thanks
    Krithika

  • 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

  • Thread safe Queue implementation

    Dear all,
    I have implemented Queue functionality using Blocking concurent linked list based java queue, but i am facing problem of deadlock/program hang.
    There are 10 threads which are trying to see that is there any object in Queue, they get that object and process it.
    Any idea what is wrong ??
    Thanks
    public class MyQueue
        private LinkedBlockingQueue<Object>  elements;
        private Object obj;
        public MyQueue() {
            elements = new LinkedBlockingQueue<Object>();
            obj=null;
        public Object pull() {
             try {
                   obj = elements.take();
              } catch (InterruptedException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
              return obj;
        public void push(Object o) {
             try {
                   elements.put(o);
              } catch (InterruptedException e) {
                   // TODO Auto-generated catch block
                   e.printStackTrace();
        public Object[] removeAllObjects() {
            Object[] x = elements.toArray();
            elements.clear();
            return x;
    }

    Thanks,
    I analyzed the hanged/deadlocked program by killing its process with command "kil -3 <pid>"
    i have seen following state for my JobHandler threads
    is any wrong with Queue implementation or some thing else , Any idea?
    "JobHandler" prio=10 tid=0xaec22000 nid=0x51c7 waiting on condition [0xaeb0b000..0xaeb0c030]
       java.lang.Thread.State: WAITING (parking)
            at sun.misc.Unsafe.park(Native Method)
            - parking to wait for  <0xee01fa00> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
            at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
            at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await(AbstractQueuedSynchronizer.java:1925)
            at java.util.concurrent.LinkedBlockingQueue.take(LinkedBlockingQueue.java:358)
            at MyQueue.pull(MyQueue.java:89)
            at JobHandler.run(JobHandler.java:264)

Maybe you are looking for

  • Convert CLOB to LONG

    I have an app that has a CLOB column in a table. The reporting software, which is separate from the application, cannot read CLOBs. So the solution that was revealed to me was to setup a trigger to copy any data going into the CLOB table to another t

  • Again Billing problem again

    I have again problem in my billing information and I can put any credit card to buy anything

  • Multiple static synchronized methods locking the same object ?

    If I have multiple static synchronized methods in a class will all the methods lock on the same (Class) object ? I guess the answer to this would be yes. In that case is it possible achieve synchronization without an object ie code level synchronizat

  • REM wip and moving average price

    Hi, I am working in REM scenario. my fert item is having moving average price say Rs 2.Currently zero stock of finished item. I am having a planned orderA quantity 10  from Oct 1st to nov 30th. when i do backflush at nov 30 , i do assembly backflush

  • TS3772 unhappy renter

    doesn't matter how many times I install/uninstall quicktime, ITunes won't recognise it. What a piece of Poo!