Here's A Question Using A Priority Queue and a DLL
Ifm trying to make a method that compares two objects that go into a DLL using a priority Queue. SO in other words lets say i have "5" go ino the DLL and then i have "2" that goes in i need to swap the 2 and the 5. And this goes on for any other objects inserted
private Comparable minPosition() throws EmptyPriorityQueueException {
if (size() == 0)
throw new EmptyPriorityQueueException ("No Elements In The Queue");
else
now this is what i got so far....but i know that i have toi make to vaiables and compare them? little help please?
Thanks
Um, well im using the adapter class, List. so ive gone a bit further, but im not sure on what to do.....
private Comparable minPosition() throws EmptyPriorityQueueException {
if (size() == 0)
throw new EmptyPriorityQueueException ("No Elements In The Queue");
while (isEmpty()==false)
r = ((Comparable)elements.first());
s = ((Comparable)elements.next(elements));
then i can make r=s and make s serach for the next element,?
Can the experienced programmers help me out? Doesn't seem to be a tuff question.
Similar Messages
-
Is this now where to ask DVD Studio Pro questions? If not, please let me know where. Here's my question: Using DVD Studio Pro 3, when trying to burn a disc which is 4.5GB, I get error message "Not eough disk space in target folder". What to do?
Thanks. Unfortunately, I need to make a master DVD that can then be duplicated in bulk as a single layer disc. This surprises me because I tried burning a different DVD project that has worked in the past which is also 4.5 GB and now I could not burn that either. I also reencoded some material to get the new project down to 4.4 GB but it still would not burn. Any ideas are appreciated.
-
Egress queueing - priority-queues and queue-sets
If I use the priority-queue out command on an interface 3750 does this treat queue1 as the priority queue?
How can I tell which traffic is sent to each queue by default? Or do I have to specifically define it such as
mls qos srr-queue output dscp-map queue 1 threshold 3 40 41 42 43 44 45 46 47
I really want dscp 40-47 to go priority and the rest to be spread evenly across the other 3 queues as the vast majority of the rest of the traffic will be 0. Is there a command that lets the other 3 queues be best effort?
Also, is this an OK config to use with priority-queueing? I don't actually want a large amount of bandwidth for the priority traffic, just for it to be expidited.
Queueset: 2
Queue : 1 2 3 4
buffers : 10 30 30 30
threshold1: 100 200 100 100
threshold2: 100 200 100 100
reserved : 50 50 50 50
maximum : 400 400 400 400
Any help very gratefully received.
Thanks, JSorry, just bouncing this to see if anyone around today can help :)
-
Could anyone here help me with using WebDynpro as view, and Adweb service
Could anyone here help me with using WebDynpro as view, and Adaptive web service as model, I am getting the following error message:
Exception on execution of web service with WSDL URL 'D:\temp\MI_SEARCH.wsdl' with operation 'MI_SEARCH' in interface 'MI_SEARCH'.Hi,
Could you check if it is the Installed JREs in Preference Page -> Java points to the jdk path and not the JRE.
Regards,
Nidhi -
C2960: ingress priority-queue and CoS/DSCP mapping
I have read the C2960 manuals for a few times, but I don't seem to find an answer.
You can enable the priority queue on the ingress interface which has two available input queues for QoS-services.
What seems to be missing from the manuals is that how can I map/direct the traffic (CoS & DSCP values) to the priority queue?
I can map traffic to two other WRR (SRR) queues with command: "mls qos srr-queue input cos-map queue queue-id threshold threshold-id cos1...cos8", but there is nothing about the priority queue.
So is the CoS/DSCP values for the priority queue fixed or how/what traffic is directed to it?
Thanks,
MiskaWhat seems to be missing from the manuals is that how can I map/direct the traffic (CoS & DSCP values) to the priority queue?
A: By default, the priority queue is queue 2, and 10 percent of the bandwidth is allocated to it.
?For queue-id, the range is 1 to 2.
Map DSCP or CoS values to an ingress queue and to a threshold ID.
By default, DSCP values 0-39 and 48-63 are mapped to queue 1 and threshold 1. DSCP values 40-47 are mapped to queue 2 and threshold 1.
By default, CoS values 0-4, 6, and 7 are mapped to queue 1 and threshold 1. CoS value 5 is mapped to queue 2 and threshold 1.
?For queue-id, the range is 1 to 2.
?For threshold-id, the range is 1 to 3. The drop-threshold percentage for threshold 3 is predefined. It is set to the queue-full state.
?For dscp1...dscp8, enter up to eight values, and separate each value with a space. The range is 0 to 63.
?For cos1...cos8, enter up to eight values, and separate each value with a space. The range is 0 to 7.
What above is saying is queue 2 is priority queue, you can use the CoS/DSCP mapping to queue to move certain CoS?DSCP to either queue 1 or queue 2.
I can map traffic to two other WRR (SRR) queues with command: "mls qos srr-queue input cos-map queue queue-id threshold threshold-id cos1...cos8", but there is nothing about the priority queue.
So is the CoS/DSCP values for the priority queue fixed or how/what traffic is directed to it?
A; See above.
For more info:
http://www.cisco.com/univercd/cc/td/doc/product/lan/cat2960/12225see/scg/swqos.htm#wp1161845
Please rate all posts. -
New Here: Application to monitor status of Weblogic queues and bridges
hi
I'm new to weblogic and I have to build a small tool/application to monitor status of Weblogic queues and bridges.
I want to know if there is any API that I can use or any script in Java or any other language?
Thank youfor that kind of stuff maybe the easiest choice is using WLST
there are a number of scripts published on the excellent middlewaremagic.com site
if you google
site:middlewaremagic.com monitoring jms
you will find plenty of stuff -
Question: Using Adobe Premiere CS3 and a Sony GV-HD700
Hi,
My name is Gerry and I am new to the forum. My problem is as follows: I have my Sony player connected via USB2 to my workstation. I am using widows xp sp3 and the device is properly recognized. When I choose capture in Premiere I recieve a message stating that the device is off-line. I power it on and off, but I am not able to see footage in the capture window. My settings are as follows:
Capture settings = Capture Format : HDV
DV/HDV Device Control
Video Standard: NTSC
Device Brand: Sony
Device Type: GV-D300 * I do not see my device type listed in the drop down list
Timecode Format: Auto Detect
Check Status: Offline
The only options I have tried changing is the Device type, also changing the device control from Serial device control to DV/HDV Device Control.
Any direction in this matter will be appreciated.
Regards...The Sony HDV700 will work with CS3 via firewire. Settings on the deck and in CS3 are important.
The HDV700 is too new to have its own settings. Select "Generic Sony," that works for me.
DO NOT set the HDV700 format to AUTO--set it manually to either DV or HDV depending on the tape format. Note also, that its often necessary to turn off the deck and turn it back on before the change is recognized by the PC.
You DO NOT selct serial control--you select Firewire or IEEE (I forget what the option is labeled.
Use the pre-assigned option in setting the sequence parameters (yeah, I know, you're capturing to the project window not the timeline, but this is where CS3 gets the capture settings.) -
Network question / using extreme apple tv and airprt express
I have a wired airport extreme in my office on a pc( i also use it to run 2 mac books wireless) and apple tv in living room.
my question is!!!!
can i put an airport express in my loft and use the ethernet plug wire to connect a pc (it doesnt have wireless) and if so how?Yes, you can use an express to create a network for presentations, your main concern would be configuring it, which you would need to connect it to a computer to do.
-
Video Rendering Question using Premiere Elements 11 and/or Adobe Premiere
The video Rendering /encoding process can take hours even on an I5 processor.
It seems like this has to be done, redone and done again during the editing process.
If I purchase a camera which supports AVCHD 2.0 - does that mean that the encoding process altogether goes away, so that content is able to be transfered natively to the end media and so that I reduce my burn time to a BluRay Disc, using for example, Adobe Premiere Elements 11 or Full Fledged Adobe Premiere, or Sony's Vegas ?
Newbie to Video Editing.AVCHD 2.0 only means that the camera can also record 1080p/60, which was previously not part of the AVCHD specification and still is not part of the Blu-ray spec. It's most useful for smooth slow motion effects.
Anything you add to Premiere Pro will need to be transcoded for Blu-ray, no way around that. -
Grounding question using a PXI-6225 and an SCB-68 TB.
Hi all!
I'm using the configuration in the title of this post to apply signals to a test setup. The SCB-connections have an analog ground that is placed next to each of the analog outputs (i.e. AOGND, AO0, AOGND, AO1...A0GND, AO7, AOGND). I have connected an analog ground (SCB-68 pin 31) and a digital ground (SCB-68 pin 12) to the negative side of my power supply. I belive this will give me a good ground reference for all the cards as I have my other cards grounds tied to this ground as well.
I'm just curious as to why they have so many grounds for the analog signals. I can only assume that it is for EMI or susceptibility. Are those grounds there to help keep the actual waveforms shielded? If I just use the two grounds mentioned I should have a good enough reference, right? I just don't want to mess up another card because I originally set this up and was driving signals with it, but didn't have any of the grounds hooked up to the 6713 card. It worked for some time until the conditions were right and then I had some offset that occurred, which burned up my card.
Any information is appreciated as to the use/need for all these grounds!
Thanks,
DBFirst of all, be sure that you are using the correct pins for each of the analog output channels of the PXI-6225. The PXI-6225 only has 2 analog outputs, and the SCB-68 is a generic connector block for 68-pin cables. I have attached the pinout for the PXI-6225 for your reference when hooking up these grounds.
After you are sure you are using the correct ground pins on the SCB-68, the grounds should be fine with that speed of signal. However, I would recommend using the individual grounds for the AO channels for continuity.
Peter E
Applications Engineer
National Instruments
Attachments:
6225 Pinout.png 107 KB -
Custom order of priority queue
I am a novice in Java. I intend to use a priority queue which holds objects. The objects have a string and two integers. I have to order the priority queue based on one of the integer.
I write syntax according to my understanding please correct me.
PriorityQueue<Object> pr = new PriorityQueue<Object>();
comparable(){
sort(Object.int2)// this is the place where I am confused
}Here's an example:
public class Caller
public static void main(String[] args)
Flight f1 = new Flight( "java", 2, 34 );
Flight f2 = new Flight( "java", 2, 3 );
Flight f3 = new Flight( "java", 2, 4 );
Flight f4 = new Flight( "java", 2, 64 );
Flight f5 = new Flight( "java", 2, 22 );
Flight f6 = new Flight( "java", 2, 12 );
PriorityQueue pq = new PriorityQueue();
pq.add(f1);
pq.add(f2);
pq.add(f3);
pq.add(f4);
pq.add(f5);
pq.add(f6);
System.out.println(pq.poll());
System.out.println(pq.poll());
System.out.println(pq.poll());
System.out.println(pq.poll());
System.out.println(pq.poll());
System.out.println(pq.poll());
public class Flight implements Comparable
private String airlinename;
private int flightnumber;
private int number;
public int compareTo(Object o)
Flight f = (Flight) o;
return number - f.getNumber();
public String toString()
return airlinename + " - " + number;
public Flight(String airname, int num1, int num2)
airlinename = airname;
flightnumber = num1;
number = num2;
public String getAirlinename()
return airlinename;
public void setAirlinename(String airlinename)
this.airlinename = airlinename;
public int getFlightnumber()
return flightnumber;
public void setFlightnumber(int flightnumber)
this.flightnumber = flightnumber;
public int getNumber()
return number;
public void setNumber(int number)
this.number = number;
}Got it? -
Low priority and high priority queue
Hi
we have high priority and low priority queue's. Functionality wise i know that time critical messages will be sent through high priority queue's and low priority messages will be sent
through low priority queues. But like to know what technicality makes this separation of
low priority and high priority queue's ? The crus of the question is what technical setting(s)
makes the queue as high priority and what technical setting(s) makes the queue as low priority
queue.
Thanks
kumari Michal
I am talking abt queue prioritization on Integration eninge only.
I am good with queue prioritization and am able to successfully implement
the same. We are using only PI7.0.
My question is what is the technical difference between high priority
and low priority queues ? what technical setting makes it a high priority
queue and what technical setting makes a low priority queue ?
Your answer:
how the system reacts to new messages if almost all queues are already blocked
for some types of messages
My comment: what setting makes the system to behave like that ? what property
of that queue makes them to behave like that ?
Thanks
kumar -
i have to make a priority queue that uses generics. i already had written a priority queue, and making the key, which was a Comparable, generic was easy, but i don't know how to do it for the data, which is an object. If someone could tell me how that'd be great. here is my code:
public class PriorityQueue<K>{
private int size;
Node first;
//Post: A class to store data, key and next to be used in the PriorityQueue
protected class Node{
Comparable key;
Object data;
Node next;
Node(Comparable k, Object d, Node n){
key = k;
data = d;
next = n;
//Post: Creates an empty queue.
PriorityQueue(){
first = new Node(null, null, null);
//Pre: size() >= 1
//Post: returns the highest priority data item
public Object peekData(){
return first.next.data;
//Pre: size() >= 1
//Post: returns the highest priority key
public Comparable <K> peekKey(){
return first.next.key;
//Post: Inserts the data into the queue at the correct spot based on
// priority determined by its key
public void insert(Comparable <K> key, Object data){
Node newNode = new Node(key, data, null);
Node current = first;
size++;
while(current.next != null && (newNode.key.compareTo(current.next.key)) > 0){
current = current.next;
newNode.next = current.next;
current.next = newNode;
//Pre: size() >= 1
//Post: Deletes the highest priority key and data item
public void remove(){
first.next = first.next.next;
size--;
//Post: returns the number of elements in the queue
public int size(){
return size;
}Pretty much as Stefan says. Here's some code:
public class PriorityQueue<K extends Comparable<K>, D> {
private int size;
private Node first;
// Post: A class to store data, key and next to be used in the PriorityQueue
protected class Node {
K key;
D data;
Node next;
Node(K k, D d, Node n) {
key = k;
data = d;
next = n;
// Post: Creates an empty queue.
PriorityQueue() {
first = new Node(null, null, null);
// Pre: size() >= 1
// Post: returns the highest priority data item
public D peekData() {
return first.next.data;
// Pre: size() >= 1
// Post: returns the highest priority key
public K peekKey() {
return first.next.key;
// Post: Inserts the data into the queue at the correct spot based on
// priority determined by its key
public void insert(K key, D data) {
Node newNode = new Node(key, data, null);
Node current = first;
size++;
while (current.next != null
&& (newNode.key.compareTo(current.next.key)) > 0) {
current = current.next;
newNode.next = current.next;
current.next = newNode;
// Pre: size() >= 1
// Post: Deletes the highest priority key and data item
public void remove() {
first.next = first.next.next;
size--;
//Post: returns the number of elements in the queue
public int size() {
return size;
} -
In the process of using a Priority Queue the question came up about what order elements with equal priority are removed. The two logical orders would be first in, first out, like the standard queue, or first in, last out, like a stack. However, testing the Priority Queue showed that the elements of equal priority were removed in neither order, and moreover, the elements were stored in a neither consistent nor prioritized order. My question is, what causes this situation, is there any way to predict the order in which equally prioritized elements will be removed, and is there any way to force the Priority Queue into removing elements in a first in, first out order without writing my own?
In the process of using a Priority Queue the question came up ...I don' t know why.The Javadoc clearly specifies that 'ties are broken arbitrarily'.
My question is, what causes this situationThe fact that it uses a priority heap algorithm, which is where its O(log(n)) performance comes from.
is there any way to predict the order in which equally prioritized elements will be removedNo.
and is there any way to force the Priority Queue into removing elements in a first in, first out order without writing my own?Encode insertion time as a minor key of the priority.
Maybe you are looking for
-
XL report is not working on office 2010
Hi All our client is having an issue with running her xl reports they have upgraded to SAP8.81 PL 05 " When I run it under Administrator as well as the user on the Terminal Server it opens the XLreporter, when I double-click a file as Administrator I
-
I'm gonna try to be clear with my problem. I have a Gmail Account working on Microsoft Exchange, for IM messaging I'm using Beejive IM with Push and I'm also using Whatsapp. Before Updating it to iOS 5.1.1 all Push notifications were working flawles
-
When I click on the red X to close IE 11 running on Windows 8.1, most of the times it generated the event: Faulting application name: IEXPLORE.EXE, version: 11.0.9600.17278, time stamp: 0x53eea0c3 Faulting module name: ntdll.dll, version: 6.3.9600.17
-
Second hard drive and the Beach Ball
Hello again, time to use the ever helpful Apple boards. I've been having a strange and disturbing problem, disturbing because it always ends in a hard reboot. I have two internal hard drives, one for running software, (called HD) the other for storin
-
No reflections in iPhoto slideshow
I do not have any reflections in iPhoto slideshow, how can I reslove this, do the images have to be a certain quality. Also, annoyingly and probably my lack of knowledge but I have to set the settings for slideshow everytime, is there a master prefer